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

Theorem bitsinv1 15785
Description: There is an explicit inverse to the bits function for nonnegative integers (which can be extended to negative integers using bitscmp 15781), 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 7158 . . . . . . . . . . 11 (𝑥 = 0 → (0..^𝑥) = (0..^0))
2 fzo0 13055 . . . . . . . . . . 11 (0..^0) = ∅
31, 2syl6eq 2872 . . . . . . . . . 10 (𝑥 = 0 → (0..^𝑥) = ∅)
43ineq2d 4188 . . . . . . . . 9 (𝑥 = 0 → ((bits‘𝑁) ∩ (0..^𝑥)) = ((bits‘𝑁) ∩ ∅))
5 in0 4344 . . . . . . . . 9 ((bits‘𝑁) ∩ ∅) = ∅
64, 5syl6eq 2872 . . . . . . . 8 (𝑥 = 0 → ((bits‘𝑁) ∩ (0..^𝑥)) = ∅)
76sumeq1d 15052 . . . . . . 7 (𝑥 = 0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = Σ𝑛 ∈ ∅ (2↑𝑛))
8 sum0 15072 . . . . . . 7 Σ𝑛 ∈ ∅ (2↑𝑛) = 0
97, 8syl6eq 2872 . . . . . 6 (𝑥 = 0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = 0)
10 oveq2 7158 . . . . . . . 8 (𝑥 = 0 → (2↑𝑥) = (2↑0))
11 2cn 11706 . . . . . . . . 9 2 ∈ ℂ
12 exp0 13427 . . . . . . . . 9 (2 ∈ ℂ → (2↑0) = 1)
1311, 12ax-mp 5 . . . . . . . 8 (2↑0) = 1
1410, 13syl6eq 2872 . . . . . . 7 (𝑥 = 0 → (2↑𝑥) = 1)
1514oveq2d 7166 . . . . . 6 (𝑥 = 0 → (𝑁 mod (2↑𝑥)) = (𝑁 mod 1))
169, 15eqeq12d 2837 . . . . 5 (𝑥 = 0 → (Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = (𝑁 mod (2↑𝑥)) ↔ 0 = (𝑁 mod 1)))
1716imbi2d 343 . . . 4 (𝑥 = 0 → ((𝑁 ∈ ℕ0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = (𝑁 mod (2↑𝑥))) ↔ (𝑁 ∈ ℕ0 → 0 = (𝑁 mod 1))))
18 oveq2 7158 . . . . . . . 8 (𝑥 = 𝑘 → (0..^𝑥) = (0..^𝑘))
1918ineq2d 4188 . . . . . . 7 (𝑥 = 𝑘 → ((bits‘𝑁) ∩ (0..^𝑥)) = ((bits‘𝑁) ∩ (0..^𝑘)))
2019sumeq1d 15052 . . . . . 6 (𝑥 = 𝑘 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑘))(2↑𝑛))
21 oveq2 7158 . . . . . . 7 (𝑥 = 𝑘 → (2↑𝑥) = (2↑𝑘))
2221oveq2d 7166 . . . . . 6 (𝑥 = 𝑘 → (𝑁 mod (2↑𝑥)) = (𝑁 mod (2↑𝑘)))
2320, 22eqeq12d 2837 . . . . 5 (𝑥 = 𝑘 → (Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = (𝑁 mod (2↑𝑥)) ↔ Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑘))(2↑𝑛) = (𝑁 mod (2↑𝑘))))
2423imbi2d 343 . . . 4 (𝑥 = 𝑘 → ((𝑁 ∈ ℕ0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = (𝑁 mod (2↑𝑥))) ↔ (𝑁 ∈ ℕ0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑘))(2↑𝑛) = (𝑁 mod (2↑𝑘)))))
25 oveq2 7158 . . . . . . . 8 (𝑥 = (𝑘 + 1) → (0..^𝑥) = (0..^(𝑘 + 1)))
2625ineq2d 4188 . . . . . . 7 (𝑥 = (𝑘 + 1) → ((bits‘𝑁) ∩ (0..^𝑥)) = ((bits‘𝑁) ∩ (0..^(𝑘 + 1))))
2726sumeq1d 15052 . . . . . 6 (𝑥 = (𝑘 + 1) → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))(2↑𝑛))
28 oveq2 7158 . . . . . . 7 (𝑥 = (𝑘 + 1) → (2↑𝑥) = (2↑(𝑘 + 1)))
2928oveq2d 7166 . . . . . 6 (𝑥 = (𝑘 + 1) → (𝑁 mod (2↑𝑥)) = (𝑁 mod (2↑(𝑘 + 1))))
3027, 29eqeq12d 2837 . . . . 5 (𝑥 = (𝑘 + 1) → (Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = (𝑁 mod (2↑𝑥)) ↔ Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))(2↑𝑛) = (𝑁 mod (2↑(𝑘 + 1)))))
3130imbi2d 343 . . . 4 (𝑥 = (𝑘 + 1) → ((𝑁 ∈ ℕ0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = (𝑁 mod (2↑𝑥))) ↔ (𝑁 ∈ ℕ0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))(2↑𝑛) = (𝑁 mod (2↑(𝑘 + 1))))))
32 oveq2 7158 . . . . . . . 8 (𝑥 = 𝑁 → (0..^𝑥) = (0..^𝑁))
3332ineq2d 4188 . . . . . . 7 (𝑥 = 𝑁 → ((bits‘𝑁) ∩ (0..^𝑥)) = ((bits‘𝑁) ∩ (0..^𝑁)))
3433sumeq1d 15052 . . . . . 6 (𝑥 = 𝑁 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑁))(2↑𝑛))
35 oveq2 7158 . . . . . . 7 (𝑥 = 𝑁 → (2↑𝑥) = (2↑𝑁))
3635oveq2d 7166 . . . . . 6 (𝑥 = 𝑁 → (𝑁 mod (2↑𝑥)) = (𝑁 mod (2↑𝑁)))
3734, 36eqeq12d 2837 . . . . 5 (𝑥 = 𝑁 → (Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = (𝑁 mod (2↑𝑥)) ↔ Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑁))(2↑𝑛) = (𝑁 mod (2↑𝑁))))
3837imbi2d 343 . . . 4 (𝑥 = 𝑁 → ((𝑁 ∈ ℕ0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = (𝑁 mod (2↑𝑥))) ↔ (𝑁 ∈ ℕ0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑁))(2↑𝑛) = (𝑁 mod (2↑𝑁)))))
39 nn0z 11999 . . . . . 6 (𝑁 ∈ ℕ0𝑁 ∈ ℤ)
40 zmod10 13249 . . . . . 6 (𝑁 ∈ ℤ → (𝑁 mod 1) = 0)
4139, 40syl 17 . . . . 5 (𝑁 ∈ ℕ0 → (𝑁 mod 1) = 0)
4241eqcomd 2827 . . . 4 (𝑁 ∈ ℕ0 → 0 = (𝑁 mod 1))
43 oveq1 7157 . . . . . . 7 𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑘))(2↑𝑛) = (𝑁 mod (2↑𝑘)) → (Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑘))(2↑𝑛) + Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛)) = ((𝑁 mod (2↑𝑘)) + Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛)))
44 fzonel 13045 . . . . . . . . . . . . 13 ¬ 𝑘 ∈ (0..^𝑘)
4544a1i 11 . . . . . . . . . . . 12 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → ¬ 𝑘 ∈ (0..^𝑘))
46 disjsn 4640 . . . . . . . . . . . 12 (((0..^𝑘) ∩ {𝑘}) = ∅ ↔ ¬ 𝑘 ∈ (0..^𝑘))
4745, 46sylibr 236 . . . . . . . . . . 11 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → ((0..^𝑘) ∩ {𝑘}) = ∅)
4847ineq2d 4188 . . . . . . . . . 10 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → ((bits‘𝑁) ∩ ((0..^𝑘) ∩ {𝑘})) = ((bits‘𝑁) ∩ ∅))
49 inindi 4202 . . . . . . . . . 10 ((bits‘𝑁) ∩ ((0..^𝑘) ∩ {𝑘})) = (((bits‘𝑁) ∩ (0..^𝑘)) ∩ ((bits‘𝑁) ∩ {𝑘}))
5048, 49, 53eqtr3g 2879 . . . . . . . . 9 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → (((bits‘𝑁) ∩ (0..^𝑘)) ∩ ((bits‘𝑁) ∩ {𝑘})) = ∅)
51 simpr 487 . . . . . . . . . . . . 13 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → 𝑘 ∈ ℕ0)
52 nn0uz 12274 . . . . . . . . . . . . 13 0 = (ℤ‘0)
5351, 52eleqtrdi 2923 . . . . . . . . . . . 12 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → 𝑘 ∈ (ℤ‘0))
54 fzosplitsn 13139 . . . . . . . . . . . 12 (𝑘 ∈ (ℤ‘0) → (0..^(𝑘 + 1)) = ((0..^𝑘) ∪ {𝑘}))
5553, 54syl 17 . . . . . . . . . . 11 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → (0..^(𝑘 + 1)) = ((0..^𝑘) ∪ {𝑘}))
5655ineq2d 4188 . . . . . . . . . 10 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → ((bits‘𝑁) ∩ (0..^(𝑘 + 1))) = ((bits‘𝑁) ∩ ((0..^𝑘) ∪ {𝑘})))
57 indi 4249 . . . . . . . . . 10 ((bits‘𝑁) ∩ ((0..^𝑘) ∪ {𝑘})) = (((bits‘𝑁) ∩ (0..^𝑘)) ∪ ((bits‘𝑁) ∩ {𝑘}))
5856, 57syl6eq 2872 . . . . . . . . 9 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → ((bits‘𝑁) ∩ (0..^(𝑘 + 1))) = (((bits‘𝑁) ∩ (0..^𝑘)) ∪ ((bits‘𝑁) ∩ {𝑘})))
59 fzofi 13336 . . . . . . . . . . 11 (0..^(𝑘 + 1)) ∈ Fin
60 inss2 4205 . . . . . . . . . . 11 ((bits‘𝑁) ∩ (0..^(𝑘 + 1))) ⊆ (0..^(𝑘 + 1))
61 ssfi 8732 . . . . . . . . . . 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 11704 . . . . . . . . . . . 12 2 ∈ ℕ
6564a1i 11 . . . . . . . . . . 11 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))) → 2 ∈ ℕ)
66 simpr 487 . . . . . . . . . . . . . 14 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))) → 𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1))))
6766elin2d 4175 . . . . . . . . . . . . 13 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))) → 𝑛 ∈ (0..^(𝑘 + 1)))
68 elfzouz 13036 . . . . . . . . . . . . 13 (𝑛 ∈ (0..^(𝑘 + 1)) → 𝑛 ∈ (ℤ‘0))
6967, 68syl 17 . . . . . . . . . . . 12 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))) → 𝑛 ∈ (ℤ‘0))
7069, 52eleqtrrdi 2924 . . . . . . . . . . 11 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))) → 𝑛 ∈ ℕ0)
7165, 70nnexpcld 13600 . . . . . . . . . 10 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))) → (2↑𝑛) ∈ ℕ)
7271nncnd 11648 . . . . . . . . 9 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))) → (2↑𝑛) ∈ ℂ)
7350, 58, 63, 72fsumsplit 15091 . . . . . . . 8 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))(2↑𝑛) = (Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑘))(2↑𝑛) + Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛)))
74 bitsinv1lem 15784 . . . . . . . . . 10 ((𝑁 ∈ ℤ ∧ 𝑘 ∈ ℕ0) → (𝑁 mod (2↑(𝑘 + 1))) = ((𝑁 mod (2↑𝑘)) + if(𝑘 ∈ (bits‘𝑁), (2↑𝑘), 0)))
7539, 74sylan 582 . . . . . . . . 9 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → (𝑁 mod (2↑(𝑘 + 1))) = ((𝑁 mod (2↑𝑘)) + if(𝑘 ∈ (bits‘𝑁), (2↑𝑘), 0)))
76 eqeq2 2833 . . . . . . . . . . 11 ((2↑𝑘) = if(𝑘 ∈ (bits‘𝑁), (2↑𝑘), 0) → (Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛) = (2↑𝑘) ↔ Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛) = if(𝑘 ∈ (bits‘𝑁), (2↑𝑘), 0)))
77 eqeq2 2833 . . . . . . . . . . 11 (0 = if(𝑘 ∈ (bits‘𝑁), (2↑𝑘), 0) → (Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛) = 0 ↔ Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛) = if(𝑘 ∈ (bits‘𝑁), (2↑𝑘), 0)))
78 simpr 487 . . . . . . . . . . . . . . 15 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑘 ∈ (bits‘𝑁)) → 𝑘 ∈ (bits‘𝑁))
7978snssd 4735 . . . . . . . . . . . . . 14 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑘 ∈ (bits‘𝑁)) → {𝑘} ⊆ (bits‘𝑁))
80 sseqin2 4191 . . . . . . . . . . . . . 14 ({𝑘} ⊆ (bits‘𝑁) ↔ ((bits‘𝑁) ∩ {𝑘}) = {𝑘})
8179, 80sylib 220 . . . . . . . . . . . . 13 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑘 ∈ (bits‘𝑁)) → ((bits‘𝑁) ∩ {𝑘}) = {𝑘})
8281sumeq1d 15052 . . . . . . . . . . . 12 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑘 ∈ (bits‘𝑁)) → Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛) = Σ𝑛 ∈ {𝑘} (2↑𝑛))
83 simplr 767 . . . . . . . . . . . . 13 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑘 ∈ (bits‘𝑁)) → 𝑘 ∈ ℕ0)
8464a1i 11 . . . . . . . . . . . . . . 15 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑘 ∈ (bits‘𝑁)) → 2 ∈ ℕ)
8584, 83nnexpcld 13600 . . . . . . . . . . . . . 14 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑘 ∈ (bits‘𝑁)) → (2↑𝑘) ∈ ℕ)
8685nncnd 11648 . . . . . . . . . . . . 13 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑘 ∈ (bits‘𝑁)) → (2↑𝑘) ∈ ℂ)
87 oveq2 7158 . . . . . . . . . . . . . 14 (𝑛 = 𝑘 → (2↑𝑛) = (2↑𝑘))
8887sumsn 15095 . . . . . . . . . . . . 13 ((𝑘 ∈ ℕ0 ∧ (2↑𝑘) ∈ ℂ) → Σ𝑛 ∈ {𝑘} (2↑𝑛) = (2↑𝑘))
8983, 86, 88syl2anc 586 . . . . . . . . . . . 12 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑘 ∈ (bits‘𝑁)) → Σ𝑛 ∈ {𝑘} (2↑𝑛) = (2↑𝑘))
9082, 89eqtrd 2856 . . . . . . . . . . 11 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑘 ∈ (bits‘𝑁)) → Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛) = (2↑𝑘))
91 simpr 487 . . . . . . . . . . . . . 14 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ ¬ 𝑘 ∈ (bits‘𝑁)) → ¬ 𝑘 ∈ (bits‘𝑁))
92 disjsn 4640 . . . . . . . . . . . . . 14 (((bits‘𝑁) ∩ {𝑘}) = ∅ ↔ ¬ 𝑘 ∈ (bits‘𝑁))
9391, 92sylibr 236 . . . . . . . . . . . . 13 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ ¬ 𝑘 ∈ (bits‘𝑁)) → ((bits‘𝑁) ∩ {𝑘}) = ∅)
9493sumeq1d 15052 . . . . . . . . . . . 12 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ ¬ 𝑘 ∈ (bits‘𝑁)) → Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛) = Σ𝑛 ∈ ∅ (2↑𝑛))
9594, 8syl6eq 2872 . . . . . . . . . . 11 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ ¬ 𝑘 ∈ (bits‘𝑁)) → Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛) = 0)
9676, 77, 90, 95ifbothda 4503 . . . . . . . . . 10 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛) = if(𝑘 ∈ (bits‘𝑁), (2↑𝑘), 0))
9796oveq2d 7166 . . . . . . . . 9 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → ((𝑁 mod (2↑𝑘)) + Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛)) = ((𝑁 mod (2↑𝑘)) + if(𝑘 ∈ (bits‘𝑁), (2↑𝑘), 0)))
9875, 97eqtr4d 2859 . . . . . . . 8 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → (𝑁 mod (2↑(𝑘 + 1))) = ((𝑁 mod (2↑𝑘)) + Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛)))
9973, 98eqeq12d 2837 . . . . . . 7 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → (Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))(2↑𝑛) = (𝑁 mod (2↑(𝑘 + 1))) ↔ (Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑘))(2↑𝑛) + Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛)) = ((𝑁 mod (2↑𝑘)) + Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛))))
10043, 99syl5ibr 248 . . . . . 6 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → (Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑘))(2↑𝑛) = (𝑁 mod (2↑𝑘)) → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))(2↑𝑛) = (𝑁 mod (2↑(𝑘 + 1)))))
101100expcom 416 . . . . 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 12071 . . 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 2923 . . . . . 6 (𝑁 ∈ ℕ0𝑁 ∈ (ℤ‘0))
10764a1i 11 . . . . . . . 8 (𝑁 ∈ ℕ0 → 2 ∈ ℕ)
108107, 105nnexpcld 13600 . . . . . . 7 (𝑁 ∈ ℕ0 → (2↑𝑁) ∈ ℕ)
109108nnzd 12080 . . . . . 6 (𝑁 ∈ ℕ0 → (2↑𝑁) ∈ ℤ)
110 2z 12008 . . . . . . . 8 2 ∈ ℤ
111 uzid 12252 . . . . . . . 8 (2 ∈ ℤ → 2 ∈ (ℤ‘2))
112110, 111ax-mp 5 . . . . . . 7 2 ∈ (ℤ‘2)
113 bernneq3 13586 . . . . . . 7 ((2 ∈ (ℤ‘2) ∧ 𝑁 ∈ ℕ0) → 𝑁 < (2↑𝑁))
114112, 113mpan 688 . . . . . 6 (𝑁 ∈ ℕ0𝑁 < (2↑𝑁))
115 elfzo2 13035 . . . . . 6 (𝑁 ∈ (0..^(2↑𝑁)) ↔ (𝑁 ∈ (ℤ‘0) ∧ (2↑𝑁) ∈ ℤ ∧ 𝑁 < (2↑𝑁)))
116106, 109, 114, 115syl3anbrc 1339 . . . . 5 (𝑁 ∈ ℕ0𝑁 ∈ (0..^(2↑𝑁)))
117 bitsfzo 15778 . . . . . 6 ((𝑁 ∈ ℤ ∧ 𝑁 ∈ ℕ0) → (𝑁 ∈ (0..^(2↑𝑁)) ↔ (bits‘𝑁) ⊆ (0..^𝑁)))
11839, 105, 117syl2anc 586 . . . . 5 (𝑁 ∈ ℕ0 → (𝑁 ∈ (0..^(2↑𝑁)) ↔ (bits‘𝑁) ⊆ (0..^𝑁)))
119116, 118mpbid 234 . . . 4 (𝑁 ∈ ℕ0 → (bits‘𝑁) ⊆ (0..^𝑁))
120 df-ss 3951 . . . 4 ((bits‘𝑁) ⊆ (0..^𝑁) ↔ ((bits‘𝑁) ∩ (0..^𝑁)) = (bits‘𝑁))
121119, 120sylib 220 . . 3 (𝑁 ∈ ℕ0 → ((bits‘𝑁) ∩ (0..^𝑁)) = (bits‘𝑁))
122121sumeq1d 15052 . 2 (𝑁 ∈ ℕ0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑁))(2↑𝑛) = Σ𝑛 ∈ (bits‘𝑁)(2↑𝑛))
123 nn0re 11900 . . 3 (𝑁 ∈ ℕ0𝑁 ∈ ℝ)
124 2rp 12388 . . . . 5 2 ∈ ℝ+
125124a1i 11 . . . 4 (𝑁 ∈ ℕ0 → 2 ∈ ℝ+)
126125, 39rpexpcld 13602 . . 3 (𝑁 ∈ ℕ0 → (2↑𝑁) ∈ ℝ+)
127 nn0ge0 11916 . . 3 (𝑁 ∈ ℕ0 → 0 ≤ 𝑁)
128 modid 13258 . . 3 (((𝑁 ∈ ℝ ∧ (2↑𝑁) ∈ ℝ+) ∧ (0 ≤ 𝑁𝑁 < (2↑𝑁))) → (𝑁 mod (2↑𝑁)) = 𝑁)
129123, 126, 127, 114, 128syl22anc 836 . 2 (𝑁 ∈ ℕ0 → (𝑁 mod (2↑𝑁)) = 𝑁)
130104, 122, 1293eqtr3d 2864 1 (𝑁 ∈ ℕ0 → Σ𝑛 ∈ (bits‘𝑁)(2↑𝑛) = 𝑁)
Colors of variables: wff setvar class
Syntax hints:  ¬ wn 3  wi 4  wb 208  wa 398   = wceq 1533  wcel 2110  cun 3933  cin 3934  wss 3935  c0 4290  ifcif 4466  {csn 4560   class class class wbr 5058  cfv 6349  (class class class)co 7150  Fincfn 8503  cc 10529  cr 10530  0cc0 10531  1c1 10532   + caddc 10534   < clt 10669  cle 10670  cn 11632  2c2 11686  0cn0 11891  cz 11975  cuz 12237  +crp 12383  ..^cfzo 13027   mod cmo 13231  cexp 13423  Σcsu 15036  bitscbits 15762
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-3 8  ax-gen 1792  ax-4 1806  ax-5 1907  ax-6 1966  ax-7 2011  ax-8 2112  ax-9 2120  ax-10 2141  ax-11 2157  ax-12 2173  ax-ext 2793  ax-rep 5182  ax-sep 5195  ax-nul 5202  ax-pow 5258  ax-pr 5321  ax-un 7455  ax-inf2 9098  ax-cnex 10587  ax-resscn 10588  ax-1cn 10589  ax-icn 10590  ax-addcl 10591  ax-addrcl 10592  ax-mulcl 10593  ax-mulrcl 10594  ax-mulcom 10595  ax-addass 10596  ax-mulass 10597  ax-distr 10598  ax-i2m1 10599  ax-1ne0 10600  ax-1rid 10601  ax-rnegex 10602  ax-rrecex 10603  ax-cnre 10604  ax-pre-lttri 10605  ax-pre-lttrn 10606  ax-pre-ltadd 10607  ax-pre-mulgt0 10608  ax-pre-sup 10609
This theorem depends on definitions:  df-bi 209  df-an 399  df-or 844  df-3or 1084  df-3an 1085  df-tru 1536  df-fal 1546  df-ex 1777  df-nf 1781  df-sb 2066  df-mo 2618  df-eu 2650  df-clab 2800  df-cleq 2814  df-clel 2893  df-nfc 2963  df-ne 3017  df-nel 3124  df-ral 3143  df-rex 3144  df-reu 3145  df-rmo 3146  df-rab 3147  df-v 3496  df-sbc 3772  df-csb 3883  df-dif 3938  df-un 3940  df-in 3942  df-ss 3951  df-pss 3953  df-nul 4291  df-if 4467  df-pw 4540  df-sn 4561  df-pr 4563  df-tp 4565  df-op 4567  df-uni 4832  df-int 4869  df-iun 4913  df-br 5059  df-opab 5121  df-mpt 5139  df-tr 5165  df-id 5454  df-eprel 5459  df-po 5468  df-so 5469  df-fr 5508  df-se 5509  df-we 5510  df-xp 5555  df-rel 5556  df-cnv 5557  df-co 5558  df-dm 5559  df-rn 5560  df-res 5561  df-ima 5562  df-pred 6142  df-ord 6188  df-on 6189  df-lim 6190  df-suc 6191  df-iota 6308  df-fun 6351  df-fn 6352  df-f 6353  df-f1 6354  df-fo 6355  df-f1o 6356  df-fv 6357  df-isom 6358  df-riota 7108  df-ov 7153  df-oprab 7154  df-mpo 7155  df-om 7575  df-1st 7683  df-2nd 7684  df-wrecs 7941  df-recs 8002  df-rdg 8040  df-1o 8096  df-oadd 8100  df-er 8283  df-en 8504  df-dom 8505  df-sdom 8506  df-fin 8507  df-sup 8900  df-inf 8901  df-oi 8968  df-card 9362  df-pnf 10671  df-mnf 10672  df-xr 10673  df-ltxr 10674  df-le 10675  df-sub 10866  df-neg 10867  df-div 11292  df-nn 11633  df-2 11694  df-3 11695  df-n0 11892  df-z 11976  df-uz 12238  df-rp 12384  df-fz 12887  df-fzo 13028  df-fl 13156  df-mod 13232  df-seq 13364  df-exp 13424  df-hash 13685  df-cj 14452  df-re 14453  df-im 14454  df-sqrt 14588  df-abs 14589  df-clim 14839  df-sum 15037  df-dvds 15602  df-bits 15765
This theorem is referenced by:  bitsinv2  15786  bitsf1ocnv  15787  eulerpartlemgc  31615  eulerpartlemgs2  31633
  Copyright terms: Public domain W3C validator