l3lab/ntp-mathlib huggingface dataset:
lemma disjoint_generalizedEigenspace [NoZeroSMulDivisors R M]
    (f : End R M) {μ₁ μ₂ : R} (hμ : μ₁ ≠ μ₂) (k l : ℕ) :
    Disjoint (f.generalizedEigenspace μ₁ k) (f.generalizedEigenspace μ₂ l) := by
  nontriviality M
  have := NoZeroSMulDivisors.isReduced R M
  rw [disjoint_iff]
  set p := f.generalizedEigenspace μ₁ k ⊓ f.generalizedEigenspace μ₂ l
  by_contra hp
  replace hp : Nontrivial p := Submodule.nontrivial_iff_ne_bot.mpr hp
  let f₁ : End R p := (f - algebraMap R (End R M) μ₁).restrict <| MapsTo.inter_inter
    (mapsTo_generalizedEigenspace_of_comm (Algebra.mul_sub_algebraMap_commutes f μ₁) μ₁ k)
    (mapsTo_generalizedEigenspace_of_comm (Algebra.mul_sub_algebraMap_commutes f μ₁) μ₂ l)
  

Proof state:
K R : Type v
V M : Type w
inst✝⁶ : CommRing R
inst✝⁵ : AddCommGroup M
inst✝⁴ : Module R M
inst✝³ : Field K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
inst✝ : NoZeroSMulDivisors R M
f : End R M
μ₁ μ₂ : R
hμ : μ₁ ≠ μ₂
k l : ℕ
✝ : Nontrivial M
this : IsReduced R
p : Submodule R M := (generalizedEigenspace f μ₁) k ⊓ (generalizedEigenspace f μ₂) l
hp : Nontrivial ↥p
f₁ : End R ↥p :=
  LinearMap.restrict (f - (algebraMap R (End R M)) μ₁)
    (_ :
      MapsTo (fun x => (f - (algebraMap R (End R M)) μ₁) x)
        (↑((generalizedEigenspace f μ₁) k) ∩ ↑((generalizedEigenspace f μ₂) l))
        (↑((generalizedEigenspace f μ₁) k) ∩ ↑((generalizedEigenspace f μ₂) l)))
⊢ False

Next tactic:
let f₂ : End R p := (f - algebraMap R (End R M) μ₂).restrict <| MapsTo.inter_inter
    (mapsTo_generalizedEigenspace_of_comm (Algebra.mul_sub_algebraMap_commutes f μ₂) μ₁ k)
    (mapsTo_generalizedEigenspace_of_comm (Algebra.mul_sub_algebraMap_commutes f μ₂) μ₂ l)
lemma disjoint_generalizedEigenspace [NoZeroSMulDivisors R M]
    (f : End R M) {μ₁ μ₂ : R} (hμ : μ₁ ≠ μ₂) (k l : ℕ) :
    Disjoint (f.generalizedEigenspace μ₁ k) (f.generalizedEigenspace μ₂ l) := by
  nontriviality M
  have := NoZeroSMulDivisors.isReduced R M
  rw [disjoint_iff]
  set p := f.generalizedEigenspace μ₁ k ⊓ f.generalizedEigenspace μ₂ l
  by_contra hp
  replace hp : Nontrivial p := Submodule.nontrivial_iff_ne_bot.mpr hp
  let f₁ : End R p := (f - algebraMap R (End R M) μ₁).restrict <| MapsTo.inter_inter
    (mapsTo_generalizedEigenspace_of_comm (Algebra.mul_sub_algebraMap_commutes f μ₁) μ₁ k)
    (mapsTo_generalizedEigenspace_of_comm (Algebra.mul_sub_algebraMap_commutes f μ₁) μ₂ l)
  let f₂ : End R p := (f - algebraMap R (End R M) μ₂).restrict <| MapsTo.inter_inter
    (mapsTo_generalizedEigenspace_of_comm (Algebra.mul_sub_algebraMap_commutes f μ₂) μ₁ k)
    (mapsTo_generalizedEigenspace_of_comm (Algebra.mul_sub_algebraMap_commutes f μ₂) μ₂ l)
  

Proof state:
K R : Type v
V M : Type w
inst✝⁶ : CommRing R
inst✝⁵ : AddCommGroup M
inst✝⁴ : Module R M
inst✝³ : Field K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
inst✝ : NoZeroSMulDivisors R M
f : End R M
μ₁ μ₂ : R
hμ : μ₁ ≠ μ₂
k l : ℕ
✝ : Nontrivial M
this : IsReduced R
p : Submodule R M := (generalizedEigenspace f μ₁) k ⊓ (generalizedEigenspace f μ₂) l
hp : Nontrivial ↥p
f₁ : End R ↥p :=
  LinearMap.restrict (f - (algebraMap R (End R M)) μ₁)
    (_ :
      MapsTo (fun x => (f - (algebraMap R (End R M)) μ₁) x)
        (↑((generalizedEigenspace f μ₁) k) ∩ ↑((generalizedEigenspace f μ₂) l))
        (↑((generalizedEigenspace f μ₁) k) ∩ ↑((generalizedEigenspace f μ₂) l)))
f₂ : End R ↥p :=
  LinearMap.restrict (f - (algebraMap R (End R M)) μ₂)
    (_ :
      MapsTo (fun x => (f - (algebraMap R (End R M)) μ₂) x)
        (↑((generalizedEigenspace f μ₁) k) ∩ ↑((generalizedEigenspace f μ₂) l))
        (↑((generalizedEigenspace f μ₁) k) ∩ ↑((generalizedEigenspace f μ₂) l)))
⊢ False

Next tactic:
have : IsNilpotent (f₂ - f₁) := by
    apply Commute.isNilpotent_sub (x := f₂) (y := f₁) _ ⟨l, ?_⟩ ⟨k, ?_⟩
    · ext; simp [smul_sub, sub_sub, smul_comm μ₁, add_sub_left_comm]
    all_goals ext ⟨x, _, _⟩; simpa [LinearMap.restrict_apply, LinearMap.pow_restrict _] using ‹_›
lemma disjoint_generalizedEigenspace [NoZeroSMulDivisors R M]
    (f : End R M) {μ₁ μ₂ : R} (hμ : μ₁ ≠ μ₂) (k l : ℕ) :
    Disjoint (f.generalizedEigenspace μ₁ k) (f.generalizedEigenspace μ₂ l) := by
  nontriviality M
  have := NoZeroSMulDivisors.isReduced R M
  rw [disjoint_iff]
  set p := f.generalizedEigenspace μ₁ k ⊓ f.generalizedEigenspace μ₂ l
  by_contra hp
  replace hp : Nontrivial p := Submodule.nontrivial_iff_ne_bot.mpr hp
  let f₁ : End R p := (f - algebraMap R (End R M) μ₁).restrict <| MapsTo.inter_inter
    (mapsTo_generalizedEigenspace_of_comm (Algebra.mul_sub_algebraMap_commutes f μ₁) μ₁ k)
    (mapsTo_generalizedEigenspace_of_comm (Algebra.mul_sub_algebraMap_commutes f μ₁) μ₂ l)
  let f₂ : End R p := (f - algebraMap R (End R M) μ₂).restrict <| MapsTo.inter_inter
    (mapsTo_generalizedEigenspace_of_comm (Algebra.mul_sub_algebraMap_commutes f μ₂) μ₁ k)
    (mapsTo_generalizedEigenspace_of_comm (Algebra.mul_sub_algebraMap_commutes f μ₂) μ₂ l)
  have : IsNilpotent (f₂ - f₁) := by
    

Proof state:
K R : Type v
V M : Type w
inst✝⁶ : CommRing R
inst✝⁵ : AddCommGroup M
inst✝⁴ : Module R M
inst✝³ : Field K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
inst✝ : NoZeroSMulDivisors R M
f : End R M
μ₁ μ₂ : R
hμ : μ₁ ≠ μ₂
k l : ℕ
✝ : Nontrivial M
this : IsReduced R
p : Submodule R M := (generalizedEigenspace f μ₁) k ⊓ (generalizedEigenspace f μ₂) l
hp : Nontrivial ↥p
f₁ : End R ↥p :=
  LinearMap.restrict (f - (algebraMap R (End R M)) μ₁)
    (_ :
      MapsTo (fun x => (f - (algebraMap R (End R M)) μ₁) x)
        (↑((generalizedEigenspace f μ₁) k) ∩ ↑((generalizedEigenspace f μ₂) l))
        (↑((generalizedEigenspace f μ₁) k) ∩ ↑((generalizedEigenspace f μ₂) l)))
f₂ : End R ↥p :=
  LinearMap.restrict (f - (algebraMap R (End R M)) μ₂)
    (_ :
      MapsTo (fun x => (f - (algebraMap R (End R M)) μ₂) x)
        (↑((generalizedEigenspace f μ₁) k) ∩ ↑((generalizedEigenspace f μ₂) l))
        (↑((generalizedEigenspace f μ₁) k) ∩ ↑((generalizedEigenspace f μ₂) l)))
⊢ IsNilpotent (f₂ - f₁)

Next tactic:
apply Commute.isNilpotent_sub (x := f₂) (y := f₁) _ ⟨l, ?_⟩ ⟨k, ?_⟩
lemma disjoint_generalizedEigenspace [NoZeroSMulDivisors R M]
    (f : End R M) {μ₁ μ₂ : R} (hμ : μ₁ ≠ μ₂) (k l : ℕ) :
    Disjoint (f.generalizedEigenspace μ₁ k) (f.generalizedEigenspace μ₂ l) := by
  nontriviality M
  have := NoZeroSMulDivisors.isReduced R M
  rw [disjoint_iff]
  set p := f.generalizedEigenspace μ₁ k ⊓ f.generalizedEigenspace μ₂ l
  by_contra hp
  replace hp : Nontrivial p := Submodule.nontrivial_iff_ne_bot.mpr hp
  let f₁ : End R p := (f - algebraMap R (End R M) μ₁).restrict <| MapsTo.inter_inter
    (mapsTo_generalizedEigenspace_of_comm (Algebra.mul_sub_algebraMap_commutes f μ₁) μ₁ k)
    (mapsTo_generalizedEigenspace_of_comm (Algebra.mul_sub_algebraMap_commutes f μ₁) μ₂ l)
  let f₂ : End R p := (f - algebraMap R (End R M) μ₂).restrict <| MapsTo.inter_inter
    (mapsTo_generalizedEigenspace_of_comm (Algebra.mul_sub_algebraMap_commutes f μ₂) μ₁ k)
    (mapsTo_generalizedEigenspace_of_comm (Algebra.mul_sub_algebraMap_commutes f μ₂) μ₂ l)
  have : IsNilpotent (f₂ - f₁) := by
    apply Commute.isNilpotent_sub (x := f₂) (y := f₁) _ ⟨l, ?_⟩ ⟨k, ?_⟩
    · 

Proof state:
K R : Type v
V M : Type w
inst✝⁶ : CommRing R
inst✝⁵ : AddCommGroup M
inst✝⁴ : Module R M
inst✝³ : Field K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
inst✝ : NoZeroSMulDivisors R M
f : End R M
μ₁ μ₂ : R
hμ : μ₁ ≠ μ₂
k l : ℕ
✝ : Nontrivial M
this : IsReduced R
p : Submodule R M := (generalizedEigenspace f μ₁) k ⊓ (generalizedEigenspace f μ₂) l
hp : Nontrivial ↥p
f₁ : End R ↥p :=
  LinearMap.restrict (f - (algebraMap R (End R M)) μ₁)
    (_ :
      MapsTo (fun x => (f - (algebraMap R (End R M)) μ₁) x)
        (↑((generalizedEigenspace f μ₁) k) ∩ ↑((generalizedEigenspace f μ₂) l))
        (↑((generalizedEigenspace f μ₁) k) ∩ ↑((generalizedEigenspace f μ₂) l)))
f₂ : End R ↥p :=
  LinearMap.restrict (f - (algebraMap R (End R M)) μ₂)
    (_ :
      MapsTo (fun x => (f - (algebraMap R (End R M)) μ₂) x)
        (↑((generalizedEigenspace f μ₁) k) ∩ ↑((generalizedEigenspace f μ₂) l))
        (↑((generalizedEigenspace f μ₁) k) ∩ ↑((generalizedEigenspace f μ₂) l)))
⊢ Commute f₂ f₁

Next tactic:
ext
lemma disjoint_generalizedEigenspace [NoZeroSMulDivisors R M]
    (f : End R M) {μ₁ μ₂ : R} (hμ : μ₁ ≠ μ₂) (k l : ℕ) :
    Disjoint (f.generalizedEigenspace μ₁ k) (f.generalizedEigenspace μ₂ l) := by
  nontriviality M
  have := NoZeroSMulDivisors.isReduced R M
  rw [disjoint_iff]
  set p := f.generalizedEigenspace μ₁ k ⊓ f.generalizedEigenspace μ₂ l
  by_contra hp
  replace hp : Nontrivial p := Submodule.nontrivial_iff_ne_bot.mpr hp
  let f₁ : End R p := (f - algebraMap R (End R M) μ₁).restrict <| MapsTo.inter_inter
    (mapsTo_generalizedEigenspace_of_comm (Algebra.mul_sub_algebraMap_commutes f μ₁) μ₁ k)
    (mapsTo_generalizedEigenspace_of_comm (Algebra.mul_sub_algebraMap_commutes f μ₁) μ₂ l)
  let f₂ : End R p := (f - algebraMap R (End R M) μ₂).restrict <| MapsTo.inter_inter
    (mapsTo_generalizedEigenspace_of_comm (Algebra.mul_sub_algebraMap_commutes f μ₂) μ₁ k)
    (mapsTo_generalizedEigenspace_of_comm (Algebra.mul_sub_algebraMap_commutes f μ₂) μ₂ l)
  have : IsNilpotent (f₂ - f₁) := by
    apply Commute.isNilpotent_sub (x := f₂) (y := f₁) _ ⟨l, ?_⟩ ⟨k, ?_⟩
    · ext; 

Proof state:
case h.a
K R : Type v
V M : Type w
inst✝⁶ : CommRing R
inst✝⁵ : AddCommGroup M
inst✝⁴ : Module R M
inst✝³ : Field K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
inst✝ : NoZeroSMulDivisors R M
f : End R M
μ₁ μ₂ : R
hμ : μ₁ ≠ μ₂
k l : ℕ
✝ : Nontrivial M
this : IsReduced R
p : Submodule R M := (generalizedEigenspace f μ₁) k ⊓ (generalizedEigenspace f μ₂) l
hp : Nontrivial ↥p
f₁ : End R ↥p :=
  LinearMap.restrict (f - (algebraMap R (End R M)) μ₁)
    (_ :
      MapsTo (fun x => (f - (algebraMap R (End R M)) μ₁) x)
        (↑((generalizedEigenspace f μ₁) k) ∩ ↑((generalizedEigenspace f μ₂) l))
        (↑((generalizedEigenspace f μ₁) k) ∩ ↑((generalizedEigenspace f μ₂) l)))
f₂ : End R ↥p :=
  LinearMap.restrict (f - (algebraMap R (End R M)) μ₂)
    (_ :
      MapsTo (fun x => (f - (algebraMap R (End R M)) μ₂) x)
        (↑((generalizedEigenspace f μ₁) k) ∩ ↑((generalizedEigenspace f μ₂) l))
        (↑((generalizedEigenspace f μ₁) k) ∩ ↑((generalizedEigenspace f μ₂) l)))
x✝ : ↥p
⊢ ↑((f₂ * f₁) x✝) = ↑((f₁ * f₂) x✝)

Next tactic:
simp [smul_sub, sub_sub, smul_comm μ₁, add_sub_left_comm]
lemma disjoint_generalizedEigenspace [NoZeroSMulDivisors R M]
    (f : End R M) {μ₁ μ₂ : R} (hμ : μ₁ ≠ μ₂) (k l : ℕ) :
    Disjoint (f.generalizedEigenspace μ₁ k) (f.generalizedEigenspace μ₂ l) := by
  nontriviality M
  have := NoZeroSMulDivisors.isReduced R M
  rw [disjoint_iff]
  set p := f.generalizedEigenspace μ₁ k ⊓ f.generalizedEigenspace μ₂ l
  by_contra hp
  replace hp : Nontrivial p := Submodule.nontrivial_iff_ne_bot.mpr hp
  let f₁ : End R p := (f - algebraMap R (End R M) μ₁).restrict <| MapsTo.inter_inter
    (mapsTo_generalizedEigenspace_of_comm (Algebra.mul_sub_algebraMap_commutes f μ₁) μ₁ k)
    (mapsTo_generalizedEigenspace_of_comm (Algebra.mul_sub_algebraMap_commutes f μ₁) μ₂ l)
  let f₂ : End R p := (f - algebraMap R (End R M) μ₂).restrict <| MapsTo.inter_inter
    (mapsTo_generalizedEigenspace_of_comm (Algebra.mul_sub_algebraMap_commutes f μ₂) μ₁ k)
    (mapsTo_generalizedEigenspace_of_comm (Algebra.mul_sub_algebraMap_commutes f μ₂) μ₂ l)
  have : IsNilpotent (f₂ - f₁) := by
    apply Commute.isNilpotent_sub (x := f₂) (y := f₁) _ ⟨l, ?_⟩ ⟨k, ?_⟩
    · ext; simp [smul_sub, sub_sub, smul_comm μ₁, add_sub_left_comm]
    all_goals 

Proof state:
K R : Type v
V M : Type w
inst✝⁶ : CommRing R
inst✝⁵ : AddCommGroup M
inst✝⁴ : Module R M
inst✝³ : Field K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
inst✝ : NoZeroSMulDivisors R M
f : End R M
μ₁ μ₂ : R
hμ : μ₁ ≠ μ₂
k l : ℕ
✝ : Nontrivial M
this : IsReduced R
p : Submodule R M := (generalizedEigenspace f μ₁) k ⊓ (generalizedEigenspace f μ₂) l
hp : Nontrivial ↥p
f₁ : End R ↥p :=
  LinearMap.restrict (f - (algebraMap R (End R M)) μ₁)
    (_ :
      MapsTo (fun x => (f - (algebraMap R (End R M)) μ₁) x)
        (↑((generalizedEigenspace f μ₁) k) ∩ ↑((generalizedEigenspace f μ₂) l))
        (↑((generalizedEigenspace f μ₁) k) ∩ ↑((generalizedEigenspace f μ₂) l)))
f₂ : End R ↥p :=
  LinearMap.restrict (f - (algebraMap R (End R M)) μ₂)
    (_ :
      MapsTo (fun x => (f - (algebraMap R (End R M)) μ₂) x)
        (↑((generalizedEigenspace f μ₁) k) ∩ ↑((generalizedEigenspace f μ₂) l))
        (↑((generalizedEigenspace f μ₁) k) ∩ ↑((generalizedEigenspace f μ₂) l)))
⊢ f₂ ^ l = 0

Next tactic:
ext ⟨x, _, _⟩
lemma disjoint_generalizedEigenspace [NoZeroSMulDivisors R M]
    (f : End R M) {μ₁ μ₂ : R} (hμ : μ₁ ≠ μ₂) (k l : ℕ) :
    Disjoint (f.generalizedEigenspace μ₁ k) (f.generalizedEigenspace μ₂ l) := by
  nontriviality M
  have := NoZeroSMulDivisors.isReduced R M
  rw [disjoint_iff]
  set p := f.generalizedEigenspace μ₁ k ⊓ f.generalizedEigenspace μ₂ l
  by_contra hp
  replace hp : Nontrivial p := Submodule.nontrivial_iff_ne_bot.mpr hp
  let f₁ : End R p := (f - algebraMap R (End R M) μ₁).restrict <| MapsTo.inter_inter
    (mapsTo_generalizedEigenspace_of_comm (Algebra.mul_sub_algebraMap_commutes f μ₁) μ₁ k)
    (mapsTo_generalizedEigenspace_of_comm (Algebra.mul_sub_algebraMap_commutes f μ₁) μ₂ l)
  let f₂ : End R p := (f - algebraMap R (End R M) μ₂).restrict <| MapsTo.inter_inter
    (mapsTo_generalizedEigenspace_of_comm (Algebra.mul_sub_algebraMap_commutes f μ₂) μ₁ k)
    (mapsTo_generalizedEigenspace_of_comm (Algebra.mul_sub_algebraMap_commutes f μ₂) μ₂ l)
  have : IsNilpotent (f₂ - f₁) := by
    apply Commute.isNilpotent_sub (x := f₂) (y := f₁) _ ⟨l, ?_⟩ ⟨k, ?_⟩
    · ext; simp [smul_sub, sub_sub, smul_comm μ₁, add_sub_left_comm]
    all_goals ext ⟨x, _, _⟩; 

Proof state:
case h.mk.intro.a
K R : Type v
V M : Type w
inst✝⁶ : CommRing R
inst✝⁵ : AddCommGroup M
inst✝⁴ : Module R M
inst✝³ : Field K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
inst✝ : NoZeroSMulDivisors R M
f : End R M
μ₁ μ₂ : R
hμ : μ₁ ≠ μ₂
k l : ℕ
✝ : Nontrivial M
this : IsReduced R
p : Submodule R M := (generalizedEigenspace f μ₁) k ⊓ (generalizedEigenspace f μ₂) l
hp : Nontrivial ↥p
f₁ : End R ↥p :=
  LinearMap.restrict (f - (algebraMap R (End R M)) μ₁)
    (_ :
      MapsTo (fun x => (f - (algebraMap R (End R M)) μ₁) x)
        (↑((generalizedEigenspace f μ₁) k) ∩ ↑((generalizedEigenspace f μ₂) l))
        (↑((generalizedEigenspace f μ₁) k) ∩ ↑((generalizedEigenspace f μ₂) l)))
f₂ : End R ↥p :=
  LinearMap.restrict (f - (algebraMap R (End R M)) μ₂)
    (_ :
      MapsTo (fun x => (f - (algebraMap R (End R M)) μ₂) x)
        (↑((generalizedEigenspace f μ₁) k) ∩ ↑((generalizedEigenspace f μ₂) l))
        (↑((generalizedEigenspace f μ₁) k) ∩ ↑((generalizedEigenspace f μ₂) l)))
x : M
left✝ : x ∈ ↑((generalizedEigenspace f μ₁) k)
right✝ : x ∈ ↑((generalizedEigenspace f μ₂) l)
⊢ ↑((f₂ ^ l)
        { val := x, property := (_ : x ∈ ↑((generalizedEigenspace f μ₁) k) ∧ x ∈ ↑((generalizedEigenspace f μ₂) l)) }) =
    ↑(0 { val := x, property := (_ : x ∈ ↑((generalizedEigenspace f μ₁) k) ∧ x ∈ ↑((generalizedEigenspace f μ₂) l)) })

Next tactic:
simpa [LinearMap.restrict_apply, LinearMap.pow_restrict _] using ‹_›
lemma disjoint_generalizedEigenspace [NoZeroSMulDivisors R M]
    (f : End R M) {μ₁ μ₂ : R} (hμ : μ₁ ≠ μ₂) (k l : ℕ) :
    Disjoint (f.generalizedEigenspace μ₁ k) (f.generalizedEigenspace μ₂ l) := by
  nontriviality M
  have := NoZeroSMulDivisors.isReduced R M
  rw [disjoint_iff]
  set p := f.generalizedEigenspace μ₁ k ⊓ f.generalizedEigenspace μ₂ l
  by_contra hp
  replace hp : Nontrivial p := Submodule.nontrivial_iff_ne_bot.mpr hp
  let f₁ : End R p := (f - algebraMap R (End R M) μ₁).restrict <| MapsTo.inter_inter
    (mapsTo_generalizedEigenspace_of_comm (Algebra.mul_sub_algebraMap_commutes f μ₁) μ₁ k)
    (mapsTo_generalizedEigenspace_of_comm (Algebra.mul_sub_algebraMap_commutes f μ₁) μ₂ l)
  let f₂ : End R p := (f - algebraMap R (End R M) μ₂).restrict <| MapsTo.inter_inter
    (mapsTo_generalizedEigenspace_of_comm (Algebra.mul_sub_algebraMap_commutes f μ₂) μ₁ k)
    (mapsTo_generalizedEigenspace_of_comm (Algebra.mul_sub_algebraMap_commutes f μ₂) μ₂ l)
  have : IsNilpotent (f₂ - f₁) := by
    apply Commute.isNilpotent_sub (x := f₂) (y := f₁) _ ⟨l, ?_⟩ ⟨k, ?_⟩
    · ext; simp [smul_sub, sub_sub, smul_comm μ₁, add_sub_left_comm]
    all_goals 

Proof state:
K R : Type v
V M : Type w
inst✝⁶ : CommRing R
inst✝⁵ : AddCommGroup M
inst✝⁴ : Module R M
inst✝³ : Field K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
inst✝ : NoZeroSMulDivisors R M
f : End R M
μ₁ μ₂ : R
hμ : μ₁ ≠ μ₂
k l : ℕ
✝ : Nontrivial M
this : IsReduced R
p : Submodule R M := (generalizedEigenspace f μ₁) k ⊓ (generalizedEigenspace f μ₂) l
hp : Nontrivial ↥p
f₁ : End R ↥p :=
  LinearMap.restrict (f - (algebraMap R (End R M)) μ₁)
    (_ :
      MapsTo (fun x => (f - (algebraMap R (End R M)) μ₁) x)
        (↑((generalizedEigenspace f μ₁) k) ∩ ↑((generalizedEigenspace f μ₂) l))
        (↑((generalizedEigenspace f μ₁) k) ∩ ↑((generalizedEigenspace f μ₂) l)))
f₂ : End R ↥p :=
  LinearMap.restrict (f - (algebraMap R (End R M)) μ₂)
    (_ :
      MapsTo (fun x => (f - (algebraMap R (End R M)) μ₂) x)
        (↑((generalizedEigenspace f μ₁) k) ∩ ↑((generalizedEigenspace f μ₂) l))
        (↑((generalizedEigenspace f μ₁) k) ∩ ↑((generalizedEigenspace f μ₂) l)))
⊢ f₁ ^ k = 0

Next tactic:
ext ⟨x, _, _⟩
lemma disjoint_generalizedEigenspace [NoZeroSMulDivisors R M]
    (f : End R M) {μ₁ μ₂ : R} (hμ : μ₁ ≠ μ₂) (k l : ℕ) :
    Disjoint (f.generalizedEigenspace μ₁ k) (f.generalizedEigenspace μ₂ l) := by
  nontriviality M
  have := NoZeroSMulDivisors.isReduced R M
  rw [disjoint_iff]
  set p := f.generalizedEigenspace μ₁ k ⊓ f.generalizedEigenspace μ₂ l
  by_contra hp
  replace hp : Nontrivial p := Submodule.nontrivial_iff_ne_bot.mpr hp
  let f₁ : End R p := (f - algebraMap R (End R M) μ₁).restrict <| MapsTo.inter_inter
    (mapsTo_generalizedEigenspace_of_comm (Algebra.mul_sub_algebraMap_commutes f μ₁) μ₁ k)
    (mapsTo_generalizedEigenspace_of_comm (Algebra.mul_sub_algebraMap_commutes f μ₁) μ₂ l)
  let f₂ : End R p := (f - algebraMap R (End R M) μ₂).restrict <| MapsTo.inter_inter
    (mapsTo_generalizedEigenspace_of_comm (Algebra.mul_sub_algebraMap_commutes f μ₂) μ₁ k)
    (mapsTo_generalizedEigenspace_of_comm (Algebra.mul_sub_algebraMap_commutes f μ₂) μ₂ l)
  have : IsNilpotent (f₂ - f₁) := by
    apply Commute.isNilpotent_sub (x := f₂) (y := f₁) _ ⟨l, ?_⟩ ⟨k, ?_⟩
    · ext; simp [smul_sub, sub_sub, smul_comm μ₁, add_sub_left_comm]
    all_goals ext ⟨x, _, _⟩; 

Proof state:
case h.mk.intro.a
K R : Type v
V M : Type w
inst✝⁶ : CommRing R
inst✝⁵ : AddCommGroup M
inst✝⁴ : Module R M
inst✝³ : Field K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
inst✝ : NoZeroSMulDivisors R M
f : End R M
μ₁ μ₂ : R
hμ : μ₁ ≠ μ₂
k l : ℕ
✝ : Nontrivial M
this : IsReduced R
p : Submodule R M := (generalizedEigenspace f μ₁) k ⊓ (generalizedEigenspace f μ₂) l
hp : Nontrivial ↥p
f₁ : End R ↥p :=
  LinearMap.restrict (f - (algebraMap R (End R M)) μ₁)
    (_ :
      MapsTo (fun x => (f - (algebraMap R (End R M)) μ₁) x)
        (↑((generalizedEigenspace f μ₁) k) ∩ ↑((generalizedEigenspace f μ₂) l))
        (↑((generalizedEigenspace f μ₁) k) ∩ ↑((generalizedEigenspace f μ₂) l)))
f₂ : End R ↥p :=
  LinearMap.restrict (f - (algebraMap R (End R M)) μ₂)
    (_ :
      MapsTo (fun x => (f - (algebraMap R (End R M)) μ₂) x)
        (↑((generalizedEigenspace f μ₁) k) ∩ ↑((generalizedEigenspace f μ₂) l))
        (↑((generalizedEigenspace f μ₁) k) ∩ ↑((generalizedEigenspace f μ₂) l)))
x : M
left✝ : x ∈ ↑((generalizedEigenspace f μ₁) k)
right✝ : x ∈ ↑((generalizedEigenspace f μ₂) l)
⊢ ↑((f₁ ^ k)
        { val := x, property := (_ : x ∈ ↑((generalizedEigenspace f μ₁) k) ∧ x ∈ ↑((generalizedEigenspace f μ₂) l)) }) =
    ↑(0 { val := x, property := (_ : x ∈ ↑((generalizedEigenspace f μ₁) k) ∧ x ∈ ↑((generalizedEigenspace f μ₂) l)) })

Next tactic:
simpa [LinearMap.restrict_apply, LinearMap.pow_restrict _] using ‹_›
lemma disjoint_generalizedEigenspace [NoZeroSMulDivisors R M]
    (f : End R M) {μ₁ μ₂ : R} (hμ : μ₁ ≠ μ₂) (k l : ℕ) :
    Disjoint (f.generalizedEigenspace μ₁ k) (f.generalizedEigenspace μ₂ l) := by
  nontriviality M
  have := NoZeroSMulDivisors.isReduced R M
  rw [disjoint_iff]
  set p := f.generalizedEigenspace μ₁ k ⊓ f.generalizedEigenspace μ₂ l
  by_contra hp
  replace hp : Nontrivial p := Submodule.nontrivial_iff_ne_bot.mpr hp
  let f₁ : End R p := (f - algebraMap R (End R M) μ₁).restrict <| MapsTo.inter_inter
    (mapsTo_generalizedEigenspace_of_comm (Algebra.mul_sub_algebraMap_commutes f μ₁) μ₁ k)
    (mapsTo_generalizedEigenspace_of_comm (Algebra.mul_sub_algebraMap_commutes f μ₁) μ₂ l)
  let f₂ : End R p := (f - algebraMap R (End R M) μ₂).restrict <| MapsTo.inter_inter
    (mapsTo_generalizedEigenspace_of_comm (Algebra.mul_sub_algebraMap_commutes f μ₂) μ₁ k)
    (mapsTo_generalizedEigenspace_of_comm (Algebra.mul_sub_algebraMap_commutes f μ₂) μ₂ l)
  have : IsNilpotent (f₂ - f₁) := by
    apply Commute.isNilpotent_sub (x := f₂) (y := f₁) _ ⟨l, ?_⟩ ⟨k, ?_⟩
    · ext; simp [smul_sub, sub_sub, smul_comm μ₁, add_sub_left_comm]
    all_goals ext ⟨x, _, _⟩; simpa [LinearMap.restrict_apply, LinearMap.pow_restrict _] using ‹_›
  

Proof state:
K R : Type v
V M : Type w
inst✝⁶ : CommRing R
inst✝⁵ : AddCommGroup M
inst✝⁴ : Module R M
inst✝³ : Field K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
inst✝ : NoZeroSMulDivisors R M
f : End R M
μ₁ μ₂ : R
hμ : μ₁ ≠ μ₂
k l : ℕ
✝ : Nontrivial M
this✝ : IsReduced R
p : Submodule R M := (generalizedEigenspace f μ₁) k ⊓ (generalizedEigenspace f μ₂) l
hp : Nontrivial ↥p
f₁ : End R ↥p :=
  LinearMap.restrict (f - (algebraMap R (End R M)) μ₁)
    (_ :
      MapsTo (fun x => (f - (algebraMap R (End R M)) μ₁) x)
        (↑((generalizedEigenspace f μ₁) k) ∩ ↑((generalizedEigenspace f μ₂) l))
        (↑((generalizedEigenspace f μ₁) k) ∩ ↑((generalizedEigenspace f μ₂) l)))
f₂ : End R ↥p :=
  LinearMap.restrict (f - (algebraMap R (End R M)) μ₂)
    (_ :
      MapsTo (fun x => (f - (algebraMap R (End R M)) μ₂) x)
        (↑((generalizedEigenspace f μ₁) k) ∩ ↑((generalizedEigenspace f μ₂) l))
        (↑((generalizedEigenspace f μ₁) k) ∩ ↑((generalizedEigenspace f μ₂) l)))
this : IsNilpotent (f₂ - f₁)
⊢ False

Next tactic:
have hf₁₂ : f₂ - f₁ = algebraMap R (End R p) (μ₁ - μ₂) := by ext; simp [sub_smul]