src/autograd/reduce_replayed_proof.bend open laws/TODOs
raw source on the hub · import bendtorch-core@0.1.0.0/src/autograd/reduce_replayed_proof.bend as Reduce_replayed_proof
32 imports
import Base import ../shape/core.bend as Shape import ../storage/model.bend as Model import ../storage/main.bend as Storage import ../storage/LAWS.bend as StorageLaws import ../storage/refinement.bend as Refinement import ../storage/arith.bend as Arith import ../storage/array.bend as ArrayCore import ../storage/api.bend as Api import ../storage/certificates.bend as Certificates import ../storage/route.bend as Route import ../shape/index_proofs.bend as Index import ../shape/nat_proofs.bend as Nats import ../tensor/core.bend as Core import ../tensor/lifecycle.bend as Lifecycle import ../tensor/elementwise.bend as Elementwise import ../tensor/word_conversion.bend as Conversion import ../tensor/read_contract.bend as Reads import ../tensor/from_values_contract.bend as FromValues import ../tensor/matrix_index_proof.bend as MatrixIndex import ../tensor/contracts/replayed.bend as Replayed import ../tensor/contracts/pointwise_proof.bend as PointwiseProof import ../tensor/contracts/LAWS.bend as Laws import ../tensor/contracts/binary_storage_proof.bend as Owned import ../tensor/contracts/binary_build_proof.bend as Build import ../tensor/contracts/matmul_parallel_proof.bend as Par import ../tensor/matmul.bend as Matrix import ../tensor/parallel.bend as Parallel import ./reduce.bend as Reduce import ./reduce_LAWS.bend as ReduceLaws import ./reduce_fiber_proof.bend as Fiber import ./reduce_parallel_proof.bend as ReduceParallel
Types
type Facts source · line 710 · raw
@-plan:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.BroadcastPlan -> @-shape:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @-count:Nat -> Data
What the cells of the build need from the plan: the target is the plan's
left shape, with count cells, and the contribution is its right shape.
Facts@-plan:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.BroadcastPlan -> @-shape:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @-count:Nat -> @count_left:{count == 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.numel(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.left_shape(plan))) : Nat} -> @right:{0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.dimensions(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.right_shape(plan)) == 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.dimensions(shape) : List<&2, U32>} -> Facts<plan, shape, count>
Definitions
def PlanMap source · line 39 · raw
@+plan:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.BroadcastPlan -> Data
def rfold source · line 43 · raw
@+shape:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+fill:F32 -> @+ops:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/LAWS.Op> -> @positions:List<&2, Nat> -> @accumulator:F32 -> F32
The replayed words at a list of offsets, added in order.
def map_word source · line 50 · raw
@+plan:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.BroadcastPlan -> @map:PlanMap(plan) -> @+shape:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+fill:F32 -> @+ops:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/LAWS.Op> -> @+position:Nat -> F32
def cell_word source · line 57 · raw
@+plan:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.BroadcastPlan -> @+map:PlanMap(plan) -> @+shape:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+fill:F32 -> @+ops:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/LAWS.Op> -> @+position:Nat -> F32
def writes source · line 60 · raw
@+plan:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.BroadcastPlan -> @+map:PlanMap(plan) -> @+shape:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+fill:F32 -> @+ops:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/LAWS.Op> -> @+count:Nat -> List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/LAWS.Op>
def writes_value source · line 68 · raw
@+plan:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.BroadcastPlan -> @+map:PlanMap(plan) -> @+shape:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+fill:F32 -> @+ops:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/LAWS.Op> -> @+output:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+count:Nat -> @+index:U32 -> @below:{Nat.is_lt(U32.to_nat(index), count) == True{} : Bool} -> @+room:{Nat.is_le(count, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.logical_numel(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.dimensions(output))) == True{} : Bool} -> {0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/contracts/replayed.value(output, 0.0, writes(plan, map, shape, fill, ops, count), index) == cell_word(plan, map, shape, fill, ops, U32.to_nat(index)) : F32}
def lt_not_eq source · line 89 · raw
@+a:Nat -> @+b:Nat -> @below:{Nat.is_lt(a, b) == True{} : Bool} -> {Nat.is_eq(a, b) == False{} : Bool}
def write_skip source · line 101 · raw
@+shape:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+previous:Nat -> @+index:U32 -> @+word:F32 -> @+old:F32 -> @+room:{Nat.is_lt(previous, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.logical_numel(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.dimensions(shape))) == True{} : Bool} -> @later:{Nat.is_lt(previous, U32.to_nat(index)) == True{} : Bool} -> {0x1689e5deb278c16abd3bd45eac101ef3/src/storage/LAWS.latest(U32.to_nat(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.count(shape)), 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/LAWS.Write{U32.from_nat(previous), word}, index, old) == old : F32}A write at an index below index leaves the word at index.
def writes_zero source · line 114 · raw
@+plan:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.BroadcastPlan -> @+map:PlanMap(plan) -> @+shape:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+fill:F32 -> @+ops:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/LAWS.Op> -> @+output:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+count:Nat -> @+index:U32 -> @+above:{Nat.is_le(count, U32.to_nat(index)) == True{} : Bool} -> @+room:{Nat.is_le(count, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.logical_numel(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.dimensions(output))) == True{} : Bool} -> {0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/contracts/replayed.value(output, 0.0, writes(plan, map, shape, fill, ops, count), index) == 0.0 : F32}At or above the count, the writes leave the +0.0 fill.
def lt_zero_false source · line 137 · raw
@+x:Nat -> {Nat.is_lt(x, 0n) == False{} : Bool}
def lt_self_succ source · line 144 · raw
@+k:Nat -> {Nat.is_lt(k, 1n+k) == True{} : Bool}
def lt_succ_right source · line 151 · raw
@+b:Nat -> @+k:Nat -> @h:{Nat.is_lt(b, k) == True{} : Bool} -> {Nat.is_lt(b, 1n+k) == True{} : Bool}
def above_false source · line 161 · raw
@+k:Nat -> @+b:Nat -> @h:{Nat.is_lt(k, b) == True{} : Bool} -> {Nat.is_lt(b, 1n+k) == False{} : Bool}k < b gives b < 1 + k false.
def lt_asym source · line 172 · raw
@+k:Nat -> @+b:Nat -> @h:{Nat.is_lt(k, b) == True{} : Bool} -> {Nat.is_lt(b, k) == False{} : Bool}
def below_true source · line 184 · raw
@+b:Nat -> @+k:Nat -> @h:{Nat.is_le(1n+b, k) == True{} : Bool} -> {Nat.is_lt(b, k) == True{} : Bool}1 + b <= k gives b < k.
def lt_add_right source · line 195 · raw
@+a:Nat -> @+c:Nat -> @+b:Nat -> @h:{Nat.is_lt(a, c) == True{} : Bool} -> {Nat.is_lt(Nat.add(a, b), Nat.add(c, b)) == True{} : Bool}
def le_add_cong source · line 207 · raw
@+c:Nat -> @+x:Nat -> @+y:Nat -> @h:{Nat.is_le(x, y) == True{} : Bool} -> {Nat.is_le(Nat.add(c, x), Nat.add(c, y)) == True{} : Bool}
def le_trans source · line 215 · raw
@+a:Nat -> @+b:Nat -> @+c:Nat -> @ab:{Nat.is_le(a, b) == True{} : Bool} -> @bc:{Nat.is_le(b, c) == True{} : Bool} -> {Nat.is_le(a, c) == True{} : Bool}
def position_step source · line 227 · raw
@+capacity:Nat -> @+offset:Nat -> @+base:Nat -> {Nat.add(offset, Nat.add(capacity, base)) == Nat.add(Nat.add(capacity, offset), base) : Nat}
def add_zero_right source · line 232 · raw
@+number:Nat -> {Nat.add(number, 0n) == number : Nat}
def output_position source · line 240 · raw
@+depth:Nat -> @+length:Nat -> @+index:U32 -> @+valid:{0x1689e5deb278c16abd3bd45eac101ef3/src/storage/main.bounds(depth, length) == True{} : Bool} -> @+inside:{Nat.is_lt(U32.to_nat(index), length) == True{} : Bool} -> {Nat.add(0x1689e5deb278c16abd3bd45eac101ef3/src/storage/model.offset(depth, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/refinement.route(depth, index)), 0n) == U32.to_nat(index) : Nat}A word index below the storage length is the offset of its own route.
def out_leaf source · line 256 · raw
@+plan:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.BroadcastPlan -> @+map:PlanMap(plan) -> @+shape:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+fill:F32 -> @+ops:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/LAWS.Op> -> @+position:Nat -> @inside:Bool -> F32
def out_spec source · line 263 · raw
@+plan:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.BroadcastPlan -> @+map:PlanMap(plan) -> @+shape:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+fill:F32 -> @+ops:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/LAWS.Op> -> @+count:Nat -> @+depth:Nat -> @+base:Nat -> Array<F32>
def out_balanced source · line 270 · raw
@+plan:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.BroadcastPlan -> @+map:PlanMap(plan) -> @+shape:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+fill:F32 -> @+ops:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/LAWS.Op> -> @+count:Nat -> @+depth:Nat -> @+base:Nat -> 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/model.Balanced(F32, depth, out_spec(plan, map, shape, fill, ops, count, depth, base))
def new_spec source · line 277 · raw
@+plan:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.BroadcastPlan -> @+map:PlanMap(plan) -> @+shape:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+fill:F32 -> @+ops:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/LAWS.Op> -> @+depth:Nat -> @+base:Nat -> {Array.new(F32, depth, 0.0) == out_spec(plan, map, shape, fill, ops, 0n, depth, base) : Array<F32>}
def above source · line 292 · raw
@+plan:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.BroadcastPlan -> @+map:PlanMap(plan) -> @+shape:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+fill:F32 -> @+ops:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/LAWS.Op> -> @+k:Nat -> @+depth:Nat -> @+b:Nat -> @+h:{Nat.is_lt(k, b) == True{} : Bool} -> {out_spec(plan, map, shape, fill, ops, k, depth, b) == out_spec(plan, map, shape, fill, ops, 1n+k, depth, b) : Array<F32>}A subtree whose positions all lie above k is the same for k and 1 + k.
def below source · line 311 · raw
@+plan:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.BroadcastPlan -> @+map:PlanMap(plan) -> @+shape:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+fill:F32 -> @+ops:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/LAWS.Op> -> @+k:Nat -> @+depth:Nat -> @+b:Nat -> @+h:{Nat.is_le(Nat.add(0x1689e5deb278c16abd3bd45eac101ef3/src/storage/model.capacity(depth), b), k) == True{} : Bool} -> {out_spec(plan, map, shape, fill, ops, k, depth, b) == out_spec(plan, map, shape, fill, ops, 1n+k, depth, b) : Array<F32>}A subtree whose positions all lie below k is the same for k and 1 + k.
def write_spec source · line 335 · raw
@+plan:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.BroadcastPlan -> @+map:PlanMap(plan) -> @+shape:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+fill:F32 -> @+ops:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/LAWS.Op> -> @+k:Nat -> @+depth:Nat -> @+base:Nat -> @+path:0x1689e5deb278c16abd3bd45eac101ef3/src/storage/model.Path(depth) -> @+h:{Nat.add(0x1689e5deb278c16abd3bd45eac101ef3/src/storage/model.offset(depth, path), base) == k : Nat} -> {0x1689e5deb278c16abd3bd45eac101ef3/src/storage/array.write_path(F32, depth, out_spec(plan, map, shape, fill, ops, k, depth, base), path, cell_word(plan, map, shape, fill, ops, k)) == out_spec(plan, map, shape, fill, ops, 1n+k, depth, base) : Array<F32>}Writing cell k at the path whose position is k turns the spec for k into the spec for 1 + k.
def chain source · line 380 · raw
@+plan:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.BroadcastPlan -> @+map:PlanMap(plan) -> @+shape:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+fill:F32 -> @+ops:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/LAWS.Op> -> @+d:Nat -> @+n:Nat -> @-f:{0x1689e5deb278c16abd3bd45eac101ef3/src/storage/main.bounds(d, n) == True{} : Bool} -> @+fits:{0x1689e5deb278c16abd3bd45eac101ef3/src/storage/main.bounds(d, n) == True{} : Bool} -> @+limit:U32 -> @+n_limit:{Nat.is_le(n, U32.to_nat(limit)) == True{} : Bool} -> @+k:Nat -> @+room:{Nat.is_le(k, n) == True{} : Bool} -> {0x1689e5deb278c16abd3bd45eac101ef3/src/storage/LAWS.replay(writes(plan, map, shape, fill, ops, k), 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/main.Owned{d, n, Array.new(F32, d, 0.0), 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/array.new_balanced(F32, d, 0.0), f}) == 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/main.Owned{d, n, out_spec(plan, map, shape, fill, ops, k, d, 0n), out_balanced(plan, map, shape, fill, ops, k, d, 0n), f} : 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/main.Storage}The family history, replayed on the owned storage that created makes,
is the owned storage that holds the output spec.
def below_front source · line 422 · raw
@+xs:List<&2, Nat> -> @+ys:List<&2, Nat> -> @+bound:Nat -> @+h:{0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce_parallel_proof.all_below(List.append(&2, Nat, xs, ys), bound) == True{} : Bool} -> {0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce_parallel_proof.all_below(xs, bound) == True{} : Bool}
def below_back source · line 434 · raw
@+xs:List<&2, Nat> -> @+ys:List<&2, Nat> -> @+bound:Nat -> @+h:{0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce_parallel_proof.all_below(List.append(&2, Nat, xs, ys), bound) == True{} : Bool} -> {0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce_parallel_proof.all_below(ys, bound) == True{} : Bool}
def rfold_append source · line 443 · raw
@+shape:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+fill:F32 -> @+ops:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/LAWS.Op> -> @+xs:List<&2, Nat> -> @+ys:List<&2, Nat> -> @+accumulator:F32 -> {rfold(shape, fill, ops, List.append(&2, Nat, xs, ys), accumulator) == rfold(shape, fill, ops, ys, rfold(shape, fill, ops, xs, accumulator)) : F32}
def leaf_eq source · line 451 · raw
@+base:Nat -> @+accumulator:F32 -> @+shape:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+fill:F32 -> @+ops:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/LAWS.Op> -> @+h:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/api.Effect> -> @+d:Nat -> @+f:F32 -> @+source:0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/contracts/matmul_parallel_proof.Source<shape, fill, ops, h, d, f> -> @+below:{Nat.is_lt(base, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.logical_numel(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.dimensions(shape))) == True{} : Bool} -> @pair:Pair(Array<F32>, F32) -> @+exact:{pair == Array.get(F32, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/api.arr(h, d, f), U32.from_nat(base)) : Pair(Array<F32>, F32)} -> {0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.leaf_add(accumulator, pair) == (rfold(shape, fill, ops, [base], accumulator), 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/api.arr(h, d, f)) : Pair(F32, Array<F32>)}
def next_eq source · line 463 · raw
@-rec:(@_:F32 -> @_:Array<F32> -> Pair(F32, Array<F32>)) -> @-low:Pair(F32, Array<F32>) -> @-value:F32 -> @-array:Array<F32> -> @+first:{low == (value, array) : Pair(F32, Array<F32>)} -> {0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.walk_next(rec, low) == rec(value, array) : Pair(F32, Array<F32>)}
def fiber_eq source · line 468 · raw
@+rows:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Row> -> @+extents:List<&2, Nat> -> @+fuel:Nat -> @+target:Nat -> @+base:Nat -> @+digit:Nat -> @+accumulator:F32 -> @+shape:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+fill:F32 -> @+ops:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/LAWS.Op> -> @+h:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/api.Effect> -> @+d:Nat -> @+f:F32 -> @+source:0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/contracts/matmul_parallel_proof.Source<shape, fill, ops, h, d, f> -> @+below:{0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce_parallel_proof.all_below(0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce_fiber_proof.visited(rows, extents, fuel, target, base, digit), 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.logical_numel(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.dimensions(shape))) == True{} : Bool} -> {0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.fiber(rows, extents, fuel, target, base, digit, accumulator, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/api.arr(h, d, f)) == (rfold(shape, fill, ops, 0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce_fiber_proof.visited(rows, extents, fuel, target, base, digit), accumulator), 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/api.arr(h, d, f)) : Pair(F32, Array<F32>)}
def eta source · line 510 · raw
@pair:Pair(Array<F32>, F32) -> {pair == (0x1689e5deb278c16abd3bd45eac101ef3/src/storage/refinement.first(F32, pair), 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/refinement.second(F32, pair)) : Pair(Array<F32>, F32)}The facts of ReduceParallel.fast_fiber, stated for the replayed arrays
Api.arr, which a proof can name as often as it needs: a read of
Api.arr(h, d, f) hands back that array, next to the word it read.
def got source · line 515 · raw
@+h:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/api.Effect> -> @+d:Nat -> @+f:F32 -> @+i:U32 -> {Array.get(F32, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/api.arr(h, d, f), i) == (0x1689e5deb278c16abd3bd45eac101ef3/src/storage/api.arr(h, d, f), 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/refinement.second(F32, Array.get(F32, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/api.arr(h, d, f), i))) : Pair(Array<F32>, F32)}
def single_arr source · line 525 · raw
@+rows:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Row> -> @+extents:List<&2, Nat> -> @+single:{0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.single_rows(rows, extents) == True{} : Bool} -> @+target:Nat -> @+base:Nat -> @+accumulator:F32 -> @+h:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/api.Effect> -> @+d:Nat -> @+f:F32 -> {0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.fiber(rows, extents, 0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.first_span(rows, extents), target, base, 0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.first_digit(rows, target), accumulator, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/api.arr(h, d, f)) == 0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.leaf_add(accumulator, Array.get(F32, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/api.arr(h, d, f), U32.from_nat(0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.single_offset(rows, extents, target, base)))) : Pair(F32, Array<F32>)}
def word_at source · line 560 · raw
@+h:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/api.Effect> -> @+d:Nat -> @+f:F32 -> @+at:Nat -> F32
The word a strided read of Api.arr(h, d, f) gets.
def step_arr source · line 563 · raw
@+stride:Nat -> @+left:Nat -> @+right:Nat -> @+rest:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Row> -> @+extent:Nat -> @+others:List<&2, Nat> -> @+single:{0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.single_rows(rest, others) == True{} : Bool} -> @+fuel:Nat -> @+target:Nat -> @+base:Nat -> @+digit:Nat -> @+accumulator:F32 -> @+h:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/api.Effect> -> @+d:Nat -> @+f:F32 -> {0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.fiber(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Row{stride, left, right} <> rest, extent <> others, 1n+fuel, target, base, digit, accumulator, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/api.arr(h, d, f)) == 0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.fiber(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Row{stride, left, right} <> rest, extent <> others, fuel, target, base, 1n+digit, F32.add(accumulator, word_at(h, d, f, 0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.strided_offset(right, base, digit, 0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.single_offset(rest, others, Nat.mod(target, left), 0n)))), 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/api.arr(h, d, f)) : Pair(F32, Array<F32>)}
def run_arr source · line 603 · raw
@+stride:Nat -> @+left:Nat -> @+right:Nat -> @+rest:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Row> -> @+extent:Nat -> @+others:List<&2, Nat> -> @+single:{0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.single_rows(rest, others) == True{} : Bool} -> @+fuel:Nat -> @+target:Nat -> @+base:Nat -> @+digit:Nat -> @+accumulator:F32 -> @+h:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/api.Effect> -> @+d:Nat -> @+f:F32 -> {0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.strided_run(fuel, right, base, digit, 0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.single_offset(rest, others, Nat.mod(target, left), 0n), accumulator, Array.get(F32, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/api.arr(h, d, f), U32.from_nat(0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.strided_offset(right, base, digit, 0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.single_offset(rest, others, Nat.mod(target, left), 0n))))) == 0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.fiber(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Row{stride, left, right} <> rest, extent <> others, 1n+fuel, target, base, digit, accumulator, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/api.arr(h, d, f)) : Pair(F32, Array<F32>)}
def strided_arr source · line 638 · raw
@+stride:Nat -> @+left:Nat -> @+right:Nat -> @+rest:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Row> -> @+extent:Nat -> @+others:List<&2, Nat> -> @+single:{0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.single_rows(rest, others) == True{} : Bool} -> @+fuel:Nat -> @+target:Nat -> @+base:Nat -> @+digit:Nat -> @+accumulator:F32 -> @+h:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/api.Effect> -> @+d:Nat -> @+f:F32 -> {0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.strided(fuel, right, base, digit, 0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.single_offset(rest, others, Nat.mod(target, left), 0n), accumulator, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/api.arr(h, d, f)) == 0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.fiber(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Row{stride, left, right} <> rest, extent <> others, fuel, target, base, digit, accumulator, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/api.arr(h, d, f)) : Pair(F32, Array<F32>)}
def fiber_kept source · line 650 · raw
@+rows:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Row> -> @+extents:List<&2, Nat> -> @+fuel:Nat -> @+target:Nat -> @+base:Nat -> @+digit:Nat -> @+accumulator:F32 -> @+h:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/api.Effect> -> @+d:Nat -> @+f:F32 -> {0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.fiber(rows, extents, fuel, target, base, digit, accumulator, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/api.arr(h, d, f)) == (Pair.fst(F32, Array<F32>, 0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.fiber(rows, extents, fuel, target, base, digit, accumulator, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/api.arr(h, d, f))), 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/api.arr(h, d, f)) : Pair(F32, Array<F32>)}A fiber of Api.arr(h, d, f) hands that array back.
def fast_arr source · line 676 · raw
@+rows:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Row> -> @+extents:List<&2, Nat> -> @+fuel:Nat -> @single:Bool -> @+ok:0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce_parallel_proof.SingleOk(single, rows, extents) -> @+target:Nat -> @+base:Nat -> @+digit:Nat -> @+accumulator:F32 -> @+h:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/api.Effect> -> @+d:Nat -> @+f:F32 -> {0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.fiber_fast(rows, extents, fuel, single, target, base, digit, accumulator, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/api.arr(h, d, f)) == 0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.fiber(rows, extents, fuel, target, base, digit, accumulator, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/api.arr(h, d, f)) : Pair(F32, Array<F32>)}
def walk_below source · line 716 · raw
@+plan:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.BroadcastPlan -> @+rows:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Row> -> @+rows_exact:{rows == 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.index_table(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.left_shape(plan)), 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.right_shape(plan)), 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.output_shape(plan))) : List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Row>} -> @+shape:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+count:Nat -> @+facts:Facts<plan, shape, count> -> @+base:Nat -> @+inside:{Nat.is_lt(base, count) == True{} : Bool} -> {0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce_parallel_proof.all_below(0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce_parallel_proof.visited_of(rows, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.output_shape(plan)), base), 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.logical_numel(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.dimensions(shape))) == True{} : Bool}Every offset the walk of a cell below count reads lies inside the
contribution.
def TreeEq source · line 730 · raw
@+plan:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.BroadcastPlan -> @+rows:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Row> -> @+rows_exact:{rows == 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.index_table(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.left_shape(plan)), 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.right_shape(plan)), 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.output_shape(plan))) : List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Row>} -> @+shape:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+fill:F32 -> @+ops:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/LAWS.Op> -> @+h:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/api.Effect> -> @+d:Nat -> @+f:F32 -> @+count:Nat -> @+depth:Nat -> @+base:Nat -> @-result:Pair(Array<F32>, Pair(Array<F32>, Unit)) -> Type
def cell_eq source · line 737 · raw
@+plan:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.BroadcastPlan -> @+rows:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Row> -> @+rows_exact:{rows == 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.index_table(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.left_shape(plan)), 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.right_shape(plan)), 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.output_shape(plan))) : List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Row>} -> @+shape:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+fill:F32 -> @+ops:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/LAWS.Op> -> @+h:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/api.Effect> -> @+d:Nat -> @+f:F32 -> @+count:Nat -> @+source:0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/contracts/matmul_parallel_proof.Source<shape, fill, ops, h, d, f> -> @+facts:Facts<plan, shape, count> -> @+base:Nat -> @inside:Bool -> @+decided:{inside == Nat.is_lt(base, count) : Bool} -> TreeEq(plan, rows, rows_exact, shape, fill, ops, h, d, f, count, 0n, base, 0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/parallel.leaf(Pair(Array<F32>, Unit), 0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.keep(0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.cell(rows, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.output_shape(plan)), base, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/api.arr(h, d, f), inside), Unit{})))
def tree_join_eq source · line 763 · raw
@+plan:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.BroadcastPlan -> @+rows:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Row> -> @+rows_exact:{rows == 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.index_table(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.left_shape(plan)), 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.right_shape(plan)), 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.output_shape(plan))) : List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Row>} -> @+shape:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+fill:F32 -> @+ops:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/LAWS.Op> -> @+h:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/api.Effect> -> @+d:Nat -> @+f:F32 -> @+count:Nat -> @+lower:Nat -> @+base:Nat -> @-a:Array<F32> -> @high:Pair(Array<F32>, Pair(Array<F32>, Unit)) -> @ea:{a == out_spec(plan, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Indexed{rows, rows_exact}, shape, fill, ops, count, lower, base) : Array<F32>} -> @facts:TreeEq(plan, rows, rows_exact, shape, fill, ops, h, d, f, count, lower, Nat.add(0x1689e5deb278c16abd3bd45eac101ef3/src/storage/model.capacity(lower), base), high) -> TreeEq(plan, rows, rows_exact, shape, fill, ops, h, d, f, count, 1n+lower, base, 0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/parallel.join(Pair(Array<F32>, Unit), a, high))
def tree_node_eq source · line 776 · raw
@+plan:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.BroadcastPlan -> @+rows:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Row> -> @+rows_exact:{rows == 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.index_table(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.left_shape(plan)), 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.right_shape(plan)), 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.output_shape(plan))) : List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Row>} -> @+shape:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+fill:F32 -> @+ops:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/LAWS.Op> -> @+h:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/api.Effect> -> @+d:Nat -> @+f:F32 -> @+count:Nat -> @+lower:Nat -> @+base:Nat -> @low:Pair(Array<F32>, Pair(Array<F32>, Unit)) -> @facts:TreeEq(plan, rows, rows_exact, shape, fill, ops, h, d, f, count, lower, base, low) -> @next:TreeEq(plan, rows, rows_exact, shape, fill, ops, h, d, f, count, lower, Nat.add(0x1689e5deb278c16abd3bd45eac101ef3/src/storage/model.capacity(lower), base), 0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/parallel.tree(0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.Fibers, Array<F32>, Unit, 0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.cell_at, 0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.fibers(0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.Fibers{rows, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.output_shape(plan))}), lower, count, Nat.add(0x1689e5deb278c16abd3bd45eac101ef3/src/storage/model.capacity(lower), base), (0x1689e5deb278c16abd3bd45eac101ef3/src/storage/api.arr(h, d, f), Unit{}))) -> TreeEq(plan, rows, rows_exact, shape, fill, ops, h, d, f, count, 1n+lower, base, 0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/parallel.node(Array<F32>, Unit, l => r => 0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/parallel.tree(0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.Fibers, Array<F32>, Unit, 0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.cell_at, 0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.fibers(0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.Fibers{rows, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.output_shape(plan))}), lower, count, Nat.add(0x1689e5deb278c16abd3bd45eac101ef3/src/storage/model.capacity(lower), base), (l, r)), low))
def pair_join_eq source · line 796 · raw
@+plan:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.BroadcastPlan -> @+rows:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Row> -> @+rows_exact:{rows == 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.index_table(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.left_shape(plan)), 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.right_shape(plan)), 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.output_shape(plan))) : List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Row>} -> @+shape:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+fill:F32 -> @+ops:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/LAWS.Op> -> @+h:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/api.Effect> -> @+d:Nat -> @+f:F32 -> @+count:Nat -> @+base:Nat -> @x:F32 -> @high:Pair(F32, Pair(Array<F32>, Unit)) -> @ex:{[x] == out_spec(plan, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Indexed{rows, rows_exact}, shape, fill, ops, count, 0n, base) : Array<F32>} -> @leaf_facts:TreeEq(plan, rows, rows_exact, shape, fill, ops, h, d, f, count, 0n, Nat.add(1n, base), 0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/parallel.leaf(Pair(Array<F32>, Unit), high)) -> TreeEq(plan, rows, rows_exact, shape, fill, ops, h, d, f, count, 1n, base, 0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/parallel.pair_join(Pair(Array<F32>, Unit), x, high))The depth-1 tree: the leaf of cell base and the leaf of the cell after
it, which reads the state the first hands back.
def pair_eq source · line 808 · raw
@+plan:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.BroadcastPlan -> @+rows:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Row> -> @+rows_exact:{rows == 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.index_table(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.left_shape(plan)), 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.right_shape(plan)), 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.output_shape(plan))) : List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Row>} -> @+shape:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+fill:F32 -> @+ops:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/LAWS.Op> -> @+h:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/api.Effect> -> @+d:Nat -> @+f:F32 -> @+count:Nat -> @+source:0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/contracts/matmul_parallel_proof.Source<shape, fill, ops, h, d, f> -> @+facts:Facts<plan, shape, count> -> @+base:Nat -> @low:Pair(F32, Pair(Array<F32>, Unit)) -> @leaf_facts:TreeEq(plan, rows, rows_exact, shape, fill, ops, h, d, f, count, 0n, base, 0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/parallel.leaf(Pair(Array<F32>, Unit), low)) -> TreeEq(plan, rows, rows_exact, shape, fill, ops, h, d, f, count, 1n, base, 0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/parallel.pair(0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.Fibers, Array<F32>, Unit, 0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.cell_at, 0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.fibers(0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.Fibers{rows, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.output_shape(plan))}), count, base, low))
def tree_eq source · line 821 · raw
@+plan:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.BroadcastPlan -> @+rows:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Row> -> @+rows_exact:{rows == 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.index_table(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.left_shape(plan)), 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.right_shape(plan)), 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.output_shape(plan))) : List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Row>} -> @+shape:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+fill:F32 -> @+ops:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/LAWS.Op> -> @+h:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/api.Effect> -> @+d:Nat -> @+f:F32 -> @+count:Nat -> @+source:0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/contracts/matmul_parallel_proof.Source<shape, fill, ops, h, d, f> -> @+facts:Facts<plan, shape, count> -> @+depth:Nat -> @+base:Nat -> TreeEq(plan, rows, rows_exact, shape, fill, ops, h, d, f, count, depth, base, 0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/parallel.tree(0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.Fibers, Array<F32>, Unit, 0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.cell_at, 0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.fibers(0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.Fibers{rows, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.output_shape(plan))}), depth, count, base, (0x1689e5deb278c16abd3bd45eac101ef3/src/storage/api.arr(h, d, f), Unit{})))
def tree_first source · line 841 · raw
@+plan:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.BroadcastPlan -> @+rows:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Row> -> @+rows_exact:{rows == 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.index_table(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.left_shape(plan)), 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.right_shape(plan)), 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.output_shape(plan))) : List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Row>} -> @+shape:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+fill:F32 -> @+ops:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/LAWS.Op> -> @+h:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/api.Effect> -> @+d:Nat -> @+f:F32 -> @+count:Nat -> @+depth:Nat -> @+base:Nat -> @-result:Pair(Array<F32>, Pair(Array<F32>, Unit)) -> @facts:TreeEq(plan, rows, rows_exact, shape, fill, ops, h, d, f, count, depth, base, result) -> {Pair.fst(Array<F32>, Pair(Array<F32>, Unit), result) == out_spec(plan, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Indexed{rows, rows_exact}, shape, fill, ops, count, depth, base) : Array<F32>}
def fork_eq source · line 849 · raw
@+plan:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.BroadcastPlan -> @+rows:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Row> -> @+rows_exact:{rows == 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.index_table(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.left_shape(plan)), 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.right_shape(plan)), 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.output_shape(plan))) : List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Row>} -> @+shape:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+fill:F32 -> @+ops:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/LAWS.Op> -> @+h:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/api.Effect> -> @+d:Nat -> @+f:F32 -> @+count:Nat -> @+lower:Nat -> @+rest:Nat -> @+base:Nat -> @low:{0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.build(lower, rest, rows, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.output_shape(plan)), count, base, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/api.arr(h, d, f)) == out_spec(plan, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Indexed{rows, rows_exact}, shape, fill, ops, count, lower, base) : Array<F32>} -> @high:{0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.build(lower, rest, rows, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.output_shape(plan)), count, Nat.add(0x1689e5deb278c16abd3bd45eac101ef3/src/storage/model.capacity(lower), base), 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/api.arr(h, d, f)) == out_spec(plan, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Indexed{rows, rows_exact}, shape, fill, ops, count, lower, Nat.add(0x1689e5deb278c16abd3bd45eac101ef3/src/storage/model.capacity(lower), base)) : Array<F32>} -> @pair:Pair(Array<F32>, Array<F32>) -> @+exact:{pair == Array.clone(F32, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/api.arr(h, d, f)) : Pair(Array<F32>, Array<F32>)} -> {0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/parallel.fork(Array<F32>, Unit, 0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.halves(pair), l => r => 0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/parallel.build(0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.Fibers, 0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.Fibers, Array<F32>, Unit, 0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.fibers, 0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.split, 0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.cell_at, 0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.Fibers{rows, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.output_shape(plan))}, lower, rest, count, base, (l, r)), l => r => 0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/parallel.build(0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.Fibers, 0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.Fibers, Array<F32>, Unit, 0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.fibers, 0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.split, 0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.cell_at, 0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.Fibers{rows, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.output_shape(plan))}, lower, rest, count, Nat.add(0x1689e5deb278c16abd3bd45eac101ef3/src/storage/model.capacity(lower), base), (l, r))) == out_spec(plan, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Indexed{rows, rows_exact}, shape, fill, ops, count, 1n+lower, base) : Array<F32>}
def build_eq source · line 878 · raw
@+plan:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.BroadcastPlan -> @+rows:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Row> -> @+rows_exact:{rows == 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.index_table(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.left_shape(plan)), 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.right_shape(plan)), 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.output_shape(plan))) : List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Row>} -> @+shape:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+fill:F32 -> @+ops:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/LAWS.Op> -> @+h:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/api.Effect> -> @+d:Nat -> @+f:F32 -> @+count:Nat -> @+source:0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/contracts/matmul_parallel_proof.Source<shape, fill, ops, h, d, f> -> @+facts:Facts<plan, shape, count> -> @+depth:Nat -> @+splits:Nat -> @+base:Nat -> {0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.build(depth, splits, rows, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.output_shape(plan)), count, base, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/api.arr(h, d, f)) == out_spec(plan, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Indexed{rows, rows_exact}, shape, fill, ops, count, depth, base) : Array<F32>}Whatever the split, the parallel build over the copy returns the spec.
def length_snoc source · line 901 · raw
@+values:List<&2, F32> -> @+word:F32 -> {List.length(&2, F32, List.append(&2, F32, values, [word])) == 1n+List.length(&2, F32, values) : Nat}As in reduce_fold_PROOF.bend: below the count, the listed words are the replayed words.
def words_length source · line 910 · raw
@+shape:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+fill:F32 -> @+ops:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/LAWS.Op> -> @+count:Nat -> {List.length(&2, F32, 0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/contracts/LAWS.words(shape, fill, ops, count)) == count : Nat}
def word_at_front source · line 922 · raw
@+values:List<&2, F32> -> @+word:F32 -> @+position:Nat -> @below:{Nat.is_lt(position, List.length(&2, F32, values)) == True{} : Bool} -> {0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce_LAWS.word_at(List.append(&2, F32, values, [word]), position) == 0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce_LAWS.word_at(values, position) : Maybe<&2, F32>}
def word_at_last source · line 933 · raw
@+values:List<&2, F32> -> @+word:F32 -> {0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce_LAWS.word_at(List.append(&2, F32, values, [word]), List.length(&2, F32, values)) == Some{word} : Maybe<&2, F32>}
def words_step source · line 941 · raw
@+shape:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+fill:F32 -> @+ops:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/LAWS.Op> -> @+previous:Nat -> @+position:Nat -> @below:{Nat.is_lt(position, 1n+previous) == True{} : Bool} -> @decision:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.BoolCase<Nat.is_eq(position, previous)> -> @earlier:(@inside:{Nat.is_lt(position, previous) == True{} : Bool} -> {0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce_LAWS.word_at(0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/contracts/LAWS.words(shape, fill, ops, previous), position) == Some{0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/contracts/replayed.value(shape, fill, ops, U32.from_nat(position))} : Maybe<&2, F32>}) -> {0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce_LAWS.word_at(0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/contracts/LAWS.words(shape, fill, ops, 1n+previous), position) == Some{0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/contracts/replayed.value(shape, fill, ops, U32.from_nat(position))} : Maybe<&2, F32>}
def words_at source · line 969 · raw
@+shape:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+fill:F32 -> @+ops:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/LAWS.Op> -> @+count:Nat -> @+position:Nat -> @below:{Nat.is_lt(position, count) == True{} : Bool} -> {0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce_LAWS.word_at(0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/contracts/LAWS.words(shape, fill, ops, count), position) == Some{0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/contracts/replayed.value(shape, fill, ops, U32.from_nat(position))} : Maybe<&2, F32>}
def parallel_splits source · line 982 · raw
@+plan:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.BroadcastPlan -> @+depth:Nat -> @+length:Nat -> Nat
def output_eq source · line 987 · raw
@+plan:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.BroadcastPlan -> @+rows:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Row> -> @+rows_exact:{rows == 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.index_table(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.left_shape(plan)), 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.right_shape(plan)), 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.output_shape(plan))) : List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Row>} -> @+shape:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+fill:F32 -> @+ops:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/LAWS.Op> -> @+h:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/api.Effect> -> @+dc:Nat -> @+fc:F32 -> @+source:0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/contracts/matmul_parallel_proof.Source<shape, fill, ops, h, dc, fc> -> @+target:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+facts:Facts<plan, shape, U32.to_nat(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.count(target))> -> @+d:Nat -> @+fits:{0x1689e5deb278c16abd3bd45eac101ef3/src/storage/main.bounds(d, U32.to_nat(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.count(target))) == True{} : Bool} -> @-f:{0x1689e5deb278c16abd3bd45eac101ef3/src/storage/main.bounds(d, U32.to_nat(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.count(target))) == True{} : Bool} -> {0x1689e5deb278c16abd3bd45eac101ef3/src/storage/LAWS.replay(writes(plan, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Indexed{rows, rows_exact}, shape, fill, ops, U32.to_nat(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.count(target))), 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/main.Owned{d, U32.to_nat(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.count(target)), Array.new(F32, d, 0.0), 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/array.new_balanced(F32, d, 0.0), f}) == 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/main.Owned{d, U32.to_nat(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.count(target)), 0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.build(d, parallel_splits(plan, d, U32.to_nat(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.count(target))), rows, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.output_shape(plan)), U32.to_nat(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.count(target)), 0n, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/api.arr(h, dc, fc)), 0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.build_balanced(d, parallel_splits(plan, d, U32.to_nat(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.count(target))), rows, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.output_shape(plan)), U32.to_nat(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.count(target)), 0n, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/api.arr(h, dc, fc)), f} : 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/main.Storage}The writes of every cell, replayed on the owned storage created makes for
the target, give the owned storage the parallel build fills.
def Final source · line 1018 · raw
@+plan:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.BroadcastPlan -> @+target:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+shape:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+fill:F32 -> @+ops:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/LAWS.Op> -> @+map:PlanMap(plan) -> @-s:0x1689e5deb278c16abd3bd45eac101ef3/src/storage/main.Storage -> @-P:(@_:Pair(0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/core.Dynamic, Result<&2, &1, 0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.Error, 0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/core.Dynamic>) -> Type) -> Type
The parallel reduce over a replayed contribution, in transport form: P holds for the result if it holds for the contribution replayed with any history that keeps its words, next to the target replayed with any history whose cells hold the cell words.
def room_of source · line 1032 · raw
@+target:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> {Nat.is_le(U32.to_nat(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.count(target)), 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.logical_numel(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.dimensions(target))) == True{} : Bool}
def inside_count source · line 1036 · raw
@+target:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+index:U32 -> @+inside:{Nat.is_lt(U32.to_nat(index), 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.logical_numel(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.dimensions(target))) == True{} : Bool} -> {Nat.is_lt(U32.to_nat(index), U32.to_nat(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.count(target))) == True{} : Bool}
def indexed_lift source · line 1043 · raw
@+plan:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.BroadcastPlan -> @+target:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+shape:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+fill:F32 -> @+ops:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/LAWS.Op> -> @-fits:{0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/lifecycle.logical_length(0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/contracts/replayed.storage(shape, fill, ops)) == 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.logical_numel(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.dimensions(shape)) : Nat} -> @+facts:Facts<plan, shape, U32.to_nat(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.count(target))> -> @+d:Nat -> @+fits_d:{0x1689e5deb278c16abd3bd45eac101ef3/src/storage/main.bounds(d, U32.to_nat(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.count(target))) == True{} : Bool} -> @-f:{0x1689e5deb278c16abd3bd45eac101ef3/src/storage/main.bounds(d, U32.to_nat(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.count(target))) == True{} : Bool} -> @-fo:{0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/lifecycle.logical_length(0x1689e5deb278c16abd3bd45eac101ef3/src/storage/main.Owned{d, U32.to_nat(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.count(target)), Array.new(F32, d, 0.0), 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/array.new_balanced(F32, d, 0.0), f}) == 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.logical_numel(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.dimensions(target)) : Nat} -> @+map:PlanMap(plan) -> @-P:(@_:Pair(0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/core.Dynamic, Result<&2, &1, 0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.Error, 0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/core.Dynamic>) -> Type) -> @final:Final(plan, target, shape, fill, ops, map, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/main.Owned{d, U32.to_nat(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.count(target)), Array.new(F32, d, 0.0), 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/array.new_balanced(F32, d, 0.0), f}, P) -> P(0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce.parallel_indexed(0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/core.Packed{shape, 0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/core.TTensor{0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/contracts/replayed.storage(shape, fill, ops), fits}}, target, plan, 0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/core.TTensor{0x1689e5deb278c16abd3bd45eac101ef3/src/storage/main.Owned{d, U32.to_nat(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.count(target)), Array.new(F32, d, 0.0), 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/array.new_balanced(F32, d, 0.0), f}, fo}, d, U32.to_nat(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.count(target)), f, fo, map))
def rfold_gather source · line 1077 · raw
@+shape:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+fill:F32 -> @+ops:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/LAWS.Op> -> @+positions:List<&2, Nat> -> @+accumulator:F32 -> @+below:{0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce_parallel_proof.all_below(positions, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.logical_numel(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.dimensions(shape))) == True{} : Bool} -> {Some{rfold(shape, fill, ops, positions, accumulator)} == 0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce_parallel_proof.gather(0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/contracts/LAWS.words(shape, fill, ops, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.logical_numel(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.dimensions(shape))), positions, Some{accumulator}) : Maybe<&2, F32>}
def word_fiber source · line 1094 · raw
@+plan:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.BroadcastPlan -> @+map:PlanMap(plan) -> @+shape:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+fill:F32 -> @+ops:List<&2, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/LAWS.Op> -> @+index:U32 -> @+inside:{Nat.is_lt(U32.to_nat(index), 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.numel(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.left_shape(plan)))) == True{} : Bool} -> @+right:{0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.dimensions(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.right_shape(plan)) == 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.dimensions(shape) : List<&2, U32>} -> {Some{cell_word(plan, map, shape, fill, ops, U32.to_nat(index))} == 0x1689e5deb278c16abd3bd45eac101ef3/src/autograd/reduce_LAWS.fiber(plan, 0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/contracts/LAWS.words(shape, fill, ops, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.logical_numel(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.dimensions(shape))), index, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.logical_numel(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.dimensions(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.output_shape(plan)))) : Maybe<&2, F32>}