def output_offset

bendtorch-core@0.1.0.0 · src/tensor/elementwise_parallel_proof.bend:422

import bendtorch-core@0.1.0.0/src/tensor/elementwise_parallel_proof.bend as ElementwiseParallelProof
import Base
import bendtorch-core@0.1.0.0/src/storage/model.bend as Model
import bendtorch-core@0.1.0.0/src/storage/refinement.bend as Refinement
import bendtorch-core@0.1.0.0/src/storage/arith.bend as Arith
import bendtorch-core@0.1.0.0/src/storage/main.bend as Storage
import bendtorch-core@0.1.0.0/src/storage/route.bend as Route

422def output_offset(+depth: Nat, +length: Nat, +index: U32, +valid: {Storage.bounds(depth, length) == True{} : Bool},
423  +inside: {Nat.is_lt(U32.to_nat(index), length) == True{} : Bool}) ->
424  {U32.to_nat(index) == Model.offset(depth, Refinement.route(depth, index)) : Nat}:
425  +rest = Arith.and_right(Nat.is_le(depth, 20n), Bool.and(Nat.is_lt(0n, length), Nat.is_le(length, Model.capacity(depth))), valid)
426  Route.route_offset(depth, index,
427    Arith.and_left(Nat.is_le(depth, 20n), Bool.and(Nat.is_lt(0n, length), Nat.is_le(length, Model.capacity(depth))), valid),
428    Arith.lt_le_trans(U32.to_nat(index), length, Model.capacity(depth), inside,
429      Arith.and_right(Nat.is_lt(0n, length), Nat.is_le(length, Model.capacity(depth)), rest)))

Uses (15)

Used by (1)