l3lab/ntp-mathlib huggingface dataset:
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
  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)
  

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 χ) ≠ ⊥}
hds : DirectSum.IsInternal fun i => ↑(weightSpace M i)
⊢ ((traceForm K L M) x) y = ∑ χ in weight K L M, finrank K ↥↑(weightSpace M χ) • (χ x * χ y)

Next tactic:
simp only [LinearMap.coeFn_sum, Finset.sum_apply, traceForm_apply_apply,
    LinearMap.trace_eq_sum_trace_restrict' hds hfin hxy]
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
  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]
  

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 χ) ≠ ⊥}
hds : DirectSum.IsInternal fun i => ↑(weightSpace M i)
⊢ ∑ i in Finite.toFinset hfin,
      (trace K ↥↑(weightSpace M i))
        (LinearMap.restrict ((toEndomorphism K L M) x ∘ₗ (toEndomorphism K L M) y)
          (_ : MapsTo ⇑((toEndomorphism K L M) x ∘ₗ (toEndomorphism K L M) y) ↑(weightSpace M i) ↑(weightSpace M i))) =
    ∑ χ in weight K L M, finrank K ↥↑(weightSpace M χ) • (χ x * χ y)

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

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 χ) ≠ ⊥}
hds : DirectSum.IsInternal fun i => ↑(weightSpace M i)
⊢ Finite.toFinset hfin = weight K L M

Next tactic:
simp
lemma LieModule.dualAnnihilator_ker_traceForm_le_span_weight [LieAlgebra.IsNilpotent K L]
    [LinearWeights K L M] [IsTriangularizable K L M] [FiniteDimensional K L] :
    (LinearMap.ker (traceForm K L M)).dualAnnihilator ≤ span K (range (weight.toLinear K L M)) := 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
inst✝ : FiniteDimensional K L
⊢ Submodule.dualAnnihilator (LinearMap.ker (traceForm K L M)) ≤ span K (range (weight.toLinear K L M))

Next tactic:
intro g hg
lemma LieModule.dualAnnihilator_ker_traceForm_le_span_weight [LieAlgebra.IsNilpotent K L]
    [LinearWeights K L M] [IsTriangularizable K L M] [FiniteDimensional K L] :
    (LinearMap.ker (traceForm K L M)).dualAnnihilator ≤ span K (range (weight.toLinear K L M)) := by
  intro g hg
  

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
inst✝ : FiniteDimensional K L
g : Module.Dual K L
hg : g ∈ Submodule.dualAnnihilator (LinearMap.ker (traceForm K L M))
⊢ g ∈ span K (range (weight.toLinear K L M))

Next tactic:
simp only [Submodule.mem_dualAnnihilator, LinearMap.mem_ker] at hg
lemma LieModule.dualAnnihilator_ker_traceForm_le_span_weight [LieAlgebra.IsNilpotent K L]
    [LinearWeights K L M] [IsTriangularizable K L M] [FiniteDimensional K L] :
    (LinearMap.ker (traceForm K L M)).dualAnnihilator ≤ span K (range (weight.toLinear K L M)) := by
  intro g hg
  simp only [Submodule.mem_dualAnnihilator, LinearMap.mem_ker] at hg
  

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
inst✝ : FiniteDimensional K L
g : Module.Dual K L
hg : ∀ (w : L), (traceForm K L M) w = 0 → g w = 0
⊢ g ∈ span K (range (weight.toLinear K L M))

Next tactic:
by_contra contra
lemma LieModule.dualAnnihilator_ker_traceForm_le_span_weight [LieAlgebra.IsNilpotent K L]
    [LinearWeights K L M] [IsTriangularizable K L M] [FiniteDimensional K L] :
    (LinearMap.ker (traceForm K L M)).dualAnnihilator ≤ span K (range (weight.toLinear K L M)) := by
  intro g hg
  simp only [Submodule.mem_dualAnnihilator, LinearMap.mem_ker] at hg
  by_contra contra
  

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
inst✝ : FiniteDimensional K L
g : Module.Dual K L
hg : ∀ (w : L), (traceForm K L M) w = 0 → g w = 0
contra : g ∉ span K (range (weight.toLinear K L M))
⊢ False

Next tactic:
obtain ⟨f : Module.Dual K (Module.Dual K L), hf, hf'⟩ :=
    Submodule.exists_dual_map_eq_bot_of_nmem contra inferInstance
lemma LieModule.dualAnnihilator_ker_traceForm_le_span_weight [LieAlgebra.IsNilpotent K L]
    [LinearWeights K L M] [IsTriangularizable K L M] [FiniteDimensional K L] :
    (LinearMap.ker (traceForm K L M)).dualAnnihilator ≤ span K (range (weight.toLinear K L M)) := by
  intro g hg
  simp only [Submodule.mem_dualAnnihilator, LinearMap.mem_ker] at hg
  by_contra contra
  obtain ⟨f : Module.Dual K (Module.Dual K L), hf, hf'⟩ :=
    Submodule.exists_dual_map_eq_bot_of_nmem contra inferInstance
  

Proof state:
case intro.intro
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
inst✝ : FiniteDimensional K L
g : Module.Dual K L
hg : ∀ (w : L), (traceForm K L M) w = 0 → g w = 0
contra : g ∉ span K (range (weight.toLinear K L M))
f : Module.Dual K (Module.Dual K L)
hf : f g ≠ 0
hf' : Submodule.map f (span K (range (weight.toLinear K L M))) = ⊥
⊢ False

Next tactic:
let x : L := (Module.evalEquiv K L).symm f
lemma LieModule.dualAnnihilator_ker_traceForm_le_span_weight [LieAlgebra.IsNilpotent K L]
    [LinearWeights K L M] [IsTriangularizable K L M] [FiniteDimensional K L] :
    (LinearMap.ker (traceForm K L M)).dualAnnihilator ≤ span K (range (weight.toLinear K L M)) := by
  intro g hg
  simp only [Submodule.mem_dualAnnihilator, LinearMap.mem_ker] at hg
  by_contra contra
  obtain ⟨f : Module.Dual K (Module.Dual K L), hf, hf'⟩ :=
    Submodule.exists_dual_map_eq_bot_of_nmem contra inferInstance
  let x : L := (Module.evalEquiv K L).symm f
  

Proof state:
case intro.intro
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
inst✝ : FiniteDimensional K L
g : Module.Dual K L
hg : ∀ (w : L), (traceForm K L M) w = 0 → g w = 0
contra : g ∉ span K (range (weight.toLinear K L M))
f : Module.Dual K (Module.Dual K L)
hf : f g ≠ 0
hf' : Submodule.map f (span K (range (weight.toLinear K L M))) = ⊥
x : L := (LinearEquiv.symm (Module.evalEquiv K L)) f
⊢ False

Next tactic:
replace hf' : ∀ χ ∈ weight K L M, χ x = 0 := by
    intro χ hχ
    change weight.toLinear K L M ⟨χ, hχ⟩ x = 0
    rw [Module.apply_evalEquiv_symm_apply, ← Submodule.mem_bot (R := K), ← hf', Submodule.mem_map]
    exact ⟨weight.toLinear K L M ⟨χ, hχ⟩, Submodule.subset_span (mem_range_self _), rfl⟩
lemma LieModule.dualAnnihilator_ker_traceForm_le_span_weight [LieAlgebra.IsNilpotent K L]
    [LinearWeights K L M] [IsTriangularizable K L M] [FiniteDimensional K L] :
    (LinearMap.ker (traceForm K L M)).dualAnnihilator ≤ span K (range (weight.toLinear K L M)) := by
  intro g hg
  simp only [Submodule.mem_dualAnnihilator, LinearMap.mem_ker] at hg
  by_contra contra
  obtain ⟨f : Module.Dual K (Module.Dual K L), hf, hf'⟩ :=
    Submodule.exists_dual_map_eq_bot_of_nmem contra inferInstance
  let x : L := (Module.evalEquiv K L).symm f
  replace hf' : ∀ χ ∈ weight K L M, χ x = 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✝³ : LieAlgebra.IsNilpotent K L
inst✝² : LinearWeights K L M
inst✝¹ : IsTriangularizable K L M
inst✝ : FiniteDimensional K L
g : Module.Dual K L
hg : ∀ (w : L), (traceForm K L M) w = 0 → g w = 0
contra : g ∉ span K (range (weight.toLinear K L M))
f : Module.Dual K (Module.Dual K L)
hf : f g ≠ 0
hf' : Submodule.map f (span K (range (weight.toLinear K L M))) = ⊥
x : L := (LinearEquiv.symm (Module.evalEquiv K L)) f
⊢ ∀ χ ∈ weight K L M, χ x = 0

Next tactic:
intro χ hχ
lemma LieModule.dualAnnihilator_ker_traceForm_le_span_weight [LieAlgebra.IsNilpotent K L]
    [LinearWeights K L M] [IsTriangularizable K L M] [FiniteDimensional K L] :
    (LinearMap.ker (traceForm K L M)).dualAnnihilator ≤ span K (range (weight.toLinear K L M)) := by
  intro g hg
  simp only [Submodule.mem_dualAnnihilator, LinearMap.mem_ker] at hg
  by_contra contra
  obtain ⟨f : Module.Dual K (Module.Dual K L), hf, hf'⟩ :=
    Submodule.exists_dual_map_eq_bot_of_nmem contra inferInstance
  let x : L := (Module.evalEquiv K L).symm f
  replace hf' : ∀ χ ∈ weight K L M, χ x = 0 := by
    intro χ 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✝³ : LieAlgebra.IsNilpotent K L
inst✝² : LinearWeights K L M
inst✝¹ : IsTriangularizable K L M
inst✝ : FiniteDimensional K L
g : Module.Dual K L
hg : ∀ (w : L), (traceForm K L M) w = 0 → g w = 0
contra : g ∉ span K (range (weight.toLinear K L M))
f : Module.Dual K (Module.Dual K L)
hf : f g ≠ 0
hf' : Submodule.map f (span K (range (weight.toLinear K L M))) = ⊥
x : L := (LinearEquiv.symm (Module.evalEquiv K L)) f
χ : L → K
hχ : χ ∈ weight K L M
⊢ χ x = 0

Next tactic:
change weight.toLinear K L M ⟨χ, hχ⟩ x = 0
lemma LieModule.dualAnnihilator_ker_traceForm_le_span_weight [LieAlgebra.IsNilpotent K L]
    [LinearWeights K L M] [IsTriangularizable K L M] [FiniteDimensional K L] :
    (LinearMap.ker (traceForm K L M)).dualAnnihilator ≤ span K (range (weight.toLinear K L M)) := by
  intro g hg
  simp only [Submodule.mem_dualAnnihilator, LinearMap.mem_ker] at hg
  by_contra contra
  obtain ⟨f : Module.Dual K (Module.Dual K L), hf, hf'⟩ :=
    Submodule.exists_dual_map_eq_bot_of_nmem contra inferInstance
  let x : L := (Module.evalEquiv K L).symm f
  replace hf' : ∀ χ ∈ weight K L M, χ x = 0 := by
    intro χ hχ
    change weight.toLinear K L M ⟨χ, hχ⟩ x = 0
    

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
inst✝ : FiniteDimensional K L
g : Module.Dual K L
hg : ∀ (w : L), (traceForm K L M) w = 0 → g w = 0
contra : g ∉ span K (range (weight.toLinear K L M))
f : Module.Dual K (Module.Dual K L)
hf : f g ≠ 0
hf' : Submodule.map f (span K (range (weight.toLinear K L M))) = ⊥
x : L := (LinearEquiv.symm (Module.evalEquiv K L)) f
χ : L → K
hχ : χ ∈ weight K L M
⊢ (weight.toLinear K L M { val := χ, property := hχ }) x = 0

Next tactic:
rw [Module.apply_evalEquiv_symm_apply, ← Submodule.mem_bot (R := K), ← hf', Submodule.mem_map]
lemma LieModule.dualAnnihilator_ker_traceForm_le_span_weight [LieAlgebra.IsNilpotent K L]
    [LinearWeights K L M] [IsTriangularizable K L M] [FiniteDimensional K L] :
    (LinearMap.ker (traceForm K L M)).dualAnnihilator ≤ span K (range (weight.toLinear K L M)) := by
  intro g hg
  simp only [Submodule.mem_dualAnnihilator, LinearMap.mem_ker] at hg
  by_contra contra
  obtain ⟨f : Module.Dual K (Module.Dual K L), hf, hf'⟩ :=
    Submodule.exists_dual_map_eq_bot_of_nmem contra inferInstance
  let x : L := (Module.evalEquiv K L).symm f
  replace hf' : ∀ χ ∈ weight K L M, χ x = 0 := by
    intro χ hχ
    change weight.toLinear K L M ⟨χ, hχ⟩ x = 0
    rw [Module.apply_evalEquiv_symm_apply, ← Submodule.mem_bot (R := K), ← hf', Submodule.mem_map]
    

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
inst✝ : FiniteDimensional K L
g : Module.Dual K L
hg : ∀ (w : L), (traceForm K L M) w = 0 → g w = 0
contra : g ∉ span K (range (weight.toLinear K L M))
f : Module.Dual K (Module.Dual K L)
hf : f g ≠ 0
hf' : Submodule.map f (span K (range (weight.toLinear K L M))) = ⊥
x : L := (LinearEquiv.symm (Module.evalEquiv K L)) f
χ : L → K
hχ : χ ∈ weight K L M
⊢ ∃ y ∈ span K (range (weight.toLinear K L M)), f y = f (weight.toLinear K L M { val := χ, property := hχ })

Next tactic:
exact ⟨weight.toLinear K L M ⟨χ, hχ⟩, Submodule.subset_span (mem_range_self _), rfl⟩
lemma LieModule.dualAnnihilator_ker_traceForm_le_span_weight [LieAlgebra.IsNilpotent K L]
    [LinearWeights K L M] [IsTriangularizable K L M] [FiniteDimensional K L] :
    (LinearMap.ker (traceForm K L M)).dualAnnihilator ≤ span K (range (weight.toLinear K L M)) := by
  intro g hg
  simp only [Submodule.mem_dualAnnihilator, LinearMap.mem_ker] at hg
  by_contra contra
  obtain ⟨f : Module.Dual K (Module.Dual K L), hf, hf'⟩ :=
    Submodule.exists_dual_map_eq_bot_of_nmem contra inferInstance
  let x : L := (Module.evalEquiv K L).symm f
  replace hf' : ∀ χ ∈ weight K L M, χ x = 0 := by
    intro χ hχ
    change weight.toLinear K L M ⟨χ, hχ⟩ x = 0
    rw [Module.apply_evalEquiv_symm_apply, ← Submodule.mem_bot (R := K), ← hf', Submodule.mem_map]
    exact ⟨weight.toLinear K L M ⟨χ, hχ⟩, Submodule.subset_span (mem_range_self _), rfl⟩
  

Proof state:
case intro.intro
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
inst✝ : FiniteDimensional K L
g : Module.Dual K L
hg : ∀ (w : L), (traceForm K L M) w = 0 → g w = 0
contra : g ∉ span K (range (weight.toLinear K L M))
f : Module.Dual K (Module.Dual K L)
hf : f g ≠ 0
x : L := (LinearEquiv.symm (Module.evalEquiv K L)) f
hf' : ∀ χ ∈ weight K L M, χ x = 0
⊢ False

Next tactic:
have hx : g x ≠ 0 := by simpa
lemma LieModule.dualAnnihilator_ker_traceForm_le_span_weight [LieAlgebra.IsNilpotent K L]
    [LinearWeights K L M] [IsTriangularizable K L M] [FiniteDimensional K L] :
    (LinearMap.ker (traceForm K L M)).dualAnnihilator ≤ span K (range (weight.toLinear K L M)) := by
  intro g hg
  simp only [Submodule.mem_dualAnnihilator, LinearMap.mem_ker] at hg
  by_contra contra
  obtain ⟨f : Module.Dual K (Module.Dual K L), hf, hf'⟩ :=
    Submodule.exists_dual_map_eq_bot_of_nmem contra inferInstance
  let x : L := (Module.evalEquiv K L).symm f
  replace hf' : ∀ χ ∈ weight K L M, χ x = 0 := by
    intro χ hχ
    change weight.toLinear K L M ⟨χ, hχ⟩ x = 0
    rw [Module.apply_evalEquiv_symm_apply, ← Submodule.mem_bot (R := K), ← hf', Submodule.mem_map]
    exact ⟨weight.toLinear K L M ⟨χ, hχ⟩, Submodule.subset_span (mem_range_self _), rfl⟩
  have hx : g x ≠ 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✝³ : LieAlgebra.IsNilpotent K L
inst✝² : LinearWeights K L M
inst✝¹ : IsTriangularizable K L M
inst✝ : FiniteDimensional K L
g : Module.Dual K L
hg : ∀ (w : L), (traceForm K L M) w = 0 → g w = 0
contra : g ∉ span K (range (weight.toLinear K L M))
f : Module.Dual K (Module.Dual K L)
hf : f g ≠ 0
x : L := (LinearEquiv.symm (Module.evalEquiv K L)) f
hf' : ∀ χ ∈ weight K L M, χ x = 0
⊢ g x ≠ 0

Next tactic:
simpa