The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V07. Linear algebra

Mathlib.LinearAlgebra.Matrix.Reindex

45 declarations and 6 deprecated aliases. Mathlib docs · Source

Changing the index type of a matrix

This file concerns the map Matrix.reindex, mapping a m by n matrix to an m' by n' matrix, as long as m ≃ m' and n ≃ n'.

Main definitions

  • Matrix.reindexAddEquiv R: Matrix.reindex as an AddEquiv between R-matrices.
  • Matrix.reindexRingEquiv R: Matrix.reindex as a RingEquiv between R-matrices.
  • Matrix.reindexLinearEquiv R A: Matrix.reindex is an R-linear equivalence between A-matrices.
  • Matrix.reindexAlgEquiv R A: Matrix.reindex is an R-algebra equivalence between A-matrices.
  • Matrix.reindexStarAlgEquiv R A: Matrix.reindex is an R-⋆-algebra equivalence between A-matrices.

Tags

matrix, reindex

def Matrix.reindexAddEquiv E1 #

{m : Type u_1} →
  {n : Type u_2} →
    {m' : Type u_4} →
      {n' : Type u_5} → (R : Type u_9) → [inst : Add R] → m ≃ m' → n ≃ n' → Matrix m n R ≃+ Matrix m' n' R

Matrix.reindex as an AddEquiv between R-matrices.

theorem Matrix.coe_reindexAddEquiv E0 #

∀ {m : Type u_1} {n : Type u_2} {m' : Type u_4} {n' : Type u_5} (R : Type u_9) [inst : Add R] (eₘ : m ≃ m')
  (eₙ : n ≃ n'), ⇑(Matrix.reindexAddEquiv R eₘ eₙ) = ⇑(Matrix.reindex eₘ eₙ)

theorem Matrix.toEquiv_reindexAddEquiv E0 #

∀ {m : Type u_1} {n : Type u_2} {m' : Type u_4} {n' : Type u_5} (R : Type u_9) [inst : Add R] (eₘ : m ≃ m')
  (eₙ : n ≃ n'), ↑(Matrix.reindexAddEquiv R eₘ eₙ) = Matrix.reindex eₘ eₙ

theorem Matrix.symm_reindexAddEquiv E0 #

∀ {m : Type u_1} {n : Type u_2} {m' : Type u_4} {n' : Type u_5} (R : Type u_9) [inst : Add R] (eₘ : m ≃ m')
  (eₙ : n ≃ n'), (Matrix.reindexAddEquiv R eₘ eₙ).symm = Matrix.reindexAddEquiv R eₘ.symm eₙ.symm

theorem Matrix.reindexAddEquiv_refl_refl E0 #

∀ {m : Type u_1} {n : Type u_2} (R : Type u_9) [inst : Add R],
  Matrix.reindexAddEquiv R (Equiv.refl m) (Equiv.refl n) = AddEquiv.refl (Matrix m n R)

theorem Matrix.reindexAddEquiv_trans_reindexAddEquiv E0 #

∀ {m : Type u_1} {n : Type u_2} {m' : Type u_4} {n' : Type u_5} {m'' : Type u_7} {n'' : Type u_8} (R : Type u_9)
  [inst : Add R] (e₁ : m ≃ m') (e₂ : n ≃ n') (e₁' : m' ≃ m'') (e₂' : n' ≃ n''),
  (Matrix.reindexAddEquiv R e₁ e₂).trans (Matrix.reindexAddEquiv R e₁' e₂') =
    Matrix.reindexAddEquiv R (e₁.trans e₁') (e₂.trans e₂')

def Matrix.reindexRingEquiv E1 #

{m : Type u_1} →
  {n : Type u_2} →
    (R : Type u_9) →
      [inst : Fintype m] →
        [inst_1 : Fintype n] → [inst_2 : Mul R] → [inst_3 : AddCommMonoid R] → m ≃ n → Matrix m m R ≃+* Matrix n n R

Matrix.reindex as a RingEquiv between R-matrices.

theorem Matrix.coe_reindexRingEquiv E0 #

∀ {m : Type u_1} {n : Type u_2} (R : Type u_9) [inst : Fintype m] [inst_1 : Fintype n] [inst_2 : Mul R]
  [inst_3 : AddCommMonoid R] (e : m ≃ n), ⇑(Matrix.reindexRingEquiv R e) = ⇑(Matrix.reindex e e)

theorem Matrix.toEquiv_reindexRingEquiv E0 #

∀ {m : Type u_1} {n : Type u_2} (R : Type u_9) [inst : Fintype m] [inst_1 : Fintype n] [inst_2 : Mul R]
  [inst_3 : AddCommMonoid R] (e : m ≃ n), ↑(Matrix.reindexRingEquiv R e) = Matrix.reindex e e

theorem Matrix.toAddEquiv_reindexRingEquiv E0 #

∀ {m : Type u_1} {n : Type u_2} (R : Type u_9) [inst : Fintype m] [inst_1 : Fintype n] [inst_2 : Mul R]
  [inst_3 : AddCommMonoid R] (e : m ≃ n), ↑(Matrix.reindexRingEquiv R e) = Matrix.reindexAddEquiv R e e

theorem Matrix.symm_reindexRingEquiv E0 #

∀ {m : Type u_1} {n : Type u_2} (R : Type u_9) [inst : Fintype m] [inst_1 : Fintype n] [inst_2 : Mul R]
  [inst_3 : AddCommMonoid R] (e : m ≃ n), (Matrix.reindexRingEquiv R e).symm = Matrix.reindexRingEquiv R e.symm

theorem Matrix.reindexRingEquiv_refl E0 #

∀ {n : Type u_2} (R : Type u_9) [inst : Fintype n] [inst_1 : Mul R] [inst_2 : AddCommMonoid R],
  Matrix.reindexRingEquiv R (Equiv.refl n) = RingEquiv.refl (Matrix n n R)

theorem Matrix.reindexRingEquiv_trans_reindexRingEquiv E0 #

∀ {m : Type u_1} {n : Type u_2} {o : Type u_3} (R : Type u_9) [inst : Fintype m] [inst_1 : Fintype n]
  [inst_2 : Fintype o] [inst_3 : Mul R] [inst_4 : AddCommMonoid R] (e : m ≃ n) (e' : n ≃ o),
  (Matrix.reindexRingEquiv R e).trans (Matrix.reindexRingEquiv R e') = Matrix.reindexRingEquiv R (e.trans e')

def Matrix.reindexLinearEquiv E1 #

{m : Type u_1} →
  {n : Type u_2} →
    {m' : Type u_4} →
      {n' : Type u_5} →
        (R : Type u_9) →
          (A : Type u_10) →
            [inst : Semiring R] →
              [inst_1 : AddCommMonoid A] → [inst_2 : Module R A] → m ≃ m' → n ≃ n' → Matrix m n A ≃ₗ[R] Matrix m' n' A

The natural map that reindexes a matrix's rows and columns with equivalent types, Matrix.reindex, is a linear equivalence.

theorem Matrix.coe_reindexLinearEquiv E0 #

∀ {m : Type u_1} {n : Type u_2} {m' : Type u_4} {n' : Type u_5} (R : Type u_9) (A : Type u_10) [inst : Semiring R]
  [inst_1 : AddCommMonoid A] [inst_2 : Module R A] (eₘ : m ≃ m') (eₙ : n ≃ n'),
  ⇑(Matrix.reindexLinearEquiv R A eₘ eₙ) = ⇑(Matrix.reindex eₘ eₙ)

theorem Matrix.toEquiv_reindexLinearEquiv E0 #

∀ {m : Type u_1} {n : Type u_2} {m' : Type u_4} {n' : Type u_5} (R : Type u_9) (A : Type u_10) [inst : Semiring R]
  [inst_1 : AddCommMonoid A] [inst_2 : Module R A] (eₘ : m ≃ m') (eₙ : n ≃ n'),
  ↑(Matrix.reindexLinearEquiv R A eₘ eₙ) = Matrix.reindex eₘ eₙ

theorem Matrix.toAddEquiv_reindexLinearEquiv E0 #

∀ {m : Type u_1} {n : Type u_2} {m' : Type u_4} {n' : Type u_5} (R : Type u_9) (A : Type u_10) [inst : Semiring R]
  [inst_1 : AddCommMonoid A] [inst_2 : Module R A] (eₘ : m ≃ m') (eₙ : n ≃ n'),
  ↑(Matrix.reindexLinearEquiv R A eₘ eₙ) = Matrix.reindexAddEquiv A eₘ eₙ

theorem Matrix.symm_reindexLinearEquiv E0 #

∀ {m : Type u_1} {n : Type u_2} {m' : Type u_4} {n' : Type u_5} (R : Type u_9) (A : Type u_10) [inst : Semiring R]
  [inst_1 : AddCommMonoid A] [inst_2 : Module R A] (eₘ : m ≃ m') (eₙ : n ≃ n'),
  (Matrix.reindexLinearEquiv R A eₘ eₙ).symm = Matrix.reindexLinearEquiv R A eₘ.symm eₙ.symm

theorem Matrix.reindexLinearEquiv_refl_refl E0 #

∀ {m : Type u_1} {n : Type u_2} (R : Type u_9) (A : Type u_10) [inst : Semiring R] [inst_1 : AddCommMonoid A]
  [inst_2 : Module R A], Matrix.reindexLinearEquiv R A (Equiv.refl m) (Equiv.refl n) = LinearEquiv.refl R (Matrix m n A)

theorem Matrix.reindexLinearEquiv_trans_reindexLinearEquiv E0 #

∀ {m : Type u_1} {n : Type u_2} {m' : Type u_4} {n' : Type u_5} {m'' : Type u_7} {n'' : Type u_8} (R : Type u_9)
  (A : Type u_10) [inst : Semiring R] [inst_1 : AddCommMonoid A] [inst_2 : Module R A] (e₁ : m ≃ m') (e₂ : n ≃ n')
  (e₁' : m' ≃ m'') (e₂' : n' ≃ n''),
  Matrix.reindexLinearEquiv R A e₁ e₂ ≪≫ₗ Matrix.reindexLinearEquiv R A e₁' e₂' =
    Matrix.reindexLinearEquiv R A (e₁.trans e₁') (e₂.trans e₂')

theorem Matrix.reindexLinearEquiv_comp E1 #

∀ {m : Type u_1} {n : Type u_2} {m' : Type u_4} {n' : Type u_5} {m'' : Type u_7} {n'' : Type u_8} (R : Type u_9)
  (A : Type u_10) [inst : Semiring R] [inst_1 : AddCommMonoid A] [inst_2 : Module R A] (e₁ : m ≃ m') (e₂ : n ≃ n')
  (e₁' : m' ≃ m'') (e₂' : n' ≃ n''),
  ⇑(Matrix.reindexLinearEquiv R A e₁' e₂') ∘ ⇑(Matrix.reindexLinearEquiv R A e₁ e₂) =
    ⇑(Matrix.reindexLinearEquiv R A (e₁.trans e₁') (e₂.trans e₂'))

theorem Matrix.reindexLinearEquiv_comp_apply E0 #

∀ {m : Type u_1} {n : Type u_2} {m' : Type u_4} {n' : Type u_5} {m'' : Type u_7} {n'' : Type u_8} (R : Type u_9)
  (A : Type u_10) [inst : Semiring R] [inst_1 : AddCommMonoid A] [inst_2 : Module R A] (e₁ : m ≃ m') (e₂ : n ≃ n')
  (e₁' : m' ≃ m'') (e₂' : n' ≃ n'') (M : Matrix m n A),
  (Matrix.reindexLinearEquiv R A e₁' e₂') ((Matrix.reindexLinearEquiv R A e₁ e₂) M) =
    (Matrix.reindexLinearEquiv R A (e₁.trans e₁') (e₂.trans e₂')) M

theorem Matrix.reindexLinearEquiv_one E1 #

∀ {m : Type u_1} {m' : Type u_4} (R : Type u_9) (A : Type u_10) [inst : Semiring R] [inst_1 : AddCommMonoid A]
  [inst_2 : Module R A] [inst_3 : DecidableEq m] [inst_4 : DecidableEq m'] [inst_5 : One A] (e : m ≃ m'),
  (Matrix.reindexLinearEquiv R A e e) 1 = 1

theorem Matrix.reindexLinearEquiv_mul E1 #

∀ {m : Type u_1} {n : Type u_2} {o : Type u_3} {m' : Type u_4} {n' : Type u_5} {o' : Type u_6} (R : Type u_9)
  (A : Type u_10) [inst : Semiring R] [inst_1 : Semiring A] [inst_2 : Module R A] [inst_3 : Fintype n]
  [inst_4 : Fintype n'] (eₘ : m ≃ m') (eₙ : n ≃ n') (eₒ : o ≃ o') (M : Matrix m n A) (N : Matrix n o A),
  (Matrix.reindexLinearEquiv R A eₘ eₙ) M * (Matrix.reindexLinearEquiv R A eₙ eₒ) N =
    (Matrix.reindexLinearEquiv R A eₘ eₒ) (M * N)

theorem Matrix.mul_reindexLinearEquiv_one E1 #

∀ {m : Type u_1} {n : Type u_2} {o : Type u_3} {n' : Type u_5} (R : Type u_9) (A : Type u_10) [inst : Semiring R]
  [inst_1 : Semiring A] [inst_2 : Module R A] [inst_3 : Fintype n] [inst_4 : DecidableEq o] (e₁ : o ≃ n) (e₂ : o ≃ n')
  (M : Matrix m n A),
  M * (Matrix.reindexLinearEquiv R A e₁ e₂) 1 = (Matrix.reindexLinearEquiv R A (Equiv.refl m) (e₁.symm.trans e₂)) M

def Matrix.reindexAlgEquiv E1 #

{m : Type u_1} →
  {n : Type u_2} →
    (R : Type u_9) →
      (A : Type u_10) →
        [inst : CommSemiring R] →
          [inst_1 : Fintype n] →
            [inst_2 : Fintype m] →
              [inst_3 : Semiring A] → [inst_4 : Algebra R A] → m ≃ n → Matrix m m A ≃ₐ[R] Matrix n n A

For square matrices with coefficients in an algebra over a commutative semiring, the natural map that reindexes a matrix's rows and columns with equivalent types, Matrix.reindex, is an equivalence of algebras.

theorem Matrix.coe_reindexAlgEquiv E0 #

∀ {m : Type u_1} {n : Type u_2} (R : Type u_9) (A : Type u_10) [inst : CommSemiring R] [inst_1 : Fintype n]
  [inst_2 : Fintype m] [inst_3 : Semiring A] [inst_4 : Algebra R A] (e : m ≃ n),
  ⇑(Matrix.reindexAlgEquiv R A e) = ⇑(Matrix.reindex e e)

theorem Matrix.toEquiv_reindexAlgEquiv E0 #

∀ {m : Type u_1} {n : Type u_2} (R : Type u_9) (A : Type u_10) [inst : CommSemiring R] [inst_1 : Fintype n]
  [inst_2 : Fintype m] [inst_3 : Semiring A] [inst_4 : Algebra R A] (e : m ≃ n),
  ↑(Matrix.reindexAlgEquiv R A e) = Matrix.reindex e e

theorem Matrix.toAddEquiv_reindexAlgEquiv E0 #

∀ {m : Type u_1} {n : Type u_2} (R : Type u_9) (A : Type u_10) [inst : CommSemiring R] [inst_1 : Fintype n]
  [inst_2 : Fintype m] [inst_3 : Semiring A] [inst_4 : Algebra R A] (e : m ≃ n),
  ↑(Matrix.reindexAlgEquiv R A e) = Matrix.reindexAddEquiv A e e

theorem Matrix.toRingEquiv_reindexAlgEquiv E0 #

∀ {m : Type u_1} {n : Type u_2} (R : Type u_9) (A : Type u_10) [inst : CommSemiring R] [inst_1 : Fintype n]
  [inst_2 : Fintype m] [inst_3 : Semiring A] [inst_4 : Algebra R A] (e : m ≃ n),
  (Matrix.reindexAlgEquiv R A e).toRingEquiv = Matrix.reindexRingEquiv A e

theorem Matrix.toLinearEquiv_reindexAlgEquiv E0 #

∀ {m : Type u_1} {n : Type u_2} (R : Type u_9) (A : Type u_10) [inst : CommSemiring R] [inst_1 : Fintype n]
  [inst_2 : Fintype m] [inst_3 : Semiring A] [inst_4 : Algebra R A] (e : m ≃ n),
  ↑(Matrix.reindexAlgEquiv R A e) = Matrix.reindexLinearEquiv R A e e

theorem Matrix.symm_reindexAlgEquiv E0 #

∀ {m : Type u_1} {n : Type u_2} (R : Type u_9) (A : Type u_10) [inst : CommSemiring R] [inst_1 : Fintype n]
  [inst_2 : Fintype m] [inst_3 : Semiring A] [inst_4 : Algebra R A] (e : m ≃ n),
  (Matrix.reindexAlgEquiv R A e).symm = Matrix.reindexAlgEquiv R A e.symm

theorem Matrix.reindexAlgEquiv_refl E0 #

∀ {m : Type u_1} (R : Type u_9) (A : Type u_10) [inst : CommSemiring R] [inst_1 : Fintype m] [inst_2 : Semiring A]
  [inst_3 : Algebra R A], Matrix.reindexAlgEquiv R A (Equiv.refl m) = AlgEquiv.refl

theorem Matrix.reindexAlgEquiv_trans_reindexAlgEquiv E0 #

∀ {m : Type u_1} {n : Type u_2} {o : Type u_3} (R : Type u_9) (A : Type u_10) [inst : CommSemiring R]
  [inst_1 : Fintype n] [inst_2 : Fintype m] [inst_3 : Fintype o] [inst_4 : Semiring A] [inst_5 : Algebra R A]
  (e : m ≃ n) (e' : n ≃ o),
  (Matrix.reindexAlgEquiv R A e).trans (Matrix.reindexAlgEquiv R A e') = Matrix.reindexAlgEquiv R A (e.trans e')

def Matrix.reindexStarAlgEquiv E1 #

{m : Type u_1} →
  {n : Type u_2} →
    (R : Type u_9) →
      (A : Type u_10) →
        [inst : Semiring R] →
          [inst_1 : Fintype n] →
            [inst_2 : Fintype m] →
              [inst_3 : NonUnitalNonAssocSemiring A] →
                [inst_4 : Module R A] → [inst_5 : Star A] → m ≃ n → Matrix m m A ≃⋆ₐ[R] Matrix n n A

For square matrices with coefficients in a (non-unital, non-associative) semiring A with a star operation and an R-module structure, the natural map that reindexes a matrix's rows and columns with equivalent types, Matrix.reindex, is an equivalence of ⋆-algebras.

theorem Matrix.coe_reindexStarAlgEquiv E0 #

∀ {m : Type u_1} {n : Type u_2} (R : Type u_9) (A : Type u_10) [inst : Semiring R] [inst_1 : Fintype n]
  [inst_2 : Fintype m] [inst_3 : NonUnitalNonAssocSemiring A] [inst_4 : Module R A] [inst_5 : Star A] (e : m ≃ n),
  ⇑(Matrix.reindexStarAlgEquiv R A e) = ⇑(Matrix.reindex e e)

theorem Matrix.toEquiv_reindexStarAlgEquiv E0 #

∀ {m : Type u_1} {n : Type u_2} (R : Type u_9) (A : Type u_10) [inst : Semiring R] [inst_1 : Fintype n]
  [inst_2 : Fintype m] [inst_3 : NonUnitalNonAssocSemiring A] [inst_4 : Module R A] [inst_5 : Star A] (e : m ≃ n),
  ↑(Matrix.reindexStarAlgEquiv R A e) = Matrix.reindex e e

theorem Matrix.toAddEquiv_reindexStarAlgEquiv E0 #

∀ {m : Type u_1} {n : Type u_2} (R : Type u_9) (A : Type u_10) [inst : Semiring R] [inst_1 : Fintype n]
  [inst_2 : Fintype m] [inst_3 : NonUnitalNonAssocSemiring A] [inst_4 : Module R A] [inst_5 : Star A] (e : m ≃ n),
  ↑(Matrix.reindexStarAlgEquiv R A e) = Matrix.reindexAddEquiv A e e

theorem Matrix.toRingEquiv_reindexStarAlgEquiv E0 #

∀ {m : Type u_1} {n : Type u_2} (R : Type u_9) (A : Type u_10) [inst : Semiring R] [inst_1 : Fintype n]
  [inst_2 : Fintype m] [inst_3 : NonUnitalNonAssocSemiring A] [inst_4 : Module R A] [inst_5 : Star A] (e : m ≃ n),
  (Matrix.reindexStarAlgEquiv R A e).toRingEquiv = Matrix.reindexRingEquiv A e

theorem Matrix.symm_reindexStarAlgEquiv E0 #

∀ {m : Type u_1} {n : Type u_2} (R : Type u_9) (A : Type u_10) [inst : Semiring R] [inst_1 : Fintype n]
  [inst_2 : Fintype m] [inst_3 : NonUnitalNonAssocSemiring A] [inst_4 : Module R A] [inst_5 : Star A] (e : m ≃ n),
  (Matrix.reindexStarAlgEquiv R A e).symm = Matrix.reindexStarAlgEquiv R A e.symm

theorem Matrix.reindexStarAlgEquiv_refl E0 #

∀ {m : Type u_1} (R : Type u_9) (A : Type u_10) [inst : Semiring R] [inst_1 : Fintype m]
  [inst_2 : NonUnitalNonAssocSemiring A] [inst_3 : Module R A] [inst_4 : Star A],
  Matrix.reindexStarAlgEquiv R A (Equiv.refl m) = StarAlgEquiv.refl R (Matrix m m A)

theorem Matrix.reindexStarAlgEquiv_trans_reindexStarAlgEquiv E0 #

∀ {m : Type u_1} {n : Type u_2} {o : Type u_3} (R : Type u_9) (A : Type u_10) [inst : Semiring R] [inst_1 : Fintype n]
  [inst_2 : Fintype m] [inst_3 : Fintype o] [inst_4 : NonUnitalNonAssocSemiring A] [inst_5 : Module R A]
  [inst_6 : Star A] (e : m ≃ n) (e' : n ≃ o),
  (Matrix.reindexStarAlgEquiv R A e).trans (Matrix.reindexStarAlgEquiv R A e') =
    Matrix.reindexStarAlgEquiv R A (e.trans e')

theorem Matrix.toAlgEquiv_reindexStarAlgEquiv E0 #

∀ {m : Type u_1} {n : Type u_2} (R : Type u_9) (A : Type u_10) [inst : CommSemiring R] [inst_1 : Fintype m]
  [inst_2 : Fintype n] [inst_3 : Semiring A] [inst_4 : Algebra R A] [inst_5 : Star A] (e : m ≃ n),
  (Matrix.reindexStarAlgEquiv R A e).toAlgEquiv = Matrix.reindexAlgEquiv R A e

theorem Matrix.det_reindexLinearEquiv_self E1 #

∀ {m : Type u_1} {n : Type u_2} (R : Type u_9) [inst : CommRing R] [inst_1 : Fintype m] [inst_2 : DecidableEq m]
  [inst_3 : Fintype n] [inst_4 : DecidableEq n] (e : m ≃ n) (M : Matrix m m R),
  ((Matrix.reindexLinearEquiv R R e e) M).det = M.det

Reindexing both indices along the same equivalence preserves the determinant.

For the simp version of this lemma, see det_submatrix_equiv_self.

theorem Matrix.det_reindexAlgEquiv E1 #

∀ {m : Type u_1} {n : Type u_2} (R : Type u_9) (B : Type u_11) [inst : CommSemiring R] [inst_1 : CommRing B]
  [inst_2 : Algebra R B] [inst_3 : Fintype m] [inst_4 : DecidableEq m] [inst_5 : Fintype n] [inst_6 : DecidableEq n]
  (e : m ≃ n) (A : Matrix m m B), ((Matrix.reindexAlgEquiv R B e) A).det = A.det

Reindexing both indices along the same equivalence preserves the determinant.

For the simp version of this lemma, see det_submatrix_equiv_self.

Deprecated aliases

NameNew nameSince
Matrix.reindexAlgEquiv_applyMatrix.coe_reindexAlgEquiv2026-06-06
Matrix.reindexAlgEquiv_mulmap_mul2026-06-06
Matrix.reindexAlgEquiv_symmMatrix.symm_reindexAlgEquiv2026-06-06
Matrix.reindexLinearEquiv_applyMatrix.coe_reindexLinearEquiv2026-06-06
Matrix.reindexLinearEquiv_symmMatrix.symm_reindexLinearEquiv2026-06-06
Matrix.reindexLinearEquiv_transMatrix.reindexLinearEquiv_trans_reindexLinearEquiv2026-06-06