def index_bounded
bendtorch-core@0.1.0.0 · src/tensor/permute_build_proof.bend:215
import bendtorch-core@0.1.0.0/src/tensor/permute_build_proof.bend as PermuteBuildProof
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/storage/arith.bend as Arith
215def index_bounded(+shape: Shape.Shape, +index: U32,
216 +inside: {Nat.is_lt(U32.to_nat(index), Shape.logical_numel(Shape.dimensions(shape))) == True{} : Bool}) ->
217 {True{} == U32.is_lt(index, Shape.count(shape)) : Bool}:
218 %Arith.u32_lt(index, Shape.count(shape)) : {True{} == _ : Bool}
219 %Equal.sym(Nat, U32.to_nat(Shape.count(shape)), Shape.elements(shape), Conversion.shape_count_exact(shape)) : {True{} == Nat.is_lt(U32.to_nat(index), _) : Bool}
220 %Equal.sym(Nat, Shape.elements(shape), Shape.logical_numel(Shape.dimensions(shape)), Shape.elements_exact(shape)) : {True{} == Nat.is_lt(U32.to_nat(index), _) : Bool}
221 Equal.sym(Bool, Nat.is_lt(U32.to_nat(index), Shape.logical_numel(Shape.dimensions(shape))), True{}, inside)