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

Theorem bitsinv1 15002
Description: There is an explicit inverse to the bits function for nonnegative integers (which can be extended to negative integers using bitscmp 14998), 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 6557 . . . . . . . . . . 11 (𝑥 = 0 → (0..^𝑥) = (0..^0))
2 fzo0 12361 . . . . . . . . . . 11 (0..^0) = ∅
31, 2syl6eq 2660 . . . . . . . . . 10 (𝑥 = 0 → (0..^𝑥) = ∅)
43ineq2d 3776 . . . . . . . . 9 (𝑥 = 0 → ((bits‘𝑁) ∩ (0..^𝑥)) = ((bits‘𝑁) ∩ ∅))
5 in0 3920 . . . . . . . . 9 ((bits‘𝑁) ∩ ∅) = ∅
64, 5syl6eq 2660 . . . . . . . 8 (𝑥 = 0 → ((bits‘𝑁) ∩ (0..^𝑥)) = ∅)
76sumeq1d 14279 . . . . . . 7 (𝑥 = 0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = Σ𝑛 ∈ ∅ (2↑𝑛))
8 sum0 14299 . . . . . . 7 Σ𝑛 ∈ ∅ (2↑𝑛) = 0
97, 8syl6eq 2660 . . . . . 6 (𝑥 = 0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = 0)
10 oveq2 6557 . . . . . . . 8 (𝑥 = 0 → (2↑𝑥) = (2↑0))
11 2cn 10968 . . . . . . . . 9 2 ∈ ℂ
12 exp0 12726 . . . . . . . . 9 (2 ∈ ℂ → (2↑0) = 1)
1311, 12ax-mp 5 . . . . . . . 8 (2↑0) = 1
1410, 13syl6eq 2660 . . . . . . 7 (𝑥 = 0 → (2↑𝑥) = 1)
1514oveq2d 6565 . . . . . 6 (𝑥 = 0 → (𝑁 mod (2↑𝑥)) = (𝑁 mod 1))
169, 15eqeq12d 2625 . . . . 5 (𝑥 = 0 → (Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = (𝑁 mod (2↑𝑥)) ↔ 0 = (𝑁 mod 1)))
1716imbi2d 329 . . . 4 (𝑥 = 0 → ((𝑁 ∈ ℕ0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = (𝑁 mod (2↑𝑥))) ↔ (𝑁 ∈ ℕ0 → 0 = (𝑁 mod 1))))
18 oveq2 6557 . . . . . . . 8 (𝑥 = 𝑘 → (0..^𝑥) = (0..^𝑘))
1918ineq2d 3776 . . . . . . 7 (𝑥 = 𝑘 → ((bits‘𝑁) ∩ (0..^𝑥)) = ((bits‘𝑁) ∩ (0..^𝑘)))
2019sumeq1d 14279 . . . . . 6 (𝑥 = 𝑘 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑘))(2↑𝑛))
21 oveq2 6557 . . . . . . 7 (𝑥 = 𝑘 → (2↑𝑥) = (2↑𝑘))
2221oveq2d 6565 . . . . . 6 (𝑥 = 𝑘 → (𝑁 mod (2↑𝑥)) = (𝑁 mod (2↑𝑘)))
2320, 22eqeq12d 2625 . . . . 5 (𝑥 = 𝑘 → (Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = (𝑁 mod (2↑𝑥)) ↔ Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑘))(2↑𝑛) = (𝑁 mod (2↑𝑘))))
2423imbi2d 329 . . . 4 (𝑥 = 𝑘 → ((𝑁 ∈ ℕ0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = (𝑁 mod (2↑𝑥))) ↔ (𝑁 ∈ ℕ0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑘))(2↑𝑛) = (𝑁 mod (2↑𝑘)))))
25 oveq2 6557 . . . . . . . 8 (𝑥 = (𝑘 + 1) → (0..^𝑥) = (0..^(𝑘 + 1)))
2625ineq2d 3776 . . . . . . 7 (𝑥 = (𝑘 + 1) → ((bits‘𝑁) ∩ (0..^𝑥)) = ((bits‘𝑁) ∩ (0..^(𝑘 + 1))))
2726sumeq1d 14279 . . . . . 6 (𝑥 = (𝑘 + 1) → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))(2↑𝑛))
28 oveq2 6557 . . . . . . 7 (𝑥 = (𝑘 + 1) → (2↑𝑥) = (2↑(𝑘 + 1)))
2928oveq2d 6565 . . . . . 6 (𝑥 = (𝑘 + 1) → (𝑁 mod (2↑𝑥)) = (𝑁 mod (2↑(𝑘 + 1))))
3027, 29eqeq12d 2625 . . . . 5 (𝑥 = (𝑘 + 1) → (Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = (𝑁 mod (2↑𝑥)) ↔ Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))(2↑𝑛) = (𝑁 mod (2↑(𝑘 + 1)))))
3130imbi2d 329 . . . 4 (𝑥 = (𝑘 + 1) → ((𝑁 ∈ ℕ0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = (𝑁 mod (2↑𝑥))) ↔ (𝑁 ∈ ℕ0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))(2↑𝑛) = (𝑁 mod (2↑(𝑘 + 1))))))
32 oveq2 6557 . . . . . . . 8 (𝑥 = 𝑁 → (0..^𝑥) = (0..^𝑁))
3332ineq2d 3776 . . . . . . 7 (𝑥 = 𝑁 → ((bits‘𝑁) ∩ (0..^𝑥)) = ((bits‘𝑁) ∩ (0..^𝑁)))
3433sumeq1d 14279 . . . . . 6 (𝑥 = 𝑁 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑁))(2↑𝑛))
35 oveq2 6557 . . . . . . 7 (𝑥 = 𝑁 → (2↑𝑥) = (2↑𝑁))
3635oveq2d 6565 . . . . . 6 (𝑥 = 𝑁 → (𝑁 mod (2↑𝑥)) = (𝑁 mod (2↑𝑁)))
3734, 36eqeq12d 2625 . . . . 5 (𝑥 = 𝑁 → (Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = (𝑁 mod (2↑𝑥)) ↔ Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑁))(2↑𝑛) = (𝑁 mod (2↑𝑁))))
3837imbi2d 329 . . . 4 (𝑥 = 𝑁 → ((𝑁 ∈ ℕ0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑥))(2↑𝑛) = (𝑁 mod (2↑𝑥))) ↔ (𝑁 ∈ ℕ0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑁))(2↑𝑛) = (𝑁 mod (2↑𝑁)))))
39 nn0z 11277 . . . . . 6 (𝑁 ∈ ℕ0𝑁 ∈ ℤ)
40 zmod10 12548 . . . . . 6 (𝑁 ∈ ℤ → (𝑁 mod 1) = 0)
4139, 40syl 17 . . . . 5 (𝑁 ∈ ℕ0 → (𝑁 mod 1) = 0)
4241eqcomd 2616 . . . 4 (𝑁 ∈ ℕ0 → 0 = (𝑁 mod 1))
43 oveq1 6556 . . . . . . 7 𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑘))(2↑𝑛) = (𝑁 mod (2↑𝑘)) → (Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑘))(2↑𝑛) + Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛)) = ((𝑁 mod (2↑𝑘)) + Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛)))
44 fzonel 12352 . . . . . . . . . . . . 13 ¬ 𝑘 ∈ (0..^𝑘)
4544a1i 11 . . . . . . . . . . . 12 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → ¬ 𝑘 ∈ (0..^𝑘))
46 disjsn 4192 . . . . . . . . . . . 12 (((0..^𝑘) ∩ {𝑘}) = ∅ ↔ ¬ 𝑘 ∈ (0..^𝑘))
4745, 46sylibr 223 . . . . . . . . . . 11 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → ((0..^𝑘) ∩ {𝑘}) = ∅)
4847ineq2d 3776 . . . . . . . . . 10 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → ((bits‘𝑁) ∩ ((0..^𝑘) ∩ {𝑘})) = ((bits‘𝑁) ∩ ∅))
49 inindi 3792 . . . . . . . . . 10 ((bits‘𝑁) ∩ ((0..^𝑘) ∩ {𝑘})) = (((bits‘𝑁) ∩ (0..^𝑘)) ∩ ((bits‘𝑁) ∩ {𝑘}))
5048, 49, 53eqtr3g 2667 . . . . . . . . 9 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → (((bits‘𝑁) ∩ (0..^𝑘)) ∩ ((bits‘𝑁) ∩ {𝑘})) = ∅)
51 simpr 476 . . . . . . . . . . . . 13 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → 𝑘 ∈ ℕ0)
52 nn0uz 11598 . . . . . . . . . . . . 13 0 = (ℤ‘0)
5351, 52syl6eleq 2698 . . . . . . . . . . . 12 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → 𝑘 ∈ (ℤ‘0))
54 fzosplitsn 12442 . . . . . . . . . . . 12 (𝑘 ∈ (ℤ‘0) → (0..^(𝑘 + 1)) = ((0..^𝑘) ∪ {𝑘}))
5553, 54syl 17 . . . . . . . . . . 11 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → (0..^(𝑘 + 1)) = ((0..^𝑘) ∪ {𝑘}))
5655ineq2d 3776 . . . . . . . . . 10 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → ((bits‘𝑁) ∩ (0..^(𝑘 + 1))) = ((bits‘𝑁) ∩ ((0..^𝑘) ∪ {𝑘})))
57 indi 3832 . . . . . . . . . 10 ((bits‘𝑁) ∩ ((0..^𝑘) ∪ {𝑘})) = (((bits‘𝑁) ∩ (0..^𝑘)) ∪ ((bits‘𝑁) ∩ {𝑘}))
5856, 57syl6eq 2660 . . . . . . . . 9 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → ((bits‘𝑁) ∩ (0..^(𝑘 + 1))) = (((bits‘𝑁) ∩ (0..^𝑘)) ∪ ((bits‘𝑁) ∩ {𝑘})))
59 fzofi 12635 . . . . . . . . . . 11 (0..^(𝑘 + 1)) ∈ Fin
60 inss2 3796 . . . . . . . . . . 11 ((bits‘𝑁) ∩ (0..^(𝑘 + 1))) ⊆ (0..^(𝑘 + 1))
61 ssfi 8065 . . . . . . . . . . 11 (((0..^(𝑘 + 1)) ∈ Fin ∧ ((bits‘𝑁) ∩ (0..^(𝑘 + 1))) ⊆ (0..^(𝑘 + 1))) → ((bits‘𝑁) ∩ (0..^(𝑘 + 1))) ∈ Fin)
6259, 60, 61mp2an 704 . . . . . . . . . 10 ((bits‘𝑁) ∩ (0..^(𝑘 + 1))) ∈ Fin
6362a1i 11 . . . . . . . . 9 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → ((bits‘𝑁) ∩ (0..^(𝑘 + 1))) ∈ Fin)
64 2nn 11062 . . . . . . . . . . . 12 2 ∈ ℕ
6564a1i 11 . . . . . . . . . . 11 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))) → 2 ∈ ℕ)
66 simpr 476 . . . . . . . . . . . . . 14 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))) → 𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1))))
6766elin2d 3765 . . . . . . . . . . . . 13 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))) → 𝑛 ∈ (0..^(𝑘 + 1)))
68 elfzouz 12343 . . . . . . . . . . . . 13 (𝑛 ∈ (0..^(𝑘 + 1)) → 𝑛 ∈ (ℤ‘0))
6967, 68syl 17 . . . . . . . . . . . 12 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))) → 𝑛 ∈ (ℤ‘0))
7069, 52syl6eleqr 2699 . . . . . . . . . . 11 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))) → 𝑛 ∈ ℕ0)
7165, 70nnexpcld 12892 . . . . . . . . . 10 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))) → (2↑𝑛) ∈ ℕ)
7271nncnd 10913 . . . . . . . . 9 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))) → (2↑𝑛) ∈ ℂ)
7350, 58, 63, 72fsumsplit 14318 . . . . . . . 8 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))(2↑𝑛) = (Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑘))(2↑𝑛) + Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛)))
74 bitsinv1lem 15001 . . . . . . . . . 10 ((𝑁 ∈ ℤ ∧ 𝑘 ∈ ℕ0) → (𝑁 mod (2↑(𝑘 + 1))) = ((𝑁 mod (2↑𝑘)) + if(𝑘 ∈ (bits‘𝑁), (2↑𝑘), 0)))
7539, 74sylan 487 . . . . . . . . 9 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → (𝑁 mod (2↑(𝑘 + 1))) = ((𝑁 mod (2↑𝑘)) + if(𝑘 ∈ (bits‘𝑁), (2↑𝑘), 0)))
76 eqeq2 2621 . . . . . . . . . . 11 ((2↑𝑘) = if(𝑘 ∈ (bits‘𝑁), (2↑𝑘), 0) → (Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛) = (2↑𝑘) ↔ Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛) = if(𝑘 ∈ (bits‘𝑁), (2↑𝑘), 0)))
77 eqeq2 2621 . . . . . . . . . . 11 (0 = if(𝑘 ∈ (bits‘𝑁), (2↑𝑘), 0) → (Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛) = 0 ↔ Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛) = if(𝑘 ∈ (bits‘𝑁), (2↑𝑘), 0)))
78 simpr 476 . . . . . . . . . . . . . . 15 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑘 ∈ (bits‘𝑁)) → 𝑘 ∈ (bits‘𝑁))
7978snssd 4281 . . . . . . . . . . . . . 14 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑘 ∈ (bits‘𝑁)) → {𝑘} ⊆ (bits‘𝑁))
80 sseqin2 3779 . . . . . . . . . . . . . 14 ({𝑘} ⊆ (bits‘𝑁) ↔ ((bits‘𝑁) ∩ {𝑘}) = {𝑘})
8179, 80sylib 207 . . . . . . . . . . . . 13 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑘 ∈ (bits‘𝑁)) → ((bits‘𝑁) ∩ {𝑘}) = {𝑘})
8281sumeq1d 14279 . . . . . . . . . . . 12 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑘 ∈ (bits‘𝑁)) → Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛) = Σ𝑛 ∈ {𝑘} (2↑𝑛))
83 simplr 788 . . . . . . . . . . . . 13 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑘 ∈ (bits‘𝑁)) → 𝑘 ∈ ℕ0)
8464a1i 11 . . . . . . . . . . . . . . 15 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑘 ∈ (bits‘𝑁)) → 2 ∈ ℕ)
8584, 83nnexpcld 12892 . . . . . . . . . . . . . 14 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑘 ∈ (bits‘𝑁)) → (2↑𝑘) ∈ ℕ)
8685nncnd 10913 . . . . . . . . . . . . 13 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑘 ∈ (bits‘𝑁)) → (2↑𝑘) ∈ ℂ)
87 oveq2 6557 . . . . . . . . . . . . . 14 (𝑛 = 𝑘 → (2↑𝑛) = (2↑𝑘))
8887sumsn 14319 . . . . . . . . . . . . 13 ((𝑘 ∈ ℕ0 ∧ (2↑𝑘) ∈ ℂ) → Σ𝑛 ∈ {𝑘} (2↑𝑛) = (2↑𝑘))
8983, 86, 88syl2anc 691 . . . . . . . . . . . 12 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑘 ∈ (bits‘𝑁)) → Σ𝑛 ∈ {𝑘} (2↑𝑛) = (2↑𝑘))
9082, 89eqtrd 2644 . . . . . . . . . . 11 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ 𝑘 ∈ (bits‘𝑁)) → Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛) = (2↑𝑘))
91 simpr 476 . . . . . . . . . . . . . 14 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ ¬ 𝑘 ∈ (bits‘𝑁)) → ¬ 𝑘 ∈ (bits‘𝑁))
92 disjsn 4192 . . . . . . . . . . . . . 14 (((bits‘𝑁) ∩ {𝑘}) = ∅ ↔ ¬ 𝑘 ∈ (bits‘𝑁))
9391, 92sylibr 223 . . . . . . . . . . . . 13 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ ¬ 𝑘 ∈ (bits‘𝑁)) → ((bits‘𝑁) ∩ {𝑘}) = ∅)
9493sumeq1d 14279 . . . . . . . . . . . 12 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ ¬ 𝑘 ∈ (bits‘𝑁)) → Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛) = Σ𝑛 ∈ ∅ (2↑𝑛))
9594, 8syl6eq 2660 . . . . . . . . . . 11 (((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) ∧ ¬ 𝑘 ∈ (bits‘𝑁)) → Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛) = 0)
9676, 77, 90, 95ifbothda 4073 . . . . . . . . . 10 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛) = if(𝑘 ∈ (bits‘𝑁), (2↑𝑘), 0))
9796oveq2d 6565 . . . . . . . . 9 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → ((𝑁 mod (2↑𝑘)) + Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛)) = ((𝑁 mod (2↑𝑘)) + if(𝑘 ∈ (bits‘𝑁), (2↑𝑘), 0)))
9875, 97eqtr4d 2647 . . . . . . . 8 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → (𝑁 mod (2↑(𝑘 + 1))) = ((𝑁 mod (2↑𝑘)) + Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛)))
9973, 98eqeq12d 2625 . . . . . . 7 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → (Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))(2↑𝑛) = (𝑁 mod (2↑(𝑘 + 1))) ↔ (Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑘))(2↑𝑛) + Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛)) = ((𝑁 mod (2↑𝑘)) + Σ𝑛 ∈ ((bits‘𝑁) ∩ {𝑘})(2↑𝑛))))
10043, 99syl5ibr 235 . . . . . 6 ((𝑁 ∈ ℕ0𝑘 ∈ ℕ0) → (Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑘))(2↑𝑛) = (𝑁 mod (2↑𝑘)) → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^(𝑘 + 1)))(2↑𝑛) = (𝑁 mod (2↑(𝑘 + 1)))))
101100expcom 450 . . . . 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 11348 . . 3 (𝑁 ∈ ℕ0 → (𝑁 ∈ ℕ0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑁))(2↑𝑛) = (𝑁 mod (2↑𝑁))))
104103pm2.43i 50 . 2 (𝑁 ∈ ℕ0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑁))(2↑𝑛) = (𝑁 mod (2↑𝑁)))
105 id 22 . . . . . . 7 (𝑁 ∈ ℕ0𝑁 ∈ ℕ0)
106105, 52syl6eleq 2698 . . . . . 6 (𝑁 ∈ ℕ0𝑁 ∈ (ℤ‘0))
10764a1i 11 . . . . . . . 8 (𝑁 ∈ ℕ0 → 2 ∈ ℕ)
108107, 105nnexpcld 12892 . . . . . . 7 (𝑁 ∈ ℕ0 → (2↑𝑁) ∈ ℕ)
109108nnzd 11357 . . . . . 6 (𝑁 ∈ ℕ0 → (2↑𝑁) ∈ ℤ)
110 2z 11286 . . . . . . . 8 2 ∈ ℤ
111 uzid 11578 . . . . . . . 8 (2 ∈ ℤ → 2 ∈ (ℤ‘2))
112110, 111ax-mp 5 . . . . . . 7 2 ∈ (ℤ‘2)
113 bernneq3 12854 . . . . . . 7 ((2 ∈ (ℤ‘2) ∧ 𝑁 ∈ ℕ0) → 𝑁 < (2↑𝑁))
114112, 113mpan 702 . . . . . 6 (𝑁 ∈ ℕ0𝑁 < (2↑𝑁))
115 elfzo2 12342 . . . . . 6 (𝑁 ∈ (0..^(2↑𝑁)) ↔ (𝑁 ∈ (ℤ‘0) ∧ (2↑𝑁) ∈ ℤ ∧ 𝑁 < (2↑𝑁)))
116106, 109, 114, 115syl3anbrc 1239 . . . . 5 (𝑁 ∈ ℕ0𝑁 ∈ (0..^(2↑𝑁)))
117 bitsfzo 14995 . . . . . 6 ((𝑁 ∈ ℤ ∧ 𝑁 ∈ ℕ0) → (𝑁 ∈ (0..^(2↑𝑁)) ↔ (bits‘𝑁) ⊆ (0..^𝑁)))
11839, 105, 117syl2anc 691 . . . . 5 (𝑁 ∈ ℕ0 → (𝑁 ∈ (0..^(2↑𝑁)) ↔ (bits‘𝑁) ⊆ (0..^𝑁)))
119116, 118mpbid 221 . . . 4 (𝑁 ∈ ℕ0 → (bits‘𝑁) ⊆ (0..^𝑁))
120 df-ss 3554 . . . 4 ((bits‘𝑁) ⊆ (0..^𝑁) ↔ ((bits‘𝑁) ∩ (0..^𝑁)) = (bits‘𝑁))
121119, 120sylib 207 . . 3 (𝑁 ∈ ℕ0 → ((bits‘𝑁) ∩ (0..^𝑁)) = (bits‘𝑁))
122121sumeq1d 14279 . 2 (𝑁 ∈ ℕ0 → Σ𝑛 ∈ ((bits‘𝑁) ∩ (0..^𝑁))(2↑𝑛) = Σ𝑛 ∈ (bits‘𝑁)(2↑𝑛))
123 nn0re 11178 . . 3 (𝑁 ∈ ℕ0𝑁 ∈ ℝ)
124 2rp 11713 . . . . 5 2 ∈ ℝ+
125124a1i 11 . . . 4 (𝑁 ∈ ℕ0 → 2 ∈ ℝ+)
126125, 39rpexpcld 12894 . . 3 (𝑁 ∈ ℕ0 → (2↑𝑁) ∈ ℝ+)
127 nn0ge0 11195 . . 3 (𝑁 ∈ ℕ0 → 0 ≤ 𝑁)
128 modid 12557 . . 3 (((𝑁 ∈ ℝ ∧ (2↑𝑁) ∈ ℝ+) ∧ (0 ≤ 𝑁𝑁 < (2↑𝑁))) → (𝑁 mod (2↑𝑁)) = 𝑁)
129123, 126, 127, 114, 128syl22anc 1319 . 2 (𝑁 ∈ ℕ0 → (𝑁 mod (2↑𝑁)) = 𝑁)
130104, 122, 1293eqtr3d 2652 1 (𝑁 ∈ ℕ0 → Σ𝑛 ∈ (bits‘𝑁)(2↑𝑛) = 𝑁)
Colors of variables: wff setvar class
Syntax hints:  ¬ wn 3  wi 4  wb 195  wa 383   = wceq 1475  wcel 1977  cun 3538  cin 3539  wss 3540  c0 3874  ifcif 4036  {csn 4125   class class class wbr 4583  cfv 5804  (class class class)co 6549  Fincfn 7841  cc 9813  cr 9814  0cc0 9815  1c1 9816   + caddc 9818   < clt 9953  cle 9954  cn 10897  2c2 10947  0cn0 11169  cz 11254  cuz 11563  +crp 11708  ..^cfzo 12334   mod cmo 12530  cexp 12722  Σcsu 14264  bitscbits 14979
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-3 8  ax-gen 1713  ax-4 1728  ax-5 1827  ax-6 1875  ax-7 1922  ax-8 1979  ax-9 1986  ax-10 2006  ax-11 2021  ax-12 2034  ax-13 2234  ax-ext 2590  ax-rep 4699  ax-sep 4709  ax-nul 4717  ax-pow 4769  ax-pr 4833  ax-un 6847  ax-inf2 8421  ax-cnex 9871  ax-resscn 9872  ax-1cn 9873  ax-icn 9874  ax-addcl 9875  ax-addrcl 9876  ax-mulcl 9877  ax-mulrcl 9878  ax-mulcom 9879  ax-addass 9880  ax-mulass 9881  ax-distr 9882  ax-i2m1 9883  ax-1ne0 9884  ax-1rid 9885  ax-rnegex 9886  ax-rrecex 9887  ax-cnre 9888  ax-pre-lttri 9889  ax-pre-lttrn 9890  ax-pre-ltadd 9891  ax-pre-mulgt0 9892  ax-pre-sup 9893
This theorem depends on definitions:  df-bi 196  df-or 384  df-an 385  df-3or 1032  df-3an 1033  df-tru 1478  df-fal 1481  df-ex 1696  df-nf 1701  df-sb 1868  df-eu 2462  df-mo 2463  df-clab 2597  df-cleq 2603  df-clel 2606  df-nfc 2740  df-ne 2782  df-nel 2783  df-ral 2901  df-rex 2902  df-reu 2903  df-rmo 2904  df-rab 2905  df-v 3175  df-sbc 3403  df-csb 3500  df-dif 3543  df-un 3545  df-in 3547  df-ss 3554  df-pss 3556  df-nul 3875  df-if 4037  df-pw 4110  df-sn 4126  df-pr 4128  df-tp 4130  df-op 4132  df-uni 4373  df-int 4411  df-iun 4457  df-br 4584  df-opab 4644  df-mpt 4645  df-tr 4681  df-eprel 4949  df-id 4953  df-po 4959  df-so 4960  df-fr 4997  df-se 4998  df-we 4999  df-xp 5044  df-rel 5045  df-cnv 5046  df-co 5047  df-dm 5048  df-rn 5049  df-res 5050  df-ima 5051  df-pred 5597  df-ord 5643  df-on 5644  df-lim 5645  df-suc 5646  df-iota 5768  df-fun 5806  df-fn 5807  df-f 5808  df-f1 5809  df-fo 5810  df-f1o 5811  df-fv 5812  df-isom 5813  df-riota 6511  df-ov 6552  df-oprab 6553  df-mpt2 6554  df-om 6958  df-1st 7059  df-2nd 7060  df-wrecs 7294  df-recs 7355  df-rdg 7393  df-1o 7447  df-oadd 7451  df-er 7629  df-en 7842  df-dom 7843  df-sdom 7844  df-fin 7845  df-sup 8231  df-inf 8232  df-oi 8298  df-card 8648  df-pnf 9955  df-mnf 9956  df-xr 9957  df-ltxr 9958  df-le 9959  df-sub 10147  df-neg 10148  df-div 10564  df-nn 10898  df-2 10956  df-3 10957  df-n0 11170  df-z 11255  df-uz 11564  df-rp 11709  df-fz 12198  df-fzo 12335  df-fl 12455  df-mod 12531  df-seq 12664  df-exp 12723  df-hash 12980  df-cj 13687  df-re 13688  df-im 13689  df-sqrt 13823  df-abs 13824  df-clim 14067  df-sum 14265  df-dvds 14822  df-bits 14982
This theorem is referenced by:  bitsinv2  15003  bitsf1ocnv  15004  eulerpartlemgc  29751  eulerpartlemgs2  29769
  Copyright terms: Public domain W3C validator