Documentation

HexMatrixMathlib.Vector

The executable-Vector ↔ Mathlib-Fin n → R equivalence, the fold-to-Finset.sum bridge for dot products, and the matrix-vector-product correspondence.

These are the base facts through which the row-span, rank, and nullspace bridges (in HexRowReduceMathlib) and the lattice bridges (in HexLLLMathlib) move between the two vector representations.

def HexMatrixMathlib.vectorEquiv {R : Type u} {n : } :
Vector R n (Fin nR)

Convert an executable Vector into Mathlib's function representation.

Equations
Instances For
    @[simp]
    theorem HexMatrixMathlib.vectorEquiv_apply {R : Type u} {n : } (v : Vector R n) (i : Fin n) :

    vectorEquiv v has entry v[i] at i, so a caller can rewrite vectorEquiv v i to v[i] without unfolding it.

    @[simp]
    theorem HexMatrixMathlib.vectorEquiv_symm_apply {R : Type u} {n : } (f : Fin nR) (i : Fin n) :
    (vectorEquiv.symm f)[i] = f i

    The inverse direction of vectorEquiv materialises a function as an executable vector entrywise: (vectorEquiv.symm f)[i] is just f i.

    theorem HexMatrixMathlib.foldl_finRange_eq_sum {R : Type u} {n : } [AddCommMonoid R] (f : Fin nR) :
    List.foldl (fun (acc : R) (i : Fin n) => acc + f i) 0 (List.finRange n) = i : Fin n, f i

    A left fold of (· + f ·) over List.finRange n from 0 is the finite sum ∑ i, f i; the bridge from the executable fold-sum to Mathlib's Finset.sum.

    The executable dot product equals Mathlib's dotProduct of the two vectors read through vectorEquiv.

    @[simp]
    theorem HexMatrixMathlib.matrixEquiv_row {R : Type u} {n m : } (M : Hex.Matrix R n m) (i : Fin n) :

    Row i of the Mathlib matrix matrixEquiv M is the image under vectorEquiv of the executable row Hex.Matrix.row M i, letting span/rank lemmas pass between the two row representations.

    @[simp]
    theorem HexMatrixMathlib.matrixEquiv_col {R : Type u} {n m : } (M : Hex.Matrix R n m) (j : Fin m) :

    Column j of the Mathlib matrix matrixEquiv M is the image under vectorEquiv of the executable column Hex.Matrix.col M j.

    theorem HexMatrixMathlib.vectorEquiv_mulVec {R : Type u} {n m : } [Semiring R] (M : Hex.Matrix R n m) (v : Vector R m) :

    The executable matrix-vector product transports to Mathlib's Matrix.mulVec under matrixEquiv/vectorEquiv.