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

Theorem sadfval 13648
Description: Define the addition of two bit sequences, using df-had 1421 and df-cad 1422 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 10585 . . . 4  |-  NN0  e.  _V
32elpw2 4456 . . 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 4456 . . 3  |-  ( B  e.  ~P NN0  <->  B  C_  NN0 )
75, 6sylibr 212 . 2  |-  ( ph  ->  B  e.  ~P NN0 )
8 simpl 457 . . . . . 6  |-  ( ( x  =  A  /\  y  =  B )  ->  x  =  A )
98eleq2d 2510 . . . . 5  |-  ( ( x  =  A  /\  y  =  B )  ->  ( k  e.  x  <->  k  e.  A ) )
10 simpr 461 . . . . . 6  |-  ( ( x  =  A  /\  y  =  B )  ->  y  =  B )
1110eleq2d 2510 . . . . 5  |-  ( ( x  =  A  /\  y  =  B )  ->  ( k  e.  y  <-> 
k  e.  B ) )
12 simp1l 1012 . . . . . . . . . . . . 13  |-  ( ( ( x  =  A  /\  y  =  B )  /\  c  e.  2o  /\  m  e. 
NN0 )  ->  x  =  A )
1312eleq2d 2510 . . . . . . . . . . . 12  |-  ( ( ( x  =  A  /\  y  =  B )  /\  c  e.  2o  /\  m  e. 
NN0 )  ->  (
m  e.  x  <->  m  e.  A ) )
14 simp1r 1013 . . . . . . . . . . . . 13  |-  ( ( ( x  =  A  /\  y  =  B )  /\  c  e.  2o  /\  m  e. 
NN0 )  ->  y  =  B )
1514eleq2d 2510 . . . . . . . . . . . 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 1424 . . . . . . . . . . 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 3811 . . . . . . . . . 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 6150 . . . . . . . . 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 11813 . . . . . . . 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 2493 . . . . . . 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 5693 . . . . . 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 2510 . . . . 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 1423 . . . 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 2964 . . 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 13647 . . 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 4443 . . 3  |-  { k  e.  NN0  | hadd (
k  e.  A , 
k  e.  B ,  (/) 
e.  ( C `  k ) ) }  e.  _V
2926, 27, 28ovmpt2a 6221 . 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 661 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 965    = wceq 1369  haddwhad 1419  caddwcad 1420    e. wcel 1756   {crab 2719    C_ wss 3328   (/)c0 3637   ifcif 3791   ~Pcpw 3860    e. cmpt 4350   ` cfv 5418  (class class class)co 6091    e. cmpt2 6093   1oc1o 6913   2oc2o 6914   0cc0 9282   1c1 9283    - cmin 9595   NN0cn0 10579    seqcseq 11806   sadd csad 13616
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-3 8  ax-gen 1591  ax-4 1602  ax-5 1670  ax-6 1708  ax-7 1728  ax-8 1758  ax-9 1760  ax-10 1775  ax-11 1780  ax-12 1792  ax-13 1943  ax-ext 2423  ax-sep 4413  ax-nul 4421  ax-pow 4470  ax-pr 4531  ax-un 6372  ax-cnex 9338  ax-resscn 9339  ax-1cn 9340  ax-icn 9341  ax-addcl 9342  ax-addrcl 9343  ax-mulcl 9344  ax-mulrcl 9345  ax-i2m1 9350  ax-1ne0 9351  ax-rrecex 9354  ax-cnre 9355
This theorem depends on definitions:  df-bi 185  df-or 370  df-an 371  df-3or 966  df-3an 967  df-xor 1351  df-tru 1372  df-had 1421  df-cad 1422  df-ex 1587  df-nf 1590  df-sb 1701  df-eu 2257  df-mo 2258  df-clab 2430  df-cleq 2436  df-clel 2439  df-nfc 2568  df-ne 2608  df-ral 2720  df-rex 2721  df-reu 2722  df-rab 2724  df-v 2974  df-sbc 3187  df-csb 3289  df-dif 3331  df-un 3333  df-in 3335  df-ss 3342  df-pss 3344  df-nul 3638  df-if 3792  df-pw 3862  df-sn 3878  df-pr 3880  df-tp 3882  df-op 3884  df-uni 4092  df-iun 4173  df-br 4293  df-opab 4351  df-mpt 4352  df-tr 4386  df-eprel 4632  df-id 4636  df-po 4641  df-so 4642  df-fr 4679  df-we 4681  df-ord 4722  df-on 4723  df-lim 4724  df-suc 4725  df-xp 4846  df-rel 4847  df-cnv 4848  df-co 4849  df-dm 4850  df-rn 4851  df-res 4852  df-ima 4853  df-iota 5381  df-fun 5420  df-fn 5421  df-f 5422  df-f1 5423  df-fo 5424  df-f1o 5425  df-fv 5426  df-ov 6094  df-oprab 6095  df-mpt2 6096  df-om 6477  df-recs 6832  df-rdg 6866  df-nn 10323  df-n0 10580  df-seq 11807  df-sad 13647
This theorem is referenced by:  sadval  13652  sadadd2lem  13655  sadadd3  13657  sadcl  13658  sadcom  13659
  Copyright terms: Public domain W3C validator