Metamath Proof Explorer < Previous   Next > Nearby theorems Mirrors  >  Home  >  MPE Home  >  Th. List  >  sadaddlem Structured version   Visualization version   GIF version

Hypotheses
Ref Expression
sadaddlem.c 𝐶 = seq0((𝑐 ∈ 2𝑜, 𝑚 ∈ ℕ0 ↦ if(cadd(𝑚 ∈ (bits‘𝐴), 𝑚 ∈ (bits‘𝐵), ∅ ∈ 𝑐), 1𝑜, ∅)), (𝑛 ∈ ℕ0 ↦ if(𝑛 = 0, ∅, (𝑛 − 1))))
Assertion
Ref Expression
Distinct variable groups:   𝑚,𝑐,𝑛   𝐴,𝑐,𝑚   𝐵,𝑐,𝑚   𝑛,𝑁
Allowed substitution hints:   𝜑(𝑚,𝑛,𝑐)   𝐴(𝑛)   𝐵(𝑛)   𝐶(𝑚,𝑛,𝑐)   𝐾(𝑚,𝑛,𝑐)   𝑁(𝑚,𝑐)

StepHypRef Expression
1 sadaddlem.k . . . . . . . . . . . . 13 𝐾 = (bits ↾ ℕ0)
21fveq1i 6353 . . . . . . . . . . . 12 (𝐾‘((bits‘𝐴) ∩ (0..^𝑁))) = ((bits ↾ ℕ0)‘((bits‘𝐴) ∩ (0..^𝑁)))
3 sadaddlem.1 . . . . . . . . . . . . . . . 16 (𝜑𝐴 ∈ ℤ)
4 2nn 11377 . . . . . . . . . . . . . . . . . 18 2 ∈ ℕ
54a1i 11 . . . . . . . . . . . . . . . . 17 (𝜑 → 2 ∈ ℕ)
6 sadaddlem.3 . . . . . . . . . . . . . . . . 17 (𝜑𝑁 ∈ ℕ0)
75, 6nnexpcld 13224 . . . . . . . . . . . . . . . 16 (𝜑 → (2↑𝑁) ∈ ℕ)
83, 7zmodcld 12885 . . . . . . . . . . . . . . 15 (𝜑 → (𝐴 mod (2↑𝑁)) ∈ ℕ0)
9 fvres 6368 . . . . . . . . . . . . . . 15 ((𝐴 mod (2↑𝑁)) ∈ ℕ0 → ((bits ↾ ℕ0)‘(𝐴 mod (2↑𝑁))) = (bits‘(𝐴 mod (2↑𝑁))))
108, 9syl 17 . . . . . . . . . . . . . 14 (𝜑 → ((bits ↾ ℕ0)‘(𝐴 mod (2↑𝑁))) = (bits‘(𝐴 mod (2↑𝑁))))
11 bitsmod 15360 . . . . . . . . . . . . . . 15 ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0) → (bits‘(𝐴 mod (2↑𝑁))) = ((bits‘𝐴) ∩ (0..^𝑁)))
123, 6, 11syl2anc 696 . . . . . . . . . . . . . 14 (𝜑 → (bits‘(𝐴 mod (2↑𝑁))) = ((bits‘𝐴) ∩ (0..^𝑁)))
1310, 12eqtrd 2794 . . . . . . . . . . . . 13 (𝜑 → ((bits ↾ ℕ0)‘(𝐴 mod (2↑𝑁))) = ((bits‘𝐴) ∩ (0..^𝑁)))
14 bitsf1o 15369 . . . . . . . . . . . . . 14 (bits ↾ ℕ0):ℕ01-1-onto→(𝒫 ℕ0 ∩ Fin)
15 f1ocnvfv 6697 . . . . . . . . . . . . . 14 (((bits ↾ ℕ0):ℕ01-1-onto→(𝒫 ℕ0 ∩ Fin) ∧ (𝐴 mod (2↑𝑁)) ∈ ℕ0) → (((bits ↾ ℕ0)‘(𝐴 mod (2↑𝑁))) = ((bits‘𝐴) ∩ (0..^𝑁)) → ((bits ↾ ℕ0)‘((bits‘𝐴) ∩ (0..^𝑁))) = (𝐴 mod (2↑𝑁))))
1614, 8, 15sylancr 698 . . . . . . . . . . . . 13 (𝜑 → (((bits ↾ ℕ0)‘(𝐴 mod (2↑𝑁))) = ((bits‘𝐴) ∩ (0..^𝑁)) → ((bits ↾ ℕ0)‘((bits‘𝐴) ∩ (0..^𝑁))) = (𝐴 mod (2↑𝑁))))
1713, 16mpd 15 . . . . . . . . . . . 12 (𝜑 → ((bits ↾ ℕ0)‘((bits‘𝐴) ∩ (0..^𝑁))) = (𝐴 mod (2↑𝑁)))
182, 17syl5eq 2806 . . . . . . . . . . 11 (𝜑 → (𝐾‘((bits‘𝐴) ∩ (0..^𝑁))) = (𝐴 mod (2↑𝑁)))
1918oveq2d 6829 . . . . . . . . . 10 (𝜑 → (𝐴 − (𝐾‘((bits‘𝐴) ∩ (0..^𝑁)))) = (𝐴 − (𝐴 mod (2↑𝑁))))
2019oveq1d 6828 . . . . . . . . 9 (𝜑 → ((𝐴 − (𝐾‘((bits‘𝐴) ∩ (0..^𝑁)))) / (2↑𝑁)) = ((𝐴 − (𝐴 mod (2↑𝑁))) / (2↑𝑁)))
213zred 11674 . . . . . . . . . 10 (𝜑𝐴 ∈ ℝ)
227nnrpd 12063 . . . . . . . . . 10 (𝜑 → (2↑𝑁) ∈ ℝ+)
23 moddifz 12876 . . . . . . . . . 10 ((𝐴 ∈ ℝ ∧ (2↑𝑁) ∈ ℝ+) → ((𝐴 − (𝐴 mod (2↑𝑁))) / (2↑𝑁)) ∈ ℤ)
2421, 22, 23syl2anc 696 . . . . . . . . 9 (𝜑 → ((𝐴 − (𝐴 mod (2↑𝑁))) / (2↑𝑁)) ∈ ℤ)
2520, 24eqeltrd 2839 . . . . . . . 8 (𝜑 → ((𝐴 − (𝐾‘((bits‘𝐴) ∩ (0..^𝑁)))) / (2↑𝑁)) ∈ ℤ)
267nnzd 11673 . . . . . . . . 9 (𝜑 → (2↑𝑁) ∈ ℤ)
277nnne0d 11257 . . . . . . . . 9 (𝜑 → (2↑𝑁) ≠ 0)
28 inss1 3976 . . . . . . . . . . . . . 14 ((bits‘𝐴) ∩ (0..^𝑁)) ⊆ (bits‘𝐴)
29 bitsss 15350 . . . . . . . . . . . . . 14 (bits‘𝐴) ⊆ ℕ0
3028, 29sstri 3753 . . . . . . . . . . . . 13 ((bits‘𝐴) ∩ (0..^𝑁)) ⊆ ℕ0
31 fzofi 12967 . . . . . . . . . . . . . 14 (0..^𝑁) ∈ Fin
32 inss2 3977 . . . . . . . . . . . . . 14 ((bits‘𝐴) ∩ (0..^𝑁)) ⊆ (0..^𝑁)
33 ssfi 8345 . . . . . . . . . . . . . 14 (((0..^𝑁) ∈ Fin ∧ ((bits‘𝐴) ∩ (0..^𝑁)) ⊆ (0..^𝑁)) → ((bits‘𝐴) ∩ (0..^𝑁)) ∈ Fin)
3431, 32, 33mp2an 710 . . . . . . . . . . . . 13 ((bits‘𝐴) ∩ (0..^𝑁)) ∈ Fin
35 elfpw 8433 . . . . . . . . . . . . 13 (((bits‘𝐴) ∩ (0..^𝑁)) ∈ (𝒫 ℕ0 ∩ Fin) ↔ (((bits‘𝐴) ∩ (0..^𝑁)) ⊆ ℕ0 ∧ ((bits‘𝐴) ∩ (0..^𝑁)) ∈ Fin))
3630, 34, 35mpbir2an 993 . . . . . . . . . . . 12 ((bits‘𝐴) ∩ (0..^𝑁)) ∈ (𝒫 ℕ0 ∩ Fin)
37 f1ocnv 6310 . . . . . . . . . . . . . . 15 ((bits ↾ ℕ0):ℕ01-1-onto→(𝒫 ℕ0 ∩ Fin) → (bits ↾ ℕ0):(𝒫 ℕ0 ∩ Fin)–1-1-onto→ℕ0)
38 f1of 6298 . . . . . . . . . . . . . . 15 ((bits ↾ ℕ0):(𝒫 ℕ0 ∩ Fin)–1-1-onto→ℕ0(bits ↾ ℕ0):(𝒫 ℕ0 ∩ Fin)⟶ℕ0)
3914, 37, 38mp2b 10 . . . . . . . . . . . . . 14 (bits ↾ ℕ0):(𝒫 ℕ0 ∩ Fin)⟶ℕ0
401feq1i 6197 . . . . . . . . . . . . . 14 (𝐾:(𝒫 ℕ0 ∩ Fin)⟶ℕ0(bits ↾ ℕ0):(𝒫 ℕ0 ∩ Fin)⟶ℕ0)
4139, 40mpbir 221 . . . . . . . . . . . . 13 𝐾:(𝒫 ℕ0 ∩ Fin)⟶ℕ0
4241ffvelrni 6521 . . . . . . . . . . . 12 (((bits‘𝐴) ∩ (0..^𝑁)) ∈ (𝒫 ℕ0 ∩ Fin) → (𝐾‘((bits‘𝐴) ∩ (0..^𝑁))) ∈ ℕ0)
4336, 42mp1i 13 . . . . . . . . . . 11 (𝜑 → (𝐾‘((bits‘𝐴) ∩ (0..^𝑁))) ∈ ℕ0)
4443nn0zd 11672 . . . . . . . . . 10 (𝜑 → (𝐾‘((bits‘𝐴) ∩ (0..^𝑁))) ∈ ℤ)
453, 44zsubcld 11679 . . . . . . . . 9 (𝜑 → (𝐴 − (𝐾‘((bits‘𝐴) ∩ (0..^𝑁)))) ∈ ℤ)
46 dvdsval2 15185 . . . . . . . . 9 (((2↑𝑁) ∈ ℤ ∧ (2↑𝑁) ≠ 0 ∧ (𝐴 − (𝐾‘((bits‘𝐴) ∩ (0..^𝑁)))) ∈ ℤ) → ((2↑𝑁) ∥ (𝐴 − (𝐾‘((bits‘𝐴) ∩ (0..^𝑁)))) ↔ ((𝐴 − (𝐾‘((bits‘𝐴) ∩ (0..^𝑁)))) / (2↑𝑁)) ∈ ℤ))
4726, 27, 45, 46syl3anc 1477 . . . . . . . 8 (𝜑 → ((2↑𝑁) ∥ (𝐴 − (𝐾‘((bits‘𝐴) ∩ (0..^𝑁)))) ↔ ((𝐴 − (𝐾‘((bits‘𝐴) ∩ (0..^𝑁)))) / (2↑𝑁)) ∈ ℤ))
4825, 47mpbird 247 . . . . . . 7 (𝜑 → (2↑𝑁) ∥ (𝐴 − (𝐾‘((bits‘𝐴) ∩ (0..^𝑁)))))
491fveq1i 6353 . . . . . . . . . . . 12 (𝐾‘((bits‘𝐵) ∩ (0..^𝑁))) = ((bits ↾ ℕ0)‘((bits‘𝐵) ∩ (0..^𝑁)))
50 sadaddlem.2 . . . . . . . . . . . . . . . 16 (𝜑𝐵 ∈ ℤ)
5150, 7zmodcld 12885 . . . . . . . . . . . . . . 15 (𝜑 → (𝐵 mod (2↑𝑁)) ∈ ℕ0)
52 fvres 6368 . . . . . . . . . . . . . . 15 ((𝐵 mod (2↑𝑁)) ∈ ℕ0 → ((bits ↾ ℕ0)‘(𝐵 mod (2↑𝑁))) = (bits‘(𝐵 mod (2↑𝑁))))
5351, 52syl 17 . . . . . . . . . . . . . 14 (𝜑 → ((bits ↾ ℕ0)‘(𝐵 mod (2↑𝑁))) = (bits‘(𝐵 mod (2↑𝑁))))
54 bitsmod 15360 . . . . . . . . . . . . . . 15 ((𝐵 ∈ ℤ ∧ 𝑁 ∈ ℕ0) → (bits‘(𝐵 mod (2↑𝑁))) = ((bits‘𝐵) ∩ (0..^𝑁)))
5550, 6, 54syl2anc 696 . . . . . . . . . . . . . 14 (𝜑 → (bits‘(𝐵 mod (2↑𝑁))) = ((bits‘𝐵) ∩ (0..^𝑁)))
5653, 55eqtrd 2794 . . . . . . . . . . . . 13 (𝜑 → ((bits ↾ ℕ0)‘(𝐵 mod (2↑𝑁))) = ((bits‘𝐵) ∩ (0..^𝑁)))
57 f1ocnvfv 6697 . . . . . . . . . . . . . 14 (((bits ↾ ℕ0):ℕ01-1-onto→(𝒫 ℕ0 ∩ Fin) ∧ (𝐵 mod (2↑𝑁)) ∈ ℕ0) → (((bits ↾ ℕ0)‘(𝐵 mod (2↑𝑁))) = ((bits‘𝐵) ∩ (0..^𝑁)) → ((bits ↾ ℕ0)‘((bits‘𝐵) ∩ (0..^𝑁))) = (𝐵 mod (2↑𝑁))))
5814, 51, 57sylancr 698 . . . . . . . . . . . . 13 (𝜑 → (((bits ↾ ℕ0)‘(𝐵 mod (2↑𝑁))) = ((bits‘𝐵) ∩ (0..^𝑁)) → ((bits ↾ ℕ0)‘((bits‘𝐵) ∩ (0..^𝑁))) = (𝐵 mod (2↑𝑁))))
5956, 58mpd 15 . . . . . . . . . . . 12 (𝜑 → ((bits ↾ ℕ0)‘((bits‘𝐵) ∩ (0..^𝑁))) = (𝐵 mod (2↑𝑁)))
6049, 59syl5eq 2806 . . . . . . . . . . 11 (𝜑 → (𝐾‘((bits‘𝐵) ∩ (0..^𝑁))) = (𝐵 mod (2↑𝑁)))
6160oveq2d 6829 . . . . . . . . . 10 (𝜑 → (𝐵 − (𝐾‘((bits‘𝐵) ∩ (0..^𝑁)))) = (𝐵 − (𝐵 mod (2↑𝑁))))
6261oveq1d 6828 . . . . . . . . 9 (𝜑 → ((𝐵 − (𝐾‘((bits‘𝐵) ∩ (0..^𝑁)))) / (2↑𝑁)) = ((𝐵 − (𝐵 mod (2↑𝑁))) / (2↑𝑁)))
6350zred 11674 . . . . . . . . . 10 (𝜑𝐵 ∈ ℝ)
64 moddifz 12876 . . . . . . . . . 10 ((𝐵 ∈ ℝ ∧ (2↑𝑁) ∈ ℝ+) → ((𝐵 − (𝐵 mod (2↑𝑁))) / (2↑𝑁)) ∈ ℤ)
6563, 22, 64syl2anc 696 . . . . . . . . 9 (𝜑 → ((𝐵 − (𝐵 mod (2↑𝑁))) / (2↑𝑁)) ∈ ℤ)
6662, 65eqeltrd 2839 . . . . . . . 8 (𝜑 → ((𝐵 − (𝐾‘((bits‘𝐵) ∩ (0..^𝑁)))) / (2↑𝑁)) ∈ ℤ)
67 inss1 3976 . . . . . . . . . . . . . 14 ((bits‘𝐵) ∩ (0..^𝑁)) ⊆ (bits‘𝐵)
68 bitsss 15350 . . . . . . . . . . . . . 14 (bits‘𝐵) ⊆ ℕ0
6967, 68sstri 3753 . . . . . . . . . . . . 13 ((bits‘𝐵) ∩ (0..^𝑁)) ⊆ ℕ0
70 inss2 3977 . . . . . . . . . . . . . 14 ((bits‘𝐵) ∩ (0..^𝑁)) ⊆ (0..^𝑁)
71 ssfi 8345 . . . . . . . . . . . . . 14 (((0..^𝑁) ∈ Fin ∧ ((bits‘𝐵) ∩ (0..^𝑁)) ⊆ (0..^𝑁)) → ((bits‘𝐵) ∩ (0..^𝑁)) ∈ Fin)
7231, 70, 71mp2an 710 . . . . . . . . . . . . 13 ((bits‘𝐵) ∩ (0..^𝑁)) ∈ Fin
73 elfpw 8433 . . . . . . . . . . . . 13 (((bits‘𝐵) ∩ (0..^𝑁)) ∈ (𝒫 ℕ0 ∩ Fin) ↔ (((bits‘𝐵) ∩ (0..^𝑁)) ⊆ ℕ0 ∧ ((bits‘𝐵) ∩ (0..^𝑁)) ∈ Fin))
7469, 72, 73mpbir2an 993 . . . . . . . . . . . 12 ((bits‘𝐵) ∩ (0..^𝑁)) ∈ (𝒫 ℕ0 ∩ Fin)
7541ffvelrni 6521 . . . . . . . . . . . 12 (((bits‘𝐵) ∩ (0..^𝑁)) ∈ (𝒫 ℕ0 ∩ Fin) → (𝐾‘((bits‘𝐵) ∩ (0..^𝑁))) ∈ ℕ0)
7674, 75mp1i 13 . . . . . . . . . . 11 (𝜑 → (𝐾‘((bits‘𝐵) ∩ (0..^𝑁))) ∈ ℕ0)
7776nn0zd 11672 . . . . . . . . . 10 (𝜑 → (𝐾‘((bits‘𝐵) ∩ (0..^𝑁))) ∈ ℤ)
7850, 77zsubcld 11679 . . . . . . . . 9 (𝜑 → (𝐵 − (𝐾‘((bits‘𝐵) ∩ (0..^𝑁)))) ∈ ℤ)
79 dvdsval2 15185 . . . . . . . . 9 (((2↑𝑁) ∈ ℤ ∧ (2↑𝑁) ≠ 0 ∧ (𝐵 − (𝐾‘((bits‘𝐵) ∩ (0..^𝑁)))) ∈ ℤ) → ((2↑𝑁) ∥ (𝐵 − (𝐾‘((bits‘𝐵) ∩ (0..^𝑁)))) ↔ ((𝐵 − (𝐾‘((bits‘𝐵) ∩ (0..^𝑁)))) / (2↑𝑁)) ∈ ℤ))
8026, 27, 78, 79syl3anc 1477 . . . . . . . 8 (𝜑 → ((2↑𝑁) ∥ (𝐵 − (𝐾‘((bits‘𝐵) ∩ (0..^𝑁)))) ↔ ((𝐵 − (𝐾‘((bits‘𝐵) ∩ (0..^𝑁)))) / (2↑𝑁)) ∈ ℤ))
8166, 80mpbird 247 . . . . . . 7 (𝜑 → (2↑𝑁) ∥ (𝐵 − (𝐾‘((bits‘𝐵) ∩ (0..^𝑁)))))
82 dvds2add 15217 . . . . . . . 8 (((2↑𝑁) ∈ ℤ ∧ (𝐴 − (𝐾‘((bits‘𝐴) ∩ (0..^𝑁)))) ∈ ℤ ∧ (𝐵 − (𝐾‘((bits‘𝐵) ∩ (0..^𝑁)))) ∈ ℤ) → (((2↑𝑁) ∥ (𝐴 − (𝐾‘((bits‘𝐴) ∩ (0..^𝑁)))) ∧ (2↑𝑁) ∥ (𝐵 − (𝐾‘((bits‘𝐵) ∩ (0..^𝑁))))) → (2↑𝑁) ∥ ((𝐴 − (𝐾‘((bits‘𝐴) ∩ (0..^𝑁)))) + (𝐵 − (𝐾‘((bits‘𝐵) ∩ (0..^𝑁)))))))
8326, 45, 78, 82syl3anc 1477 . . . . . . 7 (𝜑 → (((2↑𝑁) ∥ (𝐴 − (𝐾‘((bits‘𝐴) ∩ (0..^𝑁)))) ∧ (2↑𝑁) ∥ (𝐵 − (𝐾‘((bits‘𝐵) ∩ (0..^𝑁))))) → (2↑𝑁) ∥ ((𝐴 − (𝐾‘((bits‘𝐴) ∩ (0..^𝑁)))) + (𝐵 − (𝐾‘((bits‘𝐵) ∩ (0..^𝑁)))))))
8448, 81, 83mp2and 717 . . . . . 6 (𝜑 → (2↑𝑁) ∥ ((𝐴 − (𝐾‘((bits‘𝐴) ∩ (0..^𝑁)))) + (𝐵 − (𝐾‘((bits‘𝐵) ∩ (0..^𝑁))))))
853zcnd 11675 . . . . . . 7 (𝜑𝐴 ∈ ℂ)
8650zcnd 11675 . . . . . . 7 (𝜑𝐵 ∈ ℂ)
8743nn0cnd 11545 . . . . . . 7 (𝜑 → (𝐾‘((bits‘𝐴) ∩ (0..^𝑁))) ∈ ℂ)
8876nn0cnd 11545 . . . . . . 7 (𝜑 → (𝐾‘((bits‘𝐵) ∩ (0..^𝑁))) ∈ ℂ)
8985, 86, 87, 88addsub4d 10631 . . . . . 6 (𝜑 → ((𝐴 + 𝐵) − ((𝐾‘((bits‘𝐴) ∩ (0..^𝑁))) + (𝐾‘((bits‘𝐵) ∩ (0..^𝑁))))) = ((𝐴 − (𝐾‘((bits‘𝐴) ∩ (0..^𝑁)))) + (𝐵 − (𝐾‘((bits‘𝐵) ∩ (0..^𝑁))))))
9084, 89breqtrrd 4832 . . . . 5 (𝜑 → (2↑𝑁) ∥ ((𝐴 + 𝐵) − ((𝐾‘((bits‘𝐴) ∩ (0..^𝑁))) + (𝐾‘((bits‘𝐵) ∩ (0..^𝑁))))))
913, 50zaddcld 11678 . . . . . 6 (𝜑 → (𝐴 + 𝐵) ∈ ℤ)
9244, 77zaddcld 11678 . . . . . 6 (𝜑 → ((𝐾‘((bits‘𝐴) ∩ (0..^𝑁))) + (𝐾‘((bits‘𝐵) ∩ (0..^𝑁)))) ∈ ℤ)
93 moddvds 15193 . . . . . 6 (((2↑𝑁) ∈ ℕ ∧ (𝐴 + 𝐵) ∈ ℤ ∧ ((𝐾‘((bits‘𝐴) ∩ (0..^𝑁))) + (𝐾‘((bits‘𝐵) ∩ (0..^𝑁)))) ∈ ℤ) → (((𝐴 + 𝐵) mod (2↑𝑁)) = (((𝐾‘((bits‘𝐴) ∩ (0..^𝑁))) + (𝐾‘((bits‘𝐵) ∩ (0..^𝑁)))) mod (2↑𝑁)) ↔ (2↑𝑁) ∥ ((𝐴 + 𝐵) − ((𝐾‘((bits‘𝐴) ∩ (0..^𝑁))) + (𝐾‘((bits‘𝐵) ∩ (0..^𝑁)))))))
947, 91, 92, 93syl3anc 1477 . . . . 5 (𝜑 → (((𝐴 + 𝐵) mod (2↑𝑁)) = (((𝐾‘((bits‘𝐴) ∩ (0..^𝑁))) + (𝐾‘((bits‘𝐵) ∩ (0..^𝑁)))) mod (2↑𝑁)) ↔ (2↑𝑁) ∥ ((𝐴 + 𝐵) − ((𝐾‘((bits‘𝐴) ∩ (0..^𝑁))) + (𝐾‘((bits‘𝐵) ∩ (0..^𝑁)))))))
9590, 94mpbird 247 . . . 4 (𝜑 → ((𝐴 + 𝐵) mod (2↑𝑁)) = (((𝐾‘((bits‘𝐴) ∩ (0..^𝑁))) + (𝐾‘((bits‘𝐵) ∩ (0..^𝑁)))) mod (2↑𝑁)))
9629a1i 11 . . . . 5 (𝜑 → (bits‘𝐴) ⊆ ℕ0)
9768a1i 11 . . . . 5 (𝜑 → (bits‘𝐵) ⊆ ℕ0)
98 sadaddlem.c . . . . 5 𝐶 = seq0((𝑐 ∈ 2𝑜, 𝑚 ∈ ℕ0 ↦ if(cadd(𝑚 ∈ (bits‘𝐴), 𝑚 ∈ (bits‘𝐵), ∅ ∈ 𝑐), 1𝑜, ∅)), (𝑛 ∈ ℕ0 ↦ if(𝑛 = 0, ∅, (𝑛 − 1))))
9996, 97, 98, 6, 1sadadd3 15385 . . . 4 (𝜑 → ((𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁))) mod (2↑𝑁)) = (((𝐾‘((bits‘𝐴) ∩ (0..^𝑁))) + (𝐾‘((bits‘𝐵) ∩ (0..^𝑁)))) mod (2↑𝑁)))
100 inss1 3976 . . . . . . . . 9 (((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁)) ⊆ ((bits‘𝐴) sadd (bits‘𝐵))
101 sadcl 15386 . . . . . . . . . 10 (((bits‘𝐴) ⊆ ℕ0 ∧ (bits‘𝐵) ⊆ ℕ0) → ((bits‘𝐴) sadd (bits‘𝐵)) ⊆ ℕ0)
10229, 68, 101mp2an 710 . . . . . . . . 9 ((bits‘𝐴) sadd (bits‘𝐵)) ⊆ ℕ0
103100, 102sstri 3753 . . . . . . . 8 (((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁)) ⊆ ℕ0
104 inss2 3977 . . . . . . . . 9 (((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁)) ⊆ (0..^𝑁)
105 ssfi 8345 . . . . . . . . 9 (((0..^𝑁) ∈ Fin ∧ (((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁)) ⊆ (0..^𝑁)) → (((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁)) ∈ Fin)
10631, 104, 105mp2an 710 . . . . . . . 8 (((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁)) ∈ Fin
107 elfpw 8433 . . . . . . . 8 ((((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁)) ∈ (𝒫 ℕ0 ∩ Fin) ↔ ((((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁)) ⊆ ℕ0 ∧ (((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁)) ∈ Fin))
108103, 106, 107mpbir2an 993 . . . . . . 7 (((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁)) ∈ (𝒫 ℕ0 ∩ Fin)
10941ffvelrni 6521 . . . . . . 7 ((((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁)) ∈ (𝒫 ℕ0 ∩ Fin) → (𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁))) ∈ ℕ0)
110108, 109mp1i 13 . . . . . 6 (𝜑 → (𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁))) ∈ ℕ0)
111110nn0red 11544 . . . . 5 (𝜑 → (𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁))) ∈ ℝ)
112110nn0ge0d 11546 . . . . 5 (𝜑 → 0 ≤ (𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁))))
1131fveq1i 6353 . . . . . . . . . 10 (𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁))) = ((bits ↾ ℕ0)‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁)))
114113fveq2i 6355 . . . . . . . . 9 ((bits ↾ ℕ0)‘(𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁)))) = ((bits ↾ ℕ0)‘((bits ↾ ℕ0)‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁))))
115 fvres 6368 . . . . . . . . . 10 ((𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁))) ∈ ℕ0 → ((bits ↾ ℕ0)‘(𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁)))) = (bits‘(𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁)))))
116110, 115syl 17 . . . . . . . . 9 (𝜑 → ((bits ↾ ℕ0)‘(𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁)))) = (bits‘(𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁)))))
117108a1i 11 . . . . . . . . . 10 (𝜑 → (((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁)) ∈ (𝒫 ℕ0 ∩ Fin))
118 f1ocnvfv2 6696 . . . . . . . . . 10 (((bits ↾ ℕ0):ℕ01-1-onto→(𝒫 ℕ0 ∩ Fin) ∧ (((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁)) ∈ (𝒫 ℕ0 ∩ Fin)) → ((bits ↾ ℕ0)‘((bits ↾ ℕ0)‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁)))) = (((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁)))
11914, 117, 118sylancr 698 . . . . . . . . 9 (𝜑 → ((bits ↾ ℕ0)‘((bits ↾ ℕ0)‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁)))) = (((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁)))
120114, 116, 1193eqtr3a 2818 . . . . . . . 8 (𝜑 → (bits‘(𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁)))) = (((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁)))
121120, 104syl6eqss 3796 . . . . . . 7 (𝜑 → (bits‘(𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁)))) ⊆ (0..^𝑁))
122110nn0zd 11672 . . . . . . . 8 (𝜑 → (𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁))) ∈ ℤ)
123 bitsfzo 15359 . . . . . . . 8 (((𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁))) ∈ ℤ ∧ 𝑁 ∈ ℕ0) → ((𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁))) ∈ (0..^(2↑𝑁)) ↔ (bits‘(𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁)))) ⊆ (0..^𝑁)))
124122, 6, 123syl2anc 696 . . . . . . 7 (𝜑 → ((𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁))) ∈ (0..^(2↑𝑁)) ↔ (bits‘(𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁)))) ⊆ (0..^𝑁)))
125121, 124mpbird 247 . . . . . 6 (𝜑 → (𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁))) ∈ (0..^(2↑𝑁)))
126 elfzolt2 12673 . . . . . 6 ((𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁))) ∈ (0..^(2↑𝑁)) → (𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁))) < (2↑𝑁))
127125, 126syl 17 . . . . 5 (𝜑 → (𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁))) < (2↑𝑁))
128 modid 12889 . . . . 5 ((((𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁))) ∈ ℝ ∧ (2↑𝑁) ∈ ℝ+) ∧ (0 ≤ (𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁))) ∧ (𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁))) < (2↑𝑁))) → ((𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁))) mod (2↑𝑁)) = (𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁))))
129111, 22, 112, 127, 128syl22anc 1478 . . . 4 (𝜑 → ((𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁))) mod (2↑𝑁)) = (𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁))))
13095, 99, 1293eqtr2d 2800 . . 3 (𝜑 → ((𝐴 + 𝐵) mod (2↑𝑁)) = (𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁))))
131130fveq2d 6356 . 2 (𝜑 → (bits‘((𝐴 + 𝐵) mod (2↑𝑁))) = (bits‘(𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁)))))
132131, 120eqtr2d 2795 1 (𝜑 → (((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁)) = (bits‘((𝐴 + 𝐵) mod (2↑𝑁))))