def written

bendtorch-core@0.1.0.0 · src/tensor/contracts/binary_build_proof.bend:60

import bendtorch-core@0.1.0.0/src/tensor/contracts/binary_build_proof.bend as BinaryBuildProof
import Base
import bendtorch-core@0.1.0.0/src/storage/api.bend as Api

60# Every write in the history lands below `n`: `Api.Valid` as a Bool, so a
61# proof of it can be used many times.
62def written(+n: Nat, +history: List<&2, Api.Effect>) -> Bool:
63  match history:
64    case Nil{}:
65      True{}
66    case +effect <> +past:
67      match effect:
68        case Api.Wrote{+i, w}:
69          Bool.and(Nat.is_lt(U32.to_nat(i), n), written(n, past))
70        case Api.Kept{i}:
71          written(n, past)
72        case Api.Left{}:
73          written(n, past)
74        case Api.Right{}:
75          written(n, past)

Uses (7)

Used by (14)