def write_hit

bendtorch-core@0.1.0.0 · src/tensor/contracts/pointwise_proof.bend:157

import bendtorch-core@0.1.0.0/src/tensor/contracts/pointwise_proof.bend as PointwiseProof
import Base
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape
import bendtorch-core@0.1.0.0/src/storage/LAWS.bend as StorageLaws
import bendtorch-core@0.1.0.0/src/storage/arith.bend as Arith

157def write_hit(+shape: Shape.Shape, +previous: Nat, +index: U32, +word: F32, +old: F32,
158  +room: {Nat.is_lt(previous, Shape.logical_numel(Shape.dimensions(shape))) == True{} : Bool},
159  at: {U32.to_nat(index) == previous : Nat}) ->
160  {StorageLaws.latest(U32.to_nat(Shape.count(shape)), StorageLaws.Write{U32.from_nat(previous), word}, index, old) == word : F32}:
161  %Equal.sym(Nat, U32.to_nat(U32.from_nat(previous)), previous, word_exact(previous, shape, room)) :
162    {Bool.pick(F32, Bool.and(Nat.is_lt(_, U32.to_nat(Shape.count(shape))), Nat.is_eq(_, U32.to_nat(index))), word, old) == word : F32}
163  %Equal.sym(Nat, U32.to_nat(index), previous, at) :
164    {Bool.pick(F32, Bool.and(Nat.is_lt(previous, U32.to_nat(Shape.count(shape))), Nat.is_eq(previous, _)), word, old) == word : F32}
165  %Equal.sym(Bool, Nat.is_lt(previous, U32.to_nat(Shape.count(shape))), True{}, lt_count(previous, shape, room)) :
166    {Bool.pick(F32, Bool.and(_, Nat.is_eq(previous, previous)), word, old) == word : F32}
167  %Equal.sym(Bool, Nat.is_eq(previous, previous), True{}, Arith.eq_refl(previous)) :
168    {Bool.pick(F32, _, word, old) == word : F32}
169  {==}

Uses (20)

Used by (1)