hex

19.7. The Mathlib correspondence🔗

Everything above is executable and Mathlib-free. HexMatrixTheory connects it to Mathlib: every Hex.Matrix corresponds to a Mathlib _root_.Matrix type with the same entries.

🔗def
HexMatrixTheory.matrixEquiv.{u_1} {R : Type u_1} {n m : ℕ} : Hex.Matrix R n m ≃ Matrix (Fin n) (Fin m) R
HexMatrixTheory.matrixEquiv.{u_1} {R : Type u_1} {n m : ℕ} : Hex.Matrix R n m ≃ Matrix (Fin n) (Fin m) R

The bijection between a Hex.Matrix and the Mathlib Matrix with the same entries.

The Semiring, Ring, and Algebra structure on square matrices, and the One instance, are defined by transport through HexMatrixTheory.matrixEquiv, bundled as HexMatrixTheory.matrixRingEquiv and HexMatrixTheory.matrixAlgEquiv. The elementary row operations become Mathlib's elementary matrices (HexMatrixTheory.matrixEquiv_rowSwap, HexMatrixTheory.matrixEquiv_rowScale, HexMatrixTheory.matrixEquiv_rowAdd).