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

Theorem sadfval 13644
Description: Define the addition of two bit sequences, using df-had 1426 and df-cad 1427 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 10581 . . . 4  |-  NN0  e.  _V
32elpw2 4453 . . 3  |-  ( A  e.  ~P NN0  <->  A  C_  NN0 )
41, 3sylibr 212 . 2  |-  ( ph  ->  A  e.  ~P NN0 )
5 sadval.b . . 3  |-  ( ph  ->  B  C_  NN0 )
62elpw2 4453 . . 3  |-  ( B  e.  ~P NN0  <->  B  C_  NN0 )
75, 6sylibr 212 . 2  |-  ( ph  ->  B  e.  ~P NN0 )
8 simpl 454 . . . . . 6  |-  ( ( x  =  A  /\  y  =  B )  ->  x  =  A )
98eleq2d 2508 . . . . 5  |-  ( ( x  =  A  /\  y  =  B )  ->  ( k  e.  x  <->  k  e.  A ) )
10 simpr 458 . . . . . 6  |-  ( ( x  =  A  /\  y  =  B )  ->  y  =  B )
1110eleq2d 2508 . . . . 5  |-  ( ( x  =  A  /\  y  =  B )  ->  ( k  e.  y  <-> 
k  e.  B ) )
12 simp1l 1007 . . . . . . . . . . . . 13  |-  ( ( ( x  =  A  /\  y  =  B )  /\  c  e.  2o  /\  m  e. 
NN0 )  ->  x  =  A )
1312eleq2d 2508 . . . . . . . . . . . 12  |-  ( ( ( x  =  A  /\  y  =  B )  /\  c  e.  2o  /\  m  e. 
NN0 )  ->  (
m  e.  x  <->  m  e.  A ) )
14 simp1r 1008 . . . . . . . . . . . . 13  |-  ( ( ( x  =  A  /\  y  =  B )  /\  c  e.  2o  /\  m  e. 
NN0 )  ->  y  =  B )
1514eleq2d 2508 . . . . . . . . . . . 12  |-  ( ( ( x  =  A  /\  y  =  B )  /\  c  e.  2o  /\  m  e. 
NN0 )  ->  (
m  e.  y  <->  m  e.  B ) )
16 biidd 237 . . . . . . . . . . . 12  |-  ( ( ( x  =  A  /\  y  =  B )  /\  c  e.  2o  /\  m  e. 
NN0 )  ->  ( (/) 
e.  c  <->  (/)  e.  c ) )
1713, 15, 16cadbi123d 1429 . . . . . . . . . . 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 3808 . . . . . . . . . 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 6149 . . . . . . . . 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 11809 . . . . . . . 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 2491 . . . . . . 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 5690 . . . . . 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 2508 . . . . 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 1428 . . . 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 2962 . . 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 13643 . . 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 4440 . . 3  |-  { k  e.  NN0  | hadd (
k  e.  A , 
k  e.  B ,  (/) 
e.  ( C `  k ) ) }  e.  _V
2926, 27, 28ovmpt2a 6220 . 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 656 1  |-  ( ph  ->  ( A sadd  B )  =  { k  e. 
NN0  | hadd ( k  e.  A ,  k  e.  B ,  (/)  e.  ( C `  k ) ) } )
Colors of variables: wff setvar class
Syntax hints:    -> wi 4    /\ wa 369    /\ w3a 960    = wceq 1364  haddwhad 1424  caddwcad 1425    e. wcel 1761   {crab 2717    C_ wss 3325   (/)c0 3634   ifcif 3788   ~Pcpw 3857    e. cmpt 4347   ` cfv 5415  (class class class)co 6090    e. cmpt2 6092   1oc1o 6909   2oc2o 6910   0cc0 9278   1c1 9279    - cmin 9591   NN0cn0 10575    seqcseq 11802   sadd csad 13612
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-3 8  ax-gen 1596  ax-4 1607  ax-5 1675  ax-6 1713  ax-7 1733  ax-8 1763  ax-9 1765  ax-10 1780  ax-11 1785  ax-12 1797  ax-13 1948  ax-ext 2422  ax-sep 4410  ax-nul 4418  ax-pow 4467  ax-pr 4528  ax-un 6371  ax-cnex 9334  ax-resscn 9335  ax-1cn 9336  ax-icn 9337  ax-addcl 9338  ax-addrcl 9339  ax-mulcl 9340  ax-mulrcl 9341  ax-i2m1 9346  ax-1ne0 9347  ax-rrecex 9350  ax-cnre 9351
This theorem depends on definitions:  df-bi 185  df-or 370  df-an 371  df-3or 961  df-3an 962  df-xor 1346  df-tru 1367  df-had 1426  df-cad 1427  df-ex 1592  df-nf 1595  df-sb 1706  df-eu 2261  df-mo 2262  df-clab 2428  df-cleq 2434  df-clel 2437  df-nfc 2566  df-ne 2606  df-ral 2718  df-rex 2719  df-reu 2720  df-rab 2722  df-v 2972  df-sbc 3184  df-csb 3286  df-dif 3328  df-un 3330  df-in 3332  df-ss 3339  df-pss 3341  df-nul 3635  df-if 3789  df-pw 3859  df-sn 3875  df-pr 3877  df-tp 3879  df-op 3881  df-uni 4089  df-iun 4170  df-br 4290  df-opab 4348  df-mpt 4349  df-tr 4383  df-eprel 4628  df-id 4632  df-po 4637  df-so 4638  df-fr 4675  df-we 4677  df-ord 4718  df-on 4719  df-lim 4720  df-suc 4721  df-xp 4842  df-rel 4843  df-cnv 4844  df-co 4845  df-dm 4846  df-rn 4847  df-res 4848  df-ima 4849  df-iota 5378  df-fun 5417  df-fn 5418  df-f 5419  df-f1 5420  df-fo 5421  df-f1o 5422  df-fv 5423  df-ov 6093  df-oprab 6094  df-mpt2 6095  df-om 6476  df-recs 6828  df-rdg 6862  df-nn 10319  df-n0 10576  df-seq 11803  df-sad 13643
This theorem is referenced by:  sadval  13648  sadadd2lem  13651  sadadd3  13653  sadcl  13654  sadcom  13655
  Copyright terms: Public domain W3C validator