def index_complete

bendtorch-core@0.1.0.0 · src/storage/route.bend:349

import bendtorch-core@0.1.0.0/src/storage/route.bend as Route
import Base
import bendtorch-core@0.1.0.0/src/storage/model.bend as Model
import bendtorch-core@0.1.0.0/src/storage/main.bend as Storage
import bendtorch-core@0.1.0.0/src/storage/arith.bend as Arith

349def index_complete(+d: Nat, +n: Nat, +i: U32, +fits: {Storage.bounds(d, n) == True{} : Bool},
350  +inside: {Nat.is_lt(U32.to_nat(i), n) == True{} : Bool}) -> {True{} == Storage.index_matches(d, n, i) : Bool}:
351  +depth = Arith.and_left(Nat.is_le(d, 20n), Bool.and(Nat.is_lt(0n, n), Nat.is_le(n, Model.capacity(d))), fits)
352  +rest = Arith.and_right(Nat.is_le(d, 20n), Bool.and(Nat.is_lt(0n, n), Nat.is_le(n, Model.capacity(d))), fits)
353  +full = Arith.and_right(Nat.is_lt(0n, n), Nat.is_le(n, Model.capacity(d)), rest)
354  +slot = Arith.lt_le_trans(U32.to_nat(i), n, Model.capacity(d), inside, full)
355  %route_offset(d, i, depth, slot) : {True{} == Bool.and(Nat.is_eq(_, U32.to_nat(i)), Nat.is_lt(_, n)) : Bool}
356  %Equal.sym(Bool, Nat.is_eq(U32.to_nat(i), U32.to_nat(i)), True{}, Arith.eq_refl(U32.to_nat(i))) : {True{} == Bool.and(_, Nat.is_lt(U32.to_nat(i), n)) : Bool}
357  Equal.sym(Bool, Nat.is_lt(U32.to_nat(i), n), True{}, inside)

Uses (17)

Used by (8)