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

Theorem bitsinv1 15964
Description: There is an explicit inverse to the bits function for nonnegative integers (which can be extended to negative integers using bitscmp 15960), part 1. (Contributed by Mario Carneiro, 7-Sep-2016.)
Assertion
Ref Expression
bitsinv1 (𝑁 ∈ ℕ0 → Σ𝑛 ∈ (bits‘𝑁)(2↑𝑛) = 𝑁)
Distinct variable group:   𝑛,𝑁

Proof of Theorem bitsinv1
Dummy variables 𝑘 𝑥 are mutually distinct and distinct from all other variables.
StepHypRef Expression
1 oveq2 7199 . . . . . . . . . . 11 (𝑥 = 0 → (0..^𝑥) = (0..^0))
2 fzo0 13231 . . . . . . . . . . 11 (0..^0) = ∅
31, 2eqtrdi 2787 . . . . . . . . . 10 (𝑥 = 0 → (0..^𝑥) = ∅)
43ineq2d 4113 . . . . . . . . 9 (𝑥 = 0 → ((bits‘𝑁) ∩ (0..^𝑥)) = ((bits‘𝑁) ∩ ∅))
5 in0 4292 . . . . . . . . 9 ((bits‘𝑁) ∩ ∅) = ∅
64, 5eqtrdi 2787 . . . . . . . 8 (𝑥 = 0 → ((bits‘𝑁) ∩ (0..^𝑥)) = ∅)
76sumeq1d 15230 . . . . . . 7 (𝑥 = 0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = Σ𝑛 ∈ ∅ (2↑𝑛))
8 sum0 15250 . . . . . . 7 Σ𝑛 ∈ ∅ (2↑𝑛) = 0
97, 8eqtrdi 2787 . . . . . 6 (𝑥 = 0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = 0)
10 oveq2 7199 . . . . . . . 8 (𝑥 = 0 → (2↑𝑥) = (2↑0))
11 2cn 11870 . . . . . . . . 9 2 ∈ ℂ
12 exp0 13604 . . . . . . . . 9 (2 ∈ ℂ → (2↑0) = 1)
1311, 12ax-mp 5 . . . . . . . 8 (2↑0) = 1
1410, 13eqtrdi 2787 . . . . . . 7 (𝑥 = 0 → (2↑𝑥) = 1)
1514oveq2d 7207 . . . . . 6 (𝑥 = 0 → (𝑁 mod (2↑𝑥)) = (𝑁 mod 1))
169, 15eqeq12d 2752 . . . . 5 (𝑥 = 0 → (Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = (𝑁 mod (2↑𝑥)) ↔ 0 = (𝑁 mod 1)))
1716imbi2d 344 . . . 4 (𝑥 = 0 → ((𝑁 ∈ ℕ0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = (𝑁 mod (2↑𝑥))) ↔ (𝑁 ∈ ℕ0 → 0 = (𝑁 mod 1))))
18 oveq2 7199 . . . . . . . 8 (𝑥 = 𝑘 → (0..^𝑥) = (0..^𝑘))
1918ineq2d 4113 . . . . . . 7 (𝑥 = 𝑘 → ((bits‘𝑁) ∩ (0..^𝑥)) = ((bits‘𝑁) ∩ (0..^𝑘)))
2019sumeq1d 15230 . . . . . 6 (𝑥 = 𝑘 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑘))(2↑𝑛))
21 oveq2 7199 . . . . . . 7 (𝑥 = 𝑘 → (2↑𝑥) = (2↑𝑘))
2221oveq2d 7207 . . . . . 6 (𝑥 = 𝑘 → (𝑁 mod (2↑𝑥)) = (𝑁 mod (2↑𝑘)))
2320, 22eqeq12d 2752 . . . . 5 (𝑥 = 𝑘 → (Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = (𝑁 mod (2↑𝑥)) ↔ Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑘))(2↑𝑛) = (𝑁 mod (2↑𝑘))))
2423imbi2d 344 . . . 4 (𝑥 = 𝑘 → ((𝑁 ∈ ℕ0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = (𝑁 mod (2↑𝑥))) ↔ (𝑁 ∈ ℕ0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑘))(2↑𝑛) = (𝑁 mod (2↑𝑘)))))
25 oveq2 7199 . . . . . . . 8 (𝑥 = (𝑘 + 1) → (0..^𝑥) = (0..^(𝑘 + 1)))
2625ineq2d 4113 . . . . . . 7 (𝑥 = (𝑘 + 1) → ((bits‘𝑁) ∩ (0..^𝑥)) = ((bits‘𝑁) ∩ (0..^(𝑘 + 1))))
2726sumeq1d 15230 . . . . . 6 (𝑥 = (𝑘 + 1) → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))(2↑𝑛))
28 oveq2 7199 . . . . . . 7 (𝑥 = (𝑘 + 1) → (2↑𝑥) = (2↑(𝑘 + 1)))
2928oveq2d 7207 . . . . . 6 (𝑥 = (𝑘 + 1) → (𝑁 mod (2↑𝑥)) = (𝑁 mod (2↑(𝑘 + 1))))
3027, 29eqeq12d 2752 . . . . 5 (𝑥 = (𝑘 + 1) → (Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = (𝑁 mod (2↑𝑥)) ↔ Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))(2↑𝑛) = (𝑁 mod (2↑(𝑘 + 1)))))
3130imbi2d 344 . . . 4 (𝑥 = (𝑘 + 1) → ((𝑁 ∈ ℕ0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = (𝑁 mod (2↑𝑥))) ↔ (𝑁 ∈ ℕ0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))(2↑𝑛) = (𝑁 mod (2↑(𝑘 + 1))))))
32 oveq2 7199 . . . . . . . 8 (𝑥 = 𝑁 → (0..^𝑥) = (0..^𝑁))
3332ineq2d 4113 . . . . . . 7 (𝑥 = 𝑁 → ((bits‘𝑁) ∩ (0..^𝑥)) = ((bits‘𝑁) ∩ (0..^𝑁)))
3433sumeq1d 15230 . . . . . 6 (𝑥 = 𝑁 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑁))(2↑𝑛))
35 oveq2 7199 . . . . . . 7 (𝑥 = 𝑁 → (2↑𝑥) = (2↑𝑁))
3635oveq2d 7207 . . . . . 6 (𝑥 = 𝑁 → (𝑁 mod (2↑𝑥)) = (𝑁 mod (2↑𝑁)))
3734, 36eqeq12d 2752 . . . . 5 (𝑥 = 𝑁 → (Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = (𝑁 mod (2↑𝑥)) ↔ Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑁))(2↑𝑛) = (𝑁 mod (2↑𝑁))))
3837imbi2d 344 . . . 4 (𝑥 = 𝑁 → ((𝑁 ∈ ℕ0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = (𝑁 mod (2↑𝑥))) ↔ (𝑁 ∈ ℕ0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑁))(2↑𝑛) = (𝑁 mod (2↑𝑁)))))
39 nn0z 12165 . . . . . 6 (𝑁 ∈ ℕ0𝑁 ∈ ℤ)
40 zmod10 13425 . . . . . 6 (𝑁 ∈ ℤ → (𝑁 mod 1) = 0)
4139, 40syl 17 . . . . 5 (𝑁 ∈ ℕ0 → (𝑁 mod 1) = 0)
4241eqcomd 2742 . . . 4 (𝑁 ∈ ℕ0 → 0 = (𝑁 mod 1))
43 oveq1 7198 . . . . . . 7 𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑘))(2↑𝑛) = (𝑁 mod (2↑𝑘)) → (Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑘))(2↑𝑛) + Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛)) = ((𝑁 mod (2↑𝑘)) + Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛)))
44 fzonel 13221 . . . . . . . . . . . . 13 ¬ 𝑘 ∈ (0..^𝑘)
4544a1i 11 . . . . . . . . . . . 12 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → ¬ 𝑘 ∈ (0..^𝑘))
46 disjsn 4613 . . . . . . . . . . . 12 (((0..^𝑘) ∩ {𝑘}) = ∅ ↔ ¬ 𝑘 ∈ (0..^𝑘))
4745, 46sylibr 237 . . . . . . . . . . 11 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → ((0..^𝑘) ∩ {𝑘}) = ∅)
4847ineq2d 4113 . . . . . . . . . 10 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → ((bits‘𝑁) ∩ ((0..^𝑘) ∩ {𝑘})) = ((bits‘𝑁) ∩ ∅))
49 inindi 4127 . . . . . . . . . 10 ((bits‘𝑁) ∩ ((0..^𝑘) ∩ {𝑘})) = (((bits‘𝑁) ∩ (0..^𝑘)) ∩ ((bits‘𝑁) ∩ {𝑘}))
5048, 49, 53eqtr3g 2794 . . . . . . . . 9 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → (((bits‘𝑁) ∩ (0..^𝑘)) ∩ ((bits‘𝑁) ∩ {𝑘})) = ∅)
51 simpr 488 . . . . . . . . . . . . 13 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → 𝑘 ∈ ℕ0)
52 nn0uz 12441 . . . . . . . . . . . . 13 0 = (ℤ‘0)
5351, 52eleqtrdi 2841 . . . . . . . . . . . 12 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → 𝑘 ∈ (ℤ‘0))
54 fzosplitsn 13315 . . . . . . . . . . . 12 (𝑘 ∈ (ℤ‘0) → (0..^(𝑘 + 1)) = ((0..^𝑘) ∪ {𝑘}))
5553, 54syl 17 . . . . . . . . . . 11 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → (0..^(𝑘 + 1)) = ((0..^𝑘) ∪ {𝑘}))
5655ineq2d 4113 . . . . . . . . . 10 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → ((bits‘𝑁) ∩ (0..^(𝑘 + 1))) = ((bits‘𝑁) ∩ ((0..^𝑘) ∪ {𝑘})))
57 indi 4174 . . . . . . . . . 10 ((bits‘𝑁) ∩ ((0..^𝑘) ∪ {𝑘})) = (((bits‘𝑁) ∩ (0..^𝑘)) ∪ ((bits‘𝑁) ∩ {𝑘}))
5856, 57eqtrdi 2787 . . . . . . . . 9 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → ((bits‘𝑁) ∩ (0..^(𝑘 + 1))) = (((bits‘𝑁) ∩ (0..^𝑘)) ∪ ((bits‘𝑁) ∩ {𝑘})))
59 fzofi 13512 . . . . . . . . . . 11 (0..^(𝑘 + 1)) ∈ Fin
60 inss2 4130 . . . . . . . . . . 11 ((bits‘𝑁) ∩ (0..^(𝑘 + 1))) ⊆ (0..^(𝑘 + 1))
61 ssfi 8829 . . . . . . . . . . 11 (((0..^(𝑘 + 1)) ∈ Fin ∧ ((bits‘𝑁) ∩ (0..^(𝑘 + 1))) ⊆ (0..^(𝑘 + 1))) → ((bits‘𝑁) ∩ (0..^(𝑘 + 1))) ∈ Fin)
6259, 60, 61mp2an 692 . . . . . . . . . 10 ((bits‘𝑁) ∩ (0..^(𝑘 + 1))) ∈ Fin
6362a1i 11 . . . . . . . . 9 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → ((bits‘𝑁) ∩ (0..^(𝑘 + 1))) ∈ Fin)
64 2nn 11868 . . . . . . . . . . . 12 2 ∈ ℕ
6564a1i 11 . . . . . . . . . . 11 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))) → 2 ∈ ℕ)
66 simpr 488 . . . . . . . . . . . . . 14 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))) → 𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1))))
6766elin2d 4099 . . . . . . . . . . . . 13 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))) → 𝑛 ∈ (0..^(𝑘 + 1)))
68 elfzouz 13212 . . . . . . . . . . . . 13 (𝑛 ∈ (0..^(𝑘 + 1)) → 𝑛 ∈ (ℤ‘0))
6967, 68syl 17 . . . . . . . . . . . 12 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))) → 𝑛 ∈ (ℤ‘0))
7069, 52eleqtrrdi 2842 . . . . . . . . . . 11 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))) → 𝑛 ∈ ℕ0)
7165, 70nnexpcld 13777 . . . . . . . . . 10 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))) → (2↑𝑛) ∈ ℕ)
7271nncnd 11811 . . . . . . . . 9 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))) → (2↑𝑛) ∈ ℂ)
7350, 58, 63, 72fsumsplit 15269 . . . . . . . 8 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))(2↑𝑛) = (Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑘))(2↑𝑛) + Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛)))
74 bitsinv1lem 15963 . . . . . . . . . 10 ((𝑁 ∈ ℤ ∧ 𝑘 ∈ ℕ0) → (𝑁 mod (2↑(𝑘 + 1))) = ((𝑁 mod (2↑𝑘)) + if(𝑘 ∈ (bits‘𝑁), (2↑𝑘), 0)))
7539, 74sylan 583 . . . . . . . . 9 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → (𝑁 mod (2↑(𝑘 + 1))) = ((𝑁 mod (2↑𝑘)) + if(𝑘 ∈ (bits‘𝑁), (2↑𝑘), 0)))
76 eqeq2 2748 . . . . . . . . . . 11 ((2↑𝑘) = if(𝑘 ∈ (bits‘𝑁), (2↑𝑘), 0) → (Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛) = (2↑𝑘) ↔ Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛) = if(𝑘 ∈ (bits‘𝑁), (2↑𝑘), 0)))
77 eqeq2 2748 . . . . . . . . . . 11 (0 = if(𝑘 ∈ (bits‘𝑁), (2↑𝑘), 0) → (Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛) = 0 ↔ Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛) = if(𝑘 ∈ (bits‘𝑁), (2↑𝑘), 0)))
78 simpr 488 . . . . . . . . . . . . . . 15 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑘 ∈ (bits‘𝑁)) → 𝑘 ∈ (bits‘𝑁))
7978snssd 4708 . . . . . . . . . . . . . 14 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑘 ∈ (bits‘𝑁)) → {𝑘} ⊆ (bits‘𝑁))
80 sseqin2 4116 . . . . . . . . . . . . . 14 ({𝑘} ⊆ (bits‘𝑁) ↔ ((bits‘𝑁) ∩ {𝑘}) = {𝑘})
8179, 80sylib 221 . . . . . . . . . . . . 13 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑘 ∈ (bits‘𝑁)) → ((bits‘𝑁) ∩ {𝑘}) = {𝑘})
8281sumeq1d 15230 . . . . . . . . . . . 12 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑘 ∈ (bits‘𝑁)) → Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛) = Σ𝑛 ∈ {𝑘} (2↑𝑛))
83 simplr 769 . . . . . . . . . . . . 13 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑘 ∈ (bits‘𝑁)) → 𝑘 ∈ ℕ0)
8464a1i 11 . . . . . . . . . . . . . . 15 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑘 ∈ (bits‘𝑁)) → 2 ∈ ℕ)
8584, 83nnexpcld 13777 . . . . . . . . . . . . . 14 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑘 ∈ (bits‘𝑁)) → (2↑𝑘) ∈ ℕ)
8685nncnd 11811 . . . . . . . . . . . . 13 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑘 ∈ (bits‘𝑁)) → (2↑𝑘) ∈ ℂ)
87 oveq2 7199 . . . . . . . . . . . . . 14 (𝑛 = 𝑘 → (2↑𝑛) = (2↑𝑘))
8887sumsn 15273 . . . . . . . . . . . . 13 ((𝑘 ∈ ℕ0 ∧ (2↑𝑘) ∈ ℂ) → Σ𝑛 ∈ {𝑘} (2↑𝑛) = (2↑𝑘))
8983, 86, 88syl2anc 587 . . . . . . . . . . . 12 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑘 ∈ (bits‘𝑁)) → Σ𝑛 ∈ {𝑘} (2↑𝑛) = (2↑𝑘))
9082, 89eqtrd 2771 . . . . . . . . . . 11 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑘 ∈ (bits‘𝑁)) → Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛) = (2↑𝑘))
91 simpr 488 . . . . . . . . . . . . . 14 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ ¬ 𝑘 ∈ (bits‘𝑁)) → ¬ 𝑘 ∈ (bits‘𝑁))
92 disjsn 4613 . . . . . . . . . . . . . 14 (((bits‘𝑁) ∩ {𝑘}) = ∅ ↔ ¬ 𝑘 ∈ (bits‘𝑁))
9391, 92sylibr 237 . . . . . . . . . . . . 13 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ ¬ 𝑘 ∈ (bits‘𝑁)) → ((bits‘𝑁) ∩ {𝑘}) = ∅)
9493sumeq1d 15230 . . . . . . . . . . . 12 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ ¬ 𝑘 ∈ (bits‘𝑁)) → Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛) = Σ𝑛 ∈ ∅ (2↑𝑛))
9594, 8eqtrdi 2787 . . . . . . . . . . 11 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ ¬ 𝑘 ∈ (bits‘𝑁)) → Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛) = 0)
9676, 77, 90, 95ifbothda 4463 . . . . . . . . . 10 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛) = if(𝑘 ∈ (bits‘𝑁), (2↑𝑘), 0))
9796oveq2d 7207 . . . . . . . . 9 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → ((𝑁 mod (2↑𝑘)) + Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛)) = ((𝑁 mod (2↑𝑘)) + if(𝑘 ∈ (bits‘𝑁), (2↑𝑘), 0)))
9875, 97eqtr4d 2774 . . . . . . . 8 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → (𝑁 mod (2↑(𝑘 + 1))) = ((𝑁 mod (2↑𝑘)) + Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛)))
9973, 98eqeq12d 2752 . . . . . . 7 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → (Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))(2↑𝑛) = (𝑁 mod (2↑(𝑘 + 1))) ↔ (Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑘))(2↑𝑛) + Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛)) = ((𝑁 mod (2↑𝑘)) + Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛))))
10043, 99syl5ibr 249 . . . . . 6 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → (Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑘))(2↑𝑛) = (𝑁 mod (2↑𝑘)) → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))(2↑𝑛) = (𝑁 mod (2↑(𝑘 + 1)))))
101100expcom 417 . . . . 5 (𝑘 ∈ ℕ0 → (𝑁 ∈ ℕ0 → (Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑘))(2↑𝑛) = (𝑁 mod (2↑𝑘)) → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))(2↑𝑛) = (𝑁 mod (2↑(𝑘 + 1))))))
102101a2d 29 . . . 4 (𝑘 ∈ ℕ0 → ((𝑁 ∈ ℕ0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑘))(2↑𝑛) = (𝑁 mod (2↑𝑘))) → (𝑁 ∈ ℕ0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))(2↑𝑛) = (𝑁 mod (2↑(𝑘 + 1))))))
10317, 24, 31, 38, 42, 102nn0ind 12237 . . 3 (𝑁 ∈ ℕ0 → (𝑁 ∈ ℕ0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑁))(2↑𝑛) = (𝑁 mod (2↑𝑁))))
104103pm2.43i 52 . 2 (𝑁 ∈ ℕ0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑁))(2↑𝑛) = (𝑁 mod (2↑𝑁)))
105 id 22 . . . . . . 7 (𝑁 ∈ ℕ0𝑁 ∈ ℕ0)
106105, 52eleqtrdi 2841 . . . . . 6 (𝑁 ∈ ℕ0𝑁 ∈ (ℤ‘0))
10764a1i 11 . . . . . . . 8 (𝑁 ∈ ℕ0 → 2 ∈ ℕ)
108107, 105nnexpcld 13777 . . . . . . 7 (𝑁 ∈ ℕ0 → (2↑𝑁) ∈ ℕ)
109108nnzd 12246 . . . . . 6 (𝑁 ∈ ℕ0 → (2↑𝑁) ∈ ℤ)
110 2z 12174 . . . . . . . 8 2 ∈ ℤ
111 uzid 12418 . . . . . . . 8 (2 ∈ ℤ → 2 ∈ (ℤ‘2))
112110, 111ax-mp 5 . . . . . . 7 2 ∈ (ℤ‘2)
113 bernneq3 13763 . . . . . . 7 ((2 ∈ (ℤ‘2) ∧ 𝑁 ∈ ℕ0) → 𝑁 < (2↑𝑁))
114112, 113mpan 690 . . . . . 6 (𝑁 ∈ ℕ0𝑁 < (2↑𝑁))
115 elfzo2 13211 . . . . . 6 (𝑁 ∈ (0..^(2↑𝑁)) ↔ (𝑁 ∈ (ℤ‘0) ∧ (2↑𝑁) ∈ ℤ ∧ 𝑁 < (2↑𝑁)))
116106, 109, 114, 115syl3anbrc 1345 . . . . 5 (𝑁 ∈ ℕ0𝑁 ∈ (0..^(2↑𝑁)))
117 bitsfzo 15957 . . . . . 6 ((𝑁 ∈ ℤ ∧ 𝑁 ∈ ℕ0) → (𝑁 ∈ (0..^(2↑𝑁)) ↔ (bits‘𝑁) ⊆ (0..^𝑁)))
11839, 105, 117syl2anc 587 . . . . 5 (𝑁 ∈ ℕ0 → (𝑁 ∈ (0..^(2↑𝑁)) ↔ (bits‘𝑁) ⊆ (0..^𝑁)))
119116, 118mpbid 235 . . . 4 (𝑁 ∈ ℕ0 → (bits‘𝑁) ⊆ (0..^𝑁))
120 df-ss 3870 . . . 4 ((bits‘𝑁) ⊆ (0..^𝑁) ↔ ((bits‘𝑁) ∩ (0..^𝑁)) = (bits‘𝑁))
121119, 120sylib 221 . . 3 (𝑁 ∈ ℕ0 → ((bits‘𝑁) ∩ (0..^𝑁)) = (bits‘𝑁))
122121sumeq1d 15230 . 2 (𝑁 ∈ ℕ0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑁))(2↑𝑛) = Σ𝑛 ∈ (bits‘𝑁)(2↑𝑛))
123 nn0re 12064 . . 3 (𝑁 ∈ ℕ0𝑁 ∈ ℝ)
124 2rp 12556 . . . . 5 2 ∈ ℝ+
125124a1i 11 . . . 4 (𝑁 ∈ ℕ0 → 2 ∈ ℝ+)
126125, 39rpexpcld 13779 . . 3 (𝑁 ∈ ℕ0 → (2↑𝑁) ∈ ℝ+)
127 nn0ge0 12080 . . 3 (𝑁 ∈ ℕ0 → 0 ≤ 𝑁)
128 modid 13434 . . 3 (((𝑁 ∈ ℝ ∧ (2↑𝑁) ∈ ℝ+) ∧ (0 ≤ 𝑁𝑁 < (2↑𝑁))) → (𝑁 mod (2↑𝑁)) = 𝑁)
129123, 126, 127, 114, 128syl22anc 839 . 2 (𝑁 ∈ ℕ0 → (𝑁 mod (2↑𝑁)) = 𝑁)
130104, 122, 1293eqtr3d 2779 1 (𝑁 ∈ ℕ0 → Σ𝑛 ∈ (bits‘𝑁)(2↑𝑛) = 𝑁)
Colors of variables: wff setvar class
Syntax hints:  ¬ wn 3  wi 4  wb 209  wa 399   = wceq 1543  wcel 2112  cun 3851  cin 3852  wss 3853  c0 4223  ifcif 4425  {csn 4527   class class class wbr 5039  cfv 6358  (class class class)co 7191  Fincfn 8604  cc 10692  cr 10693  0cc0 10694  1c1 10695   + caddc 10697   < clt 10832  cle 10833  cn 11795  2c2 11850  0cn0 12055  cz 12141  cuz 12403  +crp 12551  ..^cfzo 13203   mod cmo 13407  cexp 13600  Σcsu 15214  bitscbits 15941
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-3 8  ax-gen 1803  ax-4 1817  ax-5 1918  ax-6 1976  ax-7 2018  ax-8 2114  ax-9 2122  ax-10 2143  ax-11 2160  ax-12 2177  ax-ext 2708  ax-rep 5164  ax-sep 5177  ax-nul 5184  ax-pow 5243  ax-pr 5307  ax-un 7501  ax-inf2 9234  ax-cnex 10750  ax-resscn 10751  ax-1cn 10752  ax-icn 10753  ax-addcl 10754  ax-addrcl 10755  ax-mulcl 10756  ax-mulrcl 10757  ax-mulcom 10758  ax-addass 10759  ax-mulass 10760  ax-distr 10761  ax-i2m1 10762  ax-1ne0 10763  ax-1rid 10764  ax-rnegex 10765  ax-rrecex 10766  ax-cnre 10767  ax-pre-lttri 10768  ax-pre-lttrn 10769  ax-pre-ltadd 10770  ax-pre-mulgt0 10771  ax-pre-sup 10772
This theorem depends on definitions:  df-bi 210  df-an 400  df-or 848  df-3or 1090  df-3an 1091  df-tru 1546  df-fal 1556  df-ex 1788  df-nf 1792  df-sb 2073  df-mo 2539  df-eu 2568  df-clab 2715  df-cleq 2728  df-clel 2809  df-nfc 2879  df-ne 2933  df-nel 3037  df-ral 3056  df-rex 3057  df-reu 3058  df-rmo 3059  df-rab 3060  df-v 3400  df-sbc 3684  df-csb 3799  df-dif 3856  df-un 3858  df-in 3860  df-ss 3870  df-pss 3872  df-nul 4224  df-if 4426  df-pw 4501  df-sn 4528  df-pr 4530  df-tp 4532  df-op 4534  df-uni 4806  df-int 4846  df-iun 4892  df-br 5040  df-opab 5102  df-mpt 5121  df-tr 5147  df-id 5440  df-eprel 5445  df-po 5453  df-so 5454  df-fr 5494  df-se 5495  df-we 5496  df-xp 5542  df-rel 5543  df-cnv 5544  df-co 5545  df-dm 5546  df-rn 5547  df-res 5548  df-ima 5549  df-pred 6140  df-ord 6194  df-on 6195  df-lim 6196  df-suc 6197  df-iota 6316  df-fun 6360  df-fn 6361  df-f 6362  df-f1 6363  df-fo 6364  df-f1o 6365  df-fv 6366  df-isom 6367  df-riota 7148  df-ov 7194  df-oprab 7195  df-mpo 7196  df-om 7623  df-1st 7739  df-2nd 7740  df-wrecs 8025  df-recs 8086  df-rdg 8124  df-1o 8180  df-er 8369  df-en 8605  df-dom 8606  df-sdom 8607  df-fin 8608  df-sup 9036  df-inf 9037  df-oi 9104  df-card 9520  df-pnf 10834  df-mnf 10835  df-xr 10836  df-ltxr 10837  df-le 10838  df-sub 11029  df-neg 11030  df-div 11455  df-nn 11796  df-2 11858  df-3 11859  df-n0 12056  df-z 12142  df-uz 12404  df-rp 12552  df-fz 13061  df-fzo 13204  df-fl 13332  df-mod 13408  df-seq 13540  df-exp 13601  df-hash 13862  df-cj 14627  df-re 14628  df-im 14629  df-sqrt 14763  df-abs 14764  df-clim 15014  df-sum 15215  df-dvds 15779  df-bits 15944
This theorem is referenced by:  bitsinv2  15965  bitsf1ocnv  15966  eulerpartlemgc  31995  eulerpartlemgs2  32013
  Copyright terms: Public domain W3C validator