MPE Home Metamath Proof Explorer < Previous   Next >
Nearby theorems
Mirrors  >  Home  >  MPE Home  >  Th. List  >  bitsf1ocnv Unicode version

Theorem bitsf1ocnv 12635
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 12286. (Contributed by Mario Carneiro, 8-Sep-2016.)
Assertion
Ref Expression
bitsf1ocnv  |-  ( (bits  |`  NN0 ) : NN0 -1-1-onto-> ( ~P NN0  i^i  Fin )  /\  `' (bits  |`  NN0 )  =  ( x  e.  ( ~P NN0  i^i  Fin )  |->  sum_ n  e.  x  ( 2 ^ n
) ) )
Distinct variable group:    x, n

Proof of Theorem bitsf1ocnv
Dummy variable  k is distinct from all other variables.
StepHypRef Expression
1 eqid 2283 . . . . . 6  |-  ( k  e.  NN0  |->  (bits `  k ) )  =  ( k  e.  NN0  |->  (bits `  k ) )
2 bitsss 12617 . . . . . . . . 9  |-  (bits `  k )  C_  NN0
32a1i 10 . . . . . . . 8  |-  ( k  e.  NN0  ->  (bits `  k )  C_  NN0 )
4 bitsfi 12628 . . . . . . . 8  |-  ( k  e.  NN0  ->  (bits `  k )  e.  Fin )
5 elfpw 7157 . . . . . . . 8  |-  ( (bits `  k )  e.  ( ~P NN0  i^i  Fin ) 
<->  ( (bits `  k
)  C_  NN0  /\  (bits `  k )  e.  Fin ) )
63, 4, 5sylanbrc 645 . . . . . . 7  |-  ( k  e.  NN0  ->  (bits `  k )  e.  ( ~P NN0  i^i  Fin ) )
76adantl 452 . . . . . 6  |-  ( (  T.  /\  k  e. 
NN0 )  ->  (bits `  k )  e.  ( ~P NN0  i^i  Fin ) )
8 elfpw 7157 . . . . . . . . 9  |-  ( x  e.  ( ~P NN0  i^i 
Fin )  <->  ( x  C_ 
NN0  /\  x  e.  Fin ) )
98simprbi 450 . . . . . . . 8  |-  ( x  e.  ( ~P NN0  i^i 
Fin )  ->  x  e.  Fin )
10 2nn0 9982 . . . . . . . . . 10  |-  2  e.  NN0
1110a1i 10 . . . . . . . . 9  |-  ( ( x  e.  ( ~P
NN0  i^i  Fin )  /\  n  e.  x
)  ->  2  e.  NN0 )
128simplbi 446 . . . . . . . . . 10  |-  ( x  e.  ( ~P NN0  i^i 
Fin )  ->  x  C_ 
NN0 )
1312sselda 3180 . . . . . . . . 9  |-  ( ( x  e.  ( ~P
NN0  i^i  Fin )  /\  n  e.  x
)  ->  n  e.  NN0 )
1411, 13nn0expcld 11267 . . . . . . . 8  |-  ( ( x  e.  ( ~P
NN0  i^i  Fin )  /\  n  e.  x
)  ->  ( 2 ^ n )  e. 
NN0 )
159, 14fsumnn0cl 12209 . . . . . . 7  |-  ( x  e.  ( ~P NN0  i^i 
Fin )  ->  sum_ n  e.  x  ( 2 ^ n )  e. 
NN0 )
1615adantl 452 . . . . . 6  |-  ( (  T.  /\  x  e.  ( ~P NN0  i^i  Fin ) )  ->  sum_ n  e.  x  ( 2 ^ n )  e. 
NN0 )
17 bitsinv2 12634 . . . . . . . . . 10  |-  ( x  e.  ( ~P NN0  i^i 
Fin )  ->  (bits ` 
sum_ n  e.  x  ( 2 ^ n
) )  =  x )
1817eqcomd 2288 . . . . . . . . 9  |-  ( x  e.  ( ~P NN0  i^i 
Fin )  ->  x  =  (bits `  sum_ n  e.  x  ( 2 ^ n ) ) )
1918ad2antll 709 . . . . . . . 8  |-  ( (  T.  /\  ( k  e.  NN0  /\  x  e.  ( ~P NN0  i^i  Fin ) ) )  ->  x  =  (bits `  sum_ n  e.  x  ( 2 ^ n ) ) )
20 fveq2 5525 . . . . . . . . 9  |-  ( k  =  sum_ n  e.  x  ( 2 ^ n
)  ->  (bits `  k
)  =  (bits `  sum_ n  e.  x  ( 2 ^ n ) ) )
2120eqeq2d 2294 . . . . . . . 8  |-  ( k  =  sum_ n  e.  x  ( 2 ^ n
)  ->  ( x  =  (bits `  k )  <->  x  =  (bits `  sum_ n  e.  x  ( 2 ^ n ) ) ) )
2219, 21syl5ibrcom 213 . . . . . . 7  |-  ( (  T.  /\  ( k  e.  NN0  /\  x  e.  ( ~P NN0  i^i  Fin ) ) )  -> 
( k  =  sum_ n  e.  x  ( 2 ^ n )  ->  x  =  (bits `  k
) ) )
23 bitsinv1 12633 . . . . . . . . . 10  |-  ( k  e.  NN0  ->  sum_ n  e.  (bits `  k )
( 2 ^ n
)  =  k )
2423eqcomd 2288 . . . . . . . . 9  |-  ( k  e.  NN0  ->  k  = 
sum_ n  e.  (bits `  k ) ( 2 ^ n ) )
2524ad2antrl 708 . . . . . . . 8  |-  ( (  T.  /\  ( k  e.  NN0  /\  x  e.  ( ~P NN0  i^i  Fin ) ) )  -> 
k  =  sum_ n  e.  (bits `  k )
( 2 ^ n
) )
26 sumeq1 12162 . . . . . . . . 9  |-  ( x  =  (bits `  k
)  ->  sum_ n  e.  x  ( 2 ^ n )  =  sum_ n  e.  (bits `  k
) ( 2 ^ n ) )
2726eqeq2d 2294 . . . . . . . 8  |-  ( x  =  (bits `  k
)  ->  ( k  =  sum_ n  e.  x  ( 2 ^ n
)  <->  k  =  sum_ n  e.  (bits `  k
) ( 2 ^ n ) ) )
2825, 27syl5ibrcom 213 . . . . . . 7  |-  ( (  T.  /\  ( k  e.  NN0  /\  x  e.  ( ~P NN0  i^i  Fin ) ) )  -> 
( x  =  (bits `  k )  ->  k  =  sum_ n  e.  x  ( 2 ^ n
) ) )
2922, 28impbid 183 . . . . . 6  |-  ( (  T.  /\  ( k  e.  NN0  /\  x  e.  ( ~P NN0  i^i  Fin ) ) )  -> 
( k  =  sum_ n  e.  x  ( 2 ^ n )  <->  x  =  (bits `  k ) ) )
301, 7, 16, 29f1ocnv2d 6068 . . . . 5  |-  (  T. 
->  ( ( k  e. 
NN0  |->  (bits `  k
) ) : NN0 -1-1-onto-> ( ~P NN0  i^i  Fin )  /\  `' ( k  e. 
NN0  |->  (bits `  k
) )  =  ( x  e.  ( ~P
NN0  i^i  Fin )  |-> 
sum_ n  e.  x  ( 2 ^ n
) ) ) )
3130simpld 445 . . . 4  |-  (  T. 
->  ( k  e.  NN0  |->  (bits `  k ) ) : NN0 -1-1-onto-> ( ~P NN0  i^i  Fin ) )
32 bitsf 12618 . . . . . . . . 9  |- bits : ZZ --> ~P NN0
3332a1i 10 . . . . . . . 8  |-  (  T. 
-> bits : ZZ --> ~P NN0 )
3433feqmptd 5575 . . . . . . 7  |-  (  T. 
-> bits  =  ( k  e.  ZZ  |->  (bits `  k
) ) )
3534reseq1d 4954 . . . . . 6  |-  (  T. 
->  (bits  |`  NN0 )  =  ( ( k  e.  ZZ  |->  (bits `  k
) )  |`  NN0 )
)
36 nn0ssz 10044 . . . . . . 7  |-  NN0  C_  ZZ
37 resmpt 5000 . . . . . . 7  |-  ( NN0  C_  ZZ  ->  ( (
k  e.  ZZ  |->  (bits `  k ) )  |`  NN0 )  =  (
k  e.  NN0  |->  (bits `  k ) ) )
3836, 37ax-mp 8 . . . . . 6  |-  ( ( k  e.  ZZ  |->  (bits `  k ) )  |`  NN0 )  =  (
k  e.  NN0  |->  (bits `  k ) )
3935, 38syl6eq 2331 . . . . 5  |-  (  T. 
->  (bits  |`  NN0 )  =  ( k  e.  NN0  |->  (bits `  k ) ) )
40 f1oeq1 5463 . . . . 5  |-  ( (bits  |`  NN0 )  =  ( k  e.  NN0  |->  (bits `  k ) )  -> 
( (bits  |`  NN0 ) : NN0
-1-1-onto-> ( ~P NN0  i^i  Fin ) 
<->  ( k  e.  NN0  |->  (bits `  k ) ) : NN0 -1-1-onto-> ( ~P NN0  i^i  Fin ) ) )
4139, 40syl 15 . . . 4  |-  (  T. 
->  ( (bits  |`  NN0 ) : NN0
-1-1-onto-> ( ~P NN0  i^i  Fin ) 
<->  ( k  e.  NN0  |->  (bits `  k ) ) : NN0 -1-1-onto-> ( ~P NN0  i^i  Fin ) ) )
4231, 41mpbird 223 . . 3  |-  (  T. 
->  (bits  |`  NN0 ) : NN0
-1-1-onto-> ( ~P NN0  i^i  Fin ) )
4339cnveqd 4857 . . . 4  |-  (  T. 
->  `' (bits  |`  NN0 )  =  `' ( k  e. 
NN0  |->  (bits `  k
) ) )
4430simprd 449 . . . 4  |-  (  T. 
->  `' ( k  e. 
NN0  |->  (bits `  k
) )  =  ( x  e.  ( ~P
NN0  i^i  Fin )  |-> 
sum_ n  e.  x  ( 2 ^ n
) ) )
4543, 44eqtrd 2315 . . 3  |-  (  T. 
->  `' (bits  |`  NN0 )  =  ( x  e.  ( ~P NN0  i^i  Fin )  |->  sum_ n  e.  x  ( 2 ^ n
) ) )
4642, 45jca 518 . 2  |-  (  T. 
->  ( (bits  |`  NN0 ) : NN0
-1-1-onto-> ( ~P NN0  i^i  Fin )  /\  `' (bits  |`  NN0 )  =  ( x  e.  ( ~P NN0  i^i  Fin )  |->  sum_ n  e.  x  ( 2 ^ n
) ) ) )
4746trud 1314 1  |-  ( (bits  |`  NN0 ) : NN0 -1-1-onto-> ( ~P NN0  i^i  Fin )  /\  `' (bits  |`  NN0 )  =  ( x  e.  ( ~P NN0  i^i  Fin )  |->  sum_ n  e.  x  ( 2 ^ n
) ) )
Colors of variables: wff set class
Syntax hints:    <-> wb 176    /\ wa 358    T. wtru 1307    = wceq 1623    e. wcel 1684    i^i cin 3151    C_ wss 3152   ~Pcpw 3625    e. cmpt 4077   `'ccnv 4688    |` cres 4691   -->wf 5251   -1-1-onto->wf1o 5254   ` cfv 5255  (class class class)co 5858   Fincfn 6863   2c2 9795   NN0cn0 9965   ZZcz 10024   ^cexp 11104   sum_csu 12158  bitscbits 12610
This theorem is referenced by:  bitsf1o  12636  bitsinv  12639
This theorem was proved from axioms:  ax-1 5  ax-2 6  ax-3 7  ax-mp 8  ax-gen 1533  ax-5 1544  ax-17 1603  ax-9 1635  ax-8 1643  ax-13 1686  ax-14 1688  ax-6 1703  ax-7 1708  ax-11 1715  ax-12 1866  ax-ext 2264  ax-rep 4131  ax-sep 4141  ax-nul 4149  ax-pow 4188  ax-pr 4214  ax-un 4512  ax-inf2 7342  ax-cnex 8793  ax-resscn 8794  ax-1cn 8795  ax-icn 8796  ax-addcl 8797  ax-addrcl 8798  ax-mulcl 8799  ax-mulrcl 8800  ax-mulcom 8801  ax-addass 8802  ax-mulass 8803  ax-distr 8804  ax-i2m1 8805  ax-1ne0 8806  ax-1rid 8807  ax-rnegex 8808  ax-rrecex 8809  ax-cnre 8810  ax-pre-lttri 8811  ax-pre-lttrn 8812  ax-pre-ltadd 8813  ax-pre-mulgt0 8814  ax-pre-sup 8815
This theorem depends on definitions:  df-bi 177  df-or 359  df-an 360  df-3or 935  df-3an 936  df-tru 1310  df-ex 1529  df-nf 1532  df-sb 1630  df-eu 2147  df-mo 2148  df-clab 2270  df-cleq 2276  df-clel 2279  df-nfc 2408  df-ne 2448  df-nel 2449  df-ral 2548  df-rex 2549  df-reu 2550  df-rmo 2551  df-rab 2552  df-v 2790  df-sbc 2992  df-csb 3082  df-dif 3155  df-un 3157  df-in 3159  df-ss 3166  df-pss 3168  df-nul 3456  df-if 3566  df-pw 3627  df-sn 3646  df-pr 3647  df-tp 3648  df-op 3649  df-uni 3828  df-int 3863  df-iun 3907  df-disj 3994  df-br 4024  df-opab 4078  df-mpt 4079  df-tr 4114  df-eprel 4305  df-id 4309  df-po 4314  df-so 4315  df-fr 4352  df-se 4353  df-we 4354  df-ord 4395  df-on 4396  df-lim 4397  df-suc 4398  df-om 4657  df-xp 4695  df-rel 4696  df-cnv 4697  df-co 4698  df-dm 4699  df-rn 4700  df-res 4701  df-ima 4702  df-iota 5219  df-fun 5257  df-fn 5258  df-f 5259  df-f1 5260  df-fo 5261  df-f1o 5262  df-fv 5263  df-isom 5264  df-ov 5861  df-oprab 5862  df-mpt2 5863  df-1st 6122  df-2nd 6123  df-riota 6304  df-recs 6388  df-rdg 6423  df-1o 6479  df-2o 6480  df-oadd 6483  df-er 6660  df-map 6774  df-pm 6775  df-en 6864  df-dom 6865  df-sdom 6866  df-fin 6867  df-sup 7194  df-oi 7225  df-card 7572  df-cda 7794  df-pnf 8869  df-mnf 8870  df-xr 8871  df-ltxr 8872  df-le 8873  df-sub 9039  df-neg 9040  df-div 9424  df-nn 9747  df-2 9804  df-3 9805  df-n0 9966  df-z 10025  df-uz 10231  df-rp 10355  df-fz 10783  df-fzo 10871  df-fl 10925  df-mod 10974  df-seq 11047  df-exp 11105  df-hash 11338  df-cj 11584  df-re 11585  df-im 11586  df-sqr 11720  df-abs 11721  df-clim 11962  df-sum 12159  df-dvds 12532  df-bits 12613
  Copyright terms: Public domain W3C validator