Proof of Theorem bitsres
Step | Hyp | Ref
| Expression |
1 | | simpl 483 |
. . . . . 6
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ 𝐴 ∈
ℤ) |
2 | | 2nn 12046 |
. . . . . . . 8
⊢ 2 ∈
ℕ |
3 | 2 | a1i 11 |
. . . . . . 7
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ 2 ∈ ℕ) |
4 | | simpr 485 |
. . . . . . 7
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ 𝑁 ∈
ℕ0) |
5 | 3, 4 | nnexpcld 13960 |
. . . . . 6
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ (2↑𝑁) ∈
ℕ) |
6 | 1, 5 | zmodcld 13612 |
. . . . 5
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ (𝐴 mod (2↑𝑁)) ∈
ℕ0) |
7 | 6 | nn0zd 12424 |
. . . 4
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ (𝐴 mod (2↑𝑁)) ∈
ℤ) |
8 | 7 | znegcld 12428 |
. . 3
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ -(𝐴 mod
(2↑𝑁)) ∈
ℤ) |
9 | | sadadd 16174 |
. . 3
⊢ ((-(𝐴 mod (2↑𝑁)) ∈ ℤ ∧ 𝐴 ∈ ℤ) → ((bits‘-(𝐴 mod (2↑𝑁))) sadd (bits‘𝐴)) = (bits‘(-(𝐴 mod (2↑𝑁)) + 𝐴))) |
10 | 8, 1, 9 | syl2anc 584 |
. 2
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ ((bits‘-(𝐴 mod
(2↑𝑁))) sadd
(bits‘𝐴)) =
(bits‘(-(𝐴 mod
(2↑𝑁)) + 𝐴))) |
11 | | sadadd 16174 |
. . . . . 6
⊢ ((-(𝐴 mod (2↑𝑁)) ∈ ℤ ∧ (𝐴 mod (2↑𝑁)) ∈ ℤ) →
((bits‘-(𝐴 mod
(2↑𝑁))) sadd
(bits‘(𝐴 mod
(2↑𝑁)))) =
(bits‘(-(𝐴 mod
(2↑𝑁)) + (𝐴 mod (2↑𝑁))))) |
12 | 8, 7, 11 | syl2anc 584 |
. . . . 5
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ ((bits‘-(𝐴 mod
(2↑𝑁))) sadd
(bits‘(𝐴 mod
(2↑𝑁)))) =
(bits‘(-(𝐴 mod
(2↑𝑁)) + (𝐴 mod (2↑𝑁))))) |
13 | 8 | zcnd 12427 |
. . . . . . . . 9
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ -(𝐴 mod
(2↑𝑁)) ∈
ℂ) |
14 | 7 | zcnd 12427 |
. . . . . . . . 9
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ (𝐴 mod (2↑𝑁)) ∈
ℂ) |
15 | 13, 14 | addcomd 11177 |
. . . . . . . 8
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ (-(𝐴 mod
(2↑𝑁)) + (𝐴 mod (2↑𝑁))) = ((𝐴 mod (2↑𝑁)) + -(𝐴 mod (2↑𝑁)))) |
16 | 14 | negidd 11322 |
. . . . . . . 8
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ ((𝐴 mod
(2↑𝑁)) + -(𝐴 mod (2↑𝑁))) = 0) |
17 | 15, 16 | eqtrd 2778 |
. . . . . . 7
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ (-(𝐴 mod
(2↑𝑁)) + (𝐴 mod (2↑𝑁))) = 0) |
18 | 17 | fveq2d 6778 |
. . . . . 6
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ (bits‘(-(𝐴 mod
(2↑𝑁)) + (𝐴 mod (2↑𝑁)))) = (bits‘0)) |
19 | | 0bits 16146 |
. . . . . 6
⊢
(bits‘0) = ∅ |
20 | 18, 19 | eqtrdi 2794 |
. . . . 5
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ (bits‘(-(𝐴 mod
(2↑𝑁)) + (𝐴 mod (2↑𝑁)))) = ∅) |
21 | 12, 20 | eqtrd 2778 |
. . . 4
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ ((bits‘-(𝐴 mod
(2↑𝑁))) sadd
(bits‘(𝐴 mod
(2↑𝑁)))) =
∅) |
22 | 21 | oveq1d 7290 |
. . 3
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ (((bits‘-(𝐴
mod (2↑𝑁))) sadd
(bits‘(𝐴 mod
(2↑𝑁)))) sadd
((bits‘𝐴) ∩
(ℤ≥‘𝑁))) = (∅ sadd ((bits‘𝐴) ∩
(ℤ≥‘𝑁)))) |
23 | | bitsss 16133 |
. . . . 5
⊢
(bits‘-(𝐴 mod
(2↑𝑁))) ⊆
ℕ0 |
24 | | bitsss 16133 |
. . . . 5
⊢
(bits‘(𝐴 mod
(2↑𝑁))) ⊆
ℕ0 |
25 | | inss1 4162 |
. . . . . 6
⊢
((bits‘𝐴)
∩ (ℤ≥‘𝑁)) ⊆ (bits‘𝐴) |
26 | | bitsss 16133 |
. . . . . . 7
⊢
(bits‘𝐴)
⊆ ℕ0 |
27 | 26 | a1i 11 |
. . . . . 6
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ (bits‘𝐴)
⊆ ℕ0) |
28 | 25, 27 | sstrid 3932 |
. . . . 5
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ ((bits‘𝐴)
∩ (ℤ≥‘𝑁)) ⊆
ℕ0) |
29 | | sadass 16178 |
. . . . 5
⊢
(((bits‘-(𝐴
mod (2↑𝑁))) ⊆
ℕ0 ∧ (bits‘(𝐴 mod (2↑𝑁))) ⊆ ℕ0 ∧
((bits‘𝐴) ∩
(ℤ≥‘𝑁)) ⊆ ℕ0) →
(((bits‘-(𝐴 mod
(2↑𝑁))) sadd
(bits‘(𝐴 mod
(2↑𝑁)))) sadd
((bits‘𝐴) ∩
(ℤ≥‘𝑁))) = ((bits‘-(𝐴 mod (2↑𝑁))) sadd ((bits‘(𝐴 mod (2↑𝑁))) sadd ((bits‘𝐴) ∩ (ℤ≥‘𝑁))))) |
30 | 23, 24, 28, 29 | mp3an12i 1464 |
. . . 4
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ (((bits‘-(𝐴
mod (2↑𝑁))) sadd
(bits‘(𝐴 mod
(2↑𝑁)))) sadd
((bits‘𝐴) ∩
(ℤ≥‘𝑁))) = ((bits‘-(𝐴 mod (2↑𝑁))) sadd ((bits‘(𝐴 mod (2↑𝑁))) sadd ((bits‘𝐴) ∩ (ℤ≥‘𝑁))))) |
31 | | bitsmod 16143 |
. . . . . . 7
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ (bits‘(𝐴 mod
(2↑𝑁))) =
((bits‘𝐴) ∩
(0..^𝑁))) |
32 | 31 | oveq1d 7290 |
. . . . . 6
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ ((bits‘(𝐴 mod
(2↑𝑁))) sadd
((bits‘𝐴) ∩
(ℤ≥‘𝑁))) = (((bits‘𝐴) ∩ (0..^𝑁)) sadd ((bits‘𝐴) ∩ (ℤ≥‘𝑁)))) |
33 | | inss1 4162 |
. . . . . . . . . 10
⊢
((bits‘𝐴)
∩ (0..^𝑁)) ⊆
(bits‘𝐴) |
34 | 33, 27 | sstrid 3932 |
. . . . . . . . 9
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ ((bits‘𝐴)
∩ (0..^𝑁)) ⊆
ℕ0) |
35 | | fzouzdisj 13423 |
. . . . . . . . . . . 12
⊢
((0..^𝑁) ∩
(ℤ≥‘𝑁)) = ∅ |
36 | 35 | ineq2i 4143 |
. . . . . . . . . . 11
⊢
((bits‘𝐴)
∩ ((0..^𝑁) ∩
(ℤ≥‘𝑁))) = ((bits‘𝐴) ∩ ∅) |
37 | | inindi 4160 |
. . . . . . . . . . 11
⊢
((bits‘𝐴)
∩ ((0..^𝑁) ∩
(ℤ≥‘𝑁))) = (((bits‘𝐴) ∩ (0..^𝑁)) ∩ ((bits‘𝐴) ∩ (ℤ≥‘𝑁))) |
38 | | in0 4325 |
. . . . . . . . . . 11
⊢
((bits‘𝐴)
∩ ∅) = ∅ |
39 | 36, 37, 38 | 3eqtr3i 2774 |
. . . . . . . . . 10
⊢
(((bits‘𝐴)
∩ (0..^𝑁)) ∩
((bits‘𝐴) ∩
(ℤ≥‘𝑁))) = ∅ |
40 | 39 | a1i 11 |
. . . . . . . . 9
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ (((bits‘𝐴)
∩ (0..^𝑁)) ∩
((bits‘𝐴) ∩
(ℤ≥‘𝑁))) = ∅) |
41 | 34, 28, 40 | saddisj 16172 |
. . . . . . . 8
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ (((bits‘𝐴)
∩ (0..^𝑁)) sadd
((bits‘𝐴) ∩
(ℤ≥‘𝑁))) = (((bits‘𝐴) ∩ (0..^𝑁)) ∪ ((bits‘𝐴) ∩ (ℤ≥‘𝑁)))) |
42 | | indi 4207 |
. . . . . . . 8
⊢
((bits‘𝐴)
∩ ((0..^𝑁) ∪
(ℤ≥‘𝑁))) = (((bits‘𝐴) ∩ (0..^𝑁)) ∪ ((bits‘𝐴) ∩ (ℤ≥‘𝑁))) |
43 | 41, 42 | eqtr4di 2796 |
. . . . . . 7
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ (((bits‘𝐴)
∩ (0..^𝑁)) sadd
((bits‘𝐴) ∩
(ℤ≥‘𝑁))) = ((bits‘𝐴) ∩ ((0..^𝑁) ∪ (ℤ≥‘𝑁)))) |
44 | | nn0uz 12620 |
. . . . . . . . . 10
⊢
ℕ0 = (ℤ≥‘0) |
45 | 4, 44 | eleqtrdi 2849 |
. . . . . . . . . . 11
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ 𝑁 ∈
(ℤ≥‘0)) |
46 | | fzouzsplit 13422 |
. . . . . . . . . . 11
⊢ (𝑁 ∈
(ℤ≥‘0) → (ℤ≥‘0) =
((0..^𝑁) ∪
(ℤ≥‘𝑁))) |
47 | 45, 46 | syl 17 |
. . . . . . . . . 10
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ (ℤ≥‘0) = ((0..^𝑁) ∪ (ℤ≥‘𝑁))) |
48 | 44, 47 | eqtrid 2790 |
. . . . . . . . 9
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ ℕ0 = ((0..^𝑁) ∪ (ℤ≥‘𝑁))) |
49 | 26, 48 | sseqtrid 3973 |
. . . . . . . 8
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ (bits‘𝐴)
⊆ ((0..^𝑁) ∪
(ℤ≥‘𝑁))) |
50 | | df-ss 3904 |
. . . . . . . 8
⊢
((bits‘𝐴)
⊆ ((0..^𝑁) ∪
(ℤ≥‘𝑁)) ↔ ((bits‘𝐴) ∩ ((0..^𝑁) ∪ (ℤ≥‘𝑁))) = (bits‘𝐴)) |
51 | 49, 50 | sylib 217 |
. . . . . . 7
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ ((bits‘𝐴)
∩ ((0..^𝑁) ∪
(ℤ≥‘𝑁))) = (bits‘𝐴)) |
52 | 43, 51 | eqtrd 2778 |
. . . . . 6
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ (((bits‘𝐴)
∩ (0..^𝑁)) sadd
((bits‘𝐴) ∩
(ℤ≥‘𝑁))) = (bits‘𝐴)) |
53 | 32, 52 | eqtrd 2778 |
. . . . 5
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ ((bits‘(𝐴 mod
(2↑𝑁))) sadd
((bits‘𝐴) ∩
(ℤ≥‘𝑁))) = (bits‘𝐴)) |
54 | 53 | oveq2d 7291 |
. . . 4
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ ((bits‘-(𝐴 mod
(2↑𝑁))) sadd
((bits‘(𝐴 mod
(2↑𝑁))) sadd
((bits‘𝐴) ∩
(ℤ≥‘𝑁)))) = ((bits‘-(𝐴 mod (2↑𝑁))) sadd (bits‘𝐴))) |
55 | 30, 54 | eqtrd 2778 |
. . 3
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ (((bits‘-(𝐴
mod (2↑𝑁))) sadd
(bits‘(𝐴 mod
(2↑𝑁)))) sadd
((bits‘𝐴) ∩
(ℤ≥‘𝑁))) = ((bits‘-(𝐴 mod (2↑𝑁))) sadd (bits‘𝐴))) |
56 | | sadid2 16176 |
. . . 4
⊢
(((bits‘𝐴)
∩ (ℤ≥‘𝑁)) ⊆ ℕ0 →
(∅ sadd ((bits‘𝐴) ∩ (ℤ≥‘𝑁))) = ((bits‘𝐴) ∩
(ℤ≥‘𝑁))) |
57 | 28, 56 | syl 17 |
. . 3
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ (∅ sadd ((bits‘𝐴) ∩ (ℤ≥‘𝑁))) = ((bits‘𝐴) ∩
(ℤ≥‘𝑁))) |
58 | 22, 55, 57 | 3eqtr3d 2786 |
. 2
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ ((bits‘-(𝐴 mod
(2↑𝑁))) sadd
(bits‘𝐴)) =
((bits‘𝐴) ∩
(ℤ≥‘𝑁))) |
59 | 1 | zcnd 12427 |
. . . . 5
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ 𝐴 ∈
ℂ) |
60 | 13, 59 | addcomd 11177 |
. . . 4
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ (-(𝐴 mod
(2↑𝑁)) + 𝐴) = (𝐴 + -(𝐴 mod (2↑𝑁)))) |
61 | 59, 14 | negsubd 11338 |
. . . . 5
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ (𝐴 + -(𝐴 mod (2↑𝑁))) = (𝐴 − (𝐴 mod (2↑𝑁)))) |
62 | 59, 14 | subcld 11332 |
. . . . . 6
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ (𝐴 − (𝐴 mod (2↑𝑁))) ∈ ℂ) |
63 | 5 | nncnd 11989 |
. . . . . 6
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ (2↑𝑁) ∈
ℂ) |
64 | 5 | nnne0d 12023 |
. . . . . 6
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ (2↑𝑁) ≠
0) |
65 | 62, 63, 64 | divcan1d 11752 |
. . . . 5
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ (((𝐴 − (𝐴 mod (2↑𝑁))) / (2↑𝑁)) · (2↑𝑁)) = (𝐴 − (𝐴 mod (2↑𝑁)))) |
66 | 1 | zred 12426 |
. . . . . . 7
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ 𝐴 ∈
ℝ) |
67 | 5 | nnrpd 12770 |
. . . . . . 7
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ (2↑𝑁) ∈
ℝ+) |
68 | | moddiffl 13602 |
. . . . . . 7
⊢ ((𝐴 ∈ ℝ ∧
(2↑𝑁) ∈
ℝ+) → ((𝐴 − (𝐴 mod (2↑𝑁))) / (2↑𝑁)) = (⌊‘(𝐴 / (2↑𝑁)))) |
69 | 66, 67, 68 | syl2anc 584 |
. . . . . 6
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ ((𝐴 − (𝐴 mod (2↑𝑁))) / (2↑𝑁)) = (⌊‘(𝐴 / (2↑𝑁)))) |
70 | 69 | oveq1d 7290 |
. . . . 5
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ (((𝐴 − (𝐴 mod (2↑𝑁))) / (2↑𝑁)) · (2↑𝑁)) = ((⌊‘(𝐴 / (2↑𝑁))) · (2↑𝑁))) |
71 | 61, 65, 70 | 3eqtr2d 2784 |
. . . 4
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ (𝐴 + -(𝐴 mod (2↑𝑁))) = ((⌊‘(𝐴 / (2↑𝑁))) · (2↑𝑁))) |
72 | 60, 71 | eqtrd 2778 |
. . 3
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ (-(𝐴 mod
(2↑𝑁)) + 𝐴) = ((⌊‘(𝐴 / (2↑𝑁))) · (2↑𝑁))) |
73 | 72 | fveq2d 6778 |
. 2
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ (bits‘(-(𝐴 mod
(2↑𝑁)) + 𝐴)) =
(bits‘((⌊‘(𝐴 / (2↑𝑁))) · (2↑𝑁)))) |
74 | 10, 58, 73 | 3eqtr3d 2786 |
1
⊢ ((𝐴 ∈ ℤ ∧ 𝑁 ∈ ℕ0)
→ ((bits‘𝐴)
∩ (ℤ≥‘𝑁)) = (bits‘((⌊‘(𝐴 / (2↑𝑁))) · (2↑𝑁)))) |