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

Theorem bitsinvp1 12656
Description: Recursive definition of the inverse of the bits function. (Contributed by Mario Carneiro, 8-Sep-2016.)
Hypothesis
Ref Expression
bitsinv.k  |-  K  =  `' (bits  |`  NN0 )
Assertion
Ref Expression
bitsinvp1  |-  ( ( A  C_  NN0  /\  N  e.  NN0 )  ->  ( K `  ( A  i^i  ( 0..^ ( N  +  1 ) ) ) )  =  ( ( K `  ( A  i^i  ( 0..^ N ) ) )  +  if ( N  e.  A ,  ( 2 ^ N ) ,  0 ) ) )

Proof of Theorem bitsinvp1
Dummy variable  k is distinct from all other variables.
StepHypRef Expression
1 fzonel 10903 . . . . . . 7  |-  -.  N  e.  ( 0..^ N )
21a1i 10 . . . . . 6  |-  ( ( A  C_  NN0  /\  N  e.  NN0 )  ->  -.  N  e.  ( 0..^ N ) )
3 disjsn 3706 . . . . . 6  |-  ( ( ( 0..^ N )  i^i  { N }
)  =  (/)  <->  -.  N  e.  ( 0..^ N ) )
42, 3sylibr 203 . . . . 5  |-  ( ( A  C_  NN0  /\  N  e.  NN0 )  ->  (
( 0..^ N )  i^i  { N }
)  =  (/) )
54ineq2d 3383 . . . 4  |-  ( ( A  C_  NN0  /\  N  e.  NN0 )  ->  ( A  i^i  ( ( 0..^ N )  i^i  { N } ) )  =  ( A  i^i  (/) ) )
6 inindi 3399 . . . 4  |-  ( A  i^i  ( ( 0..^ N )  i^i  { N } ) )  =  ( ( A  i^i  ( 0..^ N ) )  i^i  ( A  i^i  { N } ) )
7 in0 3493 . . . 4  |-  ( A  i^i  (/) )  =  (/)
85, 6, 73eqtr3g 2351 . . 3  |-  ( ( A  C_  NN0  /\  N  e.  NN0 )  ->  (
( A  i^i  (
0..^ N ) )  i^i  ( A  i^i  { N } ) )  =  (/) )
9 simpr 447 . . . . . . 7  |-  ( ( A  C_  NN0  /\  N  e.  NN0 )  ->  N  e.  NN0 )
10 nn0uz 10278 . . . . . . 7  |-  NN0  =  ( ZZ>= `  0 )
119, 10syl6eleq 2386 . . . . . 6  |-  ( ( A  C_  NN0  /\  N  e.  NN0 )  ->  N  e.  ( ZZ>= `  0 )
)
12 fzosplitsn 10936 . . . . . 6  |-  ( N  e.  ( ZZ>= `  0
)  ->  ( 0..^ ( N  +  1 ) )  =  ( ( 0..^ N )  u.  { N }
) )
1311, 12syl 15 . . . . 5  |-  ( ( A  C_  NN0  /\  N  e.  NN0 )  ->  (
0..^ ( N  + 
1 ) )  =  ( ( 0..^ N )  u.  { N } ) )
1413ineq2d 3383 . . . 4  |-  ( ( A  C_  NN0  /\  N  e.  NN0 )  ->  ( A  i^i  ( 0..^ ( N  +  1 ) ) )  =  ( A  i^i  ( ( 0..^ N )  u. 
{ N } ) ) )
15 indi 3428 . . . 4  |-  ( A  i^i  ( ( 0..^ N )  u.  { N } ) )  =  ( ( A  i^i  ( 0..^ N ) )  u.  ( A  i^i  { N } ) )
1614, 15syl6eq 2344 . . 3  |-  ( ( A  C_  NN0  /\  N  e.  NN0 )  ->  ( A  i^i  ( 0..^ ( N  +  1 ) ) )  =  ( ( A  i^i  (
0..^ N ) )  u.  ( A  i^i  { N } ) ) )
17 fzofi 11052 . . . . 5  |-  ( 0..^ ( N  +  1 ) )  e.  Fin
1817a1i 10 . . . 4  |-  ( ( A  C_  NN0  /\  N  e.  NN0 )  ->  (
0..^ ( N  + 
1 ) )  e. 
Fin )
19 inss2 3403 . . . 4  |-  ( A  i^i  ( 0..^ ( N  +  1 ) ) )  C_  (
0..^ ( N  + 
1 ) )
20 ssfi 7099 . . . 4  |-  ( ( ( 0..^ ( N  +  1 ) )  e.  Fin  /\  ( A  i^i  ( 0..^ ( N  +  1 ) ) )  C_  (
0..^ ( N  + 
1 ) ) )  ->  ( A  i^i  ( 0..^ ( N  + 
1 ) ) )  e.  Fin )
2118, 19, 20sylancl 643 . . 3  |-  ( ( A  C_  NN0  /\  N  e.  NN0 )  ->  ( A  i^i  ( 0..^ ( N  +  1 ) ) )  e.  Fin )
22 2nn 9893 . . . . . 6  |-  2  e.  NN
2322a1i 10 . . . . 5  |-  ( ( ( A  C_  NN0  /\  N  e.  NN0 )  /\  k  e.  ( A  i^i  ( 0..^ ( N  +  1 ) ) ) )  ->  2  e.  NN )
24 inss1 3402 . . . . . . 7  |-  ( A  i^i  ( 0..^ ( N  +  1 ) ) )  C_  A
25 simpl 443 . . . . . . 7  |-  ( ( A  C_  NN0  /\  N  e.  NN0 )  ->  A  C_ 
NN0 )
2624, 25syl5ss 3203 . . . . . 6  |-  ( ( A  C_  NN0  /\  N  e.  NN0 )  ->  ( A  i^i  ( 0..^ ( N  +  1 ) ) )  C_  NN0 )
2726sselda 3193 . . . . 5  |-  ( ( ( A  C_  NN0  /\  N  e.  NN0 )  /\  k  e.  ( A  i^i  ( 0..^ ( N  +  1 ) ) ) )  ->  k  e.  NN0 )
2823, 27nnexpcld 11282 . . . 4  |-  ( ( ( A  C_  NN0  /\  N  e.  NN0 )  /\  k  e.  ( A  i^i  ( 0..^ ( N  +  1 ) ) ) )  ->  (
2 ^ k )  e.  NN )
2928nncnd 9778 . . 3  |-  ( ( ( A  C_  NN0  /\  N  e.  NN0 )  /\  k  e.  ( A  i^i  ( 0..^ ( N  +  1 ) ) ) )  ->  (
2 ^ k )  e.  CC )
308, 16, 21, 29fsumsplit 12228 . 2  |-  ( ( A  C_  NN0  /\  N  e.  NN0 )  ->  sum_ k  e.  ( A  i^i  (
0..^ ( N  + 
1 ) ) ) ( 2 ^ k
)  =  ( sum_ k  e.  ( A  i^i  ( 0..^ N ) ) ( 2 ^ k )  +  sum_ k  e.  ( A  i^i  { N } ) ( 2 ^ k
) ) )
31 elfpw 7173 . . . 4  |-  ( ( A  i^i  ( 0..^ ( N  +  1 ) ) )  e.  ( ~P NN0  i^i  Fin )  <->  ( ( A  i^i  ( 0..^ ( N  +  1 ) ) )  C_  NN0  /\  ( A  i^i  (
0..^ ( N  + 
1 ) ) )  e.  Fin ) )
3226, 21, 31sylanbrc 645 . . 3  |-  ( ( A  C_  NN0  /\  N  e.  NN0 )  ->  ( A  i^i  ( 0..^ ( N  +  1 ) ) )  e.  ( ~P NN0  i^i  Fin ) )
33 bitsinv.k . . . 4  |-  K  =  `' (bits  |`  NN0 )
3433bitsinv 12655 . . 3  |-  ( ( A  i^i  ( 0..^ ( N  +  1 ) ) )  e.  ( ~P NN0  i^i  Fin )  ->  ( K `  ( A  i^i  (
0..^ ( N  + 
1 ) ) ) )  =  sum_ k  e.  ( A  i^i  (
0..^ ( N  + 
1 ) ) ) ( 2 ^ k
) )
3532, 34syl 15 . 2  |-  ( ( A  C_  NN0  /\  N  e.  NN0 )  ->  ( K `  ( A  i^i  ( 0..^ ( N  +  1 ) ) ) )  =  sum_ k  e.  ( A  i^i  ( 0..^ ( N  +  1 ) ) ) ( 2 ^ k ) )
36 inss1 3402 . . . . . 6  |-  ( A  i^i  ( 0..^ N ) )  C_  A
3736, 25syl5ss 3203 . . . . 5  |-  ( ( A  C_  NN0  /\  N  e.  NN0 )  ->  ( A  i^i  ( 0..^ N ) )  C_  NN0 )
38 fzofi 11052 . . . . . . 7  |-  ( 0..^ N )  e.  Fin
3938a1i 10 . . . . . 6  |-  ( ( A  C_  NN0  /\  N  e.  NN0 )  ->  (
0..^ N )  e. 
Fin )
40 inss2 3403 . . . . . 6  |-  ( A  i^i  ( 0..^ N ) )  C_  (
0..^ N )
41 ssfi 7099 . . . . . 6  |-  ( ( ( 0..^ N )  e.  Fin  /\  ( A  i^i  ( 0..^ N ) )  C_  (
0..^ N ) )  ->  ( A  i^i  ( 0..^ N ) )  e.  Fin )
4239, 40, 41sylancl 643 . . . . 5  |-  ( ( A  C_  NN0  /\  N  e.  NN0 )  ->  ( A  i^i  ( 0..^ N ) )  e.  Fin )
43 elfpw 7173 . . . . 5  |-  ( ( A  i^i  ( 0..^ N ) )  e.  ( ~P NN0  i^i  Fin )  <->  ( ( A  i^i  ( 0..^ N ) )  C_  NN0  /\  ( A  i^i  (
0..^ N ) )  e.  Fin ) )
4437, 42, 43sylanbrc 645 . . . 4  |-  ( ( A  C_  NN0  /\  N  e.  NN0 )  ->  ( A  i^i  ( 0..^ N ) )  e.  ( ~P NN0  i^i  Fin ) )
4533bitsinv 12655 . . . 4  |-  ( ( A  i^i  ( 0..^ N ) )  e.  ( ~P NN0  i^i  Fin )  ->  ( K `  ( A  i^i  (
0..^ N ) ) )  =  sum_ k  e.  ( A  i^i  (
0..^ N ) ) ( 2 ^ k
) )
4644, 45syl 15 . . 3  |-  ( ( A  C_  NN0  /\  N  e.  NN0 )  ->  ( K `  ( A  i^i  ( 0..^ N ) ) )  =  sum_ k  e.  ( A  i^i  ( 0..^ N ) ) ( 2 ^ k ) )
47 eqeq1 2302 . . . 4  |-  ( ( 2 ^ N )  =  if ( N  e.  A ,  ( 2 ^ N ) ,  0 )  -> 
( ( 2 ^ N )  =  sum_ k  e.  ( A  i^i  { N } ) ( 2 ^ k
)  <->  if ( N  e.  A ,  ( 2 ^ N ) ,  0 )  =  sum_ k  e.  ( A  i^i  { N } ) ( 2 ^ k
) ) )
48 eqeq1 2302 . . . 4  |-  ( 0  =  if ( N  e.  A ,  ( 2 ^ N ) ,  0 )  -> 
( 0  =  sum_ k  e.  ( A  i^i  { N } ) ( 2 ^ k
)  <->  if ( N  e.  A ,  ( 2 ^ N ) ,  0 )  =  sum_ k  e.  ( A  i^i  { N } ) ( 2 ^ k
) ) )
49 snssi 3775 . . . . . . . 8  |-  ( N  e.  A  ->  { N }  C_  A )
5049adantl 452 . . . . . . 7  |-  ( ( ( A  C_  NN0  /\  N  e.  NN0 )  /\  N  e.  A )  ->  { N }  C_  A )
51 dfss1 3386 . . . . . . 7  |-  ( { N }  C_  A  <->  ( A  i^i  { N } )  =  { N } )
5250, 51sylib 188 . . . . . 6  |-  ( ( ( A  C_  NN0  /\  N  e.  NN0 )  /\  N  e.  A )  ->  ( A  i^i  { N } )  =  { N } )
5352sumeq1d 12190 . . . . 5  |-  ( ( ( A  C_  NN0  /\  N  e.  NN0 )  /\  N  e.  A )  -> 
sum_ k  e.  ( A  i^i  { N } ) ( 2 ^ k )  = 
sum_ k  e.  { N }  ( 2 ^ k ) )
54 simpr 447 . . . . . 6  |-  ( ( ( A  C_  NN0  /\  N  e.  NN0 )  /\  N  e.  A )  ->  N  e.  A )
5522a1i 10 . . . . . . . 8  |-  ( ( ( A  C_  NN0  /\  N  e.  NN0 )  /\  N  e.  A )  ->  2  e.  NN )
56 simplr 731 . . . . . . . 8  |-  ( ( ( A  C_  NN0  /\  N  e.  NN0 )  /\  N  e.  A )  ->  N  e.  NN0 )
5755, 56nnexpcld 11282 . . . . . . 7  |-  ( ( ( A  C_  NN0  /\  N  e.  NN0 )  /\  N  e.  A )  ->  ( 2 ^ N
)  e.  NN )
5857nncnd 9778 . . . . . 6  |-  ( ( ( A  C_  NN0  /\  N  e.  NN0 )  /\  N  e.  A )  ->  ( 2 ^ N
)  e.  CC )
59 oveq2 5882 . . . . . . 7  |-  ( k  =  N  ->  (
2 ^ k )  =  ( 2 ^ N ) )
6059sumsn 12229 . . . . . 6  |-  ( ( N  e.  A  /\  ( 2 ^ N
)  e.  CC )  ->  sum_ k  e.  { N }  ( 2 ^ k )  =  ( 2 ^ N
) )
6154, 58, 60syl2anc 642 . . . . 5  |-  ( ( ( A  C_  NN0  /\  N  e.  NN0 )  /\  N  e.  A )  -> 
sum_ k  e.  { N }  ( 2 ^ k )  =  ( 2 ^ N
) )
6253, 61eqtr2d 2329 . . . 4  |-  ( ( ( A  C_  NN0  /\  N  e.  NN0 )  /\  N  e.  A )  ->  ( 2 ^ N
)  =  sum_ k  e.  ( A  i^i  { N } ) ( 2 ^ k ) )
63 simpr 447 . . . . . . 7  |-  ( ( ( A  C_  NN0  /\  N  e.  NN0 )  /\  -.  N  e.  A
)  ->  -.  N  e.  A )
64 disjsn 3706 . . . . . . 7  |-  ( ( A  i^i  { N } )  =  (/)  <->  -.  N  e.  A )
6563, 64sylibr 203 . . . . . 6  |-  ( ( ( A  C_  NN0  /\  N  e.  NN0 )  /\  -.  N  e.  A
)  ->  ( A  i^i  { N } )  =  (/) )
6665sumeq1d 12190 . . . . 5  |-  ( ( ( A  C_  NN0  /\  N  e.  NN0 )  /\  -.  N  e.  A
)  ->  sum_ k  e.  ( A  i^i  { N } ) ( 2 ^ k )  = 
sum_ k  e.  (/)  ( 2 ^ k
) )
67 sum0 12210 . . . . 5  |-  sum_ k  e.  (/)  ( 2 ^ k )  =  0
6866, 67syl6req 2345 . . . 4  |-  ( ( ( A  C_  NN0  /\  N  e.  NN0 )  /\  -.  N  e.  A
)  ->  0  =  sum_ k  e.  ( A  i^i  { N }
) ( 2 ^ k ) )
6947, 48, 62, 68ifbothda 3608 . . 3  |-  ( ( A  C_  NN0  /\  N  e.  NN0 )  ->  if ( N  e.  A ,  ( 2 ^ N ) ,  0 )  =  sum_ k  e.  ( A  i^i  { N } ) ( 2 ^ k ) )
7046, 69oveq12d 5892 . 2  |-  ( ( A  C_  NN0  /\  N  e.  NN0 )  ->  (
( K `  ( A  i^i  ( 0..^ N ) ) )  +  if ( N  e.  A ,  ( 2 ^ N ) ,  0 ) )  =  ( sum_ k  e.  ( A  i^i  ( 0..^ N ) ) ( 2 ^ k )  +  sum_ k  e.  ( A  i^i  { N } ) ( 2 ^ k ) ) )
7130, 35, 703eqtr4d 2338 1  |-  ( ( A  C_  NN0  /\  N  e.  NN0 )  ->  ( K `  ( A  i^i  ( 0..^ ( N  +  1 ) ) ) )  =  ( ( K `  ( A  i^i  ( 0..^ N ) ) )  +  if ( N  e.  A ,  ( 2 ^ N ) ,  0 ) ) )
Colors of variables: wff set class
Syntax hints:   -. wn 3    -> wi 4    /\ wa 358    = wceq 1632    e. wcel 1696    u. cun 3163    i^i cin 3164    C_ wss 3165   (/)c0 3468   ifcif 3578   ~Pcpw 3638   {csn 3653   `'ccnv 4704    |` cres 4707   ` cfv 5271  (class class class)co 5874   Fincfn 6879   CCcc 8751   0cc0 8753   1c1 8754    + caddc 8756   NNcn 9762   2c2 9811   NN0cn0 9981   ZZ>=cuz 10246  ..^cfzo 10886   ^cexp 11120   sum_csu 12174  bitscbits 12626
This theorem is referenced by:  sadcaddlem  12664  sadadd2lem  12666
This theorem was proved from axioms:  ax-1 5  ax-2 6  ax-3 7  ax-mp 8  ax-gen 1536  ax-5 1547  ax-17 1606  ax-9 1644  ax-8 1661  ax-13 1698  ax-14 1700  ax-6 1715  ax-7 1720  ax-11 1727  ax-12 1878  ax-ext 2277  ax-rep 4147  ax-sep 4157  ax-nul 4165  ax-pow 4204  ax-pr 4230  ax-un 4528  ax-inf2 7358  ax-cnex 8809  ax-resscn 8810  ax-1cn 8811  ax-icn 8812  ax-addcl 8813  ax-addrcl 8814  ax-mulcl 8815  ax-mulrcl 8816  ax-mulcom 8817  ax-addass 8818  ax-mulass 8819  ax-distr 8820  ax-i2m1 8821  ax-1ne0 8822  ax-1rid 8823  ax-rnegex 8824  ax-rrecex 8825  ax-cnre 8826  ax-pre-lttri 8827  ax-pre-lttrn 8828  ax-pre-ltadd 8829  ax-pre-mulgt0 8830  ax-pre-sup 8831
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 1532  df-nf 1535  df-sb 1639  df-eu 2160  df-mo 2161  df-clab 2283  df-cleq 2289  df-clel 2292  df-nfc 2421  df-ne 2461  df-nel 2462  df-ral 2561  df-rex 2562  df-reu 2563  df-rmo 2564  df-rab 2565  df-v 2803  df-sbc 3005  df-csb 3095  df-dif 3168  df-un 3170  df-in 3172  df-ss 3179  df-pss 3181  df-nul 3469  df-if 3579  df-pw 3640  df-sn 3659  df-pr 3660  df-tp 3661  df-op 3662  df-uni 3844  df-int 3879  df-iun 3923  df-disj 4010  df-br 4040  df-opab 4094  df-mpt 4095  df-tr 4130  df-eprel 4321  df-id 4325  df-po 4330  df-so 4331  df-fr 4368  df-se 4369  df-we 4370  df-ord 4411  df-on 4412  df-lim 4413  df-suc 4414  df-om 4673  df-xp 4711  df-rel 4712  df-cnv 4713  df-co 4714  df-dm 4715  df-rn 4716  df-res 4717  df-ima 4718  df-iota 5235  df-fun 5273  df-fn 5274  df-f 5275  df-f1 5276  df-fo 5277  df-f1o 5278  df-fv 5279  df-isom 5280  df-ov 5877  df-oprab 5878  df-mpt2 5879  df-1st 6138  df-2nd 6139  df-riota 6320  df-recs 6404  df-rdg 6439  df-1o 6495  df-2o 6496  df-oadd 6499  df-er 6676  df-map 6790  df-pm 6791  df-en 6880  df-dom 6881  df-sdom 6882  df-fin 6883  df-sup 7210  df-oi 7241  df-card 7588  df-cda 7810  df-pnf 8885  df-mnf 8886  df-xr 8887  df-ltxr 8888  df-le 8889  df-sub 9055  df-neg 9056  df-div 9440  df-nn 9763  df-2 9820  df-3 9821  df-n0 9982  df-z 10041  df-uz 10247  df-rp 10371  df-fz 10799  df-fzo 10887  df-fl 10941  df-mod 10990  df-seq 11063  df-exp 11121  df-hash 11354  df-cj 11600  df-re 11601  df-im 11602  df-sqr 11736  df-abs 11737  df-clim 11978  df-sum 12175  df-dvds 12548  df-bits 12629
  Copyright terms: Public domain W3C validator