Tensor Algebra Lemmas #
This file collects foundational algebraic lemmas for TorchLean.Tensor: extensionality, map/fold
rewrites, and pointwise arithmetic facts used throughout the autograd and runtime-correctness proof
files.
Tensor extensionality over a generic element type: equal getSpec views imply equal tensors.
Elementwise addition is associative (over $\mathbb R$ tensors).
Bias cancellation for tensor subtraction: (a + c) - (b + c) = a - b.
Linearity of matrix-vector multiplication in the vector argument (addition).
Linearity of matrix-vector multiplication in the vector argument (scaling).
Full linearity of matrix-vector multiplication in the vector argument.
Mapping 0 + · over an Option is the identity.
Left identity for addSpec: adding the all-zero tensor does nothing.
Right identity for addSpec: adding the all-zero tensor does nothing.
Left identity for mulSpec: multiplying by the all-ones tensor does nothing.
Right identity for mulSpec: multiplying by the all-ones tensor does nothing.
Adding scalar tensors in a left fold agrees with folding their scalar values.