TransposePROOF.swapped_offset: def of bendtorch-core@0.1.0.0 Import: import bendtorch-core@0.1.0.0/src/tensor/transpose_PROOF.bend as TransposePROOF Lines 184-208 of bendtorch-core@0.1.0.0/src/tensor/transpose_PROOF.bend: https://jend.leeeet.dev/read.txt?path=bendtorch-core@0.1.0.0/src/tensor/transpose_PROOF.bend&start_line=184&end_line=208 import Base import bendtorch-core@0.1.0.0/src/tensor/word_conversion.bend as Conversion import bendtorch-core@0.1.0.0/src/tensor/matrix_index_proof.bend as MatrixIndex import bendtorch-core@0.1.0.0/src/shape/nat_proofs.bend as Nats # Source of output digits (j, l) of a [columns, rows] transpose: the input # offset l * columns + j, once both digits are words again. def swapped_offset(+rows: U32, +columns: U32, +j: Nat, +l: Nat, +j_below: {Nat.is_lt(j, U32.to_nat(columns)) == True{} : Bool}, +l_below: {Nat.is_lt(l, U32.to_nat(rows)) == True{} : Bool}) -> {Some{U32.from_nat(Nat.add(Nat.mul(U32.to_nat(U32.from_nat(l)), Nat.mul(U32.to_nat(columns), 1n)), Nat.add(Nat.mul(U32.to_nat(U32.from_nat(j)), 1n), 0n)))} == Some{U32.from_nat(Nat.add(Nat.mul(l, U32.to_nat(columns)), j))} : Maybe<&2, U32>}: +c = U32.to_nat(columns) %Equal.sym(Nat, U32.to_nat(U32.from_nat(l)), l, MatrixIndex.word_below(l, rows, l_below)) : {Some{U32.from_nat(Nat.add(Nat.mul(_, Nat.mul(c, 1n)), Nat.add(Nat.mul(U32.to_nat(U32.from_nat(j)), 1n), 0n)))} == Some{U32.from_nat(Nat.add(Nat.mul(l, c), j))} : Maybe<&2, U32>} %Equal.sym(Nat, U32.to_nat(U32.from_nat(j)), j, MatrixIndex.word_below(j, columns, j_below)) : {Some{U32.from_nat(Nat.add(Nat.mul(l, Nat.mul(c, 1n)), Nat.add(Nat.mul(_, 1n), 0n)))} == Some{U32.from_nat(Nat.add(Nat.mul(l, c), j))} : Maybe<&2, U32>} %Equal.sym(Nat, Nat.mul(c, 1n), c, Nats.mul_one_right(c)) : {Some{U32.from_nat(Nat.add(Nat.mul(l, _), Nat.add(Nat.mul(j, 1n), 0n)))} == Some{U32.from_nat(Nat.add(Nat.mul(l, c), j))} : Maybe<&2, U32>} %Equal.sym(Nat, Nat.mul(j, 1n), j, Nats.mul_one_right(j)) : {Some{U32.from_nat(Nat.add(Nat.mul(l, c), Nat.add(_, 0n)))} == Some{U32.from_nat(Nat.add(Nat.mul(l, c), j))} : Maybe<&2, U32>} %Equal.sym(Nat, Nat.add(j, 0n), j, Conversion.add_zero(j)) : {Some{U32.from_nat(Nat.add(Nat.mul(l, c), _))} == Some{U32.from_nat(Nat.add(Nat.mul(l, c), j))} : Maybe<&2, U32>} {==} Uses (13): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Equal.sym https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Maybe https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.add https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.is_lt https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.mul https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.from_nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.to_nat https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/shape/nat_proofs.bend&name=mul_one_right https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/matrix_index_proof.bend&name=word_below https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/word_conversion.bend&name=add_zero