l3lab/ntp-mathlib huggingface dataset:
/-- A generalized eigenvalue for some exponent `k` is also
    a generalized eigenvalue for exponents larger than `k`. -/
theorem hasGeneralizedEigenvalue_of_hasGeneralizedEigenvalue_of_le {f : End R M} {μ : R} {k : ℕ}
    {m : ℕ} (hm : k ≤ m) (hk : f.HasGeneralizedEigenvalue μ k) :
    f.HasGeneralizedEigenvalue μ m := by
  unfold HasGeneralizedEigenvalue at *
  contrapose! hk
  

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
f : End R M
μ : R
k m : ℕ
hm : k ≤ m
hk : (generalizedEigenspace f μ) m = ⊥
⊢ (generalizedEigenspace f μ) k = ⊥

Next tactic:
rw [← le_bot_iff, ← hk]
/-- A generalized eigenvalue for some exponent `k` is also
    a generalized eigenvalue for exponents larger than `k`. -/
theorem hasGeneralizedEigenvalue_of_hasGeneralizedEigenvalue_of_le {f : End R M} {μ : R} {k : ℕ}
    {m : ℕ} (hm : k ≤ m) (hk : f.HasGeneralizedEigenvalue μ k) :
    f.HasGeneralizedEigenvalue μ m := by
  unfold HasGeneralizedEigenvalue at *
  contrapose! hk
  rw [← le_bot_iff, ← hk]
  

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
f : End R M
μ : R
k m : ℕ
hm : k ≤ m
hk : (generalizedEigenspace f μ) m = ⊥
⊢ (generalizedEigenspace f μ) k ≤ (generalizedEigenspace f μ) m

Next tactic:
exact (f.generalizedEigenspace μ).monotone hm
/-- All eigenvalues are generalized eigenvalues. -/
theorem hasGeneralizedEigenvalue_of_hasEigenvalue {f : End R M} {μ : R} {k : ℕ} (hk : 0 < k)
    (hμ : f.HasEigenvalue μ) : f.HasGeneralizedEigenvalue μ k := 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
f : End R M
μ : R
k : ℕ
hk : 0 < k
hμ : HasEigenvalue f μ
⊢ HasGeneralizedEigenvalue f μ k

Next tactic:
apply hasGeneralizedEigenvalue_of_hasGeneralizedEigenvalue_of_le hk
/-- All eigenvalues are generalized eigenvalues. -/
theorem hasGeneralizedEigenvalue_of_hasEigenvalue {f : End R M} {μ : R} {k : ℕ} (hk : 0 < k)
    (hμ : f.HasEigenvalue μ) : f.HasGeneralizedEigenvalue μ k := by
  apply hasGeneralizedEigenvalue_of_hasGeneralizedEigenvalue_of_le hk
  

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
f : End R M
μ : R
k : ℕ
hk : 0 < k
hμ : HasEigenvalue f μ
⊢ HasGeneralizedEigenvalue f μ (Nat.succ 0)

Next tactic:
rw [HasGeneralizedEigenvalue, generalizedEigenspace, OrderHom.coe_mk, pow_one]
/-- All eigenvalues are generalized eigenvalues. -/
theorem hasGeneralizedEigenvalue_of_hasEigenvalue {f : End R M} {μ : R} {k : ℕ} (hk : 0 < k)
    (hμ : f.HasEigenvalue μ) : f.HasGeneralizedEigenvalue μ k := by
  apply hasGeneralizedEigenvalue_of_hasGeneralizedEigenvalue_of_le hk
  rw [HasGeneralizedEigenvalue, generalizedEigenspace, OrderHom.coe_mk, pow_one]
  

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
f : End R M
μ : R
k : ℕ
hk : 0 < k
hμ : HasEigenvalue f μ
⊢ LinearMap.ker (f - (algebraMap R (End R M)) μ) ≠ ⊥

Next tactic:
exact hμ
/-- All generalized eigenvalues are eigenvalues. -/
theorem hasEigenvalue_of_hasGeneralizedEigenvalue {f : End R M} {μ : R} {k : ℕ}
    (hμ : f.HasGeneralizedEigenvalue μ k) : f.HasEigenvalue μ := 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
f : End R M
μ : R
k : ℕ
hμ : HasGeneralizedEigenvalue f μ k
⊢ HasEigenvalue f μ

Next tactic:
intro contra
/-- All generalized eigenvalues are eigenvalues. -/
theorem hasEigenvalue_of_hasGeneralizedEigenvalue {f : End R M} {μ : R} {k : ℕ}
    (hμ : f.HasGeneralizedEigenvalue μ k) : f.HasEigenvalue μ := by
  intro contra; 

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
f : End R M
μ : R
k : ℕ
hμ : HasGeneralizedEigenvalue f μ k
contra : eigenspace f μ = ⊥
⊢ False

Next tactic:
apply hμ
/-- All generalized eigenvalues are eigenvalues. -/
theorem hasEigenvalue_of_hasGeneralizedEigenvalue {f : End R M} {μ : R} {k : ℕ}
    (hμ : f.HasGeneralizedEigenvalue μ k) : f.HasEigenvalue μ := by
  intro contra; apply hμ
  

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
f : End R M
μ : R
k : ℕ
hμ : HasGeneralizedEigenvalue f μ k
contra : eigenspace f μ = ⊥
⊢ (generalizedEigenspace f μ) k = ⊥

Next tactic:
erw [LinearMap.ker_eq_bot] at contra ⊢
/-- All generalized eigenvalues are eigenvalues. -/
theorem hasEigenvalue_of_hasGeneralizedEigenvalue {f : End R M} {μ : R} {k : ℕ}
    (hμ : f.HasGeneralizedEigenvalue μ k) : f.HasEigenvalue μ := by
  intro contra; apply hμ
  erw [LinearMap.ker_eq_bot] at contra ⊢; 

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
f : End R M
μ : R
k : ℕ
hμ : HasGeneralizedEigenvalue f μ k
contra : Function.Injective ⇑(f - (algebraMap R (End R M)) μ)
⊢ Function.Injective ⇑((f - (algebraMap R (End R M)) μ) ^ k)

Next tactic:
rw [LinearMap.coe_pow]
/-- All generalized eigenvalues are eigenvalues. -/
theorem hasEigenvalue_of_hasGeneralizedEigenvalue {f : End R M} {μ : R} {k : ℕ}
    (hμ : f.HasGeneralizedEigenvalue μ k) : f.HasEigenvalue μ := by
  intro contra; apply hμ
  erw [LinearMap.ker_eq_bot] at contra ⊢; rw [LinearMap.coe_pow]
  

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
f : End R M
μ : R
k : ℕ
hμ : HasGeneralizedEigenvalue f μ k
contra : Function.Injective ⇑(f - (algebraMap R (End R M)) μ)
⊢ Function.Injective (⇑(f - (algebraMap R (End R M)) μ))^[k]

Next tactic:
exact Function.Injective.iterate contra k
lemma mapsTo_generalizedEigenspace_of_comm {f g : End R M} (h : Commute f g) (μ : R) (k : ℕ) :
    MapsTo g (f.generalizedEigenspace μ k) (f.generalizedEigenspace μ k) := 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
f g : End R M
h : Commute f g
μ : R
k : ℕ
⊢ MapsTo ⇑g ↑((generalizedEigenspace f μ) k) ↑((generalizedEigenspace f μ) k)

Next tactic:
replace h : Commute ((f - μ • (1 : End R M)) ^ k) g :=
    (h.sub_left <| Algebra.commute_algebraMap_left μ g).pow_left k
lemma mapsTo_generalizedEigenspace_of_comm {f g : End R M} (h : Commute f g) (μ : R) (k : ℕ) :
    MapsTo g (f.generalizedEigenspace μ k) (f.generalizedEigenspace μ k) := by
  replace h : Commute ((f - μ • (1 : End R M)) ^ k) g :=
    (h.sub_left <| Algebra.commute_algebraMap_left μ g).pow_left 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
f g : End R M
μ : R
k : ℕ
h : Commute ((f - μ • 1) ^ k) g
⊢ MapsTo ⇑g ↑((generalizedEigenspace f μ) k) ↑((generalizedEigenspace f μ) k)

Next tactic:
intro x hx
lemma mapsTo_generalizedEigenspace_of_comm {f g : End R M} (h : Commute f g) (μ : R) (k : ℕ) :
    MapsTo g (f.generalizedEigenspace μ k) (f.generalizedEigenspace μ k) := by
  replace h : Commute ((f - μ • (1 : End R M)) ^ k) g :=
    (h.sub_left <| Algebra.commute_algebraMap_left μ g).pow_left k
  intro x hx
  

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
f g : End R M
μ : R
k : ℕ
h : Commute ((f - μ • 1) ^ k) g
x : M
hx : x ∈ ↑((generalizedEigenspace f μ) k)
⊢ g x ∈ ↑((generalizedEigenspace f μ) k)

Next tactic:
simp only [SetLike.mem_coe, mem_generalizedEigenspace] at hx ⊢
lemma mapsTo_generalizedEigenspace_of_comm {f g : End R M} (h : Commute f g) (μ : R) (k : ℕ) :
    MapsTo g (f.generalizedEigenspace μ k) (f.generalizedEigenspace μ k) := by
  replace h : Commute ((f - μ • (1 : End R M)) ^ k) g :=
    (h.sub_left <| Algebra.commute_algebraMap_left μ g).pow_left k
  intro x hx
  simp only [SetLike.mem_coe, mem_generalizedEigenspace] at hx ⊢
  

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
f g : End R M
μ : R
k : ℕ
h : Commute ((f - μ • 1) ^ k) g
x : M
hx : ((f - μ • 1) ^ k) x = 0
⊢ ((f - μ • 1) ^ k) (g x) = 0

Next tactic:
rw [← LinearMap.comp_apply, ← LinearMap.mul_eq_comp, h.eq, LinearMap.mul_eq_comp,
    LinearMap.comp_apply, hx, map_zero]
lemma mapsTo_iSup_generalizedEigenspace_of_comm {f g : End R M} (h : Commute f g) (μ : R) :
    MapsTo g ↑(⨆ k, f.generalizedEigenspace μ k) ↑(⨆ k, f.generalizedEigenspace μ k) := 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
f g : End R M
h : Commute f g
μ : R
⊢ MapsTo ⇑g ↑(⨆ k, (generalizedEigenspace f μ) k) ↑(⨆ k, (generalizedEigenspace f μ) k)

Next tactic:
simp only [MapsTo, Submodule.coe_iSup_of_chain, mem_iUnion, SetLike.mem_coe]
lemma mapsTo_iSup_generalizedEigenspace_of_comm {f g : End R M} (h : Commute f g) (μ : R) :
    MapsTo g ↑(⨆ k, f.generalizedEigenspace μ k) ↑(⨆ k, f.generalizedEigenspace μ k) := by
  simp only [MapsTo, Submodule.coe_iSup_of_chain, mem_iUnion, SetLike.mem_coe]
  

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
f g : End R M
h : Commute f g
μ : R
⊢ ∀ ⦃x : M⦄, (∃ i, x ∈ (generalizedEigenspace f μ) i) → ∃ i, g x ∈ (generalizedEigenspace f μ) i

Next tactic:
rintro x ⟨k, hk⟩
lemma mapsTo_iSup_generalizedEigenspace_of_comm {f g : End R M} (h : Commute f g) (μ : R) :
    MapsTo g ↑(⨆ k, f.generalizedEigenspace μ k) ↑(⨆ k, f.generalizedEigenspace μ k) := by
  simp only [MapsTo, Submodule.coe_iSup_of_chain, mem_iUnion, SetLike.mem_coe]
  rintro x ⟨k, hk⟩
  

Proof state:
case intro
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
f g : End R M
h : Commute f g
μ : R
x : M
k : ℕ
hk : x ∈ (generalizedEigenspace f μ) k
⊢ ∃ i, g x ∈ (generalizedEigenspace f μ) i

Next tactic:
exact ⟨k, f.mapsTo_generalizedEigenspace_of_comm h μ k hk⟩
/-- The restriction of `f - μ • 1` to the `k`-fold generalized `μ`-eigenspace is nilpotent. -/
lemma isNilpotent_restrict_sub_algebraMap (f : End R M) (μ : R) (k : ℕ)
    (h : MapsTo (f - algebraMap R (End R M) μ)
      (f.generalizedEigenspace μ k) (f.generalizedEigenspace μ k) :=
      mapsTo_generalizedEigenspace_of_comm (Algebra.mul_sub_algebraMap_commutes f μ) μ k) :
    IsNilpotent ((f - algebraMap R (End R M) μ).restrict h) := 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
f : End R M
μ : R
k : ℕ
h :
  optParam (MapsTo ⇑(f - (algebraMap R (End R M)) μ) ↑((generalizedEigenspace f μ) k) ↑((generalizedEigenspace f μ) k))
    (_ : MapsTo ⇑(f - (algebraMap R (End R M)) μ) ↑((generalizedEigenspace f μ) k) ↑((generalizedEigenspace f μ) k))
⊢ IsNilpotent (LinearMap.restrict (f - (algebraMap R (End R M)) μ) h)

Next tactic:
use k
/-- The restriction of `f - μ • 1` to the `k`-fold generalized `μ`-eigenspace is nilpotent. -/
lemma isNilpotent_restrict_sub_algebraMap (f : End R M) (μ : R) (k : ℕ)
    (h : MapsTo (f - algebraMap R (End R M) μ)
      (f.generalizedEigenspace μ k) (f.generalizedEigenspace μ k) :=
      mapsTo_generalizedEigenspace_of_comm (Algebra.mul_sub_algebraMap_commutes f μ) μ k) :
    IsNilpotent ((f - algebraMap R (End R M) μ).restrict h) := by
  use k
  

Proof state:
case h
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
f : End R M
μ : R
k : ℕ
h :
  optParam (MapsTo ⇑(f - (algebraMap R (End R M)) μ) ↑((generalizedEigenspace f μ) k) ↑((generalizedEigenspace f μ) k))
    (_ : MapsTo ⇑(f - (algebraMap R (End R M)) μ) ↑((generalizedEigenspace f μ) k) ↑((generalizedEigenspace f μ) k))
⊢ LinearMap.restrict (f - (algebraMap R (End R M)) μ) h ^ k = 0

Next tactic:
ext
/-- The restriction of `f - μ • 1` to the `k`-fold generalized `μ`-eigenspace is nilpotent. -/
lemma isNilpotent_restrict_sub_algebraMap (f : End R M) (μ : R) (k : ℕ)
    (h : MapsTo (f - algebraMap R (End R M) μ)
      (f.generalizedEigenspace μ k) (f.generalizedEigenspace μ k) :=
      mapsTo_generalizedEigenspace_of_comm (Algebra.mul_sub_algebraMap_commutes f μ) μ k) :
    IsNilpotent ((f - algebraMap R (End R M) μ).restrict h) := by
  use k
  ext
  

Proof state:
case h.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
f : End R M
μ : R
k : ℕ
h :
  optParam (MapsTo ⇑(f - (algebraMap R (End R M)) μ) ↑((generalizedEigenspace f μ) k) ↑((generalizedEigenspace f μ) k))
    (_ : MapsTo ⇑(f - (algebraMap R (End R M)) μ) ↑((generalizedEigenspace f μ) k) ↑((generalizedEigenspace f μ) k))
x✝ : ↥((generalizedEigenspace f μ) k)
⊢ ↑((LinearMap.restrict (f - (algebraMap R (End R M)) μ) h ^ k) x✝) = ↑(0 x✝)

Next tactic:
simp [LinearMap.restrict_apply, LinearMap.pow_restrict _]
/-- The restriction of `f - μ • 1` to the generalized `μ`-eigenspace is nilpotent. -/
lemma isNilpotent_restrict_iSup_sub_algebraMap [IsNoetherian R M] (f : End R M) (μ : R)
    (h : MapsTo (f - algebraMap R (End R M) μ)
      ↑(⨆ k, f.generalizedEigenspace μ k) ↑(⨆ k, f.generalizedEigenspace μ k) :=
      mapsTo_iSup_generalizedEigenspace_of_comm (Algebra.mul_sub_algebraMap_commutes f μ) μ) :
    IsNilpotent ((f - algebraMap R (End R M) μ).restrict h) := 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✝ : IsNoetherian R M
f : End R M
μ : R
h :
  optParam
    (MapsTo ⇑(f - (algebraMap R (End R M)) μ) ↑(⨆ k, (generalizedEigenspace f μ) k)
      ↑(⨆ k, (generalizedEigenspace f μ) k))
    (_ :
      MapsTo ⇑(f - (algebraMap R (End R M)) μ) ↑(⨆ k, (generalizedEigenspace f μ) k)
        ↑(⨆ k, (generalizedEigenspace f μ) k))
⊢ IsNilpotent (LinearMap.restrict (f - (algebraMap R (End R M)) μ) h)

Next tactic:
obtain ⟨l, hl⟩ : ∃ l, ⨆ k, f.generalizedEigenspace μ k = f.generalizedEigenspace μ l :=
    ⟨_, maximalGeneralizedEigenspace_eq f μ⟩
/-- The restriction of `f - μ • 1` to the generalized `μ`-eigenspace is nilpotent. -/
lemma isNilpotent_restrict_iSup_sub_algebraMap [IsNoetherian R M] (f : End R M) (μ : R)
    (h : MapsTo (f - algebraMap R (End R M) μ)
      ↑(⨆ k, f.generalizedEigenspace μ k) ↑(⨆ k, f.generalizedEigenspace μ k) :=
      mapsTo_iSup_generalizedEigenspace_of_comm (Algebra.mul_sub_algebraMap_commutes f μ) μ) :
    IsNilpotent ((f - algebraMap R (End R M) μ).restrict h) := by
  obtain ⟨l, hl⟩ : ∃ l, ⨆ k, f.generalizedEigenspace μ k = f.generalizedEigenspace μ l :=
    ⟨_, maximalGeneralizedEigenspace_eq f μ⟩
  

Proof state:
case intro
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✝ : IsNoetherian R M
f : End R M
μ : R
h :
  optParam
    (MapsTo ⇑(f - (algebraMap R (End R M)) μ) ↑(⨆ k, (generalizedEigenspace f μ) k)
      ↑(⨆ k, (generalizedEigenspace f μ) k))
    (_ :
      MapsTo ⇑(f - (algebraMap R (End R M)) μ) ↑(⨆ k, (generalizedEigenspace f μ) k)
        ↑(⨆ k, (generalizedEigenspace f μ) k))
l : ℕ
hl : ⨆ k, (generalizedEigenspace f μ) k = (generalizedEigenspace f μ) l
⊢ IsNilpotent (LinearMap.restrict (f - (algebraMap R (End R M)) μ) h)

Next tactic:
use l
/-- The restriction of `f - μ • 1` to the generalized `μ`-eigenspace is nilpotent. -/
lemma isNilpotent_restrict_iSup_sub_algebraMap [IsNoetherian R M] (f : End R M) (μ : R)
    (h : MapsTo (f - algebraMap R (End R M) μ)
      ↑(⨆ k, f.generalizedEigenspace μ k) ↑(⨆ k, f.generalizedEigenspace μ k) :=
      mapsTo_iSup_generalizedEigenspace_of_comm (Algebra.mul_sub_algebraMap_commutes f μ) μ) :
    IsNilpotent ((f - algebraMap R (End R M) μ).restrict h) := by
  obtain ⟨l, hl⟩ : ∃ l, ⨆ k, f.generalizedEigenspace μ k = f.generalizedEigenspace μ l :=
    ⟨_, maximalGeneralizedEigenspace_eq f μ⟩
  use l
  

Proof state:
case h
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✝ : IsNoetherian R M
f : End R M
μ : R
h :
  optParam
    (MapsTo ⇑(f - (algebraMap R (End R M)) μ) ↑(⨆ k, (generalizedEigenspace f μ) k)
      ↑(⨆ k, (generalizedEigenspace f μ) k))
    (_ :
      MapsTo ⇑(f - (algebraMap R (End R M)) μ) ↑(⨆ k, (generalizedEigenspace f μ) k)
        ↑(⨆ k, (generalizedEigenspace f μ) k))
l : ℕ
hl : ⨆ k, (generalizedEigenspace f μ) k = (generalizedEigenspace f μ) l
⊢ LinearMap.restrict (f - (algebraMap R (End R M)) μ) h ^ l = 0

Next tactic:
ext ⟨x, hx⟩
/-- The restriction of `f - μ • 1` to the generalized `μ`-eigenspace is nilpotent. -/
lemma isNilpotent_restrict_iSup_sub_algebraMap [IsNoetherian R M] (f : End R M) (μ : R)
    (h : MapsTo (f - algebraMap R (End R M) μ)
      ↑(⨆ k, f.generalizedEigenspace μ k) ↑(⨆ k, f.generalizedEigenspace μ k) :=
      mapsTo_iSup_generalizedEigenspace_of_comm (Algebra.mul_sub_algebraMap_commutes f μ) μ) :
    IsNilpotent ((f - algebraMap R (End R M) μ).restrict h) := by
  obtain ⟨l, hl⟩ : ∃ l, ⨆ k, f.generalizedEigenspace μ k = f.generalizedEigenspace μ l :=
    ⟨_, maximalGeneralizedEigenspace_eq f μ⟩
  use l
  ext ⟨x, hx⟩
  

Proof state:
case h.h.mk.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✝ : IsNoetherian R M
f : End R M
μ : R
h :
  optParam
    (MapsTo ⇑(f - (algebraMap R (End R M)) μ) ↑(⨆ k, (generalizedEigenspace f μ) k)
      ↑(⨆ k, (generalizedEigenspace f μ) k))
    (_ :
      MapsTo ⇑(f - (algebraMap R (End R M)) μ) ↑(⨆ k, (generalizedEigenspace f μ) k)
        ↑(⨆ k, (generalizedEigenspace f μ) k))
l : ℕ
hl : ⨆ k, (generalizedEigenspace f μ) k = (generalizedEigenspace f μ) l
x : M
hx : x ∈ ⨆ k, (generalizedEigenspace f μ) k
⊢ ↑((LinearMap.restrict (f - (algebraMap R (End R M)) μ) h ^ l) { val := x, property := hx }) =
    ↑(0 { val := x, property := hx })

Next tactic:
simpa [hl, LinearMap.restrict_apply, LinearMap.pow_restrict _] using hx
lemma disjoint_generalizedEigenspace [NoZeroSMulDivisors R M]
    (f : End R M) {μ₁ μ₂ : R} (hμ : μ₁ ≠ μ₂) (k l : ℕ) :
    Disjoint (f.generalizedEigenspace μ₁ k) (f.generalizedEigenspace μ₂ l) := 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 : ℕ
⊢ Disjoint ((generalizedEigenspace f μ₁) k) ((generalizedEigenspace f μ₂) l)

Next tactic:
nontriviality M
lemma disjoint_generalizedEigenspace [NoZeroSMulDivisors R M]
    (f : End R M) {μ₁ μ₂ : R} (hμ : μ₁ ≠ μ₂) (k l : ℕ) :
    Disjoint (f.generalizedEigenspace μ₁ k) (f.generalizedEigenspace μ₂ l) := by
  nontriviality M
  

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
⊢ Disjoint ((generalizedEigenspace f μ₁) k) ((generalizedEigenspace f μ₂) l)

Next tactic:
have := NoZeroSMulDivisors.isReduced R M
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
  

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
⊢ Disjoint ((generalizedEigenspace f μ₁) k) ((generalizedEigenspace f μ₂) l)

Next tactic:
rw [disjoint_iff]
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]
  

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
⊢ (generalizedEigenspace f μ₁) k ⊓ (generalizedEigenspace f μ₂) l = ⊥

Next tactic:
set p := f.generalizedEigenspace μ₁ k ⊓ f.generalizedEigenspace μ₂ 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
  

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
⊢ p = ⊥

Next tactic:
by_contra hp
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
  

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 : ¬p = ⊥
⊢ False

Next tactic:
replace hp : Nontrivial p := Submodule.nontrivial_iff_ne_bot.mpr hp
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
  

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
⊢ 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)