def alloc_read
bendtorch-core@0.1.0.0 · src/storage/api.bend:650
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
650def alloc_read(+d: Nat, +n: Nat, +value: F32, valid: Bool, -decision: {valid == Storage.bounds(d, n) : Bool},
651 +ops: List<&2, Laws.Op>, +j: U32, yes: {True{} == valid : Bool}, +fits: {Storage.bounds(d, n) == True{} : Bool},
652 +inside: {Nat.is_lt(U32.to_nat(j), n) == True{} : Bool}) ->
653 {Laws.read(Laws.replay(ops, Laws.created.of(Storage.allocate(d, n, value, valid, decision))), j) ==
654 Done{Laws.expected(ops, n, j, value)} : Result<&2, &2, Storage.Error, F32>}:
655 match valid:
656 case True{}:
657 replay_read(ops, d, n, value, Nil{}, j, hit_of(n, ops), {==}, ArrayCore.new_balanced(F32, d, value),
658 Equal.sym(Bool, True{}, Storage.bounds(d, n), decision), fits, inside, Unit{})
659 case False{}:
660 Empty.absurd({Laws.read(Laws.replay(ops, Laws.created.of(Storage.allocate(d, n, value, False{}, decision))), j) ==
661 Done{Laws.expected(ops, n, j, value)} : Result<&2, &2, Storage.Error, F32>}, Arith.clash_true(yes))