l3lab/ntp-mathlib huggingface dataset:
theorem linearIndependent_stdBasis [Ring R] [∀ i, AddCommGroup (Ms i)] [∀ i, Module R (Ms i)]
    [DecidableEq η] (v : ∀ j, ιs j → Ms j) (hs : ∀ i, LinearIndependent R (v i)) :
    LinearIndependent R fun ji : Σj, ιs j => stdBasis R Ms ji.1 (v ji.1 ji.2) := by
  have hs' : ∀ j : η, LinearIndependent R fun i : ιs j => stdBasis R Ms j (v j i) := by
    intro j
    exact (hs j).map' _ (ker_stdBasis _ _ _)
  apply linearIndependent_iUnion_finite hs'
  · intro j J _ hiJ
    have h₀ :
      ∀ j, span R (range fun i : ιs j => stdBasis R Ms j (v j i)) ≤
        LinearMap.range (stdBasis R Ms j) := by
      intro j
      rw [span_le, LinearMap.range_coe]
      apply range_comp_subset_range
    have h₁ :
      span R (range fun i : ιs j => stdBasis R Ms j (v j i)) ≤
        ⨆ i ∈ ({j} : Set _), LinearMap.range (stdBasis R Ms i) := by
      rw [@iSup_singleton _ _ _ fun i => LinearMap.range (stdBasis R (Ms) i)]
      

Proof state:
R : Type u_1
η : Type u_2
ιs : η → Type u_3
Ms : η → Type u_4
inst✝³ : Ring R
inst✝² : (i : η) → AddCommGroup (Ms i)
inst✝¹ : (i : η) → Module R (Ms i)
inst✝ : DecidableEq η
v : (j : η) → ιs j → Ms j
hs : ∀ (i : η), LinearIndependent R (v i)
hs' : ∀ (j : η), LinearIndependent R fun i => (stdBasis R Ms j) (v j i)
j : η
J : Set η
a✝ : Set.Finite J
hiJ : j ∉ J
h₀ : ∀ (j : η), span R (Set.range fun i => (stdBasis R Ms j) (v j i)) ≤ LinearMap.range (stdBasis R Ms j)
⊢ span R (Set.range fun i => (stdBasis R Ms j) (v j i)) ≤ LinearMap.range (stdBasis R Ms j)

Next tactic:
apply h₀
theorem linearIndependent_stdBasis [Ring R] [∀ i, AddCommGroup (Ms i)] [∀ i, Module R (Ms i)]
    [DecidableEq η] (v : ∀ j, ιs j → Ms j) (hs : ∀ i, LinearIndependent R (v i)) :
    LinearIndependent R fun ji : Σj, ιs j => stdBasis R Ms ji.1 (v ji.1 ji.2) := by
  have hs' : ∀ j : η, LinearIndependent R fun i : ιs j => stdBasis R Ms j (v j i) := by
    intro j
    exact (hs j).map' _ (ker_stdBasis _ _ _)
  apply linearIndependent_iUnion_finite hs'
  · intro j J _ hiJ
    have h₀ :
      ∀ j, span R (range fun i : ιs j => stdBasis R Ms j (v j i)) ≤
        LinearMap.range (stdBasis R Ms j) := by
      intro j
      rw [span_le, LinearMap.range_coe]
      apply range_comp_subset_range
    have h₁ :
      span R (range fun i : ιs j => stdBasis R Ms j (v j i)) ≤
        ⨆ i ∈ ({j} : Set _), LinearMap.range (stdBasis R Ms i) := by
      rw [@iSup_singleton _ _ _ fun i => LinearMap.range (stdBasis R (Ms) i)]
      apply h₀
    

Proof state:
R : Type u_1
η : Type u_2
ιs : η → Type u_3
Ms : η → Type u_4
inst✝³ : Ring R
inst✝² : (i : η) → AddCommGroup (Ms i)
inst✝¹ : (i : η) → Module R (Ms i)
inst✝ : DecidableEq η
v : (j : η) → ιs j → Ms j
hs : ∀ (i : η), LinearIndependent R (v i)
hs' : ∀ (j : η), LinearIndependent R fun i => (stdBasis R Ms j) (v j i)
j : η
J : Set η
a✝ : Set.Finite J
hiJ : j ∉ J
h₀ : ∀ (j : η), span R (Set.range fun i => (stdBasis R Ms j) (v j i)) ≤ LinearMap.range (stdBasis R Ms j)
h₁ : span R (Set.range fun i => (stdBasis R Ms j) (v j i)) ≤ ⨆ i ∈ {j}, LinearMap.range (stdBasis R Ms i)
⊢ Disjoint (span R (Set.range fun i => (stdBasis R Ms j) (v j i)))
    (⨆ i ∈ J, span R (Set.range fun i_1 => (stdBasis R Ms i) (v i i_1)))

Next tactic:
have h₂ :
      ⨆ j ∈ J, span R (range fun i : ιs j => stdBasis R Ms j (v j i)) ≤
        ⨆ j ∈ J, LinearMap.range (stdBasis R (fun j : η => Ms j) j) :=
      iSup₂_mono fun i _ => h₀ i
theorem linearIndependent_stdBasis [Ring R] [∀ i, AddCommGroup (Ms i)] [∀ i, Module R (Ms i)]
    [DecidableEq η] (v : ∀ j, ιs j → Ms j) (hs : ∀ i, LinearIndependent R (v i)) :
    LinearIndependent R fun ji : Σj, ιs j => stdBasis R Ms ji.1 (v ji.1 ji.2) := by
  have hs' : ∀ j : η, LinearIndependent R fun i : ιs j => stdBasis R Ms j (v j i) := by
    intro j
    exact (hs j).map' _ (ker_stdBasis _ _ _)
  apply linearIndependent_iUnion_finite hs'
  · intro j J _ hiJ
    have h₀ :
      ∀ j, span R (range fun i : ιs j => stdBasis R Ms j (v j i)) ≤
        LinearMap.range (stdBasis R Ms j) := by
      intro j
      rw [span_le, LinearMap.range_coe]
      apply range_comp_subset_range
    have h₁ :
      span R (range fun i : ιs j => stdBasis R Ms j (v j i)) ≤
        ⨆ i ∈ ({j} : Set _), LinearMap.range (stdBasis R Ms i) := by
      rw [@iSup_singleton _ _ _ fun i => LinearMap.range (stdBasis R (Ms) i)]
      apply h₀
    have h₂ :
      ⨆ j ∈ J, span R (range fun i : ιs j => stdBasis R Ms j (v j i)) ≤
        ⨆ j ∈ J, LinearMap.range (stdBasis R (fun j : η => Ms j) j) :=
      iSup₂_mono fun i _ => h₀ i
    

Proof state:
R : Type u_1
η : Type u_2
ιs : η → Type u_3
Ms : η → Type u_4
inst✝³ : Ring R
inst✝² : (i : η) → AddCommGroup (Ms i)
inst✝¹ : (i : η) → Module R (Ms i)
inst✝ : DecidableEq η
v : (j : η) → ιs j → Ms j
hs : ∀ (i : η), LinearIndependent R (v i)
hs' : ∀ (j : η), LinearIndependent R fun i => (stdBasis R Ms j) (v j i)
j : η
J : Set η
a✝ : Set.Finite J
hiJ : j ∉ J
h₀ : ∀ (j : η), span R (Set.range fun i => (stdBasis R Ms j) (v j i)) ≤ LinearMap.range (stdBasis R Ms j)
h₁ : span R (Set.range fun i => (stdBasis R Ms j) (v j i)) ≤ ⨆ i ∈ {j}, LinearMap.range (stdBasis R Ms i)
h₂ :
  ⨆ j ∈ J, span R (Set.range fun i => (stdBasis R Ms j) (v j i)) ≤
    ⨆ j ∈ J, LinearMap.range (stdBasis R (fun j => Ms j) j)
⊢ Disjoint (span R (Set.range fun i => (stdBasis R Ms j) (v j i)))
    (⨆ i ∈ J, span R (Set.range fun i_1 => (stdBasis R Ms i) (v i i_1)))

Next tactic:
have h₃ : Disjoint (fun i : η => i ∈ ({j} : Set _)) J := by
      convert Set.disjoint_singleton_left.2 hiJ using 0
theorem linearIndependent_stdBasis [Ring R] [∀ i, AddCommGroup (Ms i)] [∀ i, Module R (Ms i)]
    [DecidableEq η] (v : ∀ j, ιs j → Ms j) (hs : ∀ i, LinearIndependent R (v i)) :
    LinearIndependent R fun ji : Σj, ιs j => stdBasis R Ms ji.1 (v ji.1 ji.2) := by
  have hs' : ∀ j : η, LinearIndependent R fun i : ιs j => stdBasis R Ms j (v j i) := by
    intro j
    exact (hs j).map' _ (ker_stdBasis _ _ _)
  apply linearIndependent_iUnion_finite hs'
  · intro j J _ hiJ
    have h₀ :
      ∀ j, span R (range fun i : ιs j => stdBasis R Ms j (v j i)) ≤
        LinearMap.range (stdBasis R Ms j) := by
      intro j
      rw [span_le, LinearMap.range_coe]
      apply range_comp_subset_range
    have h₁ :
      span R (range fun i : ιs j => stdBasis R Ms j (v j i)) ≤
        ⨆ i ∈ ({j} : Set _), LinearMap.range (stdBasis R Ms i) := by
      rw [@iSup_singleton _ _ _ fun i => LinearMap.range (stdBasis R (Ms) i)]
      apply h₀
    have h₂ :
      ⨆ j ∈ J, span R (range fun i : ιs j => stdBasis R Ms j (v j i)) ≤
        ⨆ j ∈ J, LinearMap.range (stdBasis R (fun j : η => Ms j) j) :=
      iSup₂_mono fun i _ => h₀ i
    have h₃ : Disjoint (fun i : η => i ∈ ({j} : Set _)) J := by
      

Proof state:
R : Type u_1
η : Type u_2
ιs : η → Type u_3
Ms : η → Type u_4
inst✝³ : Ring R
inst✝² : (i : η) → AddCommGroup (Ms i)
inst✝¹ : (i : η) → Module R (Ms i)
inst✝ : DecidableEq η
v : (j : η) → ιs j → Ms j
hs : ∀ (i : η), LinearIndependent R (v i)
hs' : ∀ (j : η), LinearIndependent R fun i => (stdBasis R Ms j) (v j i)
j : η
J : Set η
a✝ : Set.Finite J
hiJ : j ∉ J
h₀ : ∀ (j : η), span R (Set.range fun i => (stdBasis R Ms j) (v j i)) ≤ LinearMap.range (stdBasis R Ms j)
h₁ : span R (Set.range fun i => (stdBasis R Ms j) (v j i)) ≤ ⨆ i ∈ {j}, LinearMap.range (stdBasis R Ms i)
h₂ :
  ⨆ j ∈ J, span R (Set.range fun i => (stdBasis R Ms j) (v j i)) ≤
    ⨆ j ∈ J, LinearMap.range (stdBasis R (fun j => Ms j) j)
⊢ Disjoint (fun i => i ∈ {j}) J

Next tactic:
convert Set.disjoint_singleton_left.2 hiJ using 0
theorem linearIndependent_stdBasis [Ring R] [∀ i, AddCommGroup (Ms i)] [∀ i, Module R (Ms i)]
    [DecidableEq η] (v : ∀ j, ιs j → Ms j) (hs : ∀ i, LinearIndependent R (v i)) :
    LinearIndependent R fun ji : Σj, ιs j => stdBasis R Ms ji.1 (v ji.1 ji.2) := by
  have hs' : ∀ j : η, LinearIndependent R fun i : ιs j => stdBasis R Ms j (v j i) := by
    intro j
    exact (hs j).map' _ (ker_stdBasis _ _ _)
  apply linearIndependent_iUnion_finite hs'
  · intro j J _ hiJ
    have h₀ :
      ∀ j, span R (range fun i : ιs j => stdBasis R Ms j (v j i)) ≤
        LinearMap.range (stdBasis R Ms j) := by
      intro j
      rw [span_le, LinearMap.range_coe]
      apply range_comp_subset_range
    have h₁ :
      span R (range fun i : ιs j => stdBasis R Ms j (v j i)) ≤
        ⨆ i ∈ ({j} : Set _), LinearMap.range (stdBasis R Ms i) := by
      rw [@iSup_singleton _ _ _ fun i => LinearMap.range (stdBasis R (Ms) i)]
      apply h₀
    have h₂ :
      ⨆ j ∈ J, span R (range fun i : ιs j => stdBasis R Ms j (v j i)) ≤
        ⨆ j ∈ J, LinearMap.range (stdBasis R (fun j : η => Ms j) j) :=
      iSup₂_mono fun i _ => h₀ i
    have h₃ : Disjoint (fun i : η => i ∈ ({j} : Set _)) J := by
      convert Set.disjoint_singleton_left.2 hiJ using 0
    

Proof state:
R : Type u_1
η : Type u_2
ιs : η → Type u_3
Ms : η → Type u_4
inst✝³ : Ring R
inst✝² : (i : η) → AddCommGroup (Ms i)
inst✝¹ : (i : η) → Module R (Ms i)
inst✝ : DecidableEq η
v : (j : η) → ιs j → Ms j
hs : ∀ (i : η), LinearIndependent R (v i)
hs' : ∀ (j : η), LinearIndependent R fun i => (stdBasis R Ms j) (v j i)
j : η
J : Set η
a✝ : Set.Finite J
hiJ : j ∉ J
h₀ : ∀ (j : η), span R (Set.range fun i => (stdBasis R Ms j) (v j i)) ≤ LinearMap.range (stdBasis R Ms j)
h₁ : span R (Set.range fun i => (stdBasis R Ms j) (v j i)) ≤ ⨆ i ∈ {j}, LinearMap.range (stdBasis R Ms i)
h₂ :
  ⨆ j ∈ J, span R (Set.range fun i => (stdBasis R Ms j) (v j i)) ≤
    ⨆ j ∈ J, LinearMap.range (stdBasis R (fun j => Ms j) j)
h₃ : Disjoint (fun i => i ∈ {j}) J
⊢ Disjoint (span R (Set.range fun i => (stdBasis R Ms j) (v j i)))
    (⨆ i ∈ J, span R (Set.range fun i_1 => (stdBasis R Ms i) (v i i_1)))

Next tactic:
exact (disjoint_stdBasis_stdBasis _ _ _ _ h₃).mono h₁ h₂
@[simp]
theorem basis_repr_stdBasis [DecidableEq η] (s : ∀ j, Basis (ιs j) R (Ms j)) (j i) :
    (Pi.basis s).repr (stdBasis R _ j (s j i)) = Finsupp.single ⟨j, i⟩ 1 := by
  

Proof state:
R : Type u_1
η : Type u_2
ιs : η → Type u_3
Ms : η → Type u_4
inst✝⁴ : Semiring R
inst✝³ : (i : η) → AddCommMonoid (Ms i)
inst✝² : (i : η) → Module R (Ms i)
inst✝¹ : Fintype η
inst✝ : DecidableEq η
s : (j : η) → Basis (ιs j) R (Ms j)
j : η
i : ιs j
⊢ (Pi.basis s).repr ((stdBasis R (fun j => Ms j) j) ((s j) i)) = fun₀ | { fst := j, snd := i } => 1

Next tactic:
ext ⟨j', i'⟩
@[simp]
theorem basis_repr_stdBasis [DecidableEq η] (s : ∀ j, Basis (ιs j) R (Ms j)) (j i) :
    (Pi.basis s).repr (stdBasis R _ j (s j i)) = Finsupp.single ⟨j, i⟩ 1 := by
  ext ⟨j', i'⟩
  

Proof state:
case h.mk
R : Type u_1
η : Type u_2
ιs : η → Type u_3
Ms : η → Type u_4
inst✝⁴ : Semiring R
inst✝³ : (i : η) → AddCommMonoid (Ms i)
inst✝² : (i : η) → Module R (Ms i)
inst✝¹ : Fintype η
inst✝ : DecidableEq η
s : (j : η) → Basis (ιs j) R (Ms j)
j : η
i : ιs j
j' : η
i' : ιs j'
⊢ ((Pi.basis s).repr ((stdBasis R (fun j => Ms j) j) ((s j) i))) { fst := j', snd := i' } =
    (fun₀ | { fst := j, snd := i } => 1) { fst := j', snd := i' }

Next tactic:
by_cases hj : j = j'
@[simp]
theorem basis_repr_stdBasis [DecidableEq η] (s : ∀ j, Basis (ιs j) R (Ms j)) (j i) :
    (Pi.basis s).repr (stdBasis R _ j (s j i)) = Finsupp.single ⟨j, i⟩ 1 := by
  ext ⟨j', i'⟩
  by_cases hj : j = j'
  · 

Proof state:
case pos
R : Type u_1
η : Type u_2
ιs : η → Type u_3
Ms : η → Type u_4
inst✝⁴ : Semiring R
inst✝³ : (i : η) → AddCommMonoid (Ms i)
inst✝² : (i : η) → Module R (Ms i)
inst✝¹ : Fintype η
inst✝ : DecidableEq η
s : (j : η) → Basis (ιs j) R (Ms j)
j : η
i : ιs j
j' : η
i' : ιs j'
hj : j = j'
⊢ ((Pi.basis s).repr ((stdBasis R (fun j => Ms j) j) ((s j) i))) { fst := j', snd := i' } =
    (fun₀ | { fst := j, snd := i } => 1) { fst := j', snd := i' }

Next tactic:
subst hj
@[simp]
theorem basis_repr_stdBasis [DecidableEq η] (s : ∀ j, Basis (ιs j) R (Ms j)) (j i) :
    (Pi.basis s).repr (stdBasis R _ j (s j i)) = Finsupp.single ⟨j, i⟩ 1 := by
  ext ⟨j', i'⟩
  by_cases hj : j = j'
  · subst hj
    -- Porting note: needed to add more lemmas
    

Proof state:
case pos
R : Type u_1
η : Type u_2
ιs : η → Type u_3
Ms : η → Type u_4
inst✝⁴ : Semiring R
inst✝³ : (i : η) → AddCommMonoid (Ms i)
inst✝² : (i : η) → Module R (Ms i)
inst✝¹ : Fintype η
inst✝ : DecidableEq η
s : (j : η) → Basis (ιs j) R (Ms j)
j : η
i i' : ιs j
⊢ ((Pi.basis s).repr ((stdBasis R (fun j => Ms j) j) ((s j) i))) { fst := j, snd := i' } =
    (fun₀ | { fst := j, snd := i } => 1) { fst := j, snd := i' }

Next tactic:
simp only [Pi.basis, LinearEquiv.trans_apply, Basis.repr_self, stdBasis_same,
      LinearEquiv.piCongrRight, Finsupp.sigmaFinsuppLEquivPiFinsupp_symm_apply,
      Basis.repr_symm_apply, LinearEquiv.coe_mk, ne_eq, Sigma.mk.inj_iff, heq_eq_eq, true_and]
@[simp]
theorem basis_repr_stdBasis [DecidableEq η] (s : ∀ j, Basis (ιs j) R (Ms j)) (j i) :
    (Pi.basis s).repr (stdBasis R _ j (s j i)) = Finsupp.single ⟨j, i⟩ 1 := by
  ext ⟨j', i'⟩
  by_cases hj : j = j'
  · subst hj
    -- Porting note: needed to add more lemmas
    simp only [Pi.basis, LinearEquiv.trans_apply, Basis.repr_self, stdBasis_same,
      LinearEquiv.piCongrRight, Finsupp.sigmaFinsuppLEquivPiFinsupp_symm_apply,
      Basis.repr_symm_apply, LinearEquiv.coe_mk, ne_eq, Sigma.mk.inj_iff, heq_eq_eq, true_and]
    

Proof state:
case pos
R : Type u_1
η : Type u_2
ιs : η → Type u_3
Ms : η → Type u_4
inst✝⁴ : Semiring R
inst✝³ : (i : η) → AddCommMonoid (Ms i)
inst✝² : (i : η) → Module R (Ms i)
inst✝¹ : Fintype η
inst✝ : DecidableEq η
s : (j : η) → Basis (ιs j) R (Ms j)
j : η
i i' : ιs j
⊢ (fun₀ | i => 1) i' = (fun₀ | { fst := j, snd := i } => 1) { fst := j, snd := i' }

Next tactic:
symm
@[simp]
theorem basis_repr_stdBasis [DecidableEq η] (s : ∀ j, Basis (ιs j) R (Ms j)) (j i) :
    (Pi.basis s).repr (stdBasis R _ j (s j i)) = Finsupp.single ⟨j, i⟩ 1 := by
  ext ⟨j', i'⟩
  by_cases hj : j = j'
  · subst hj
    -- Porting note: needed to add more lemmas
    simp only [Pi.basis, LinearEquiv.trans_apply, Basis.repr_self, stdBasis_same,
      LinearEquiv.piCongrRight, Finsupp.sigmaFinsuppLEquivPiFinsupp_symm_apply,
      Basis.repr_symm_apply, LinearEquiv.coe_mk, ne_eq, Sigma.mk.inj_iff, heq_eq_eq, true_and]
    symm
    -- Porting note: `Sigma.mk.inj` not found in the following, replaced by `Sigma.mk.inj_iff.mp`
    

Proof state:
case pos
R : Type u_1
η : Type u_2
ιs : η → Type u_3
Ms : η → Type u_4
inst✝⁴ : Semiring R
inst✝³ : (i : η) → AddCommMonoid (Ms i)
inst✝² : (i : η) → Module R (Ms i)
inst✝¹ : Fintype η
inst✝ : DecidableEq η
s : (j : η) → Basis (ιs j) R (Ms j)
j : η
i i' : ιs j
⊢ (fun₀ | { fst := j, snd := i } => 1) { fst := j, snd := i' } = (fun₀ | i => 1) i'

Next tactic:
exact
      Finsupp.single_apply_left
        (fun i i' (h : (⟨j, i⟩ : Σj, ιs j) = ⟨j, i'⟩) => eq_of_heq (Sigma.mk.inj_iff.mp h).2) _ _ _
@[simp]
theorem basis_repr_stdBasis [DecidableEq η] (s : ∀ j, Basis (ιs j) R (Ms j)) (j i) :
    (Pi.basis s).repr (stdBasis R _ j (s j i)) = Finsupp.single ⟨j, i⟩ 1 := by
  ext ⟨j', i'⟩
  by_cases hj : j = j'
  · subst hj
    -- Porting note: needed to add more lemmas
    simp only [Pi.basis, LinearEquiv.trans_apply, Basis.repr_self, stdBasis_same,
      LinearEquiv.piCongrRight, Finsupp.sigmaFinsuppLEquivPiFinsupp_symm_apply,
      Basis.repr_symm_apply, LinearEquiv.coe_mk, ne_eq, Sigma.mk.inj_iff, heq_eq_eq, true_and]
    symm
    -- Porting note: `Sigma.mk.inj` not found in the following, replaced by `Sigma.mk.inj_iff.mp`
    exact
      Finsupp.single_apply_left
        (fun i i' (h : (⟨j, i⟩ : Σj, ιs j) = ⟨j, i'⟩) => eq_of_heq (Sigma.mk.inj_iff.mp h).2) _ _ _
  

Proof state:
case neg
R : Type u_1
η : Type u_2
ιs : η → Type u_3
Ms : η → Type u_4
inst✝⁴ : Semiring R
inst✝³ : (i : η) → AddCommMonoid (Ms i)
inst✝² : (i : η) → Module R (Ms i)
inst✝¹ : Fintype η
inst✝ : DecidableEq η
s : (j : η) → Basis (ιs j) R (Ms j)
j : η
i : ιs j
j' : η
i' : ιs j'
hj : ¬j = j'
⊢ ((Pi.basis s).repr ((stdBasis R (fun j => Ms j) j) ((s j) i))) { fst := j', snd := i' } =
    (fun₀ | { fst := j, snd := i } => 1) { fst := j', snd := i' }

Next tactic:
simp only [Pi.basis, LinearEquiv.trans_apply, Finsupp.sigmaFinsuppLEquivPiFinsupp_symm_apply,
    LinearEquiv.piCongrRight]
@[simp]
theorem basis_repr_stdBasis [DecidableEq η] (s : ∀ j, Basis (ιs j) R (Ms j)) (j i) :
    (Pi.basis s).repr (stdBasis R _ j (s j i)) = Finsupp.single ⟨j, i⟩ 1 := by
  ext ⟨j', i'⟩
  by_cases hj : j = j'
  · subst hj
    -- Porting note: needed to add more lemmas
    simp only [Pi.basis, LinearEquiv.trans_apply, Basis.repr_self, stdBasis_same,
      LinearEquiv.piCongrRight, Finsupp.sigmaFinsuppLEquivPiFinsupp_symm_apply,
      Basis.repr_symm_apply, LinearEquiv.coe_mk, ne_eq, Sigma.mk.inj_iff, heq_eq_eq, true_and]
    symm
    -- Porting note: `Sigma.mk.inj` not found in the following, replaced by `Sigma.mk.inj_iff.mp`
    exact
      Finsupp.single_apply_left
        (fun i i' (h : (⟨j, i⟩ : Σj, ιs j) = ⟨j, i'⟩) => eq_of_heq (Sigma.mk.inj_iff.mp h).2) _ _ _
  simp only [Pi.basis, LinearEquiv.trans_apply, Finsupp.sigmaFinsuppLEquivPiFinsupp_symm_apply,
    LinearEquiv.piCongrRight]
  dsimp
  

Proof state:
case neg
R : Type u_1
η : Type u_2
ιs : η → Type u_3
Ms : η → Type u_4
inst✝⁴ : Semiring R
inst✝³ : (i : η) → AddCommMonoid (Ms i)
inst✝² : (i : η) → Module R (Ms i)
inst✝¹ : Fintype η
inst✝ : DecidableEq η
s : (j : η) → Basis (ιs j) R (Ms j)
j : η
i : ιs j
j' : η
i' : ιs j'
hj : ¬j = j'
⊢ ((s j').repr ((stdBasis R (fun j => Ms j) j) ((s j) i) j')) i' =
    (fun₀ | { fst := j, snd := i } => 1) { fst := j', snd := i' }

Next tactic:
rw [stdBasis_ne _ _ _ _ (Ne.symm hj), LinearEquiv.map_zero, Finsupp.zero_apply,
    Finsupp.single_eq_of_ne]
@[simp]
theorem basis_repr_stdBasis [DecidableEq η] (s : ∀ j, Basis (ιs j) R (Ms j)) (j i) :
    (Pi.basis s).repr (stdBasis R _ j (s j i)) = Finsupp.single ⟨j, i⟩ 1 := by
  ext ⟨j', i'⟩
  by_cases hj : j = j'
  · subst hj
    -- Porting note: needed to add more lemmas
    simp only [Pi.basis, LinearEquiv.trans_apply, Basis.repr_self, stdBasis_same,
      LinearEquiv.piCongrRight, Finsupp.sigmaFinsuppLEquivPiFinsupp_symm_apply,
      Basis.repr_symm_apply, LinearEquiv.coe_mk, ne_eq, Sigma.mk.inj_iff, heq_eq_eq, true_and]
    symm
    -- Porting note: `Sigma.mk.inj` not found in the following, replaced by `Sigma.mk.inj_iff.mp`
    exact
      Finsupp.single_apply_left
        (fun i i' (h : (⟨j, i⟩ : Σj, ιs j) = ⟨j, i'⟩) => eq_of_heq (Sigma.mk.inj_iff.mp h).2) _ _ _
  simp only [Pi.basis, LinearEquiv.trans_apply, Finsupp.sigmaFinsuppLEquivPiFinsupp_symm_apply,
    LinearEquiv.piCongrRight]
  dsimp
  rw [stdBasis_ne _ _ _ _ (Ne.symm hj), LinearEquiv.map_zero, Finsupp.zero_apply,
    Finsupp.single_eq_of_ne]
  

Proof state:
case neg
R : Type u_1
η : Type u_2
ιs : η → Type u_3
Ms : η → Type u_4
inst✝⁴ : Semiring R
inst✝³ : (i : η) → AddCommMonoid (Ms i)
inst✝² : (i : η) → Module R (Ms i)
inst✝¹ : Fintype η
inst✝ : DecidableEq η
s : (j : η) → Basis (ιs j) R (Ms j)
j : η
i : ιs j
j' : η
i' : ιs j'
hj : ¬j = j'
⊢ { fst := j, snd := i } ≠ { fst := j', snd := i' }

Next tactic:
rintro ⟨⟩
@[simp]
theorem basis_repr_stdBasis [DecidableEq η] (s : ∀ j, Basis (ιs j) R (Ms j)) (j i) :
    (Pi.basis s).repr (stdBasis R _ j (s j i)) = Finsupp.single ⟨j, i⟩ 1 := by
  ext ⟨j', i'⟩
  by_cases hj : j = j'
  · subst hj
    -- Porting note: needed to add more lemmas
    simp only [Pi.basis, LinearEquiv.trans_apply, Basis.repr_self, stdBasis_same,
      LinearEquiv.piCongrRight, Finsupp.sigmaFinsuppLEquivPiFinsupp_symm_apply,
      Basis.repr_symm_apply, LinearEquiv.coe_mk, ne_eq, Sigma.mk.inj_iff, heq_eq_eq, true_and]
    symm
    -- Porting note: `Sigma.mk.inj` not found in the following, replaced by `Sigma.mk.inj_iff.mp`
    exact
      Finsupp.single_apply_left
        (fun i i' (h : (⟨j, i⟩ : Σj, ιs j) = ⟨j, i'⟩) => eq_of_heq (Sigma.mk.inj_iff.mp h).2) _ _ _
  simp only [Pi.basis, LinearEquiv.trans_apply, Finsupp.sigmaFinsuppLEquivPiFinsupp_symm_apply,
    LinearEquiv.piCongrRight]
  dsimp
  rw [stdBasis_ne _ _ _ _ (Ne.symm hj), LinearEquiv.map_zero, Finsupp.zero_apply,
    Finsupp.single_eq_of_ne]
  rintro ⟨⟩
  

Proof state:
case neg.refl
R : Type u_1
η : Type u_2
ιs : η → Type u_3
Ms : η → Type u_4
inst✝⁴ : Semiring R
inst✝³ : (i : η) → AddCommMonoid (Ms i)
inst✝² : (i : η) → Module R (Ms i)
inst✝¹ : Fintype η
inst✝ : DecidableEq η
s : (j : η) → Basis (ιs j) R (Ms j)
j : η
i : ιs j
hj : ¬j = j
⊢ False

Next tactic:
contradiction
@[simp]
theorem basis_apply [DecidableEq η] (s : ∀ j, Basis (ιs j) R (Ms j)) (ji) :
    Pi.basis s ji = stdBasis R _ ji.1 (s ji.1 ji.2) :=
  Basis.apply_eq_iff.mpr (by 

Proof state:
R : Type u_1
η : Type u_2
ιs : η → Type u_3
Ms : η → Type u_4
inst✝⁴ : Semiring R
inst✝³ : (i : η) → AddCommMonoid (Ms i)
inst✝² : (i : η) → Module R (Ms i)
inst✝¹ : Fintype η
inst✝ : DecidableEq η
s : (j : η) → Basis (ιs j) R (Ms j)
ji : (j : η) × ιs j
⊢ (Pi.basis s).repr ((stdBasis R Ms ji.fst) ((s ji.fst) ji.snd)) = fun₀ | ji => 1

Next tactic:
simp
@[simp]
theorem basisFun_apply [DecidableEq η] (i) : basisFun R η i = stdBasis R (fun _ : η => R) i 1 := by
  

Proof state:
R : Type u_1
η : Type u_2
ιs : η → Type u_3
Ms : η → Type u_4
inst✝⁴ : Semiring R
inst✝³ : (i : η) → AddCommMonoid (Ms i)
inst✝² : (i : η) → Module R (Ms i)
inst✝¹ : Fintype η
inst✝ : DecidableEq η
i : η
⊢ (basisFun R η) i = (stdBasis R (fun x => R) i) 1

Next tactic:
simp only [basisFun, Basis.coe_ofEquivFun, LinearEquiv.refl_symm, LinearEquiv.refl_apply,
    stdBasis_apply]
@[simp]
theorem basisFun_repr (x : η → R) (i : η) : (Pi.basisFun R η).repr x i = x i := by 

Proof state:
R : Type u_1
η : Type u_2
ιs : η → Type u_3
Ms : η → Type u_4
inst✝³ : Semiring R
inst✝² : (i : η) → AddCommMonoid (Ms i)
inst✝¹ : (i : η) → Module R (Ms i)
inst✝ : Fintype η
x : η → R
i : η
⊢ ((basisFun R η).repr x) i = x i

Next tactic:
simp [basisFun]
lemma piEquiv_apply_apply (v : ι → M) (w : ι → R) :
    piEquiv ι R M v w = ∑ i, w i • v i := by
  

Proof state:
ι : Type u_1
R : Type u_2
M : Type u_3
N : Type u_4
inst✝⁵ : Fintype ι
inst✝⁴ : CommSemiring R
inst✝³ : AddCommMonoid M
inst✝² : AddCommMonoid N
inst✝¹ : Module R M
inst✝ : Module R N
v : ι → M
w : ι → R
⊢ ((piEquiv ι R M) v) w = ∑ i : ι, w i • v i

Next tactic:
simp only [piEquiv, Basis.constr_apply_fintype, Basis.equivFun_apply]
lemma piEquiv_apply_apply (v : ι → M) (w : ι → R) :
    piEquiv ι R M v w = ∑ i, w i • v i := by
  simp only [piEquiv, Basis.constr_apply_fintype, Basis.equivFun_apply]
  

Proof state:
ι : Type u_1
R : Type u_2
M : Type u_3
N : Type u_4
inst✝⁵ : Fintype ι
inst✝⁴ : CommSemiring R
inst✝³ : AddCommMonoid M
inst✝² : AddCommMonoid N
inst✝¹ : Module R M
inst✝ : Module R N
v : ι → M
w : ι → R
⊢ ∑ x : ι, ((Pi.basisFun R ι).repr w) x • v x = ∑ i : ι, w i • v i

Next tactic:
congr
@[simp] lemma surjective_piEquiv_apply_iff (v : ι → M) :
    Surjective (piEquiv ι R M v) ↔ span R (range v) = ⊤ := by
  

Proof state:
ι : Type u_1
R : Type u_2
M : Type u_3
N : Type u_4
inst✝⁵ : Fintype ι
inst✝⁴ : CommSemiring R
inst✝³ : AddCommMonoid M
inst✝² : AddCommMonoid N
inst✝¹ : Module R M
inst✝ : Module R N
v : ι → M
⊢ Surjective ⇑((piEquiv ι R M) v) ↔ span R (range v) = ⊤

Next tactic:
rw [← LinearMap.range_eq_top, range_piEquiv]
theorem stdBasis_eq_stdBasisMatrix (i : n) (j : m) [DecidableEq n] [DecidableEq m] :
    stdBasis R n m (i, j) = stdBasisMatrix i j (1 : R) := by
  -- Porting note: `simp` fails to apply `Pi.basis_apply`
  

Proof state:
R : Type u_1
m : Type u_2
n : Type u_3
inst✝⁴ : Fintype m
inst✝³ : Fintype n
inst✝² : Semiring R
i : n
j : m
inst✝¹ : DecidableEq n
inst✝ : DecidableEq m
⊢ (stdBasis R n m) (i, j) = stdBasisMatrix i j 1

Next tactic:
ext a b
theorem stdBasis_eq_stdBasisMatrix (i : n) (j : m) [DecidableEq n] [DecidableEq m] :
    stdBasis R n m (i, j) = stdBasisMatrix i j (1 : R) := by
  -- Porting note: `simp` fails to apply `Pi.basis_apply`
  ext a b
  

Proof state:
case a.h
R : Type u_1
m : Type u_2
n : Type u_3
inst✝⁴ : Fintype m
inst✝³ : Fintype n
inst✝² : Semiring R
i : n
j : m
inst✝¹ : DecidableEq n
inst✝ : DecidableEq m
a : n
b : m
⊢ (stdBasis R n m) (i, j) a b = stdBasisMatrix i j 1 a b

Next tactic:
by_cases hi : i = a