Documentation

HexMatrixMathlib.Algebra

Mathlib algebraic structure on Hex.Matrix, transported along matrixEquiv.

matrixEquiv carries the executable dense-matrix operations to Mathlib's function-based Matrix, so we equip Hex.Matrix with the Mathlib algebraic tower (AddCommMonoid, AddCommGroup, Module, Semiring, Ring, Algebra) whose operations are the executable ones, and upgrade matrixEquiv to the corresponding additive, linear, ring, and algebra equivalences.

Base operations on the opaque structure #

The abbreviation representation inherited these pointwise operations from Vector; the opaque structure delegates them to the row data, so the Mathlib tower transported along matrixEquiv has executable operations.

@[implicit_reducible]
instance HexMatrixMathlib.instAdd {R : Type u} {n m : } [Add R] :
Add (Hex.Matrix R n m)
Equations
@[implicit_reducible]
instance HexMatrixMathlib.instNeg {R : Type u} {n m : } [Neg R] :
Neg (Hex.Matrix R n m)
Equations
@[implicit_reducible]
instance HexMatrixMathlib.instSub {R : Type u} {n m : } [Sub R] :
Sub (Hex.Matrix R n m)
Equations
@[simp]
theorem HexMatrixMathlib.rows_add {R : Type u} {n m : } [Add R] (A B : Hex.Matrix R n m) :
(A + B).rows = A.rows + B.rows
@[simp]
theorem HexMatrixMathlib.rows_neg {R : Type u} {n m : } [Neg R] (A : Hex.Matrix R n m) :
(-A).rows = -A.rows
@[simp]
theorem HexMatrixMathlib.rows_sub {R : Type u} {n m : } [Sub R] (A B : Hex.Matrix R n m) :
(A - B).rows = A.rows - B.rows

Preservation of the additive operations #

@[simp]
theorem HexMatrixMathlib.matrixEquiv_zero {R : Type u} {n m : } [Zero R] :
@[simp]
theorem HexMatrixMathlib.matrixEquiv_add {R : Type u} {n m : } [Add R] (A B : Hex.Matrix R n m) :
@[simp]
theorem HexMatrixMathlib.matrixEquiv_neg {R : Type u} {n m : } [Neg R] (A : Hex.Matrix R n m) :
@[simp]
theorem HexMatrixMathlib.matrixEquiv_sub {R : Type u} {n m : } [Sub R] (A B : Hex.Matrix R n m) :
@[simp]
theorem HexMatrixMathlib.matrixEquiv_smul {R : Type u} {n m : } {S : Type u_1} [SMul S R] (c : S) (A : Hex.Matrix R n m) :
@[implicit_reducible]
instance HexMatrixMathlib.instOne {R : Type u} {n : } [OfNat R 0] [OfNat R 1] :
One (Hex.Matrix R n n)

1 on a square matrix is the identity matrix. The instance is here rather than in HexMatrix because the Semiring/Ring structures transported below need it, while HexMatrix states its own lemmas with Matrix.identity.

Equations

Additive instances and the additive equivalence #

matrixEquiv as an additive equivalence.

Equations
Instances For

    Module structure and the linear equivalence #

    matrixEquiv as an R-linear equivalence.

    Equations
    Instances For

      Multiplicative preservation #

      @[simp]
      theorem HexMatrixMathlib.matrixEquiv_one {R : Type u} {n : } [Zero R] [One R] :
      @[simp]

      Auxiliary operations, pulled back through matrixEquiv #

      These NatCast, IntCast, and Pow instances exist only to populate the corresponding fields of the Semiring/Ring structures. They are proof-facing: defined by transport through matrixEquiv, not in executable form. Executable code never goes through them — it uses the HexMatrix operations directly (the square-matrix *, the ofFn identity). Their transport lemmas below reduce them to the Mathlib side for simp/grind.

      @[implicit_reducible]
      instance HexMatrixMathlib.instNatCast {R : Type u} {n : } [Semiring R] :
      Equations
      @[implicit_reducible]
      instance HexMatrixMathlib.instIntCast {R : Type u} {n : } [Ring R] :
      Equations
      @[implicit_reducible]
      instance HexMatrixMathlib.instPow {R : Type u} {n : } [Semiring R] :
      Equations
      @[simp]
      theorem HexMatrixMathlib.matrixEquiv_natCast {R : Type u} {n : } [Semiring R] (k : ) :
      matrixEquiv k = k
      @[simp]
      theorem HexMatrixMathlib.matrixEquiv_intCast {R : Type u} {n : } [Ring R] (k : ) :
      matrixEquiv k = k
      @[simp]
      theorem HexMatrixMathlib.matrixEquiv_pow {R : Type u} {n : } [Semiring R] (M : Hex.Matrix R n n) (k : ) :

      Ring structure and the ring equivalence #

      @[implicit_reducible]
      Equations
      @[implicit_reducible]
      instance HexMatrixMathlib.instRing {R : Type u} {n : } [Ring R] :
      Equations

      matrixEquiv as a ring equivalence on square matrices.

      Equations
      Instances For

        Algebra structure and the algebra equivalence #

        @[implicit_reducible]
        instance HexMatrixMathlib.instAlgebra {R : Type u} {n : } [CommSemiring R] :
        Equations

        matrixEquiv as an R-algebra equivalence on square matrices.

        Equations
        Instances For