def above

bendtorch-core@0.1.0.0 · src/tensor/contracts/matmul_parallel_proof.bend:274

import bendtorch-core@0.1.0.0/src/tensor/contracts/matmul_parallel_proof.bend as MatmulParallelProof
import Base
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape
import bendtorch-core@0.1.0.0/src/storage/model.bend as Model
import bendtorch-core@0.1.0.0/src/storage/LAWS.bend as StorageLaws
import bendtorch-core@0.1.0.0/src/storage/arith.bend as Arith
import bendtorch-core@0.1.0.0/src/storage/api.bend as Api

274# A subtree whose positions all lie above k is the same for k and 1 + k.
275def above(+span: Nat, +columns: Nat, +left: Shape.Shape, +left_fill: F32, +left_ops: List<&2, StorageLaws.Op>, +right: Shape.Shape, +right_fill: F32, +right_ops: List<&2, StorageLaws.Op>, +k: Nat, +depth: Nat, +b: Nat, +h: {Nat.is_lt(k, b) == True{} : Bool}) ->
276  {out_spec(span, columns, left, left_fill, left_ops, right, right_fill, right_ops, k, depth, b) == out_spec(span, columns, left, left_fill, left_ops, right, right_fill, right_ops, 1n+k, depth, b) : Array<F32>}:
277  match depth:
278    case 0n:
279      %Equal.sym(Bool, Nat.is_lt(b, k), False{}, lt_asym(k, b, h)) :
280        {ALeaf{out_leaf(span, columns, left, left_fill, left_ops, right, right_fill, right_ops, b, _)} == ALeaf{out_leaf(span, columns, left, left_fill, left_ops, right, right_fill, right_ops, b, Nat.is_lt(b, 1n+k))} : Array<F32>}
281      %Equal.sym(Bool, Nat.is_lt(b, 1n+k), False{}, above_false(k, b, h)) :
282        {ALeaf{0.0} == ALeaf{out_leaf(span, columns, left, left_fill, left_ops, right, right_fill, right_ops, b, _)} : Array<F32>}
283      {==}
284    case 1n+inner:
285      +high = Nat.add(Model.capacity(inner), b)
286      %Equal.sym(Array<F32>, out_spec(span, columns, left, left_fill, left_ops, right, right_fill, right_ops, k, inner, b), out_spec(span, columns, left, left_fill, left_ops, right, right_fill, right_ops, 1n+k, inner, b), above(span, columns, left, left_fill, left_ops, right, right_fill, right_ops, k, inner, b, h)) :
287        {ANode{_, out_spec(span, columns, left, left_fill, left_ops, right, right_fill, right_ops, k, inner, high)} == out_spec(span, columns, left, left_fill, left_ops, right, right_fill, right_ops, 1n+k, 1n+inner, b) : Array<F32>}
288      %Equal.sym(Array<F32>, out_spec(span, columns, left, left_fill, left_ops, right, right_fill, right_ops, k, inner, high), out_spec(span, columns, left, left_fill, left_ops, right, right_fill, right_ops, 1n+k, inner, high),
289        above(span, columns, left, left_fill, left_ops, right, right_fill, right_ops, k, inner, high, Arith.lt_le_trans(k, b, high, h, Api.le_add_left(Model.capacity(inner), b)))) :
290        {ANode{out_spec(span, columns, left, left_fill, left_ops, right, right_fill, right_ops, 1n+k, inner, b), _} == out_spec(span, columns, left, left_fill, left_ops, right, right_fill, right_ops, 1n+k, 1n+inner, b) : Array<F32>}
291      {==}

Uses (17)

Used by (1)