Linear-algebra facts for dependent tensors.
The results here cover dot products, matrix-vector structure, and linearity facts used by autograd, runtime approximation, and model proofs.
Adjointness of matrix-vector and vector-matrix multiplication under the dot product:
⟪y, W x⟫ = ⟪y W, x⟫ (a.k.a. ⟪y, W x⟫ = ⟪Wᵀ y, x⟫ depending on conventions).
This is the algebraic heart of the linear-layer gradient rule.
shapeOf recovers the shape already tracked in the tensor type.
This is a small bridge for proofs that move between value-level shape computations and type-indexed tensor operations.
Map and elementwise operation laws #
Functor identity law for mapSpec: mapping id is a no-op.
Functor law for mapSpec: mapping g then f equals mapping f ∘ g.
A scalar additivity law lifts pointwise through mapSpec and addSpec.
Commutativity transfer: if f is commutative, then map2_spec f is commutative on tensors.
Matrix and vector algebra #
Associativity of matrix-vector multiplication: A (B x) = (A B) x.
Coordinate rule for the matrix transpose swapAdjacentAxes A 0: (Aᵀ)[i,j] = A[j,i].
Matrix transpose is an involution.
Transpose of a product: (A ⬝ B)ᵀ = Bᵀ ⬝ Aᵀ.
Right-adjointness of matrix multiplication under the Frobenius dot-product.
Informally: ⟪A ⬝ B, C⟫ = ⟪A, C ⬝ Bᵀ⟫.
Transpose invariance of the Frobenius dot-product: ⟪Aᵀ, Bᵀ⟫ = ⟪A, B⟫.
Left-adjointness of matrix multiplication under the Frobenius dot-product.
Informally: ⟪A ⬝ B, C⟫ = ⟪B, Aᵀ ⬝ C⟫.
Outer product properties. Essential for proving weight gradient correctness.