def prefix_previous

bendtorch-core@0.1.0.0 · src/tensor/core_PROOF.bend:757

import bendtorch-core@0.1.0.0/src/tensor/core_PROOF.bend as CorePROOF
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/elementwise.bend as Elementwise

757def prefix_previous(+operation: Elementwise.Operation, +plan: Shape.BroadcastPlan,
758  -original_left: Core.Dynamic, -original_right: Core.Dynamic, +cursor: Nat, +index: U32,
759  -before: Core.Tensor<Shape.output_shape(plan)>, -after: Core.Tensor<Shape.output_shape(plan)>,
760  converted: {U32.to_nat(index) == cursor : Nat},
761  prefix: Elementwise.PrefixInvariant(operation, plan, original_left, original_right, cursor, Core.Packed{Shape.output_shape(plan), before}),
762  frame: @+other: U32 -> @checked: Core.ObservationChecked(Core.Packed{Shape.output_shape(plan), before}, other) ->
763    @different: {Nat.is_eq(U32.to_nat(index), U32.to_nat(other)) == False{} : Bool} ->
764      Core.ObservationChecked(Core.Packed{Shape.output_shape(plan), after}, other) &
765        {Core.observe(Shape.output_shape(plan), after, other) == Core.observe(Shape.output_shape(plan), before, other) : Maybe<&2, F32>},
766  +other: U32, +earlier: Shape.LT(U32.to_nat(other), cursor)) ->
767  Core.ObservationChecked(Core.Packed{Shape.output_shape(plan), after}, other) &
768    {Core.observe(Shape.output_shape(plan), after, other) == Elementwise.expected(operation, plan, original_left, original_right, other) : Maybe<&2, F32>}:
769  {\{Tuple: before_checked => before_equal =>
770    {\{Tuple: after_checked => after_equal => (after_checked,
771      Equal.trans(Maybe<&2, F32>, Core.observe(Shape.output_shape(plan), after, other), Core.observe(Shape.output_shape(plan), before, other),
772        Elementwise.expected(operation, plan, original_left, original_right, other), after_equal, before_equal))} :
773      (Core.ObservationChecked(Core.Packed{Shape.output_shape(plan), after}, other) &
774        {Core.observe(Shape.output_shape(plan), after, other) == Core.observe(Shape.output_shape(plan), before, other) : Maybe<&2, F32>}) ->
775      (Core.ObservationChecked(Core.Packed{Shape.output_shape(plan), after}, other) &
776        {Core.observe(Shape.output_shape(plan), after, other) == Elementwise.expected(operation, plan, original_left, original_right, other) : Maybe<&2, F32>})}(frame(other)(before_checked)(
777          %Equal.sym(Nat, U32.to_nat(index), cursor, converted) : {Nat.is_eq(_, U32.to_nat(other)) == False{} : Bool}
778          lt_big_small_different(U32.to_nat(other), cursor, earlier)))
779  } :
780    (Core.ObservationChecked(Core.Packed{Shape.output_shape(plan), before}, other) &
781      {Core.observe(Shape.output_shape(plan), before, other) == Elementwise.expected(operation, plan, original_left, original_right, other) : Maybe<&2, F32>}) ->
782    (Core.ObservationChecked(Core.Packed{Shape.output_shape(plan), after}, other) &
783      {Core.observe(Shape.output_shape(plan), after, other) == Elementwise.expected(operation, plan, original_left, original_right, other) : Maybe<&2, F32>})}(prefix(other)(earlier))

Uses (22)

Used by (1)