def write_moved
bendtorch-core@0.1.0.0 · src/tensor/contracts/replayed.bend:150
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
150def write_moved(+shape: Shape.Shape, +fill: F32, +ops: List<&2, StorageLaws.Op>,
151 -valid: {Lifecycle.logical_length(storage(shape, fill, ops)) == Shape.logical_numel(Shape.dimensions(shape)) : Nat},
152 +index: U32, +word: F32) ->
153 {write_stored(shape, Core.write_flat(shape, Core.TTensor{storage(shape, fill, ops), valid}, index, word)) ==
154 storage(shape, fill, snoc(ops, StorageLaws.Write{index, word})) : Storage.Storage}:
155 Equal.trans(Storage.Storage, write_stored(shape, Core.write_flat(shape, Core.TTensor{storage(shape, fill, ops), valid}, index, word)),
156 StorageLaws.written(storage(shape, fill, ops), index, word), storage(shape, fill, snoc(ops, StorageLaws.Write{index, word})),
157 write_owner_projection(shape, storage(shape, fill, ops), valid, index, word, Storage.set(storage(shape, fill, ops), index, word), {==}),
158 Equal.sym(Storage.Storage, storage(shape, fill, snoc(ops, StorageLaws.Write{index, word})), StorageLaws.written(storage(shape, fill, ops), index, word),
159 replay_snoc(ops, StorageLaws.Write{index, word}, shape, fill)))