def step_right_success

bendtorch-core@0.1.0.0 · src/tensor/elementwise_PROOF.bend:663

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/storage/arith.bend as Arith
import bendtorch-core@0.1.0.0/src/tensor/transform_PROOF.bend as TransformProof
import bendtorch-core@0.1.0.0/src/tensor/transform_totality.bend as TransformTotality

663def step_right_success(+operation: Elementwise.Operation, +shape: Shape.Shape, +index: U32,
664  left: Core.Dynamic, output: Core.Tensor<shape>, left_value: F32, pair: Core.Dynamic & Result<&2, &2, Core.Error, F32>,
665  -successful: {dynamic_read_succeeded(pair) == True{} : Bool},
666  -inside: {Nat.is_lt(U32.to_nat(index), Shape.logical_numel(Shape.dimensions(shape))) == True{} : Bool}) ->
667  StepSuccess<shape, Elementwise.step_right(operation, shape, index, left, output, left_value, pair)>:
668  (right, result) = pair
669  match result:
670    case Fail{error}:
671      StepSuccess{Empty.absurd({False{} == True{} : Bool}, Arith.clash(successful))}
672    case Done{+value}:
673      step_write_success(shape, left, right, Core.write_flat(shape, output, index, Elementwise.scalar(operation, left_value, value)),
674        {\{TransformTotality.WriteSuccess: successful => successful} :
675          TransformTotality.WriteSuccess<shape, output, index, Elementwise.scalar(operation, left_value, value)> ->
676          {TransformTotality.write_succeeded(shape, Core.write_flat(shape, output, index, Elementwise.scalar(operation, left_value, value))) == True{} : Bool}}(
677            TransformProof.tensor_write_success(shape, output, index, Elementwise.scalar(operation, left_value, value), inside)))

Uses (26)

Used by (1)