l3lab/ntp-mathlib huggingface dataset:
/-- Generalized eigenrange and generalized eigenspace for exponent `finrank K V` are disjoint. -/
theorem generalized_eigenvec_disjoint_range_ker [FiniteDimensional K V] (f : End K V) (μ : K) :
    Disjoint (f.generalizedEigenrange μ (finrank K V))
      (f.generalizedEigenspace μ (finrank K V)) := by
  have h :=
    calc
      Submodule.comap ((f - algebraMap _ _ μ) ^ finrank K V)
        (f.generalizedEigenspace μ (finrank K V)) =
          LinearMap.ker ((f - algebraMap _ _ μ) ^ finrank K V *
            (f - algebraMap K (End K V) μ) ^ finrank K V) := by
              rw [generalizedEigenspace, OrderHom.coe_mk, ← LinearMap.ker_comp]; rfl
      _ = f.generalizedEigenspace μ (finrank K V + finrank K V) := by rw [← pow_add]; 

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✝ : FiniteDimensional K V
f : End K V
μ : K
⊢ LinearMap.ker ((f - (algebraMap K (End K V)) μ) ^ (finrank K V + finrank K V)) =
    (generalizedEigenspace f μ) (finrank K V + finrank K V)

Next tactic:
rfl
/-- Generalized eigenrange and generalized eigenspace for exponent `finrank K V` are disjoint. -/
theorem generalized_eigenvec_disjoint_range_ker [FiniteDimensional K V] (f : End K V) (μ : K) :
    Disjoint (f.generalizedEigenrange μ (finrank K V))
      (f.generalizedEigenspace μ (finrank K V)) := by
  have h :=
    calc
      Submodule.comap ((f - algebraMap _ _ μ) ^ finrank K V)
        (f.generalizedEigenspace μ (finrank K V)) =
          LinearMap.ker ((f - algebraMap _ _ μ) ^ finrank K V *
            (f - algebraMap K (End K V) μ) ^ finrank K V) := by
              rw [generalizedEigenspace, OrderHom.coe_mk, ← LinearMap.ker_comp]; rfl
      _ = f.generalizedEigenspace μ (finrank K V + finrank K V) := by rw [← pow_add]; rfl
      _ = f.generalizedEigenspace μ (finrank K V) := 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✝ : FiniteDimensional K V
f : End K V
μ : K
⊢ (generalizedEigenspace f μ) (finrank K V + finrank K V) = (generalizedEigenspace f μ) (finrank K V)

Next tactic:
rw [generalizedEigenspace_eq_generalizedEigenspace_finrank_of_le]
/-- Generalized eigenrange and generalized eigenspace for exponent `finrank K V` are disjoint. -/
theorem generalized_eigenvec_disjoint_range_ker [FiniteDimensional K V] (f : End K V) (μ : K) :
    Disjoint (f.generalizedEigenrange μ (finrank K V))
      (f.generalizedEigenspace μ (finrank K V)) := by
  have h :=
    calc
      Submodule.comap ((f - algebraMap _ _ μ) ^ finrank K V)
        (f.generalizedEigenspace μ (finrank K V)) =
          LinearMap.ker ((f - algebraMap _ _ μ) ^ finrank K V *
            (f - algebraMap K (End K V) μ) ^ finrank K V) := by
              rw [generalizedEigenspace, OrderHom.coe_mk, ← LinearMap.ker_comp]; rfl
      _ = f.generalizedEigenspace μ (finrank K V + finrank K V) := by rw [← pow_add]; rfl
      _ = f.generalizedEigenspace μ (finrank K V) := by
        rw [generalizedEigenspace_eq_generalizedEigenspace_finrank_of_le]; 

Proof state:
case hk
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✝ : FiniteDimensional K V
f : End K V
μ : K
⊢ finrank K V ≤ finrank K V + finrank K V

Next tactic:
linarith
/-- Generalized eigenrange and generalized eigenspace for exponent `finrank K V` are disjoint. -/
theorem generalized_eigenvec_disjoint_range_ker [FiniteDimensional K V] (f : End K V) (μ : K) :
    Disjoint (f.generalizedEigenrange μ (finrank K V))
      (f.generalizedEigenspace μ (finrank K V)) := by
  have h :=
    calc
      Submodule.comap ((f - algebraMap _ _ μ) ^ finrank K V)
        (f.generalizedEigenspace μ (finrank K V)) =
          LinearMap.ker ((f - algebraMap _ _ μ) ^ finrank K V *
            (f - algebraMap K (End K V) μ) ^ finrank K V) := by
              rw [generalizedEigenspace, OrderHom.coe_mk, ← LinearMap.ker_comp]; rfl
      _ = f.generalizedEigenspace μ (finrank K V + finrank K V) := by rw [← pow_add]; rfl
      _ = f.generalizedEigenspace μ (finrank K V) := by
        rw [generalizedEigenspace_eq_generalizedEigenspace_finrank_of_le]; linarith
  

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✝ : FiniteDimensional K V
f : End K V
μ : K
h :
  Submodule.comap ((f - (algebraMap K (End K V)) μ) ^ finrank K V) ((generalizedEigenspace f μ) (finrank K V)) =
    (generalizedEigenspace f μ) (finrank K V)
⊢ Disjoint (generalizedEigenrange f μ (finrank K V)) ((generalizedEigenspace f μ) (finrank K V))

Next tactic:
rw [disjoint_iff_inf_le, generalizedEigenrange, LinearMap.range_eq_map,
    Submodule.map_inf_eq_map_inf_comap, top_inf_eq, h]
/-- Generalized eigenrange and generalized eigenspace for exponent `finrank K V` are disjoint. -/
theorem generalized_eigenvec_disjoint_range_ker [FiniteDimensional K V] (f : End K V) (μ : K) :
    Disjoint (f.generalizedEigenrange μ (finrank K V))
      (f.generalizedEigenspace μ (finrank K V)) := by
  have h :=
    calc
      Submodule.comap ((f - algebraMap _ _ μ) ^ finrank K V)
        (f.generalizedEigenspace μ (finrank K V)) =
          LinearMap.ker ((f - algebraMap _ _ μ) ^ finrank K V *
            (f - algebraMap K (End K V) μ) ^ finrank K V) := by
              rw [generalizedEigenspace, OrderHom.coe_mk, ← LinearMap.ker_comp]; rfl
      _ = f.generalizedEigenspace μ (finrank K V + finrank K V) := by rw [← pow_add]; rfl
      _ = f.generalizedEigenspace μ (finrank K V) := by
        rw [generalizedEigenspace_eq_generalizedEigenspace_finrank_of_le]; linarith
  rw [disjoint_iff_inf_le, generalizedEigenrange, LinearMap.range_eq_map,
    Submodule.map_inf_eq_map_inf_comap, top_inf_eq, 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
inst✝ : FiniteDimensional K V
f : End K V
μ : K
h :
  Submodule.comap ((f - (algebraMap K (End K V)) μ) ^ finrank K V) ((generalizedEigenspace f μ) (finrank K V)) =
    (generalizedEigenspace f μ) (finrank K V)
⊢ Submodule.map ((f - (algebraMap K (End K V)) μ) ^ finrank K V) ((generalizedEigenspace f μ) (finrank K V)) ≤ ⊥

Next tactic:
apply Submodule.map_comap_le
/-- If an invariant subspace `p` of an endomorphism `f` is disjoint from the `μ`-eigenspace of `f`,
then the restriction of `f` to `p` has trivial `μ`-eigenspace. -/
theorem eigenspace_restrict_eq_bot {f : End R M} {p : Submodule R M} (hfp : ∀ x ∈ p, f x ∈ p)
    {μ : R} (hμp : Disjoint (f.eigenspace μ) p) : eigenspace (f.restrict hfp) μ = ⊥ := 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
p : Submodule R M
hfp : ∀ x ∈ p, f x ∈ p
μ : R
hμp : Disjoint (eigenspace f μ) p
⊢ eigenspace (LinearMap.restrict f hfp) μ = ⊥

Next tactic:
rw [eq_bot_iff]
/-- If an invariant subspace `p` of an endomorphism `f` is disjoint from the `μ`-eigenspace of `f`,
then the restriction of `f` to `p` has trivial `μ`-eigenspace. -/
theorem eigenspace_restrict_eq_bot {f : End R M} {p : Submodule R M} (hfp : ∀ x ∈ p, f x ∈ p)
    {μ : R} (hμp : Disjoint (f.eigenspace μ) p) : eigenspace (f.restrict hfp) μ = ⊥ := by
  rw [eq_bot_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
f : End R M
p : Submodule R M
hfp : ∀ x ∈ p, f x ∈ p
μ : R
hμp : Disjoint (eigenspace f μ) p
⊢ eigenspace (LinearMap.restrict f hfp) μ ≤ ⊥

Next tactic:
intro x hx
/-- If an invariant subspace `p` of an endomorphism `f` is disjoint from the `μ`-eigenspace of `f`,
then the restriction of `f` to `p` has trivial `μ`-eigenspace. -/
theorem eigenspace_restrict_eq_bot {f : End R M} {p : Submodule R M} (hfp : ∀ x ∈ p, f x ∈ p)
    {μ : R} (hμp : Disjoint (f.eigenspace μ) p) : eigenspace (f.restrict hfp) μ = ⊥ := by
  rw [eq_bot_iff]
  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 : End R M
p : Submodule R M
hfp : ∀ x ∈ p, f x ∈ p
μ : R
hμp : Disjoint (eigenspace f μ) p
x : ↥p
hx : x ∈ eigenspace (LinearMap.restrict f hfp) μ
⊢ x ∈ ⊥

Next tactic:
simpa using hμp.le_bot ⟨eigenspace_restrict_le_eigenspace f hfp μ ⟨x, hx, rfl⟩, x.prop⟩
/-- The generalized eigenspace of an eigenvalue has positive dimension for positive exponents. -/
theorem pos_finrank_generalizedEigenspace_of_hasEigenvalue [FiniteDimensional K V] {f : End K V}
    {k : ℕ} {μ : K} (hx : f.HasEigenvalue μ) (hk : 0 < k) :
    0 < finrank K (f.generalizedEigenspace μ k) :=
  calc
    0 = finrank K (⊥ : Submodule K V) := 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✝ : FiniteDimensional K V
f : End K V
k : ℕ
μ : K
hx : HasEigenvalue f μ
hk : 0 < k
⊢ 0 = finrank K ↥⊥

Next tactic:
rw [finrank_bot]
/-- A linear map maps a generalized eigenrange into itself. -/
theorem map_generalizedEigenrange_le {f : End K V} {μ : K} {n : ℕ} :
    Submodule.map f (f.generalizedEigenrange μ n) ≤ f.generalizedEigenrange μ n :=
  calc
    Submodule.map f (f.generalizedEigenrange μ n) =
      LinearMap.range (f * (f - algebraMap _ _ μ) ^ n) := 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 K V
μ : K
n : ℕ
⊢ Submodule.map f (generalizedEigenrange f μ n) = LinearMap.range (f * (f - (algebraMap K (End K V)) μ) ^ n)

Next tactic:
rw [generalizedEigenrange]
/-- A linear map maps a generalized eigenrange into itself. -/
theorem map_generalizedEigenrange_le {f : End K V} {μ : K} {n : ℕ} :
    Submodule.map f (f.generalizedEigenrange μ n) ≤ f.generalizedEigenrange μ n :=
  calc
    Submodule.map f (f.generalizedEigenrange μ n) =
      LinearMap.range (f * (f - algebraMap _ _ μ) ^ n) := by
        rw [generalizedEigenrange]; 

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 K V
μ : K
n : ℕ
⊢ Submodule.map f (LinearMap.range ((f - (algebraMap K (End K V)) μ) ^ n)) =
    LinearMap.range (f * (f - (algebraMap K (End K V)) μ) ^ n)

Next tactic:
exact (LinearMap.range_comp _ _).symm
/-- A linear map maps a generalized eigenrange into itself. -/
theorem map_generalizedEigenrange_le {f : End K V} {μ : K} {n : ℕ} :
    Submodule.map f (f.generalizedEigenrange μ n) ≤ f.generalizedEigenrange μ n :=
  calc
    Submodule.map f (f.generalizedEigenrange μ n) =
      LinearMap.range (f * (f - algebraMap _ _ μ) ^ n) := by
        rw [generalizedEigenrange]; exact (LinearMap.range_comp _ _).symm
    _ = LinearMap.range ((f - algebraMap _ _ μ) ^ n * 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
f : End K V
μ : K
n : ℕ
⊢ LinearMap.range (f * (f - (algebraMap K (End K V)) μ) ^ n) =
    LinearMap.range ((f - (algebraMap K (End K V)) μ) ^ n * f)

Next tactic:
rw [Algebra.mul_sub_algebraMap_pow_commutes]
lemma iSup_generalizedEigenspace_le_smul (f : Module.End R M) (μ t : R) :
    (⨆ k, f.generalizedEigenspace μ k) ≤ ⨆ k, (t • f).generalizedEigenspace (t * μ) 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
μ t : R
⊢ ⨆ k, (generalizedEigenspace f μ) k ≤ ⨆ k, (generalizedEigenspace (t • f) (t * μ)) k

Next tactic:
intro m hm
lemma iSup_generalizedEigenspace_le_smul (f : Module.End R M) (μ t : R) :
    (⨆ k, f.generalizedEigenspace μ k) ≤ ⨆ k, (t • f).generalizedEigenspace (t * μ) k := by
  intro m hm
  

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
μ t : R
m : M
hm : m ∈ ⨆ k, (generalizedEigenspace f μ) k
⊢ m ∈ ⨆ k, (generalizedEigenspace (t • f) (t * μ)) k

Next tactic:
simp only [Submodule.mem_iSup_of_chain, mem_generalizedEigenspace] at hm ⊢
lemma iSup_generalizedEigenspace_le_smul (f : Module.End R M) (μ t : R) :
    (⨆ k, f.generalizedEigenspace μ k) ≤ ⨆ k, (t • f).generalizedEigenspace (t * μ) k := by
  intro m hm
  simp only [Submodule.mem_iSup_of_chain, mem_generalizedEigenspace] at hm ⊢
  

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
μ t : R
m : M
hm : ∃ k, ((f - μ • 1) ^ k) m = 0
⊢ ∃ k, ((t • f - (t * μ) • 1) ^ k) m = 0

Next tactic:
refine Exists.imp (fun k hk ↦ ?_) hm
lemma iSup_generalizedEigenspace_le_smul (f : Module.End R M) (μ t : R) :
    (⨆ k, f.generalizedEigenspace μ k) ≤ ⨆ k, (t • f).generalizedEigenspace (t * μ) k := by
  intro m hm
  simp only [Submodule.mem_iSup_of_chain, mem_generalizedEigenspace] at hm ⊢
  refine Exists.imp (fun k hk ↦ ?_) hm
  

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
μ t : R
m : M
hm : ∃ k, ((f - μ • 1) ^ k) m = 0
k : ℕ
hk : ((f - μ • 1) ^ k) m = 0
⊢ ((t • f - (t * μ) • 1) ^ k) m = 0

Next tactic:
rw [mul_smul, ← smul_sub, smul_pow, LinearMap.smul_apply, hk, smul_zero]
lemma iSup_generalizedEigenspace_inf_le_add
    (f₁ f₂ : End R M) (μ₁ μ₂ : R) (h : Commute f₁ f₂) :
    (⨆ k, f₁.generalizedEigenspace μ₁ k) ⊓ (⨆ k, f₂.generalizedEigenspace μ₂ k) ≤
    ⨆ k, (f₁ + 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₁ f₂ : End R M
μ₁ μ₂ : R
h : Commute f₁ f₂
⊢ (⨆ k, (generalizedEigenspace f₁ μ₁) k) ⊓ ⨆ k, (generalizedEigenspace f₂ μ₂) k ≤
    ⨆ k, (generalizedEigenspace (f₁ + f₂) (μ₁ + μ₂)) k

Next tactic:
intro m hm
lemma iSup_generalizedEigenspace_inf_le_add
    (f₁ f₂ : End R M) (μ₁ μ₂ : R) (h : Commute f₁ f₂) :
    (⨆ k, f₁.generalizedEigenspace μ₁ k) ⊓ (⨆ k, f₂.generalizedEigenspace μ₂ k) ≤
    ⨆ k, (f₁ + f₂).generalizedEigenspace (μ₁ + μ₂) k := by
  intro m hm
  

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₁ f₂ : End R M
μ₁ μ₂ : R
h : Commute f₁ f₂
m : M
hm : m ∈ (⨆ k, (generalizedEigenspace f₁ μ₁) k) ⊓ ⨆ k, (generalizedEigenspace f₂ μ₂) k
⊢ m ∈ ⨆ k, (generalizedEigenspace (f₁ + f₂) (μ₁ + μ₂)) k

Next tactic:
simp only [iSup_le_iff, Submodule.mem_inf, Submodule.mem_iSup_of_chain,
    mem_generalizedEigenspace] at hm ⊢
lemma iSup_generalizedEigenspace_inf_le_add
    (f₁ f₂ : End R M) (μ₁ μ₂ : R) (h : Commute f₁ f₂) :
    (⨆ k, f₁.generalizedEigenspace μ₁ k) ⊓ (⨆ k, f₂.generalizedEigenspace μ₂ k) ≤
    ⨆ k, (f₁ + f₂).generalizedEigenspace (μ₁ + μ₂) k := by
  intro m hm
  simp only [iSup_le_iff, Submodule.mem_inf, Submodule.mem_iSup_of_chain,
    mem_generalizedEigenspace] at hm ⊢
  

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₁ f₂ : End R M
μ₁ μ₂ : R
h : Commute f₁ f₂
m : M
hm : (∃ k, ((f₁ - μ₁ • 1) ^ k) m = 0) ∧ ∃ k, ((f₂ - μ₂ • 1) ^ k) m = 0
⊢ ∃ k, ((f₁ + f₂ - (μ₁ + μ₂) • 1) ^ k) m = 0

Next tactic:
obtain ⟨⟨k₁, hk₁⟩, ⟨k₂, hk₂⟩⟩ := hm
lemma iSup_generalizedEigenspace_inf_le_add
    (f₁ f₂ : End R M) (μ₁ μ₂ : R) (h : Commute f₁ f₂) :
    (⨆ k, f₁.generalizedEigenspace μ₁ k) ⊓ (⨆ k, f₂.generalizedEigenspace μ₂ k) ≤
    ⨆ k, (f₁ + f₂).generalizedEigenspace (μ₁ + μ₂) k := by
  intro m hm
  simp only [iSup_le_iff, Submodule.mem_inf, Submodule.mem_iSup_of_chain,
    mem_generalizedEigenspace] at hm ⊢
  obtain ⟨⟨k₁, hk₁⟩, ⟨k₂, hk₂⟩⟩ := hm
  

Proof state:
case intro.intro.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₁ f₂ : End R M
μ₁ μ₂ : R
h : Commute f₁ f₂
m : M
k₁ : ℕ
hk₁ : ((f₁ - μ₁ • 1) ^ k₁) m = 0
k₂ : ℕ
hk₂ : ((f₂ - μ₂ • 1) ^ k₂) m = 0
⊢ ∃ k, ((f₁ + f₂ - (μ₁ + μ₂) • 1) ^ k) m = 0

Next tactic:
use k₁ + k₂ - 1
lemma iSup_generalizedEigenspace_inf_le_add
    (f₁ f₂ : End R M) (μ₁ μ₂ : R) (h : Commute f₁ f₂) :
    (⨆ k, f₁.generalizedEigenspace μ₁ k) ⊓ (⨆ k, f₂.generalizedEigenspace μ₂ k) ≤
    ⨆ k, (f₁ + f₂).generalizedEigenspace (μ₁ + μ₂) k := by
  intro m hm
  simp only [iSup_le_iff, Submodule.mem_inf, Submodule.mem_iSup_of_chain,
    mem_generalizedEigenspace] at hm ⊢
  obtain ⟨⟨k₁, hk₁⟩, ⟨k₂, hk₂⟩⟩ := hm
  use k₁ + k₂ - 1
  

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₁ f₂ : End R M
μ₁ μ₂ : R
h : Commute f₁ f₂
m : M
k₁ : ℕ
hk₁ : ((f₁ - μ₁ • 1) ^ k₁) m = 0
k₂ : ℕ
hk₂ : ((f₂ - μ₂ • 1) ^ k₂) m = 0
⊢ ((f₁ + f₂ - (μ₁ + μ₂) • 1) ^ (k₁ + k₂ - 1)) m = 0

Next tactic:
have : f₁ + f₂ - (μ₁ + μ₂) • 1 = (f₁ - μ₁ • 1) + (f₂ - μ₂ • 1) := by
    rw [add_smul]; exact add_sub_add_comm f₁ f₂ (μ₁ • 1) (μ₂ • 1)
lemma iSup_generalizedEigenspace_inf_le_add
    (f₁ f₂ : End R M) (μ₁ μ₂ : R) (h : Commute f₁ f₂) :
    (⨆ k, f₁.generalizedEigenspace μ₁ k) ⊓ (⨆ k, f₂.generalizedEigenspace μ₂ k) ≤
    ⨆ k, (f₁ + f₂).generalizedEigenspace (μ₁ + μ₂) k := by
  intro m hm
  simp only [iSup_le_iff, Submodule.mem_inf, Submodule.mem_iSup_of_chain,
    mem_generalizedEigenspace] at hm ⊢
  obtain ⟨⟨k₁, hk₁⟩, ⟨k₂, hk₂⟩⟩ := hm
  use k₁ + k₂ - 1
  have : f₁ + f₂ - (μ₁ + μ₂) • 1 = (f₁ - μ₁ • 1) + (f₂ - μ₂ • 1) := 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₁ f₂ : End R M
μ₁ μ₂ : R
h : Commute f₁ f₂
m : M
k₁ : ℕ
hk₁ : ((f₁ - μ₁ • 1) ^ k₁) m = 0
k₂ : ℕ
hk₂ : ((f₂ - μ₂ • 1) ^ k₂) m = 0
⊢ f₁ + f₂ - (μ₁ + μ₂) • 1 = f₁ - μ₁ • 1 + (f₂ - μ₂ • 1)

Next tactic:
rw [add_smul]
lemma iSup_generalizedEigenspace_inf_le_add
    (f₁ f₂ : End R M) (μ₁ μ₂ : R) (h : Commute f₁ f₂) :
    (⨆ k, f₁.generalizedEigenspace μ₁ k) ⊓ (⨆ k, f₂.generalizedEigenspace μ₂ k) ≤
    ⨆ k, (f₁ + f₂).generalizedEigenspace (μ₁ + μ₂) k := by
  intro m hm
  simp only [iSup_le_iff, Submodule.mem_inf, Submodule.mem_iSup_of_chain,
    mem_generalizedEigenspace] at hm ⊢
  obtain ⟨⟨k₁, hk₁⟩, ⟨k₂, hk₂⟩⟩ := hm
  use k₁ + k₂ - 1
  have : f₁ + f₂ - (μ₁ + μ₂) • 1 = (f₁ - μ₁ • 1) + (f₂ - μ₂ • 1) := by
    rw [add_smul]; 

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₁ f₂ : End R M
μ₁ μ₂ : R
h : Commute f₁ f₂
m : M
k₁ : ℕ
hk₁ : ((f₁ - μ₁ • 1) ^ k₁) m = 0
k₂ : ℕ
hk₂ : ((f₂ - μ₂ • 1) ^ k₂) m = 0
⊢ f₁ + f₂ - (μ₁ • 1 + μ₂ • 1) = f₁ - μ₁ • 1 + (f₂ - μ₂ • 1)

Next tactic:
exact add_sub_add_comm f₁ f₂ (μ₁ • 1) (μ₂ • 1)
lemma iSup_generalizedEigenspace_inf_le_add
    (f₁ f₂ : End R M) (μ₁ μ₂ : R) (h : Commute f₁ f₂) :
    (⨆ k, f₁.generalizedEigenspace μ₁ k) ⊓ (⨆ k, f₂.generalizedEigenspace μ₂ k) ≤
    ⨆ k, (f₁ + f₂).generalizedEigenspace (μ₁ + μ₂) k := by
  intro m hm
  simp only [iSup_le_iff, Submodule.mem_inf, Submodule.mem_iSup_of_chain,
    mem_generalizedEigenspace] at hm ⊢
  obtain ⟨⟨k₁, hk₁⟩, ⟨k₂, hk₂⟩⟩ := hm
  use k₁ + k₂ - 1
  have : f₁ + f₂ - (μ₁ + μ₂) • 1 = (f₁ - μ₁ • 1) + (f₂ - μ₂ • 1) := by
    rw [add_smul]; exact add_sub_add_comm f₁ f₂ (μ₁ • 1) (μ₂ • 1)
  

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₁ f₂ : End R M
μ₁ μ₂ : R
h : Commute f₁ f₂
m : M
k₁ : ℕ
hk₁ : ((f₁ - μ₁ • 1) ^ k₁) m = 0
k₂ : ℕ
hk₂ : ((f₂ - μ₂ • 1) ^ k₂) m = 0
this : f₁ + f₂ - (μ₁ + μ₂) • 1 = f₁ - μ₁ • 1 + (f₂ - μ₂ • 1)
⊢ ((f₁ + f₂ - (μ₁ + μ₂) • 1) ^ (k₁ + k₂ - 1)) m = 0

Next tactic:
replace h : Commute (f₁ - μ₁ • 1) (f₂ - μ₂ • 1) :=
    (h.sub_right <| Algebra.commute_algebraMap_right μ₂ f₁).sub_left
      (Algebra.commute_algebraMap_left μ₁ _)
lemma iSup_generalizedEigenspace_inf_le_add
    (f₁ f₂ : End R M) (μ₁ μ₂ : R) (h : Commute f₁ f₂) :
    (⨆ k, f₁.generalizedEigenspace μ₁ k) ⊓ (⨆ k, f₂.generalizedEigenspace μ₂ k) ≤
    ⨆ k, (f₁ + f₂).generalizedEigenspace (μ₁ + μ₂) k := by
  intro m hm
  simp only [iSup_le_iff, Submodule.mem_inf, Submodule.mem_iSup_of_chain,
    mem_generalizedEigenspace] at hm ⊢
  obtain ⟨⟨k₁, hk₁⟩, ⟨k₂, hk₂⟩⟩ := hm
  use k₁ + k₂ - 1
  have : f₁ + f₂ - (μ₁ + μ₂) • 1 = (f₁ - μ₁ • 1) + (f₂ - μ₂ • 1) := by
    rw [add_smul]; exact add_sub_add_comm f₁ f₂ (μ₁ • 1) (μ₂ • 1)
  replace h : Commute (f₁ - μ₁ • 1) (f₂ - μ₂ • 1) :=
    (h.sub_right <| Algebra.commute_algebraMap_right μ₂ f₁).sub_left
      (Algebra.commute_algebraMap_left μ₁ _)
  

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₁ f₂ : End R M
μ₁ μ₂ : R
m : M
k₁ : ℕ
hk₁ : ((f₁ - μ₁ • 1) ^ k₁) m = 0
k₂ : ℕ
hk₂ : ((f₂ - μ₂ • 1) ^ k₂) m = 0
this : f₁ + f₂ - (μ₁ + μ₂) • 1 = f₁ - μ₁ • 1 + (f₂ - μ₂ • 1)
h : Commute (f₁ - μ₁ • 1) (f₂ - μ₂ • 1)
⊢ ((f₁ + f₂ - (μ₁ + μ₂) • 1) ^ (k₁ + k₂ - 1)) m = 0

Next tactic:
rw [this, h.add_pow', LinearMap.coeFn_sum, Finset.sum_apply]
lemma iSup_generalizedEigenspace_inf_le_add
    (f₁ f₂ : End R M) (μ₁ μ₂ : R) (h : Commute f₁ f₂) :
    (⨆ k, f₁.generalizedEigenspace μ₁ k) ⊓ (⨆ k, f₂.generalizedEigenspace μ₂ k) ≤
    ⨆ k, (f₁ + f₂).generalizedEigenspace (μ₁ + μ₂) k := by
  intro m hm
  simp only [iSup_le_iff, Submodule.mem_inf, Submodule.mem_iSup_of_chain,
    mem_generalizedEigenspace] at hm ⊢
  obtain ⟨⟨k₁, hk₁⟩, ⟨k₂, hk₂⟩⟩ := hm
  use k₁ + k₂ - 1
  have : f₁ + f₂ - (μ₁ + μ₂) • 1 = (f₁ - μ₁ • 1) + (f₂ - μ₂ • 1) := by
    rw [add_smul]; exact add_sub_add_comm f₁ f₂ (μ₁ • 1) (μ₂ • 1)
  replace h : Commute (f₁ - μ₁ • 1) (f₂ - μ₂ • 1) :=
    (h.sub_right <| Algebra.commute_algebraMap_right μ₂ f₁).sub_left
      (Algebra.commute_algebraMap_left μ₁ _)
  rw [this, h.add_pow', LinearMap.coeFn_sum, Finset.sum_apply]
  

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₁ f₂ : End R M
μ₁ μ₂ : R
m : M
k₁ : ℕ
hk₁ : ((f₁ - μ₁ • 1) ^ k₁) m = 0
k₂ : ℕ
hk₂ : ((f₂ - μ₂ • 1) ^ k₂) m = 0
this : f₁ + f₂ - (μ₁ + μ₂) • 1 = f₁ - μ₁ • 1 + (f₂ - μ₂ • 1)
h : Commute (f₁ - μ₁ • 1) (f₂ - μ₂ • 1)
⊢ (Finset.sum (Finset.antidiagonal (k₁ + k₂ - 1)) fun c =>
      (Nat.choose (k₁ + k₂ - 1) c.1 • ((f₁ - μ₁ • 1) ^ c.1 * (f₂ - μ₂ • 1) ^ c.2)) m) =
    0

Next tactic:
refine Finset.sum_eq_zero fun ⟨i, j⟩ hij ↦ ?_