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

Theorem sadfval 15795
Description: Define the addition of two bit sequences, using df-had 1595 and df-cad 1609 bit operations. (Contributed by Mario Carneiro, 5-Sep-2016.)
Hypotheses
Ref Expression
sadval.a (𝜑𝐴 ⊆ ℕ0)
sadval.b (𝜑𝐵 ⊆ ℕ0)
sadval.c 𝐶 = seq0((𝑐 ∈ 2o, 𝑚 ∈ ℕ0 ↦ if(cadd(𝑚𝐴, 𝑚𝐵, ∅ ∈ 𝑐), 1o, ∅)), (𝑛 ∈ ℕ0 ↦ if(𝑛 = 0, ∅, (𝑛 − 1))))
Assertion
Ref Expression
sadfval (𝜑 → (𝐴 sadd 𝐵) = {𝑘 ∈ ℕ0 ∣ hadd(𝑘𝐴, 𝑘𝐵, ∅ ∈ (𝐶𝑘))})
Distinct variable groups:   𝑘,𝑐,𝑚,𝑛   𝐴,𝑐,𝑘,𝑚   𝐵,𝑐,𝑘,𝑚   𝐶,𝑘   𝜑,𝑘
Allowed substitution hints:   𝜑(𝑚,𝑛,𝑐)   𝐴(𝑛)   𝐵(𝑛)   𝐶(𝑚,𝑛,𝑐)

Proof of Theorem sadfval
Dummy variables 𝑥 𝑦 are mutually distinct and distinct from all other variables.
StepHypRef Expression
1 sadval.a . . 3 (𝜑𝐴 ⊆ ℕ0)
2 nn0ex 11895 . . . 4 0 ∈ V
32elpw2 5215 . . 3 (𝐴 ∈ 𝒫 ℕ0𝐴 ⊆ ℕ0)
41, 3sylibr 237 . 2 (𝜑𝐴 ∈ 𝒫 ℕ0)
5 sadval.b . . 3 (𝜑𝐵 ⊆ ℕ0)
62elpw2 5215 . . 3 (𝐵 ∈ 𝒫 ℕ0𝐵 ⊆ ℕ0)
75, 6sylibr 237 . 2 (𝜑𝐵 ∈ 𝒫 ℕ0)
8 simpl 486 . . . . . 6 ((𝑥 = 𝐴𝑦 = 𝐵) → 𝑥 = 𝐴)
98eleq2d 2878 . . . . 5 ((𝑥 = 𝐴𝑦 = 𝐵) → (𝑘𝑥𝑘𝐴))
10 simpr 488 . . . . . 6 ((𝑥 = 𝐴𝑦 = 𝐵) → 𝑦 = 𝐵)
1110eleq2d 2878 . . . . 5 ((𝑥 = 𝐴𝑦 = 𝐵) → (𝑘𝑦𝑘𝐵))
12 simp1l 1194 . . . . . . . . . . . . 13 (((𝑥 = 𝐴𝑦 = 𝐵) ∧ 𝑐 ∈ 2o𝑚 ∈ ℕ0) → 𝑥 = 𝐴)
1312eleq2d 2878 . . . . . . . . . . . 12 (((𝑥 = 𝐴𝑦 = 𝐵) ∧ 𝑐 ∈ 2o𝑚 ∈ ℕ0) → (𝑚𝑥𝑚𝐴))
14 simp1r 1195 . . . . . . . . . . . . 13 (((𝑥 = 𝐴𝑦 = 𝐵) ∧ 𝑐 ∈ 2o𝑚 ∈ ℕ0) → 𝑦 = 𝐵)
1514eleq2d 2878 . . . . . . . . . . . 12 (((𝑥 = 𝐴𝑦 = 𝐵) ∧ 𝑐 ∈ 2o𝑚 ∈ ℕ0) → (𝑚𝑦𝑚𝐵))
16 biidd 265 . . . . . . . . . . . 12 (((𝑥 = 𝐴𝑦 = 𝐵) ∧ 𝑐 ∈ 2o𝑚 ∈ ℕ0) → (∅ ∈ 𝑐 ↔ ∅ ∈ 𝑐))
1713, 15, 16cadbi123d 1612 . . . . . . . . . . 11 (((𝑥 = 𝐴𝑦 = 𝐵) ∧ 𝑐 ∈ 2o𝑚 ∈ ℕ0) → (cadd(𝑚𝑥, 𝑚𝑦, ∅ ∈ 𝑐) ↔ cadd(𝑚𝐴, 𝑚𝐵, ∅ ∈ 𝑐)))
1817ifbid 4450 . . . . . . . . . 10 (((𝑥 = 𝐴𝑦 = 𝐵) ∧ 𝑐 ∈ 2o𝑚 ∈ ℕ0) → if(cadd(𝑚𝑥, 𝑚𝑦, ∅ ∈ 𝑐), 1o, ∅) = if(cadd(𝑚𝐴, 𝑚𝐵, ∅ ∈ 𝑐), 1o, ∅))
1918mpoeq3dva 7214 . . . . . . . . 9 ((𝑥 = 𝐴𝑦 = 𝐵) → (𝑐 ∈ 2o, 𝑚 ∈ ℕ0 ↦ if(cadd(𝑚𝑥, 𝑚𝑦, ∅ ∈ 𝑐), 1o, ∅)) = (𝑐 ∈ 2o, 𝑚 ∈ ℕ0 ↦ if(cadd(𝑚𝐴, 𝑚𝐵, ∅ ∈ 𝑐), 1o, ∅)))
2019seqeq2d 13375 . . . . . . . 8 ((𝑥 = 𝐴𝑦 = 𝐵) → seq0((𝑐 ∈ 2o, 𝑚 ∈ ℕ0 ↦ if(cadd(𝑚𝑥, 𝑚𝑦, ∅ ∈ 𝑐), 1o, ∅)), (𝑛 ∈ ℕ0 ↦ if(𝑛 = 0, ∅, (𝑛 − 1)))) = seq0((𝑐 ∈ 2o, 𝑚 ∈ ℕ0 ↦ if(cadd(𝑚𝐴, 𝑚𝐵, ∅ ∈ 𝑐), 1o, ∅)), (𝑛 ∈ ℕ0 ↦ if(𝑛 = 0, ∅, (𝑛 − 1)))))
21 sadval.c . . . . . . . 8 𝐶 = seq0((𝑐 ∈ 2o, 𝑚 ∈ ℕ0 ↦ if(cadd(𝑚𝐴, 𝑚𝐵, ∅ ∈ 𝑐), 1o, ∅)), (𝑛 ∈ ℕ0 ↦ if(𝑛 = 0, ∅, (𝑛 − 1))))
2220, 21eqtr4di 2854 . . . . . . 7 ((𝑥 = 𝐴𝑦 = 𝐵) → seq0((𝑐 ∈ 2o, 𝑚 ∈ ℕ0 ↦ if(cadd(𝑚𝑥, 𝑚𝑦, ∅ ∈ 𝑐), 1o, ∅)), (𝑛 ∈ ℕ0 ↦ if(𝑛 = 0, ∅, (𝑛 − 1)))) = 𝐶)
2322fveq1d 6651 . . . . . 6 ((𝑥 = 𝐴𝑦 = 𝐵) → (seq0((𝑐 ∈ 2o, 𝑚 ∈ ℕ0 ↦ if(cadd(𝑚𝑥, 𝑚𝑦, ∅ ∈ 𝑐), 1o, ∅)), (𝑛 ∈ ℕ0 ↦ if(𝑛 = 0, ∅, (𝑛 − 1))))‘𝑘) = (𝐶𝑘))
2423eleq2d 2878 . . . . 5 ((𝑥 = 𝐴𝑦 = 𝐵) → (∅ ∈ (seq0((𝑐 ∈ 2o, 𝑚 ∈ ℕ0 ↦ if(cadd(𝑚𝑥, 𝑚𝑦, ∅ ∈ 𝑐), 1o, ∅)), (𝑛 ∈ ℕ0 ↦ if(𝑛 = 0, ∅, (𝑛 − 1))))‘𝑘) ↔ ∅ ∈ (𝐶𝑘)))
259, 11, 24hadbi123d 1596 . . . 4 ((𝑥 = 𝐴𝑦 = 𝐵) → (hadd(𝑘𝑥, 𝑘𝑦, ∅ ∈ (seq0((𝑐 ∈ 2o, 𝑚 ∈ ℕ0 ↦ if(cadd(𝑚𝑥, 𝑚𝑦, ∅ ∈ 𝑐), 1o, ∅)), (𝑛 ∈ ℕ0 ↦ if(𝑛 = 0, ∅, (𝑛 − 1))))‘𝑘)) ↔ hadd(𝑘𝐴, 𝑘𝐵, ∅ ∈ (𝐶𝑘))))
2625rabbidv 3430 . . 3 ((𝑥 = 𝐴𝑦 = 𝐵) → {𝑘 ∈ ℕ0 ∣ hadd(𝑘𝑥, 𝑘𝑦, ∅ ∈ (seq0((𝑐 ∈ 2o, 𝑚 ∈ ℕ0 ↦ if(cadd(𝑚𝑥, 𝑚𝑦, ∅ ∈ 𝑐), 1o, ∅)), (𝑛 ∈ ℕ0 ↦ if(𝑛 = 0, ∅, (𝑛 − 1))))‘𝑘))} = {𝑘 ∈ ℕ0 ∣ hadd(𝑘𝐴, 𝑘𝐵, ∅ ∈ (𝐶𝑘))})
27 df-sad 15794 . . 3 sadd = (𝑥 ∈ 𝒫 ℕ0, 𝑦 ∈ 𝒫 ℕ0 ↦ {𝑘 ∈ ℕ0 ∣ hadd(𝑘𝑥, 𝑘𝑦, ∅ ∈ (seq0((𝑐 ∈ 2o, 𝑚 ∈ ℕ0 ↦ if(cadd(𝑚𝑥, 𝑚𝑦, ∅ ∈ 𝑐), 1o, ∅)), (𝑛 ∈ ℕ0 ↦ if(𝑛 = 0, ∅, (𝑛 − 1))))‘𝑘))})
282rabex 5202 . . 3 {𝑘 ∈ ℕ0 ∣ hadd(𝑘𝐴, 𝑘𝐵, ∅ ∈ (𝐶𝑘))} ∈ V
2926, 27, 28ovmpoa 7288 . 2 ((𝐴 ∈ 𝒫 ℕ0𝐵 ∈ 𝒫 ℕ0) → (𝐴 sadd 𝐵) = {𝑘 ∈ ℕ0 ∣ hadd(𝑘𝐴, 𝑘𝐵, ∅ ∈ (𝐶𝑘))})
304, 7, 29syl2anc 587 1 (𝜑 → (𝐴 sadd 𝐵) = {𝑘 ∈ ℕ0 ∣ hadd(𝑘𝐴, 𝑘𝐵, ∅ ∈ (𝐶𝑘))})
Colors of variables: wff setvar class
Syntax hints:  wi 4  wa 399  w3a 1084   = wceq 1538  haddwhad 1594  caddwcad 1608  wcel 2112  {crab 3113  wss 3884  c0 4246  ifcif 4428  𝒫 cpw 4500  cmpt 5113  cfv 6328  (class class class)co 7139  cmpo 7141  1oc1o 8082  2oc2o 8083  0cc0 10530  1c1 10531  cmin 10863  0cn0 11889  seqcseq 13368   sadd csad 15763
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-3 8  ax-gen 1797  ax-4 1811  ax-5 1911  ax-6 1970  ax-7 2015  ax-8 2114  ax-9 2122  ax-10 2143  ax-11 2159  ax-12 2176  ax-ext 2773  ax-sep 5170  ax-nul 5177  ax-pow 5234  ax-pr 5298  ax-un 7445  ax-cnex 10586  ax-1cn 10588  ax-addcl 10590
This theorem depends on definitions:  df-bi 210  df-an 400  df-or 845  df-3or 1085  df-3an 1086  df-xor 1503  df-tru 1541  df-had 1595  df-cad 1609  df-ex 1782  df-nf 1786  df-sb 2070  df-mo 2601  df-eu 2632  df-clab 2780  df-cleq 2794  df-clel 2873  df-nfc 2941  df-ne 2991  df-ral 3114  df-rex 3115  df-reu 3116  df-rab 3118  df-v 3446  df-sbc 3724  df-csb 3832  df-dif 3887  df-un 3889  df-in 3891  df-ss 3901  df-pss 3903  df-nul 4247  df-if 4429  df-pw 4502  df-sn 4529  df-pr 4531  df-tp 4533  df-op 4535  df-uni 4804  df-iun 4886  df-br 5034  df-opab 5096  df-mpt 5114  df-tr 5140  df-id 5428  df-eprel 5433  df-po 5442  df-so 5443  df-fr 5482  df-we 5484  df-xp 5529  df-rel 5530  df-cnv 5531  df-co 5532  df-dm 5533  df-rn 5534  df-res 5535  df-ima 5536  df-pred 6120  df-ord 6166  df-on 6167  df-lim 6168  df-suc 6169  df-iota 6287  df-fun 6330  df-fn 6331  df-f 6332  df-f1 6333  df-fo 6334  df-f1o 6335  df-fv 6336  df-ov 7142  df-oprab 7143  df-mpo 7144  df-om 7565  df-wrecs 7934  df-recs 7995  df-rdg 8033  df-nn 11630  df-n0 11890  df-seq 13369  df-sad 15794
This theorem is referenced by:  sadval  15799  sadadd2lem  15802  sadadd3  15804  sadcl  15805  sadcom  15806
  Copyright terms: Public domain W3C validator