def left_below

bendtorch-core@0.1.0.0 · src/tensor/contracts/binary_build_proof.bend:158

import bendtorch-core@0.1.0.0/src/tensor/contracts/binary_build_proof.bend as BinaryBuildProof
import Base
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape
import bendtorch-core@0.1.0.0/src/tensor/elementwise.bend as Elementwise
import bendtorch-core@0.1.0.0/src/tensor/contracts/broadcast.bend as Broadcast
import bendtorch-core@0.1.0.0/src/tensor/contracts/broadcast_proof.bend as BroadcastProof

158def left_below(+plan: Shape.BroadcastPlan, +count: Nat, +nl: Nat, +position: Nat,
159  +count_exact: {count == Shape.logical_numel(Shape.dimensions(Shape.output_shape(plan))) : Nat},
160  +left_count: {nl == Shape.logical_numel(Shape.dimensions(Shape.left_shape(plan))) : Nat},
161  +decided: {True{} == Nat.is_lt(position, count) : Bool}) ->
162  {Nat.is_lt(U32.to_nat(left_index(plan, position)), nl) == True{} : Bool}:
163  word_below(Shape.left_shape(plan), nl, Elementwise.left_walk(Shape.extents(Shape.left_shape(plan)), Shape.extents(Shape.right_shape(plan)), Shape.extents(Shape.output_shape(plan)), Shape.index_map(plan), position), left_count,
164    %Equal.sym(Nat, Elementwise.left_walk(Shape.extents(Shape.left_shape(plan)), Shape.extents(Shape.right_shape(plan)), Shape.extents(Shape.output_shape(plan)), Shape.index_map(plan), position), Broadcast.left_walk(Shape.extents(Shape.left_shape(plan)), Shape.extents(Shape.right_shape(plan)), Shape.extents(Shape.output_shape(plan)), Shape.index_map(plan), position), walk_left_same(Shape.extents(Shape.left_shape(plan)), Shape.extents(Shape.right_shape(plan)), Shape.extents(Shape.output_shape(plan)), Shape.index_map(plan), position)) : {Nat.is_lt(_, Shape.logical_numel(Shape.dimensions(Shape.left_shape(plan)))) == True{} : Bool}
165    BroadcastProof.left_walk_bound(plan, Shape.index_map(plan), position, output_below(plan, count, position, count_exact, decided)))

Uses (20)

Used by (1)