def facts_2

bendtorch-core@0.1.0.0 · src/tensor/axis_algebra.bend:2134

import bendtorch-core@0.1.0.0/src/tensor/axis_algebra.bend as AxisAlgebra
import Base
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape
import bendtorch-core@0.1.0.0/src/storage/arith.bend as Arith
import bendtorch-core@0.1.0.0/src/tensor/axis_spec.bend as Axis

2134def facts_2(+axes: List<&2, Nat>, accepted: {True{} == Axis.valid(2n, axes) : Bool}) -> Facts<2n, axes>:
2135  match axes:
2136    case Nil{}:
2137      Empty.absurd(Facts<2n, Nil{}>, Shape.clash(accepted))
2138    case +a0 <> Nil{}:
2139      Empty.absurd(Facts<2n, a0 <> Nil{}>, Shape.clash(accepted))
2140    case 0n <> 0n <> Nil{}:
2141      Empty.absurd(Facts<2n, [0n, 0n]>, Shape.clash(accepted))
2142    case 0n <> 1n <> Nil{}:
2143      Certified{{==}, {==}, {==}, A => items => length => lists_01(A, items, length),
2144        dims => length => product_01(dims, length), dims => coords => dl => cl => fit_01(dims, coords, dl, cl)}
2145    case 0n <> (2n+p) <> Nil{}:
2146      Empty.absurd(Facts<2n, 0n <> (2n+p) <> Nil{}>, Arith.lt_zero(p, Arith.and_left(Nat.is_lt(2n+p, 2n), Axis.bounded(Nil{}, 2n), Arith.and_left(Axis.bounded(0n <> (2n+p) <> Nil{}, 2n), Axis.unique(0n <> (2n+p) <> Nil{}), Equal.sym(Bool, True{}, Axis.valid(2n, 0n <> (2n+p) <> Nil{}), accepted)))))
2147    case 1n <> 0n <> Nil{}:
2148      Certified{{==}, {==}, {==}, A => items => length => lists_10(A, items, length),
2149        dims => length => product_10(dims, length), dims => coords => dl => cl => fit_10(dims, coords, dl, cl)}
2150    case 1n <> 1n <> Nil{}:
2151      Empty.absurd(Facts<2n, [1n, 1n]>, Shape.clash(accepted))
2152    case 1n <> (2n+p) <> Nil{}:
2153      Empty.absurd(Facts<2n, 1n <> (2n+p) <> Nil{}>, Arith.lt_zero(p, Arith.and_left(Nat.is_lt(2n+p, 2n), Axis.bounded(Nil{}, 2n), Arith.and_left(Axis.bounded(1n <> (2n+p) <> Nil{}, 2n), Axis.unique(1n <> (2n+p) <> Nil{}), Equal.sym(Bool, True{}, Axis.valid(2n, 1n <> (2n+p) <> Nil{}), accepted)))))
2154    case (2n+p) <> a0 <> Nil{}:
2155      Empty.absurd(Facts<2n, (2n+p) <> a0 <> Nil{}>, Arith.lt_zero(p, Arith.and_left(Nat.is_lt(2n+p, 2n), Axis.bounded(a0 <> Nil{}, 2n), Arith.and_left(Axis.bounded((2n+p) <> a0 <> Nil{}, 2n), Axis.unique((2n+p) <> a0 <> Nil{}), Equal.sym(Bool, True{}, Axis.valid(2n, (2n+p) <> a0 <> Nil{}), accepted)))))
2156    case +a0 <> +a1 <> +a2 <> +tail:
2157      Empty.absurd(Facts<2n, a0 <> a1 <> a2 <> tail>, Shape.clash(accepted))

Uses (19)

Used by (1)