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

Theorem bitsinv1 16322
Description: There is an explicit inverse to the bits function for nonnegative integers (which can be extended to negative integers using bitscmp 16318), 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 7365 . . . . . . . . . . 11 (𝑥 = 0 → (0..^𝑥) = (0..^0))
2 fzo0 13596 . . . . . . . . . . 11 (0..^0) = ∅
31, 2eqtrdi 2792 . . . . . . . . . 10 (𝑥 = 0 → (0..^𝑥) = ∅)
43ineq2d 4172 . . . . . . . . 9 (𝑥 = 0 → ((bits‘𝑁) ∩ (0..^𝑥)) = ((bits‘𝑁) ∩ ∅))
5 in0 4351 . . . . . . . . 9 ((bits‘𝑁) ∩ ∅) = ∅
64, 5eqtrdi 2792 . . . . . . . 8 (𝑥 = 0 → ((bits‘𝑁) ∩ (0..^𝑥)) = ∅)
76sumeq1d 15586 . . . . . . 7 (𝑥 = 0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = Σ𝑛 ∈ ∅ (2↑𝑛))
8 sum0 15606 . . . . . . 7 Σ𝑛 ∈ ∅ (2↑𝑛) = 0
97, 8eqtrdi 2792 . . . . . 6 (𝑥 = 0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = 0)
10 oveq2 7365 . . . . . . . 8 (𝑥 = 0 → (2↑𝑥) = (2↑0))
11 2cn 12228 . . . . . . . . 9 2 ∈ ℂ
12 exp0 13971 . . . . . . . . 9 (2 ∈ ℂ → (2↑0) = 1)
1311, 12ax-mp 5 . . . . . . . 8 (2↑0) = 1
1410, 13eqtrdi 2792 . . . . . . 7 (𝑥 = 0 → (2↑𝑥) = 1)
1514oveq2d 7373 . . . . . 6 (𝑥 = 0 → (𝑁 mod (2↑𝑥)) = (𝑁 mod 1))
169, 15eqeq12d 2752 . . . . 5 (𝑥 = 0 → (Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = (𝑁 mod (2↑𝑥)) ↔ 0 = (𝑁 mod 1)))
1716imbi2d 340 . . . 4 (𝑥 = 0 → ((𝑁 ∈ ℕ0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = (𝑁 mod (2↑𝑥))) ↔ (𝑁 ∈ ℕ0 → 0 = (𝑁 mod 1))))
18 oveq2 7365 . . . . . . . 8 (𝑥 = 𝑘 → (0..^𝑥) = (0..^𝑘))
1918ineq2d 4172 . . . . . . 7 (𝑥 = 𝑘 → ((bits‘𝑁) ∩ (0..^𝑥)) = ((bits‘𝑁) ∩ (0..^𝑘)))
2019sumeq1d 15586 . . . . . 6 (𝑥 = 𝑘 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑘))(2↑𝑛))
21 oveq2 7365 . . . . . . 7 (𝑥 = 𝑘 → (2↑𝑥) = (2↑𝑘))
2221oveq2d 7373 . . . . . 6 (𝑥 = 𝑘 → (𝑁 mod (2↑𝑥)) = (𝑁 mod (2↑𝑘)))
2320, 22eqeq12d 2752 . . . . 5 (𝑥 = 𝑘 → (Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = (𝑁 mod (2↑𝑥)) ↔ Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑘))(2↑𝑛) = (𝑁 mod (2↑𝑘))))
2423imbi2d 340 . . . 4 (𝑥 = 𝑘 → ((𝑁 ∈ ℕ0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = (𝑁 mod (2↑𝑥))) ↔ (𝑁 ∈ ℕ0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑘))(2↑𝑛) = (𝑁 mod (2↑𝑘)))))
25 oveq2 7365 . . . . . . . 8 (𝑥 = (𝑘 + 1) → (0..^𝑥) = (0..^(𝑘 + 1)))
2625ineq2d 4172 . . . . . . 7 (𝑥 = (𝑘 + 1) → ((bits‘𝑁) ∩ (0..^𝑥)) = ((bits‘𝑁) ∩ (0..^(𝑘 + 1))))
2726sumeq1d 15586 . . . . . 6 (𝑥 = (𝑘 + 1) → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))(2↑𝑛))
28 oveq2 7365 . . . . . . 7 (𝑥 = (𝑘 + 1) → (2↑𝑥) = (2↑(𝑘 + 1)))
2928oveq2d 7373 . . . . . 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 340 . . . 4 (𝑥 = (𝑘 + 1) → ((𝑁 ∈ ℕ0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = (𝑁 mod (2↑𝑥))) ↔ (𝑁 ∈ ℕ0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))(2↑𝑛) = (𝑁 mod (2↑(𝑘 + 1))))))
32 oveq2 7365 . . . . . . . 8 (𝑥 = 𝑁 → (0..^𝑥) = (0..^𝑁))
3332ineq2d 4172 . . . . . . 7 (𝑥 = 𝑁 → ((bits‘𝑁) ∩ (0..^𝑥)) = ((bits‘𝑁) ∩ (0..^𝑁)))
3433sumeq1d 15586 . . . . . 6 (𝑥 = 𝑁 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑁))(2↑𝑛))
35 oveq2 7365 . . . . . . 7 (𝑥 = 𝑁 → (2↑𝑥) = (2↑𝑁))
3635oveq2d 7373 . . . . . 6 (𝑥 = 𝑁 → (𝑁 mod (2↑𝑥)) = (𝑁 mod (2↑𝑁)))
3734, 36eqeq12d 2752 . . . . 5 (𝑥 = 𝑁 → (Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = (𝑁 mod (2↑𝑥)) ↔ Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑁))(2↑𝑛) = (𝑁 mod (2↑𝑁))))
3837imbi2d 340 . . . 4 (𝑥 = 𝑁 → ((𝑁 ∈ ℕ0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = (𝑁 mod (2↑𝑥))) ↔ (𝑁 ∈ ℕ0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑁))(2↑𝑛) = (𝑁 mod (2↑𝑁)))))
39 nn0z 12524 . . . . . 6 (𝑁 ∈ ℕ0𝑁 ∈ ℤ)
40 zmod10 13792 . . . . . 6 (𝑁 ∈ ℤ → (𝑁 mod 1) = 0)
4139, 40syl 17 . . . . 5 (𝑁 ∈ ℕ0 → (𝑁 mod 1) = 0)
4241eqcomd 2742 . . . 4 (𝑁 ∈ ℕ0 → 0 = (𝑁 mod 1))
43 oveq1 7364 . . . . . . 7 𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑘))(2↑𝑛) = (𝑁 mod (2↑𝑘)) → (Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑘))(2↑𝑛) + Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛)) = ((𝑁 mod (2↑𝑘)) + Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛)))
44 fzonel 13586 . . . . . . . . . . . . 13 ¬ 𝑘 ∈ (0..^𝑘)
4544a1i 11 . . . . . . . . . . . 12 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → ¬ 𝑘 ∈ (0..^𝑘))
46 disjsn 4672 . . . . . . . . . . . 12 (((0..^𝑘) ∩ {𝑘}) = ∅ ↔ ¬ 𝑘 ∈ (0..^𝑘))
4745, 46sylibr 233 . . . . . . . . . . 11 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → ((0..^𝑘) ∩ {𝑘}) = ∅)
4847ineq2d 4172 . . . . . . . . . 10 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → ((bits‘𝑁) ∩ ((0..^𝑘) ∩ {𝑘})) = ((bits‘𝑁) ∩ ∅))
49 inindi 4186 . . . . . . . . . 10 ((bits‘𝑁) ∩ ((0..^𝑘) ∩ {𝑘})) = (((bits‘𝑁) ∩ (0..^𝑘)) ∩ ((bits‘𝑁) ∩ {𝑘}))
5048, 49, 53eqtr3g 2799 . . . . . . . . 9 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → (((bits‘𝑁) ∩ (0..^𝑘)) ∩ ((bits‘𝑁) ∩ {𝑘})) = ∅)
51 simpr 485 . . . . . . . . . . . . 13 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → 𝑘 ∈ ℕ0)
52 nn0uz 12805 . . . . . . . . . . . . 13 0 = (ℤ‘0)
5351, 52eleqtrdi 2848 . . . . . . . . . . . 12 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → 𝑘 ∈ (ℤ‘0))
54 fzosplitsn 13680 . . . . . . . . . . . 12 (𝑘 ∈ (ℤ‘0) → (0..^(𝑘 + 1)) = ((0..^𝑘) ∪ {𝑘}))
5553, 54syl 17 . . . . . . . . . . 11 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → (0..^(𝑘 + 1)) = ((0..^𝑘) ∪ {𝑘}))
5655ineq2d 4172 . . . . . . . . . 10 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → ((bits‘𝑁) ∩ (0..^(𝑘 + 1))) = ((bits‘𝑁) ∩ ((0..^𝑘) ∪ {𝑘})))
57 indi 4233 . . . . . . . . . 10 ((bits‘𝑁) ∩ ((0..^𝑘) ∪ {𝑘})) = (((bits‘𝑁) ∩ (0..^𝑘)) ∪ ((bits‘𝑁) ∩ {𝑘}))
5856, 57eqtrdi 2792 . . . . . . . . 9 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → ((bits‘𝑁) ∩ (0..^(𝑘 + 1))) = (((bits‘𝑁) ∩ (0..^𝑘)) ∪ ((bits‘𝑁) ∩ {𝑘})))
59 fzofi 13879 . . . . . . . . . . 11 (0..^(𝑘 + 1)) ∈ Fin
60 inss2 4189 . . . . . . . . . . 11 ((bits‘𝑁) ∩ (0..^(𝑘 + 1))) ⊆ (0..^(𝑘 + 1))
61 ssfi 9117 . . . . . . . . . . 11 (((0..^(𝑘 + 1)) ∈ Fin ∧ ((bits‘𝑁) ∩ (0..^(𝑘 + 1))) ⊆ (0..^(𝑘 + 1))) → ((bits‘𝑁) ∩ (0..^(𝑘 + 1))) ∈ Fin)
6259, 60, 61mp2an 690 . . . . . . . . . 10 ((bits‘𝑁) ∩ (0..^(𝑘 + 1))) ∈ Fin
6362a1i 11 . . . . . . . . 9 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → ((bits‘𝑁) ∩ (0..^(𝑘 + 1))) ∈ Fin)
64 2nn 12226 . . . . . . . . . . . 12 2 ∈ ℕ
6564a1i 11 . . . . . . . . . . 11 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))) → 2 ∈ ℕ)
66 simpr 485 . . . . . . . . . . . . . 14 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))) → 𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1))))
6766elin2d 4159 . . . . . . . . . . . . 13 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))) → 𝑛 ∈ (0..^(𝑘 + 1)))
68 elfzouz 13576 . . . . . . . . . . . . 13 (𝑛 ∈ (0..^(𝑘 + 1)) → 𝑛 ∈ (ℤ‘0))
6967, 68syl 17 . . . . . . . . . . . 12 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))) → 𝑛 ∈ (ℤ‘0))
7069, 52eleqtrrdi 2849 . . . . . . . . . . 11 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))) → 𝑛 ∈ ℕ0)
7165, 70nnexpcld 14148 . . . . . . . . . 10 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))) → (2↑𝑛) ∈ ℕ)
7271nncnd 12169 . . . . . . . . 9 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))) → (2↑𝑛) ∈ ℂ)
7350, 58, 63, 72fsumsplit 15626 . . . . . . . 8 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))(2↑𝑛) = (Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑘))(2↑𝑛) + Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛)))
74 bitsinv1lem 16321 . . . . . . . . . 10 ((𝑁 ∈ ℤ ∧ 𝑘 ∈ ℕ0) → (𝑁 mod (2↑(𝑘 + 1))) = ((𝑁 mod (2↑𝑘)) + if(𝑘 ∈ (bits‘𝑁), (2↑𝑘), 0)))
7539, 74sylan 580 . . . . . . . . 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 485 . . . . . . . . . . . . . . 15 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑘 ∈ (bits‘𝑁)) → 𝑘 ∈ (bits‘𝑁))
7978snssd 4769 . . . . . . . . . . . . . 14 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑘 ∈ (bits‘𝑁)) → {𝑘} ⊆ (bits‘𝑁))
80 sseqin2 4175 . . . . . . . . . . . . . 14 ({𝑘} ⊆ (bits‘𝑁) ↔ ((bits‘𝑁) ∩ {𝑘}) = {𝑘})
8179, 80sylib 217 . . . . . . . . . . . . 13 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑘 ∈ (bits‘𝑁)) → ((bits‘𝑁) ∩ {𝑘}) = {𝑘})
8281sumeq1d 15586 . . . . . . . . . . . 12 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑘 ∈ (bits‘𝑁)) → Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛) = Σ𝑛 ∈ {𝑘} (2↑𝑛))
83 simplr 767 . . . . . . . . . . . . 13 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑘 ∈ (bits‘𝑁)) → 𝑘 ∈ ℕ0)
8464a1i 11 . . . . . . . . . . . . . . 15 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑘 ∈ (bits‘𝑁)) → 2 ∈ ℕ)
8584, 83nnexpcld 14148 . . . . . . . . . . . . . 14 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑘 ∈ (bits‘𝑁)) → (2↑𝑘) ∈ ℕ)
8685nncnd 12169 . . . . . . . . . . . . 13 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑘 ∈ (bits‘𝑁)) → (2↑𝑘) ∈ ℂ)
87 oveq2 7365 . . . . . . . . . . . . . 14 (𝑛 = 𝑘 → (2↑𝑛) = (2↑𝑘))
8887sumsn 15631 . . . . . . . . . . . . 13 ((𝑘 ∈ ℕ0 ∧ (2↑𝑘) ∈ ℂ) → Σ𝑛 ∈ {𝑘} (2↑𝑛) = (2↑𝑘))
8983, 86, 88syl2anc 584 . . . . . . . . . . . 12 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑘 ∈ (bits‘𝑁)) → Σ𝑛 ∈ {𝑘} (2↑𝑛) = (2↑𝑘))
9082, 89eqtrd 2776 . . . . . . . . . . 11 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑘 ∈ (bits‘𝑁)) → Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛) = (2↑𝑘))
91 simpr 485 . . . . . . . . . . . . . 14 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ ¬ 𝑘 ∈ (bits‘𝑁)) → ¬ 𝑘 ∈ (bits‘𝑁))
92 disjsn 4672 . . . . . . . . . . . . . 14 (((bits‘𝑁) ∩ {𝑘}) = ∅ ↔ ¬ 𝑘 ∈ (bits‘𝑁))
9391, 92sylibr 233 . . . . . . . . . . . . 13 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ ¬ 𝑘 ∈ (bits‘𝑁)) → ((bits‘𝑁) ∩ {𝑘}) = ∅)
9493sumeq1d 15586 . . . . . . . . . . . 12 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ ¬ 𝑘 ∈ (bits‘𝑁)) → Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛) = Σ𝑛 ∈ ∅ (2↑𝑛))
9594, 8eqtrdi 2792 . . . . . . . . . . 11 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ ¬ 𝑘 ∈ (bits‘𝑁)) → Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛) = 0)
9676, 77, 90, 95ifbothda 4524 . . . . . . . . . 10 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛) = if(𝑘 ∈ (bits‘𝑁), (2↑𝑘), 0))
9796oveq2d 7373 . . . . . . . . 9 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → ((𝑁 mod (2↑𝑘)) + Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛)) = ((𝑁 mod (2↑𝑘)) + if(𝑘 ∈ (bits‘𝑁), (2↑𝑘), 0)))
9875, 97eqtr4d 2779 . . . . . . . 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 245 . . . . . 6 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → (Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑘))(2↑𝑛) = (𝑁 mod (2↑𝑘)) → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))(2↑𝑛) = (𝑁 mod (2↑(𝑘 + 1)))))
101100expcom 414 . . . . 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 12598 . . 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 2848 . . . . . 6 (𝑁 ∈ ℕ0𝑁 ∈ (ℤ‘0))
10764a1i 11 . . . . . . . 8 (𝑁 ∈ ℕ0 → 2 ∈ ℕ)
108107, 105nnexpcld 14148 . . . . . . 7 (𝑁 ∈ ℕ0 → (2↑𝑁) ∈ ℕ)
109108nnzd 12526 . . . . . 6 (𝑁 ∈ ℕ0 → (2↑𝑁) ∈ ℤ)
110 2z 12535 . . . . . . . 8 2 ∈ ℤ
111 uzid 12778 . . . . . . . 8 (2 ∈ ℤ → 2 ∈ (ℤ‘2))
112110, 111ax-mp 5 . . . . . . 7 2 ∈ (ℤ‘2)
113 bernneq3 14134 . . . . . . 7 ((2 ∈ (ℤ‘2) ∧ 𝑁 ∈ ℕ0) → 𝑁 < (2↑𝑁))
114112, 113mpan 688 . . . . . 6 (𝑁 ∈ ℕ0𝑁 < (2↑𝑁))
115 elfzo2 13575 . . . . . 6 (𝑁 ∈ (0..^(2↑𝑁)) ↔ (𝑁 ∈ (ℤ‘0) ∧ (2↑𝑁) ∈ ℤ ∧ 𝑁 < (2↑𝑁)))
116106, 109, 114, 115syl3anbrc 1343 . . . . 5 (𝑁 ∈ ℕ0𝑁 ∈ (0..^(2↑𝑁)))
117 bitsfzo 16315 . . . . . 6 ((𝑁 ∈ ℤ ∧ 𝑁 ∈ ℕ0) → (𝑁 ∈ (0..^(2↑𝑁)) ↔ (bits‘𝑁) ⊆ (0..^𝑁)))
11839, 105, 117syl2anc 584 . . . . 5 (𝑁 ∈ ℕ0 → (𝑁 ∈ (0..^(2↑𝑁)) ↔ (bits‘𝑁) ⊆ (0..^𝑁)))
119116, 118mpbid 231 . . . 4 (𝑁 ∈ ℕ0 → (bits‘𝑁) ⊆ (0..^𝑁))
120 df-ss 3927 . . . 4 ((bits‘𝑁) ⊆ (0..^𝑁) ↔ ((bits‘𝑁) ∩ (0..^𝑁)) = (bits‘𝑁))
121119, 120sylib 217 . . 3 (𝑁 ∈ ℕ0 → ((bits‘𝑁) ∩ (0..^𝑁)) = (bits‘𝑁))
122121sumeq1d 15586 . 2 (𝑁 ∈ ℕ0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑁))(2↑𝑛) = Σ𝑛 ∈ (bits‘𝑁)(2↑𝑛))
123 nn0re 12422 . . 3 (𝑁 ∈ ℕ0𝑁 ∈ ℝ)
124 2rp 12920 . . . . 5 2 ∈ ℝ+
125124a1i 11 . . . 4 (𝑁 ∈ ℕ0 → 2 ∈ ℝ+)
126125, 39rpexpcld 14150 . . 3 (𝑁 ∈ ℕ0 → (2↑𝑁) ∈ ℝ+)
127 nn0ge0 12438 . . 3 (𝑁 ∈ ℕ0 → 0 ≤ 𝑁)
128 modid 13801 . . 3 (((𝑁 ∈ ℝ ∧ (2↑𝑁) ∈ ℝ+) ∧ (0 ≤ 𝑁𝑁 < (2↑𝑁))) → (𝑁 mod (2↑𝑁)) = 𝑁)
129123, 126, 127, 114, 128syl22anc 837 . 2 (𝑁 ∈ ℕ0 → (𝑁 mod (2↑𝑁)) = 𝑁)
130104, 122, 1293eqtr3d 2784 1 (𝑁 ∈ ℕ0 → Σ𝑛 ∈ (bits‘𝑁)(2↑𝑛) = 𝑁)
Colors of variables: wff setvar class
Syntax hints:  ¬ wn 3  wi 4  wb 205  wa 396   = wceq 1541  wcel 2106  cun 3908  cin 3909  wss 3910  c0 4282  ifcif 4486  {csn 4586   class class class wbr 5105  cfv 6496  (class class class)co 7357  Fincfn 8883  cc 11049  cr 11050  0cc0 11051  1c1 11052   + caddc 11054   < clt 11189  cle 11190  cn 12153  2c2 12208  0cn0 12413  cz 12499  cuz 12763  +crp 12915  ..^cfzo 13567   mod cmo 13774  cexp 13967  Σcsu 15570  bitscbits 16299
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-3 8  ax-gen 1797  ax-4 1811  ax-5 1913  ax-6 1971  ax-7 2011  ax-8 2108  ax-9 2116  ax-10 2137  ax-11 2154  ax-12 2171  ax-ext 2707  ax-rep 5242  ax-sep 5256  ax-nul 5263  ax-pow 5320  ax-pr 5384  ax-un 7672  ax-inf2 9577  ax-cnex 11107  ax-resscn 11108  ax-1cn 11109  ax-icn 11110  ax-addcl 11111  ax-addrcl 11112  ax-mulcl 11113  ax-mulrcl 11114  ax-mulcom 11115  ax-addass 11116  ax-mulass 11117  ax-distr 11118  ax-i2m1 11119  ax-1ne0 11120  ax-1rid 11121  ax-rnegex 11122  ax-rrecex 11123  ax-cnre 11124  ax-pre-lttri 11125  ax-pre-lttrn 11126  ax-pre-ltadd 11127  ax-pre-mulgt0 11128  ax-pre-sup 11129
This theorem depends on definitions:  df-bi 206  df-an 397  df-or 846  df-3or 1088  df-3an 1089  df-tru 1544  df-fal 1554  df-ex 1782  df-nf 1786  df-sb 2068  df-mo 2538  df-eu 2567  df-clab 2714  df-cleq 2728  df-clel 2814  df-nfc 2889  df-ne 2944  df-nel 3050  df-ral 3065  df-rex 3074  df-rmo 3353  df-reu 3354  df-rab 3408  df-v 3447  df-sbc 3740  df-csb 3856  df-dif 3913  df-un 3915  df-in 3917  df-ss 3927  df-pss 3929  df-nul 4283  df-if 4487  df-pw 4562  df-sn 4587  df-pr 4589  df-op 4593  df-uni 4866  df-int 4908  df-iun 4956  df-br 5106  df-opab 5168  df-mpt 5189  df-tr 5223  df-id 5531  df-eprel 5537  df-po 5545  df-so 5546  df-fr 5588  df-se 5589  df-we 5590  df-xp 5639  df-rel 5640  df-cnv 5641  df-co 5642  df-dm 5643  df-rn 5644  df-res 5645  df-ima 5646  df-pred 6253  df-ord 6320  df-on 6321  df-lim 6322  df-suc 6323  df-iota 6448  df-fun 6498  df-fn 6499  df-f 6500  df-f1 6501  df-fo 6502  df-f1o 6503  df-fv 6504  df-isom 6505  df-riota 7313  df-ov 7360  df-oprab 7361  df-mpo 7362  df-om 7803  df-1st 7921  df-2nd 7922  df-frecs 8212  df-wrecs 8243  df-recs 8317  df-rdg 8356  df-1o 8412  df-er 8648  df-en 8884  df-dom 8885  df-sdom 8886  df-fin 8887  df-sup 9378  df-inf 9379  df-oi 9446  df-card 9875  df-pnf 11191  df-mnf 11192  df-xr 11193  df-ltxr 11194  df-le 11195  df-sub 11387  df-neg 11388  df-div 11813  df-nn 12154  df-2 12216  df-3 12217  df-n0 12414  df-z 12500  df-uz 12764  df-rp 12916  df-fz 13425  df-fzo 13568  df-fl 13697  df-mod 13775  df-seq 13907  df-exp 13968  df-hash 14231  df-cj 14984  df-re 14985  df-im 14986  df-sqrt 15120  df-abs 15121  df-clim 15370  df-sum 15571  df-dvds 16137  df-bits 16302
This theorem is referenced by:  bitsinv2  16323  bitsf1ocnv  16324  eulerpartlemgc  32962  eulerpartlemgs2  32980
  Copyright terms: Public domain W3C validator