Metamath Proof Explorer


Theorem allbutfi

Description: For all but finitely many. Some authors say "cofinitely many". Some authors say "ultimately". Compare with eliuniin and eliuniin2 (here, the precondition can be dropped; see eliuniincex ). (Contributed by Glauco Siliprandi, 26-Jun-2021)

Ref Expression
Hypotheses allbutfi.z 𝑍 = ( ℤ𝑀 )
allbutfi.a 𝐴 = 𝑛𝑍 𝑚 ∈ ( ℤ𝑛 ) 𝐵
Assertion allbutfi ( 𝑋𝐴 ↔ ∃ 𝑛𝑍𝑚 ∈ ( ℤ𝑛 ) 𝑋𝐵 )

Proof

Step Hyp Ref Expression
1 allbutfi.z 𝑍 = ( ℤ𝑀 )
2 allbutfi.a 𝐴 = 𝑛𝑍 𝑚 ∈ ( ℤ𝑛 ) 𝐵
3 2 eleq2i ( 𝑋𝐴𝑋 𝑛𝑍 𝑚 ∈ ( ℤ𝑛 ) 𝐵 )
4 3 biimpi ( 𝑋𝐴𝑋 𝑛𝑍 𝑚 ∈ ( ℤ𝑛 ) 𝐵 )
5 eliun ( 𝑋 𝑛𝑍 𝑚 ∈ ( ℤ𝑛 ) 𝐵 ↔ ∃ 𝑛𝑍 𝑋 𝑚 ∈ ( ℤ𝑛 ) 𝐵 )
6 4 5 sylib ( 𝑋𝐴 → ∃ 𝑛𝑍 𝑋 𝑚 ∈ ( ℤ𝑛 ) 𝐵 )
7 nfcv 𝑛 𝑋
8 nfiu1 𝑛 𝑛𝑍 𝑚 ∈ ( ℤ𝑛 ) 𝐵
9 2 8 nfcxfr 𝑛 𝐴
10 7 9 nfel 𝑛 𝑋𝐴
11 eliin ( 𝑋𝐴 → ( 𝑋 𝑚 ∈ ( ℤ𝑛 ) 𝐵 ↔ ∀ 𝑚 ∈ ( ℤ𝑛 ) 𝑋𝐵 ) )
12 11 biimpd ( 𝑋𝐴 → ( 𝑋 𝑚 ∈ ( ℤ𝑛 ) 𝐵 → ∀ 𝑚 ∈ ( ℤ𝑛 ) 𝑋𝐵 ) )
13 12 a1d ( 𝑋𝐴 → ( 𝑛𝑍 → ( 𝑋 𝑚 ∈ ( ℤ𝑛 ) 𝐵 → ∀ 𝑚 ∈ ( ℤ𝑛 ) 𝑋𝐵 ) ) )
14 10 13 reximdai ( 𝑋𝐴 → ( ∃ 𝑛𝑍 𝑋 𝑚 ∈ ( ℤ𝑛 ) 𝐵 → ∃ 𝑛𝑍𝑚 ∈ ( ℤ𝑛 ) 𝑋𝐵 ) )
15 6 14 mpd ( 𝑋𝐴 → ∃ 𝑛𝑍𝑚 ∈ ( ℤ𝑛 ) 𝑋𝐵 )
16 simpr ( ( 𝑛𝑍 ∧ ∀ 𝑚 ∈ ( ℤ𝑛 ) 𝑋𝐵 ) → ∀ 𝑚 ∈ ( ℤ𝑛 ) 𝑋𝐵 )
17 1 eleq2i ( 𝑛𝑍𝑛 ∈ ( ℤ𝑀 ) )
18 17 biimpi ( 𝑛𝑍𝑛 ∈ ( ℤ𝑀 ) )
19 eluzelz ( 𝑛 ∈ ( ℤ𝑀 ) → 𝑛 ∈ ℤ )
20 uzid ( 𝑛 ∈ ℤ → 𝑛 ∈ ( ℤ𝑛 ) )
21 18 19 20 3syl ( 𝑛𝑍𝑛 ∈ ( ℤ𝑛 ) )
22 21 ne0d ( 𝑛𝑍 → ( ℤ𝑛 ) ≠ ∅ )
23 eliin2 ( ( ℤ𝑛 ) ≠ ∅ → ( 𝑋 𝑚 ∈ ( ℤ𝑛 ) 𝐵 ↔ ∀ 𝑚 ∈ ( ℤ𝑛 ) 𝑋𝐵 ) )
24 22 23 syl ( 𝑛𝑍 → ( 𝑋 𝑚 ∈ ( ℤ𝑛 ) 𝐵 ↔ ∀ 𝑚 ∈ ( ℤ𝑛 ) 𝑋𝐵 ) )
25 24 adantr ( ( 𝑛𝑍 ∧ ∀ 𝑚 ∈ ( ℤ𝑛 ) 𝑋𝐵 ) → ( 𝑋 𝑚 ∈ ( ℤ𝑛 ) 𝐵 ↔ ∀ 𝑚 ∈ ( ℤ𝑛 ) 𝑋𝐵 ) )
26 16 25 mpbird ( ( 𝑛𝑍 ∧ ∀ 𝑚 ∈ ( ℤ𝑛 ) 𝑋𝐵 ) → 𝑋 𝑚 ∈ ( ℤ𝑛 ) 𝐵 )
27 26 ex ( 𝑛𝑍 → ( ∀ 𝑚 ∈ ( ℤ𝑛 ) 𝑋𝐵𝑋 𝑚 ∈ ( ℤ𝑛 ) 𝐵 ) )
28 27 reximia ( ∃ 𝑛𝑍𝑚 ∈ ( ℤ𝑛 ) 𝑋𝐵 → ∃ 𝑛𝑍 𝑋 𝑚 ∈ ( ℤ𝑛 ) 𝐵 )
29 28 5 sylibr ( ∃ 𝑛𝑍𝑚 ∈ ( ℤ𝑛 ) 𝑋𝐵𝑋 𝑛𝑍 𝑚 ∈ ( ℤ𝑛 ) 𝐵 )
30 29 2 eleqtrrdi ( ∃ 𝑛𝑍𝑚 ∈ ( ℤ𝑛 ) 𝑋𝐵𝑋𝐴 )
31 15 30 impbii ( 𝑋𝐴 ↔ ∃ 𝑛𝑍𝑚 ∈ ( ℤ𝑛 ) 𝑋𝐵 )