def alloc_status

bendtorch-core@0.1.0.0 · src/storage/api.bend:746

import bendtorch-core@0.1.0.0/src/storage/api.bend as Api
import Base
import bendtorch-core@0.1.0.0/src/storage/array.bend as ArrayCore
import bendtorch-core@0.1.0.0/src/storage/main.bend as Storage
import bendtorch-core@0.1.0.0/src/storage/LAWS.bend as Laws
import bendtorch-core@0.1.0.0/src/storage/arith.bend as Arith

746def alloc_status(+d: Nat, +n: Nat, +value: F32, valid: Bool, -decision: {valid == Storage.bounds(d, n) : Bool},
747  +ops: List<&2, Laws.Op>, +j: U32, +v: F32, yes: {True{} == valid : Bool}, +fits: {Storage.bounds(d, n) == True{} : Bool},
748  +inside: {Nat.is_lt(U32.to_nat(j), n) == True{} : Bool}) ->
749  {Laws.status(Laws.replay(ops, Laws.created.of(Storage.allocate(d, n, value, valid, decision))), j, v) == Done{Unit{}} : Result<&2, &2, Storage.Error, Unit>}:
750  match valid:
751    case True{}:
752      replay_status(ops, d, n, value, Nil{}, j, v, hit_of(n, ops), {==}, ArrayCore.new_balanced(F32, d, value),
753        Equal.sym(Bool, True{}, Storage.bounds(d, n), decision), fits, inside)
754    case False{}:
755      Empty.absurd({Laws.status(Laws.replay(ops, Laws.created.of(Storage.allocate(d, n, value, False{}, decision))), j, v) == Done{Unit{}} : Result<&2, &2, Storage.Error, Unit>},
756        Arith.clash_true(yes))

Uses (22)

Used by (1)