def natural_decided_success

bendtorch-core@0.1.0.0 · src/tensor/transform_PROOF.bend:1861

import bendtorch-core@0.1.0.0/src/tensor/transform_PROOF.bend as TransformPROOF
import Base
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape
import bendtorch-core@0.1.0.0/src/tensor/layout.bend as Layout
import bendtorch-core@0.1.0.0/src/tensor/transform_LAWS.bend as Laws
import bendtorch-core@0.1.0.0/src/tensor/core.bend as Core
import bendtorch-core@0.1.0.0/src/tensor/transforms.bend as Transforms
import bendtorch-core@0.1.0.0/src/storage/arith.bend as Arith
import bendtorch-core@0.1.0.0/src/tensor/transform_totality.bend as Totality
import bendtorch-core@0.1.0.0/src/tensor/permutation_mapping.bend as Mapping

1861def natural_decided_success(+input: Shape.Shape, +axes: List<&2, U32>, +plan: Layout.Plan<input, axes>, +cursor: Nat, +index: U32,
1862  decision: Shape.BoolCase<Nat.is_eq(U32.to_nat(index), cursor)>, source: Core.Tensor<input>, target: Core.Tensor<Layout.output(input, axes, plan)>,
1863  -candidate: {index == U32.from_nat(cursor) : U32}, -word_exact: {U32.to_nat(index) == cursor : Nat},
1864  +inside: {True{} == U32.is_lt(index, Shape.count(Layout.output(input, axes, plan))) : Bool}) ->
1865  Totality.NaturalSuccess<input, axes, plan, cursor, Transforms.natural_decided(input, axes, plan, cursor, index, source, target, candidate, decision)>:
1866  match decision:
1867    case Shape.BFalse{equal}:
1868      Totality.NaturalSuccess{Empty.absurd({False{} == True{} : Bool},
1869        Arith.clash(Equal.trans(Bool, False{}, Nat.is_eq(U32.to_nat(index), cursor), True{}, equal, Mapping.natural_equal_true(U32.to_nat(index), cursor, word_exact))))}
1870    case Shape.BTrue{equal}:
1871      Totality.NaturalSuccess{
1872        {\{Totality.CopyStepSuccess: successful => successful} :
1873          Totality.CopyStepSuccess<input, axes, plan, source, target, index> ->
1874            {Totality.copy_succeeded(input, axes, plan, Transforms.copy_step(input, axes, plan, source, target, index)) == True{} : Bool}}(
1875              Laws.copy_step_valid_success(input, axes, plan, source, target, index, inside))}

Uses (24)

Used by (1)