l3lab/ntp-mathlib huggingface dataset:
/-- If `E / F` is a finite extension such that `E = F(α)`, then for any intermediate field `K`, the
`F` adjoin the coefficients of `minpoly K α` is equal to `K` itself. -/
theorem adjoin_minpoly_coeff_of_exists_primitive_element
    [FiniteDimensional F E] (hprim : adjoin F {α} = ⊤) (K : IntermediateField F E) :
    adjoin F ((minpoly K α).map (algebraMap K E)).frange = K := by
  set g := (minpoly K α).map (algebraMap K E)
  set K' : IntermediateField F E := adjoin F g.frange
  have hsub : K' ≤ K := by
    refine adjoin_le_iff.mpr fun x ↦ ?_
    rw [Finset.mem_coe, mem_frange_iff]
    rintro ⟨n, -, rfl⟩
    rw [coeff_map]
    apply Subtype.mem
  have dvd_g : minpoly K' α ∣ g.toSubring K'.toSubring (subset_adjoin F _)
  · apply minpoly.dvd
    erw [aeval_def, eval₂_eq_eval_map, g.map_toSubring K'.toSubring, eval_map, ← aeval_def]
    exact minpoly.aeval K α
  have finrank_eq : ∀ K : IntermediateField F E, finrank K E = natDegree (minpoly K α)
  · intro K
    have := adjoin.finrank (.of_finite K α)
    erw [adjoin_eq_top_of_adjoin_eq_top F hprim, finrank_top K E] at this
    exact this
  refine eq_of_le_of_finrank_le' hsub ?_
  simp_rw [finrank_eq]
  convert natDegree_le_of_dvd dvd_g
    ((g.monic_toSubring _ _).mpr <| (minpoly.monic <| .of_finite K α).map _).ne_zero using 1
  

Proof state:
case h.e'_4
F : Type u_1
inst✝⁷ : Field F
E : Type u_2
inst✝⁶ : Field E
inst✝⁵ : Algebra F E
α : E
K✝ : Type u_3
inst✝⁴ : Field K✝
inst✝³ : Algebra F K✝
L : Type u_4
inst✝² : Field L
inst✝¹ : Algebra K✝ L
inst✝ : FiniteDimensional F E
hprim : F⟮α⟯ = ⊤
K : IntermediateField F E
g : E[X] := Polynomial.map (algebraMap (↥K) E) (minpoly (↥K) α)
K' : IntermediateField F E := adjoin F ↑(frange g)
hsub : K' ≤ K
dvd_g : minpoly (↥K') α ∣ toSubring g (Subalgebra.toSubring K'.toSubalgebra) (_ : ↑(frange g) ⊆ ↑(adjoin F ↑(frange g)))
finrank_eq : ∀ (K : IntermediateField F E), finrank (↥K) E = natDegree (minpoly (↥K) α)
⊢ natDegree (minpoly (↥K) α) =
    natDegree (toSubring g (Subalgebra.toSubring K'.toSubalgebra) (_ : ↑(frange g) ⊆ ↑(adjoin F ↑(frange g))))

Next tactic:
rw [natDegree_toSubring, natDegree_map]
/-- A compositum of algebraic extensions is algebraic -/
theorem isAlgebraic_iSup {ι : Type*} {t : ι → IntermediateField K L}
    (h : ∀ i, Algebra.IsAlgebraic K (t i)) :
    Algebra.IsAlgebraic K (⨆ i, t i : IntermediateField K L) := by
  

Proof state:
F : Type u_1
inst✝⁶ : Field F
E : Type u_2
inst✝⁵ : Field E
inst✝⁴ : Algebra F E
α : E
K : Type u_3
inst✝³ : Field K
inst✝² : Algebra F K
L : Type u_4
inst✝¹ : Field L
inst✝ : Algebra K L
ι : Type u_5
t : ι → IntermediateField K L
h : ∀ (i : ι), Algebra.IsAlgebraic K ↥(t i)
⊢ Algebra.IsAlgebraic K ↥(⨆ i, t i)

Next tactic:
rintro ⟨x, hx⟩
/-- A compositum of algebraic extensions is algebraic -/
theorem isAlgebraic_iSup {ι : Type*} {t : ι → IntermediateField K L}
    (h : ∀ i, Algebra.IsAlgebraic K (t i)) :
    Algebra.IsAlgebraic K (⨆ i, t i : IntermediateField K L) := by
  rintro ⟨x, hx⟩
  

Proof state:
case mk
F : Type u_1
inst✝⁶ : Field F
E : Type u_2
inst✝⁵ : Field E
inst✝⁴ : Algebra F E
α : E
K : Type u_3
inst✝³ : Field K
inst✝² : Algebra F K
L : Type u_4
inst✝¹ : Field L
inst✝ : Algebra K L
ι : Type u_5
t : ι → IntermediateField K L
h : ∀ (i : ι), Algebra.IsAlgebraic K ↥(t i)
x : L
hx : x ∈ ⨆ i, t i
⊢ IsAlgebraic K { val := x, property := hx }

Next tactic:
obtain ⟨s, hx⟩ := exists_finset_of_mem_supr' hx
/-- A compositum of algebraic extensions is algebraic -/
theorem isAlgebraic_iSup {ι : Type*} {t : ι → IntermediateField K L}
    (h : ∀ i, Algebra.IsAlgebraic K (t i)) :
    Algebra.IsAlgebraic K (⨆ i, t i : IntermediateField K L) := by
  rintro ⟨x, hx⟩
  obtain ⟨s, hx⟩ := exists_finset_of_mem_supr' hx
  

Proof state:
case mk.intro
F : Type u_1
inst✝⁶ : Field F
E : Type u_2
inst✝⁵ : Field E
inst✝⁴ : Algebra F E
α : E
K : Type u_3
inst✝³ : Field K
inst✝² : Algebra F K
L : Type u_4
inst✝¹ : Field L
inst✝ : Algebra K L
ι : Type u_5
t : ι → IntermediateField K L
h : ∀ (i : ι), Algebra.IsAlgebraic K ↥(t i)
x : L
hx✝ : x ∈ ⨆ i, t i
s : Finset ((i : ι) × ↥(t i))
hx : x ∈ ⨆ i ∈ s, K⟮↑i.snd⟯
⊢ IsAlgebraic K { val := x, property := hx✝ }

Next tactic:
rw [isAlgebraic_iff, Subtype.coe_mk, ← Subtype.coe_mk (p := (· ∈ _)) x hx, ← isAlgebraic_iff]
/-- A compositum of algebraic extensions is algebraic -/
theorem isAlgebraic_iSup {ι : Type*} {t : ι → IntermediateField K L}
    (h : ∀ i, Algebra.IsAlgebraic K (t i)) :
    Algebra.IsAlgebraic K (⨆ i, t i : IntermediateField K L) := by
  rintro ⟨x, hx⟩
  obtain ⟨s, hx⟩ := exists_finset_of_mem_supr' hx
  rw [isAlgebraic_iff, Subtype.coe_mk, ← Subtype.coe_mk (p := (· ∈ _)) x hx, ← isAlgebraic_iff]
  

Proof state:
case mk.intro
F : Type u_1
inst✝⁶ : Field F
E : Type u_2
inst✝⁵ : Field E
inst✝⁴ : Algebra F E
α : E
K : Type u_3
inst✝³ : Field K
inst✝² : Algebra F K
L : Type u_4
inst✝¹ : Field L
inst✝ : Algebra K L
ι : Type u_5
t : ι → IntermediateField K L
h : ∀ (i : ι), Algebra.IsAlgebraic K ↥(t i)
x : L
hx✝ : x ∈ ⨆ i, t i
s : Finset ((i : ι) × ↥(t i))
hx : x ∈ ⨆ i ∈ s, K⟮↑i.snd⟯
⊢ IsAlgebraic K { val := x, property := hx }

Next tactic:
haveI : ∀ i : Σ i, t i, FiniteDimensional K K⟮(i.2 : L)⟯ := fun ⟨i, x⟩ ↦
    adjoin.finiteDimensional (isIntegral_iff.1 (h i x).isIntegral)
/-- A compositum of algebraic extensions is algebraic -/
theorem isAlgebraic_iSup {ι : Type*} {t : ι → IntermediateField K L}
    (h : ∀ i, Algebra.IsAlgebraic K (t i)) :
    Algebra.IsAlgebraic K (⨆ i, t i : IntermediateField K L) := by
  rintro ⟨x, hx⟩
  obtain ⟨s, hx⟩ := exists_finset_of_mem_supr' hx
  rw [isAlgebraic_iff, Subtype.coe_mk, ← Subtype.coe_mk (p := (· ∈ _)) x hx, ← isAlgebraic_iff]
  haveI : ∀ i : Σ i, t i, FiniteDimensional K K⟮(i.2 : L)⟯ := fun ⟨i, x⟩ ↦
    adjoin.finiteDimensional (isIntegral_iff.1 (h i x).isIntegral)
  

Proof state:
case mk.intro
F : Type u_1
inst✝⁶ : Field F
E : Type u_2
inst✝⁵ : Field E
inst✝⁴ : Algebra F E
α : E
K : Type u_3
inst✝³ : Field K
inst✝² : Algebra F K
L : Type u_4
inst✝¹ : Field L
inst✝ : Algebra K L
ι : Type u_5
t : ι → IntermediateField K L
h : ∀ (i : ι), Algebra.IsAlgebraic K ↥(t i)
x : L
hx✝ : x ∈ ⨆ i, t i
s : Finset ((i : ι) × ↥(t i))
hx : x ∈ ⨆ i ∈ s, K⟮↑i.snd⟯
this : ∀ (i : (i : ι) × ↥(t i)), FiniteDimensional K ↥K⟮↑i.snd⟯
⊢ IsAlgebraic K { val := x, property := hx }

Next tactic:
apply Algebra.IsAlgebraic.of_finite
theorem isAlgebraic_adjoin {S : Set L} (hS : ∀ x ∈ S, IsIntegral K x) :
    Algebra.IsAlgebraic K (adjoin K S) := by
  

Proof state:
F : Type u_1
inst✝⁶ : Field F
E : Type u_2
inst✝⁵ : Field E
inst✝⁴ : Algebra F E
α : E
K : Type u_3
inst✝³ : Field K
inst✝² : Algebra F K
L : Type u_4
inst✝¹ : Field L
inst✝ : Algebra K L
S : Set L
hS : ∀ x ∈ S, IsIntegral K x
⊢ Algebra.IsAlgebraic K ↥(adjoin K S)

Next tactic:
rw [← biSup_adjoin_simple, ← iSup_subtype'']
theorem isAlgebraic_adjoin {S : Set L} (hS : ∀ x ∈ S, IsIntegral K x) :
    Algebra.IsAlgebraic K (adjoin K S) := by
  rw [← biSup_adjoin_simple, ← iSup_subtype'']
  

Proof state:
F : Type u_1
inst✝⁶ : Field F
E : Type u_2
inst✝⁵ : Field E
inst✝⁴ : Algebra F E
α : E
K : Type u_3
inst✝³ : Field K
inst✝² : Algebra F K
L : Type u_4
inst✝¹ : Field L
inst✝ : Algebra K L
S : Set L
hS : ∀ x ∈ S, IsIntegral K x
⊢ Algebra.IsAlgebraic K ↥(⨆ i, K⟮↑i⟯)

Next tactic:
exact isAlgebraic_iSup fun x ↦ isAlgebraic_adjoin_simple (hS x x.2)
/-- If `L / K` is a field extension, `S` is a finite subset of `L`, such that every element of `S`
is integral (= algebraic) over `K`, then `K(S) / K` is a finite extension.
A direct corollary of `finiteDimensional_iSup_of_finite`. -/
theorem finiteDimensional_adjoin {S : Set L} [Finite S] (hS : ∀ x ∈ S, IsIntegral K x) :
    FiniteDimensional K (adjoin K S) := by
  

Proof state:
F : Type u_1
inst✝⁷ : Field F
E : Type u_2
inst✝⁶ : Field E
inst✝⁵ : Algebra F E
α : E
K : Type u_3
inst✝⁴ : Field K
inst✝³ : Algebra F K
L : Type u_4
inst✝² : Field L
inst✝¹ : Algebra K L
S : Set L
inst✝ : Finite ↑S
hS : ∀ x ∈ S, IsIntegral K x
⊢ FiniteDimensional K ↥(adjoin K S)

Next tactic:
rw [← biSup_adjoin_simple, ← iSup_subtype'']
/-- If `L / K` is a field extension, `S` is a finite subset of `L`, such that every element of `S`
is integral (= algebraic) over `K`, then `K(S) / K` is a finite extension.
A direct corollary of `finiteDimensional_iSup_of_finite`. -/
theorem finiteDimensional_adjoin {S : Set L} [Finite S] (hS : ∀ x ∈ S, IsIntegral K x) :
    FiniteDimensional K (adjoin K S) := by
  rw [← biSup_adjoin_simple, ← iSup_subtype'']
  

Proof state:
F : Type u_1
inst✝⁷ : Field F
E : Type u_2
inst✝⁶ : Field E
inst✝⁵ : Algebra F E
α : E
K : Type u_3
inst✝⁴ : Field K
inst✝³ : Algebra F K
L : Type u_4
inst✝² : Field L
inst✝¹ : Algebra K L
S : Set L
inst✝ : Finite ↑S
hS : ∀ x ∈ S, IsIntegral K x
⊢ FiniteDimensional K ↥(⨆ i, K⟮↑i⟯)

Next tactic:
haveI (x : S) := adjoin.finiteDimensional (hS x.1 x.2)
/-- If `L / K` is a field extension, `S` is a finite subset of `L`, such that every element of `S`
is integral (= algebraic) over `K`, then `K(S) / K` is a finite extension.
A direct corollary of `finiteDimensional_iSup_of_finite`. -/
theorem finiteDimensional_adjoin {S : Set L} [Finite S] (hS : ∀ x ∈ S, IsIntegral K x) :
    FiniteDimensional K (adjoin K S) := by
  rw [← biSup_adjoin_simple, ← iSup_subtype'']
  haveI (x : S) := adjoin.finiteDimensional (hS x.1 x.2)
  

Proof state:
F : Type u_1
inst✝⁷ : Field F
E : Type u_2
inst✝⁶ : Field E
inst✝⁵ : Algebra F E
α : E
K : Type u_3
inst✝⁴ : Field K
inst✝³ : Algebra F K
L : Type u_4
inst✝² : Field L
inst✝¹ : Algebra K L
S : Set L
inst✝ : Finite ↑S
hS : ∀ x ∈ S, IsIntegral K x
this : ∀ (x : ↑S), FiniteDimensional K ↥K⟮↑x⟯
⊢ FiniteDimensional K ↥(⨆ i, K⟮↑i⟯)

Next tactic:
exact finiteDimensional_iSup_of_finite
/-- Algebra homomorphism `F⟮α⟯ →ₐ[F] K` are in bijection with the set of roots
of `minpoly α` in `K`. -/
noncomputable def algHomAdjoinIntegralEquiv (h : IsIntegral F α) :
    (F⟮α⟯ →ₐ[F] K) ≃ { x // x ∈ (minpoly F α).aroots K } :=
  (adjoin.powerBasis h).liftEquiv'.trans
    ((Equiv.refl _).subtypeEquiv fun x => by
      

Proof state:
F : Type u_1
inst✝⁴ : Field F
E : Type u_2
inst✝³ : Field E
inst✝² : Algebra F E
α : E
K : Type u_3
inst✝¹ : Field K
inst✝ : Algebra F K
h : IsIntegral F α
x : K
⊢ x ∈ aroots (minpoly F (adjoin.powerBasis h).gen) K ↔ (Equiv.refl K) x ∈ aroots (minpoly F α) K

Next tactic:
rw [adjoin.powerBasis_gen, minpoly_gen, Equiv.refl_apply]
lemma algHomAdjoinIntegralEquiv_symm_apply_gen (h : IsIntegral F α)
    (x : { x // x ∈ (minpoly F α).aroots K }) :
    (algHomAdjoinIntegralEquiv F h).symm x (AdjoinSimple.gen F α) = x :=
  (adjoin.powerBasis h).lift_gen x.val <| by
    

Proof state:
F : Type u_1
inst✝⁴ : Field F
E : Type u_2
inst✝³ : Field E
inst✝² : Algebra F E
α : E
K : Type u_3
inst✝¹ : Field K
inst✝ : Algebra F K
h : IsIntegral F α
x : { x // x ∈ aroots (minpoly F α) K }
⊢ (aeval ↑x) (minpoly F (adjoin.powerBasis h).gen) = 0

Next tactic:
rw [adjoin.powerBasis_gen, minpoly_gen]
lemma algHomAdjoinIntegralEquiv_symm_apply_gen (h : IsIntegral F α)
    (x : { x // x ∈ (minpoly F α).aroots K }) :
    (algHomAdjoinIntegralEquiv F h).symm x (AdjoinSimple.gen F α) = x :=
  (adjoin.powerBasis h).lift_gen x.val <| by
    rw [adjoin.powerBasis_gen, minpoly_gen]; 

Proof state:
F : Type u_1
inst✝⁴ : Field F
E : Type u_2
inst✝³ : Field E
inst✝² : Algebra F E
α : E
K : Type u_3
inst✝¹ : Field K
inst✝ : Algebra F K
h : IsIntegral F α
x : { x // x ∈ aroots (minpoly F α) K }
⊢ (aeval ↑x) (minpoly F α) = 0

Next tactic:
exact (mem_aroots.mp x.2).2
theorem card_algHom_adjoin_integral (h : IsIntegral F α) (h_sep : (minpoly F α).Separable)
    (h_splits : (minpoly F α).Splits (algebraMap F K)) :
    @Fintype.card (F⟮α⟯ →ₐ[F] K) (fintypeOfAlgHomAdjoinIntegral F h) = (minpoly F α).natDegree := by
  

Proof state:
F : Type u_1
inst✝⁴ : Field F
E : Type u_2
inst✝³ : Field E
inst✝² : Algebra F E
α : E
K : Type u_3
inst✝¹ : Field K
inst✝ : Algebra F K
h : IsIntegral F α
h_sep : Separable (minpoly F α)
h_splits : Splits (algebraMap F K) (minpoly F α)
⊢ Fintype.card (↥F⟮α⟯ →ₐ[F] K) = natDegree (minpoly F α)

Next tactic:
rw [AlgHom.card_of_powerBasis]
theorem card_algHom_adjoin_integral (h : IsIntegral F α) (h_sep : (minpoly F α).Separable)
    (h_splits : (minpoly F α).Splits (algebraMap F K)) :
    @Fintype.card (F⟮α⟯ →ₐ[F] K) (fintypeOfAlgHomAdjoinIntegral F h) = (minpoly F α).natDegree := by
  rw [AlgHom.card_of_powerBasis] <;>
    

Proof state:
F : Type u_1
inst✝⁴ : Field F
E : Type u_2
inst✝³ : Field E
inst✝² : Algebra F E
α : E
K : Type u_3
inst✝¹ : Field K
inst✝ : Algebra F K
h : IsIntegral F α
h_sep : Separable (minpoly F α)
h_splits : Splits (algebraMap F K) (minpoly F α)
⊢ (adjoin.powerBasis h).dim = natDegree (minpoly F α)

Next tactic:
simp only [adjoin.powerBasis_dim, adjoin.powerBasis_gen, minpoly_gen, h_sep, h_splits]
theorem card_algHom_adjoin_integral (h : IsIntegral F α) (h_sep : (minpoly F α).Separable)
    (h_splits : (minpoly F α).Splits (algebraMap F K)) :
    @Fintype.card (F⟮α⟯ →ₐ[F] K) (fintypeOfAlgHomAdjoinIntegral F h) = (minpoly F α).natDegree := by
  rw [AlgHom.card_of_powerBasis] <;>
    

Proof state:
case h_sep
F : Type u_1
inst✝⁴ : Field F
E : Type u_2
inst✝³ : Field E
inst✝² : Algebra F E
α : E
K : Type u_3
inst✝¹ : Field K
inst✝ : Algebra F K
h : IsIntegral F α
h_sep : Separable (minpoly F α)
h_splits : Splits (algebraMap F K) (minpoly F α)
⊢ Separable (minpoly F (adjoin.powerBasis h).gen)

Next tactic:
simp only [adjoin.powerBasis_dim, adjoin.powerBasis_gen, minpoly_gen, h_sep, h_splits]
theorem card_algHom_adjoin_integral (h : IsIntegral F α) (h_sep : (minpoly F α).Separable)
    (h_splits : (minpoly F α).Splits (algebraMap F K)) :
    @Fintype.card (F⟮α⟯ →ₐ[F] K) (fintypeOfAlgHomAdjoinIntegral F h) = (minpoly F α).natDegree := by
  rw [AlgHom.card_of_powerBasis] <;>
    

Proof state:
case h_splits
F : Type u_1
inst✝⁴ : Field F
E : Type u_2
inst✝³ : Field E
inst✝² : Algebra F E
α : E
K : Type u_3
inst✝¹ : Field K
inst✝ : Algebra F K
h : IsIntegral F α
h_sep : Separable (minpoly F α)
h_splits : Splits (algebraMap F K) (minpoly F α)
⊢ Splits (algebraMap F K) (minpoly F (adjoin.powerBasis h).gen)

Next tactic:
simp only [adjoin.powerBasis_dim, adjoin.powerBasis_gen, minpoly_gen, h_sep, h_splits]
theorem fg_bot : (⊥ : IntermediateField F E).FG :=
  -- porting note: was `⟨∅, adjoin_empty F E⟩`
  ⟨∅, by 

Proof state:
F : Type u_1
inst✝² : Field F
E : Type u_2
inst✝¹ : Field E
inst✝ : Algebra F E
⊢ adjoin F ↑∅ = ⊥

Next tactic:
simp only [Finset.coe_empty, adjoin_empty]
theorem fG_of_fG_toSubalgebra (S : IntermediateField F E) (h : S.toSubalgebra.FG) : S.FG := by
  

Proof state:
F : Type u_1
inst✝² : Field F
E : Type u_2
inst✝¹ : Field E
inst✝ : Algebra F E
S : IntermediateField F E
h : Subalgebra.FG S.toSubalgebra
⊢ FG S

Next tactic:
cases' h with t ht
theorem fG_of_fG_toSubalgebra (S : IntermediateField F E) (h : S.toSubalgebra.FG) : S.FG := by
  cases' h with t ht
  

Proof state:
case intro
F : Type u_1
inst✝² : Field F
E : Type u_2
inst✝¹ : Field E
inst✝ : Algebra F E
S : IntermediateField F E
t : Finset E
ht : Algebra.adjoin F ↑t = S.toSubalgebra
⊢ FG S

Next tactic:
exact ⟨t, (eq_adjoin_of_eq_algebra_adjoin _ _ _ ht.symm).symm⟩
theorem induction_on_adjoin_finset (S : Finset E) (P : IntermediateField F E → Prop) (base : P ⊥)
    (ih : ∀ (K : IntermediateField F E), ∀ x ∈ S, P K → P (K⟮x⟯.restrictScalars F)) :
    P (adjoin F S) := by
  

Proof state:
F : Type u_1
inst✝² : Field F
E : Type u_2
inst✝¹ : Field E
inst✝ : Algebra F E
S : Finset E
P : IntermediateField F E → Prop
base : P ⊥
ih : ∀ (K : IntermediateField F E), ∀ x ∈ S, P K → P (restrictScalars F (↥K)⟮x⟯)
⊢ P (adjoin F ↑S)

Next tactic:
refine' Finset.induction_on' S _ (fun ha _ _ h => _)
theorem induction_on_adjoin_finset (S : Finset E) (P : IntermediateField F E → Prop) (base : P ⊥)
    (ih : ∀ (K : IntermediateField F E), ∀ x ∈ S, P K → P (K⟮x⟯.restrictScalars F)) :
    P (adjoin F S) := by
  refine' Finset.induction_on' S _ (fun ha _ _ h => _)
  · 

Proof state:
case refine'_1
F : Type u_1
inst✝² : Field F
E : Type u_2
inst✝¹ : Field E
inst✝ : Algebra F E
S : Finset E
P : IntermediateField F E → Prop
base : P ⊥
ih : ∀ (K : IntermediateField F E), ∀ x ∈ S, P K → P (restrictScalars F (↥K)⟮x⟯)
⊢ P (adjoin F ↑∅)

Next tactic:
simp [base]
theorem induction_on_adjoin_finset (S : Finset E) (P : IntermediateField F E → Prop) (base : P ⊥)
    (ih : ∀ (K : IntermediateField F E), ∀ x ∈ S, P K → P (K⟮x⟯.restrictScalars F)) :
    P (adjoin F S) := by
  refine' Finset.induction_on' S _ (fun ha _ _ h => _)
  · simp [base]
  · 

Proof state:
case refine'_2
F : Type u_1
inst✝² : Field F
E : Type u_2
inst✝¹ : Field E
inst✝ : Algebra F E
S : Finset E
P : IntermediateField F E → Prop
base : P ⊥
ih : ∀ (K : IntermediateField F E), ∀ x ∈ S, P K → P (restrictScalars F (↥K)⟮x⟯)
a✝ : E
s✝ : Finset E
ha : a✝ ∈ S
x✝¹ : s✝ ⊆ S
x✝ : a✝ ∉ s✝
h : P (adjoin F ↑s✝)
⊢ P (adjoin F ↑(insert a✝ s✝))

Next tactic:
rw [Finset.coe_insert, Set.insert_eq, Set.union_comm, ← adjoin_adjoin_left]
theorem induction_on_adjoin_finset (S : Finset E) (P : IntermediateField F E → Prop) (base : P ⊥)
    (ih : ∀ (K : IntermediateField F E), ∀ x ∈ S, P K → P (K⟮x⟯.restrictScalars F)) :
    P (adjoin F S) := by
  refine' Finset.induction_on' S _ (fun ha _ _ h => _)
  · simp [base]
  · rw [Finset.coe_insert, Set.insert_eq, Set.union_comm, ← adjoin_adjoin_left]
    

Proof state:
case refine'_2
F : Type u_1
inst✝² : Field F
E : Type u_2
inst✝¹ : Field E
inst✝ : Algebra F E
S : Finset E
P : IntermediateField F E → Prop
base : P ⊥
ih : ∀ (K : IntermediateField F E), ∀ x ∈ S, P K → P (restrictScalars F (↥K)⟮x⟯)
a✝ : E
s✝ : Finset E
ha : a✝ ∈ S
x✝¹ : s✝ ⊆ S
x✝ : a✝ ∉ s✝
h : P (adjoin F ↑s✝)
⊢ P (restrictScalars F (↥(adjoin F ↑s✝))⟮a✝⟯)

Next tactic:
exact ih (adjoin F _) _ ha h
theorem induction_on_adjoin_fg (P : IntermediateField F E → Prop) (base : P ⊥)
    (ih : ∀ (K : IntermediateField F E) (x : E), P K → P (K⟮x⟯.restrictScalars F))
    (K : IntermediateField F E) (hK : K.FG) : P K := by
  

Proof state:
F : Type u_1
inst✝² : Field F
E : Type u_2
inst✝¹ : Field E
inst✝ : Algebra F E
P : IntermediateField F E → Prop
base : P ⊥
ih : ∀ (K : IntermediateField F E) (x : E), P K → P (restrictScalars F (↥K)⟮x⟯)
K : IntermediateField F E
hK : FG K
⊢ P K

Next tactic:
obtain ⟨S, rfl⟩ := hK
theorem induction_on_adjoin_fg (P : IntermediateField F E → Prop) (base : P ⊥)
    (ih : ∀ (K : IntermediateField F E) (x : E), P K → P (K⟮x⟯.restrictScalars F))
    (K : IntermediateField F E) (hK : K.FG) : P K := by
  obtain ⟨S, rfl⟩ := hK
  

Proof state:
case intro
F : Type u_1
inst✝² : Field F
E : Type u_2
inst✝¹ : Field E
inst✝ : Algebra F E
P : IntermediateField F E → Prop
base : P ⊥
ih : ∀ (K : IntermediateField F E) (x : E), P K → P (restrictScalars F (↥K)⟮x⟯)
S : Finset E
⊢ P (adjoin F ↑S)

Next tactic:
exact induction_on_adjoin_finset S P base fun K x _ hK => ih K x hK
instance : PartialOrder (Lifts F E K) where
  le L₁ L₂ := ∃ h : L₁.carrier ≤ L₂.carrier, ∀ x, L₂.emb (inclusion h x) = L₁.emb x
  le_refl L := ⟨le_rfl, by 

Proof state:
F : Type u_1
E : Type u_2
K : Type u_3
inst✝⁴ : Field F
inst✝³ : Field E
inst✝² : Field K
inst✝¹ : Algebra F E
inst✝ : Algebra F K
S : Set E
L : Lifts F E K
⊢ ∀ (x : ↥L.carrier), L.emb ((inclusion (_ : L.carrier ≤ L.carrier)) x) = L.emb x

Next tactic:
simp
instance : PartialOrder (Lifts F E K) where
  le L₁ L₂ := ∃ h : L₁.carrier ≤ L₂.carrier, ∀ x, L₂.emb (inclusion h x) = L₁.emb x
  le_refl L := ⟨le_rfl, by simp⟩
  le_trans L₁ L₂ L₃ := by
    

Proof state:
F : Type u_1
E : Type u_2
K : Type u_3
inst✝⁴ : Field F
inst✝³ : Field E
inst✝² : Field K
inst✝¹ : Algebra F E
inst✝ : Algebra F K
S : Set E
L₁ L₂ L₃ : Lifts F E K
⊢ L₁ ≤ L₂ → L₂ ≤ L₃ → L₁ ≤ L₃

Next tactic:
rintro ⟨h₁₂, h₁₂'⟩ ⟨h₂₃, h₂₃'⟩
instance : PartialOrder (Lifts F E K) where
  le L₁ L₂ := ∃ h : L₁.carrier ≤ L₂.carrier, ∀ x, L₂.emb (inclusion h x) = L₁.emb x
  le_refl L := ⟨le_rfl, by simp⟩
  le_trans L₁ L₂ L₃ := by
    rintro ⟨h₁₂, h₁₂'⟩ ⟨h₂₃, h₂₃'⟩
    

Proof state:
case intro.intro
F : Type u_1
E : Type u_2
K : Type u_3
inst✝⁴ : Field F
inst✝³ : Field E
inst✝² : Field K
inst✝¹ : Algebra F E
inst✝ : Algebra F K
S : Set E
L₁ L₂ L₃ : Lifts F E K
h₁₂ : L₁.carrier ≤ L₂.carrier
h₁₂' : ∀ (x : ↥L₁.carrier), L₂.emb ((inclusion h₁₂) x) = L₁.emb x
h₂₃ : L₂.carrier ≤ L₃.carrier
h₂₃' : ∀ (x : ↥L₂.carrier), L₃.emb ((inclusion h₂₃) x) = L₂.emb x
⊢ L₁ ≤ L₃

Next tactic:
refine ⟨h₁₂.trans h₂₃, fun _ ↦ ?_⟩
instance : PartialOrder (Lifts F E K) where
  le L₁ L₂ := ∃ h : L₁.carrier ≤ L₂.carrier, ∀ x, L₂.emb (inclusion h x) = L₁.emb x
  le_refl L := ⟨le_rfl, by simp⟩
  le_trans L₁ L₂ L₃ := by
    rintro ⟨h₁₂, h₁₂'⟩ ⟨h₂₃, h₂₃'⟩
    refine ⟨h₁₂.trans h₂₃, fun _ ↦ ?_⟩
    

Proof state:
case intro.intro
F : Type u_1
E : Type u_2
K : Type u_3
inst✝⁴ : Field F
inst✝³ : Field E
inst✝² : Field K
inst✝¹ : Algebra F E
inst✝ : Algebra F K
S : Set E
L₁ L₂ L₃ : Lifts F E K
h₁₂ : L₁.carrier ≤ L₂.carrier
h₁₂' : ∀ (x : ↥L₁.carrier), L₂.emb ((inclusion h₁₂) x) = L₁.emb x
h₂₃ : L₂.carrier ≤ L₃.carrier
h₂₃' : ∀ (x : ↥L₂.carrier), L₃.emb ((inclusion h₂₃) x) = L₂.emb x
x✝ : ↥L₁.carrier
⊢ L₃.emb ((inclusion (_ : L₁.carrier ≤ L₃.carrier)) x✝) = L₁.emb x✝

Next tactic:
rw [← inclusion_inclusion h₁₂ h₂₃, h₂₃', h₁₂']
instance : PartialOrder (Lifts F E K) where
  le L₁ L₂ := ∃ h : L₁.carrier ≤ L₂.carrier, ∀ x, L₂.emb (inclusion h x) = L₁.emb x
  le_refl L := ⟨le_rfl, by simp⟩
  le_trans L₁ L₂ L₃ := by
    rintro ⟨h₁₂, h₁₂'⟩ ⟨h₂₃, h₂₃'⟩
    refine ⟨h₁₂.trans h₂₃, fun _ ↦ ?_⟩
    rw [← inclusion_inclusion h₁₂ h₂₃, h₂₃', h₁₂']
  le_antisymm := by
    

Proof state:
F : Type u_1
E : Type u_2
K : Type u_3
inst✝⁴ : Field F
inst✝³ : Field E
inst✝² : Field K
inst✝¹ : Algebra F E
inst✝ : Algebra F K
S : Set E
⊢ ∀ (a b : Lifts F E K), a ≤ b → b ≤ a → a = b

Next tactic:
rintro ⟨L₁, e₁⟩ ⟨L₂, e₂⟩ ⟨h₁₂, h₁₂'⟩ ⟨h₂₁, h₂₁'⟩
instance : PartialOrder (Lifts F E K) where
  le L₁ L₂ := ∃ h : L₁.carrier ≤ L₂.carrier, ∀ x, L₂.emb (inclusion h x) = L₁.emb x
  le_refl L := ⟨le_rfl, by simp⟩
  le_trans L₁ L₂ L₃ := by
    rintro ⟨h₁₂, h₁₂'⟩ ⟨h₂₃, h₂₃'⟩
    refine ⟨h₁₂.trans h₂₃, fun _ ↦ ?_⟩
    rw [← inclusion_inclusion h₁₂ h₂₃, h₂₃', h₁₂']
  le_antisymm := by
    rintro ⟨L₁, e₁⟩ ⟨L₂, e₂⟩ ⟨h₁₂, h₁₂'⟩ ⟨h₂₁, h₂₁'⟩
    

Proof state:
case mk.mk.intro.intro
F : Type u_1
E : Type u_2
K : Type u_3
inst✝⁴ : Field F
inst✝³ : Field E
inst✝² : Field K
inst✝¹ : Algebra F E
inst✝ : Algebra F K
S : Set E
L₁ : IntermediateField F E
e₁ : ↥L₁ →ₐ[F] K
L₂ : IntermediateField F E
e₂ : ↥L₂ →ₐ[F] K
h₁₂ : { carrier := L₁, emb := e₁ }.carrier ≤ { carrier := L₂, emb := e₂ }.carrier
h₁₂' :
  ∀ (x : ↥{ carrier := L₁, emb := e₁ }.carrier),
    { carrier := L₂, emb := e₂ }.emb ((inclusion h₁₂) x) = { carrier := L₁, emb := e₁ }.emb x
h₂₁ : { carrier := L₂, emb := e₂ }.carrier ≤ { carrier := L₁, emb := e₁ }.carrier
h₂₁' :
  ∀ (x : ↥{ carrier := L₂, emb := e₂ }.carrier),
    { carrier := L₁, emb := e₁ }.emb ((inclusion h₂₁) x) = { carrier := L₂, emb := e₂ }.emb x
⊢ { carrier := L₁, emb := e₁ } = { carrier := L₂, emb := e₂ }

Next tactic:
obtain rfl : L₁ = L₂ := h₁₂.antisymm h₂₁
instance : PartialOrder (Lifts F E K) where
  le L₁ L₂ := ∃ h : L₁.carrier ≤ L₂.carrier, ∀ x, L₂.emb (inclusion h x) = L₁.emb x
  le_refl L := ⟨le_rfl, by simp⟩
  le_trans L₁ L₂ L₃ := by
    rintro ⟨h₁₂, h₁₂'⟩ ⟨h₂₃, h₂₃'⟩
    refine ⟨h₁₂.trans h₂₃, fun _ ↦ ?_⟩
    rw [← inclusion_inclusion h₁₂ h₂₃, h₂₃', h₁₂']
  le_antisymm := by
    rintro ⟨L₁, e₁⟩ ⟨L₂, e₂⟩ ⟨h₁₂, h₁₂'⟩ ⟨h₂₁, h₂₁'⟩
    obtain rfl : L₁ = L₂ := h₁₂.antisymm h₂₁
    

Proof state:
case mk.mk.intro.intro
F : Type u_1
E : Type u_2
K : Type u_3
inst✝⁴ : Field F
inst✝³ : Field E
inst✝² : Field K
inst✝¹ : Algebra F E
inst✝ : Algebra F K
S : Set E
L₁ : IntermediateField F E
e₁ e₂ : ↥L₁ →ₐ[F] K
h₁₂ : { carrier := L₁, emb := e₁ }.carrier ≤ { carrier := L₁, emb := e₂ }.carrier
h₁₂' :
  ∀ (x : ↥{ carrier := L₁, emb := e₁ }.carrier),
    { carrier := L₁, emb := e₂ }.emb ((inclusion h₁₂) x) = { carrier := L₁, emb := e₁ }.emb x
h₂₁ : { carrier := L₁, emb := e₂ }.carrier ≤ { carrier := L₁, emb := e₁ }.carrier
h₂₁' :
  ∀ (x : ↥{ carrier := L₁, emb := e₂ }.carrier),
    { carrier := L₁, emb := e₁ }.emb ((inclusion h₂₁) x) = { carrier := L₁, emb := e₂ }.emb x
⊢ { carrier := L₁, emb := e₁ } = { carrier := L₁, emb := e₂ }

Next tactic:
congr