Defs.ok: def of lawful-bytes@0.1.1.0 Import: import lawful-bytes@0.1.1.0/defs.bend as Defs Lines 37-43 of lawful-bytes@0.1.1.0/defs.bend: https://jend.leeeet.dev/read.txt?path=lawful-bytes@0.1.1.0/defs.bend&start_line=37&end_line=43 import Base import lawful-arrays@0.1.0.0/defs.bend as A # b is well formed with a block of depth d: a perfect block of 2^d words, # d <= 29, and len within the block. A buffer holds at most 2^31 bytes (2 GiB), # so every index and length fits in a U32; the laws' hypotheses keep sums of # lengths in range too. Larger files are read in pieces. def ok(b: Bytes, +d: Nat) -> Bool: Bytes{len, buf} = b A.full(U32, buf, d) && (Nat.is_le(d, 29n) && Nat.is_le(U32.to_nat(len), Nat.mul(4n, Nat.pow(2n, d)))) Uses (10): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.and https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.is_le https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.mul https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.pow https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.to_nat https://jend.leeeet.dev/definition.txt?path=lawful-arrays@0.1.0.0/defs.bend&name=full https://jend.leeeet.dev/definition.txt?path=lawful-bytes@0.1.1.0/defs.bend&name=Bytes