l3lab/ntp-mathlib huggingface dataset:
theorem Algebra.trace_ne_zero [FiniteDimensional K L] [IsSeparable K L] :
    Algebra.trace K L ≠ 0 := by
  intro e
  let pb : PowerBasis K L := Field.powerBasisOfFiniteOfSeparable _ _
  apply det_traceMatrix_ne_zero' pb
  rw [show traceMatrix K pb.basis = 0 by ext; simp [e], Matrix.det_zero]
  

Proof state:
R : Type u_1
S : Type u_2
T : Type u_3
inst✝¹⁵ : CommRing R
inst✝¹⁴ : CommRing S
inst✝¹³ : CommRing T
inst✝¹² : Algebra R S
inst✝¹¹ : Algebra R T
K : Type u_4
L : Type u_5
inst✝¹⁰ : Field K
inst✝⁹ : Field L
inst✝⁸ : Algebra K L
ι κ : Type w
inst✝⁷ : Fintype ι
F : Type u_6
inst✝⁶ : Field F
inst✝⁵ : Algebra R L
inst✝⁴ : Algebra L F
inst✝³ : Algebra R F
inst✝² : IsScalarTower R L F
pb✝ : PowerBasis K L
inst✝¹ : FiniteDimensional K L
inst✝ : IsSeparable K L
e : trace K L = 0
pb : PowerBasis K L := Field.powerBasisOfFiniteOfSeparable K L
⊢ Nonempty (Fin pb.dim)

Next tactic:
rw [← pb.finrank, ← Fin.pos_iff_nonempty]
theorem Algebra.trace_ne_zero [FiniteDimensional K L] [IsSeparable K L] :
    Algebra.trace K L ≠ 0 := by
  intro e
  let pb : PowerBasis K L := Field.powerBasisOfFiniteOfSeparable _ _
  apply det_traceMatrix_ne_zero' pb
  rw [show traceMatrix K pb.basis = 0 by ext; simp [e], Matrix.det_zero]
  rw [← pb.finrank, ← Fin.pos_iff_nonempty]
  

Proof state:
R : Type u_1
S : Type u_2
T : Type u_3
inst✝¹⁵ : CommRing R
inst✝¹⁴ : CommRing S
inst✝¹³ : CommRing T
inst✝¹² : Algebra R S
inst✝¹¹ : Algebra R T
K : Type u_4
L : Type u_5
inst✝¹⁰ : Field K
inst✝⁹ : Field L
inst✝⁸ : Algebra K L
ι κ : Type w
inst✝⁷ : Fintype ι
F : Type u_6
inst✝⁶ : Field F
inst✝⁵ : Algebra R L
inst✝⁴ : Algebra L F
inst✝³ : Algebra R F
inst✝² : IsScalarTower R L F
pb✝ : PowerBasis K L
inst✝¹ : FiniteDimensional K L
inst✝ : IsSeparable K L
e : trace K L = 0
pb : PowerBasis K L := Field.powerBasisOfFiniteOfSeparable K L
⊢ 0 < finrank K L

Next tactic:
exact finrank_pos
theorem Algebra.trace_surjective [FiniteDimensional K L] [IsSeparable K L] :
    Function.Surjective (Algebra.trace K L) := by
  

Proof state:
R : Type u_1
S : Type u_2
T : Type u_3
inst✝¹⁵ : CommRing R
inst✝¹⁴ : CommRing S
inst✝¹³ : CommRing T
inst✝¹² : Algebra R S
inst✝¹¹ : Algebra R T
K : Type u_4
L : Type u_5
inst✝¹⁰ : Field K
inst✝⁹ : Field L
inst✝⁸ : Algebra K L
ι κ : Type w
inst✝⁷ : Fintype ι
F : Type u_6
inst✝⁶ : Field F
inst✝⁵ : Algebra R L
inst✝⁴ : Algebra L F
inst✝³ : Algebra R F
inst✝² : IsScalarTower R L F
pb : PowerBasis K L
inst✝¹ : FiniteDimensional K L
inst✝ : IsSeparable K L
⊢ Function.Surjective ⇑(trace K L)

Next tactic:
rw [← LinearMap.range_eq_top]
theorem Algebra.trace_surjective [FiniteDimensional K L] [IsSeparable K L] :
    Function.Surjective (Algebra.trace K L) := by
  rw [← LinearMap.range_eq_top]
  

Proof state:
R : Type u_1
S : Type u_2
T : Type u_3
inst✝¹⁵ : CommRing R
inst✝¹⁴ : CommRing S
inst✝¹³ : CommRing T
inst✝¹² : Algebra R S
inst✝¹¹ : Algebra R T
K : Type u_4
L : Type u_5
inst✝¹⁰ : Field K
inst✝⁹ : Field L
inst✝⁸ : Algebra K L
ι κ : Type w
inst✝⁷ : Fintype ι
F : Type u_6
inst✝⁶ : Field F
inst✝⁵ : Algebra R L
inst✝⁴ : Algebra L F
inst✝³ : Algebra R F
inst✝² : IsScalarTower R L F
pb : PowerBasis K L
inst✝¹ : FiniteDimensional K L
inst✝ : IsSeparable K L
⊢ range (trace K L) = ⊤

Next tactic:
apply (IsSimpleOrder.eq_bot_or_eq_top (α := Ideal K) _).resolve_left
theorem Algebra.trace_surjective [FiniteDimensional K L] [IsSeparable K L] :
    Function.Surjective (Algebra.trace K L) := by
  rw [← LinearMap.range_eq_top]
  apply (IsSimpleOrder.eq_bot_or_eq_top (α := Ideal K) _).resolve_left
  

Proof state:
R : Type u_1
S : Type u_2
T : Type u_3
inst✝¹⁵ : CommRing R
inst✝¹⁴ : CommRing S
inst✝¹³ : CommRing T
inst✝¹² : Algebra R S
inst✝¹¹ : Algebra R T
K : Type u_4
L : Type u_5
inst✝¹⁰ : Field K
inst✝⁹ : Field L
inst✝⁸ : Algebra K L
ι κ : Type w
inst✝⁷ : Fintype ι
F : Type u_6
inst✝⁶ : Field F
inst✝⁵ : Algebra R L
inst✝⁴ : Algebra L F
inst✝³ : Algebra R F
inst✝² : IsScalarTower R L F
pb : PowerBasis K L
inst✝¹ : FiniteDimensional K L
inst✝ : IsSeparable K L
⊢ ¬range (trace K L) = ⊥

Next tactic:
rw [LinearMap.range_eq_bot]
theorem Algebra.trace_surjective [FiniteDimensional K L] [IsSeparable K L] :
    Function.Surjective (Algebra.trace K L) := by
  rw [← LinearMap.range_eq_top]
  apply (IsSimpleOrder.eq_bot_or_eq_top (α := Ideal K) _).resolve_left
  rw [LinearMap.range_eq_bot]
  

Proof state:
R : Type u_1
S : Type u_2
T : Type u_3
inst✝¹⁵ : CommRing R
inst✝¹⁴ : CommRing S
inst✝¹³ : CommRing T
inst✝¹² : Algebra R S
inst✝¹¹ : Algebra R T
K : Type u_4
L : Type u_5
inst✝¹⁰ : Field K
inst✝⁹ : Field L
inst✝⁸ : Algebra K L
ι κ : Type w
inst✝⁷ : Fintype ι
F : Type u_6
inst✝⁶ : Field F
inst✝⁵ : Algebra R L
inst✝⁴ : Algebra L F
inst✝³ : Algebra R F
inst✝² : IsScalarTower R L F
pb : PowerBasis K L
inst✝¹ : FiniteDimensional K L
inst✝ : IsSeparable K L
⊢ ¬trace K L = 0

Next tactic:
exact Algebra.trace_ne_zero K L
/--
The dual basis of a powerbasis `{1, x, x²...}` under the trace form is `aᵢ / f'(x)`,
with `f` being the minimal polynomial of `x` and `f / (X - x) = ∑ aᵢxⁱ`.
-/
lemma traceForm_dualBasis_powerBasis_eq [FiniteDimensional K L] [IsSeparable K L]
    (pb : PowerBasis K L) (i) :
    (Algebra.traceForm K L).dualBasis (traceForm_nondegenerate K L) pb.basis i =
      (minpolyDiv K pb.gen).coeff i / aeval pb.gen (derivative <| minpoly K pb.gen) := by
  

Proof state:
R : Type u_1
S : Type u_2
T : Type u_3
inst✝¹⁵ : CommRing R
inst✝¹⁴ : CommRing S
inst✝¹³ : CommRing T
inst✝¹² : Algebra R S
inst✝¹¹ : Algebra R T
K : Type u_4
L : Type u_5
inst✝¹⁰ : Field K
inst✝⁹ : Field L
inst✝⁸ : Algebra K L
ι κ : Type w
inst✝⁷ : Fintype ι
F : Type u_6
inst✝⁶ : Field F
inst✝⁵ : Algebra R L
inst✝⁴ : Algebra L F
inst✝³ : Algebra R F
inst✝² : IsScalarTower R L F
pb✝ : PowerBasis K L
inst✝¹ : FiniteDimensional K L
inst✝ : IsSeparable K L
pb : PowerBasis K L
i : Fin pb.dim
⊢ (BilinForm.dualBasis (traceForm K L) (_ : BilinForm.Nondegenerate (traceForm K L)) pb.basis) i =
    coeff (minpolyDiv K pb.gen) ↑i / (aeval pb.gen) (derivative (minpoly K pb.gen))

Next tactic:
classical
  apply ((Algebra.traceForm K L).toDual (traceForm_nondegenerate K L)).injective
  apply pb.basis.ext
  intro j
  simp only [BilinForm.toDual_def, BilinForm.apply_dualBasis_left]
  apply (algebraMap K (AlgebraicClosure K)).injective
  have := congr_arg (coeff · i) (sum_smul_minpolyDiv_eq_X_pow (AlgebraicClosure K)
    pb.adjoin_gen_eq_top (r := j) (pb.finrank.symm ▸ j.prop))
  simp only [AlgEquiv.toAlgHom_eq_coe, Polynomial.map_smul, map_div₀,
    map_pow, RingHom.coe_coe, AlgHom.coe_coe, finset_sum_coeff, coeff_smul, coeff_map, smul_eq_mul,
    coeff_X_pow, ← Fin.ext_iff, @eq_comm _ i] at this
  rw [PowerBasis.coe_basis, Algebra.traceForm_apply, RingHom.map_ite_one_zero,
  ← this, trace_eq_sum_embeddings (E := AlgebraicClosure K)]
  apply Finset.sum_congr rfl
  intro σ _
  simp only [_root_.map_mul, map_div₀, map_pow]
  ring
/--
The dual basis of a powerbasis `{1, x, x²...}` under the trace form is `aᵢ / f'(x)`,
with `f` being the minimal polynomial of `x` and `f / (X - x) = ∑ aᵢxⁱ`.
-/
lemma traceForm_dualBasis_powerBasis_eq [FiniteDimensional K L] [IsSeparable K L]
    (pb : PowerBasis K L) (i) :
    (Algebra.traceForm K L).dualBasis (traceForm_nondegenerate K L) pb.basis i =
      (minpolyDiv K pb.gen).coeff i / aeval pb.gen (derivative <| minpoly K pb.gen) := by
  classical
  

Proof state:
R : Type u_1
S : Type u_2
T : Type u_3
inst✝¹⁵ : CommRing R
inst✝¹⁴ : CommRing S
inst✝¹³ : CommRing T
inst✝¹² : Algebra R S
inst✝¹¹ : Algebra R T
K : Type u_4
L : Type u_5
inst✝¹⁰ : Field K
inst✝⁹ : Field L
inst✝⁸ : Algebra K L
ι κ : Type w
inst✝⁷ : Fintype ι
F : Type u_6
inst✝⁶ : Field F
inst✝⁵ : Algebra R L
inst✝⁴ : Algebra L F
inst✝³ : Algebra R F
inst✝² : IsScalarTower R L F
pb✝ : PowerBasis K L
inst✝¹ : FiniteDimensional K L
inst✝ : IsSeparable K L
pb : PowerBasis K L
i : Fin pb.dim
⊢ (BilinForm.dualBasis (traceForm K L) (_ : BilinForm.Nondegenerate (traceForm K L)) pb.basis) i =
    coeff (minpolyDiv K pb.gen) ↑i / (aeval pb.gen) (derivative (minpoly K pb.gen))

Next tactic:
apply ((Algebra.traceForm K L).toDual (traceForm_nondegenerate K L)).injective
/--
The dual basis of a powerbasis `{1, x, x²...}` under the trace form is `aᵢ / f'(x)`,
with `f` being the minimal polynomial of `x` and `f / (X - x) = ∑ aᵢxⁱ`.
-/
lemma traceForm_dualBasis_powerBasis_eq [FiniteDimensional K L] [IsSeparable K L]
    (pb : PowerBasis K L) (i) :
    (Algebra.traceForm K L).dualBasis (traceForm_nondegenerate K L) pb.basis i =
      (minpolyDiv K pb.gen).coeff i / aeval pb.gen (derivative <| minpoly K pb.gen) := by
  classical
  apply ((Algebra.traceForm K L).toDual (traceForm_nondegenerate K L)).injective
  

Proof state:
case a
R : Type u_1
S : Type u_2
T : Type u_3
inst✝¹⁵ : CommRing R
inst✝¹⁴ : CommRing S
inst✝¹³ : CommRing T
inst✝¹² : Algebra R S
inst✝¹¹ : Algebra R T
K : Type u_4
L : Type u_5
inst✝¹⁰ : Field K
inst✝⁹ : Field L
inst✝⁸ : Algebra K L
ι κ : Type w
inst✝⁷ : Fintype ι
F : Type u_6
inst✝⁶ : Field F
inst✝⁵ : Algebra R L
inst✝⁴ : Algebra L F
inst✝³ : Algebra R F
inst✝² : IsScalarTower R L F
pb✝ : PowerBasis K L
inst✝¹ : FiniteDimensional K L
inst✝ : IsSeparable K L
pb : PowerBasis K L
i : Fin pb.dim
⊢ (BilinForm.toDual (traceForm K L) (_ : BilinForm.Nondegenerate (traceForm K L)))
      ((BilinForm.dualBasis (traceForm K L) (_ : BilinForm.Nondegenerate (traceForm K L)) pb.basis) i) =
    (BilinForm.toDual (traceForm K L) (_ : BilinForm.Nondegenerate (traceForm K L)))
      (coeff (minpolyDiv K pb.gen) ↑i / (aeval pb.gen) (derivative (minpoly K pb.gen)))

Next tactic:
apply pb.basis.ext
/--
The dual basis of a powerbasis `{1, x, x²...}` under the trace form is `aᵢ / f'(x)`,
with `f` being the minimal polynomial of `x` and `f / (X - x) = ∑ aᵢxⁱ`.
-/
lemma traceForm_dualBasis_powerBasis_eq [FiniteDimensional K L] [IsSeparable K L]
    (pb : PowerBasis K L) (i) :
    (Algebra.traceForm K L).dualBasis (traceForm_nondegenerate K L) pb.basis i =
      (minpolyDiv K pb.gen).coeff i / aeval pb.gen (derivative <| minpoly K pb.gen) := by
  classical
  apply ((Algebra.traceForm K L).toDual (traceForm_nondegenerate K L)).injective
  apply pb.basis.ext
  

Proof state:
case a
R : Type u_1
S : Type u_2
T : Type u_3
inst✝¹⁵ : CommRing R
inst✝¹⁴ : CommRing S
inst✝¹³ : CommRing T
inst✝¹² : Algebra R S
inst✝¹¹ : Algebra R T
K : Type u_4
L : Type u_5
inst✝¹⁰ : Field K
inst✝⁹ : Field L
inst✝⁸ : Algebra K L
ι κ : Type w
inst✝⁷ : Fintype ι
F : Type u_6
inst✝⁶ : Field F
inst✝⁵ : Algebra R L
inst✝⁴ : Algebra L F
inst✝³ : Algebra R F
inst✝² : IsScalarTower R L F
pb✝ : PowerBasis K L
inst✝¹ : FiniteDimensional K L
inst✝ : IsSeparable K L
pb : PowerBasis K L
i : Fin pb.dim
⊢ ∀ (i_1 : Fin pb.dim),
    ((BilinForm.toDual (traceForm K L) (_ : BilinForm.Nondegenerate (traceForm K L)))
          ((BilinForm.dualBasis (traceForm K L) (_ : BilinForm.Nondegenerate (traceForm K L)) pb.basis) i))
        (pb.basis i_1) =
      ((BilinForm.toDual (traceForm K L) (_ : BilinForm.Nondegenerate (traceForm K L)))
          (coeff (minpolyDiv K pb.gen) ↑i / (aeval pb.gen) (derivative (minpoly K pb.gen))))
        (pb.basis i_1)

Next tactic:
intro j
/--
The dual basis of a powerbasis `{1, x, x²...}` under the trace form is `aᵢ / f'(x)`,
with `f` being the minimal polynomial of `x` and `f / (X - x) = ∑ aᵢxⁱ`.
-/
lemma traceForm_dualBasis_powerBasis_eq [FiniteDimensional K L] [IsSeparable K L]
    (pb : PowerBasis K L) (i) :
    (Algebra.traceForm K L).dualBasis (traceForm_nondegenerate K L) pb.basis i =
      (minpolyDiv K pb.gen).coeff i / aeval pb.gen (derivative <| minpoly K pb.gen) := by
  classical
  apply ((Algebra.traceForm K L).toDual (traceForm_nondegenerate K L)).injective
  apply pb.basis.ext
  intro j
  

Proof state:
case a
R : Type u_1
S : Type u_2
T : Type u_3
inst✝¹⁵ : CommRing R
inst✝¹⁴ : CommRing S
inst✝¹³ : CommRing T
inst✝¹² : Algebra R S
inst✝¹¹ : Algebra R T
K : Type u_4
L : Type u_5
inst✝¹⁰ : Field K
inst✝⁹ : Field L
inst✝⁸ : Algebra K L
ι κ : Type w
inst✝⁷ : Fintype ι
F : Type u_6
inst✝⁶ : Field F
inst✝⁵ : Algebra R L
inst✝⁴ : Algebra L F
inst✝³ : Algebra R F
inst✝² : IsScalarTower R L F
pb✝ : PowerBasis K L
inst✝¹ : FiniteDimensional K L
inst✝ : IsSeparable K L
pb : PowerBasis K L
i j : Fin pb.dim
⊢ ((BilinForm.toDual (traceForm K L) (_ : BilinForm.Nondegenerate (traceForm K L)))
        ((BilinForm.dualBasis (traceForm K L) (_ : BilinForm.Nondegenerate (traceForm K L)) pb.basis) i))
      (pb.basis j) =
    ((BilinForm.toDual (traceForm K L) (_ : BilinForm.Nondegenerate (traceForm K L)))
        (coeff (minpolyDiv K pb.gen) ↑i / (aeval pb.gen) (derivative (minpoly K pb.gen))))
      (pb.basis j)

Next tactic:
simp only [BilinForm.toDual_def, BilinForm.apply_dualBasis_left]
/--
The dual basis of a powerbasis `{1, x, x²...}` under the trace form is `aᵢ / f'(x)`,
with `f` being the minimal polynomial of `x` and `f / (X - x) = ∑ aᵢxⁱ`.
-/
lemma traceForm_dualBasis_powerBasis_eq [FiniteDimensional K L] [IsSeparable K L]
    (pb : PowerBasis K L) (i) :
    (Algebra.traceForm K L).dualBasis (traceForm_nondegenerate K L) pb.basis i =
      (minpolyDiv K pb.gen).coeff i / aeval pb.gen (derivative <| minpoly K pb.gen) := by
  classical
  apply ((Algebra.traceForm K L).toDual (traceForm_nondegenerate K L)).injective
  apply pb.basis.ext
  intro j
  simp only [BilinForm.toDual_def, BilinForm.apply_dualBasis_left]
  

Proof state:
case a
R : Type u_1
S : Type u_2
T : Type u_3
inst✝¹⁵ : CommRing R
inst✝¹⁴ : CommRing S
inst✝¹³ : CommRing T
inst✝¹² : Algebra R S
inst✝¹¹ : Algebra R T
K : Type u_4
L : Type u_5
inst✝¹⁰ : Field K
inst✝⁹ : Field L
inst✝⁸ : Algebra K L
ι κ : Type w
inst✝⁷ : Fintype ι
F : Type u_6
inst✝⁶ : Field F
inst✝⁵ : Algebra R L
inst✝⁴ : Algebra L F
inst✝³ : Algebra R F
inst✝² : IsScalarTower R L F
pb✝ : PowerBasis K L
inst✝¹ : FiniteDimensional K L
inst✝ : IsSeparable K L
pb : PowerBasis K L
i j : Fin pb.dim
⊢ (if j = i then 1 else 0) =
    BilinForm.bilin (traceForm K L) (coeff (minpolyDiv K pb.gen) ↑i / (aeval pb.gen) (derivative (minpoly K pb.gen)))
      (pb.basis j)

Next tactic:
apply (algebraMap K (AlgebraicClosure K)).injective
/--
The dual basis of a powerbasis `{1, x, x²...}` under the trace form is `aᵢ / f'(x)`,
with `f` being the minimal polynomial of `x` and `f / (X - x) = ∑ aᵢxⁱ`.
-/
lemma traceForm_dualBasis_powerBasis_eq [FiniteDimensional K L] [IsSeparable K L]
    (pb : PowerBasis K L) (i) :
    (Algebra.traceForm K L).dualBasis (traceForm_nondegenerate K L) pb.basis i =
      (minpolyDiv K pb.gen).coeff i / aeval pb.gen (derivative <| minpoly K pb.gen) := by
  classical
  apply ((Algebra.traceForm K L).toDual (traceForm_nondegenerate K L)).injective
  apply pb.basis.ext
  intro j
  simp only [BilinForm.toDual_def, BilinForm.apply_dualBasis_left]
  apply (algebraMap K (AlgebraicClosure K)).injective
  

Proof state:
case a.a
R : Type u_1
S : Type u_2
T : Type u_3
inst✝¹⁵ : CommRing R
inst✝¹⁴ : CommRing S
inst✝¹³ : CommRing T
inst✝¹² : Algebra R S
inst✝¹¹ : Algebra R T
K : Type u_4
L : Type u_5
inst✝¹⁰ : Field K
inst✝⁹ : Field L
inst✝⁸ : Algebra K L
ι κ : Type w
inst✝⁷ : Fintype ι
F : Type u_6
inst✝⁶ : Field F
inst✝⁵ : Algebra R L
inst✝⁴ : Algebra L F
inst✝³ : Algebra R F
inst✝² : IsScalarTower R L F
pb✝ : PowerBasis K L
inst✝¹ : FiniteDimensional K L
inst✝ : IsSeparable K L
pb : PowerBasis K L
i j : Fin pb.dim
⊢ (algebraMap K (AlgebraicClosure K)) (if j = i then 1 else 0) =
    (algebraMap K (AlgebraicClosure K))
      (BilinForm.bilin (traceForm K L) (coeff (minpolyDiv K pb.gen) ↑i / (aeval pb.gen) (derivative (minpoly K pb.gen)))
        (pb.basis j))

Next tactic:
have := congr_arg (coeff · i) (sum_smul_minpolyDiv_eq_X_pow (AlgebraicClosure K)
    pb.adjoin_gen_eq_top (r := j) (pb.finrank.symm ▸ j.prop))
/--
The dual basis of a powerbasis `{1, x, x²...}` under the trace form is `aᵢ / f'(x)`,
with `f` being the minimal polynomial of `x` and `f / (X - x) = ∑ aᵢxⁱ`.
-/
lemma traceForm_dualBasis_powerBasis_eq [FiniteDimensional K L] [IsSeparable K L]
    (pb : PowerBasis K L) (i) :
    (Algebra.traceForm K L).dualBasis (traceForm_nondegenerate K L) pb.basis i =
      (minpolyDiv K pb.gen).coeff i / aeval pb.gen (derivative <| minpoly K pb.gen) := by
  classical
  apply ((Algebra.traceForm K L).toDual (traceForm_nondegenerate K L)).injective
  apply pb.basis.ext
  intro j
  simp only [BilinForm.toDual_def, BilinForm.apply_dualBasis_left]
  apply (algebraMap K (AlgebraicClosure K)).injective
  have := congr_arg (coeff · i) (sum_smul_minpolyDiv_eq_X_pow (AlgebraicClosure K)
    pb.adjoin_gen_eq_top (r := j) (pb.finrank.symm ▸ j.prop))
  

Proof state:
case a.a
R : Type u_1
S : Type u_2
T : Type u_3
inst✝¹⁵ : CommRing R
inst✝¹⁴ : CommRing S
inst✝¹³ : CommRing T
inst✝¹² : Algebra R S
inst✝¹¹ : Algebra R T
K : Type u_4
L : Type u_5
inst✝¹⁰ : Field K
inst✝⁹ : Field L
inst✝⁸ : Algebra K L
ι κ : Type w
inst✝⁷ : Fintype ι
F : Type u_6
inst✝⁶ : Field F
inst✝⁵ : Algebra R L
inst✝⁴ : Algebra L F
inst✝³ : Algebra R F
inst✝² : IsScalarTower R L F
pb✝ : PowerBasis K L
inst✝¹ : FiniteDimensional K L
inst✝ : IsSeparable K L
pb : PowerBasis K L
i j : Fin pb.dim
this :
  (fun x => coeff x ↑i)
      (∑ σ : L →ₐ[K] AlgebraicClosure K,
        Polynomial.map (↑σ) ((pb.gen ^ ↑j / (aeval pb.gen) (derivative (minpoly K pb.gen))) • minpolyDiv K pb.gen)) =
    (fun x => coeff x ↑i) (X ^ ↑j)
⊢ (algebraMap K (AlgebraicClosure K)) (if j = i then 1 else 0) =
    (algebraMap K (AlgebraicClosure K))
      (BilinForm.bilin (traceForm K L) (coeff (minpolyDiv K pb.gen) ↑i / (aeval pb.gen) (derivative (minpoly K pb.gen)))
        (pb.basis j))

Next tactic:
simp only [AlgEquiv.toAlgHom_eq_coe, Polynomial.map_smul, map_div₀,
    map_pow, RingHom.coe_coe, AlgHom.coe_coe, finset_sum_coeff, coeff_smul, coeff_map, smul_eq_mul,
    coeff_X_pow, ← Fin.ext_iff, @eq_comm _ i] at this
/--
The dual basis of a powerbasis `{1, x, x²...}` under the trace form is `aᵢ / f'(x)`,
with `f` being the minimal polynomial of `x` and `f / (X - x) = ∑ aᵢxⁱ`.
-/
lemma traceForm_dualBasis_powerBasis_eq [FiniteDimensional K L] [IsSeparable K L]
    (pb : PowerBasis K L) (i) :
    (Algebra.traceForm K L).dualBasis (traceForm_nondegenerate K L) pb.basis i =
      (minpolyDiv K pb.gen).coeff i / aeval pb.gen (derivative <| minpoly K pb.gen) := by
  classical
  apply ((Algebra.traceForm K L).toDual (traceForm_nondegenerate K L)).injective
  apply pb.basis.ext
  intro j
  simp only [BilinForm.toDual_def, BilinForm.apply_dualBasis_left]
  apply (algebraMap K (AlgebraicClosure K)).injective
  have := congr_arg (coeff · i) (sum_smul_minpolyDiv_eq_X_pow (AlgebraicClosure K)
    pb.adjoin_gen_eq_top (r := j) (pb.finrank.symm ▸ j.prop))
  simp only [AlgEquiv.toAlgHom_eq_coe, Polynomial.map_smul, map_div₀,
    map_pow, RingHom.coe_coe, AlgHom.coe_coe, finset_sum_coeff, coeff_smul, coeff_map, smul_eq_mul,
    coeff_X_pow, ← Fin.ext_iff, @eq_comm _ i] at this
  

Proof state:
case a.a
R : Type u_1
S : Type u_2
T : Type u_3
inst✝¹⁵ : CommRing R
inst✝¹⁴ : CommRing S
inst✝¹³ : CommRing T
inst✝¹² : Algebra R S
inst✝¹¹ : Algebra R T
K : Type u_4
L : Type u_5
inst✝¹⁰ : Field K
inst✝⁹ : Field L
inst✝⁸ : Algebra K L
ι κ : Type w
inst✝⁷ : Fintype ι
F : Type u_6
inst✝⁶ : Field F
inst✝⁵ : Algebra R L
inst✝⁴ : Algebra L F
inst✝³ : Algebra R F
inst✝² : IsScalarTower R L F
pb✝ : PowerBasis K L
inst✝¹ : FiniteDimensional K L
inst✝ : IsSeparable K L
pb : PowerBasis K L
i j : Fin pb.dim
this :
  ∑ x : L →ₐ[K] AlgebraicClosure K,
      x pb.gen ^ ↑j / x ((aeval pb.gen) (derivative (minpoly K pb.gen))) * x (coeff (minpolyDiv K pb.gen) ↑i) =
    if j = i then 1 else 0
⊢ (algebraMap K (AlgebraicClosure K)) (if j = i then 1 else 0) =
    (algebraMap K (AlgebraicClosure K))
      (BilinForm.bilin (traceForm K L) (coeff (minpolyDiv K pb.gen) ↑i / (aeval pb.gen) (derivative (minpoly K pb.gen)))
        (pb.basis j))

Next tactic:
rw [PowerBasis.coe_basis, Algebra.traceForm_apply, RingHom.map_ite_one_zero,
  ← this, trace_eq_sum_embeddings (E := AlgebraicClosure K)]
/--
The dual basis of a powerbasis `{1, x, x²...}` under the trace form is `aᵢ / f'(x)`,
with `f` being the minimal polynomial of `x` and `f / (X - x) = ∑ aᵢxⁱ`.
-/
lemma traceForm_dualBasis_powerBasis_eq [FiniteDimensional K L] [IsSeparable K L]
    (pb : PowerBasis K L) (i) :
    (Algebra.traceForm K L).dualBasis (traceForm_nondegenerate K L) pb.basis i =
      (minpolyDiv K pb.gen).coeff i / aeval pb.gen (derivative <| minpoly K pb.gen) := by
  classical
  apply ((Algebra.traceForm K L).toDual (traceForm_nondegenerate K L)).injective
  apply pb.basis.ext
  intro j
  simp only [BilinForm.toDual_def, BilinForm.apply_dualBasis_left]
  apply (algebraMap K (AlgebraicClosure K)).injective
  have := congr_arg (coeff · i) (sum_smul_minpolyDiv_eq_X_pow (AlgebraicClosure K)
    pb.adjoin_gen_eq_top (r := j) (pb.finrank.symm ▸ j.prop))
  simp only [AlgEquiv.toAlgHom_eq_coe, Polynomial.map_smul, map_div₀,
    map_pow, RingHom.coe_coe, AlgHom.coe_coe, finset_sum_coeff, coeff_smul, coeff_map, smul_eq_mul,
    coeff_X_pow, ← Fin.ext_iff, @eq_comm _ i] at this
  rw [PowerBasis.coe_basis, Algebra.traceForm_apply, RingHom.map_ite_one_zero,
  ← this, trace_eq_sum_embeddings (E := AlgebraicClosure K)]
  

Proof state:
case a.a
R : Type u_1
S : Type u_2
T : Type u_3
inst✝¹⁵ : CommRing R
inst✝¹⁴ : CommRing S
inst✝¹³ : CommRing T
inst✝¹² : Algebra R S
inst✝¹¹ : Algebra R T
K : Type u_4
L : Type u_5
inst✝¹⁰ : Field K
inst✝⁹ : Field L
inst✝⁸ : Algebra K L
ι κ : Type w
inst✝⁷ : Fintype ι
F : Type u_6
inst✝⁶ : Field F
inst✝⁵ : Algebra R L
inst✝⁴ : Algebra L F
inst✝³ : Algebra R F
inst✝² : IsScalarTower R L F
pb✝ : PowerBasis K L
inst✝¹ : FiniteDimensional K L
inst✝ : IsSeparable K L
pb : PowerBasis K L
i j : Fin pb.dim
this :
  ∑ x : L →ₐ[K] AlgebraicClosure K,
      x pb.gen ^ ↑j / x ((aeval pb.gen) (derivative (minpoly K pb.gen))) * x (coeff (minpolyDiv K pb.gen) ↑i) =
    if j = i then 1 else 0
⊢ ∑ x : L →ₐ[K] AlgebraicClosure K,
      x pb.gen ^ ↑j / x ((aeval pb.gen) (derivative (minpoly K pb.gen))) * x (coeff (minpolyDiv K pb.gen) ↑i) =
    ∑ σ : L →ₐ[K] AlgebraicClosure K,
      σ (coeff (minpolyDiv K pb.gen) ↑i / (aeval pb.gen) (derivative (minpoly K pb.gen)) * (fun i => pb.gen ^ ↑i) j)

Next tactic:
apply Finset.sum_congr rfl
/--
The dual basis of a powerbasis `{1, x, x²...}` under the trace form is `aᵢ / f'(x)`,
with `f` being the minimal polynomial of `x` and `f / (X - x) = ∑ aᵢxⁱ`.
-/
lemma traceForm_dualBasis_powerBasis_eq [FiniteDimensional K L] [IsSeparable K L]
    (pb : PowerBasis K L) (i) :
    (Algebra.traceForm K L).dualBasis (traceForm_nondegenerate K L) pb.basis i =
      (minpolyDiv K pb.gen).coeff i / aeval pb.gen (derivative <| minpoly K pb.gen) := by
  classical
  apply ((Algebra.traceForm K L).toDual (traceForm_nondegenerate K L)).injective
  apply pb.basis.ext
  intro j
  simp only [BilinForm.toDual_def, BilinForm.apply_dualBasis_left]
  apply (algebraMap K (AlgebraicClosure K)).injective
  have := congr_arg (coeff · i) (sum_smul_minpolyDiv_eq_X_pow (AlgebraicClosure K)
    pb.adjoin_gen_eq_top (r := j) (pb.finrank.symm ▸ j.prop))
  simp only [AlgEquiv.toAlgHom_eq_coe, Polynomial.map_smul, map_div₀,
    map_pow, RingHom.coe_coe, AlgHom.coe_coe, finset_sum_coeff, coeff_smul, coeff_map, smul_eq_mul,
    coeff_X_pow, ← Fin.ext_iff, @eq_comm _ i] at this
  rw [PowerBasis.coe_basis, Algebra.traceForm_apply, RingHom.map_ite_one_zero,
  ← this, trace_eq_sum_embeddings (E := AlgebraicClosure K)]
  apply Finset.sum_congr rfl
  

Proof state:
case a.a
R : Type u_1
S : Type u_2
T : Type u_3
inst✝¹⁵ : CommRing R
inst✝¹⁴ : CommRing S
inst✝¹³ : CommRing T
inst✝¹² : Algebra R S
inst✝¹¹ : Algebra R T
K : Type u_4
L : Type u_5
inst✝¹⁰ : Field K
inst✝⁹ : Field L
inst✝⁸ : Algebra K L
ι κ : Type w
inst✝⁷ : Fintype ι
F : Type u_6
inst✝⁶ : Field F
inst✝⁵ : Algebra R L
inst✝⁴ : Algebra L F
inst✝³ : Algebra R F
inst✝² : IsScalarTower R L F
pb✝ : PowerBasis K L
inst✝¹ : FiniteDimensional K L
inst✝ : IsSeparable K L
pb : PowerBasis K L
i j : Fin pb.dim
this :
  ∑ x : L →ₐ[K] AlgebraicClosure K,
      x pb.gen ^ ↑j / x ((aeval pb.gen) (derivative (minpoly K pb.gen))) * x (coeff (minpolyDiv K pb.gen) ↑i) =
    if j = i then 1 else 0
⊢ ∀ x ∈ Finset.univ,
    x pb.gen ^ ↑j / x ((aeval pb.gen) (derivative (minpoly K pb.gen))) * x (coeff (minpolyDiv K pb.gen) ↑i) =
      x (coeff (minpolyDiv K pb.gen) ↑i / (aeval pb.gen) (derivative (minpoly K pb.gen)) * (fun i => pb.gen ^ ↑i) j)

Next tactic:
intro σ _