def loop_finish_success
bendtorch-core@0.1.0.0 · src/tensor/elementwise_PROOF.bend:791
import bendtorch-core@0.1.0.0/src/tensor/elementwise_PROOF.bend as ElementwisePROOF
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
import bendtorch-core@0.1.0.0/src/tensor/elementwise_totality.bend as Totality
import bendtorch-core@0.1.0.0/src/storage/arith.bend as Arith
791def loop_finish_success(+fuel: Nat, +operation: Elementwise.Operation, +plan: Shape.BroadcastPlan, +cursor: Nat,
792 -before_left: Core.Dynamic, -before_right: Core.Dynamic,
793 result: Elementwise.NaturalStep<Shape.output_shape(plan), cursor>,
794 -successful: {natural_succeeded(Shape.output_shape(plan), cursor, result) == True{} : Bool},
795 -sources: NaturalSources<Shape.output_shape(plan), cursor, before_left, before_right, result>,
796 -fits: FittingSources<plan, before_left, before_right>,
797 -rec: @state: Elementwise.State<Shape.output_shape(plan)> ->
798 @-next_fits: FittingSources<plan, step_left_owner(Shape.output_shape(plan), Elementwise.Continue{state}), step_right_owner(Shape.output_shape(plan), Elementwise.Continue{state})> ->
799 Totality.Success<Elementwise.loop(fuel, operation, plan, 1n+cursor, state)>) ->
800 Totality.Success<Elementwise.finish_step(Shape.output_shape(plan), cursor, state => Elementwise.loop(fuel, operation, plan, 1n+cursor, state), result)>:
801 match result:
802 case Elementwise.NaturalStop{left, right, error}:
803 Totality.Success{Empty.absurd({False{} == True{} : Bool}, Arith.clash(successful))}
804 case Elementwise.NaturalContinue{state, index, exact}:
805 success_reify(Elementwise.loop(fuel, operation, plan, 1n+cursor, state),
806 rec(state)(retained_fits(plan, before_left, before_right,
807 step_left_owner(Shape.output_shape(plan), Elementwise.Continue{state}), step_right_owner(Shape.output_shape(plan), Elementwise.Continue{state}),
808 {\{NaturalSources: l => r => l} : NaturalSources<Shape.output_shape(plan), cursor, before_left, before_right, Elementwise.NaturalContinue{state, index, exact}> ->
809 Totality.SameSource(before_left, step_left_owner(Shape.output_shape(plan), Elementwise.Continue{state}))}(sources),
810 {\{NaturalSources: l => r => r} : NaturalSources<Shape.output_shape(plan), cursor, before_left, before_right, Elementwise.NaturalContinue{state, index, exact}> ->
811 Totality.SameSource(before_right, step_right_owner(Shape.output_shape(plan), Elementwise.Continue{state}))}(sources), fits)))