l3lab/ntp-mathlib huggingface dataset:
theorem range_vecMulLinear (M : Matrix m n R) :
    LinearMap.range M.vecMulLinear = span R (range M) := by
  

Proof state:
R : Type u_1
inst✝² : Semiring R
l : Type u_2
m : Type u_3
n : Type u_4
inst✝¹ : Fintype m
inst✝ : DecidableEq m
M : Matrix m n R
⊢ LinearMap.range (vecMulLinear M) = span R (Set.range M)

Next tactic:
letI := Classical.decEq m
theorem range_vecMulLinear (M : Matrix m n R) :
    LinearMap.range M.vecMulLinear = span R (range M) := by
  letI := Classical.decEq m
  

Proof state:
R : Type u_1
inst✝² : Semiring R
l : Type u_2
m : Type u_3
n : Type u_4
inst✝¹ : Fintype m
inst✝ : DecidableEq m
M : Matrix m n R
this : DecidableEq m := Classical.decEq m
⊢ LinearMap.range (vecMulLinear M) = span R (Set.range M)

Next tactic:
simp_rw [range_eq_map, ← iSup_range_stdBasis, Submodule.map_iSup, range_eq_map, ←
    Ideal.span_singleton_one, Ideal.span, Submodule.map_span, image_image, image_singleton,
    Matrix.vecMulLinear_apply, iSup_span, range_eq_iUnion, iUnion_singleton_eq_range,
    LinearMap.stdBasis, coe_single]
theorem range_vecMulLinear (M : Matrix m n R) :
    LinearMap.range M.vecMulLinear = span R (range M) := by
  letI := Classical.decEq m
  simp_rw [range_eq_map, ← iSup_range_stdBasis, Submodule.map_iSup, range_eq_map, ←
    Ideal.span_singleton_one, Ideal.span, Submodule.map_span, image_image, image_singleton,
    Matrix.vecMulLinear_apply, iSup_span, range_eq_iUnion, iUnion_singleton_eq_range,
    LinearMap.stdBasis, coe_single]
  

Proof state:
R : Type u_1
inst✝² : Semiring R
l : Type u_2
m : Type u_3
n : Type u_4
inst✝¹ : Fintype m
inst✝ : DecidableEq m
M : Matrix m n R
this : DecidableEq m := Classical.decEq m
⊢ span R (Set.range fun x => vecMul (Pi.single x 1) M) = span R (Set.range fun x => M x)

Next tactic:
unfold vecMul
theorem range_vecMulLinear (M : Matrix m n R) :
    LinearMap.range M.vecMulLinear = span R (range M) := by
  letI := Classical.decEq m
  simp_rw [range_eq_map, ← iSup_range_stdBasis, Submodule.map_iSup, range_eq_map, ←
    Ideal.span_singleton_one, Ideal.span, Submodule.map_span, image_image, image_singleton,
    Matrix.vecMulLinear_apply, iSup_span, range_eq_iUnion, iUnion_singleton_eq_range,
    LinearMap.stdBasis, coe_single]
  unfold vecMul
  

Proof state:
R : Type u_1
inst✝² : Semiring R
l : Type u_2
m : Type u_3
n : Type u_4
inst✝¹ : Fintype m
inst✝ : DecidableEq m
M : Matrix m n R
this : DecidableEq m := Classical.decEq m
⊢ span R
      (Set.range fun x x_1 =>
        let j := x_1;
        Pi.single x 1 ⬝ᵥ fun i => M i j) =
    span R (Set.range fun x => M x)

Next tactic:
simp_rw [single_dotProduct, one_mul]
theorem Matrix.vecMul_injective_iff {R : Type*} [CommRing R] {M : Matrix m n R} :
    Function.Injective M.vecMul ↔ LinearIndependent R (fun i ↦ M i) := by
  

Proof state:
R✝ : Type u_1
inst✝³ : Semiring R✝
l : Type u_2
m : Type u_3
n : Type u_4
inst✝² : Fintype m
inst✝¹ : DecidableEq m
R : Type u_5
inst✝ : CommRing R
M : Matrix m n R
⊢ (Function.Injective fun v => vecMul v M) ↔ LinearIndependent R fun i => M i

Next tactic:
rw [← coe_vecMulLinear]
theorem Matrix.vecMul_injective_iff {R : Type*} [CommRing R] {M : Matrix m n R} :
    Function.Injective M.vecMul ↔ LinearIndependent R (fun i ↦ M i) := by
  rw [← coe_vecMulLinear]
  

Proof state:
R✝ : Type u_1
inst✝³ : Semiring R✝
l : Type u_2
m : Type u_3
n : Type u_4
inst✝² : Fintype m
inst✝¹ : DecidableEq m
R : Type u_5
inst✝ : CommRing R
M : Matrix m n R
⊢ Function.Injective ⇑(vecMulLinear M) ↔ LinearIndependent R fun i => M i

Next tactic:
simp only [← LinearMap.ker_eq_bot, Fintype.linearIndependent_iff, Submodule.eq_bot_iff,
    LinearMap.mem_ker, vecMulLinear_apply]
theorem Matrix.vecMul_injective_iff {R : Type*} [CommRing R] {M : Matrix m n R} :
    Function.Injective M.vecMul ↔ LinearIndependent R (fun i ↦ M i) := by
  rw [← coe_vecMulLinear]
  simp only [← LinearMap.ker_eq_bot, Fintype.linearIndependent_iff, Submodule.eq_bot_iff,
    LinearMap.mem_ker, vecMulLinear_apply]
  

Proof state:
R✝ : Type u_1
inst✝³ : Semiring R✝
l : Type u_2
m : Type u_3
n : Type u_4
inst✝² : Fintype m
inst✝¹ : DecidableEq m
R : Type u_5
inst✝ : CommRing R
M : Matrix m n R
⊢ (∀ (x : m → R), vecMul x M = 0 → x = 0) ↔ ∀ (g : m → R), ∑ i : m, g i • M i = 0 → ∀ (i : m), g i = 0

Next tactic:
refine ⟨fun h c h0 ↦ congr_fun <| h c ?_, fun h c h0 ↦ funext <| h c ?_⟩
theorem Matrix.vecMul_injective_iff {R : Type*} [CommRing R] {M : Matrix m n R} :
    Function.Injective M.vecMul ↔ LinearIndependent R (fun i ↦ M i) := by
  rw [← coe_vecMulLinear]
  simp only [← LinearMap.ker_eq_bot, Fintype.linearIndependent_iff, Submodule.eq_bot_iff,
    LinearMap.mem_ker, vecMulLinear_apply]
  refine ⟨fun h c h0 ↦ congr_fun <| h c ?_, fun h c h0 ↦ funext <| h c ?_⟩
  · 

Proof state:
case refine_1
R✝ : Type u_1
inst✝³ : Semiring R✝
l : Type u_2
m : Type u_3
n : Type u_4
inst✝² : Fintype m
inst✝¹ : DecidableEq m
R : Type u_5
inst✝ : CommRing R
M : Matrix m n R
h : ∀ (x : m → R), vecMul x M = 0 → x = 0
c : m → R
h0 : ∑ i : m, c i • M i = 0
⊢ vecMul c M = 0

Next tactic:
rw [← h0]
theorem Matrix.vecMul_injective_iff {R : Type*} [CommRing R] {M : Matrix m n R} :
    Function.Injective M.vecMul ↔ LinearIndependent R (fun i ↦ M i) := by
  rw [← coe_vecMulLinear]
  simp only [← LinearMap.ker_eq_bot, Fintype.linearIndependent_iff, Submodule.eq_bot_iff,
    LinearMap.mem_ker, vecMulLinear_apply]
  refine ⟨fun h c h0 ↦ congr_fun <| h c ?_, fun h c h0 ↦ funext <| h c ?_⟩
  · rw [← h0]
    

Proof state:
case refine_1
R✝ : Type u_1
inst✝³ : Semiring R✝
l : Type u_2
m : Type u_3
n : Type u_4
inst✝² : Fintype m
inst✝¹ : DecidableEq m
R : Type u_5
inst✝ : CommRing R
M : Matrix m n R
h : ∀ (x : m → R), vecMul x M = 0 → x = 0
c : m → R
h0 : ∑ i : m, c i • M i = 0
⊢ vecMul c M = ∑ i : m, c i • M i

Next tactic:
ext i
theorem Matrix.vecMul_injective_iff {R : Type*} [CommRing R] {M : Matrix m n R} :
    Function.Injective M.vecMul ↔ LinearIndependent R (fun i ↦ M i) := by
  rw [← coe_vecMulLinear]
  simp only [← LinearMap.ker_eq_bot, Fintype.linearIndependent_iff, Submodule.eq_bot_iff,
    LinearMap.mem_ker, vecMulLinear_apply]
  refine ⟨fun h c h0 ↦ congr_fun <| h c ?_, fun h c h0 ↦ funext <| h c ?_⟩
  · rw [← h0]
    ext i
    

Proof state:
case refine_1.h
R✝ : Type u_1
inst✝³ : Semiring R✝
l : Type u_2
m : Type u_3
n : Type u_4
inst✝² : Fintype m
inst✝¹ : DecidableEq m
R : Type u_5
inst✝ : CommRing R
M : Matrix m n R
h : ∀ (x : m → R), vecMul x M = 0 → x = 0
c : m → R
h0 : ∑ i : m, c i • M i = 0
i : n
⊢ vecMul c M i = Finset.sum Finset.univ (fun i => c i • M i) i

Next tactic:
simp [vecMul, dotProduct]
theorem Matrix.vecMul_injective_iff {R : Type*} [CommRing R] {M : Matrix m n R} :
    Function.Injective M.vecMul ↔ LinearIndependent R (fun i ↦ M i) := by
  rw [← coe_vecMulLinear]
  simp only [← LinearMap.ker_eq_bot, Fintype.linearIndependent_iff, Submodule.eq_bot_iff,
    LinearMap.mem_ker, vecMulLinear_apply]
  refine ⟨fun h c h0 ↦ congr_fun <| h c ?_, fun h c h0 ↦ funext <| h c ?_⟩
  · rw [← h0]
    ext i
    simp [vecMul, dotProduct]
  · 

Proof state:
case refine_2
R✝ : Type u_1
inst✝³ : Semiring R✝
l : Type u_2
m : Type u_3
n : Type u_4
inst✝² : Fintype m
inst✝¹ : DecidableEq m
R : Type u_5
inst✝ : CommRing R
M : Matrix m n R
h : ∀ (g : m → R), ∑ i : m, g i • M i = 0 → ∀ (i : m), g i = 0
c : m → R
h0 : vecMul c M = 0
⊢ ∑ i : m, c i • M i = 0

Next tactic:
rw [← h0]
theorem Matrix.vecMul_injective_iff {R : Type*} [CommRing R] {M : Matrix m n R} :
    Function.Injective M.vecMul ↔ LinearIndependent R (fun i ↦ M i) := by
  rw [← coe_vecMulLinear]
  simp only [← LinearMap.ker_eq_bot, Fintype.linearIndependent_iff, Submodule.eq_bot_iff,
    LinearMap.mem_ker, vecMulLinear_apply]
  refine ⟨fun h c h0 ↦ congr_fun <| h c ?_, fun h c h0 ↦ funext <| h c ?_⟩
  · rw [← h0]
    ext i
    simp [vecMul, dotProduct]
  · rw [← h0]
    

Proof state:
case refine_2
R✝ : Type u_1
inst✝³ : Semiring R✝
l : Type u_2
m : Type u_3
n : Type u_4
inst✝² : Fintype m
inst✝¹ : DecidableEq m
R : Type u_5
inst✝ : CommRing R
M : Matrix m n R
h : ∀ (g : m → R), ∑ i : m, g i • M i = 0 → ∀ (i : m), g i = 0
c : m → R
h0 : vecMul c M = 0
⊢ ∑ i : m, c i • M i = vecMul c M

Next tactic:
ext j
theorem Matrix.vecMul_injective_iff {R : Type*} [CommRing R] {M : Matrix m n R} :
    Function.Injective M.vecMul ↔ LinearIndependent R (fun i ↦ M i) := by
  rw [← coe_vecMulLinear]
  simp only [← LinearMap.ker_eq_bot, Fintype.linearIndependent_iff, Submodule.eq_bot_iff,
    LinearMap.mem_ker, vecMulLinear_apply]
  refine ⟨fun h c h0 ↦ congr_fun <| h c ?_, fun h c h0 ↦ funext <| h c ?_⟩
  · rw [← h0]
    ext i
    simp [vecMul, dotProduct]
  · rw [← h0]
    ext j
    

Proof state:
case refine_2.h
R✝ : Type u_1
inst✝³ : Semiring R✝
l : Type u_2
m : Type u_3
n : Type u_4
inst✝² : Fintype m
inst✝¹ : DecidableEq m
R : Type u_5
inst✝ : CommRing R
M : Matrix m n R
h : ∀ (g : m → R), ∑ i : m, g i • M i = 0 → ∀ (i : m), g i = 0
c : m → R
h0 : vecMul c M = 0
j : n
⊢ Finset.sum Finset.univ (fun i => c i • M i) j = vecMul c M j

Next tactic:
simp [vecMul, dotProduct]
/-- Linear maps `(m → R) →ₗ[R] (n → R)` are linearly equivalent over `Rᵐᵒᵖ` to `Matrix m n R`,
by having matrices act by right multiplication.
 -/
def LinearMap.toMatrixRight' : ((m → R) →ₗ[R] n → R) ≃ₗ[Rᵐᵒᵖ] Matrix m n R where
  toFun f i j := f (stdBasis R (fun _ => R) i 1) j
  invFun := Matrix.vecMulLinear
  right_inv M := by
    ext i j
    simp only [Matrix.vecMul_stdBasis, Matrix.vecMulLinear_apply]
  left_inv f := by
    apply (Pi.basisFun R m).ext
    intro j; ext i
    simp only [Pi.basisFun_apply, Matrix.vecMul_stdBasis, Matrix.vecMulLinear_apply]
  map_add' f g := by
    

Proof state:
R : Type u_1
inst✝² : Semiring R
l : Type u_2
m : Type u_3
n : Type u_4
inst✝¹ : Fintype m
inst✝ : DecidableEq m
f g : (m → R) →ₗ[R] n → R
⊢ (fun f i j => f ((stdBasis R (fun x => R) i) 1) j) (f + g) =
    (fun f i j => f ((stdBasis R (fun x => R) i) 1) j) f + (fun f i j => f ((stdBasis R (fun x => R) i) 1) j) g

Next tactic:
ext i j
/-- Linear maps `(m → R) →ₗ[R] (n → R)` are linearly equivalent over `Rᵐᵒᵖ` to `Matrix m n R`,
by having matrices act by right multiplication.
 -/
def LinearMap.toMatrixRight' : ((m → R) →ₗ[R] n → R) ≃ₗ[Rᵐᵒᵖ] Matrix m n R where
  toFun f i j := f (stdBasis R (fun _ => R) i 1) j
  invFun := Matrix.vecMulLinear
  right_inv M := by
    ext i j
    simp only [Matrix.vecMul_stdBasis, Matrix.vecMulLinear_apply]
  left_inv f := by
    apply (Pi.basisFun R m).ext
    intro j; ext i
    simp only [Pi.basisFun_apply, Matrix.vecMul_stdBasis, Matrix.vecMulLinear_apply]
  map_add' f g := by
    ext i j
    

Proof state:
case a.h
R : Type u_1
inst✝² : Semiring R
l : Type u_2
m : Type u_3
n : Type u_4
inst✝¹ : Fintype m
inst✝ : DecidableEq m
f g : (m → R) →ₗ[R] n → R
i : m
j : n
⊢ (fun f i j => f ((stdBasis R (fun x => R) i) 1) j) (f + g) i j =
    ((fun f i j => f ((stdBasis R (fun x => R) i) 1) j) f + (fun f i j => f ((stdBasis R (fun x => R) i) 1) j) g) i j

Next tactic:
simp only [Pi.add_apply, LinearMap.add_apply, Matrix.add_apply]
/-- Linear maps `(m → R) →ₗ[R] (n → R)` are linearly equivalent over `Rᵐᵒᵖ` to `Matrix m n R`,
by having matrices act by right multiplication.
 -/
def LinearMap.toMatrixRight' : ((m → R) →ₗ[R] n → R) ≃ₗ[Rᵐᵒᵖ] Matrix m n R where
  toFun f i j := f (stdBasis R (fun _ => R) i 1) j
  invFun := Matrix.vecMulLinear
  right_inv M := by
    ext i j
    simp only [Matrix.vecMul_stdBasis, Matrix.vecMulLinear_apply]
  left_inv f := by
    apply (Pi.basisFun R m).ext
    intro j; ext i
    simp only [Pi.basisFun_apply, Matrix.vecMul_stdBasis, Matrix.vecMulLinear_apply]
  map_add' f g := by
    ext i j
    simp only [Pi.add_apply, LinearMap.add_apply, Matrix.add_apply]
  map_smul' c f := by
    

Proof state:
R : Type u_1
inst✝² : Semiring R
l : Type u_2
m : Type u_3
n : Type u_4
inst✝¹ : Fintype m
inst✝ : DecidableEq m
c : Rᵐᵒᵖ
f : (m → R) →ₗ[R] n → R
⊢ AddHom.toFun
      { toFun := fun f i j => f ((stdBasis R (fun x => R) i) 1) j,
        map_add' :=
          (_ :
            ∀ (f g : (m → R) →ₗ[R] n → R),
              (fun f i j => f ((stdBasis R (fun x => R) i) 1) j) (f + g) =
                (fun f i j => f ((stdBasis R (fun x => R) i) 1) j) f +
                  (fun f i j => f ((stdBasis R (fun x => R) i) 1) j) g) }
      (c • f) =
    (RingHom.id Rᵐᵒᵖ) c •
      AddHom.toFun
        { toFun := fun f i j => f ((stdBasis R (fun x => R) i) 1) j,
          map_add' :=
            (_ :
              ∀ (f g : (m → R) →ₗ[R] n → R),
                (fun f i j => f ((stdBasis R (fun x => R) i) 1) j) (f + g) =
                  (fun f i j => f ((stdBasis R (fun x => R) i) 1) j) f +
                    (fun f i j => f ((stdBasis R (fun x => R) i) 1) j) g) }
        f

Next tactic:
ext i j
/-- Linear maps `(m → R) →ₗ[R] (n → R)` are linearly equivalent over `Rᵐᵒᵖ` to `Matrix m n R`,
by having matrices act by right multiplication.
 -/
def LinearMap.toMatrixRight' : ((m → R) →ₗ[R] n → R) ≃ₗ[Rᵐᵒᵖ] Matrix m n R where
  toFun f i j := f (stdBasis R (fun _ => R) i 1) j
  invFun := Matrix.vecMulLinear
  right_inv M := by
    ext i j
    simp only [Matrix.vecMul_stdBasis, Matrix.vecMulLinear_apply]
  left_inv f := by
    apply (Pi.basisFun R m).ext
    intro j; ext i
    simp only [Pi.basisFun_apply, Matrix.vecMul_stdBasis, Matrix.vecMulLinear_apply]
  map_add' f g := by
    ext i j
    simp only [Pi.add_apply, LinearMap.add_apply, Matrix.add_apply]
  map_smul' c f := by
    ext i j
    

Proof state:
case a.h
R : Type u_1
inst✝² : Semiring R
l : Type u_2
m : Type u_3
n : Type u_4
inst✝¹ : Fintype m
inst✝ : DecidableEq m
c : Rᵐᵒᵖ
f : (m → R) →ₗ[R] n → R
i : m
j : n
⊢ AddHom.toFun
      { toFun := fun f i j => f ((stdBasis R (fun x => R) i) 1) j,
        map_add' :=
          (_ :
            ∀ (f g : (m → R) →ₗ[R] n → R),
              (fun f i j => f ((stdBasis R (fun x => R) i) 1) j) (f + g) =
                (fun f i j => f ((stdBasis R (fun x => R) i) 1) j) f +
                  (fun f i j => f ((stdBasis R (fun x => R) i) 1) j) g) }
      (c • f) i j =
    ((RingHom.id Rᵐᵒᵖ) c •
        AddHom.toFun
          { toFun := fun f i j => f ((stdBasis R (fun x => R) i) 1) j,
            map_add' :=
              (_ :
                ∀ (f g : (m → R) →ₗ[R] n → R),
                  (fun f i j => f ((stdBasis R (fun x => R) i) 1) j) (f + g) =
                    (fun f i j => f ((stdBasis R (fun x => R) i) 1) j) f +
                      (fun f i j => f ((stdBasis R (fun x => R) i) 1) j) g) }
          f)
      i j

Next tactic:
simp only [Pi.smul_apply, LinearMap.smul_apply, RingHom.id_apply, Matrix.smul_apply]
/-- Linear maps `(m → R) →ₗ[R] (n → R)` are linearly equivalent over `Rᵐᵒᵖ` to `Matrix m n R`,
by having matrices act by right multiplication.
 -/
def LinearMap.toMatrixRight' : ((m → R) →ₗ[R] n → R) ≃ₗ[Rᵐᵒᵖ] Matrix m n R where
  toFun f i j := f (stdBasis R (fun _ => R) i 1) j
  invFun := Matrix.vecMulLinear
  right_inv M := by
    ext i j
    simp only [Matrix.vecMul_stdBasis, Matrix.vecMulLinear_apply]
  left_inv f := by
    

Proof state:
R : Type u_1
inst✝² : Semiring R
l : Type u_2
m : Type u_3
n : Type u_4
inst✝¹ : Fintype m
inst✝ : DecidableEq m
f : (m → R) →ₗ[R] n → R
⊢ vecMulLinear
      (AddHom.toFun
        {
            toAddHom :=
              { toFun := fun f i j => f ((stdBasis R (fun x => R) i) 1) j,
                map_add' :=
                  (_ :
                    ∀ (f g : (m → R) →ₗ[R] n → R),
                      (fun f i j => f ((stdBasis R (fun x => R) i) 1) j) (f + g) =
                        (fun f i j => f ((stdBasis R (fun x => R) i) 1) j) f +
                          (fun f i j => f ((stdBasis R (fun x => R) i) 1) j) g) },
            map_smul' :=
              (_ :
                ∀ (c : Rᵐᵒᵖ) (f : (m → R) →ₗ[R] n → R),
                  AddHom.toFun
                      { toFun := fun f i j => f ((stdBasis R (fun x => R) i) 1) j,
                        map_add' :=
                          (_ :
                            ∀ (f g : (m → R) →ₗ[R] n → R),
                              (fun f i j => f ((stdBasis R (fun x => R) i) 1) j) (f + g) =
                                (fun f i j => f ((stdBasis R (fun x => R) i) 1) j) f +
                                  (fun f i j => f ((stdBasis R (fun x => R) i) 1) j) g) }
                      (c • f) =
                    (RingHom.id Rᵐᵒᵖ) c •
                      AddHom.toFun
                        { toFun := fun f i j => f ((stdBasis R (fun x => R) i) 1) j,
                          map_add' :=
                            (_ :
                              ∀ (f g : (m → R) →ₗ[R] n → R),
                                (fun f i j => f ((stdBasis R (fun x => R) i) 1) j) (f + g) =
                                  (fun f i j => f ((stdBasis R (fun x => R) i) 1) j) f +
                                    (fun f i j => f ((stdBasis R (fun x => R) i) 1) j) g) }
                        f) }.toAddHom
        f) =
    f

Next tactic:
apply (Pi.basisFun R m).ext
/-- Linear maps `(m → R) →ₗ[R] (n → R)` are linearly equivalent over `Rᵐᵒᵖ` to `Matrix m n R`,
by having matrices act by right multiplication.
 -/
def LinearMap.toMatrixRight' : ((m → R) →ₗ[R] n → R) ≃ₗ[Rᵐᵒᵖ] Matrix m n R where
  toFun f i j := f (stdBasis R (fun _ => R) i 1) j
  invFun := Matrix.vecMulLinear
  right_inv M := by
    ext i j
    simp only [Matrix.vecMul_stdBasis, Matrix.vecMulLinear_apply]
  left_inv f := by
    apply (Pi.basisFun R m).ext
    

Proof state:
R : Type u_1
inst✝² : Semiring R
l : Type u_2
m : Type u_3
n : Type u_4
inst✝¹ : Fintype m
inst✝ : DecidableEq m
f : (m → R) →ₗ[R] n → R
⊢ ∀ (i : m),
    (vecMulLinear
          (AddHom.toFun
            {
                toAddHom :=
                  { toFun := fun f i j => f ((stdBasis R (fun x => R) i) 1) j,
                    map_add' :=
                      (_ :
                        ∀ (f g : (m → R) →ₗ[R] n → R),
                          (fun f i j => f ((stdBasis R (fun x => R) i) 1) j) (f + g) =
                            (fun f i j => f ((stdBasis R (fun x => R) i) 1) j) f +
                              (fun f i j => f ((stdBasis R (fun x => R) i) 1) j) g) },
                map_smul' :=
                  (_ :
                    ∀ (c : Rᵐᵒᵖ) (f : (m → R) →ₗ[R] n → R),
                      AddHom.toFun
                          { toFun := fun f i j => f ((stdBasis R (fun x => R) i) 1) j,
                            map_add' :=
                              (_ :
                                ∀ (f g : (m → R) →ₗ[R] n → R),
                                  (fun f i j => f ((stdBasis R (fun x => R) i) 1) j) (f + g) =
                                    (fun f i j => f ((stdBasis R (fun x => R) i) 1) j) f +
                                      (fun f i j => f ((stdBasis R (fun x => R) i) 1) j) g) }
                          (c • f) =
                        (RingHom.id Rᵐᵒᵖ) c •
                          AddHom.toFun
                            { toFun := fun f i j => f ((stdBasis R (fun x => R) i) 1) j,
                              map_add' :=
                                (_ :
                                  ∀ (f g : (m → R) →ₗ[R] n → R),
                                    (fun f i j => f ((stdBasis R (fun x => R) i) 1) j) (f + g) =
                                      (fun f i j => f ((stdBasis R (fun x => R) i) 1) j) f +
                                        (fun f i j => f ((stdBasis R (fun x => R) i) 1) j) g) }
                            f) }.toAddHom
            f))
        ((Pi.basisFun R m) i) =
      f ((Pi.basisFun R m) i)

Next tactic:
intro j
/-- Linear maps `(m → R) →ₗ[R] (n → R)` are linearly equivalent over `Rᵐᵒᵖ` to `Matrix m n R`,
by having matrices act by right multiplication.
 -/
def LinearMap.toMatrixRight' : ((m → R) →ₗ[R] n → R) ≃ₗ[Rᵐᵒᵖ] Matrix m n R where
  toFun f i j := f (stdBasis R (fun _ => R) i 1) j
  invFun := Matrix.vecMulLinear
  right_inv M := by
    ext i j
    simp only [Matrix.vecMul_stdBasis, Matrix.vecMulLinear_apply]
  left_inv f := by
    apply (Pi.basisFun R m).ext
    intro j; 

Proof state:
R : Type u_1
inst✝² : Semiring R
l : Type u_2
m : Type u_3
n : Type u_4
inst✝¹ : Fintype m
inst✝ : DecidableEq m
f : (m → R) →ₗ[R] n → R
j : m
⊢ (vecMulLinear
        (AddHom.toFun
          {
              toAddHom :=
                { toFun := fun f i j => f ((stdBasis R (fun x => R) i) 1) j,
                  map_add' :=
                    (_ :
                      ∀ (f g : (m → R) →ₗ[R] n → R),
                        (fun f i j => f ((stdBasis R (fun x => R) i) 1) j) (f + g) =
                          (fun f i j => f ((stdBasis R (fun x => R) i) 1) j) f +
                            (fun f i j => f ((stdBasis R (fun x => R) i) 1) j) g) },
              map_smul' :=
                (_ :
                  ∀ (c : Rᵐᵒᵖ) (f : (m → R) →ₗ[R] n → R),
                    AddHom.toFun
                        { toFun := fun f i j => f ((stdBasis R (fun x => R) i) 1) j,
                          map_add' :=
                            (_ :
                              ∀ (f g : (m → R) →ₗ[R] n → R),
                                (fun f i j => f ((stdBasis R (fun x => R) i) 1) j) (f + g) =
                                  (fun f i j => f ((stdBasis R (fun x => R) i) 1) j) f +
                                    (fun f i j => f ((stdBasis R (fun x => R) i) 1) j) g) }
                        (c • f) =
                      (RingHom.id Rᵐᵒᵖ) c •
                        AddHom.toFun
                          { toFun := fun f i j => f ((stdBasis R (fun x => R) i) 1) j,
                            map_add' :=
                              (_ :
                                ∀ (f g : (m → R) →ₗ[R] n → R),
                                  (fun f i j => f ((stdBasis R (fun x => R) i) 1) j) (f + g) =
                                    (fun f i j => f ((stdBasis R (fun x => R) i) 1) j) f +
                                      (fun f i j => f ((stdBasis R (fun x => R) i) 1) j) g) }
                          f) }.toAddHom
          f))
      ((Pi.basisFun R m) j) =
    f ((Pi.basisFun R m) j)

Next tactic:
ext i