def frame_cell

bendtorch-core@0.1.0.0 · src/tensor/matmul_PROOF.bend:309

import bendtorch-core@0.1.0.0/src/tensor/matmul_PROOF.bend as MatmulPROOF
import Base
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape
import bendtorch-core@0.1.0.0/src/tensor/core.bend as Core
import bendtorch-core@0.1.0.0/src/tensor/matmul_LAWS.bend as Laws

309def frame_cell(+inner: U32, +left: Shape.Shape, +right: Shape.Shape, -a: Core.Tensor<left>, -b: Core.Tensor<right>,
310  +output: Shape.Shape, -before: Core.Tensor<output>, -after: Core.Tensor<output>, +cursor: Nat, +position: Nat,
311  cell: Laws.ProductCell<inner, left, right, a, b, output, before, position>,
312  -cursor_exact: {U32.to_nat(U32.from_nat(cursor)) == cursor : Nat}, -earlier: {Nat.is_lt(position, cursor) == True{} : Bool},
313  -frame: @+other: U32 -> @checked: Core.ObservationChecked(Core.Packed{output, before}, other) ->
314    @different: {Nat.is_eq(U32.to_nat(U32.from_nat(cursor)), U32.to_nat(other)) == False{} : Bool} ->
315      Core.ObservationChecked(Core.Packed{output, after}, other) &
316        {Core.checked_observe(output, after, other) == Core.checked_observe(output, before, other) : Maybe<&2, F32>}) ->
317  Laws.ProductCell<inner, left, right, a, b, output, after, position>:
318  Laws.ProductCell{row, column, coordinate, decoded, coordinates, word_exact, factors, logical, value, fold, checked, observed} = cell
319  Laws.ProductCell{row, column, coordinate, decoded, coordinates, word_exact, factors, logical, value, fold,
320    Pair.fst(Core.ObservationChecked(Core.Packed{output, after}, U32.from_nat(position)),
321      {Core.checked_observe(output, after, U32.from_nat(position)) == Core.checked_observe(output, before, U32.from_nat(position)) : Maybe<&2, F32>},
322      frame(U32.from_nat(position), checked, checked_different(position, cursor, word_exact, cursor_exact, earlier))),
323    Equal.trans(Maybe<&2, F32>, Core.checked_observe(output, after, U32.from_nat(position)),
324      Core.checked_observe(output, before, U32.from_nat(position)), Some{value},
325      Pair.snd(Core.ObservationChecked(Core.Packed{output, after}, U32.from_nat(position)),
326        {Core.checked_observe(output, after, U32.from_nat(position)) == Core.checked_observe(output, before, U32.from_nat(position)) : Maybe<&2, F32>},
327        frame(U32.from_nat(position), checked, checked_different(position, cursor, word_exact, cursor_exact, earlier))), observed)}

Uses (20)

Used by (1)