def output_source
bendtorch-core@0.1.0.0 · src/tensor/matmul_PROOF.bend:1527
import bendtorch-core@0.1.0.0/src/tensor/matmul_PROOF.bend as MatmulPROOF
import Base
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape
import bendtorch-core@0.1.0.0/src/tensor/core.bend as Core
import bendtorch-core@0.1.0.0/src/tensor/matmul.bend as Matrix
import bendtorch-core@0.1.0.0/src/tensor/matmul_LAWS.bend as Laws
import bendtorch-core@0.1.0.0/src/storage/main.bend as Storage
import bendtorch-core@0.1.0.0/src/tensor/elementwise_parallel_proof.bend as Parallel
1527def output_source(+left: Shape.Shape, +right: Shape.Shape, +output: Shape.Shape, +rows: U32, +inner: U32, +right_inner: U32, +columns: U32,
1528 -le: {Shape.dimensions(left) == [rows, inner] : List<&2, U32>}, -re: {Shape.dimensions(right) == [right_inner, columns] : List<&2, U32>},
1529 -oe: {Shape.dimensions(output) == [rows, columns] : List<&2, U32>}, -compatible: {U32.to_nat(inner) == U32.to_nat(right_inner) : Nat},
1530 +depth: Nat, +length: Nat, -valid: {Storage.bounds(depth, length) == True{} : Bool},
1531 -exact: {length == Shape.logical_numel(Shape.dimensions(output)) : Nat},
1532 -a: Core.Tensor<left>, -b: Core.Tensor<right>,
1533 -kept_left: Core.Tensor<left>, -copy_left: Array<F32>, -taken_left: Parallel.Taken<Core.Packed{left, a}, (Core.Packed{left, kept_left}, copy_left)>,
1534 -kept_right: Core.Tensor<right>, -copy_right: Array<F32>, -taken_right: Parallel.Taken<Core.Packed{right, b}, (Core.Packed{right, kept_right}, copy_right)>) ->
1535 Laws.SourceMatmul<Core.Packed{left, a}, Core.Packed{right, b}, Matrix.parallel_output(output, U32.to_nat(inner), U32.to_nat(columns), depth, length,
1536 valid, exact, (Core.Packed{left, kept_left}, copy_left), (Core.Packed{right, kept_right}, copy_right))>:
1537 Laws.SourceMatmul{unit => Laws.MatmulSuccess{left, right, Matrix.Plan{output, rows, inner, right_inner, columns, le, re, oe, compatible},
1538 a, b, kept_left, kept_right,
1539 Core.TTensor{Storage.Owned{depth, length,
1540 Matrix.build(depth, Matrix.product_splits(depth, U32.to_nat(inner)), U32.to_nat(inner), U32.to_nat(columns), length, 0n, copy_left, copy_right),
1541 Matrix.build_balanced(depth, Matrix.product_splits(depth, U32.to_nat(inner)), U32.to_nat(inner), U32.to_nat(columns), length, 0n, copy_left, copy_right),
1542 valid}, exact},
1543 {==}, {==}, {==}, {==}, {==},
1544 Laws.ProductPrefix{
1545 other => {\{Parallel.Fact: p => p} : Parallel.Fact<{Core.checked_observe(left, kept_left, other) == Core.checked_observe(left, a, other) : Maybe<&2, F32>}> ->
1546 {Core.checked_observe(left, kept_left, other) == Core.checked_observe(left, a, other) : Maybe<&2, F32>}}(
1547 taken_keeps(left, a, kept_left, copy_left, taken_left, other)),
1548 other => {\{Parallel.Fact: p => p} : Parallel.Fact<{Core.checked_observe(right, kept_right, other) == Core.checked_observe(right, b, other) : Maybe<&2, F32>}> ->
1549 {Core.checked_observe(right, kept_right, other) == Core.checked_observe(right, b, other) : Maybe<&2, F32>}}(
1550 taken_keeps(right, b, kept_right, copy_right, taken_right, other)),
1551 position => earlier =>
1552 {\{Parallel.Taken: dl => bl => left_reads => left_same =>
1553 {\{Parallel.Taken: dr => br => right_reads => right_same =>
1554 {\{Parallel.Fact: p => p} :
1555 Parallel.Fact<Laws.ProductCell<inner, left, right, a, b, output,
1556 Core.TTensor{Storage.Owned{depth, length,
1557 Matrix.build(depth, Matrix.product_splits(depth, U32.to_nat(inner)), U32.to_nat(inner), U32.to_nat(columns), length, 0n, copy_left, copy_right),
1558 Matrix.build_balanced(depth, Matrix.product_splits(depth, U32.to_nat(inner)), U32.to_nat(inner), U32.to_nat(columns), length, 0n, copy_left, copy_right),
1559 valid}, exact}, position>> ->
1560 Laws.ProductCell<inner, left, right, a, b, output,
1561 Core.TTensor{Storage.Owned{depth, length,
1562 Matrix.build(depth, Matrix.product_splits(depth, U32.to_nat(inner)), U32.to_nat(inner), U32.to_nat(columns), length, 0n, copy_left, copy_right),
1563 Matrix.build_balanced(depth, Matrix.product_splits(depth, U32.to_nat(inner)), U32.to_nat(inner), U32.to_nat(columns), length, 0n, copy_left, copy_right),
1564 valid}, exact}, position>}(
1565 product_cell(left, right, output, rows, inner, right_inner, columns, le, re, oe, compatible, depth, length, valid, exact,
1566 a, b, dl, dr, copy_left, copy_right, bl, br, left_reads, right_reads, position, earlier))} :
1567 Parallel.Taken<Core.Packed{right, b}, (Core.Packed{right, kept_right}, copy_right)> ->
1568 Laws.ProductCell<inner, left, right, a, b, output,
1569 Core.TTensor{Storage.Owned{depth, length,
1570 Matrix.build(depth, Matrix.product_splits(depth, U32.to_nat(inner)), U32.to_nat(inner), U32.to_nat(columns), length, 0n, copy_left, copy_right),
1571 Matrix.build_balanced(depth, Matrix.product_splits(depth, U32.to_nat(inner)), U32.to_nat(inner), U32.to_nat(columns), length, 0n, copy_left, copy_right),
1572 valid}, exact}, position>}(taken_right)} :
1573 Parallel.Taken<Core.Packed{left, a}, (Core.Packed{left, kept_left}, copy_left)> ->
1574 Laws.ProductCell<inner, left, right, a, b, output,
1575 Core.TTensor{Storage.Owned{depth, length,
1576 Matrix.build(depth, Matrix.product_splits(depth, U32.to_nat(inner)), U32.to_nat(inner), U32.to_nat(columns), length, 0n, copy_left, copy_right),
1577 Matrix.build_balanced(depth, Matrix.product_splits(depth, U32.to_nat(inner)), U32.to_nat(inner), U32.to_nat(columns), length, 0n, copy_left, copy_right),
1578 valid}, exact}, position>}(taken_left)}}}