~/bend-docscommunity

proof_find.bend checks

raw source on the hub · import lawful-bytes@0.1.0.0/proof_find.bend as Proof_find

12 imports
import Base
import ./defs.bend as D
import ./bytes.bend as B
import ./proof_seq.bend as Q
import ./proof_core.bend as C
import lawful-words@0.1.0.0/defs.bend as W
import lawful-words@0.1.0.0/proof_nat.bend as N
import lawful-words@0.1.0.0/proof_u32.bend as U
import lawful-arrays@0.1.0.0/defs.bend as A
import lawful-arrays@0.1.0.0/proof_base.bend as AB
import lawful-arrays@0.1.0.0/proof_tree.bend as P
import lawful-arrays@0.1.0.0/proof_index.bend as I

Laws

law none_ne_some provedsource · line 29 · raw

@-x:U32 -> @e:{None{} == Some{x} : Maybe<&2, U32>} -> Empty

law drop_zero provedsource · line 37 · raw

@+xs:List<&2, U32> -> {List.drop(&2, U32, xs, 0n) == xs : List<&2, U32>}

law drop_cons provedsource · line 49 · raw

@+xs:List<&2, U32> -> @+j:Nat -> @+x:U32 -> @+hx:{List.get(&2, U32, xs, j) == Some{x} : Maybe<&2, U32>} -> {List.drop(&2, U32, xs, j) == x <> List.drop(&2, U32, xs, Nat.add(j, 1n)) : List<&2, U32>}

Dropping j elements from a list with x at j leaves x in front.

law slice_cons provedsource · line 68 · raw

@+xs:List<&2, U32> -> @+j:Nat -> @+k:Nat -> @+x:U32 -> @+hx:{List.get(&2, U32, xs, j) == Some{x} : Maybe<&2, U32>} -> {0xc018b2b7a70e32edf065f462beb7dcfd/defs.slice(xs, j, 1n+k) == x <> 0xc018b2b7a70e32edf065f462beb7dcfd/defs.slice(xs, Nat.add(j, 1n), k) : List<&2, U32>}

law lt_add_succ provedsource · line 81 · raw

@+a:Nat -> @+k:Nat -> {Nat.is_lt(a, Nat.add(a, 1n+k)) == True{} : Bool}

law add11 provedsource · line 94 · raw

@+j:U32 -> {U32.add(U32.add(j, 1), 1) == U32.add(j, 2) : U32}

(j + 1) + 1 is j + 2, for every word j (no range needed: through from_nat).

law fgo_pair provedsource · line 111 · raw

@n:Nat -> @+hit:Bool -> @+len:U32 -> @+t:0x13527df86b638e4649c15a58682c998e/proof_tree.Tree<U32> -> @+x:U32 -> @+j:U32 -> @+to:U32 -> @+c:U32 -> {0xc018b2b7a70e32edf065f462beb7dcfd/bytes.find.go(n, hit, (0xc018b2b7a70e32edf065f462beb7dcfd/proof_core.BT(len, t), x), j, to, c) == (0xc018b2b7a70e32edf065f462beb7dcfd/proof_core.BT(len, t), Pair.snd(0xc018b2b7a70e32edf065f462beb7dcfd/defs.Bytes, U32, 0xc018b2b7a70e32edf065f462beb7dcfd/bytes.find.go(n, hit, (0xc018b2b7a70e32edf065f462beb7dcfd/proof_core.BT(len, t), x), j, to, c))) : Pair(0xc018b2b7a70e32edf065f462beb7dcfd/defs.Bytes, U32)}

law find_pair_t provedsource · line 135 · raw

@+len:U32 -> @+t:0x13527df86b638e4649c15a58682c998e/proof_tree.Tree<U32> -> @+from:U32 -> @+to:U32 -> @+c:U32 -> {0xc018b2b7a70e32edf065f462beb7dcfd/bytes.find(0xc018b2b7a70e32edf065f462beb7dcfd/proof_core.BT(len, t), from, to, c) == (0xc018b2b7a70e32edf065f462beb7dcfd/proof_core.BT(len, t), Pair.snd(0xc018b2b7a70e32edf065f462beb7dcfd/defs.Bytes, U32, 0xc018b2b7a70e32edf065f462beb7dcfd/bytes.find(0xc018b2b7a70e32edf065f462beb7dcfd/proof_core.BT(len, t), from, to, c))) : Pair(0xc018b2b7a70e32edf065f462beb7dcfd/defs.Bytes, U32)}

law fgo2_pair provedsource · line 153 · raw

@n:Nat -> @+hit:Bool -> @+len:U32 -> @+t:0x13527df86b638e4649c15a58682c998e/proof_tree.Tree<U32> -> @+x:U32 -> @+j:U32 -> @+to:U32 -> @+c1:U32 -> @+c2:U32 -> {0xc018b2b7a70e32edf065f462beb7dcfd/bytes.find2.go(n, hit, (0xc018b2b7a70e32edf065f462beb7dcfd/proof_core.BT(len, t), x), j, to, c1, c2) == (0xc018b2b7a70e32edf065f462beb7dcfd/proof_core.BT(len, t), Pair.snd(0xc018b2b7a70e32edf065f462beb7dcfd/defs.Bytes, U32, 0xc018b2b7a70e32edf065f462beb7dcfd/bytes.find2.go(n, hit, (0xc018b2b7a70e32edf065f462beb7dcfd/proof_core.BT(len, t), x), j, to, c1, c2))) : Pair(0xc018b2b7a70e32edf065f462beb7dcfd/defs.Bytes, U32)}

law find2_pair_t provedsource · line 178 · raw

@+len:U32 -> @+t:0x13527df86b638e4649c15a58682c998e/proof_tree.Tree<U32> -> @+from:U32 -> @+to:U32 -> @+c1:U32 -> @+c2:U32 -> {0xc018b2b7a70e32edf065f462beb7dcfd/bytes.find2(0xc018b2b7a70e32edf065f462beb7dcfd/proof_core.BT(len, t), from, to, c1, c2) == (0xc018b2b7a70e32edf065f462beb7dcfd/proof_core.BT(len, t), Pair.snd(0xc018b2b7a70e32edf065f462beb7dcfd/defs.Bytes, U32, 0xc018b2b7a70e32edf065f462beb7dcfd/bytes.find2(0xc018b2b7a70e32edf065f462beb7dcfd/proof_core.BT(len, t), from, to, c1, c2))) : Pair(0xc018b2b7a70e32edf065f462beb7dcfd/defs.Bytes, U32)}

law step_lt provedsource · line 202 · raw

@+len:U32 -> @+j:U32 -> @+to:U32 -> @+k:Nat -> @+hn:{Nat.add(U32.to_nat(j), 1n+k) == U32.to_nat(to) : Nat} -> @+hto:{Nat.is_le(U32.to_nat(to), U32.to_nat(len)) == True{} : Bool} -> {Nat.is_lt(U32.to_nat(j), U32.to_nat(len)) == True{} : Bool}

With j + 1 + k = to <= len, byte j is in range.

law step_lt4 provedsource · line 217 · raw

@+len:U32 -> @+t:0x13527df86b638e4649c15a58682c998e/proof_tree.Tree<U32> -> @+d:Nat -> @+j:U32 -> @+h:{0xc018b2b7a70e32edf065f462beb7dcfd/defs.ok(0xc018b2b7a70e32edf065f462beb7dcfd/proof_core.BT(len, t), d) == True{} : Bool} -> @+hj:{Nat.is_lt(U32.to_nat(j), U32.to_nat(len)) == True{} : Bool} -> {Nat.is_lt(U32.to_nat(j), Nat.mul(4n, Nat.pow(2n, d))) == True{} : Bool}

law step_get provedsource · line 229 · raw

@+len:U32 -> @+t:0x13527df86b638e4649c15a58682c998e/proof_tree.Tree<U32> -> @+d:Nat -> @+j:U32 -> @+h:{0xc018b2b7a70e32edf065f462beb7dcfd/defs.ok(0xc018b2b7a70e32edf065f462beb7dcfd/proof_core.BT(len, t), d) == True{} : Bool} -> @+hj:{Nat.is_lt(U32.to_nat(j), U32.to_nat(len)) == True{} : Bool} -> {List.get(&2, U32, 0xc018b2b7a70e32edf065f462beb7dcfd/defs.view(0xc018b2b7a70e32edf065f462beb7dcfd/proof_core.BT(len, t)), U32.to_nat(j)) == Some{0xc018b2b7a70e32edf065f462beb7dcfd/proof_core.AT(len, t, j)} : Maybe<&2, U32>}

law step_n provedsource · line 242 · raw

@+j:U32 -> @+k:Nat -> @+to:U32 -> @+d:Nat -> @+hd:{Nat.is_le(d, 29n) == True{} : Bool} -> @+hj4:{Nat.is_lt(U32.to_nat(j), Nat.mul(4n, Nat.pow(2n, d))) == True{} : Bool} -> @+hn:{Nat.add(U32.to_nat(j), 1n+k) == U32.to_nat(to) : Nat} -> {Nat.add(U32.to_nat(U32.add(j, 1)), k) == U32.to_nat(to) : Nat}

law fgo_view provedsource · line 264 · raw

@+n:Nat -> @+hit:Bool -> @+len:U32 -> @+t:0x13527df86b638e4649c15a58682c998e/proof_tree.Tree<U32> -> @+d:Nat -> @+j:U32 -> @+to:U32 -> @+c:U32 -> @+hh:{U32.is_eq(0xc018b2b7a70e32edf065f462beb7dcfd/proof_core.AT(len, t, j), c) == hit : Bool} -> @+hn:{Nat.add(U32.to_nat(j), n) == U32.to_nat(to) : Nat} -> @+hto:{Nat.is_le(U32.to_nat(to), U32.to_nat(len)) == True{} : Bool} -> @+h:{0xc018b2b7a70e32edf065f462beb7dcfd/defs.ok(0xc018b2b7a70e32edf065f462beb7dcfd/proof_core.BT(len, t), d) == True{} : Bool} -> {U32.to_nat(Pair.snd(0xc018b2b7a70e32edf065f462beb7dcfd/defs.Bytes, U32, 0xc018b2b7a70e32edf065f462beb7dcfd/bytes.find.go(n, hit, (0xc018b2b7a70e32edf065f462beb7dcfd/proof_core.BT(len, t), 0xc018b2b7a70e32edf065f462beb7dcfd/proof_core.AT(len, t, U32.add(j, 1))), j, to, c))) == Nat.add(U32.to_nat(j), 0xc018b2b7a70e32edf065f462beb7dcfd/defs.run_len(0xc018b2b7a70e32edf065f462beb7dcfd/defs.slice(0xc018b2b7a70e32edf065f462beb7dcfd/defs.view(0xc018b2b7a70e32edf065f462beb7dcfd/proof_core.BT(len, t)), U32.to_nat(j), n), c)) : Nat}

hit says byte j is c, r holds byte j + 1, j + n = to.

law le_ft provedsource · line 323 · raw

@+from:U32 -> @+to:U32 -> @+hft:{U32.is_le(from, to) == True{} : Bool} -> {Nat.is_le(U32.to_nat(from), U32.to_nat(to)) == True{} : Bool}

from <= to as numbers.

law find_view_t provedsource · line 333 · raw

@+len:U32 -> @+t:0x13527df86b638e4649c15a58682c998e/proof_tree.Tree<U32> -> @+d:Nat -> @+from:U32 -> @+to:U32 -> @+c:U32 -> @+h:{0xc018b2b7a70e32edf065f462beb7dcfd/defs.ok(0xc018b2b7a70e32edf065f462beb7dcfd/proof_core.BT(len, t), d) == True{} : Bool} -> @+hft:{U32.is_le(from, to) == True{} : Bool} -> @+ht:{Nat.is_le(U32.to_nat(to), 0xc018b2b7a70e32edf065f462beb7dcfd/defs.size(0xc018b2b7a70e32edf065f462beb7dcfd/proof_core.BT(len, t))) == True{} : Bool} -> @+hc:{U32.is_lt(c, 256) == True{} : Bool} -> {U32.to_nat(Pair.snd(0xc018b2b7a70e32edf065f462beb7dcfd/defs.Bytes, U32, 0xc018b2b7a70e32edf065f462beb7dcfd/bytes.find(0xc018b2b7a70e32edf065f462beb7dcfd/proof_core.BT(len, t), from, to, c))) == 0xc018b2b7a70e32edf065f462beb7dcfd/defs.first(0xc018b2b7a70e32edf065f462beb7dcfd/defs.view(0xc018b2b7a70e32edf065f462beb7dcfd/proof_core.BT(len, t)), U32.to_nat(from), U32.to_nat(to), c) : Nat}

law fgo2_view provedsource · line 363 · raw

@+n:Nat -> @+hit:Bool -> @+len:U32 -> @+t:0x13527df86b638e4649c15a58682c998e/proof_tree.Tree<U32> -> @+d:Nat -> @+j:U32 -> @+to:U32 -> @+c1:U32 -> @+c2:U32 -> @+hh:{Bool.or(U32.is_eq(0xc018b2b7a70e32edf065f462beb7dcfd/proof_core.AT(len, t, j), c1), U32.is_eq(0xc018b2b7a70e32edf065f462beb7dcfd/proof_core.AT(len, t, j), c2)) == hit : Bool} -> @+hn:{Nat.add(U32.to_nat(j), n) == U32.to_nat(to) : Nat} -> @+hto:{Nat.is_le(U32.to_nat(to), U32.to_nat(len)) == True{} : Bool} -> @+h:{0xc018b2b7a70e32edf065f462beb7dcfd/defs.ok(0xc018b2b7a70e32edf065f462beb7dcfd/proof_core.BT(len, t), d) == True{} : Bool} -> {U32.to_nat(Pair.snd(0xc018b2b7a70e32edf065f462beb7dcfd/defs.Bytes, U32, 0xc018b2b7a70e32edf065f462beb7dcfd/bytes.find2.go(n, hit, (0xc018b2b7a70e32edf065f462beb7dcfd/proof_core.BT(len, t), 0xc018b2b7a70e32edf065f462beb7dcfd/proof_core.AT(len, t, U32.add(j, 1))), j, to, c1, c2))) == Nat.add(U32.to_nat(j), 0xc018b2b7a70e32edf065f462beb7dcfd/defs.run_len2(0xc018b2b7a70e32edf065f462beb7dcfd/defs.slice(0xc018b2b7a70e32edf065f462beb7dcfd/defs.view(0xc018b2b7a70e32edf065f462beb7dcfd/proof_core.BT(len, t)), U32.to_nat(j), n), c1, c2)) : Nat}

hit says byte j is c1 or c2, r holds byte j + 1, j + n = to.

law find2_view_t provedsource · line 422 · raw

@+len:U32 -> @+t:0x13527df86b638e4649c15a58682c998e/proof_tree.Tree<U32> -> @+d:Nat -> @+from:U32 -> @+to:U32 -> @+c1:U32 -> @+c2:U32 -> @+h:{0xc018b2b7a70e32edf065f462beb7dcfd/defs.ok(0xc018b2b7a70e32edf065f462beb7dcfd/proof_core.BT(len, t), d) == True{} : Bool} -> @+hft:{U32.is_le(from, to) == True{} : Bool} -> @+ht:{Nat.is_le(U32.to_nat(to), 0xc018b2b7a70e32edf065f462beb7dcfd/defs.size(0xc018b2b7a70e32edf065f462beb7dcfd/proof_core.BT(len, t))) == True{} : Bool} -> @+hc1:{U32.is_lt(c1, 256) == True{} : Bool} -> @+hc2:{U32.is_lt(c2, 256) == True{} : Bool} -> {U32.to_nat(Pair.snd(0xc018b2b7a70e32edf065f462beb7dcfd/defs.Bytes, U32, 0xc018b2b7a70e32edf065f462beb7dcfd/bytes.find2(0xc018b2b7a70e32edf065f462beb7dcfd/proof_core.BT(len, t), from, to, c1, c2))) == 0xc018b2b7a70e32edf065f462beb7dcfd/defs.first2(0xc018b2b7a70e32edf065f462beb7dcfd/defs.view(0xc018b2b7a70e32edf065f462beb7dcfd/proof_core.BT(len, t)), U32.to_nat(from), U32.to_nat(to), c1, c2) : Nat}

Definitions

def is_some_t source · line 22 · raw

@m:Maybe<&2, U32> -> Type