~/bend-docscommunity

proof_u32.bend checks

raw source on the hub · import 0xeb25eff332574f4f1d48668b83cdda30/proof_u32.bend as Proof_u32

Proof helpers for bend-osdev-asn1: Base's U32 equality is reflexive and sound (equal comparison means the same word), by induction over the bits of Base's Word; and so is the byte-list equality a1.leq.

3 imports
import Base
import ./number.bend as Nu
import ./proof_nat.bend as AN

Definitions

def au.fin_refl source · line 8 · raw

@b:Bool -> {Word.cmp.fin(b, b, EQ{}) == EQ{} : Cmp}

def au.cmp_refl source · line 15 · raw

@n:Nat -> @w:Word(n) -> {Word.cmp(n, w, w) == EQ{} : Cmp}

def au.is_eq_refl source · line 25 · raw

@x:U32 -> {U32.is_eq(x, x) == True{} : Bool}

def au.cdisc source · line 31 · raw

@c:Cmp -> Type

def au.bool_cmp source · line 40 · raw

@a:Bool -> @b:Bool -> @+e:{Cmp.is_eq(Bool.cmp(a, b)) == True{} : Bool} -> {a == b : Bool}

def au.fin_eq source · line 52 · raw

@t:Cmp -> @a:Bool -> @b:Bool -> @+e:{Cmp.is_eq(Word.cmp.fin(a, b, t)) == True{} : Bool} -> {t == EQ{} : Cmp}

a comparison that is EQ after fin: the rest compared EQ and the bits agree

def au.fin_bits source · line 61 · raw

@t:Cmp -> @a:Bool -> @b:Bool -> @+e:{Cmp.is_eq(Word.cmp.fin(a, b, t)) == True{} : Bool} -> {a == b : Bool}

def au.cmp_sound source · line 70 · raw

@n:Nat -> @x:Word(n) -> @y:Word(n) -> @+e:{Cmp.is_eq(Word.cmp(n, x, y)) == True{} : Bool} -> {x == y : Word(n)}

def au.is_eq_sound source · line 86 · raw

@x:U32 -> @y:U32 -> @+e:{U32.is_eq(x, y) == True{} : Bool} -> {x == y : U32}

def au.leq_refl source · line 94 · raw

@xs:List<&2, U32> -> {0xeb25eff332574f4f1d48668b83cdda30/number.a1.leq(xs, xs) == True{} : Bool}

def au.leq_sound source · line 102 · raw

@xs:List<&2, U32> -> @ys:List<&2, U32> -> @+e:{0xeb25eff332574f4f1d48668b83cdda30/number.a1.leq(xs, ys) == True{} : Bool} -> {xs == ys : List<&2, U32>}