Proof of Theorem sadaddlem
Step | Hyp | Ref
| Expression |
1 | | 2nn 11976 |
. . . . . . . . . 10
⊢ 2 ∈
ℕ |
2 | 1 | a1i 11 |
. . . . . . . . 9
⊢ (𝜑 → 2 ∈
ℕ) |
3 | | sadaddlem.3 |
. . . . . . . . 9
⊢ (𝜑 → 𝑁 ∈
ℕ0) |
4 | 2, 3 | nnexpcld 13888 |
. . . . . . . 8
⊢ (𝜑 → (2↑𝑁) ∈ ℕ) |
5 | 4 | nnzd 12354 |
. . . . . . 7
⊢ (𝜑 → (2↑𝑁) ∈ ℤ) |
6 | | sadaddlem.1 |
. . . . . . . 8
⊢ (𝜑 → 𝐴 ∈ ℤ) |
7 | | inss1 4159 |
. . . . . . . . . . . 12
⊢
((bits‘𝐴)
∩ (0..^𝑁)) ⊆
(bits‘𝐴) |
8 | | bitsss 16061 |
. . . . . . . . . . . 12
⊢
(bits‘𝐴)
⊆ ℕ0 |
9 | 7, 8 | sstri 3926 |
. . . . . . . . . . 11
⊢
((bits‘𝐴)
∩ (0..^𝑁)) ⊆
ℕ0 |
10 | | fzofi 13622 |
. . . . . . . . . . . 12
⊢
(0..^𝑁) ∈
Fin |
11 | | inss2 4160 |
. . . . . . . . . . . 12
⊢
((bits‘𝐴)
∩ (0..^𝑁)) ⊆
(0..^𝑁) |
12 | | ssfi 8918 |
. . . . . . . . . . . 12
⊢
(((0..^𝑁) ∈ Fin
∧ ((bits‘𝐴) ∩
(0..^𝑁)) ⊆ (0..^𝑁)) → ((bits‘𝐴) ∩ (0..^𝑁)) ∈ Fin) |
13 | 10, 11, 12 | mp2an 688 |
. . . . . . . . . . 11
⊢
((bits‘𝐴)
∩ (0..^𝑁)) ∈
Fin |
14 | | elfpw 9051 |
. . . . . . . . . . 11
⊢
(((bits‘𝐴)
∩ (0..^𝑁)) ∈
(𝒫 ℕ0 ∩ Fin) ↔ (((bits‘𝐴) ∩ (0..^𝑁)) ⊆ ℕ0 ∧
((bits‘𝐴) ∩
(0..^𝑁)) ∈
Fin)) |
15 | 9, 13, 14 | mpbir2an 707 |
. . . . . . . . . 10
⊢
((bits‘𝐴)
∩ (0..^𝑁)) ∈
(𝒫 ℕ0 ∩ Fin) |
16 | | bitsf1o 16080 |
. . . . . . . . . . . . 13
⊢ (bits
↾ ℕ0):ℕ0–1-1-onto→(𝒫 ℕ0 ∩
Fin) |
17 | | f1ocnv 6712 |
. . . . . . . . . . . . 13
⊢ ((bits
↾ ℕ0):ℕ0–1-1-onto→(𝒫 ℕ0 ∩ Fin)
→ ◡(bits ↾
ℕ0):(𝒫 ℕ0 ∩ Fin)–1-1-onto→ℕ0) |
18 | | f1of 6700 |
. . . . . . . . . . . . 13
⊢ (◡(bits ↾
ℕ0):(𝒫 ℕ0 ∩ Fin)–1-1-onto→ℕ0 → ◡(bits ↾
ℕ0):(𝒫 ℕ0 ∩
Fin)⟶ℕ0) |
19 | 16, 17, 18 | mp2b 10 |
. . . . . . . . . . . 12
⊢ ◡(bits ↾
ℕ0):(𝒫 ℕ0 ∩
Fin)⟶ℕ0 |
20 | | sadaddlem.k |
. . . . . . . . . . . . 13
⊢ 𝐾 = ◡(bits ↾
ℕ0) |
21 | 20 | feq1i 6575 |
. . . . . . . . . . . 12
⊢ (𝐾:(𝒫 ℕ0
∩ Fin)⟶ℕ0 ↔ ◡(bits ↾
ℕ0):(𝒫 ℕ0 ∩
Fin)⟶ℕ0) |
22 | 19, 21 | mpbir 230 |
. . . . . . . . . . 11
⊢ 𝐾:(𝒫 ℕ0
∩ Fin)⟶ℕ0 |
23 | 22 | ffvelrni 6942 |
. . . . . . . . . 10
⊢
(((bits‘𝐴)
∩ (0..^𝑁)) ∈
(𝒫 ℕ0 ∩ Fin) → (𝐾‘((bits‘𝐴) ∩ (0..^𝑁))) ∈
ℕ0) |
24 | 15, 23 | mp1i 13 |
. . . . . . . . 9
⊢ (𝜑 → (𝐾‘((bits‘𝐴) ∩ (0..^𝑁))) ∈
ℕ0) |
25 | 24 | nn0zd 12353 |
. . . . . . . 8
⊢ (𝜑 → (𝐾‘((bits‘𝐴) ∩ (0..^𝑁))) ∈ ℤ) |
26 | 6, 25 | zsubcld 12360 |
. . . . . . 7
⊢ (𝜑 → (𝐴 − (𝐾‘((bits‘𝐴) ∩ (0..^𝑁)))) ∈ ℤ) |
27 | | sadaddlem.2 |
. . . . . . . 8
⊢ (𝜑 → 𝐵 ∈ ℤ) |
28 | | inss1 4159 |
. . . . . . . . . . . 12
⊢
((bits‘𝐵)
∩ (0..^𝑁)) ⊆
(bits‘𝐵) |
29 | | bitsss 16061 |
. . . . . . . . . . . 12
⊢
(bits‘𝐵)
⊆ ℕ0 |
30 | 28, 29 | sstri 3926 |
. . . . . . . . . . 11
⊢
((bits‘𝐵)
∩ (0..^𝑁)) ⊆
ℕ0 |
31 | | inss2 4160 |
. . . . . . . . . . . 12
⊢
((bits‘𝐵)
∩ (0..^𝑁)) ⊆
(0..^𝑁) |
32 | | ssfi 8918 |
. . . . . . . . . . . 12
⊢
(((0..^𝑁) ∈ Fin
∧ ((bits‘𝐵) ∩
(0..^𝑁)) ⊆ (0..^𝑁)) → ((bits‘𝐵) ∩ (0..^𝑁)) ∈ Fin) |
33 | 10, 31, 32 | mp2an 688 |
. . . . . . . . . . 11
⊢
((bits‘𝐵)
∩ (0..^𝑁)) ∈
Fin |
34 | | elfpw 9051 |
. . . . . . . . . . 11
⊢
(((bits‘𝐵)
∩ (0..^𝑁)) ∈
(𝒫 ℕ0 ∩ Fin) ↔ (((bits‘𝐵) ∩ (0..^𝑁)) ⊆ ℕ0 ∧
((bits‘𝐵) ∩
(0..^𝑁)) ∈
Fin)) |
35 | 30, 33, 34 | mpbir2an 707 |
. . . . . . . . . 10
⊢
((bits‘𝐵)
∩ (0..^𝑁)) ∈
(𝒫 ℕ0 ∩ Fin) |
36 | 22 | ffvelrni 6942 |
. . . . . . . . . 10
⊢
(((bits‘𝐵)
∩ (0..^𝑁)) ∈
(𝒫 ℕ0 ∩ Fin) → (𝐾‘((bits‘𝐵) ∩ (0..^𝑁))) ∈
ℕ0) |
37 | 35, 36 | mp1i 13 |
. . . . . . . . 9
⊢ (𝜑 → (𝐾‘((bits‘𝐵) ∩ (0..^𝑁))) ∈
ℕ0) |
38 | 37 | nn0zd 12353 |
. . . . . . . 8
⊢ (𝜑 → (𝐾‘((bits‘𝐵) ∩ (0..^𝑁))) ∈ ℤ) |
39 | 27, 38 | zsubcld 12360 |
. . . . . . 7
⊢ (𝜑 → (𝐵 − (𝐾‘((bits‘𝐵) ∩ (0..^𝑁)))) ∈ ℤ) |
40 | 20 | fveq1i 6757 |
. . . . . . . . . . . 12
⊢ (𝐾‘((bits‘𝐴) ∩ (0..^𝑁))) = (◡(bits ↾
ℕ0)‘((bits‘𝐴) ∩ (0..^𝑁))) |
41 | 6, 4 | zmodcld 13540 |
. . . . . . . . . . . . . . 15
⊢ (𝜑 → (𝐴 mod (2↑𝑁)) ∈
ℕ0) |
42 | 41 | fvresd 6776 |
. . . . . . . . . . . . . 14
⊢ (𝜑 → ((bits ↾
ℕ0)‘(𝐴 mod (2↑𝑁))) = (bits‘(𝐴 mod (2↑𝑁)))) |
43 | | bitsmod 16071 |
. . . . . . . . . . . . . . 15
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ (bits‘(𝐴 mod
(2↑𝑁))) =
((bits‘𝐴) ∩
(0..^𝑁))) |
44 | 6, 3, 43 | syl2anc 583 |
. . . . . . . . . . . . . 14
⊢ (𝜑 → (bits‘(𝐴 mod (2↑𝑁))) = ((bits‘𝐴) ∩ (0..^𝑁))) |
45 | 42, 44 | eqtrd 2778 |
. . . . . . . . . . . . 13
⊢ (𝜑 → ((bits ↾
ℕ0)‘(𝐴 mod (2↑𝑁))) = ((bits‘𝐴) ∩ (0..^𝑁))) |
46 | | f1ocnvfv 7131 |
. . . . . . . . . . . . . 14
⊢ (((bits
↾ ℕ0):ℕ0–1-1-onto→(𝒫 ℕ0 ∩ Fin)
∧ (𝐴 mod (2↑𝑁)) ∈ ℕ0)
→ (((bits ↾ ℕ0)‘(𝐴 mod (2↑𝑁))) = ((bits‘𝐴) ∩ (0..^𝑁)) → (◡(bits ↾
ℕ0)‘((bits‘𝐴) ∩ (0..^𝑁))) = (𝐴 mod (2↑𝑁)))) |
47 | 16, 41, 46 | sylancr 586 |
. . . . . . . . . . . . 13
⊢ (𝜑 → (((bits ↾
ℕ0)‘(𝐴 mod (2↑𝑁))) = ((bits‘𝐴) ∩ (0..^𝑁)) → (◡(bits ↾
ℕ0)‘((bits‘𝐴) ∩ (0..^𝑁))) = (𝐴 mod (2↑𝑁)))) |
48 | 45, 47 | mpd 15 |
. . . . . . . . . . . 12
⊢ (𝜑 → (◡(bits ↾
ℕ0)‘((bits‘𝐴) ∩ (0..^𝑁))) = (𝐴 mod (2↑𝑁))) |
49 | 40, 48 | eqtrid 2790 |
. . . . . . . . . . 11
⊢ (𝜑 → (𝐾‘((bits‘𝐴) ∩ (0..^𝑁))) = (𝐴 mod (2↑𝑁))) |
50 | 49 | oveq2d 7271 |
. . . . . . . . . 10
⊢ (𝜑 → (𝐴 − (𝐾‘((bits‘𝐴) ∩ (0..^𝑁)))) = (𝐴 − (𝐴 mod (2↑𝑁)))) |
51 | 50 | oveq1d 7270 |
. . . . . . . . 9
⊢ (𝜑 → ((𝐴 − (𝐾‘((bits‘𝐴) ∩ (0..^𝑁)))) / (2↑𝑁)) = ((𝐴 − (𝐴 mod (2↑𝑁))) / (2↑𝑁))) |
52 | 6 | zred 12355 |
. . . . . . . . . 10
⊢ (𝜑 → 𝐴 ∈ ℝ) |
53 | 4 | nnrpd 12699 |
. . . . . . . . . 10
⊢ (𝜑 → (2↑𝑁) ∈
ℝ+) |
54 | | moddifz 13531 |
. . . . . . . . . 10
⊢ ((𝐴 ∈ ℝ ∧
(2↑𝑁) ∈
ℝ+) → ((𝐴 − (𝐴 mod (2↑𝑁))) / (2↑𝑁)) ∈ ℤ) |
55 | 52, 53, 54 | syl2anc 583 |
. . . . . . . . 9
⊢ (𝜑 → ((𝐴 − (𝐴 mod (2↑𝑁))) / (2↑𝑁)) ∈ ℤ) |
56 | 51, 55 | eqeltrd 2839 |
. . . . . . . 8
⊢ (𝜑 → ((𝐴 − (𝐾‘((bits‘𝐴) ∩ (0..^𝑁)))) / (2↑𝑁)) ∈ ℤ) |
57 | 4 | nnne0d 11953 |
. . . . . . . . 9
⊢ (𝜑 → (2↑𝑁) ≠ 0) |
58 | | dvdsval2 15894 |
. . . . . . . . 9
⊢
(((2↑𝑁) ∈
ℤ ∧ (2↑𝑁)
≠ 0 ∧ (𝐴 −
(𝐾‘((bits‘𝐴) ∩ (0..^𝑁)))) ∈ ℤ) → ((2↑𝑁) ∥ (𝐴 − (𝐾‘((bits‘𝐴) ∩ (0..^𝑁)))) ↔ ((𝐴 − (𝐾‘((bits‘𝐴) ∩ (0..^𝑁)))) / (2↑𝑁)) ∈ ℤ)) |
59 | 5, 57, 26, 58 | syl3anc 1369 |
. . . . . . . 8
⊢ (𝜑 → ((2↑𝑁) ∥ (𝐴 − (𝐾‘((bits‘𝐴) ∩ (0..^𝑁)))) ↔ ((𝐴 − (𝐾‘((bits‘𝐴) ∩ (0..^𝑁)))) / (2↑𝑁)) ∈ ℤ)) |
60 | 56, 59 | mpbird 256 |
. . . . . . 7
⊢ (𝜑 → (2↑𝑁) ∥ (𝐴 − (𝐾‘((bits‘𝐴) ∩ (0..^𝑁))))) |
61 | 20 | fveq1i 6757 |
. . . . . . . . . . . 12
⊢ (𝐾‘((bits‘𝐵) ∩ (0..^𝑁))) = (◡(bits ↾
ℕ0)‘((bits‘𝐵) ∩ (0..^𝑁))) |
62 | 27, 4 | zmodcld 13540 |
. . . . . . . . . . . . . . 15
⊢ (𝜑 → (𝐵 mod (2↑𝑁)) ∈
ℕ0) |
63 | 62 | fvresd 6776 |
. . . . . . . . . . . . . 14
⊢ (𝜑 → ((bits ↾
ℕ0)‘(𝐵 mod (2↑𝑁))) = (bits‘(𝐵 mod (2↑𝑁)))) |
64 | | bitsmod 16071 |
. . . . . . . . . . . . . . 15
⊢ ((𝐵 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ (bits‘(𝐵 mod
(2↑𝑁))) =
((bits‘𝐵) ∩
(0..^𝑁))) |
65 | 27, 3, 64 | syl2anc 583 |
. . . . . . . . . . . . . 14
⊢ (𝜑 → (bits‘(𝐵 mod (2↑𝑁))) = ((bits‘𝐵) ∩ (0..^𝑁))) |
66 | 63, 65 | eqtrd 2778 |
. . . . . . . . . . . . 13
⊢ (𝜑 → ((bits ↾
ℕ0)‘(𝐵 mod (2↑𝑁))) = ((bits‘𝐵) ∩ (0..^𝑁))) |
67 | | f1ocnvfv 7131 |
. . . . . . . . . . . . . 14
⊢ (((bits
↾ ℕ0):ℕ0–1-1-onto→(𝒫 ℕ0 ∩ Fin)
∧ (𝐵 mod (2↑𝑁)) ∈ ℕ0)
→ (((bits ↾ ℕ0)‘(𝐵 mod (2↑𝑁))) = ((bits‘𝐵) ∩ (0..^𝑁)) → (◡(bits ↾
ℕ0)‘((bits‘𝐵) ∩ (0..^𝑁))) = (𝐵 mod (2↑𝑁)))) |
68 | 16, 62, 67 | sylancr 586 |
. . . . . . . . . . . . 13
⊢ (𝜑 → (((bits ↾
ℕ0)‘(𝐵 mod (2↑𝑁))) = ((bits‘𝐵) ∩ (0..^𝑁)) → (◡(bits ↾
ℕ0)‘((bits‘𝐵) ∩ (0..^𝑁))) = (𝐵 mod (2↑𝑁)))) |
69 | 66, 68 | mpd 15 |
. . . . . . . . . . . 12
⊢ (𝜑 → (◡(bits ↾
ℕ0)‘((bits‘𝐵) ∩ (0..^𝑁))) = (𝐵 mod (2↑𝑁))) |
70 | 61, 69 | eqtrid 2790 |
. . . . . . . . . . 11
⊢ (𝜑 → (𝐾‘((bits‘𝐵) ∩ (0..^𝑁))) = (𝐵 mod (2↑𝑁))) |
71 | 70 | oveq2d 7271 |
. . . . . . . . . 10
⊢ (𝜑 → (𝐵 − (𝐾‘((bits‘𝐵) ∩ (0..^𝑁)))) = (𝐵 − (𝐵 mod (2↑𝑁)))) |
72 | 71 | oveq1d 7270 |
. . . . . . . . 9
⊢ (𝜑 → ((𝐵 − (𝐾‘((bits‘𝐵) ∩ (0..^𝑁)))) / (2↑𝑁)) = ((𝐵 − (𝐵 mod (2↑𝑁))) / (2↑𝑁))) |
73 | 27 | zred 12355 |
. . . . . . . . . 10
⊢ (𝜑 → 𝐵 ∈ ℝ) |
74 | | moddifz 13531 |
. . . . . . . . . 10
⊢ ((𝐵 ∈ ℝ ∧
(2↑𝑁) ∈
ℝ+) → ((𝐵 − (𝐵 mod (2↑𝑁))) / (2↑𝑁)) ∈ ℤ) |
75 | 73, 53, 74 | syl2anc 583 |
. . . . . . . . 9
⊢ (𝜑 → ((𝐵 − (𝐵 mod (2↑𝑁))) / (2↑𝑁)) ∈ ℤ) |
76 | 72, 75 | eqeltrd 2839 |
. . . . . . . 8
⊢ (𝜑 → ((𝐵 − (𝐾‘((bits‘𝐵) ∩ (0..^𝑁)))) / (2↑𝑁)) ∈ ℤ) |
77 | | dvdsval2 15894 |
. . . . . . . . 9
⊢
(((2↑𝑁) ∈
ℤ ∧ (2↑𝑁)
≠ 0 ∧ (𝐵 −
(𝐾‘((bits‘𝐵) ∩ (0..^𝑁)))) ∈ ℤ) → ((2↑𝑁) ∥ (𝐵 − (𝐾‘((bits‘𝐵) ∩ (0..^𝑁)))) ↔ ((𝐵 − (𝐾‘((bits‘𝐵) ∩ (0..^𝑁)))) / (2↑𝑁)) ∈ ℤ)) |
78 | 5, 57, 39, 77 | syl3anc 1369 |
. . . . . . . 8
⊢ (𝜑 → ((2↑𝑁) ∥ (𝐵 − (𝐾‘((bits‘𝐵) ∩ (0..^𝑁)))) ↔ ((𝐵 − (𝐾‘((bits‘𝐵) ∩ (0..^𝑁)))) / (2↑𝑁)) ∈ ℤ)) |
79 | 76, 78 | mpbird 256 |
. . . . . . 7
⊢ (𝜑 → (2↑𝑁) ∥ (𝐵 − (𝐾‘((bits‘𝐵) ∩ (0..^𝑁))))) |
80 | 5, 26, 39, 60, 79 | dvds2addd 15929 |
. . . . . 6
⊢ (𝜑 → (2↑𝑁) ∥ ((𝐴 − (𝐾‘((bits‘𝐴) ∩ (0..^𝑁)))) + (𝐵 − (𝐾‘((bits‘𝐵) ∩ (0..^𝑁)))))) |
81 | 6 | zcnd 12356 |
. . . . . . 7
⊢ (𝜑 → 𝐴 ∈ ℂ) |
82 | 27 | zcnd 12356 |
. . . . . . 7
⊢ (𝜑 → 𝐵 ∈ ℂ) |
83 | 24 | nn0cnd 12225 |
. . . . . . 7
⊢ (𝜑 → (𝐾‘((bits‘𝐴) ∩ (0..^𝑁))) ∈ ℂ) |
84 | 37 | nn0cnd 12225 |
. . . . . . 7
⊢ (𝜑 → (𝐾‘((bits‘𝐵) ∩ (0..^𝑁))) ∈ ℂ) |
85 | 81, 82, 83, 84 | addsub4d 11309 |
. . . . . 6
⊢ (𝜑 → ((𝐴 + 𝐵) − ((𝐾‘((bits‘𝐴) ∩ (0..^𝑁))) + (𝐾‘((bits‘𝐵) ∩ (0..^𝑁))))) = ((𝐴 − (𝐾‘((bits‘𝐴) ∩ (0..^𝑁)))) + (𝐵 − (𝐾‘((bits‘𝐵) ∩ (0..^𝑁)))))) |
86 | 80, 85 | breqtrrd 5098 |
. . . . 5
⊢ (𝜑 → (2↑𝑁) ∥ ((𝐴 + 𝐵) − ((𝐾‘((bits‘𝐴) ∩ (0..^𝑁))) + (𝐾‘((bits‘𝐵) ∩ (0..^𝑁)))))) |
87 | 6, 27 | zaddcld 12359 |
. . . . . 6
⊢ (𝜑 → (𝐴 + 𝐵) ∈ ℤ) |
88 | 25, 38 | zaddcld 12359 |
. . . . . 6
⊢ (𝜑 → ((𝐾‘((bits‘𝐴) ∩ (0..^𝑁))) + (𝐾‘((bits‘𝐵) ∩ (0..^𝑁)))) ∈ ℤ) |
89 | | moddvds 15902 |
. . . . . 6
⊢
(((2↑𝑁) ∈
ℕ ∧ (𝐴 + 𝐵) ∈ ℤ ∧ ((𝐾‘((bits‘𝐴) ∩ (0..^𝑁))) + (𝐾‘((bits‘𝐵) ∩ (0..^𝑁)))) ∈ ℤ) → (((𝐴 + 𝐵) mod (2↑𝑁)) = (((𝐾‘((bits‘𝐴) ∩ (0..^𝑁))) + (𝐾‘((bits‘𝐵) ∩ (0..^𝑁)))) mod (2↑𝑁)) ↔ (2↑𝑁) ∥ ((𝐴 + 𝐵) − ((𝐾‘((bits‘𝐴) ∩ (0..^𝑁))) + (𝐾‘((bits‘𝐵) ∩ (0..^𝑁))))))) |
90 | 4, 87, 88, 89 | syl3anc 1369 |
. . . . 5
⊢ (𝜑 → (((𝐴 + 𝐵) mod (2↑𝑁)) = (((𝐾‘((bits‘𝐴) ∩ (0..^𝑁))) + (𝐾‘((bits‘𝐵) ∩ (0..^𝑁)))) mod (2↑𝑁)) ↔ (2↑𝑁) ∥ ((𝐴 + 𝐵) − ((𝐾‘((bits‘𝐴) ∩ (0..^𝑁))) + (𝐾‘((bits‘𝐵) ∩ (0..^𝑁))))))) |
91 | 86, 90 | mpbird 256 |
. . . 4
⊢ (𝜑 → ((𝐴 + 𝐵) mod (2↑𝑁)) = (((𝐾‘((bits‘𝐴) ∩ (0..^𝑁))) + (𝐾‘((bits‘𝐵) ∩ (0..^𝑁)))) mod (2↑𝑁))) |
92 | 8 | a1i 11 |
. . . . 5
⊢ (𝜑 → (bits‘𝐴) ⊆
ℕ0) |
93 | 29 | a1i 11 |
. . . . 5
⊢ (𝜑 → (bits‘𝐵) ⊆
ℕ0) |
94 | | sadaddlem.c |
. . . . 5
⊢ 𝐶 = seq0((𝑐 ∈ 2o, 𝑚 ∈ ℕ0 ↦
if(cadd(𝑚 ∈
(bits‘𝐴), 𝑚 ∈ (bits‘𝐵), ∅ ∈ 𝑐), 1o, ∅)),
(𝑛 ∈
ℕ0 ↦ if(𝑛 = 0, ∅, (𝑛 − 1)))) |
95 | 92, 93, 94, 3, 20 | sadadd3 16096 |
. . . 4
⊢ (𝜑 → ((𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁))) mod (2↑𝑁)) = (((𝐾‘((bits‘𝐴) ∩ (0..^𝑁))) + (𝐾‘((bits‘𝐵) ∩ (0..^𝑁)))) mod (2↑𝑁))) |
96 | | inss1 4159 |
. . . . . . . . 9
⊢
(((bits‘𝐴)
sadd (bits‘𝐵)) ∩
(0..^𝑁)) ⊆
((bits‘𝐴) sadd
(bits‘𝐵)) |
97 | | sadcl 16097 |
. . . . . . . . . 10
⊢
(((bits‘𝐴)
⊆ ℕ0 ∧ (bits‘𝐵) ⊆ ℕ0) →
((bits‘𝐴) sadd
(bits‘𝐵)) ⊆
ℕ0) |
98 | 8, 29, 97 | mp2an 688 |
. . . . . . . . 9
⊢
((bits‘𝐴) sadd
(bits‘𝐵)) ⊆
ℕ0 |
99 | 96, 98 | sstri 3926 |
. . . . . . . 8
⊢
(((bits‘𝐴)
sadd (bits‘𝐵)) ∩
(0..^𝑁)) ⊆
ℕ0 |
100 | | inss2 4160 |
. . . . . . . . 9
⊢
(((bits‘𝐴)
sadd (bits‘𝐵)) ∩
(0..^𝑁)) ⊆ (0..^𝑁) |
101 | | ssfi 8918 |
. . . . . . . . 9
⊢
(((0..^𝑁) ∈ Fin
∧ (((bits‘𝐴) sadd
(bits‘𝐵)) ∩
(0..^𝑁)) ⊆ (0..^𝑁)) → (((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁)) ∈ Fin) |
102 | 10, 100, 101 | mp2an 688 |
. . . . . . . 8
⊢
(((bits‘𝐴)
sadd (bits‘𝐵)) ∩
(0..^𝑁)) ∈
Fin |
103 | | elfpw 9051 |
. . . . . . . 8
⊢
((((bits‘𝐴)
sadd (bits‘𝐵)) ∩
(0..^𝑁)) ∈ (𝒫
ℕ0 ∩ Fin) ↔ ((((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁)) ⊆ ℕ0 ∧
(((bits‘𝐴) sadd
(bits‘𝐵)) ∩
(0..^𝑁)) ∈
Fin)) |
104 | 99, 102, 103 | mpbir2an 707 |
. . . . . . 7
⊢
(((bits‘𝐴)
sadd (bits‘𝐵)) ∩
(0..^𝑁)) ∈ (𝒫
ℕ0 ∩ Fin) |
105 | 22 | ffvelrni 6942 |
. . . . . . 7
⊢
((((bits‘𝐴)
sadd (bits‘𝐵)) ∩
(0..^𝑁)) ∈ (𝒫
ℕ0 ∩ Fin) → (𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁))) ∈
ℕ0) |
106 | 104, 105 | mp1i 13 |
. . . . . 6
⊢ (𝜑 → (𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁))) ∈
ℕ0) |
107 | 106 | nn0red 12224 |
. . . . 5
⊢ (𝜑 → (𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁))) ∈ ℝ) |
108 | 106 | nn0ge0d 12226 |
. . . . 5
⊢ (𝜑 → 0 ≤ (𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁)))) |
109 | 20 | fveq1i 6757 |
. . . . . . . . . 10
⊢ (𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁))) = (◡(bits ↾
ℕ0)‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁))) |
110 | 109 | fveq2i 6759 |
. . . . . . . . 9
⊢ ((bits
↾ ℕ0)‘(𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁)))) = ((bits ↾
ℕ0)‘(◡(bits
↾ ℕ0)‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁)))) |
111 | 106 | fvresd 6776 |
. . . . . . . . 9
⊢ (𝜑 → ((bits ↾
ℕ0)‘(𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁)))) = (bits‘(𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁))))) |
112 | 104 | a1i 11 |
. . . . . . . . . 10
⊢ (𝜑 → (((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁)) ∈ (𝒫 ℕ0
∩ Fin)) |
113 | | f1ocnvfv2 7130 |
. . . . . . . . . 10
⊢ (((bits
↾ ℕ0):ℕ0–1-1-onto→(𝒫 ℕ0 ∩ Fin)
∧ (((bits‘𝐴) sadd
(bits‘𝐵)) ∩
(0..^𝑁)) ∈ (𝒫
ℕ0 ∩ Fin)) → ((bits ↾
ℕ0)‘(◡(bits
↾ ℕ0)‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁)))) = (((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁))) |
114 | 16, 112, 113 | sylancr 586 |
. . . . . . . . 9
⊢ (𝜑 → ((bits ↾
ℕ0)‘(◡(bits
↾ ℕ0)‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁)))) = (((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁))) |
115 | 110, 111,
114 | 3eqtr3a 2803 |
. . . . . . . 8
⊢ (𝜑 → (bits‘(𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁)))) = (((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁))) |
116 | 115, 100 | eqsstrdi 3971 |
. . . . . . 7
⊢ (𝜑 → (bits‘(𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁)))) ⊆ (0..^𝑁)) |
117 | 106 | nn0zd 12353 |
. . . . . . . 8
⊢ (𝜑 → (𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁))) ∈ ℤ) |
118 | | bitsfzo 16070 |
. . . . . . . 8
⊢ (((𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁))) ∈ ℤ ∧ 𝑁 ∈ ℕ0) → ((𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁))) ∈ (0..^(2↑𝑁)) ↔ (bits‘(𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁)))) ⊆ (0..^𝑁))) |
119 | 117, 3, 118 | syl2anc 583 |
. . . . . . 7
⊢ (𝜑 → ((𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁))) ∈ (0..^(2↑𝑁)) ↔ (bits‘(𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁)))) ⊆ (0..^𝑁))) |
120 | 116, 119 | mpbird 256 |
. . . . . 6
⊢ (𝜑 → (𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁))) ∈ (0..^(2↑𝑁))) |
121 | | elfzolt2 13325 |
. . . . . 6
⊢ ((𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁))) ∈ (0..^(2↑𝑁)) → (𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁))) < (2↑𝑁)) |
122 | 120, 121 | syl 17 |
. . . . 5
⊢ (𝜑 → (𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁))) < (2↑𝑁)) |
123 | | modid 13544 |
. . . . 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..^𝑁)))) |
124 | 107, 53, 108, 122, 123 | syl22anc 835 |
. . . 4
⊢ (𝜑 → ((𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁))) mod (2↑𝑁)) = (𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁)))) |
125 | 91, 95, 124 | 3eqtr2d 2784 |
. . 3
⊢ (𝜑 → ((𝐴 + 𝐵) mod (2↑𝑁)) = (𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁)))) |
126 | 125 | fveq2d 6760 |
. 2
⊢ (𝜑 → (bits‘((𝐴 + 𝐵) mod (2↑𝑁))) = (bits‘(𝐾‘(((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁))))) |
127 | 126, 115 | eqtr2d 2779 |
1
⊢ (𝜑 → (((bits‘𝐴) sadd (bits‘𝐵)) ∩ (0..^𝑁)) = (bits‘((𝐴 + 𝐵) mod (2↑𝑁)))) |