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

Theorem bitsinv1 15779
Description: There is an explicit inverse to the bits function for nonnegative integers (which can be extended to negative integers using bitscmp 15775), 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 7153 . . . . . . . . . . 11 (𝑥 = 0 → (0..^𝑥) = (0..^0))
2 fzo0 13049 . . . . . . . . . . 11 (0..^0) = ∅
31, 2syl6eq 2869 . . . . . . . . . 10 (𝑥 = 0 → (0..^𝑥) = ∅)
43ineq2d 4186 . . . . . . . . 9 (𝑥 = 0 → ((bits‘𝑁) ∩ (0..^𝑥)) = ((bits‘𝑁) ∩ ∅))
5 in0 4342 . . . . . . . . 9 ((bits‘𝑁) ∩ ∅) = ∅
64, 5syl6eq 2869 . . . . . . . 8 (𝑥 = 0 → ((bits‘𝑁) ∩ (0..^𝑥)) = ∅)
76sumeq1d 15046 . . . . . . 7 (𝑥 = 0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = Σ𝑛 ∈ ∅ (2↑𝑛))
8 sum0 15066 . . . . . . 7 Σ𝑛 ∈ ∅ (2↑𝑛) = 0
97, 8syl6eq 2869 . . . . . 6 (𝑥 = 0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = 0)
10 oveq2 7153 . . . . . . . 8 (𝑥 = 0 → (2↑𝑥) = (2↑0))
11 2cn 11700 . . . . . . . . 9 2 ∈ ℂ
12 exp0 13421 . . . . . . . . 9 (2 ∈ ℂ → (2↑0) = 1)
1311, 12ax-mp 5 . . . . . . . 8 (2↑0) = 1
1410, 13syl6eq 2869 . . . . . . 7 (𝑥 = 0 → (2↑𝑥) = 1)
1514oveq2d 7161 . . . . . 6 (𝑥 = 0 → (𝑁 mod (2↑𝑥)) = (𝑁 mod 1))
169, 15eqeq12d 2834 . . . . 5 (𝑥 = 0 → (Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = (𝑁 mod (2↑𝑥)) ↔ 0 = (𝑁 mod 1)))
1716imbi2d 342 . . . 4 (𝑥 = 0 → ((𝑁 ∈ ℕ0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = (𝑁 mod (2↑𝑥))) ↔ (𝑁 ∈ ℕ0 → 0 = (𝑁 mod 1))))
18 oveq2 7153 . . . . . . . 8 (𝑥 = 𝑘 → (0..^𝑥) = (0..^𝑘))
1918ineq2d 4186 . . . . . . 7 (𝑥 = 𝑘 → ((bits‘𝑁) ∩ (0..^𝑥)) = ((bits‘𝑁) ∩ (0..^𝑘)))
2019sumeq1d 15046 . . . . . 6 (𝑥 = 𝑘 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑘))(2↑𝑛))
21 oveq2 7153 . . . . . . 7 (𝑥 = 𝑘 → (2↑𝑥) = (2↑𝑘))
2221oveq2d 7161 . . . . . 6 (𝑥 = 𝑘 → (𝑁 mod (2↑𝑥)) = (𝑁 mod (2↑𝑘)))
2320, 22eqeq12d 2834 . . . . 5 (𝑥 = 𝑘 → (Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = (𝑁 mod (2↑𝑥)) ↔ Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑘))(2↑𝑛) = (𝑁 mod (2↑𝑘))))
2423imbi2d 342 . . . 4 (𝑥 = 𝑘 → ((𝑁 ∈ ℕ0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = (𝑁 mod (2↑𝑥))) ↔ (𝑁 ∈ ℕ0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑘))(2↑𝑛) = (𝑁 mod (2↑𝑘)))))
25 oveq2 7153 . . . . . . . 8 (𝑥 = (𝑘 + 1) → (0..^𝑥) = (0..^(𝑘 + 1)))
2625ineq2d 4186 . . . . . . 7 (𝑥 = (𝑘 + 1) → ((bits‘𝑁) ∩ (0..^𝑥)) = ((bits‘𝑁) ∩ (0..^(𝑘 + 1))))
2726sumeq1d 15046 . . . . . 6 (𝑥 = (𝑘 + 1) → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))(2↑𝑛))
28 oveq2 7153 . . . . . . 7 (𝑥 = (𝑘 + 1) → (2↑𝑥) = (2↑(𝑘 + 1)))
2928oveq2d 7161 . . . . . 6 (𝑥 = (𝑘 + 1) → (𝑁 mod (2↑𝑥)) = (𝑁 mod (2↑(𝑘 + 1))))
3027, 29eqeq12d 2834 . . . . 5 (𝑥 = (𝑘 + 1) → (Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = (𝑁 mod (2↑𝑥)) ↔ Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))(2↑𝑛) = (𝑁 mod (2↑(𝑘 + 1)))))
3130imbi2d 342 . . . 4 (𝑥 = (𝑘 + 1) → ((𝑁 ∈ ℕ0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = (𝑁 mod (2↑𝑥))) ↔ (𝑁 ∈ ℕ0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))(2↑𝑛) = (𝑁 mod (2↑(𝑘 + 1))))))
32 oveq2 7153 . . . . . . . 8 (𝑥 = 𝑁 → (0..^𝑥) = (0..^𝑁))
3332ineq2d 4186 . . . . . . 7 (𝑥 = 𝑁 → ((bits‘𝑁) ∩ (0..^𝑥)) = ((bits‘𝑁) ∩ (0..^𝑁)))
3433sumeq1d 15046 . . . . . 6 (𝑥 = 𝑁 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑁))(2↑𝑛))
35 oveq2 7153 . . . . . . 7 (𝑥 = 𝑁 → (2↑𝑥) = (2↑𝑁))
3635oveq2d 7161 . . . . . 6 (𝑥 = 𝑁 → (𝑁 mod (2↑𝑥)) = (𝑁 mod (2↑𝑁)))
3734, 36eqeq12d 2834 . . . . 5 (𝑥 = 𝑁 → (Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = (𝑁 mod (2↑𝑥)) ↔ Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑁))(2↑𝑛) = (𝑁 mod (2↑𝑁))))
3837imbi2d 342 . . . 4 (𝑥 = 𝑁 → ((𝑁 ∈ ℕ0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = (𝑁 mod (2↑𝑥))) ↔ (𝑁 ∈ ℕ0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑁))(2↑𝑛) = (𝑁 mod (2↑𝑁)))))
39 nn0z 11993 . . . . . 6 (𝑁 ∈ ℕ0𝑁 ∈ ℤ)
40 zmod10 13243 . . . . . 6 (𝑁 ∈ ℤ → (𝑁 mod 1) = 0)
4139, 40syl 17 . . . . 5 (𝑁 ∈ ℕ0 → (𝑁 mod 1) = 0)
4241eqcomd 2824 . . . 4 (𝑁 ∈ ℕ0 → 0 = (𝑁 mod 1))
43 oveq1 7152 . . . . . . 7 𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑘))(2↑𝑛) = (𝑁 mod (2↑𝑘)) → (Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑘))(2↑𝑛) + Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛)) = ((𝑁 mod (2↑𝑘)) + Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛)))
44 fzonel 13039 . . . . . . . . . . . . 13 ¬ 𝑘 ∈ (0..^𝑘)
4544a1i 11 . . . . . . . . . . . 12 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → ¬ 𝑘 ∈ (0..^𝑘))
46 disjsn 4639 . . . . . . . . . . . 12 (((0..^𝑘) ∩ {𝑘}) = ∅ ↔ ¬ 𝑘 ∈ (0..^𝑘))
4745, 46sylibr 235 . . . . . . . . . . 11 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → ((0..^𝑘) ∩ {𝑘}) = ∅)
4847ineq2d 4186 . . . . . . . . . 10 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → ((bits‘𝑁) ∩ ((0..^𝑘) ∩ {𝑘})) = ((bits‘𝑁) ∩ ∅))
49 inindi 4200 . . . . . . . . . 10 ((bits‘𝑁) ∩ ((0..^𝑘) ∩ {𝑘})) = (((bits‘𝑁) ∩ (0..^𝑘)) ∩ ((bits‘𝑁) ∩ {𝑘}))
5048, 49, 53eqtr3g 2876 . . . . . . . . 9 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → (((bits‘𝑁) ∩ (0..^𝑘)) ∩ ((bits‘𝑁) ∩ {𝑘})) = ∅)
51 simpr 485 . . . . . . . . . . . . 13 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → 𝑘 ∈ ℕ0)
52 nn0uz 12268 . . . . . . . . . . . . 13 0 = (ℤ‘0)
5351, 52eleqtrdi 2920 . . . . . . . . . . . 12 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → 𝑘 ∈ (ℤ‘0))
54 fzosplitsn 13133 . . . . . . . . . . . 12 (𝑘 ∈ (ℤ‘0) → (0..^(𝑘 + 1)) = ((0..^𝑘) ∪ {𝑘}))
5553, 54syl 17 . . . . . . . . . . 11 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → (0..^(𝑘 + 1)) = ((0..^𝑘) ∪ {𝑘}))
5655ineq2d 4186 . . . . . . . . . 10 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → ((bits‘𝑁) ∩ (0..^(𝑘 + 1))) = ((bits‘𝑁) ∩ ((0..^𝑘) ∪ {𝑘})))
57 indi 4247 . . . . . . . . . 10 ((bits‘𝑁) ∩ ((0..^𝑘) ∪ {𝑘})) = (((bits‘𝑁) ∩ (0..^𝑘)) ∪ ((bits‘𝑁) ∩ {𝑘}))
5856, 57syl6eq 2869 . . . . . . . . 9 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → ((bits‘𝑁) ∩ (0..^(𝑘 + 1))) = (((bits‘𝑁) ∩ (0..^𝑘)) ∪ ((bits‘𝑁) ∩ {𝑘})))
59 fzofi 13330 . . . . . . . . . . 11 (0..^(𝑘 + 1)) ∈ Fin
60 inss2 4203 . . . . . . . . . . 11 ((bits‘𝑁) ∩ (0..^(𝑘 + 1))) ⊆ (0..^(𝑘 + 1))
61 ssfi 8726 . . . . . . . . . . 11 (((0..^(𝑘 + 1)) ∈ Fin ∧ ((bits‘𝑁) ∩ (0..^(𝑘 + 1))) ⊆ (0..^(𝑘 + 1))) → ((bits‘𝑁) ∩ (0..^(𝑘 + 1))) ∈ Fin)
6259, 60, 61mp2an 688 . . . . . . . . . 10 ((bits‘𝑁) ∩ (0..^(𝑘 + 1))) ∈ Fin
6362a1i 11 . . . . . . . . 9 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → ((bits‘𝑁) ∩ (0..^(𝑘 + 1))) ∈ Fin)
64 2nn 11698 . . . . . . . . . . . 12 2 ∈ ℕ
6564a1i 11 . . . . . . . . . . 11 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))) → 2 ∈ ℕ)
66 simpr 485 . . . . . . . . . . . . . 14 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))) → 𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1))))
6766elin2d 4173 . . . . . . . . . . . . 13 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))) → 𝑛 ∈ (0..^(𝑘 + 1)))
68 elfzouz 13030 . . . . . . . . . . . . 13 (𝑛 ∈ (0..^(𝑘 + 1)) → 𝑛 ∈ (ℤ‘0))
6967, 68syl 17 . . . . . . . . . . . 12 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))) → 𝑛 ∈ (ℤ‘0))
7069, 52eleqtrrdi 2921 . . . . . . . . . . 11 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))) → 𝑛 ∈ ℕ0)
7165, 70nnexpcld 13594 . . . . . . . . . 10 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))) → (2↑𝑛) ∈ ℕ)
7271nncnd 11642 . . . . . . . . 9 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))) → (2↑𝑛) ∈ ℂ)
7350, 58, 63, 72fsumsplit 15085 . . . . . . . 8 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))(2↑𝑛) = (Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑘))(2↑𝑛) + Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛)))
74 bitsinv1lem 15778 . . . . . . . . . 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 2830 . . . . . . . . . . 11 ((2↑𝑘) = if(𝑘 ∈ (bits‘𝑁), (2↑𝑘), 0) → (Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛) = (2↑𝑘) ↔ Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛) = if(𝑘 ∈ (bits‘𝑁), (2↑𝑘), 0)))
77 eqeq2 2830 . . . . . . . . . . 11 (0 = if(𝑘 ∈ (bits‘𝑁), (2↑𝑘), 0) → (Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛) = 0 ↔ Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛) = if(𝑘 ∈ (bits‘𝑁), (2↑𝑘), 0)))
78 simpr 485 . . . . . . . . . . . . . . 15 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑘 ∈ (bits‘𝑁)) → 𝑘 ∈ (bits‘𝑁))
7978snssd 4734 . . . . . . . . . . . . . 14 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑘 ∈ (bits‘𝑁)) → {𝑘} ⊆ (bits‘𝑁))
80 sseqin2 4189 . . . . . . . . . . . . . 14 ({𝑘} ⊆ (bits‘𝑁) ↔ ((bits‘𝑁) ∩ {𝑘}) = {𝑘})
8179, 80sylib 219 . . . . . . . . . . . . 13 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑘 ∈ (bits‘𝑁)) → ((bits‘𝑁) ∩ {𝑘}) = {𝑘})
8281sumeq1d 15046 . . . . . . . . . . . 12 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑘 ∈ (bits‘𝑁)) → Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛) = Σ𝑛 ∈ {𝑘} (2↑𝑛))
83 simplr 765 . . . . . . . . . . . . 13 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑘 ∈ (bits‘𝑁)) → 𝑘 ∈ ℕ0)
8464a1i 11 . . . . . . . . . . . . . . 15 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑘 ∈ (bits‘𝑁)) → 2 ∈ ℕ)
8584, 83nnexpcld 13594 . . . . . . . . . . . . . 14 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑘 ∈ (bits‘𝑁)) → (2↑𝑘) ∈ ℕ)
8685nncnd 11642 . . . . . . . . . . . . 13 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑘 ∈ (bits‘𝑁)) → (2↑𝑘) ∈ ℂ)
87 oveq2 7153 . . . . . . . . . . . . . 14 (𝑛 = 𝑘 → (2↑𝑛) = (2↑𝑘))
8887sumsn 15089 . . . . . . . . . . . . 13 ((𝑘 ∈ ℕ0 ∧ (2↑𝑘) ∈ ℂ) → Σ𝑛 ∈ {𝑘} (2↑𝑛) = (2↑𝑘))
8983, 86, 88syl2anc 584 . . . . . . . . . . . 12 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑘 ∈ (bits‘𝑁)) → Σ𝑛 ∈ {𝑘} (2↑𝑛) = (2↑𝑘))
9082, 89eqtrd 2853 . . . . . . . . . . 11 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑘 ∈ (bits‘𝑁)) → Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛) = (2↑𝑘))
91 simpr 485 . . . . . . . . . . . . . 14 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ ¬ 𝑘 ∈ (bits‘𝑁)) → ¬ 𝑘 ∈ (bits‘𝑁))
92 disjsn 4639 . . . . . . . . . . . . . 14 (((bits‘𝑁) ∩ {𝑘}) = ∅ ↔ ¬ 𝑘 ∈ (bits‘𝑁))
9391, 92sylibr 235 . . . . . . . . . . . . 13 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ ¬ 𝑘 ∈ (bits‘𝑁)) → ((bits‘𝑁) ∩ {𝑘}) = ∅)
9493sumeq1d 15046 . . . . . . . . . . . 12 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ ¬ 𝑘 ∈ (bits‘𝑁)) → Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛) = Σ𝑛 ∈ ∅ (2↑𝑛))
9594, 8syl6eq 2869 . . . . . . . . . . 11 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ ¬ 𝑘 ∈ (bits‘𝑁)) → Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛) = 0)
9676, 77, 90, 95ifbothda 4500 . . . . . . . . . 10 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛) = if(𝑘 ∈ (bits‘𝑁), (2↑𝑘), 0))
9796oveq2d 7161 . . . . . . . . 9 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → ((𝑁 mod (2↑𝑘)) + Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛)) = ((𝑁 mod (2↑𝑘)) + if(𝑘 ∈ (bits‘𝑁), (2↑𝑘), 0)))
9875, 97eqtr4d 2856 . . . . . . . 8 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → (𝑁 mod (2↑(𝑘 + 1))) = ((𝑁 mod (2↑𝑘)) + Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛)))
9973, 98eqeq12d 2834 . . . . . . 7 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → (Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))(2↑𝑛) = (𝑁 mod (2↑(𝑘 + 1))) ↔ (Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑘))(2↑𝑛) + Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛)) = ((𝑁 mod (2↑𝑘)) + Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛))))
10043, 99syl5ibr 247 . . . . . 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 12065 . . 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 2920 . . . . . 6 (𝑁 ∈ ℕ0𝑁 ∈ (ℤ‘0))
10764a1i 11 . . . . . . . 8 (𝑁 ∈ ℕ0 → 2 ∈ ℕ)
108107, 105nnexpcld 13594 . . . . . . 7 (𝑁 ∈ ℕ0 → (2↑𝑁) ∈ ℕ)
109108nnzd 12074 . . . . . 6 (𝑁 ∈ ℕ0 → (2↑𝑁) ∈ ℤ)
110 2z 12002 . . . . . . . 8 2 ∈ ℤ
111 uzid 12246 . . . . . . . 8 (2 ∈ ℤ → 2 ∈ (ℤ‘2))
112110, 111ax-mp 5 . . . . . . 7 2 ∈ (ℤ‘2)
113 bernneq3 13580 . . . . . . 7 ((2 ∈ (ℤ‘2) ∧ 𝑁 ∈ ℕ0) → 𝑁 < (2↑𝑁))
114112, 113mpan 686 . . . . . 6 (𝑁 ∈ ℕ0𝑁 < (2↑𝑁))
115 elfzo2 13029 . . . . . 6 (𝑁 ∈ (0..^(2↑𝑁)) ↔ (𝑁 ∈ (ℤ‘0) ∧ (2↑𝑁) ∈ ℤ ∧ 𝑁 < (2↑𝑁)))
116106, 109, 114, 115syl3anbrc 1335 . . . . 5 (𝑁 ∈ ℕ0𝑁 ∈ (0..^(2↑𝑁)))
117 bitsfzo 15772 . . . . . 6 ((𝑁 ∈ ℤ ∧ 𝑁 ∈ ℕ0) → (𝑁 ∈ (0..^(2↑𝑁)) ↔ (bits‘𝑁) ⊆ (0..^𝑁)))
11839, 105, 117syl2anc 584 . . . . 5 (𝑁 ∈ ℕ0 → (𝑁 ∈ (0..^(2↑𝑁)) ↔ (bits‘𝑁) ⊆ (0..^𝑁)))
119116, 118mpbid 233 . . . 4 (𝑁 ∈ ℕ0 → (bits‘𝑁) ⊆ (0..^𝑁))
120 df-ss 3949 . . . 4 ((bits‘𝑁) ⊆ (0..^𝑁) ↔ ((bits‘𝑁) ∩ (0..^𝑁)) = (bits‘𝑁))
121119, 120sylib 219 . . 3 (𝑁 ∈ ℕ0 → ((bits‘𝑁) ∩ (0..^𝑁)) = (bits‘𝑁))
122121sumeq1d 15046 . 2 (𝑁 ∈ ℕ0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑁))(2↑𝑛) = Σ𝑛 ∈ (bits‘𝑁)(2↑𝑛))
123 nn0re 11894 . . 3 (𝑁 ∈ ℕ0𝑁 ∈ ℝ)
124 2rp 12382 . . . . 5 2 ∈ ℝ+
125124a1i 11 . . . 4 (𝑁 ∈ ℕ0 → 2 ∈ ℝ+)
126125, 39rpexpcld 13596 . . 3 (𝑁 ∈ ℕ0 → (2↑𝑁) ∈ ℝ+)
127 nn0ge0 11910 . . 3 (𝑁 ∈ ℕ0 → 0 ≤ 𝑁)
128 modid 13252 . . 3 (((𝑁 ∈ ℝ ∧ (2↑𝑁) ∈ ℝ+) ∧ (0 ≤ 𝑁𝑁 < (2↑𝑁))) → (𝑁 mod (2↑𝑁)) = 𝑁)
129123, 126, 127, 114, 128syl22anc 834 . 2 (𝑁 ∈ ℕ0 → (𝑁 mod (2↑𝑁)) = 𝑁)
130104, 122, 1293eqtr3d 2861 1 (𝑁 ∈ ℕ0 → Σ𝑛 ∈ (bits‘𝑁)(2↑𝑛) = 𝑁)
Colors of variables: wff setvar class
Syntax hints:  ¬ wn 3  wi 4  wb 207  wa 396   = wceq 1528  wcel 2105  cun 3931  cin 3932  wss 3933  c0 4288  ifcif 4463  {csn 4557   class class class wbr 5057  cfv 6348  (class class class)co 7145  Fincfn 8497  cc 10523  cr 10524  0cc0 10525  1c1 10526   + caddc 10528   < clt 10663  cle 10664  cn 11626  2c2 11680  0cn0 11885  cz 11969  cuz 12231  +crp 12377  ..^cfzo 13021   mod cmo 13225  cexp 13417  Σcsu 15030  bitscbits 15756
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-3 8  ax-gen 1787  ax-4 1801  ax-5 1902  ax-6 1961  ax-7 2006  ax-8 2107  ax-9 2115  ax-10 2136  ax-11 2151  ax-12 2167  ax-ext 2790  ax-rep 5181  ax-sep 5194  ax-nul 5201  ax-pow 5257  ax-pr 5320  ax-un 7450  ax-inf2 9092  ax-cnex 10581  ax-resscn 10582  ax-1cn 10583  ax-icn 10584  ax-addcl 10585  ax-addrcl 10586  ax-mulcl 10587  ax-mulrcl 10588  ax-mulcom 10589  ax-addass 10590  ax-mulass 10591  ax-distr 10592  ax-i2m1 10593  ax-1ne0 10594  ax-1rid 10595  ax-rnegex 10596  ax-rrecex 10597  ax-cnre 10598  ax-pre-lttri 10599  ax-pre-lttrn 10600  ax-pre-ltadd 10601  ax-pre-mulgt0 10602  ax-pre-sup 10603
This theorem depends on definitions:  df-bi 208  df-an 397  df-or 842  df-3or 1080  df-3an 1081  df-tru 1531  df-fal 1541  df-ex 1772  df-nf 1776  df-sb 2061  df-mo 2615  df-eu 2647  df-clab 2797  df-cleq 2811  df-clel 2890  df-nfc 2960  df-ne 3014  df-nel 3121  df-ral 3140  df-rex 3141  df-reu 3142  df-rmo 3143  df-rab 3144  df-v 3494  df-sbc 3770  df-csb 3881  df-dif 3936  df-un 3938  df-in 3940  df-ss 3949  df-pss 3951  df-nul 4289  df-if 4464  df-pw 4537  df-sn 4558  df-pr 4560  df-tp 4562  df-op 4564  df-uni 4831  df-int 4868  df-iun 4912  df-br 5058  df-opab 5120  df-mpt 5138  df-tr 5164  df-id 5453  df-eprel 5458  df-po 5467  df-so 5468  df-fr 5507  df-se 5508  df-we 5509  df-xp 5554  df-rel 5555  df-cnv 5556  df-co 5557  df-dm 5558  df-rn 5559  df-res 5560  df-ima 5561  df-pred 6141  df-ord 6187  df-on 6188  df-lim 6189  df-suc 6190  df-iota 6307  df-fun 6350  df-fn 6351  df-f 6352  df-f1 6353  df-fo 6354  df-f1o 6355  df-fv 6356  df-isom 6357  df-riota 7103  df-ov 7148  df-oprab 7149  df-mpo 7150  df-om 7570  df-1st 7678  df-2nd 7679  df-wrecs 7936  df-recs 7997  df-rdg 8035  df-1o 8091  df-oadd 8095  df-er 8278  df-en 8498  df-dom 8499  df-sdom 8500  df-fin 8501  df-sup 8894  df-inf 8895  df-oi 8962  df-card 9356  df-pnf 10665  df-mnf 10666  df-xr 10667  df-ltxr 10668  df-le 10669  df-sub 10860  df-neg 10861  df-div 11286  df-nn 11627  df-2 11688  df-3 11689  df-n0 11886  df-z 11970  df-uz 12232  df-rp 12378  df-fz 12881  df-fzo 13022  df-fl 13150  df-mod 13226  df-seq 13358  df-exp 13418  df-hash 13679  df-cj 14446  df-re 14447  df-im 14448  df-sqrt 14582  df-abs 14583  df-clim 14833  df-sum 15031  df-dvds 15596  df-bits 15759
This theorem is referenced by:  bitsinv2  15780  bitsf1ocnv  15781  eulerpartlemgc  31519  eulerpartlemgs2  31537
  Copyright terms: Public domain W3C validator