def right_inside

bendtorch-core@0.1.0.0 · src/tensor/contracts/broadcast_proof.bend:72

import bendtorch-core@0.1.0.0/src/tensor/contracts/broadcast_proof.bend as BroadcastProof
import Base
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape
import bendtorch-core@0.1.0.0/src/tensor/word_conversion.bend as Conversion
import bendtorch-core@0.1.0.0/src/tensor/contracts/pointwise.bend as Pointwise
import bendtorch-core@0.1.0.0/src/tensor/contracts/broadcast.bend as Broadcast

72def right_inside(+plan: Shape.BroadcastPlan, +count: Nat,
73  +room: {Nat.is_le(count, Shape.logical_numel(Shape.dimensions(Shape.output_shape(plan)))) == True{} : Bool}) ->
74  {Pointwise.inside(~Shape.BroadcastPlan, ~Broadcast.right_map, plan, count, Shape.logical_numel(Shape.dimensions(Shape.right_shape(plan)))) == True{} : Bool}:
75  match count:
76    case 0n:
77      {==}
78    case 1n+previous:
79      +total = Shape.logical_numel(Shape.dimensions(Shape.output_shape(plan)))
80      +bound = Shape.logical_numel(Shape.dimensions(Shape.right_shape(plan)))
81      %Equal.sym(Bool, Pointwise.inside(~Shape.BroadcastPlan, ~Broadcast.right_map, plan, previous, bound), True{},
82        right_inside(plan, previous, Conversion.le_predecessor(previous, total, room))) :
83        {Bool.and(_, Nat.is_lt(Broadcast.right_map(plan, previous), bound)) == True{} : Bool}
84      %Equal.sym(Bool, Nat.is_lt(Broadcast.right_map(plan, previous), bound), True{},
85        right_walk_bound(plan, Shape.index_map(plan), previous, Conversion.le_successor_lt(previous, total, room))) :
86        {Bool.and(True{}, _) == True{} : Bool}
87      {==}

Uses (17)

Used by (1)