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

Theorem bitsf1ocnv 12919
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 12570. (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 2412 . . . . . 6  |-  ( k  e.  NN0  |->  (bits `  k ) )  =  ( k  e.  NN0  |->  (bits `  k ) )
2 bitsss 12901 . . . . . . . . 9  |-  (bits `  k )  C_  NN0
32a1i 11 . . . . . . . 8  |-  ( k  e.  NN0  ->  (bits `  k )  C_  NN0 )
4 bitsfi 12912 . . . . . . . 8  |-  ( k  e.  NN0  ->  (bits `  k )  e.  Fin )
5 elfpw 7374 . . . . . . . 8  |-  ( (bits `  k )  e.  ( ~P NN0  i^i  Fin ) 
<->  ( (bits `  k
)  C_  NN0  /\  (bits `  k )  e.  Fin ) )
63, 4, 5sylanbrc 646 . . . . . . 7  |-  ( k  e.  NN0  ->  (bits `  k )  e.  ( ~P NN0  i^i  Fin ) )
76adantl 453 . . . . . 6  |-  ( (  T.  /\  k  e. 
NN0 )  ->  (bits `  k )  e.  ( ~P NN0  i^i  Fin ) )
8 elfpw 7374 . . . . . . . . 9  |-  ( x  e.  ( ~P NN0  i^i 
Fin )  <->  ( x  C_ 
NN0  /\  x  e.  Fin ) )
98simprbi 451 . . . . . . . 8  |-  ( x  e.  ( ~P NN0  i^i 
Fin )  ->  x  e.  Fin )
10 2nn0 10202 . . . . . . . . . 10  |-  2  e.  NN0
1110a1i 11 . . . . . . . . 9  |-  ( ( x  e.  ( ~P
NN0  i^i  Fin )  /\  n  e.  x
)  ->  2  e.  NN0 )
128simplbi 447 . . . . . . . . . 10  |-  ( x  e.  ( ~P NN0  i^i 
Fin )  ->  x  C_ 
NN0 )
1312sselda 3316 . . . . . . . . 9  |-  ( ( x  e.  ( ~P
NN0  i^i  Fin )  /\  n  e.  x
)  ->  n  e.  NN0 )
1411, 13nn0expcld 11508 . . . . . . . 8  |-  ( ( x  e.  ( ~P
NN0  i^i  Fin )  /\  n  e.  x
)  ->  ( 2 ^ n )  e. 
NN0 )
159, 14fsumnn0cl 12493 . . . . . . 7  |-  ( x  e.  ( ~P NN0  i^i 
Fin )  ->  sum_ n  e.  x  ( 2 ^ n )  e. 
NN0 )
1615adantl 453 . . . . . 6  |-  ( (  T.  /\  x  e.  ( ~P NN0  i^i  Fin ) )  ->  sum_ n  e.  x  ( 2 ^ n )  e. 
NN0 )
17 bitsinv2 12918 . . . . . . . . . 10  |-  ( x  e.  ( ~P NN0  i^i 
Fin )  ->  (bits ` 
sum_ n  e.  x  ( 2 ^ n
) )  =  x )
1817eqcomd 2417 . . . . . . . . 9  |-  ( x  e.  ( ~P NN0  i^i 
Fin )  ->  x  =  (bits `  sum_ n  e.  x  ( 2 ^ n ) ) )
1918ad2antll 710 . . . . . . . 8  |-  ( (  T.  /\  ( k  e.  NN0  /\  x  e.  ( ~P NN0  i^i  Fin ) ) )  ->  x  =  (bits `  sum_ n  e.  x  ( 2 ^ n ) ) )
20 fveq2 5695 . . . . . . . . 9  |-  ( k  =  sum_ n  e.  x  ( 2 ^ n
)  ->  (bits `  k
)  =  (bits `  sum_ n  e.  x  ( 2 ^ n ) ) )
2120eqeq2d 2423 . . . . . . . 8  |-  ( k  =  sum_ n  e.  x  ( 2 ^ n
)  ->  ( x  =  (bits `  k )  <->  x  =  (bits `  sum_ n  e.  x  ( 2 ^ n ) ) ) )
2219, 21syl5ibrcom 214 . . . . . . 7  |-  ( (  T.  /\  ( k  e.  NN0  /\  x  e.  ( ~P NN0  i^i  Fin ) ) )  -> 
( k  =  sum_ n  e.  x  ( 2 ^ n )  ->  x  =  (bits `  k
) ) )
23 bitsinv1 12917 . . . . . . . . . 10  |-  ( k  e.  NN0  ->  sum_ n  e.  (bits `  k )
( 2 ^ n
)  =  k )
2423eqcomd 2417 . . . . . . . . 9  |-  ( k  e.  NN0  ->  k  = 
sum_ n  e.  (bits `  k ) ( 2 ^ n ) )
2524ad2antrl 709 . . . . . . . 8  |-  ( (  T.  /\  ( k  e.  NN0  /\  x  e.  ( ~P NN0  i^i  Fin ) ) )  -> 
k  =  sum_ n  e.  (bits `  k )
( 2 ^ n
) )
26 sumeq1 12446 . . . . . . . . 9  |-  ( x  =  (bits `  k
)  ->  sum_ n  e.  x  ( 2 ^ n )  =  sum_ n  e.  (bits `  k
) ( 2 ^ n ) )
2726eqeq2d 2423 . . . . . . . 8  |-  ( x  =  (bits `  k
)  ->  ( k  =  sum_ n  e.  x  ( 2 ^ n
)  <->  k  =  sum_ n  e.  (bits `  k
) ( 2 ^ n ) ) )
2825, 27syl5ibrcom 214 . . . . . . 7  |-  ( (  T.  /\  ( k  e.  NN0  /\  x  e.  ( ~P NN0  i^i  Fin ) ) )  -> 
( x  =  (bits `  k )  ->  k  =  sum_ n  e.  x  ( 2 ^ n
) ) )
2922, 28impbid 184 . . . . . 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 6262 . . . . 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 446 . . . 4  |-  (  T. 
->  ( k  e.  NN0  |->  (bits `  k ) ) : NN0 -1-1-onto-> ( ~P NN0  i^i  Fin ) )
32 bitsf 12902 . . . . . . . . 9  |- bits : ZZ --> ~P NN0
3332a1i 11 . . . . . . . 8  |-  (  T. 
-> bits : ZZ --> ~P NN0 )
3433feqmptd 5746 . . . . . . 7  |-  (  T. 
-> bits  =  ( k  e.  ZZ  |->  (bits `  k
) ) )
3534reseq1d 5112 . . . . . 6  |-  (  T. 
->  (bits  |`  NN0 )  =  ( ( k  e.  ZZ  |->  (bits `  k
) )  |`  NN0 )
)
36 nn0ssz 10266 . . . . . . 7  |-  NN0  C_  ZZ
37 resmpt 5158 . . . . . . 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 2460 . . . . 5  |-  (  T. 
->  (bits  |`  NN0 )  =  ( k  e.  NN0  |->  (bits `  k ) ) )
40 f1oeq1 5632 . . . . 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 224 . . 3  |-  (  T. 
->  (bits  |`  NN0 ) : NN0
-1-1-onto-> ( ~P NN0  i^i  Fin ) )
4339cnveqd 5015 . . . 4  |-  (  T. 
->  `' (bits  |`  NN0 )  =  `' ( k  e. 
NN0  |->  (bits `  k
) ) )
4430simprd 450 . . . 4  |-  (  T. 
->  `' ( k  e. 
NN0  |->  (bits `  k
) )  =  ( x  e.  ( ~P
NN0  i^i  Fin )  |-> 
sum_ n  e.  x  ( 2 ^ n
) ) )
4543, 44eqtrd 2444 . . 3  |-  (  T. 
->  `' (bits  |`  NN0 )  =  ( x  e.  ( ~P NN0  i^i  Fin )  |->  sum_ n  e.  x  ( 2 ^ n
) ) )
4642, 45jca 519 . 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 1329 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 177    /\ wa 359    T. wtru 1322    = wceq 1649    e. wcel 1721    i^i cin 3287    C_ wss 3288   ~Pcpw 3767    e. cmpt 4234   `'ccnv 4844    |` cres 4847   -->wf 5417   -1-1-onto->wf1o 5420   ` cfv 5421  (class class class)co 6048   Fincfn 7076   2c2 10013   NN0cn0 10185   ZZcz 10246   ^cexp 11345   sum_csu 12442  bitscbits 12894
This theorem is referenced by:  bitsf1o  12920  bitsinv  12923
This theorem was proved from axioms:  ax-1 5  ax-2 6  ax-3 7  ax-mp 8  ax-gen 1552  ax-5 1563  ax-17 1623  ax-9 1662  ax-8 1683  ax-13 1723  ax-14 1725  ax-6 1740  ax-7 1745  ax-11 1757  ax-12 1946  ax-ext 2393  ax-rep 4288  ax-sep 4298  ax-nul 4306  ax-pow 4345  ax-pr 4371  ax-un 4668  ax-inf2 7560  ax-cnex 9010  ax-resscn 9011  ax-1cn 9012  ax-icn 9013  ax-addcl 9014  ax-addrcl 9015  ax-mulcl 9016  ax-mulrcl 9017  ax-mulcom 9018  ax-addass 9019  ax-mulass 9020  ax-distr 9021  ax-i2m1 9022  ax-1ne0 9023  ax-1rid 9024  ax-rnegex 9025  ax-rrecex 9026  ax-cnre 9027  ax-pre-lttri 9028  ax-pre-lttrn 9029  ax-pre-ltadd 9030  ax-pre-mulgt0 9031  ax-pre-sup 9032
This theorem depends on definitions:  df-bi 178  df-or 360  df-an 361  df-3or 937  df-3an 938  df-tru 1325  df-ex 1548  df-nf 1551  df-sb 1656  df-eu 2266  df-mo 2267  df-clab 2399  df-cleq 2405  df-clel 2408  df-nfc 2537  df-ne 2577  df-nel 2578  df-ral 2679  df-rex 2680  df-reu 2681  df-rmo 2682  df-rab 2683  df-v 2926  df-sbc 3130  df-csb 3220  df-dif 3291  df-un 3293  df-in 3295  df-ss 3302  df-pss 3304  df-nul 3597  df-if 3708  df-pw 3769  df-sn 3788  df-pr 3789  df-tp 3790  df-op 3791  df-uni 3984  df-int 4019  df-iun 4063  df-disj 4151  df-br 4181  df-opab 4235  df-mpt 4236  df-tr 4271  df-eprel 4462  df-id 4466  df-po 4471  df-so 4472  df-fr 4509  df-se 4510  df-we 4511  df-ord 4552  df-on 4553  df-lim 4554  df-suc 4555  df-om 4813  df-xp 4851  df-rel 4852  df-cnv 4853  df-co 4854  df-dm 4855  df-rn 4856  df-res 4857  df-ima 4858  df-iota 5385  df-fun 5423  df-fn 5424  df-f 5425  df-f1 5426  df-fo 5427  df-f1o 5428  df-fv 5429  df-isom 5430  df-ov 6051  df-oprab 6052  df-mpt2 6053  df-1st 6316  df-2nd 6317  df-riota 6516  df-recs 6600  df-rdg 6635  df-1o 6691  df-2o 6692  df-oadd 6695  df-er 6872  df-map 6987  df-pm 6988  df-en 7077  df-dom 7078  df-sdom 7079  df-fin 7080  df-sup 7412  df-oi 7443  df-card 7790  df-cda 8012  df-pnf 9086  df-mnf 9087  df-xr 9088  df-ltxr 9089  df-le 9090  df-sub 9257  df-neg 9258  df-div 9642  df-nn 9965  df-2 10022  df-3 10023  df-n0 10186  df-z 10247  df-uz 10453  df-rp 10577  df-fz 11008  df-fzo 11099  df-fl 11165  df-mod 11214  df-seq 11287  df-exp 11346  df-hash 11582  df-cj 11867  df-re 11868  df-im 11869  df-sqr 12003  df-abs 12004  df-clim 12245  df-sum 12443  df-dvds 12816  df-bits 12897
  Copyright terms: Public domain W3C validator