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

Theorem sadfval 12966
Description: Define the addition of two bit sequences, using df-had 1390 and df-cad 1391 bit operations. (Contributed by Mario Carneiro, 5-Sep-2016.)
Hypotheses
Ref Expression
sadval.a  |-  ( ph  ->  A  C_  NN0 )
sadval.b  |-  ( ph  ->  B  C_  NN0 )
sadval.c  |-  C  =  seq  0 ( ( c  e.  2o ,  m  e.  NN0  |->  if (cadd ( m  e.  A ,  m  e.  B ,  (/)  e.  c ) ,  1o ,  (/) ) ) ,  ( n  e.  NN0  |->  if ( n  =  0 ,  (/) ,  ( n  - 
1 ) ) ) )
Assertion
Ref Expression
sadfval  |-  ( ph  ->  ( A sadd  B )  =  { k  e. 
NN0  | hadd ( k  e.  A ,  k  e.  B ,  (/)  e.  ( C `  k ) ) } )
Distinct variable groups:    k, c, m, n    A, c, k, m    B, c, k, m    C, k    ph, k
Allowed substitution hints:    ph( m, n, c)    A( n)    B( n)    C( m, n, c)

Proof of Theorem sadfval
Dummy variables  x  y are mutually distinct and distinct from all other variables.
StepHypRef Expression
1 sadval.a . . 3  |-  ( ph  ->  A  C_  NN0 )
2 nn0ex 10229 . . . 4  |-  NN0  e.  _V
32elpw2 4366 . . 3  |-  ( A  e.  ~P NN0  <->  A  C_  NN0 )
41, 3sylibr 205 . 2  |-  ( ph  ->  A  e.  ~P NN0 )
5 sadval.b . . 3  |-  ( ph  ->  B  C_  NN0 )
62elpw2 4366 . . 3  |-  ( B  e.  ~P NN0  <->  B  C_  NN0 )
75, 6sylibr 205 . 2  |-  ( ph  ->  B  e.  ~P NN0 )
8 simpl 445 . . . . . 6  |-  ( ( x  =  A  /\  y  =  B )  ->  x  =  A )
98eleq2d 2505 . . . . 5  |-  ( ( x  =  A  /\  y  =  B )  ->  ( k  e.  x  <->  k  e.  A ) )
10 simpr 449 . . . . . 6  |-  ( ( x  =  A  /\  y  =  B )  ->  y  =  B )
1110eleq2d 2505 . . . . 5  |-  ( ( x  =  A  /\  y  =  B )  ->  ( k  e.  y  <-> 
k  e.  B ) )
12 simp1l 982 . . . . . . . . . . . . 13  |-  ( ( ( x  =  A  /\  y  =  B )  /\  c  e.  2o  /\  m  e. 
NN0 )  ->  x  =  A )
1312eleq2d 2505 . . . . . . . . . . . 12  |-  ( ( ( x  =  A  /\  y  =  B )  /\  c  e.  2o  /\  m  e. 
NN0 )  ->  (
m  e.  x  <->  m  e.  A ) )
14 simp1r 983 . . . . . . . . . . . . 13  |-  ( ( ( x  =  A  /\  y  =  B )  /\  c  e.  2o  /\  m  e. 
NN0 )  ->  y  =  B )
1514eleq2d 2505 . . . . . . . . . . . 12  |-  ( ( ( x  =  A  /\  y  =  B )  /\  c  e.  2o  /\  m  e. 
NN0 )  ->  (
m  e.  y  <->  m  e.  B ) )
16 biidd 230 . . . . . . . . . . . 12  |-  ( ( ( x  =  A  /\  y  =  B )  /\  c  e.  2o  /\  m  e. 
NN0 )  ->  ( (/) 
e.  c  <->  (/)  e.  c ) )
1713, 15, 16cadbi123d 1393 . . . . . . . . . . 11  |-  ( ( ( x  =  A  /\  y  =  B )  /\  c  e.  2o  /\  m  e. 
NN0 )  ->  (cadd ( m  e.  x ,  m  e.  y ,  (/)  e.  c )  <-> cadd ( m  e.  A ,  m  e.  B ,  (/)  e.  c ) ) )
1817ifbid 3759 . . . . . . . . . 10  |-  ( ( ( x  =  A  /\  y  =  B )  /\  c  e.  2o  /\  m  e. 
NN0 )  ->  if (cadd ( m  e.  x ,  m  e.  y ,  (/)  e.  c ) ,  1o ,  (/) )  =  if (cadd ( m  e.  A ,  m  e.  B ,  (/)  e.  c ) ,  1o ,  (/) ) )
1918mpt2eq3dva 6140 . . . . . . . . 9  |-  ( ( x  =  A  /\  y  =  B )  ->  ( c  e.  2o ,  m  e.  NN0  |->  if (cadd ( m  e.  x ,  m  e.  y ,  (/)  e.  c ) ,  1o ,  (/) ) )  =  ( c  e.  2o ,  m  e.  NN0  |->  if (cadd ( m  e.  A ,  m  e.  B ,  (/)  e.  c ) ,  1o ,  (/) ) ) )
2019seqeq2d 11332 . . . . . . . 8  |-  ( ( x  =  A  /\  y  =  B )  ->  seq  0 ( ( c  e.  2o ,  m  e.  NN0  |->  if (cadd ( m  e.  x ,  m  e.  y ,  (/)  e.  c ) ,  1o ,  (/) ) ) ,  ( n  e.  NN0  |->  if ( n  =  0 ,  (/) ,  ( n  - 
1 ) ) ) )  =  seq  0
( ( c  e.  2o ,  m  e. 
NN0  |->  if (cadd ( m  e.  A ,  m  e.  B ,  (/) 
e.  c ) ,  1o ,  (/) ) ) ,  ( n  e. 
NN0  |->  if ( n  =  0 ,  (/) ,  ( n  -  1 ) ) ) ) )
21 sadval.c . . . . . . . 8  |-  C  =  seq  0 ( ( c  e.  2o ,  m  e.  NN0  |->  if (cadd ( m  e.  A ,  m  e.  B ,  (/)  e.  c ) ,  1o ,  (/) ) ) ,  ( n  e.  NN0  |->  if ( n  =  0 ,  (/) ,  ( n  - 
1 ) ) ) )
2220, 21syl6eqr 2488 . . . . . . 7  |-  ( ( x  =  A  /\  y  =  B )  ->  seq  0 ( ( c  e.  2o ,  m  e.  NN0  |->  if (cadd ( m  e.  x ,  m  e.  y ,  (/)  e.  c ) ,  1o ,  (/) ) ) ,  ( n  e.  NN0  |->  if ( n  =  0 ,  (/) ,  ( n  - 
1 ) ) ) )  =  C )
2322fveq1d 5732 . . . . . 6  |-  ( ( x  =  A  /\  y  =  B )  ->  (  seq  0 ( ( c  e.  2o ,  m  e.  NN0  |->  if (cadd ( m  e.  x ,  m  e.  y ,  (/)  e.  c ) ,  1o ,  (/) ) ) ,  ( n  e.  NN0  |->  if ( n  =  0 ,  (/) ,  ( n  - 
1 ) ) ) ) `  k )  =  ( C `  k ) )
2423eleq2d 2505 . . . . 5  |-  ( ( x  =  A  /\  y  =  B )  ->  ( (/)  e.  (  seq  0 ( ( c  e.  2o ,  m  e.  NN0  |->  if (cadd ( m  e.  x ,  m  e.  y ,  (/)  e.  c ) ,  1o ,  (/) ) ) ,  ( n  e. 
NN0  |->  if ( n  =  0 ,  (/) ,  ( n  -  1 ) ) ) ) `
 k )  <->  (/)  e.  ( C `  k ) ) )
259, 11, 24hadbi123d 1392 . . . 4  |-  ( ( x  =  A  /\  y  =  B )  ->  (hadd ( k  e.  x ,  k  e.  y ,  (/)  e.  (  seq  0 ( ( c  e.  2o ,  m  e.  NN0  |->  if (cadd ( m  e.  x ,  m  e.  y ,  (/)  e.  c ) ,  1o ,  (/) ) ) ,  ( n  e.  NN0  |->  if ( n  =  0 ,  (/) ,  ( n  - 
1 ) ) ) ) `  k ) )  <-> hadd ( k  e.  A ,  k  e.  B ,  (/)  e.  ( C `
 k ) ) ) )
2625rabbidv 2950 . . 3  |-  ( ( x  =  A  /\  y  =  B )  ->  { k  e.  NN0  | hadd ( k  e.  x ,  k  e.  y ,  (/)  e.  (  seq  0 ( ( c  e.  2o ,  m  e.  NN0  |->  if (cadd ( m  e.  x ,  m  e.  y ,  (/)  e.  c ) ,  1o ,  (/) ) ) ,  ( n  e. 
NN0  |->  if ( n  =  0 ,  (/) ,  ( n  -  1 ) ) ) ) `
 k ) ) }  =  { k  e.  NN0  | hadd (
k  e.  A , 
k  e.  B ,  (/) 
e.  ( C `  k ) ) } )
27 df-sad 12965 . . 3  |- sadd  =  ( x  e.  ~P NN0 ,  y  e.  ~P NN0  |->  { k  e.  NN0  | hadd ( k  e.  x ,  k  e.  y ,  (/)  e.  (  seq  0 ( ( c  e.  2o ,  m  e.  NN0  |->  if (cadd ( m  e.  x ,  m  e.  y ,  (/)  e.  c ) ,  1o ,  (/) ) ) ,  ( n  e. 
NN0  |->  if ( n  =  0 ,  (/) ,  ( n  -  1 ) ) ) ) `
 k ) ) } )
282rabex 4356 . . 3  |-  { k  e.  NN0  | hadd (
k  e.  A , 
k  e.  B ,  (/) 
e.  ( C `  k ) ) }  e.  _V
2926, 27, 28ovmpt2a 6206 . 2  |-  ( ( A  e.  ~P NN0  /\  B  e.  ~P NN0 )  ->  ( A sadd  B
)  =  { k  e.  NN0  | hadd (
k  e.  A , 
k  e.  B ,  (/) 
e.  ( C `  k ) ) } )
304, 7, 29syl2anc 644 1  |-  ( ph  ->  ( A sadd  B )  =  { k  e. 
NN0  | hadd ( k  e.  A ,  k  e.  B ,  (/)  e.  ( C `  k ) ) } )
Colors of variables: wff set class
Syntax hints:    -> wi 4    /\ wa 360    /\ w3a 937  haddwhad 1388  caddwcad 1389    = wceq 1653    e. wcel 1726   {crab 2711    C_ wss 3322   (/)c0 3630   ifcif 3741   ~Pcpw 3801    e. cmpt 4268   ` cfv 5456  (class class class)co 6083    e. cmpt2 6085   1oc1o 6719   2oc2o 6720   0cc0 8992   1c1 8993    - cmin 9293   NN0cn0 10223    seq cseq 11325   sadd csad 12934
This theorem is referenced by:  sadval  12970  sadadd2lem  12973  sadadd3  12975  sadcl  12976  sadcom  12977
This theorem was proved from axioms:  ax-1 5  ax-2 6  ax-3 7  ax-mp 8  ax-gen 1556  ax-5 1567  ax-17 1627  ax-9 1667  ax-8 1688  ax-13 1728  ax-14 1730  ax-6 1745  ax-7 1750  ax-11 1762  ax-12 1951  ax-ext 2419  ax-sep 4332  ax-nul 4340  ax-pow 4379  ax-pr 4405  ax-un 4703  ax-cnex 9048  ax-resscn 9049  ax-1cn 9050  ax-icn 9051  ax-addcl 9052  ax-addrcl 9053  ax-mulcl 9054  ax-mulrcl 9055  ax-i2m1 9060  ax-1ne0 9061  ax-rrecex 9064  ax-cnre 9065
This theorem depends on definitions:  df-bi 179  df-or 361  df-an 362  df-3or 938  df-3an 939  df-xor 1315  df-tru 1329  df-had 1390  df-cad 1391  df-ex 1552  df-nf 1555  df-sb 1660  df-eu 2287  df-mo 2288  df-clab 2425  df-cleq 2431  df-clel 2434  df-nfc 2563  df-ne 2603  df-ral 2712  df-rex 2713  df-reu 2714  df-rab 2716  df-v 2960  df-sbc 3164  df-csb 3254  df-dif 3325  df-un 3327  df-in 3329  df-ss 3336  df-pss 3338  df-nul 3631  df-if 3742  df-pw 3803  df-sn 3822  df-pr 3823  df-tp 3824  df-op 3825  df-uni 4018  df-iun 4097  df-br 4215  df-opab 4269  df-mpt 4270  df-tr 4305  df-eprel 4496  df-id 4500  df-po 4505  df-so 4506  df-fr 4543  df-we 4545  df-ord 4586  df-on 4587  df-lim 4588  df-suc 4589  df-om 4848  df-xp 4886  df-rel 4887  df-cnv 4888  df-co 4889  df-dm 4890  df-rn 4891  df-res 4892  df-ima 4893  df-iota 5420  df-fun 5458  df-fn 5459  df-f 5460  df-f1 5461  df-fo 5462  df-f1o 5463  df-fv 5464  df-ov 6086  df-oprab 6087  df-mpt2 6088  df-recs 6635  df-rdg 6670  df-nn 10003  df-n0 10224  df-seq 11326  df-sad 12965
  Copyright terms: Public domain W3C validator