AxisAlgebra.product_10: def of bendtorch-core@0.1.0.0 Import: import bendtorch-core@0.1.0.0/src/tensor/axis_algebra.bend as AxisAlgebra Lines 422-431 of bendtorch-core@0.1.0.0/src/tensor/axis_algebra.bend: https://jend.leeeet.dev/read.txt?path=bendtorch-core@0.1.0.0/src/tensor/axis_algebra.bend&start_line=422&end_line=431 import Base import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape import bendtorch-core@0.1.0.0/src/tensor/axis_spec.bend as Axis def product_10(+dims: List<&2, Nat>, length: {List.length(&2, Nat, dims) == 2n : Nat}) -> {Shape.numel(Axis.order(Nat, dims, [1n, 0n])) == Shape.numel(dims) : Nat}: match dims: case Nil{}: Empty.absurd({Shape.numel(Axis.order(Nat, Nil{}, [1n, 0n])) == Shape.numel(Nil{}) : Nat}, nat_clash(0n, 2n, length, {==})) case +x0 <> Nil{}: Empty.absurd({Shape.numel(Axis.order(Nat, x0 <> Nil{}, [1n, 0n])) == Shape.numel(x0 <> Nil{}) : Nat}, nat_clash(1n, 2n, length, {==})) case +x0 <> +x1 <> Nil{}: Equal.trans(Nat, Nat.mul(x1, Nat.mul(x0, 1n)), Nat.mul(x0, Nat.mul(x1, 1n)), Nat.mul(x0, Nat.mul(x1, 1n)), mul_swap(x1, x0, 1n), {==}) case +x0 <> +x1 <> +x2 <> +tail: Empty.absurd({Shape.numel(Axis.order(Nat, x0 <> x1 <> x2 <> tail, [1n, 0n])) == Shape.numel(x0 <> x1 <> x2 <> tail) : Nat}, nat_clash(3n+List.length(&2, Nat, tail), 2n, length, {==})) Uses (10): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Empty.absurd https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Equal.trans https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List.length https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.mul https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/shape/core.bend&name=numel https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/axis_algebra.bend&name=mul_swap https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/axis_algebra.bend&name=nat_clash https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/axis_spec.bend&name=order