def allocated_success

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

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
import bendtorch-core@0.1.0.0/src/tensor/transform_PROOF.bend as TransformProof
import bendtorch-core@0.1.0.0/src/tensor/word_conversion.bend as Conversion
import bendtorch-core@0.1.0.0/src/tensor/allocation_spec.bend as Allocation

837def allocated_success(+operation: Elementwise.Operation, +plan: Shape.BroadcastPlan, left: Core.Dynamic, right: Core.Dynamic,
838  result: Result<&2, &1, Core.Error, Core.Tensor<Shape.output_shape(plan)>>,
839  -fits: FittingSources<plan, left, right>, -done: Allocation.TensorDone<Shape.output_shape(plan), result>) ->
840  Totality.Success<Elementwise.allocated(operation, plan, left, right, result)>:
841  match result:
842    case Fail{error}:
843      Totality.Success{Empty.absurd({False{} == True{} : Bool},
844        {\{Allocation.TensorDone: tensor => same => Arith.clash(Equal.cong(Result<&2, &1, Core.Error, Core.Tensor<Shape.output_shape(plan)>>, Bool,
845          result => Result.is_done(&2, &1, Core.Error, Core.Tensor<Shape.output_shape(plan)>, result), Fail{error}, Done{tensor},
846          Equal.sym(Result<&2, &1, Core.Error, Core.Tensor<Shape.output_shape(plan)>>, Done{tensor}, Fail{error}, same)))} :
847          Allocation.TensorDone<Shape.output_shape(plan), Fail{error}> -> Empty}(done))}
848    case Done{output}:
849      loop_success(Shape.elements(Shape.output_shape(plan)), operation, plan, 0n, Elementwise.State{left, right, output}, fits,
850        %Equal.sym(Nat, Nat.add(Shape.elements(Shape.output_shape(plan)), 0n), Shape.elements(Shape.output_shape(plan)), TransformProof.add_zero_right(Shape.elements(Shape.output_shape(plan)))) :
851          {Nat.is_le(_, Shape.elements(Shape.output_shape(plan))) == True{} : Bool}
852        Conversion.le_reflexive(Shape.elements(Shape.output_shape(plan))))

Uses (26)

Used by (0)

No other definition uses this definition.