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)
  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 ‹_›
  have hf₁₂ : f₂ - f₁ = algebraMap R (End R p) (μ₁ - μ₂) := 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)))
this : IsNilpotent (f₂ - f₁)
⊢ f₂ - f₁ = (algebraMap R (End R ↥p)) (μ₁ - μ₂)

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; simp [smul_sub, sub_sub, smul_comm μ₁, add_sub_left_comm]
    all_goals ext ⟨x, _, _⟩; simpa [LinearMap.restrict_apply, LinearMap.pow_restrict _] using ‹_›
  have hf₁₂ : f₂ - f₁ = algebraMap R (End R p) (μ₁ - μ₂) := by 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)))
this : IsNilpotent (f₂ - f₁)
x✝ : ↥p
⊢ ↑((f₂ - f₁) x✝) = ↑(((algebraMap R (End R ↥p)) (μ₁ - μ₂)) x✝)

Next tactic:
simp [sub_smul]
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 ‹_›
  have hf₁₂ : f₂ - f₁ = algebraMap R (End R p) (μ₁ - μ₂) := by ext; simp [sub_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
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₁)
hf₁₂ : f₂ - f₁ = (algebraMap R (End R ↥p)) (μ₁ - μ₂)
⊢ False

Next tactic:
rw [hf₁₂, IsNilpotent.map_iff (NoZeroSMulDivisors.algebraMap_injective _ _),
    isNilpotent_iff_eq_zero, sub_eq_zero] at this
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 ‹_›
  have hf₁₂ : f₂ - f₁ = algebraMap R (End R p) (μ₁ - μ₂) := by ext; simp [sub_smul]
  rw [hf₁₂, IsNilpotent.map_iff (NoZeroSMulDivisors.algebraMap_injective _ _),
    isNilpotent_iff_eq_zero, sub_eq_zero] at this
  

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 : μ₁ = μ₂
hf₁₂ : f₂ - f₁ = (algebraMap R (End R ↥p)) (μ₁ - μ₂)
⊢ False

Next tactic:
contradiction
lemma disjoint_iSup_generalizedEigenspace [NoZeroSMulDivisors R M]
    (f : End R M) {μ₁ μ₂ : R} (hμ : μ₁ ≠ μ₂) :
    Disjoint (⨆ 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
inst✝ : NoZeroSMulDivisors R M
f : End R M
μ₁ μ₂ : R
hμ : μ₁ ≠ μ₂
⊢ Disjoint (⨆ k, (generalizedEigenspace f μ₁) k) (⨆ k, (generalizedEigenspace f μ₂) k)

Next tactic:
simp_rw [(f.generalizedEigenspace μ₁).mono.directed_le.disjoint_iSup_left,
    (f.generalizedEigenspace μ₂).mono.directed_le.disjoint_iSup_right]
lemma disjoint_iSup_generalizedEigenspace [NoZeroSMulDivisors R M]
    (f : End R M) {μ₁ μ₂ : R} (hμ : μ₁ ≠ μ₂) :
    Disjoint (⨆ k, f.generalizedEigenspace μ₁ k) (⨆ k, f.generalizedEigenspace μ₂ k) := by
  simp_rw [(f.generalizedEigenspace μ₁).mono.directed_le.disjoint_iSup_left,
    (f.generalizedEigenspace μ₂).mono.directed_le.disjoint_iSup_right]
  

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μ : μ₁ ≠ μ₂
⊢ ∀ (i i_1 : ℕ), Disjoint ((generalizedEigenspace f μ₁) i) ((generalizedEigenspace f μ₂) i_1)

Next tactic:
exact disjoint_generalizedEigenspace f hμ
lemma injOn_generalizedEigenspace [NoZeroSMulDivisors R M] (f : End R M) :
    InjOn (⨆ 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
inst✝ : NoZeroSMulDivisors R M
f : End R M
⊢ InjOn (fun x => ⨆ k, (generalizedEigenspace f x) k) {μ | ⨆ k, (generalizedEigenspace f μ) k ≠ ⊥}

Next tactic:
rintro μ₁ _ μ₂ hμ₂ (hμ₁₂ : ⨆ k, f.generalizedEigenspace μ₁ k = ⨆ k, f.generalizedEigenspace μ₂ k)
lemma injOn_generalizedEigenspace [NoZeroSMulDivisors R M] (f : End R M) :
    InjOn (⨆ k, f.generalizedEigenspace · k) {μ | ⨆ k, f.generalizedEigenspace μ k ≠ ⊥} := by
  rintro μ₁ _ μ₂ hμ₂ (hμ₁₂ : ⨆ k, f.generalizedEigenspace μ₁ k = ⨆ k, f.generalizedEigenspace μ₂ 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
a✝ : μ₁ ∈ {μ | ⨆ k, (generalizedEigenspace f μ) k ≠ ⊥}
μ₂ : R
hμ₂ : μ₂ ∈ {μ | ⨆ k, (generalizedEigenspace f μ) k ≠ ⊥}
hμ₁₂ : ⨆ k, (generalizedEigenspace f μ₁) k = ⨆ k, (generalizedEigenspace f μ₂) k
⊢ μ₁ = μ₂

Next tactic:
by_contra contra
lemma injOn_generalizedEigenspace [NoZeroSMulDivisors R M] (f : End R M) :
    InjOn (⨆ k, f.generalizedEigenspace · k) {μ | ⨆ k, f.generalizedEigenspace μ k ≠ ⊥} := by
  rintro μ₁ _ μ₂ hμ₂ (hμ₁₂ : ⨆ k, f.generalizedEigenspace μ₁ k = ⨆ k, f.generalizedEigenspace μ₂ k)
  by_contra 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
inst✝ : NoZeroSMulDivisors R M
f : End R M
μ₁ : R
a✝ : μ₁ ∈ {μ | ⨆ k, (generalizedEigenspace f μ) k ≠ ⊥}
μ₂ : R
hμ₂ : μ₂ ∈ {μ | ⨆ k, (generalizedEigenspace f μ) k ≠ ⊥}
hμ₁₂ : ⨆ k, (generalizedEigenspace f μ₁) k = ⨆ k, (generalizedEigenspace f μ₂) k
contra : ¬μ₁ = μ₂
⊢ False

Next tactic:
apply hμ₂
lemma injOn_generalizedEigenspace [NoZeroSMulDivisors R M] (f : End R M) :
    InjOn (⨆ k, f.generalizedEigenspace · k) {μ | ⨆ k, f.generalizedEigenspace μ k ≠ ⊥} := by
  rintro μ₁ _ μ₂ hμ₂ (hμ₁₂ : ⨆ k, f.generalizedEigenspace μ₁ k = ⨆ k, f.generalizedEigenspace μ₂ k)
  by_contra 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
inst✝ : NoZeroSMulDivisors R M
f : End R M
μ₁ : R
a✝ : μ₁ ∈ {μ | ⨆ k, (generalizedEigenspace f μ) k ≠ ⊥}
μ₂ : R
hμ₂ : μ₂ ∈ {μ | ⨆ k, (generalizedEigenspace f μ) k ≠ ⊥}
hμ₁₂ : ⨆ k, (generalizedEigenspace f μ₁) k = ⨆ k, (generalizedEigenspace f μ₂) k
contra : ¬μ₁ = μ₂
⊢ ⨆ k, (generalizedEigenspace f μ₂) k = ⊥

Next tactic:
simpa only [hμ₁₂, disjoint_self] using f.disjoint_iSup_generalizedEigenspace contra
theorem independent_generalizedEigenspace [NoZeroSMulDivisors R M] (f : End R M) :
    CompleteLattice.Independent (fun μ ↦ ⨆ 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
inst✝ : NoZeroSMulDivisors R M
f : End R M
⊢ CompleteLattice.Independent fun μ => ⨆ k, (generalizedEigenspace f μ) k

Next tactic:
classical
  suffices ∀ μ (s : Finset R) (_ : μ ∉ s), Disjoint (⨆ k, f.generalizedEigenspace μ k)
      (s.sup fun μ ↦ ⨆ k, f.generalizedEigenspace μ k) by
    simp_rw [CompleteLattice.independent_iff_supIndep_of_injOn f.injOn_generalizedEigenspace,
      Finset.supIndep_iff_disjoint_erase]
    exact fun s μ _ ↦ this _ _ (s.not_mem_erase μ)
  intro μ₁ s
  induction' s using Finset.induction_on with μ₂ s _ ih; simp
  intro hμ₁₂
  obtain ⟨hμ₁₂ : μ₁ ≠ μ₂, hμ₁ : μ₁ ∉ s⟩ := by rwa [Finset.mem_insert, not_or] at hμ₁₂
  specialize ih hμ₁
  rw [Finset.sup_insert, disjoint_iff, Submodule.eq_bot_iff]
  rintro x ⟨hx, hx'⟩
  simp only [SetLike.mem_coe] at hx hx'
  suffices x ∈ ⨆ k, generalizedEigenspace f μ₂ k by
    rw [← Submodule.mem_bot (R := R), ← (f.disjoint_iSup_generalizedEigenspace hμ₁₂).eq_bot]
    exact ⟨hx, this⟩
  obtain ⟨y, hy, z, hz, rfl⟩ := Submodule.mem_sup.mp hx'; clear hx'
  let g := f - algebraMap R (End R M) μ₂
  obtain ⟨k : ℕ, hk : (g ^ k) y = 0⟩ := by simpa using hy
  have hyz : (g ^ k) (y + z) ∈
      (⨆ k, generalizedEigenspace f μ₁ k) ⊓ s.sup fun μ ↦ ⨆ k, f.generalizedEigenspace μ k := by
    refine ⟨f.mapsTo_iSup_generalizedEigenspace_of_comm ?_ μ₁ hx, ?_⟩
    · exact Algebra.mul_sub_algebraMap_pow_commutes f μ₂ k
    · rw [SetLike.mem_coe, map_add, hk, zero_add]
      suffices (s.sup fun μ ↦ ⨆ k, f.generalizedEigenspace μ k).map (g ^ k) ≤
          s.sup fun μ ↦ ⨆ k, f.generalizedEigenspace μ k by exact this (Submodule.mem_map_of_mem hz)
      simp_rw [Finset.sup_eq_iSup, Submodule.map_iSup (ι := R), Submodule.map_iSup (ι := _ ∈ s)]
      refine iSup₂_mono fun μ _ ↦ ?_
      rintro - ⟨u, hu, rfl⟩
      refine f.mapsTo_iSup_generalizedEigenspace_of_comm ?_ μ hu
      exact Algebra.mul_sub_algebraMap_pow_commutes f μ₂ k
  rw [ih.eq_bot, Submodule.mem_bot] at hyz
  simp_rw [Submodule.mem_iSup_of_chain, mem_generalizedEigenspace]
  exact ⟨k, hyz⟩
theorem independent_generalizedEigenspace [NoZeroSMulDivisors R M] (f : End R M) :
    CompleteLattice.Independent (fun μ ↦ ⨆ k, f.generalizedEigenspace μ k) := by
  classical
  

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
⊢ CompleteLattice.Independent fun μ => ⨆ k, (generalizedEigenspace f μ) k

Next tactic:
suffices ∀ μ (s : Finset R) (_ : μ ∉ s), Disjoint (⨆ k, f.generalizedEigenspace μ k)
      (s.sup fun μ ↦ ⨆ k, f.generalizedEigenspace μ k) by
    simp_rw [CompleteLattice.independent_iff_supIndep_of_injOn f.injOn_generalizedEigenspace,
      Finset.supIndep_iff_disjoint_erase]
    exact fun s μ _ ↦ this _ _ (s.not_mem_erase μ)
theorem independent_generalizedEigenspace [NoZeroSMulDivisors R M] (f : End R M) :
    CompleteLattice.Independent (fun μ ↦ ⨆ k, f.generalizedEigenspace μ k) := by
  classical
  suffices ∀ μ (s : Finset R) (_ : μ ∉ s), Disjoint (⨆ k, f.generalizedEigenspace μ k)
      (s.sup fun μ ↦ ⨆ 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
inst✝ : NoZeroSMulDivisors R M
f : End R M
this :
  ∀ (μ : R) (s : Finset R),
    μ ∉ s → Disjoint (⨆ k, (generalizedEigenspace f μ) k) (Finset.sup s fun μ => ⨆ k, (generalizedEigenspace f μ) k)
⊢ CompleteLattice.Independent fun μ => ⨆ k, (generalizedEigenspace f μ) k

Next tactic:
simp_rw [CompleteLattice.independent_iff_supIndep_of_injOn f.injOn_generalizedEigenspace,
      Finset.supIndep_iff_disjoint_erase]
theorem independent_generalizedEigenspace [NoZeroSMulDivisors R M] (f : End R M) :
    CompleteLattice.Independent (fun μ ↦ ⨆ k, f.generalizedEigenspace μ k) := by
  classical
  suffices ∀ μ (s : Finset R) (_ : μ ∉ s), Disjoint (⨆ k, f.generalizedEigenspace μ k)
      (s.sup fun μ ↦ ⨆ k, f.generalizedEigenspace μ k) by
    simp_rw [CompleteLattice.independent_iff_supIndep_of_injOn f.injOn_generalizedEigenspace,
      Finset.supIndep_iff_disjoint_erase]
    

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
this :
  ∀ (μ : R) (s : Finset R),
    μ ∉ s → Disjoint (⨆ k, (generalizedEigenspace f μ) k) (Finset.sup s fun μ => ⨆ k, (generalizedEigenspace f μ) k)
⊢ ∀ (s : Finset R),
    ∀ i ∈ s,
      Disjoint (⨆ k, (generalizedEigenspace f i) k)
        (Finset.sup (Finset.erase s i) fun μ => ⨆ k, (generalizedEigenspace f μ) k)

Next tactic:
exact fun s μ _ ↦ this _ _ (s.not_mem_erase μ)
theorem independent_generalizedEigenspace [NoZeroSMulDivisors R M] (f : End R M) :
    CompleteLattice.Independent (fun μ ↦ ⨆ k, f.generalizedEigenspace μ k) := by
  classical
  suffices ∀ μ (s : Finset R) (_ : μ ∉ s), Disjoint (⨆ k, f.generalizedEigenspace μ k)
      (s.sup fun μ ↦ ⨆ k, f.generalizedEigenspace μ k) by
    simp_rw [CompleteLattice.independent_iff_supIndep_of_injOn f.injOn_generalizedEigenspace,
      Finset.supIndep_iff_disjoint_erase]
    exact fun s μ _ ↦ this _ _ (s.not_mem_erase μ)
  

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) (s : Finset R),
    μ ∉ s → Disjoint (⨆ k, (generalizedEigenspace f μ) k) (Finset.sup s fun μ => ⨆ k, (generalizedEigenspace f μ) k)

Next tactic:
intro μ₁ s
theorem independent_generalizedEigenspace [NoZeroSMulDivisors R M] (f : End R M) :
    CompleteLattice.Independent (fun μ ↦ ⨆ k, f.generalizedEigenspace μ k) := by
  classical
  suffices ∀ μ (s : Finset R) (_ : μ ∉ s), Disjoint (⨆ k, f.generalizedEigenspace μ k)
      (s.sup fun μ ↦ ⨆ k, f.generalizedEigenspace μ k) by
    simp_rw [CompleteLattice.independent_iff_supIndep_of_injOn f.injOn_generalizedEigenspace,
      Finset.supIndep_iff_disjoint_erase]
    exact fun s μ _ ↦ this _ _ (s.not_mem_erase μ)
  intro μ₁ s
  

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
s : Finset R
⊢ μ₁ ∉ s → Disjoint (⨆ k, (generalizedEigenspace f μ₁) k) (Finset.sup s fun μ => ⨆ k, (generalizedEigenspace f μ) k)

Next tactic:
induction' s using Finset.induction_on with μ₂ s _ ih
theorem independent_generalizedEigenspace [NoZeroSMulDivisors R M] (f : End R M) :
    CompleteLattice.Independent (fun μ ↦ ⨆ k, f.generalizedEigenspace μ k) := by
  classical
  suffices ∀ μ (s : Finset R) (_ : μ ∉ s), Disjoint (⨆ k, f.generalizedEigenspace μ k)
      (s.sup fun μ ↦ ⨆ k, f.generalizedEigenspace μ k) by
    simp_rw [CompleteLattice.independent_iff_supIndep_of_injOn f.injOn_generalizedEigenspace,
      Finset.supIndep_iff_disjoint_erase]
    exact fun s μ _ ↦ this _ _ (s.not_mem_erase μ)
  intro μ₁ s
  induction' s using Finset.induction_on with μ₂ s _ ih; 

Proof state:
case empty
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
⊢ μ₁ ∉ ∅ → Disjoint (⨆ k, (generalizedEigenspace f μ₁) k) (Finset.sup ∅ fun μ => ⨆ k, (generalizedEigenspace f μ) k)
case insert
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
s : Finset R
a✝ : μ₂ ∉ s
ih : μ₁ ∉ s → Disjoint (⨆ k, (generalizedEigenspace f μ₁) k) (Finset.sup s fun μ => ⨆ k, (generalizedEigenspace f μ) k)
⊢ μ₁ ∉ insert μ₂ s →
    Disjoint (⨆ k, (generalizedEigenspace f μ₁) k)
      (Finset.sup (insert μ₂ s) fun μ => ⨆ k, (generalizedEigenspace f μ) k)

Next tactic:
simp
theorem independent_generalizedEigenspace [NoZeroSMulDivisors R M] (f : End R M) :
    CompleteLattice.Independent (fun μ ↦ ⨆ k, f.generalizedEigenspace μ k) := by
  classical
  suffices ∀ μ (s : Finset R) (_ : μ ∉ s), Disjoint (⨆ k, f.generalizedEigenspace μ k)
      (s.sup fun μ ↦ ⨆ k, f.generalizedEigenspace μ k) by
    simp_rw [CompleteLattice.independent_iff_supIndep_of_injOn f.injOn_generalizedEigenspace,
      Finset.supIndep_iff_disjoint_erase]
    exact fun s μ _ ↦ this _ _ (s.not_mem_erase μ)
  intro μ₁ s
  induction' s using Finset.induction_on with μ₂ s _ ih; simp
  

Proof state:
case insert
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
s : Finset R
a✝ : μ₂ ∉ s
ih : μ₁ ∉ s → Disjoint (⨆ k, (generalizedEigenspace f μ₁) k) (Finset.sup s fun μ => ⨆ k, (generalizedEigenspace f μ) k)
⊢ μ₁ ∉ insert μ₂ s →
    Disjoint (⨆ k, (generalizedEigenspace f μ₁) k)
      (Finset.sup (insert μ₂ s) fun μ => ⨆ k, (generalizedEigenspace f μ) k)

Next tactic:
intro hμ₁₂