roundtrip-proof.bend checks
raw source on the hub · import bend-kit-bytes@0.3.3.2/roundtrip-proof.bend as Roundtrip_proof
9 imports
import Base import ./bytes.bend as Bytes import ./decimal-proof.bend as Decimal import ./array-proof.bend as ArrayModel import ./packed-proof.bend as Packed import bend-kit-lemmas@0.1.5.1/lemmas.bend as Lemmas import bend-mathlib@0.8.0.0/nat.bend as MNat import ./ascii-proof.bend as Ascii import ./codec-proof.bend as Codec
Definitions
def width source · line 11 · raw
@+n:U32 -> U32
def width_bound source · line 14 · raw
@+n:U32 -> 0x78e347bf8d0582a322c01b02c727566f/nat.le(U32.to_nat(width(n)), 11n)
def width_ne_zero source · line 18 · raw
@+n:U32 -> {U32.is_ne(width(n), 0) == True{} : Bool}
def depth source · line 24 · raw
@+len:U32 -> Nat
def allocation_bounds source · line 27 · raw
@n:Nat -> @h:0x78e347bf8d0582a322c01b02c727566f/nat.le(n, 11n) -> Pair(0x78e347bf8d0582a322c01b02c727566f/nat.lt(depth(U32.from_nat(n)), 3n), 0x78e347bf8d0582a322c01b02c727566f/nat.le(U32.to_nat(U32.from_nat(n)), 0x166a26e38c43ec5f8fe3323f5850e3d8/packed-proof.capacity(depth(U32.from_nat(n)))))
def allocation source · line 56 · raw
@+len:U32 -> @h:0x78e347bf8d0582a322c01b02c727566f/nat.le(U32.to_nat(len), 11n) -> Pair(0x78e347bf8d0582a322c01b02c727566f/nat.lt(depth(len), 3n), 0x78e347bf8d0582a322c01b02c727566f/nat.le(U32.to_nat(len), 0x166a26e38c43ec5f8fe3323f5850e3d8/packed-proof.capacity(depth(len))))
def alloc_model source · line 60 · raw
@+len:U32 -> @h:0x78e347bf8d0582a322c01b02c727566f/nat.lt(depth(len), 3n) -> {0x166a26e38c43ec5f8fe3323f5850e3d8/bytes.alloc(len) == 0x166a26e38c43ec5f8fe3323f5850e3d8/array-proof.build(depth(len), 0x166a26e38c43ec5f8fe3323f5850e3d8/array-proof.replicate(0xd8f70327683b21776ccf8aa205a4e092/lemmas.pow2(depth(len)), 0)) : Array<U32>}
def replicate_length source · line 63 · raw
@n:Nat -> @+v:U32 -> {0x166a26e38c43ec5f8fe3323f5850e3d8/array-proof.len(0x166a26e38c43ec5f8fe3323f5850e3d8/array-proof.replicate(n, v)) == n : Nat}
def width_positive source · line 71 · raw
@+n:U32 -> 0x78e347bf8d0582a322c01b02c727566f/nat.le(1n, U32.to_nat(width(n)))
def width_lt16 source · line 76 · raw
@+n:U32 -> 0x78e347bf8d0582a322c01b02c727566f/nat.lt(U32.to_nat(width(n)), 16n)
def from_pred source · line 79 · raw
@+n:Nat -> @+i:U32 -> @h:{1n+U32.to_nat(i) == n : Nat} -> {U32.from_nat(Nat.sub(n, 1n)) == i : U32}
def raw_pred source · line 84 · raw
@+n:U32 -> @+hd:0x78e347bf8d0582a322c01b02c727566f/nat.lt(depth(width(n)), 3n) -> @+hc:0x78e347bf8d0582a322c01b02c727566f/nat.le(U32.to_nat(width(n)), 0x166a26e38c43ec5f8fe3323f5850e3d8/packed-proof.capacity(depth(width(n)))) -> @r:0x166a26e38c43ec5f8fe3323f5850e3d8/codec-proof.Pred(width(n)) -> {0x166a26e38c43ec5f8fe3323f5850e3d8/bytes.u32.read(0x166a26e38c43ec5f8fe3323f5850e3d8/bytes.u32.show(n)) == Some{n} : Maybe<&2, U32>}
def raw_allocation source · line 118 · raw
@+n:U32 -> @r:Pair(0x78e347bf8d0582a322c01b02c727566f/nat.lt(depth(width(n)), 3n), 0x78e347bf8d0582a322c01b02c727566f/nat.le(U32.to_nat(width(n)), 0x166a26e38c43ec5f8fe3323f5850e3d8/packed-proof.capacity(depth(width(n))))) -> {0x166a26e38c43ec5f8fe3323f5850e3d8/bytes.u32.read(0x166a26e38c43ec5f8fe3323f5850e3d8/bytes.u32.show(n)) == Some{n} : Maybe<&2, U32>}
def raw source · line 123 · raw
@+n:U32 -> {0x166a26e38c43ec5f8fe3323f5850e3d8/bytes.u32.read(0x166a26e38c43ec5f8fe3323f5850e3d8/bytes.u32.show(n)) == Some{n} : Maybe<&2, U32>}