Metamath Proof Explorer


Theorem bitsf1ocnv

Description: The bits function restricted to nonnegative integers is a bijection from the integers to the finite sets of integers. It is in fact the inverse of the Ackermann bijection ackbijnn . (Contributed by Mario Carneiro, 8-Sep-2016)

Ref Expression
Assertion bitsf1ocnv bits 0 : 0 1-1 onto 𝒫 0 Fin bits 0 -1 = x 𝒫 0 Fin n x 2 n

Proof

Step Hyp Ref Expression
1 eqid k 0 bits k = k 0 bits k
2 bitsss bits k 0
3 2 a1i k 0 bits k 0
4 bitsfi k 0 bits k Fin
5 elfpw bits k 𝒫 0 Fin bits k 0 bits k Fin
6 3 4 5 sylanbrc k 0 bits k 𝒫 0 Fin
7 6 adantl k 0 bits k 𝒫 0 Fin
8 elinel2 x 𝒫 0 Fin x Fin
9 2nn0 2 0
10 9 a1i x 𝒫 0 Fin n x 2 0
11 elfpw x 𝒫 0 Fin x 0 x Fin
12 11 simplbi x 𝒫 0 Fin x 0
13 12 sselda x 𝒫 0 Fin n x n 0
14 10 13 nn0expcld x 𝒫 0 Fin n x 2 n 0
15 8 14 fsumnn0cl x 𝒫 0 Fin n x 2 n 0
16 15 adantl x 𝒫 0 Fin n x 2 n 0
17 bitsinv2 x 𝒫 0 Fin bits n x 2 n = x
18 17 eqcomd x 𝒫 0 Fin x = bits n x 2 n
19 18 ad2antll k 0 x 𝒫 0 Fin x = bits n x 2 n
20 fveq2 k = n x 2 n bits k = bits n x 2 n
21 20 eqeq2d k = n x 2 n x = bits k x = bits n x 2 n
22 19 21 syl5ibrcom k 0 x 𝒫 0 Fin k = n x 2 n x = bits k
23 bitsinv1 k 0 n bits k 2 n = k
24 23 eqcomd k 0 k = n bits k 2 n
25 24 ad2antrl k 0 x 𝒫 0 Fin k = n bits k 2 n
26 sumeq1 x = bits k n x 2 n = n bits k 2 n
27 26 eqeq2d x = bits k k = n x 2 n k = n bits k 2 n
28 25 27 syl5ibrcom k 0 x 𝒫 0 Fin x = bits k k = n x 2 n
29 22 28 impbid k 0 x 𝒫 0 Fin k = n x 2 n x = bits k
30 1 7 16 29 f1ocnv2d k 0 bits k : 0 1-1 onto 𝒫 0 Fin k 0 bits k -1 = x 𝒫 0 Fin n x 2 n
31 30 simpld k 0 bits k : 0 1-1 onto 𝒫 0 Fin
32 bitsf bits : 𝒫 0
33 32 a1i bits : 𝒫 0
34 33 feqmptd bits = k bits k
35 34 reseq1d bits 0 = k bits k 0
36 nn0ssz 0
37 resmpt 0 k bits k 0 = k 0 bits k
38 36 37 ax-mp k bits k 0 = k 0 bits k
39 35 38 eqtrdi bits 0 = k 0 bits k
40 39 f1oeq1d bits 0 : 0 1-1 onto 𝒫 0 Fin k 0 bits k : 0 1-1 onto 𝒫 0 Fin
41 31 40 mpbird bits 0 : 0 1-1 onto 𝒫 0 Fin
42 39 cnveqd bits 0 -1 = k 0 bits k -1
43 30 simprd k 0 bits k -1 = x 𝒫 0 Fin n x 2 n
44 42 43 eqtrd bits 0 -1 = x 𝒫 0 Fin n x 2 n
45 41 44 jca bits 0 : 0 1-1 onto 𝒫 0 Fin bits 0 -1 = x 𝒫 0 Fin n x 2 n
46 45 mptru bits 0 : 0 1-1 onto 𝒫 0 Fin bits 0 -1 = x 𝒫 0 Fin n x 2 n