def get_checked_keep

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

import bendtorch-core@0.1.0.0/src/storage/api.bend as Api
import Base
import bendtorch-core@0.1.0.0/src/storage/model.bend as Model
import bendtorch-core@0.1.0.0/src/storage/refinement.bend as Refinement
import bendtorch-core@0.1.0.0/src/storage/certificates.bend as Certificates
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

97def get_checked_keep(+d: Nat, +n: Nat, array: Array<F32>, +i: U32, allowed: Bool,
98  -decision: {allowed == Nat.is_lt(U32.to_nat(i), n) : Bool},
99  -balanced: Model.Balanced(F32, d, array), -valid: {Storage.bounds(d, n) == True{} : Bool},
100  yes: {True{} == allowed : Bool}, +fits: {Storage.bounds(d, n) == True{} : Bool},
101  +inside: {Nat.is_lt(U32.to_nat(i), n) == True{} : Bool}) ->
102  {Storage.get_checked(d, n, array, i, allowed, decision, balanced, valid) ==
103    (Storage.Owned{d, n, Refinement.first(F32, Array.get(F32, array, i)),
104      Certificates.get_result(F32, d, array, i, Array.get(F32, array, i), {==}, balanced), valid},
105      Done{Refinement.second(F32, Array.get(F32, array, i))}) : Storage.Storage & Result<&2, &2, Storage.Error, F32>}:
106  match allowed:
107    case True{}:
108      finish_owner(d, n, array, i, Array.get(F32, array, i), {==}, balanced, valid)
109    case False{}:
110      Empty.absurd({Storage.get_checked(d, n, array, i, False{}, decision, balanced, valid) ==
111        (Storage.Owned{d, n, Refinement.first(F32, Array.get(F32, array, i)),
112          Certificates.get_result(F32, d, array, i, Array.get(F32, array, i), {==}, balanced), valid},
113          Done{Refinement.second(F32, Array.get(F32, array, i))}) : Storage.Storage & Result<&2, &2, Storage.Error, F32>}, Arith.clash_true(yes))

Uses (22)

Used by (4)