defs.bend checks
raw source on the hub · import lawful-arrays@0.1.0.1/defs.bend as Defs
1 import
import Base
Definitions
def full source · line 11 · raw
@-T:Type -> @a:Array<T> -> @+d:Nat -> Bool
a is a perfect tree of depth d: 2^d leaves, every one at depth d. Arrays made by Array.new are; Array.set and Array.get keep it so.
def view source · line 24 · raw
@-T:Data -> @a:Array<T> -> List<&2, T>
The leaves of a, left to right (the same list as Base's Array.to_list, which is a template and cannot appear in a law). Elements must be Data.
def slot source · line 34 · raw
@i:U32 -> @d:Nat -> Nat
The leaf an access at index i reaches in a perfect tree of depth d < 32: i modulo 2^d. (From depth 32 up, Base's Array.size wraps to 0 and every access reaches the last leaf; the laws exclude that.)