l3lab/ntp-mathlib huggingface dataset:
@[simp] lemma ker_killingForm_eq_bot :
    LinearMap.ker (killingForm R L) = ⊥ := by
  

Proof state:
R : Type u_1
K : Type u_2
L : Type u_3
M : Type u_4
inst✝¹⁶ : CommRing R
inst✝¹⁵ : LieRing L
inst✝¹⁴ : LieAlgebra R L
inst✝¹³ : AddCommGroup M
inst✝¹² : Module R M
inst✝¹¹ : LieRingModule L M
inst✝¹⁰ : LieModule R L M
inst✝⁹ : Module.Free R M
inst✝⁸ : Module.Finite R M
inst✝⁷ : Field K
inst✝⁶ : LieAlgebra K L
inst✝⁵ : Module K M
inst✝⁴ : LieModule K L M
inst✝³ : FiniteDimensional K M
inst✝² : Module.Free R L
inst✝¹ : Module.Finite R L
inst✝ : IsKilling R L
⊢ LinearMap.ker (killingForm R L) = ⊥

Next tactic:
simp [← LieIdeal.coe_killingCompl_top, killingCompl_top_eq_bot]
/-- If the Killing form of a Lie algebra is non-singular, it remains non-singular when restricted
to a Cartan subalgebra. -/
lemma ker_restrictBilinear_eq_bot_of_isCartanSubalgebra
    [IsNoetherian R L] [IsArtinian R L] (H : LieSubalgebra R L) [H.IsCartanSubalgebra] :
    LinearMap.ker (H.restrictBilinear (killingForm R L)) = ⊥ := by
  

Proof state:
R : Type u_1
K : Type u_2
L : Type u_3
M : Type u_4
inst✝¹⁹ : CommRing R
inst✝¹⁸ : LieRing L
inst✝¹⁷ : LieAlgebra R L
inst✝¹⁶ : AddCommGroup M
inst✝¹⁵ : Module R M
inst✝¹⁴ : LieRingModule L M
inst✝¹³ : LieModule R L M
inst✝¹² : Module.Free R M
inst✝¹¹ : Module.Finite R M
inst✝¹⁰ : Field K
inst✝⁹ : LieAlgebra K L
inst✝⁸ : Module K M
inst✝⁷ : LieModule K L M
inst✝⁶ : FiniteDimensional K M
inst✝⁵ : Module.Free R L
inst✝⁴ : Module.Finite R L
inst✝³ : IsKilling R L
inst✝² : IsNoetherian R L
inst✝¹ : IsArtinian R L
H : LieSubalgebra R L
inst✝ : LieSubalgebra.IsCartanSubalgebra H
⊢ LinearMap.ker (Submodule.restrictBilinear H.toSubmodule (killingForm R L)) = ⊥

Next tactic:
have h : Codisjoint (rootSpace H 0) (LieModule.posFittingComp R H L) :=
    (LieModule.isCompl_weightSpace_zero_posFittingComp R H L).codisjoint
/-- If the Killing form of a Lie algebra is non-singular, it remains non-singular when restricted
to a Cartan subalgebra. -/
lemma ker_restrictBilinear_eq_bot_of_isCartanSubalgebra
    [IsNoetherian R L] [IsArtinian R L] (H : LieSubalgebra R L) [H.IsCartanSubalgebra] :
    LinearMap.ker (H.restrictBilinear (killingForm R L)) = ⊥ := by
  have h : Codisjoint (rootSpace H 0) (LieModule.posFittingComp R H L) :=
    (LieModule.isCompl_weightSpace_zero_posFittingComp R H L).codisjoint
  

Proof state:
R : Type u_1
K : Type u_2
L : Type u_3
M : Type u_4
inst✝¹⁹ : CommRing R
inst✝¹⁸ : LieRing L
inst✝¹⁷ : LieAlgebra R L
inst✝¹⁶ : AddCommGroup M
inst✝¹⁵ : Module R M
inst✝¹⁴ : LieRingModule L M
inst✝¹³ : LieModule R L M
inst✝¹² : Module.Free R M
inst✝¹¹ : Module.Finite R M
inst✝¹⁰ : Field K
inst✝⁹ : LieAlgebra K L
inst✝⁸ : Module K M
inst✝⁷ : LieModule K L M
inst✝⁶ : FiniteDimensional K M
inst✝⁵ : Module.Free R L
inst✝⁴ : Module.Finite R L
inst✝³ : IsKilling R L
inst✝² : IsNoetherian R L
inst✝¹ : IsArtinian R L
H : LieSubalgebra R L
inst✝ : LieSubalgebra.IsCartanSubalgebra H
h : Codisjoint (rootSpace H 0) (LieModule.posFittingComp R (↥H) L)
⊢ LinearMap.ker (Submodule.restrictBilinear H.toSubmodule (killingForm R L)) = ⊥

Next tactic:
replace h : Codisjoint (H : Submodule R L) (LieModule.posFittingComp R H L : Submodule R L) := by
    rwa [codisjoint_iff, ← LieSubmodule.coe_toSubmodule_eq_iff, LieSubmodule.sup_coe_toSubmodule,
      LieSubmodule.top_coeSubmodule, rootSpace_zero_eq R L H, LieSubalgebra.coe_toLieSubmodule,
      ← codisjoint_iff] at h
/-- If the Killing form of a Lie algebra is non-singular, it remains non-singular when restricted
to a Cartan subalgebra. -/
lemma ker_restrictBilinear_eq_bot_of_isCartanSubalgebra
    [IsNoetherian R L] [IsArtinian R L] (H : LieSubalgebra R L) [H.IsCartanSubalgebra] :
    LinearMap.ker (H.restrictBilinear (killingForm R L)) = ⊥ := by
  have h : Codisjoint (rootSpace H 0) (LieModule.posFittingComp R H L) :=
    (LieModule.isCompl_weightSpace_zero_posFittingComp R H L).codisjoint
  replace h : Codisjoint (H : Submodule R L) (LieModule.posFittingComp R H L : Submodule R L) := by
    

Proof state:
R : Type u_1
K : Type u_2
L : Type u_3
M : Type u_4
inst✝¹⁹ : CommRing R
inst✝¹⁸ : LieRing L
inst✝¹⁷ : LieAlgebra R L
inst✝¹⁶ : AddCommGroup M
inst✝¹⁵ : Module R M
inst✝¹⁴ : LieRingModule L M
inst✝¹³ : LieModule R L M
inst✝¹² : Module.Free R M
inst✝¹¹ : Module.Finite R M
inst✝¹⁰ : Field K
inst✝⁹ : LieAlgebra K L
inst✝⁸ : Module K M
inst✝⁷ : LieModule K L M
inst✝⁶ : FiniteDimensional K M
inst✝⁵ : Module.Free R L
inst✝⁴ : Module.Finite R L
inst✝³ : IsKilling R L
inst✝² : IsNoetherian R L
inst✝¹ : IsArtinian R L
H : LieSubalgebra R L
inst✝ : LieSubalgebra.IsCartanSubalgebra H
h : Codisjoint (rootSpace H 0) (LieModule.posFittingComp R (↥H) L)
⊢ Codisjoint H.toSubmodule ↑(LieModule.posFittingComp R (↥H) L)

Next tactic:
rwa [codisjoint_iff, ← LieSubmodule.coe_toSubmodule_eq_iff, LieSubmodule.sup_coe_toSubmodule,
      LieSubmodule.top_coeSubmodule, rootSpace_zero_eq R L H, LieSubalgebra.coe_toLieSubmodule,
      ← codisjoint_iff] at h
/-- If the Killing form of a Lie algebra is non-singular, it remains non-singular when restricted
to a Cartan subalgebra. -/
lemma ker_restrictBilinear_eq_bot_of_isCartanSubalgebra
    [IsNoetherian R L] [IsArtinian R L] (H : LieSubalgebra R L) [H.IsCartanSubalgebra] :
    LinearMap.ker (H.restrictBilinear (killingForm R L)) = ⊥ := by
  have h : Codisjoint (rootSpace H 0) (LieModule.posFittingComp R H L) :=
    (LieModule.isCompl_weightSpace_zero_posFittingComp R H L).codisjoint
  replace h : Codisjoint (H : Submodule R L) (LieModule.posFittingComp R H L : Submodule R L) := by
    rwa [codisjoint_iff, ← LieSubmodule.coe_toSubmodule_eq_iff, LieSubmodule.sup_coe_toSubmodule,
      LieSubmodule.top_coeSubmodule, rootSpace_zero_eq R L H, LieSubalgebra.coe_toLieSubmodule,
      ← codisjoint_iff] at h
  

Proof state:
R : Type u_1
K : Type u_2
L : Type u_3
M : Type u_4
inst✝¹⁹ : CommRing R
inst✝¹⁸ : LieRing L
inst✝¹⁷ : LieAlgebra R L
inst✝¹⁶ : AddCommGroup M
inst✝¹⁵ : Module R M
inst✝¹⁴ : LieRingModule L M
inst✝¹³ : LieModule R L M
inst✝¹² : Module.Free R M
inst✝¹¹ : Module.Finite R M
inst✝¹⁰ : Field K
inst✝⁹ : LieAlgebra K L
inst✝⁸ : Module K M
inst✝⁷ : LieModule K L M
inst✝⁶ : FiniteDimensional K M
inst✝⁵ : Module.Free R L
inst✝⁴ : Module.Finite R L
inst✝³ : IsKilling R L
inst✝² : IsNoetherian R L
inst✝¹ : IsArtinian R L
H : LieSubalgebra R L
inst✝ : LieSubalgebra.IsCartanSubalgebra H
h : Codisjoint H.toSubmodule ↑(LieModule.posFittingComp R (↥H) L)
⊢ LinearMap.ker (Submodule.restrictBilinear H.toSubmodule (killingForm R L)) = ⊥

Next tactic:
suffices this : ∀ m₀ ∈ H, ∀ m₁ ∈ LieModule.posFittingComp R H L, killingForm R L m₀ m₁ = 0 by
    simp [LinearMap.ker_restrictBilinear_eq_of_codisjoint h this]
/-- If the Killing form of a Lie algebra is non-singular, it remains non-singular when restricted
to a Cartan subalgebra. -/
lemma ker_restrictBilinear_eq_bot_of_isCartanSubalgebra
    [IsNoetherian R L] [IsArtinian R L] (H : LieSubalgebra R L) [H.IsCartanSubalgebra] :
    LinearMap.ker (H.restrictBilinear (killingForm R L)) = ⊥ := by
  have h : Codisjoint (rootSpace H 0) (LieModule.posFittingComp R H L) :=
    (LieModule.isCompl_weightSpace_zero_posFittingComp R H L).codisjoint
  replace h : Codisjoint (H : Submodule R L) (LieModule.posFittingComp R H L : Submodule R L) := by
    rwa [codisjoint_iff, ← LieSubmodule.coe_toSubmodule_eq_iff, LieSubmodule.sup_coe_toSubmodule,
      LieSubmodule.top_coeSubmodule, rootSpace_zero_eq R L H, LieSubalgebra.coe_toLieSubmodule,
      ← codisjoint_iff] at h
  suffices this : ∀ m₀ ∈ H, ∀ m₁ ∈ LieModule.posFittingComp R H L, killingForm R L m₀ m₁ = 0 by
    

Proof state:
R : Type u_1
K : Type u_2
L : Type u_3
M : Type u_4
inst✝¹⁹ : CommRing R
inst✝¹⁸ : LieRing L
inst✝¹⁷ : LieAlgebra R L
inst✝¹⁶ : AddCommGroup M
inst✝¹⁵ : Module R M
inst✝¹⁴ : LieRingModule L M
inst✝¹³ : LieModule R L M
inst✝¹² : Module.Free R M
inst✝¹¹ : Module.Finite R M
inst✝¹⁰ : Field K
inst✝⁹ : LieAlgebra K L
inst✝⁸ : Module K M
inst✝⁷ : LieModule K L M
inst✝⁶ : FiniteDimensional K M
inst✝⁵ : Module.Free R L
inst✝⁴ : Module.Finite R L
inst✝³ : IsKilling R L
inst✝² : IsNoetherian R L
inst✝¹ : IsArtinian R L
H : LieSubalgebra R L
inst✝ : LieSubalgebra.IsCartanSubalgebra H
h : Codisjoint H.toSubmodule ↑(LieModule.posFittingComp R (↥H) L)
this : ∀ m₀ ∈ H, ∀ m₁ ∈ LieModule.posFittingComp R (↥H) L, ((killingForm R L) m₀) m₁ = 0
⊢ LinearMap.ker (Submodule.restrictBilinear H.toSubmodule (killingForm R L)) = ⊥

Next tactic:
simp [LinearMap.ker_restrictBilinear_eq_of_codisjoint h this]
/-- If the Killing form of a Lie algebra is non-singular, it remains non-singular when restricted
to a Cartan subalgebra. -/
lemma ker_restrictBilinear_eq_bot_of_isCartanSubalgebra
    [IsNoetherian R L] [IsArtinian R L] (H : LieSubalgebra R L) [H.IsCartanSubalgebra] :
    LinearMap.ker (H.restrictBilinear (killingForm R L)) = ⊥ := by
  have h : Codisjoint (rootSpace H 0) (LieModule.posFittingComp R H L) :=
    (LieModule.isCompl_weightSpace_zero_posFittingComp R H L).codisjoint
  replace h : Codisjoint (H : Submodule R L) (LieModule.posFittingComp R H L : Submodule R L) := by
    rwa [codisjoint_iff, ← LieSubmodule.coe_toSubmodule_eq_iff, LieSubmodule.sup_coe_toSubmodule,
      LieSubmodule.top_coeSubmodule, rootSpace_zero_eq R L H, LieSubalgebra.coe_toLieSubmodule,
      ← codisjoint_iff] at h
  suffices this : ∀ m₀ ∈ H, ∀ m₁ ∈ LieModule.posFittingComp R H L, killingForm R L m₀ m₁ = 0 by
    simp [LinearMap.ker_restrictBilinear_eq_of_codisjoint h this]
  

Proof state:
R : Type u_1
K : Type u_2
L : Type u_3
M : Type u_4
inst✝¹⁹ : CommRing R
inst✝¹⁸ : LieRing L
inst✝¹⁷ : LieAlgebra R L
inst✝¹⁶ : AddCommGroup M
inst✝¹⁵ : Module R M
inst✝¹⁴ : LieRingModule L M
inst✝¹³ : LieModule R L M
inst✝¹² : Module.Free R M
inst✝¹¹ : Module.Finite R M
inst✝¹⁰ : Field K
inst✝⁹ : LieAlgebra K L
inst✝⁸ : Module K M
inst✝⁷ : LieModule K L M
inst✝⁶ : FiniteDimensional K M
inst✝⁵ : Module.Free R L
inst✝⁴ : Module.Finite R L
inst✝³ : IsKilling R L
inst✝² : IsNoetherian R L
inst✝¹ : IsArtinian R L
H : LieSubalgebra R L
inst✝ : LieSubalgebra.IsCartanSubalgebra H
h : Codisjoint H.toSubmodule ↑(LieModule.posFittingComp R (↥H) L)
⊢ ∀ m₀ ∈ H, ∀ m₁ ∈ LieModule.posFittingComp R (↥H) L, ((killingForm R L) m₀) m₁ = 0

Next tactic:
intro m₀ h₀ m₁ h₁
/-- If the Killing form of a Lie algebra is non-singular, it remains non-singular when restricted
to a Cartan subalgebra. -/
lemma ker_restrictBilinear_eq_bot_of_isCartanSubalgebra
    [IsNoetherian R L] [IsArtinian R L] (H : LieSubalgebra R L) [H.IsCartanSubalgebra] :
    LinearMap.ker (H.restrictBilinear (killingForm R L)) = ⊥ := by
  have h : Codisjoint (rootSpace H 0) (LieModule.posFittingComp R H L) :=
    (LieModule.isCompl_weightSpace_zero_posFittingComp R H L).codisjoint
  replace h : Codisjoint (H : Submodule R L) (LieModule.posFittingComp R H L : Submodule R L) := by
    rwa [codisjoint_iff, ← LieSubmodule.coe_toSubmodule_eq_iff, LieSubmodule.sup_coe_toSubmodule,
      LieSubmodule.top_coeSubmodule, rootSpace_zero_eq R L H, LieSubalgebra.coe_toLieSubmodule,
      ← codisjoint_iff] at h
  suffices this : ∀ m₀ ∈ H, ∀ m₁ ∈ LieModule.posFittingComp R H L, killingForm R L m₀ m₁ = 0 by
    simp [LinearMap.ker_restrictBilinear_eq_of_codisjoint h this]
  intro m₀ h₀ m₁ h₁
  

Proof state:
R : Type u_1
K : Type u_2
L : Type u_3
M : Type u_4
inst✝¹⁹ : CommRing R
inst✝¹⁸ : LieRing L
inst✝¹⁷ : LieAlgebra R L
inst✝¹⁶ : AddCommGroup M
inst✝¹⁵ : Module R M
inst✝¹⁴ : LieRingModule L M
inst✝¹³ : LieModule R L M
inst✝¹² : Module.Free R M
inst✝¹¹ : Module.Finite R M
inst✝¹⁰ : Field K
inst✝⁹ : LieAlgebra K L
inst✝⁸ : Module K M
inst✝⁷ : LieModule K L M
inst✝⁶ : FiniteDimensional K M
inst✝⁵ : Module.Free R L
inst✝⁴ : Module.Finite R L
inst✝³ : IsKilling R L
inst✝² : IsNoetherian R L
inst✝¹ : IsArtinian R L
H : LieSubalgebra R L
inst✝ : LieSubalgebra.IsCartanSubalgebra H
h : Codisjoint H.toSubmodule ↑(LieModule.posFittingComp R (↥H) L)
m₀ : L
h₀ : m₀ ∈ H
m₁ : L
h₁ : m₁ ∈ LieModule.posFittingComp R (↥H) L
⊢ ((killingForm R L) m₀) m₁ = 0

Next tactic:
exact killingForm_eq_zero_of_mem_zeroRoot_mem_posFitting R L H (le_zeroRootSubalgebra R L H h₀) h₁
/-- The converse of this is true over a field of characteristic zero. There are counterexamples
over fields with positive characteristic. -/
instance isSemisimple [IsDomain R] [IsPrincipalIdealRing R] : IsSemisimple R L := by
  

Proof state:
R : Type u_1
K : Type u_2
L : Type u_3
M : Type u_4
inst✝¹⁸ : CommRing R
inst✝¹⁷ : LieRing L
inst✝¹⁶ : LieAlgebra R L
inst✝¹⁵ : AddCommGroup M
inst✝¹⁴ : Module R M
inst✝¹³ : LieRingModule L M
inst✝¹² : LieModule R L M
inst✝¹¹ : Module.Free R M
inst✝¹⁰ : Module.Finite R M
inst✝⁹ : Field K
inst✝⁸ : LieAlgebra K L
inst✝⁷ : Module K M
inst✝⁶ : LieModule K L M
inst✝⁵ : FiniteDimensional K M
inst✝⁴ : Module.Free R L
inst✝³ : Module.Finite R L
inst✝² : IsKilling R L
inst✝¹ : IsDomain R
inst✝ : IsPrincipalIdealRing R
⊢ IsSemisimple R L

Next tactic:
refine' (isSemisimple_iff_no_abelian_ideals R L).mpr fun I hI ↦ _
/-- The converse of this is true over a field of characteristic zero. There are counterexamples
over fields with positive characteristic. -/
instance isSemisimple [IsDomain R] [IsPrincipalIdealRing R] : IsSemisimple R L := by
  refine' (isSemisimple_iff_no_abelian_ideals R L).mpr fun I hI ↦ _
  

Proof state:
R : Type u_1
K : Type u_2
L : Type u_3
M : Type u_4
inst✝¹⁸ : CommRing R
inst✝¹⁷ : LieRing L
inst✝¹⁶ : LieAlgebra R L
inst✝¹⁵ : AddCommGroup M
inst✝¹⁴ : Module R M
inst✝¹³ : LieRingModule L M
inst✝¹² : LieModule R L M
inst✝¹¹ : Module.Free R M
inst✝¹⁰ : Module.Finite R M
inst✝⁹ : Field K
inst✝⁸ : LieAlgebra K L
inst✝⁷ : Module K M
inst✝⁶ : LieModule K L M
inst✝⁵ : FiniteDimensional K M
inst✝⁴ : Module.Free R L
inst✝³ : Module.Finite R L
inst✝² : IsKilling R L
inst✝¹ : IsDomain R
inst✝ : IsPrincipalIdealRing R
I : LieIdeal R L
hI : IsLieAbelian ↥↑I
⊢ I = ⊥

Next tactic:
rw [eq_bot_iff, ← killingCompl_top_eq_bot]
/-- The converse of this is true over a field of characteristic zero. There are counterexamples
over fields with positive characteristic. -/
instance isSemisimple [IsDomain R] [IsPrincipalIdealRing R] : IsSemisimple R L := by
  refine' (isSemisimple_iff_no_abelian_ideals R L).mpr fun I hI ↦ _
  rw [eq_bot_iff, ← killingCompl_top_eq_bot]
  

Proof state:
R : Type u_1
K : Type u_2
L : Type u_3
M : Type u_4
inst✝¹⁸ : CommRing R
inst✝¹⁷ : LieRing L
inst✝¹⁶ : LieAlgebra R L
inst✝¹⁵ : AddCommGroup M
inst✝¹⁴ : Module R M
inst✝¹³ : LieRingModule L M
inst✝¹² : LieModule R L M
inst✝¹¹ : Module.Free R M
inst✝¹⁰ : Module.Finite R M
inst✝⁹ : Field K
inst✝⁸ : LieAlgebra K L
inst✝⁷ : Module K M
inst✝⁶ : LieModule K L M
inst✝⁵ : FiniteDimensional K M
inst✝⁴ : Module.Free R L
inst✝³ : Module.Finite R L
inst✝² : IsKilling R L
inst✝¹ : IsDomain R
inst✝ : IsPrincipalIdealRing R
I : LieIdeal R L
hI : IsLieAbelian ↥↑I
⊢ I ≤ LieIdeal.killingCompl R L ⊤

Next tactic:
exact I.le_killingCompl_top_of_isLieAbelian
lemma LieModule.traceForm_eq_sum_finrank_nsmul_mul [LieAlgebra.IsNilpotent K L]
    [LinearWeights K L M] [IsTriangularizable K L M] (x y : L) :
    traceForm K L M x y = ∑ χ in weight K L M, finrank K (weightSpace M χ) • (χ x * χ y) := by
  

Proof state:
R : Type u_1
K : Type u_2
L : Type u_3
M : Type u_4
inst✝¹⁶ : CommRing R
inst✝¹⁵ : LieRing L
inst✝¹⁴ : LieAlgebra R L
inst✝¹³ : AddCommGroup M
inst✝¹² : Module R M
inst✝¹¹ : LieRingModule L M
inst✝¹⁰ : LieModule R L M
inst✝⁹ : Module.Free R M
inst✝⁸ : Module.Finite R M
inst✝⁷ : Field K
inst✝⁶ : LieAlgebra K L
inst✝⁵ : Module K M
inst✝⁴ : LieModule K L M
inst✝³ : FiniteDimensional K M
inst✝² : LieAlgebra.IsNilpotent K L
inst✝¹ : LinearWeights K L M
inst✝ : IsTriangularizable K L M
x y : L
⊢ ((traceForm K L M) x) y = ∑ χ in weight K L M, finrank K ↥↑(weightSpace M χ) • (χ x * χ y)

Next tactic:
have hxy : ∀ χ : L → K, MapsTo (toEndomorphism K L M x ∘ₗ toEndomorphism K L M y)
      (weightSpace M χ) (weightSpace M χ) :=
    fun χ m hm ↦ LieSubmodule.lie_mem _ <| LieSubmodule.lie_mem _ hm
lemma LieModule.traceForm_eq_sum_finrank_nsmul_mul [LieAlgebra.IsNilpotent K L]
    [LinearWeights K L M] [IsTriangularizable K L M] (x y : L) :
    traceForm K L M x y = ∑ χ in weight K L M, finrank K (weightSpace M χ) • (χ x * χ y) := by
  have hxy : ∀ χ : L → K, MapsTo (toEndomorphism K L M x ∘ₗ toEndomorphism K L M y)
      (weightSpace M χ) (weightSpace M χ) :=
    fun χ m hm ↦ LieSubmodule.lie_mem _ <| LieSubmodule.lie_mem _ hm
  

Proof state:
R : Type u_1
K : Type u_2
L : Type u_3
M : Type u_4
inst✝¹⁶ : CommRing R
inst✝¹⁵ : LieRing L
inst✝¹⁴ : LieAlgebra R L
inst✝¹³ : AddCommGroup M
inst✝¹² : Module R M
inst✝¹¹ : LieRingModule L M
inst✝¹⁰ : LieModule R L M
inst✝⁹ : Module.Free R M
inst✝⁸ : Module.Finite R M
inst✝⁷ : Field K
inst✝⁶ : LieAlgebra K L
inst✝⁵ : Module K M
inst✝⁴ : LieModule K L M
inst✝³ : FiniteDimensional K M
inst✝² : LieAlgebra.IsNilpotent K L
inst✝¹ : LinearWeights K L M
inst✝ : IsTriangularizable K L M
x y : L
hxy :
  ∀ (χ : L → K), MapsTo ⇑((toEndomorphism K L M) x ∘ₗ (toEndomorphism K L M) y) ↑(weightSpace M χ) ↑(weightSpace M χ)
⊢ ((traceForm K L M) x) y = ∑ χ in weight K L M, finrank K ↥↑(weightSpace M χ) • (χ x * χ y)

Next tactic:
have hfin : {χ : L → K | (weightSpace M χ : Submodule K M) ≠ ⊥}.Finite := by
    convert finite_weightSpace_ne_bot K L M
    exact LieSubmodule.coeSubmodule_eq_bot_iff (weightSpace M _)
lemma LieModule.traceForm_eq_sum_finrank_nsmul_mul [LieAlgebra.IsNilpotent K L]
    [LinearWeights K L M] [IsTriangularizable K L M] (x y : L) :
    traceForm K L M x y = ∑ χ in weight K L M, finrank K (weightSpace M χ) • (χ x * χ y) := by
  have hxy : ∀ χ : L → K, MapsTo (toEndomorphism K L M x ∘ₗ toEndomorphism K L M y)
      (weightSpace M χ) (weightSpace M χ) :=
    fun χ m hm ↦ LieSubmodule.lie_mem _ <| LieSubmodule.lie_mem _ hm
  have hfin : {χ : L → K | (weightSpace M χ : Submodule K M) ≠ ⊥}.Finite := by
    

Proof state:
R : Type u_1
K : Type u_2
L : Type u_3
M : Type u_4
inst✝¹⁶ : CommRing R
inst✝¹⁵ : LieRing L
inst✝¹⁴ : LieAlgebra R L
inst✝¹³ : AddCommGroup M
inst✝¹² : Module R M
inst✝¹¹ : LieRingModule L M
inst✝¹⁰ : LieModule R L M
inst✝⁹ : Module.Free R M
inst✝⁸ : Module.Finite R M
inst✝⁷ : Field K
inst✝⁶ : LieAlgebra K L
inst✝⁵ : Module K M
inst✝⁴ : LieModule K L M
inst✝³ : FiniteDimensional K M
inst✝² : LieAlgebra.IsNilpotent K L
inst✝¹ : LinearWeights K L M
inst✝ : IsTriangularizable K L M
x y : L
hxy :
  ∀ (χ : L → K), MapsTo ⇑((toEndomorphism K L M) x ∘ₗ (toEndomorphism K L M) y) ↑(weightSpace M χ) ↑(weightSpace M χ)
⊢ Set.Finite {χ | ↑(weightSpace M χ) ≠ ⊥}

Next tactic:
convert finite_weightSpace_ne_bot K L M
lemma LieModule.traceForm_eq_sum_finrank_nsmul_mul [LieAlgebra.IsNilpotent K L]
    [LinearWeights K L M] [IsTriangularizable K L M] (x y : L) :
    traceForm K L M x y = ∑ χ in weight K L M, finrank K (weightSpace M χ) • (χ x * χ y) := by
  have hxy : ∀ χ : L → K, MapsTo (toEndomorphism K L M x ∘ₗ toEndomorphism K L M y)
      (weightSpace M χ) (weightSpace M χ) :=
    fun χ m hm ↦ LieSubmodule.lie_mem _ <| LieSubmodule.lie_mem _ hm
  have hfin : {χ : L → K | (weightSpace M χ : Submodule K M) ≠ ⊥}.Finite := by
    convert finite_weightSpace_ne_bot K L M
    

Proof state:
case h.e'_2.h.e'_2.h.h.a
R : Type u_1
K : Type u_2
L : Type u_3
M : Type u_4
inst✝¹⁶ : CommRing R
inst✝¹⁵ : LieRing L
inst✝¹⁴ : LieAlgebra R L
inst✝¹³ : AddCommGroup M
inst✝¹² : Module R M
inst✝¹¹ : LieRingModule L M
inst✝¹⁰ : LieModule R L M
inst✝⁹ : Module.Free R M
inst✝⁸ : Module.Finite R M
inst✝⁷ : Field K
inst✝⁶ : LieAlgebra K L
inst✝⁵ : Module K M
inst✝⁴ : LieModule K L M
inst✝³ : FiniteDimensional K M
inst✝² : LieAlgebra.IsNilpotent K L
inst✝¹ : LinearWeights K L M
inst✝ : IsTriangularizable K L M
x y : L
hxy :
  ∀ (χ : L → K), MapsTo ⇑((toEndomorphism K L M) x ∘ₗ (toEndomorphism K L M) y) ↑(weightSpace M χ) ↑(weightSpace M χ)
x✝ : L → K
⊢ ↑(weightSpace M x✝) = ⊥ ↔ weightSpace M x✝ = ⊥

Next tactic:
exact LieSubmodule.coeSubmodule_eq_bot_iff (weightSpace M _)
lemma LieModule.traceForm_eq_sum_finrank_nsmul_mul [LieAlgebra.IsNilpotent K L]
    [LinearWeights K L M] [IsTriangularizable K L M] (x y : L) :
    traceForm K L M x y = ∑ χ in weight K L M, finrank K (weightSpace M χ) • (χ x * χ y) := by
  have hxy : ∀ χ : L → K, MapsTo (toEndomorphism K L M x ∘ₗ toEndomorphism K L M y)
      (weightSpace M χ) (weightSpace M χ) :=
    fun χ m hm ↦ LieSubmodule.lie_mem _ <| LieSubmodule.lie_mem _ hm
  have hfin : {χ : L → K | (weightSpace M χ : Submodule K M) ≠ ⊥}.Finite := by
    convert finite_weightSpace_ne_bot K L M
    exact LieSubmodule.coeSubmodule_eq_bot_iff (weightSpace M _)
  

Proof state:
R : Type u_1
K : Type u_2
L : Type u_3
M : Type u_4
inst✝¹⁶ : CommRing R
inst✝¹⁵ : LieRing L
inst✝¹⁴ : LieAlgebra R L
inst✝¹³ : AddCommGroup M
inst✝¹² : Module R M
inst✝¹¹ : LieRingModule L M
inst✝¹⁰ : LieModule R L M
inst✝⁹ : Module.Free R M
inst✝⁸ : Module.Finite R M
inst✝⁷ : Field K
inst✝⁶ : LieAlgebra K L
inst✝⁵ : Module K M
inst✝⁴ : LieModule K L M
inst✝³ : FiniteDimensional K M
inst✝² : LieAlgebra.IsNilpotent K L
inst✝¹ : LinearWeights K L M
inst✝ : IsTriangularizable K L M
x y : L
hxy :
  ∀ (χ : L → K), MapsTo ⇑((toEndomorphism K L M) x ∘ₗ (toEndomorphism K L M) y) ↑(weightSpace M χ) ↑(weightSpace M χ)
hfin : Set.Finite {χ | ↑(weightSpace M χ) ≠ ⊥}
⊢ ((traceForm K L M) x) y = ∑ χ in weight K L M, finrank K ↥↑(weightSpace M χ) • (χ x * χ y)

Next tactic:
classical
  have hds := DirectSum.isInternal_submodule_of_independent_of_iSup_eq_top
    (LieSubmodule.independent_iff_coe_toSubmodule.mp <| independent_weightSpace K L M)
    (LieSubmodule.iSup_eq_top_iff_coe_toSubmodule.mp <| iSup_weightSpace_eq_top K L M)
  simp only [LinearMap.coeFn_sum, Finset.sum_apply, traceForm_apply_apply,
    LinearMap.trace_eq_sum_trace_restrict' hds hfin hxy]
  exact Finset.sum_congr (by simp) (fun χ _ ↦ traceForm_weightSpace_eq K L M χ x y)
lemma LieModule.traceForm_eq_sum_finrank_nsmul_mul [LieAlgebra.IsNilpotent K L]
    [LinearWeights K L M] [IsTriangularizable K L M] (x y : L) :
    traceForm K L M x y = ∑ χ in weight K L M, finrank K (weightSpace M χ) • (χ x * χ y) := by
  have hxy : ∀ χ : L → K, MapsTo (toEndomorphism K L M x ∘ₗ toEndomorphism K L M y)
      (weightSpace M χ) (weightSpace M χ) :=
    fun χ m hm ↦ LieSubmodule.lie_mem _ <| LieSubmodule.lie_mem _ hm
  have hfin : {χ : L → K | (weightSpace M χ : Submodule K M) ≠ ⊥}.Finite := by
    convert finite_weightSpace_ne_bot K L M
    exact LieSubmodule.coeSubmodule_eq_bot_iff (weightSpace M _)
  classical
  

Proof state:
R : Type u_1
K : Type u_2
L : Type u_3
M : Type u_4
inst✝¹⁶ : CommRing R
inst✝¹⁵ : LieRing L
inst✝¹⁴ : LieAlgebra R L
inst✝¹³ : AddCommGroup M
inst✝¹² : Module R M
inst✝¹¹ : LieRingModule L M
inst✝¹⁰ : LieModule R L M
inst✝⁹ : Module.Free R M
inst✝⁸ : Module.Finite R M
inst✝⁷ : Field K
inst✝⁶ : LieAlgebra K L
inst✝⁵ : Module K M
inst✝⁴ : LieModule K L M
inst✝³ : FiniteDimensional K M
inst✝² : LieAlgebra.IsNilpotent K L
inst✝¹ : LinearWeights K L M
inst✝ : IsTriangularizable K L M
x y : L
hxy :
  ∀ (χ : L → K), MapsTo ⇑((toEndomorphism K L M) x ∘ₗ (toEndomorphism K L M) y) ↑(weightSpace M χ) ↑(weightSpace M χ)
hfin : Set.Finite {χ | ↑(weightSpace M χ) ≠ ⊥}
⊢ ((traceForm K L M) x) y = ∑ χ in weight K L M, finrank K ↥↑(weightSpace M χ) • (χ x * χ y)

Next tactic:
have hds := DirectSum.isInternal_submodule_of_independent_of_iSup_eq_top
    (LieSubmodule.independent_iff_coe_toSubmodule.mp <| independent_weightSpace K L M)
    (LieSubmodule.iSup_eq_top_iff_coe_toSubmodule.mp <| iSup_weightSpace_eq_top K L M)