def write_done
bendtorch-core@0.1.0.0 · src/tensor/contracts/replayed.bend:161
import bendtorch-core@0.1.0.0/src/tensor/contracts/replayed.bend as Replayed
import Base
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape
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 StorageLaws
import bendtorch-core@0.1.0.0/src/tensor/core.bend as Core
import bendtorch-core@0.1.0.0/src/tensor/lifecycle.bend as Lifecycle
import bendtorch-core@0.1.0.0/src/tensor/word_conversion.bend as Conversion
import bendtorch-core@0.1.0.0/src/tensor/read_contract.bend as Reads
161def write_done(+shape: Shape.Shape, +fill: F32, +ops: List<&2, StorageLaws.Op>,
162 -valid: {Lifecycle.logical_length(storage(shape, fill, ops)) == Shape.logical_numel(Shape.dimensions(shape)) : Nat},
163 +index: U32, +word: F32,
164 inside: {Nat.is_lt(U32.to_nat(index), Shape.logical_numel(Shape.dimensions(shape))) == True{} : Bool}) ->
165 {write_status(shape, Core.write_flat(shape, Core.TTensor{storage(shape, fill, ops), valid}, index, word)) == True{} : Bool}:
166 Equal.trans(Bool, write_status(shape, Core.write_flat(shape, Core.TTensor{storage(shape, fill, ops), valid}, index, word)),
167 Result.is_done(&2, &2, Storage.Error, Unit, StorageLaws.status(storage(shape, fill, ops), index, word)), True{},
168 write_status_projection(shape, storage(shape, fill, ops), valid, index, word, Storage.set(storage(shape, fill, ops), index, word), {==}),
169 Equal.cong(Result<&2, &2, Storage.Error, Unit>, Bool, Result.is_done(&2, &2, Storage.Error, Unit),
170 StorageLaws.status(storage(shape, fill, ops), index, word), Done{Unit{}},
171 StorageLaws.replay_set(Shape.count(shape), fill, ops, index, word, Conversion.shape_count_within(shape),
172 Reads.word_inside(shape, index, inside))))