l3lab/ntp-mathlib huggingface dataset:
/-- From a basis `e : ι → M`, build a linear equivalence between families of vectors `v : ι → M`,
and matrices, making the matrix whose columns are the vectors `v i` written in the basis `e`. -/
def toMatrixEquiv [Fintype ι] (e : Basis ι R M) : (ι → M) ≃ₗ[R] Matrix ι ι R where
  toFun := e.toMatrix
  map_add' v w := by
    ext i j
    change _ = _ + _
    rw [e.toMatrix_apply, Pi.add_apply, LinearEquiv.map_add]
    rfl
  map_smul' := by
    intro c v
    ext i j
    dsimp only []
    rw [e.toMatrix_apply, Pi.smul_apply, LinearEquiv.map_smul]
    rfl
  invFun m j := ∑ i, m i j • e i
  left_inv := by
    intro v
    

Proof state:
ι : Type u_1
ι' : Type u_2
κ : Type u_3
κ' : Type u_4
R : Type u_5
M : Type u_6
inst✝⁶ : CommSemiring R
inst✝⁵ : AddCommMonoid M
inst✝⁴ : Module R M
R₂ : Type u_7
M₂ : Type u_8
inst✝³ : CommRing R₂
inst✝² : AddCommGroup M₂
inst✝¹ : Module R₂ M₂
e✝ : Basis ι R M
v✝ : ι' → M
i : ι
j : ι'
inst✝ : Fintype ι
e : Basis ι R M
v : ι → M
⊢ (fun m j => ∑ i : ι, m i j • e i)
      (AddHom.toFun
        {
            toAddHom :=
              { toFun := toMatrix e,
                map_add' := (_ : ∀ (v w : ι → M), toMatrix e (v + w) = toMatrix e v + toMatrix e w) },
            map_smul' :=
              (_ :
                ∀ (c : R) (v : ι → M),
                  AddHom.toFun
                      { toFun := toMatrix e,
                        map_add' := (_ : ∀ (v w : ι → M), toMatrix e (v + w) = toMatrix e v + toMatrix e w) }
                      (c • v) =
                    (RingHom.id R) c •
                      AddHom.toFun
                        { toFun := toMatrix e,
                          map_add' := (_ : ∀ (v w : ι → M), toMatrix e (v + w) = toMatrix e v + toMatrix e w) }
                        v) }.toAddHom
        v) =
    v

Next tactic:
ext j
/-- From a basis `e : ι → M`, build a linear equivalence between families of vectors `v : ι → M`,
and matrices, making the matrix whose columns are the vectors `v i` written in the basis `e`. -/
def toMatrixEquiv [Fintype ι] (e : Basis ι R M) : (ι → M) ≃ₗ[R] Matrix ι ι R where
  toFun := e.toMatrix
  map_add' v w := by
    ext i j
    change _ = _ + _
    rw [e.toMatrix_apply, Pi.add_apply, LinearEquiv.map_add]
    rfl
  map_smul' := by
    intro c v
    ext i j
    dsimp only []
    rw [e.toMatrix_apply, Pi.smul_apply, LinearEquiv.map_smul]
    rfl
  invFun m j := ∑ i, m i j • e i
  left_inv := by
    intro v
    ext j
    

Proof state:
case h
ι : Type u_1
ι' : Type u_2
κ : Type u_3
κ' : Type u_4
R : Type u_5
M : Type u_6
inst✝⁶ : CommSemiring R
inst✝⁵ : AddCommMonoid M
inst✝⁴ : Module R M
R₂ : Type u_7
M₂ : Type u_8
inst✝³ : CommRing R₂
inst✝² : AddCommGroup M₂
inst✝¹ : Module R₂ M₂
e✝ : Basis ι R M
v✝ : ι' → M
i : ι
j✝ : ι'
inst✝ : Fintype ι
e : Basis ι R M
v : ι → M
j : ι
⊢ (fun m j => ∑ i : ι, m i j • e i)
      (AddHom.toFun
        {
            toAddHom :=
              { toFun := toMatrix e,
                map_add' := (_ : ∀ (v w : ι → M), toMatrix e (v + w) = toMatrix e v + toMatrix e w) },
            map_smul' :=
              (_ :
                ∀ (c : R) (v : ι → M),
                  AddHom.toFun
                      { toFun := toMatrix e,
                        map_add' := (_ : ∀ (v w : ι → M), toMatrix e (v + w) = toMatrix e v + toMatrix e w) }
                      (c • v) =
                    (RingHom.id R) c •
                      AddHom.toFun
                        { toFun := toMatrix e,
                          map_add' := (_ : ∀ (v w : ι → M), toMatrix e (v + w) = toMatrix e v + toMatrix e w) }
                        v) }.toAddHom
        v)
      j =
    v j

Next tactic:
exact e.sum_toMatrix_smul_self v j
/-- From a basis `e : ι → M`, build a linear equivalence between families of vectors `v : ι → M`,
and matrices, making the matrix whose columns are the vectors `v i` written in the basis `e`. -/
def toMatrixEquiv [Fintype ι] (e : Basis ι R M) : (ι → M) ≃ₗ[R] Matrix ι ι R where
  toFun := e.toMatrix
  map_add' v w := by
    ext i j
    change _ = _ + _
    rw [e.toMatrix_apply, Pi.add_apply, LinearEquiv.map_add]
    rfl
  map_smul' := by
    intro c v
    ext i j
    dsimp only []
    rw [e.toMatrix_apply, Pi.smul_apply, LinearEquiv.map_smul]
    rfl
  invFun m j := ∑ i, m i j • e i
  left_inv := by
    intro v
    ext j
    exact e.sum_toMatrix_smul_self v j
  right_inv := by
    

Proof state:
ι : Type u_1
ι' : Type u_2
κ : Type u_3
κ' : Type u_4
R : Type u_5
M : Type u_6
inst✝⁶ : CommSemiring R
inst✝⁵ : AddCommMonoid M
inst✝⁴ : Module R M
R₂ : Type u_7
M₂ : Type u_8
inst✝³ : CommRing R₂
inst✝² : AddCommGroup M₂
inst✝¹ : Module R₂ M₂
e✝ : Basis ι R M
v : ι' → M
i : ι
j : ι'
inst✝ : Fintype ι
e : Basis ι R M
⊢ Function.RightInverse (fun m j => ∑ i : ι, m i j • e i)
    {
          toAddHom :=
            { toFun := toMatrix e,
              map_add' := (_ : ∀ (v w : ι → M), toMatrix e (v + w) = toMatrix e v + toMatrix e w) },
          map_smul' :=
            (_ :
              ∀ (c : R) (v : ι → M),
                AddHom.toFun
                    { toFun := toMatrix e,
                      map_add' := (_ : ∀ (v w : ι → M), toMatrix e (v + w) = toMatrix e v + toMatrix e w) }
                    (c • v) =
                  (RingHom.id R) c •
                    AddHom.toFun
                      { toFun := toMatrix e,
                        map_add' := (_ : ∀ (v w : ι → M), toMatrix e (v + w) = toMatrix e v + toMatrix e w) }
                      v) }.toAddHom.toFun

Next tactic:
intro m
/-- From a basis `e : ι → M`, build a linear equivalence between families of vectors `v : ι → M`,
and matrices, making the matrix whose columns are the vectors `v i` written in the basis `e`. -/
def toMatrixEquiv [Fintype ι] (e : Basis ι R M) : (ι → M) ≃ₗ[R] Matrix ι ι R where
  toFun := e.toMatrix
  map_add' v w := by
    ext i j
    change _ = _ + _
    rw [e.toMatrix_apply, Pi.add_apply, LinearEquiv.map_add]
    rfl
  map_smul' := by
    intro c v
    ext i j
    dsimp only []
    rw [e.toMatrix_apply, Pi.smul_apply, LinearEquiv.map_smul]
    rfl
  invFun m j := ∑ i, m i j • e i
  left_inv := by
    intro v
    ext j
    exact e.sum_toMatrix_smul_self v j
  right_inv := by
    intro m
    

Proof state:
ι : Type u_1
ι' : Type u_2
κ : Type u_3
κ' : Type u_4
R : Type u_5
M : Type u_6
inst✝⁶ : CommSemiring R
inst✝⁵ : AddCommMonoid M
inst✝⁴ : Module R M
R₂ : Type u_7
M₂ : Type u_8
inst✝³ : CommRing R₂
inst✝² : AddCommGroup M₂
inst✝¹ : Module R₂ M₂
e✝ : Basis ι R M
v : ι' → M
i : ι
j : ι'
inst✝ : Fintype ι
e : Basis ι R M
m : Matrix ι ι R
⊢ AddHom.toFun
      {
          toAddHom :=
            { toFun := toMatrix e,
              map_add' := (_ : ∀ (v w : ι → M), toMatrix e (v + w) = toMatrix e v + toMatrix e w) },
          map_smul' :=
            (_ :
              ∀ (c : R) (v : ι → M),
                AddHom.toFun
                    { toFun := toMatrix e,
                      map_add' := (_ : ∀ (v w : ι → M), toMatrix e (v + w) = toMatrix e v + toMatrix e w) }
                    (c • v) =
                  (RingHom.id R) c •
                    AddHom.toFun
                      { toFun := toMatrix e,
                        map_add' := (_ : ∀ (v w : ι → M), toMatrix e (v + w) = toMatrix e v + toMatrix e w) }
                      v) }.toAddHom
      ((fun m j => ∑ i : ι, m i j • e i) m) =
    m

Next tactic:
ext k l
/-- From a basis `e : ι → M`, build a linear equivalence between families of vectors `v : ι → M`,
and matrices, making the matrix whose columns are the vectors `v i` written in the basis `e`. -/
def toMatrixEquiv [Fintype ι] (e : Basis ι R M) : (ι → M) ≃ₗ[R] Matrix ι ι R where
  toFun := e.toMatrix
  map_add' v w := by
    ext i j
    change _ = _ + _
    rw [e.toMatrix_apply, Pi.add_apply, LinearEquiv.map_add]
    rfl
  map_smul' := by
    intro c v
    ext i j
    dsimp only []
    rw [e.toMatrix_apply, Pi.smul_apply, LinearEquiv.map_smul]
    rfl
  invFun m j := ∑ i, m i j • e i
  left_inv := by
    intro v
    ext j
    exact e.sum_toMatrix_smul_self v j
  right_inv := by
    intro m
    ext k l
    

Proof state:
case a.h
ι : Type u_1
ι' : Type u_2
κ : Type u_3
κ' : Type u_4
R : Type u_5
M : Type u_6
inst✝⁶ : CommSemiring R
inst✝⁵ : AddCommMonoid M
inst✝⁴ : Module R M
R₂ : Type u_7
M₂ : Type u_8
inst✝³ : CommRing R₂
inst✝² : AddCommGroup M₂
inst✝¹ : Module R₂ M₂
e✝ : Basis ι R M
v : ι' → M
i : ι
j : ι'
inst✝ : Fintype ι
e : Basis ι R M
m : Matrix ι ι R
k l : ι
⊢ AddHom.toFun
      {
          toAddHom :=
            { toFun := toMatrix e,
              map_add' := (_ : ∀ (v w : ι → M), toMatrix e (v + w) = toMatrix e v + toMatrix e w) },
          map_smul' :=
            (_ :
              ∀ (c : R) (v : ι → M),
                AddHom.toFun
                    { toFun := toMatrix e,
                      map_add' := (_ : ∀ (v w : ι → M), toMatrix e (v + w) = toMatrix e v + toMatrix e w) }
                    (c • v) =
                  (RingHom.id R) c •
                    AddHom.toFun
                      { toFun := toMatrix e,
                        map_add' := (_ : ∀ (v w : ι → M), toMatrix e (v + w) = toMatrix e v + toMatrix e w) }
                      v) }.toAddHom
      ((fun m j => ∑ i : ι, m i j • e i) m) k l =
    m k l

Next tactic:
simp only [e.toMatrix_apply, ← e.equivFun_apply, ← e.equivFun_symm_apply,
      LinearEquiv.apply_symm_apply]
@[simp]
theorem basis_toMatrix_mul_linearMap_toMatrix [DecidableEq ι'] :
    c.toMatrix c' * LinearMap.toMatrix b' c' f = LinearMap.toMatrix b' c f :=
  (Matrix.toLin b' c).injective
    (by
      

Proof state:
ι : Type u_1
ι' : Type u_2
κ : Type u_3
κ' : Type u_4
R : Type u_5
M : Type u_6
inst✝¹¹ : CommSemiring R
inst✝¹⁰ : AddCommMonoid M
inst✝⁹ : Module R M
R₂ : Type u_7
M₂ : Type u_8
inst✝⁸ : CommRing R₂
inst✝⁷ : AddCommGroup M₂
inst✝⁶ : Module R₂ M₂
e : Basis ι R M
v : ι' → M
i : ι
j : ι'
N : Type u_9
inst✝⁵ : AddCommMonoid N
inst✝⁴ : Module R N
b : Basis ι R M
b' : Basis ι' R M
c : Basis κ R N
c' : Basis κ' R N
f : M →ₗ[R] N
inst✝³ : Fintype ι'
inst✝² : Fintype κ
inst✝¹ : Fintype κ'
inst✝ : DecidableEq ι'
⊢ (toLin b' c) (Basis.toMatrix c ⇑c' * (toMatrix b' c') f) = (toLin b' c) ((toMatrix b' c) f)

Next tactic:
haveI := Classical.decEq κ'
@[simp]
theorem basis_toMatrix_mul_linearMap_toMatrix [DecidableEq ι'] :
    c.toMatrix c' * LinearMap.toMatrix b' c' f = LinearMap.toMatrix b' c f :=
  (Matrix.toLin b' c).injective
    (by
      haveI := Classical.decEq κ'
      

Proof state:
ι : Type u_1
ι' : Type u_2
κ : Type u_3
κ' : Type u_4
R : Type u_5
M : Type u_6
inst✝¹¹ : CommSemiring R
inst✝¹⁰ : AddCommMonoid M
inst✝⁹ : Module R M
R₂ : Type u_7
M₂ : Type u_8
inst✝⁸ : CommRing R₂
inst✝⁷ : AddCommGroup M₂
inst✝⁶ : Module R₂ M₂
e : Basis ι R M
v : ι' → M
i : ι
j : ι'
N : Type u_9
inst✝⁵ : AddCommMonoid N
inst✝⁴ : Module R N
b : Basis ι R M
b' : Basis ι' R M
c : Basis κ R N
c' : Basis κ' R N
f : M →ₗ[R] N
inst✝³ : Fintype ι'
inst✝² : Fintype κ
inst✝¹ : Fintype κ'
inst✝ : DecidableEq ι'
this : DecidableEq κ'
⊢ (toLin b' c) (Basis.toMatrix c ⇑c' * (toMatrix b' c') f) = (toLin b' c) ((toMatrix b' c) f)

Next tactic:
rw [toLin_toMatrix, toLin_mul b' c' c, toLin_toMatrix, c.toLin_toMatrix, id_comp]
@[simp]
theorem linearMap_toMatrix_mul_basis_toMatrix [DecidableEq ι] [DecidableEq ι'] :
    LinearMap.toMatrix b' c' f * b'.toMatrix b = LinearMap.toMatrix b c' f :=
  (Matrix.toLin b c').injective
    (by 

Proof state:
ι : Type u_1
ι' : Type u_2
κ : Type u_3
κ' : Type u_4
R : Type u_5
M : Type u_6
inst✝¹³ : CommSemiring R
inst✝¹² : AddCommMonoid M
inst✝¹¹ : Module R M
R₂ : Type u_7
M₂ : Type u_8
inst✝¹⁰ : CommRing R₂
inst✝⁹ : AddCommGroup M₂
inst✝⁸ : Module R₂ M₂
e : Basis ι R M
v : ι' → M
i : ι
j : ι'
N : Type u_9
inst✝⁷ : AddCommMonoid N
inst✝⁶ : Module R N
b : Basis ι R M
b' : Basis ι' R M
c : Basis κ R N
c' : Basis κ' R N
f : M →ₗ[R] N
inst✝⁵ : Fintype ι'
inst✝⁴ : Fintype κ
inst✝³ : Fintype κ'
inst✝² : Fintype ι
inst✝¹ : DecidableEq ι
inst✝ : DecidableEq ι'
⊢ (toLin b c') ((toMatrix b' c') f * Basis.toMatrix b' ⇑b) = (toLin b c') ((toMatrix b c') f)

Next tactic:
rw [toLin_toMatrix, toLin_mul b b' c', toLin_toMatrix, b'.toLin_toMatrix, comp_id]
theorem basis_toMatrix_mul_linearMap_toMatrix_mul_basis_toMatrix [DecidableEq ι] [DecidableEq ι'] :
    c.toMatrix c' * LinearMap.toMatrix b' c' f * b'.toMatrix b = LinearMap.toMatrix b c f := by
  

Proof state:
ι : Type u_1
ι' : Type u_2
κ : Type u_3
κ' : Type u_4
R : Type u_5
M : Type u_6
inst✝¹³ : CommSemiring R
inst✝¹² : AddCommMonoid M
inst✝¹¹ : Module R M
R₂ : Type u_7
M₂ : Type u_8
inst✝¹⁰ : CommRing R₂
inst✝⁹ : AddCommGroup M₂
inst✝⁸ : Module R₂ M₂
e : Basis ι R M
v : ι' → M
i : ι
j : ι'
N : Type u_9
inst✝⁷ : AddCommMonoid N
inst✝⁶ : Module R N
b : Basis ι R M
b' : Basis ι' R M
c : Basis κ R N
c' : Basis κ' R N
f : M →ₗ[R] N
inst✝⁵ : Fintype ι'
inst✝⁴ : Fintype κ
inst✝³ : Fintype κ'
inst✝² : Fintype ι
inst✝¹ : DecidableEq ι
inst✝ : DecidableEq ι'
⊢ Basis.toMatrix c ⇑c' * (toMatrix b' c') f * Basis.toMatrix b' ⇑b = (toMatrix b c) f

Next tactic:
rw [basis_toMatrix_mul_linearMap_toMatrix, linearMap_toMatrix_mul_basis_toMatrix]
theorem basis_toMatrix_mul [DecidableEq κ] (b₁ : Basis ι R M) (b₂ : Basis ι' R M) (b₃ : Basis κ R N)
    (A : Matrix ι' κ R) : b₁.toMatrix b₂ * A = LinearMap.toMatrix b₃ b₁ (toLin b₃ b₂ A) := by
  

Proof state:
ι : Type u_1
ι' : Type u_2
κ : Type u_3
κ' : Type u_4
R : Type u_5
M : Type u_6
inst✝¹² : CommSemiring R
inst✝¹¹ : AddCommMonoid M
inst✝¹⁰ : Module R M
R₂ : Type u_7
M₂ : Type u_8
inst✝⁹ : CommRing R₂
inst✝⁸ : AddCommGroup M₂
inst✝⁷ : Module R₂ M₂
e : Basis ι R M
v : ι' → M
i : ι
j : ι'
N : Type u_9
inst✝⁶ : AddCommMonoid N
inst✝⁵ : Module R N
b : Basis ι R M
b' : Basis ι' R M
c : Basis κ R N
c' : Basis κ' R N
f : M →ₗ[R] N
inst✝⁴ : Fintype ι'
inst✝³ : Fintype κ
inst✝² : Fintype κ'
inst✝¹ : Fintype ι
inst✝ : DecidableEq κ
b₁ : Basis ι R M
b₂ : Basis ι' R M
b₃ : Basis κ R N
A : Matrix ι' κ R
⊢ Basis.toMatrix b₁ ⇑b₂ * A = (toMatrix b₃ b₁) ((toLin b₃ b₂) A)

Next tactic:
have := basis_toMatrix_mul_linearMap_toMatrix b₃ b₁ b₂ (Matrix.toLin b₃ b₂ A)
theorem basis_toMatrix_mul [DecidableEq κ] (b₁ : Basis ι R M) (b₂ : Basis ι' R M) (b₃ : Basis κ R N)
    (A : Matrix ι' κ R) : b₁.toMatrix b₂ * A = LinearMap.toMatrix b₃ b₁ (toLin b₃ b₂ A) := by
  have := basis_toMatrix_mul_linearMap_toMatrix b₃ b₁ b₂ (Matrix.toLin b₃ b₂ A)
  

Proof state:
ι : Type u_1
ι' : Type u_2
κ : Type u_3
κ' : Type u_4
R : Type u_5
M : Type u_6
inst✝¹² : CommSemiring R
inst✝¹¹ : AddCommMonoid M
inst✝¹⁰ : Module R M
R₂ : Type u_7
M₂ : Type u_8
inst✝⁹ : CommRing R₂
inst✝⁸ : AddCommGroup M₂
inst✝⁷ : Module R₂ M₂
e : Basis ι R M
v : ι' → M
i : ι
j : ι'
N : Type u_9
inst✝⁶ : AddCommMonoid N
inst✝⁵ : Module R N
b : Basis ι R M
b' : Basis ι' R M
c : Basis κ R N
c' : Basis κ' R N
f : M →ₗ[R] N
inst✝⁴ : Fintype ι'
inst✝³ : Fintype κ
inst✝² : Fintype κ'
inst✝¹ : Fintype ι
inst✝ : DecidableEq κ
b₁ : Basis ι R M
b₂ : Basis ι' R M
b₃ : Basis κ R N
A : Matrix ι' κ R
this : Basis.toMatrix b₁ ⇑b₂ * (toMatrix b₃ b₂) ((toLin b₃ b₂) A) = (toMatrix b₃ b₁) ((toLin b₃ b₂) A)
⊢ Basis.toMatrix b₁ ⇑b₂ * A = (toMatrix b₃ b₁) ((toLin b₃ b₂) A)

Next tactic:
rwa [LinearMap.toMatrix_toLin] at this
theorem mul_basis_toMatrix [DecidableEq ι] [DecidableEq ι'] (b₁ : Basis ι R M) (b₂ : Basis ι' R M)
    (b₃ : Basis κ R N) (A : Matrix κ ι R) :
    A * b₁.toMatrix b₂ = LinearMap.toMatrix b₂ b₃ (toLin b₁ b₃ A) := by
  

Proof state:
ι : Type u_1
ι' : Type u_2
κ : Type u_3
κ' : Type u_4
R : Type u_5
M : Type u_6
inst✝¹³ : CommSemiring R
inst✝¹² : AddCommMonoid M
inst✝¹¹ : Module R M
R₂ : Type u_7
M₂ : Type u_8
inst✝¹⁰ : CommRing R₂
inst✝⁹ : AddCommGroup M₂
inst✝⁸ : Module R₂ M₂
e : Basis ι R M
v : ι' → M
i : ι
j : ι'
N : Type u_9
inst✝⁷ : AddCommMonoid N
inst✝⁶ : Module R N
b : Basis ι R M
b' : Basis ι' R M
c : Basis κ R N
c' : Basis κ' R N
f : M →ₗ[R] N
inst✝⁵ : Fintype ι'
inst✝⁴ : Fintype κ
inst✝³ : Fintype κ'
inst✝² : Fintype ι
inst✝¹ : DecidableEq ι
inst✝ : DecidableEq ι'
b₁ : Basis ι R M
b₂ : Basis ι' R M
b₃ : Basis κ R N
A : Matrix κ ι R
⊢ A * Basis.toMatrix b₁ ⇑b₂ = (toMatrix b₂ b₃) ((toLin b₁ b₃) A)

Next tactic:
have := linearMap_toMatrix_mul_basis_toMatrix b₂ b₁ b₃ (Matrix.toLin b₁ b₃ A)
theorem mul_basis_toMatrix [DecidableEq ι] [DecidableEq ι'] (b₁ : Basis ι R M) (b₂ : Basis ι' R M)
    (b₃ : Basis κ R N) (A : Matrix κ ι R) :
    A * b₁.toMatrix b₂ = LinearMap.toMatrix b₂ b₃ (toLin b₁ b₃ A) := by
  have := linearMap_toMatrix_mul_basis_toMatrix b₂ b₁ b₃ (Matrix.toLin b₁ b₃ A)
  

Proof state:
ι : Type u_1
ι' : Type u_2
κ : Type u_3
κ' : Type u_4
R : Type u_5
M : Type u_6
inst✝¹³ : CommSemiring R
inst✝¹² : AddCommMonoid M
inst✝¹¹ : Module R M
R₂ : Type u_7
M₂ : Type u_8
inst✝¹⁰ : CommRing R₂
inst✝⁹ : AddCommGroup M₂
inst✝⁸ : Module R₂ M₂
e : Basis ι R M
v : ι' → M
i : ι
j : ι'
N : Type u_9
inst✝⁷ : AddCommMonoid N
inst✝⁶ : Module R N
b : Basis ι R M
b' : Basis ι' R M
c : Basis κ R N
c' : Basis κ' R N
f : M →ₗ[R] N
inst✝⁵ : Fintype ι'
inst✝⁴ : Fintype κ
inst✝³ : Fintype κ'
inst✝² : Fintype ι
inst✝¹ : DecidableEq ι
inst✝ : DecidableEq ι'
b₁ : Basis ι R M
b₂ : Basis ι' R M
b₃ : Basis κ R N
A : Matrix κ ι R
this : (toMatrix b₁ b₃) ((toLin b₁ b₃) A) * Basis.toMatrix b₁ ⇑b₂ = (toMatrix b₂ b₃) ((toLin b₁ b₃) A)
⊢ A * Basis.toMatrix b₁ ⇑b₂ = (toMatrix b₂ b₃) ((toLin b₁ b₃) A)

Next tactic:
rwa [LinearMap.toMatrix_toLin] at this
theorem basis_toMatrix_basisFun_mul (b : Basis ι R (ι → R)) (A : Matrix ι ι R) :
    b.toMatrix (Pi.basisFun R ι) * A = of fun i j => b.repr (Aᵀ j) i := by
  

Proof state:
ι : Type u_1
ι' : Type u_2
κ : Type u_3
κ' : Type u_4
R : Type u_5
M : Type u_6
inst✝¹¹ : CommSemiring R
inst✝¹⁰ : AddCommMonoid M
inst✝⁹ : Module R M
R₂ : Type u_7
M₂ : Type u_8
inst✝⁸ : CommRing R₂
inst✝⁷ : AddCommGroup M₂
inst✝⁶ : Module R₂ M₂
e : Basis ι R M
v : ι' → M
i : ι
j : ι'
N : Type u_9
inst✝⁵ : AddCommMonoid N
inst✝⁴ : Module R N
b✝ : Basis ι R M
b' : Basis ι' R M
c : Basis κ R N
c' : Basis κ' R N
f : M →ₗ[R] N
inst✝³ : Fintype ι'
inst✝² : Fintype κ
inst✝¹ : Fintype κ'
inst✝ : Fintype ι
b : Basis ι R (ι → R)
A : Matrix ι ι R
⊢ Basis.toMatrix b ⇑(Pi.basisFun R ι) * A = of fun i j => (b.repr (Aᵀ j)) i

Next tactic:
classical
    simp only [basis_toMatrix_mul _ _ (Pi.basisFun R ι), Matrix.toLin_eq_toLin']
    ext i j
    rw [LinearMap.toMatrix_apply, Matrix.toLin'_apply, Pi.basisFun_apply,
      Matrix.mulVec_stdBasis_apply, Matrix.of_apply]
theorem basis_toMatrix_basisFun_mul (b : Basis ι R (ι → R)) (A : Matrix ι ι R) :
    b.toMatrix (Pi.basisFun R ι) * A = of fun i j => b.repr (Aᵀ j) i := by
  classical
    

Proof state:
ι : Type u_1
ι' : Type u_2
κ : Type u_3
κ' : Type u_4
R : Type u_5
M : Type u_6
inst✝¹¹ : CommSemiring R
inst✝¹⁰ : AddCommMonoid M
inst✝⁹ : Module R M
R₂ : Type u_7
M₂ : Type u_8
inst✝⁸ : CommRing R₂
inst✝⁷ : AddCommGroup M₂
inst✝⁶ : Module R₂ M₂
e : Basis ι R M
v : ι' → M
i : ι
j : ι'
N : Type u_9
inst✝⁵ : AddCommMonoid N
inst✝⁴ : Module R N
b✝ : Basis ι R M
b' : Basis ι' R M
c : Basis κ R N
c' : Basis κ' R N
f : M →ₗ[R] N
inst✝³ : Fintype ι'
inst✝² : Fintype κ
inst✝¹ : Fintype κ'
inst✝ : Fintype ι
b : Basis ι R (ι → R)
A : Matrix ι ι R
⊢ Basis.toMatrix b ⇑(Pi.basisFun R ι) * A = of fun i j => (b.repr (Aᵀ j)) i

Next tactic:
simp only [basis_toMatrix_mul _ _ (Pi.basisFun R ι), Matrix.toLin_eq_toLin']
theorem basis_toMatrix_basisFun_mul (b : Basis ι R (ι → R)) (A : Matrix ι ι R) :
    b.toMatrix (Pi.basisFun R ι) * A = of fun i j => b.repr (Aᵀ j) i := by
  classical
    simp only [basis_toMatrix_mul _ _ (Pi.basisFun R ι), Matrix.toLin_eq_toLin']
    

Proof state:
ι : Type u_1
ι' : Type u_2
κ : Type u_3
κ' : Type u_4
R : Type u_5
M : Type u_6
inst✝¹¹ : CommSemiring R
inst✝¹⁰ : AddCommMonoid M
inst✝⁹ : Module R M
R₂ : Type u_7
M₂ : Type u_8
inst✝⁸ : CommRing R₂
inst✝⁷ : AddCommGroup M₂
inst✝⁶ : Module R₂ M₂
e : Basis ι R M
v : ι' → M
i : ι
j : ι'
N : Type u_9
inst✝⁵ : AddCommMonoid N
inst✝⁴ : Module R N
b✝ : Basis ι R M
b' : Basis ι' R M
c : Basis κ R N
c' : Basis κ' R N
f : M →ₗ[R] N
inst✝³ : Fintype ι'
inst✝² : Fintype κ
inst✝¹ : Fintype κ'
inst✝ : Fintype ι
b : Basis ι R (ι → R)
A : Matrix ι ι R
⊢ (toMatrix (Pi.basisFun R ι) b) (toLin' A) = of fun i j => (b.repr (Aᵀ j)) i

Next tactic:
ext i j
theorem basis_toMatrix_basisFun_mul (b : Basis ι R (ι → R)) (A : Matrix ι ι R) :
    b.toMatrix (Pi.basisFun R ι) * A = of fun i j => b.repr (Aᵀ j) i := by
  classical
    simp only [basis_toMatrix_mul _ _ (Pi.basisFun R ι), Matrix.toLin_eq_toLin']
    ext i j
    

Proof state:
case a.h
ι : Type u_1
ι' : Type u_2
κ : Type u_3
κ' : Type u_4
R : Type u_5
M : Type u_6
inst✝¹¹ : CommSemiring R
inst✝¹⁰ : AddCommMonoid M
inst✝⁹ : Module R M
R₂ : Type u_7
M₂ : Type u_8
inst✝⁸ : CommRing R₂
inst✝⁷ : AddCommGroup M₂
inst✝⁶ : Module R₂ M₂
e : Basis ι R M
v : ι' → M
i✝ : ι
j✝ : ι'
N : Type u_9
inst✝⁵ : AddCommMonoid N
inst✝⁴ : Module R N
b✝ : Basis ι R M
b' : Basis ι' R M
c : Basis κ R N
c' : Basis κ' R N
f : M →ₗ[R] N
inst✝³ : Fintype ι'
inst✝² : Fintype κ
inst✝¹ : Fintype κ'
inst✝ : Fintype ι
b : Basis ι R (ι → R)
A : Matrix ι ι R
i j : ι
⊢ (toMatrix (Pi.basisFun R ι) b) (toLin' A) i j = of (fun i j => (b.repr (Aᵀ j)) i) i j

Next tactic:
rw [LinearMap.toMatrix_apply, Matrix.toLin'_apply, Pi.basisFun_apply,
      Matrix.mulVec_stdBasis_apply, Matrix.of_apply]
/-- A generalization of `LinearMap.toMatrix_id`. -/
@[simp]
theorem LinearMap.toMatrix_id_eq_basis_toMatrix [DecidableEq ι] :
    LinearMap.toMatrix b b' id = b'.toMatrix b := by
  

Proof state:
ι : Type u_1
ι' : Type u_2
κ : Type u_3
κ' : Type u_4
R : Type u_5
M : Type u_6
inst✝¹² : CommSemiring R
inst✝¹¹ : AddCommMonoid M
inst✝¹⁰ : Module R M
R₂ : Type u_7
M₂ : Type u_8
inst✝⁹ : CommRing R₂
inst✝⁸ : AddCommGroup M₂
inst✝⁷ : Module R₂ M₂
e : Basis ι R M
v : ι' → M
i : ι
j : ι'
N : Type u_9
inst✝⁶ : AddCommMonoid N
inst✝⁵ : Module R N
b : Basis ι R M
b' : Basis ι' R M
c : Basis κ R N
c' : Basis κ' R N
f : M →ₗ[R] N
inst✝⁴ : Fintype ι'
inst✝³ : Fintype κ
inst✝² : Fintype κ'
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
⊢ (toMatrix b b') id = Basis.toMatrix b' ⇑b

Next tactic:
haveI := Classical.decEq ι'
/-- A generalization of `LinearMap.toMatrix_id`. -/
@[simp]
theorem LinearMap.toMatrix_id_eq_basis_toMatrix [DecidableEq ι] :
    LinearMap.toMatrix b b' id = b'.toMatrix b := by
  haveI := Classical.decEq ι'
  

Proof state:
ι : Type u_1
ι' : Type u_2
κ : Type u_3
κ' : Type u_4
R : Type u_5
M : Type u_6
inst✝¹² : CommSemiring R
inst✝¹¹ : AddCommMonoid M
inst✝¹⁰ : Module R M
R₂ : Type u_7
M₂ : Type u_8
inst✝⁹ : CommRing R₂
inst✝⁸ : AddCommGroup M₂
inst✝⁷ : Module R₂ M₂
e : Basis ι R M
v : ι' → M
i : ι
j : ι'
N : Type u_9
inst✝⁶ : AddCommMonoid N
inst✝⁵ : Module R N
b : Basis ι R M
b' : Basis ι' R M
c : Basis κ R N
c' : Basis κ' R N
f : M →ₗ[R] N
inst✝⁴ : Fintype ι'
inst✝³ : Fintype κ
inst✝² : Fintype κ'
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
this : DecidableEq ι'
⊢ (toMatrix b b') id = Basis.toMatrix b' ⇑b

Next tactic:
rw [← @basis_toMatrix_mul_linearMap_toMatrix _ _ ι, toMatrix_id, Matrix.mul_one]
/-- See also `Basis.toMatrix_reindex` which gives the `simp` normal form of this result. -/
theorem Basis.toMatrix_reindex' [DecidableEq ι] [DecidableEq ι'] (b : Basis ι R M) (v : ι' → M)
    (e : ι ≃ ι') : (b.reindex e).toMatrix v = Matrix.reindexAlgEquiv _ e (b.toMatrix (v ∘ e)) := by
  

Proof state:
ι : Type u_1
ι' : Type u_2
κ : Type u_3
κ' : Type u_4
R : Type u_5
M : Type u_6
inst✝¹³ : CommSemiring R
inst✝¹² : AddCommMonoid M
inst✝¹¹ : Module R M
R₂ : Type u_7
M₂ : Type u_8
inst✝¹⁰ : CommRing R₂
inst✝⁹ : AddCommGroup M₂
inst✝⁸ : Module R₂ M₂
e✝ : Basis ι R M
v✝ : ι' → M
i : ι
j : ι'
N : Type u_9
inst✝⁷ : AddCommMonoid N
inst✝⁶ : Module R N
b✝ : Basis ι R M
b' : Basis ι' R M
c : Basis κ R N
c' : Basis κ' R N
f : M →ₗ[R] N
inst✝⁵ : Fintype ι'
inst✝⁴ : Fintype κ
inst✝³ : Fintype κ'
inst✝² : Fintype ι
inst✝¹ : DecidableEq ι
inst✝ : DecidableEq ι'
b : Basis ι R M
v : ι' → M
e : ι ≃ ι'
⊢ toMatrix (reindex b e) v = (reindexAlgEquiv R e) (toMatrix b (v ∘ ⇑e))

Next tactic:
ext