PROOF.un.add_v: def of bend-osdev-u32@0.1.0.0 Import: import bend-osdev-u32@0.1.0.0/PROOF.bend as PROOF Lines 550-576 of bend-osdev-u32@0.1.0.0/PROOF.bend: https://jend.leeeet.dev/read.txt?path=bend-osdev-u32@0.1.0.0/PROOF.bend&start_line=550&end_line=576 import Base import bend-osdev-u32@0.1.0.0/u32.bend as U # adc(a, b, False, c) + 2^n * carry out = c + a + b def un.add_v(n: Nat, a: Word(n), b: Word(n), c: Bool) -> {Nat.add(Word.to_nat(n, Word.adc(n, a, b, False{}, c)), U.U32Nat.dbl(n, U.U32Nat.bit(un.co(n, a, b, c)))) == Nat.add(U.U32Nat.bit(c), Nat.add(Word.to_nat(n, a), Word.to_nat(n, b))) : Nat}: match n: case 0n: match a b c: case WNil{} WNil{} False{}: {==} case WNil{} WNil{} True{}: {==} case 1n+ +p: match a b c: case WCon{False{}, +at} WCon{False{}, +bt} False{}: un.cell(False{}, False{}, False{}, Word.to_nat(p, Word.adc(p, at, bt, False{}, False{})), U.U32Nat.dbl(p, U.U32Nat.bit(un.co(p, at, bt, False{}))), Word.to_nat(p, at), Word.to_nat(p, bt), un.add_v(p, at, bt, False{})) case WCon{True{}, +at} WCon{False{}, +bt} False{}: un.cell(True{}, False{}, False{}, Word.to_nat(p, Word.adc(p, at, bt, False{}, False{})), U.U32Nat.dbl(p, U.U32Nat.bit(un.co(p, at, bt, False{}))), Word.to_nat(p, at), Word.to_nat(p, bt), un.add_v(p, at, bt, False{})) case WCon{False{}, +at} WCon{True{}, +bt} False{}: un.cell(False{}, True{}, False{}, Word.to_nat(p, Word.adc(p, at, bt, False{}, False{})), U.U32Nat.dbl(p, U.U32Nat.bit(un.co(p, at, bt, False{}))), Word.to_nat(p, at), Word.to_nat(p, bt), un.add_v(p, at, bt, False{})) case WCon{False{}, +at} WCon{False{}, +bt} True{}: un.cell(False{}, False{}, True{}, Word.to_nat(p, Word.adc(p, at, bt, False{}, False{})), U.U32Nat.dbl(p, U.U32Nat.bit(un.co(p, at, bt, False{}))), Word.to_nat(p, at), Word.to_nat(p, bt), un.add_v(p, at, bt, False{})) case WCon{True{}, +at} WCon{True{}, +bt} False{}: un.cell(True{}, True{}, False{}, Word.to_nat(p, Word.adc(p, at, bt, False{}, True{})), U.U32Nat.dbl(p, U.U32Nat.bit(un.co(p, at, bt, True{}))), Word.to_nat(p, at), Word.to_nat(p, bt), un.add_v(p, at, bt, True{})) case WCon{True{}, +at} WCon{False{}, +bt} True{}: un.cell(True{}, False{}, True{}, Word.to_nat(p, Word.adc(p, at, bt, False{}, True{})), U.U32Nat.dbl(p, U.U32Nat.bit(un.co(p, at, bt, True{}))), Word.to_nat(p, at), Word.to_nat(p, bt), un.add_v(p, at, bt, True{})) case WCon{False{}, +at} WCon{True{}, +bt} True{}: un.cell(False{}, True{}, True{}, Word.to_nat(p, Word.adc(p, at, bt, False{}, True{})), U.U32Nat.dbl(p, U.U32Nat.bit(un.co(p, at, bt, True{}))), Word.to_nat(p, at), Word.to_nat(p, bt), un.add_v(p, at, bt, True{})) case WCon{True{}, +at} WCon{True{}, +bt} True{}: un.cell(True{}, True{}, True{}, Word.to_nat(p, Word.adc(p, at, bt, False{}, True{})), U.U32Nat.dbl(p, U.U32Nat.bit(un.co(p, at, bt, True{}))), Word.to_nat(p, at), Word.to_nat(p, bt), un.add_v(p, at, bt, True{})) Uses (12): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.add https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Word https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Word.Con https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Word.Nil https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Word.adc https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Word.to_nat https://jend.leeeet.dev/definition.txt?path=bend-osdev-u32@0.1.0.0/PROOF.bend&name=un.cell https://jend.leeeet.dev/definition.txt?path=bend-osdev-u32@0.1.0.0/PROOF.bend&name=un.co https://jend.leeeet.dev/definition.txt?path=bend-osdev-u32@0.1.0.0/u32.bend&name=U32Nat.bit https://jend.leeeet.dev/definition.txt?path=bend-osdev-u32@0.1.0.0/u32.bend&name=U32Nat.dbl