Metamath Proof Explorer


Theorem saddisjlem

Description: Lemma for sadadd . (Contributed by Mario Carneiro, 9-Sep-2016)

Ref Expression
Hypotheses saddisj.1 ( 𝜑𝐴 ⊆ ℕ0 )
saddisj.2 ( 𝜑𝐵 ⊆ ℕ0 )
saddisj.3 ( 𝜑 → ( 𝐴𝐵 ) = ∅ )
saddisjlem.c 𝐶 = seq 0 ( ( 𝑐 ∈ 2o , 𝑚 ∈ ℕ0 ↦ if ( cadd ( 𝑚𝐴 , 𝑚𝐵 , ∅ ∈ 𝑐 ) , 1o , ∅ ) ) , ( 𝑛 ∈ ℕ0 ↦ if ( 𝑛 = 0 , ∅ , ( 𝑛 − 1 ) ) ) )
saddisjlem.3 ( 𝜑𝑁 ∈ ℕ0 )
Assertion saddisjlem ( 𝜑 → ( 𝑁 ∈ ( 𝐴 sadd 𝐵 ) ↔ 𝑁 ∈ ( 𝐴𝐵 ) ) )

Proof

Step Hyp Ref Expression
1 saddisj.1 ( 𝜑𝐴 ⊆ ℕ0 )
2 saddisj.2 ( 𝜑𝐵 ⊆ ℕ0 )
3 saddisj.3 ( 𝜑 → ( 𝐴𝐵 ) = ∅ )
4 saddisjlem.c 𝐶 = seq 0 ( ( 𝑐 ∈ 2o , 𝑚 ∈ ℕ0 ↦ if ( cadd ( 𝑚𝐴 , 𝑚𝐵 , ∅ ∈ 𝑐 ) , 1o , ∅ ) ) , ( 𝑛 ∈ ℕ0 ↦ if ( 𝑛 = 0 , ∅ , ( 𝑛 − 1 ) ) ) )
5 saddisjlem.3 ( 𝜑𝑁 ∈ ℕ0 )
6 1 2 4 5 sadval ( 𝜑 → ( 𝑁 ∈ ( 𝐴 sadd 𝐵 ) ↔ hadd ( 𝑁𝐴 , 𝑁𝐵 , ∅ ∈ ( 𝐶𝑁 ) ) ) )
7 fveq2 ( 𝑥 = 0 → ( 𝐶𝑥 ) = ( 𝐶 ‘ 0 ) )
8 7 eleq2d ( 𝑥 = 0 → ( ∅ ∈ ( 𝐶𝑥 ) ↔ ∅ ∈ ( 𝐶 ‘ 0 ) ) )
9 8 notbid ( 𝑥 = 0 → ( ¬ ∅ ∈ ( 𝐶𝑥 ) ↔ ¬ ∅ ∈ ( 𝐶 ‘ 0 ) ) )
10 9 imbi2d ( 𝑥 = 0 → ( ( 𝜑 → ¬ ∅ ∈ ( 𝐶𝑥 ) ) ↔ ( 𝜑 → ¬ ∅ ∈ ( 𝐶 ‘ 0 ) ) ) )
11 fveq2 ( 𝑥 = 𝑘 → ( 𝐶𝑥 ) = ( 𝐶𝑘 ) )
12 11 eleq2d ( 𝑥 = 𝑘 → ( ∅ ∈ ( 𝐶𝑥 ) ↔ ∅ ∈ ( 𝐶𝑘 ) ) )
13 12 notbid ( 𝑥 = 𝑘 → ( ¬ ∅ ∈ ( 𝐶𝑥 ) ↔ ¬ ∅ ∈ ( 𝐶𝑘 ) ) )
14 13 imbi2d ( 𝑥 = 𝑘 → ( ( 𝜑 → ¬ ∅ ∈ ( 𝐶𝑥 ) ) ↔ ( 𝜑 → ¬ ∅ ∈ ( 𝐶𝑘 ) ) ) )
15 fveq2 ( 𝑥 = ( 𝑘 + 1 ) → ( 𝐶𝑥 ) = ( 𝐶 ‘ ( 𝑘 + 1 ) ) )
16 15 eleq2d ( 𝑥 = ( 𝑘 + 1 ) → ( ∅ ∈ ( 𝐶𝑥 ) ↔ ∅ ∈ ( 𝐶 ‘ ( 𝑘 + 1 ) ) ) )
17 16 notbid ( 𝑥 = ( 𝑘 + 1 ) → ( ¬ ∅ ∈ ( 𝐶𝑥 ) ↔ ¬ ∅ ∈ ( 𝐶 ‘ ( 𝑘 + 1 ) ) ) )
18 17 imbi2d ( 𝑥 = ( 𝑘 + 1 ) → ( ( 𝜑 → ¬ ∅ ∈ ( 𝐶𝑥 ) ) ↔ ( 𝜑 → ¬ ∅ ∈ ( 𝐶 ‘ ( 𝑘 + 1 ) ) ) ) )
19 fveq2 ( 𝑥 = 𝑁 → ( 𝐶𝑥 ) = ( 𝐶𝑁 ) )
20 19 eleq2d ( 𝑥 = 𝑁 → ( ∅ ∈ ( 𝐶𝑥 ) ↔ ∅ ∈ ( 𝐶𝑁 ) ) )
21 20 notbid ( 𝑥 = 𝑁 → ( ¬ ∅ ∈ ( 𝐶𝑥 ) ↔ ¬ ∅ ∈ ( 𝐶𝑁 ) ) )
22 21 imbi2d ( 𝑥 = 𝑁 → ( ( 𝜑 → ¬ ∅ ∈ ( 𝐶𝑥 ) ) ↔ ( 𝜑 → ¬ ∅ ∈ ( 𝐶𝑁 ) ) ) )
23 1 2 4 sadc0 ( 𝜑 → ¬ ∅ ∈ ( 𝐶 ‘ 0 ) )
24 noel ¬ 𝑘 ∈ ∅
25 1 ad2antrr ( ( ( 𝜑𝑘 ∈ ℕ0 ) ∧ ¬ ∅ ∈ ( 𝐶𝑘 ) ) → 𝐴 ⊆ ℕ0 )
26 2 ad2antrr ( ( ( 𝜑𝑘 ∈ ℕ0 ) ∧ ¬ ∅ ∈ ( 𝐶𝑘 ) ) → 𝐵 ⊆ ℕ0 )
27 simplr ( ( ( 𝜑𝑘 ∈ ℕ0 ) ∧ ¬ ∅ ∈ ( 𝐶𝑘 ) ) → 𝑘 ∈ ℕ0 )
28 25 26 4 27 sadcp1 ( ( ( 𝜑𝑘 ∈ ℕ0 ) ∧ ¬ ∅ ∈ ( 𝐶𝑘 ) ) → ( ∅ ∈ ( 𝐶 ‘ ( 𝑘 + 1 ) ) ↔ cadd ( 𝑘𝐴 , 𝑘𝐵 , ∅ ∈ ( 𝐶𝑘 ) ) ) )
29 cad0 ( ¬ ∅ ∈ ( 𝐶𝑘 ) → ( cadd ( 𝑘𝐴 , 𝑘𝐵 , ∅ ∈ ( 𝐶𝑘 ) ) ↔ ( 𝑘𝐴𝑘𝐵 ) ) )
30 29 adantl ( ( ( 𝜑𝑘 ∈ ℕ0 ) ∧ ¬ ∅ ∈ ( 𝐶𝑘 ) ) → ( cadd ( 𝑘𝐴 , 𝑘𝐵 , ∅ ∈ ( 𝐶𝑘 ) ) ↔ ( 𝑘𝐴𝑘𝐵 ) ) )
31 elin ( 𝑘 ∈ ( 𝐴𝐵 ) ↔ ( 𝑘𝐴𝑘𝐵 ) )
32 3 ad2antrr ( ( ( 𝜑𝑘 ∈ ℕ0 ) ∧ ¬ ∅ ∈ ( 𝐶𝑘 ) ) → ( 𝐴𝐵 ) = ∅ )
33 32 eleq2d ( ( ( 𝜑𝑘 ∈ ℕ0 ) ∧ ¬ ∅ ∈ ( 𝐶𝑘 ) ) → ( 𝑘 ∈ ( 𝐴𝐵 ) ↔ 𝑘 ∈ ∅ ) )
34 31 33 bitr3id ( ( ( 𝜑𝑘 ∈ ℕ0 ) ∧ ¬ ∅ ∈ ( 𝐶𝑘 ) ) → ( ( 𝑘𝐴𝑘𝐵 ) ↔ 𝑘 ∈ ∅ ) )
35 28 30 34 3bitrd ( ( ( 𝜑𝑘 ∈ ℕ0 ) ∧ ¬ ∅ ∈ ( 𝐶𝑘 ) ) → ( ∅ ∈ ( 𝐶 ‘ ( 𝑘 + 1 ) ) ↔ 𝑘 ∈ ∅ ) )
36 24 35 mtbiri ( ( ( 𝜑𝑘 ∈ ℕ0 ) ∧ ¬ ∅ ∈ ( 𝐶𝑘 ) ) → ¬ ∅ ∈ ( 𝐶 ‘ ( 𝑘 + 1 ) ) )
37 36 ex ( ( 𝜑𝑘 ∈ ℕ0 ) → ( ¬ ∅ ∈ ( 𝐶𝑘 ) → ¬ ∅ ∈ ( 𝐶 ‘ ( 𝑘 + 1 ) ) ) )
38 37 expcom ( 𝑘 ∈ ℕ0 → ( 𝜑 → ( ¬ ∅ ∈ ( 𝐶𝑘 ) → ¬ ∅ ∈ ( 𝐶 ‘ ( 𝑘 + 1 ) ) ) ) )
39 38 a2d ( 𝑘 ∈ ℕ0 → ( ( 𝜑 → ¬ ∅ ∈ ( 𝐶𝑘 ) ) → ( 𝜑 → ¬ ∅ ∈ ( 𝐶 ‘ ( 𝑘 + 1 ) ) ) ) )
40 10 14 18 22 23 39 nn0ind ( 𝑁 ∈ ℕ0 → ( 𝜑 → ¬ ∅ ∈ ( 𝐶𝑁 ) ) )
41 5 40 mpcom ( 𝜑 → ¬ ∅ ∈ ( 𝐶𝑁 ) )
42 hadrot ( hadd ( ∅ ∈ ( 𝐶𝑁 ) , 𝑁𝐴 , 𝑁𝐵 ) ↔ hadd ( 𝑁𝐴 , 𝑁𝐵 , ∅ ∈ ( 𝐶𝑁 ) ) )
43 had0 ( ¬ ∅ ∈ ( 𝐶𝑁 ) → ( hadd ( ∅ ∈ ( 𝐶𝑁 ) , 𝑁𝐴 , 𝑁𝐵 ) ↔ ( 𝑁𝐴𝑁𝐵 ) ) )
44 42 43 bitr3id ( ¬ ∅ ∈ ( 𝐶𝑁 ) → ( hadd ( 𝑁𝐴 , 𝑁𝐵 , ∅ ∈ ( 𝐶𝑁 ) ) ↔ ( 𝑁𝐴𝑁𝐵 ) ) )
45 41 44 syl ( 𝜑 → ( hadd ( 𝑁𝐴 , 𝑁𝐵 , ∅ ∈ ( 𝐶𝑁 ) ) ↔ ( 𝑁𝐴𝑁𝐵 ) ) )
46 noel ¬ 𝑁 ∈ ∅
47 elin ( 𝑁 ∈ ( 𝐴𝐵 ) ↔ ( 𝑁𝐴𝑁𝐵 ) )
48 3 eleq2d ( 𝜑 → ( 𝑁 ∈ ( 𝐴𝐵 ) ↔ 𝑁 ∈ ∅ ) )
49 47 48 bitr3id ( 𝜑 → ( ( 𝑁𝐴𝑁𝐵 ) ↔ 𝑁 ∈ ∅ ) )
50 46 49 mtbiri ( 𝜑 → ¬ ( 𝑁𝐴𝑁𝐵 ) )
51 xor2 ( ( 𝑁𝐴𝑁𝐵 ) ↔ ( ( 𝑁𝐴𝑁𝐵 ) ∧ ¬ ( 𝑁𝐴𝑁𝐵 ) ) )
52 51 rbaib ( ¬ ( 𝑁𝐴𝑁𝐵 ) → ( ( 𝑁𝐴𝑁𝐵 ) ↔ ( 𝑁𝐴𝑁𝐵 ) ) )
53 50 52 syl ( 𝜑 → ( ( 𝑁𝐴𝑁𝐵 ) ↔ ( 𝑁𝐴𝑁𝐵 ) ) )
54 elun ( 𝑁 ∈ ( 𝐴𝐵 ) ↔ ( 𝑁𝐴𝑁𝐵 ) )
55 53 54 bitr4di ( 𝜑 → ( ( 𝑁𝐴𝑁𝐵 ) ↔ 𝑁 ∈ ( 𝐴𝐵 ) ) )
56 6 45 55 3bitrd ( 𝜑 → ( 𝑁 ∈ ( 𝐴 sadd 𝐵 ) ↔ 𝑁 ∈ ( 𝐴𝐵 ) ) )