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

Theorem bitsf1ocnv 12987
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 12638. (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 2442 . . . . . 6  |-  ( k  e.  NN0  |->  (bits `  k ) )  =  ( k  e.  NN0  |->  (bits `  k ) )
2 bitsss 12969 . . . . . . . . 9  |-  (bits `  k )  C_  NN0
32a1i 11 . . . . . . . 8  |-  ( k  e.  NN0  ->  (bits `  k )  C_  NN0 )
4 bitsfi 12980 . . . . . . . 8  |-  ( k  e.  NN0  ->  (bits `  k )  e.  Fin )
5 elfpw 7437 . . . . . . . 8  |-  ( (bits `  k )  e.  ( ~P NN0  i^i  Fin ) 
<->  ( (bits `  k
)  C_  NN0  /\  (bits `  k )  e.  Fin ) )
63, 4, 5sylanbrc 647 . . . . . . 7  |-  ( k  e.  NN0  ->  (bits `  k )  e.  ( ~P NN0  i^i  Fin ) )
76adantl 454 . . . . . 6  |-  ( (  T.  /\  k  e. 
NN0 )  ->  (bits `  k )  e.  ( ~P NN0  i^i  Fin ) )
8 elfpw 7437 . . . . . . . . 9  |-  ( x  e.  ( ~P NN0  i^i 
Fin )  <->  ( x  C_ 
NN0  /\  x  e.  Fin ) )
98simprbi 452 . . . . . . . 8  |-  ( x  e.  ( ~P NN0  i^i 
Fin )  ->  x  e.  Fin )
10 2nn0 10269 . . . . . . . . . 10  |-  2  e.  NN0
1110a1i 11 . . . . . . . . 9  |-  ( ( x  e.  ( ~P
NN0  i^i  Fin )  /\  n  e.  x
)  ->  2  e.  NN0 )
128simplbi 448 . . . . . . . . . 10  |-  ( x  e.  ( ~P NN0  i^i 
Fin )  ->  x  C_ 
NN0 )
1312sselda 3334 . . . . . . . . 9  |-  ( ( x  e.  ( ~P
NN0  i^i  Fin )  /\  n  e.  x
)  ->  n  e.  NN0 )
1411, 13nn0expcld 11576 . . . . . . . 8  |-  ( ( x  e.  ( ~P
NN0  i^i  Fin )  /\  n  e.  x
)  ->  ( 2 ^ n )  e. 
NN0 )
159, 14fsumnn0cl 12561 . . . . . . 7  |-  ( x  e.  ( ~P NN0  i^i 
Fin )  ->  sum_ n  e.  x  ( 2 ^ n )  e. 
NN0 )
1615adantl 454 . . . . . 6  |-  ( (  T.  /\  x  e.  ( ~P NN0  i^i  Fin ) )  ->  sum_ n  e.  x  ( 2 ^ n )  e. 
NN0 )
17 bitsinv2 12986 . . . . . . . . . 10  |-  ( x  e.  ( ~P NN0  i^i 
Fin )  ->  (bits ` 
sum_ n  e.  x  ( 2 ^ n
) )  =  x )
1817eqcomd 2447 . . . . . . . . 9  |-  ( x  e.  ( ~P NN0  i^i 
Fin )  ->  x  =  (bits `  sum_ n  e.  x  ( 2 ^ n ) ) )
1918ad2antll 711 . . . . . . . 8  |-  ( (  T.  /\  ( k  e.  NN0  /\  x  e.  ( ~P NN0  i^i  Fin ) ) )  ->  x  =  (bits `  sum_ n  e.  x  ( 2 ^ n ) ) )
20 fveq2 5757 . . . . . . . . 9  |-  ( k  =  sum_ n  e.  x  ( 2 ^ n
)  ->  (bits `  k
)  =  (bits `  sum_ n  e.  x  ( 2 ^ n ) ) )
2120eqeq2d 2453 . . . . . . . 8  |-  ( k  =  sum_ n  e.  x  ( 2 ^ n
)  ->  ( x  =  (bits `  k )  <->  x  =  (bits `  sum_ n  e.  x  ( 2 ^ n ) ) ) )
2219, 21syl5ibrcom 215 . . . . . . 7  |-  ( (  T.  /\  ( k  e.  NN0  /\  x  e.  ( ~P NN0  i^i  Fin ) ) )  -> 
( k  =  sum_ n  e.  x  ( 2 ^ n )  ->  x  =  (bits `  k
) ) )
23 bitsinv1 12985 . . . . . . . . . 10  |-  ( k  e.  NN0  ->  sum_ n  e.  (bits `  k )
( 2 ^ n
)  =  k )
2423eqcomd 2447 . . . . . . . . 9  |-  ( k  e.  NN0  ->  k  = 
sum_ n  e.  (bits `  k ) ( 2 ^ n ) )
2524ad2antrl 710 . . . . . . . 8  |-  ( (  T.  /\  ( k  e.  NN0  /\  x  e.  ( ~P NN0  i^i  Fin ) ) )  -> 
k  =  sum_ n  e.  (bits `  k )
( 2 ^ n
) )
26 sumeq1 12514 . . . . . . . . 9  |-  ( x  =  (bits `  k
)  ->  sum_ n  e.  x  ( 2 ^ n )  =  sum_ n  e.  (bits `  k
) ( 2 ^ n ) )
2726eqeq2d 2453 . . . . . . . 8  |-  ( x  =  (bits `  k
)  ->  ( k  =  sum_ n  e.  x  ( 2 ^ n
)  <->  k  =  sum_ n  e.  (bits `  k
) ( 2 ^ n ) ) )
2825, 27syl5ibrcom 215 . . . . . . 7  |-  ( (  T.  /\  ( k  e.  NN0  /\  x  e.  ( ~P NN0  i^i  Fin ) ) )  -> 
( x  =  (bits `  k )  ->  k  =  sum_ n  e.  x  ( 2 ^ n
) ) )
2922, 28impbid 185 . . . . . 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 6324 . . . . 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 447 . . . 4  |-  (  T. 
->  ( k  e.  NN0  |->  (bits `  k ) ) : NN0 -1-1-onto-> ( ~P NN0  i^i  Fin ) )
32 bitsf 12970 . . . . . . . . 9  |- bits : ZZ --> ~P NN0
3332a1i 11 . . . . . . . 8  |-  (  T. 
-> bits : ZZ --> ~P NN0 )
3433feqmptd 5808 . . . . . . 7  |-  (  T. 
-> bits  =  ( k  e.  ZZ  |->  (bits `  k
) ) )
3534reseq1d 5174 . . . . . 6  |-  (  T. 
->  (bits  |`  NN0 )  =  ( ( k  e.  ZZ  |->  (bits `  k
) )  |`  NN0 )
)
36 nn0ssz 10333 . . . . . . 7  |-  NN0  C_  ZZ
37 resmpt 5220 . . . . . . 7  |-  ( NN0  C_  ZZ  ->  ( (
k  e.  ZZ  |->  (bits `  k ) )  |`  NN0 )  =  (
k  e.  NN0  |->  (bits `  k ) ) )
3836, 37ax-mp 5 . . . . . 6  |-  ( ( k  e.  ZZ  |->  (bits `  k ) )  |`  NN0 )  =  (
k  e.  NN0  |->  (bits `  k ) )
3935, 38syl6eq 2490 . . . . 5  |-  (  T. 
->  (bits  |`  NN0 )  =  ( k  e.  NN0  |->  (bits `  k ) ) )
40 f1oeq1 5694 . . . . 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 16 . . . 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 225 . . 3  |-  (  T. 
->  (bits  |`  NN0 ) : NN0
-1-1-onto-> ( ~P NN0  i^i  Fin ) )
4339cnveqd 5077 . . . 4  |-  (  T. 
->  `' (bits  |`  NN0 )  =  `' ( k  e. 
NN0  |->  (bits `  k
) ) )
4430simprd 451 . . . 4  |-  (  T. 
->  `' ( k  e. 
NN0  |->  (bits `  k
) )  =  ( x  e.  ( ~P
NN0  i^i  Fin )  |-> 
sum_ n  e.  x  ( 2 ^ n
) ) )
4543, 44eqtrd 2474 . . 3  |-  (  T. 
->  `' (bits  |`  NN0 )  =  ( x  e.  ( ~P NN0  i^i  Fin )  |->  sum_ n  e.  x  ( 2 ^ n
) ) )
4642, 45jca 520 . 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 1333 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 178    /\ wa 360    T. wtru 1326    = wceq 1653    e. wcel 1727    i^i cin 3305    C_ wss 3306   ~Pcpw 3823    e. cmpt 4291   `'ccnv 4906    |` cres 4909   -->wf 5479   -1-1-onto->wf1o 5482   ` cfv 5483  (class class class)co 6110   Fincfn 7138   2c2 10080   NN0cn0 10252   ZZcz 10313   ^cexp 11413   sum_csu 12510  bitscbits 12962
This theorem is referenced by:  bitsf1o  12988  bitsinv  12991
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-3 8  ax-gen 1556  ax-5 1567  ax-17 1627  ax-9 1668  ax-8 1689  ax-13 1729  ax-14 1731  ax-6 1746  ax-7 1751  ax-11 1763  ax-12 1953  ax-ext 2423  ax-rep 4345  ax-sep 4355  ax-nul 4363  ax-pow 4406  ax-pr 4432  ax-un 4730  ax-inf2 7625  ax-cnex 9077  ax-resscn 9078  ax-1cn 9079  ax-icn 9080  ax-addcl 9081  ax-addrcl 9082  ax-mulcl 9083  ax-mulrcl 9084  ax-mulcom 9085  ax-addass 9086  ax-mulass 9087  ax-distr 9088  ax-i2m1 9089  ax-1ne0 9090  ax-1rid 9091  ax-rnegex 9092  ax-rrecex 9093  ax-cnre 9094  ax-pre-lttri 9095  ax-pre-lttrn 9096  ax-pre-ltadd 9097  ax-pre-mulgt0 9098  ax-pre-sup 9099
This theorem depends on definitions:  df-bi 179  df-or 361  df-an 362  df-3or 938  df-3an 939  df-tru 1329  df-ex 1552  df-nf 1555  df-sb 1660  df-eu 2291  df-mo 2292  df-clab 2429  df-cleq 2435  df-clel 2438  df-nfc 2567  df-ne 2607  df-nel 2608  df-ral 2716  df-rex 2717  df-reu 2718  df-rmo 2719  df-rab 2720  df-v 2964  df-sbc 3168  df-csb 3268  df-dif 3309  df-un 3311  df-in 3313  df-ss 3320  df-pss 3322  df-nul 3614  df-if 3764  df-pw 3825  df-sn 3844  df-pr 3845  df-tp 3846  df-op 3847  df-uni 4040  df-int 4075  df-iun 4119  df-disj 4208  df-br 4238  df-opab 4292  df-mpt 4293  df-tr 4328  df-eprel 4523  df-id 4527  df-po 4532  df-so 4533  df-fr 4570  df-se 4571  df-we 4572  df-ord 4613  df-on 4614  df-lim 4615  df-suc 4616  df-om 4875  df-xp 4913  df-rel 4914  df-cnv 4915  df-co 4916  df-dm 4917  df-rn 4918  df-res 4919  df-ima 4920  df-iota 5447  df-fun 5485  df-fn 5486  df-f 5487  df-f1 5488  df-fo 5489  df-f1o 5490  df-fv 5491  df-isom 5492  df-ov 6113  df-oprab 6114  df-mpt2 6115  df-1st 6378  df-2nd 6379  df-riota 6578  df-recs 6662  df-rdg 6697  df-1o 6753  df-2o 6754  df-oadd 6757  df-er 6934  df-map 7049  df-pm 7050  df-en 7139  df-dom 7140  df-sdom 7141  df-fin 7142  df-sup 7475  df-oi 7508  df-card 7857  df-cda 8079  df-pnf 9153  df-mnf 9154  df-xr 9155  df-ltxr 9156  df-le 9157  df-sub 9324  df-neg 9325  df-div 9709  df-nn 10032  df-2 10089  df-3 10090  df-n0 10253  df-z 10314  df-uz 10520  df-rp 10644  df-fz 11075  df-fzo 11167  df-fl 11233  df-mod 11282  df-seq 11355  df-exp 11414  df-hash 11650  df-cj 11935  df-re 11936  df-im 11937  df-sqr 12071  df-abs 12072  df-clim 12313  df-sum 12511  df-dvds 12884  df-bits 12965
  Copyright terms: Public domain W3C validator