def plan_unique_success
bendtorch-core@0.1.0.0 · src/tensor/permutation_mapping.bend:276
import bendtorch-core@0.1.0.0/src/tensor/permutation_mapping.bend as PermutationMapping
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/storage/arith.bend as Arith
276def plan_unique_success(+input: Shape.Shape, +axes: List<&2, U32>, decision: Shape.BoolCase<Layout.unique(axes)>,
277 +valid: {True{} == Layout.bijective(input, axes) : Bool}) ->
278 {Result.is_done(&2, &2, Layout.Error, Layout.Plan<input, axes>, Layout.plan_unique(input, axes, decision)) == True{} : Bool}:
279 match decision:
280 case Shape.BFalse{equal}:
281 Empty.absurd({False{} == True{} : Bool},
282 Arith.clash(Equal.trans(Bool, False{}, Layout.unique(axes), True{}, equal,
283 Equal.sym(Bool, True{}, Layout.unique(axes),
284 and_right(Layout.bounded(axes, Shape.rank(input)), Layout.unique(axes),
285 and_right(Nat.is_eq(Shape.rank_dimensions(axes), Shape.rank_dimensions(Shape.dimensions(input))),
286 Bool.and(Layout.bounded(axes, Shape.rank(input)), Layout.unique(axes)), valid))))))
287 case Shape.BTrue{equal}:
288 plan_decided_success(input, axes, Shape.bool_case(Layout.bijective(input, axes)), valid)