l3lab/ntp-mathlib huggingface dataset:
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₂₁
    congr
    

Proof state:
case mk.mk.intro.intro.e_emb
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
⊢ e₁ = e₂

Next tactic:
exact AlgHom.ext h₂₁'
noncomputable instance : OrderBot (Lifts F E K) where
  bot := ⟨⊥, (Algebra.ofId F K).comp (botEquiv F E)⟩
  bot_le L := ⟨bot_le, fun x ↦ 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 : ↥⊥.carrier
⊢ L.emb ((inclusion (_ : ⊥ ≤ L.carrier)) x) = ⊥.emb x

Next tactic:
obtain ⟨x, rfl⟩ := (botEquiv F E).symm.surjective x
noncomputable instance : OrderBot (Lifts F E K) where
  bot := ⟨⊥, (Algebra.ofId F K).comp (botEquiv F E)⟩
  bot_le L := ⟨bot_le, fun x ↦ by
    obtain ⟨x, rfl⟩ := (botEquiv F E).symm.surjective x
    

Proof state:
case 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 : Lifts F E K
x : F
⊢ L.emb ((inclusion (_ : ⊥ ≤ L.carrier)) ((AlgEquiv.symm (botEquiv F E)) x)) = ⊥.emb ((AlgEquiv.symm (botEquiv F E)) x)

Next tactic:
simp_rw [AlgHom.comp_apply, AlgHom.coe_coe, AlgEquiv.apply_symm_apply]
noncomputable instance : OrderBot (Lifts F E K) where
  bot := ⟨⊥, (Algebra.ofId F K).comp (botEquiv F E)⟩
  bot_le L := ⟨bot_le, fun x ↦ by
    obtain ⟨x, rfl⟩ := (botEquiv F E).symm.surjective x
    simp_rw [AlgHom.comp_apply, AlgHom.coe_coe, AlgEquiv.apply_symm_apply]
    

Proof state:
case 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 : Lifts F E K
x : F
⊢ L.emb ((inclusion (_ : ⊥ ≤ L.carrier)) ((AlgEquiv.symm (botEquiv F E)) x)) = (Algebra.ofId F K) x

Next tactic:
exact L.emb.commutes x
/-- A chain of lifts has an upper bound. -/
theorem Lifts.exists_upper_bound (c : Set (Lifts F E K)) (hc : IsChain (· ≤ ·) c) :
    ∃ ub, ∀ a ∈ c, a ≤ ub := 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
c : Set (Lifts F E K)
hc : IsChain (fun x x_1 => x ≤ x_1) c
⊢ ∃ ub, ∀ a ∈ c, a ≤ ub

Next tactic:
let t (i : ↑(insert ⊥ c)) := i.val.carrier
/-- A chain of lifts has an upper bound. -/
theorem Lifts.exists_upper_bound (c : Set (Lifts F E K)) (hc : IsChain (· ≤ ·) c) :
    ∃ ub, ∀ a ∈ c, a ≤ ub := by
  let t (i : ↑(insert ⊥ c)) := i.val.carrier
  

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
c : Set (Lifts F E K)
hc : IsChain (fun x x_1 => x ≤ x_1) c
t : ↑(insert ⊥ c) → IntermediateField F E := fun i => (↑i).carrier
⊢ ∃ ub, ∀ a ∈ c, a ≤ ub

Next tactic:
let t' (i) := (t i).toSubalgebra
/-- A chain of lifts has an upper bound. -/
theorem Lifts.exists_upper_bound (c : Set (Lifts F E K)) (hc : IsChain (· ≤ ·) c) :
    ∃ ub, ∀ a ∈ c, a ≤ ub := by
  let t (i : ↑(insert ⊥ c)) := i.val.carrier
  let t' (i) := (t i).toSubalgebra
  

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
c : Set (Lifts F E K)
hc : IsChain (fun x x_1 => x ≤ x_1) c
t : ↑(insert ⊥ c) → IntermediateField F E := fun i => (↑i).carrier
t' : ↑(insert ⊥ c) → Subalgebra F E := fun i => (t i).toSubalgebra
⊢ ∃ ub, ∀ a ∈ c, a ≤ ub

Next tactic:
have hc := hc.insert fun _ _ _ ↦ .inl bot_le
/-- A chain of lifts has an upper bound. -/
theorem Lifts.exists_upper_bound (c : Set (Lifts F E K)) (hc : IsChain (· ≤ ·) c) :
    ∃ ub, ∀ a ∈ c, a ≤ ub := by
  let t (i : ↑(insert ⊥ c)) := i.val.carrier
  let t' (i) := (t i).toSubalgebra
  have hc := hc.insert fun _ _ _ ↦ .inl bot_le
  

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
c : Set (Lifts F E K)
hc✝ : IsChain (fun x x_1 => x ≤ x_1) c
t : ↑(insert ⊥ c) → IntermediateField F E := fun i => (↑i).carrier
t' : ↑(insert ⊥ c) → Subalgebra F E := fun i => (t i).toSubalgebra
hc : IsChain (fun x x_1 => x ≤ x_1) (insert ⊥ c)
⊢ ∃ ub, ∀ a ∈ c, a ≤ ub

Next tactic:
have dir : Directed (· ≤ ·) t := hc.directedOn.directed_val.mono_comp _ fun _ _ h ↦ h.1
/-- A chain of lifts has an upper bound. -/
theorem Lifts.exists_upper_bound (c : Set (Lifts F E K)) (hc : IsChain (· ≤ ·) c) :
    ∃ ub, ∀ a ∈ c, a ≤ ub := by
  let t (i : ↑(insert ⊥ c)) := i.val.carrier
  let t' (i) := (t i).toSubalgebra
  have hc := hc.insert fun _ _ _ ↦ .inl bot_le
  have dir : Directed (· ≤ ·) t := hc.directedOn.directed_val.mono_comp _ fun _ _ h ↦ h.1
  

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
c : Set (Lifts F E K)
hc✝ : IsChain (fun x x_1 => x ≤ x_1) c
t : ↑(insert ⊥ c) → IntermediateField F E := fun i => (↑i).carrier
t' : ↑(insert ⊥ c) → Subalgebra F E := fun i => (t i).toSubalgebra
hc : IsChain (fun x x_1 => x ≤ x_1) (insert ⊥ c)
dir : Directed (fun x x_1 => x ≤ x_1) t
⊢ ∃ ub, ∀ a ∈ c, a ≤ ub

Next tactic:
refine ⟨⟨iSup t, (Subalgebra.iSupLift t' dir (fun i ↦ i.val.emb) (fun i j h ↦ ?_) _ rfl).comp
      (Subalgebra.equivOfEq _ _ <| toSubalgebra_iSup_of_directed dir)⟩,
    fun L hL ↦ have hL := Set.mem_insert_of_mem ⊥ hL; ⟨le_iSup t ⟨L, hL⟩, fun x ↦ ?_⟩⟩
/-- A chain of lifts has an upper bound. -/
theorem Lifts.exists_upper_bound (c : Set (Lifts F E K)) (hc : IsChain (· ≤ ·) c) :
    ∃ ub, ∀ a ∈ c, a ≤ ub := by
  let t (i : ↑(insert ⊥ c)) := i.val.carrier
  let t' (i) := (t i).toSubalgebra
  have hc := hc.insert fun _ _ _ ↦ .inl bot_le
  have dir : Directed (· ≤ ·) t := hc.directedOn.directed_val.mono_comp _ fun _ _ h ↦ h.1
  refine ⟨⟨iSup t, (Subalgebra.iSupLift t' dir (fun i ↦ i.val.emb) (fun i j h ↦ ?_) _ rfl).comp
      (Subalgebra.equivOfEq _ _ <| toSubalgebra_iSup_of_directed dir)⟩,
    fun L hL ↦ have hL := Set.mem_insert_of_mem ⊥ hL; ⟨le_iSup t ⟨L, hL⟩, fun x ↦ ?_⟩⟩
  · 

Proof state:
case refine_1
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
c : Set (Lifts F E K)
hc✝ : IsChain (fun x x_1 => x ≤ x_1) c
t : ↑(insert ⊥ c) → IntermediateField F E := fun i => (↑i).carrier
t' : ↑(insert ⊥ c) → Subalgebra F E := fun i => (t i).toSubalgebra
hc : IsChain (fun x x_1 => x ≤ x_1) (insert ⊥ c)
dir : Directed (fun x x_1 => x ≤ x_1) t
i j : ↑(insert ⊥ c)
h : t' i ≤ t' j
⊢ (fun i => (↑i).emb) i = AlgHom.comp ((fun i => (↑i).emb) j) (Subalgebra.inclusion h)

Next tactic:
refine AlgHom.ext fun x ↦ (hc.total i.2 j.2).elim (fun hij ↦ (hij.snd x).symm) fun hji ↦ ?_
/-- A chain of lifts has an upper bound. -/
theorem Lifts.exists_upper_bound (c : Set (Lifts F E K)) (hc : IsChain (· ≤ ·) c) :
    ∃ ub, ∀ a ∈ c, a ≤ ub := by
  let t (i : ↑(insert ⊥ c)) := i.val.carrier
  let t' (i) := (t i).toSubalgebra
  have hc := hc.insert fun _ _ _ ↦ .inl bot_le
  have dir : Directed (· ≤ ·) t := hc.directedOn.directed_val.mono_comp _ fun _ _ h ↦ h.1
  refine ⟨⟨iSup t, (Subalgebra.iSupLift t' dir (fun i ↦ i.val.emb) (fun i j h ↦ ?_) _ rfl).comp
      (Subalgebra.equivOfEq _ _ <| toSubalgebra_iSup_of_directed dir)⟩,
    fun L hL ↦ have hL := Set.mem_insert_of_mem ⊥ hL; ⟨le_iSup t ⟨L, hL⟩, fun x ↦ ?_⟩⟩
  · refine AlgHom.ext fun x ↦ (hc.total i.2 j.2).elim (fun hij ↦ (hij.snd x).symm) fun hji ↦ ?_
    

Proof state:
case refine_1
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
c : Set (Lifts F E K)
hc✝ : IsChain (fun x x_1 => x ≤ x_1) c
t : ↑(insert ⊥ c) → IntermediateField F E := fun i => (↑i).carrier
t' : ↑(insert ⊥ c) → Subalgebra F E := fun i => (t i).toSubalgebra
hc : IsChain (fun x x_1 => x ≤ x_1) (insert ⊥ c)
dir : Directed (fun x x_1 => x ≤ x_1) t
i j : ↑(insert ⊥ c)
h : t' i ≤ t' j
x : ↥(↑i).carrier
hji : ↑j ≤ ↑i
⊢ ((fun i => (↑i).emb) i) x = (AlgHom.comp ((fun i => (↑i).emb) j) (Subalgebra.inclusion h)) x

Next tactic:
erw [AlgHom.comp_apply, ← hji.snd (Subalgebra.inclusion h x),
         inclusion_inclusion, inclusion_self, AlgHom.id_apply x]
/-- A chain of lifts has an upper bound. -/
theorem Lifts.exists_upper_bound (c : Set (Lifts F E K)) (hc : IsChain (· ≤ ·) c) :
    ∃ ub, ∀ a ∈ c, a ≤ ub := by
  let t (i : ↑(insert ⊥ c)) := i.val.carrier
  let t' (i) := (t i).toSubalgebra
  have hc := hc.insert fun _ _ _ ↦ .inl bot_le
  have dir : Directed (· ≤ ·) t := hc.directedOn.directed_val.mono_comp _ fun _ _ h ↦ h.1
  refine ⟨⟨iSup t, (Subalgebra.iSupLift t' dir (fun i ↦ i.val.emb) (fun i j h ↦ ?_) _ rfl).comp
      (Subalgebra.equivOfEq _ _ <| toSubalgebra_iSup_of_directed dir)⟩,
    fun L hL ↦ have hL := Set.mem_insert_of_mem ⊥ hL; ⟨le_iSup t ⟨L, hL⟩, fun x ↦ ?_⟩⟩
  · refine AlgHom.ext fun x ↦ (hc.total i.2 j.2).elim (fun hij ↦ (hij.snd x).symm) fun hji ↦ ?_
    erw [AlgHom.comp_apply, ← hji.snd (Subalgebra.inclusion h x),
         inclusion_inclusion, inclusion_self, AlgHom.id_apply x]
  · 

Proof state:
case refine_2
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
c : Set (Lifts F E K)
hc✝ : IsChain (fun x x_1 => x ≤ x_1) c
t : ↑(insert ⊥ c) → IntermediateField F E := fun i => (↑i).carrier
t' : ↑(insert ⊥ c) → Subalgebra F E := fun i => (t i).toSubalgebra
hc : IsChain (fun x x_1 => x ≤ x_1) (insert ⊥ c)
dir : Directed (fun x x_1 => x ≤ x_1) t
L : Lifts F E K
hL✝ : L ∈ c
hL : L ∈ insert ⊥ c
x : ↥L.carrier
⊢ { carrier := iSup t,
          emb :=
            AlgHom.comp
              (Subalgebra.iSupLift t' dir (fun i => (↑i).emb)
                (_ :
                  ∀ (i j : ↑(insert ⊥ c)) (h : t' i ≤ t' j),
                    (fun i => (↑i).emb) i = AlgHom.comp ((fun i => (↑i).emb) j) (Subalgebra.inclusion h))
                (iSup t') (_ : iSup t' = iSup t'))
              ↑(Subalgebra.equivOfEq (iSup t).toSubalgebra (⨆ i, (t i).toSubalgebra)
                  (_ : (iSup t).toSubalgebra = ⨆ i, (t i).toSubalgebra)) }.emb
      ((inclusion (_ : t { val := L, property := hL } ≤ iSup t)) x) =
    L.emb x

Next tactic:
dsimp only [AlgHom.comp_apply]
/-- A chain of lifts has an upper bound. -/
theorem Lifts.exists_upper_bound (c : Set (Lifts F E K)) (hc : IsChain (· ≤ ·) c) :
    ∃ ub, ∀ a ∈ c, a ≤ ub := by
  let t (i : ↑(insert ⊥ c)) := i.val.carrier
  let t' (i) := (t i).toSubalgebra
  have hc := hc.insert fun _ _ _ ↦ .inl bot_le
  have dir : Directed (· ≤ ·) t := hc.directedOn.directed_val.mono_comp _ fun _ _ h ↦ h.1
  refine ⟨⟨iSup t, (Subalgebra.iSupLift t' dir (fun i ↦ i.val.emb) (fun i j h ↦ ?_) _ rfl).comp
      (Subalgebra.equivOfEq _ _ <| toSubalgebra_iSup_of_directed dir)⟩,
    fun L hL ↦ have hL := Set.mem_insert_of_mem ⊥ hL; ⟨le_iSup t ⟨L, hL⟩, fun x ↦ ?_⟩⟩
  · refine AlgHom.ext fun x ↦ (hc.total i.2 j.2).elim (fun hij ↦ (hij.snd x).symm) fun hji ↦ ?_
    erw [AlgHom.comp_apply, ← hji.snd (Subalgebra.inclusion h x),
         inclusion_inclusion, inclusion_self, AlgHom.id_apply x]
  · dsimp only [AlgHom.comp_apply]
    

Proof state:
case refine_2
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
c : Set (Lifts F E K)
hc✝ : IsChain (fun x x_1 => x ≤ x_1) c
t : ↑(insert ⊥ c) → IntermediateField F E := fun i => (↑i).carrier
t' : ↑(insert ⊥ c) → Subalgebra F E := fun i => (t i).toSubalgebra
hc : IsChain (fun x x_1 => x ≤ x_1) (insert ⊥ c)
dir : Directed (fun x x_1 => x ≤ x_1) t
L : Lifts F E K
hL✝ : L ∈ c
hL : L ∈ insert ⊥ c
x : ↥L.carrier
⊢ (Subalgebra.iSupLift (fun i => (↑i).carrier.toSubalgebra) dir (fun i => (↑i).emb)
        (_ :
          ∀ (i j : ↑(insert ⊥ c)) (h : (↑i).carrier.toSubalgebra ≤ (↑j).carrier.toSubalgebra),
            (↑i).emb = AlgHom.comp (↑j).emb (Subalgebra.inclusion h))
        (⨆ i, (↑i).carrier.toSubalgebra) (_ : ⨆ i, (↑i).carrier.toSubalgebra = ⨆ i, (↑i).carrier.toSubalgebra))
      (↑(Subalgebra.equivOfEq (⨆ i, (↑i).carrier).toSubalgebra (⨆ i, (↑i).carrier.toSubalgebra)
            (_ : (⨆ i, (↑i).carrier).toSubalgebra = ⨆ i, (↑i).carrier.toSubalgebra))
        ((inclusion (_ : (↑{ val := L, property := hL }).carrier ≤ ⨆ i, (↑i).carrier)) x)) =
    L.emb x

Next tactic:
exact Subalgebra.iSupLift_inclusion (K := t') (i := ⟨L, hL⟩) x (le_iSup t' ⟨L, hL⟩)
/-- Given an element `s : E` whose conjugates are all in `K`, any lift can be extended to one
  whose carrier contains `s`. -/
theorem Lifts.exists_lift_of_splits (x : Lifts F E K) {s : E} (h1 : IsIntegral F s)
    (h2 : (minpoly F s).Splits (algebraMap F K)) : ∃ y, x ≤ y ∧ s ∈ y.carrier :=
  have I1 : IsIntegral x.carrier s := h1.tower_top
  have I2 := (minpoly.degree_pos I1).ne'
  have key : (minpoly x.carrier s).Splits x.emb.toRingHom :=
    splits_of_splits_of_dvd _ (map_ne_zero (minpoly.ne_zero h1))
      ((splits_map_iff _ _).2 (x.emb.comp_algebraMap ▸ h2)) (minpoly.dvd_map_of_isScalarTower _ _ _)
  letI : Algebra x.carrier K := x.emb.toRingHom.toAlgebra
  let carrier := x.carrier⟮s⟯.restrictScalars F
  letI : Algebra x.carrier carrier := x.carrier⟮s⟯.toSubalgebra.algebra
  let φ : carrier →ₐ[x.carrier] K := ((algHomAdjoinIntegralEquiv x.carrier I1).symm
    ⟨rootOfSplits x.emb.toRingHom key I2, 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
x : Lifts F E K
s : E
h1 : IsIntegral F s
h2 : Splits (algebraMap F K) (minpoly F s)
I1 : IsIntegral (↥x.carrier) s
I2 : degree (minpoly (↥x.carrier) s) ≠ 0
key : Splits (↑x.emb) (minpoly (↥x.carrier) s)
this✝ : Algebra (↥x.carrier) K := RingHom.toAlgebra ↑x.emb
carrier : IntermediateField F E := restrictScalars F (↥x.carrier)⟮s⟯
this : Algebra ↥x.carrier ↥carrier := Subalgebra.algebra (↥x.carrier)⟮s⟯.toSubalgebra
⊢ rootOfSplits (↑x.emb) key I2 ∈ aroots (minpoly (↥x.carrier) s) K

Next tactic:
rw [mem_aroots, and_iff_right (minpoly.ne_zero I1)]
/-- Given an element `s : E` whose conjugates are all in `K`, any lift can be extended to one
  whose carrier contains `s`. -/
theorem Lifts.exists_lift_of_splits (x : Lifts F E K) {s : E} (h1 : IsIntegral F s)
    (h2 : (minpoly F s).Splits (algebraMap F K)) : ∃ y, x ≤ y ∧ s ∈ y.carrier :=
  have I1 : IsIntegral x.carrier s := h1.tower_top
  have I2 := (minpoly.degree_pos I1).ne'
  have key : (minpoly x.carrier s).Splits x.emb.toRingHom :=
    splits_of_splits_of_dvd _ (map_ne_zero (minpoly.ne_zero h1))
      ((splits_map_iff _ _).2 (x.emb.comp_algebraMap ▸ h2)) (minpoly.dvd_map_of_isScalarTower _ _ _)
  letI : Algebra x.carrier K := x.emb.toRingHom.toAlgebra
  let carrier := x.carrier⟮s⟯.restrictScalars F
  letI : Algebra x.carrier carrier := x.carrier⟮s⟯.toSubalgebra.algebra
  let φ : carrier →ₐ[x.carrier] K := ((algHomAdjoinIntegralEquiv x.carrier I1).symm
    ⟨rootOfSplits x.emb.toRingHom key I2, by
      rw [mem_aroots, and_iff_right (minpoly.ne_zero I1)]
      

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
x : Lifts F E K
s : E
h1 : IsIntegral F s
h2 : Splits (algebraMap F K) (minpoly F s)
I1 : IsIntegral (↥x.carrier) s
I2 : degree (minpoly (↥x.carrier) s) ≠ 0
key : Splits (↑x.emb) (minpoly (↥x.carrier) s)
this✝ : Algebra (↥x.carrier) K := RingHom.toAlgebra ↑x.emb
carrier : IntermediateField F E := restrictScalars F (↥x.carrier)⟮s⟯
this : Algebra ↥x.carrier ↥carrier := Subalgebra.algebra (↥x.carrier)⟮s⟯.toSubalgebra
⊢ (aeval (rootOfSplits (↑x.emb) key I2)) (minpoly (↥x.carrier) s) = 0

Next tactic:
exact map_rootOfSplits x.emb.toRingHom key I2
theorem exists_algHom_adjoin_of_splits : ∃ φ : adjoin F S →ₐ[F] K, φ.comp (inclusion hL) = f := 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
hK : ∀ s ∈ S, IsIntegral F s ∧ Splits (algebraMap F K) (minpoly F s)
hK' : ∀ (s : E), IsIntegral F s ∧ Splits (algebraMap F K) (minpoly F s)
L : IntermediateField F E
f : ↥L →ₐ[F] K
hL : L ≤ adjoin F S
⊢ ∃ φ, AlgHom.comp φ (inclusion hL) = f

Next tactic:
obtain ⟨φ, hfφ, hφ⟩ := zorn_nonempty_Ici₀ _
    (fun c _ hc _ _ ↦ Lifts.exists_upper_bound c hc) ⟨L, f⟩ le_rfl
theorem exists_algHom_adjoin_of_splits : ∃ φ : adjoin F S →ₐ[F] K, φ.comp (inclusion hL) = f := by
  obtain ⟨φ, hfφ, hφ⟩ := zorn_nonempty_Ici₀ _
    (fun c _ hc _ _ ↦ Lifts.exists_upper_bound c hc) ⟨L, f⟩ le_rfl
  

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
hK : ∀ s ∈ S, IsIntegral F s ∧ Splits (algebraMap F K) (minpoly F s)
hK' : ∀ (s : E), IsIntegral F s ∧ Splits (algebraMap F K) (minpoly F s)
L : IntermediateField F E
f : ↥L →ₐ[F] K
hL : L ≤ adjoin F S
φ : Lifts F E K
hfφ : { carrier := L, emb := f } ≤ φ
hφ : ∀ (z : Lifts F E K), φ ≤ z → z ≤ φ
⊢ ∃ φ, AlgHom.comp φ (inclusion hL) = f

Next tactic:
refine ⟨φ.emb.comp (inclusion <| adjoin_le_iff.mpr fun s hs ↦ ?_), ?_⟩
theorem exists_algHom_adjoin_of_splits : ∃ φ : adjoin F S →ₐ[F] K, φ.comp (inclusion hL) = f := by
  obtain ⟨φ, hfφ, hφ⟩ := zorn_nonempty_Ici₀ _
    (fun c _ hc _ _ ↦ Lifts.exists_upper_bound c hc) ⟨L, f⟩ le_rfl
  refine ⟨φ.emb.comp (inclusion <| adjoin_le_iff.mpr fun s hs ↦ ?_), ?_⟩
  · 

Proof state:
case intro.intro.refine_1
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
hK : ∀ s ∈ S, IsIntegral F s ∧ Splits (algebraMap F K) (minpoly F s)
hK' : ∀ (s : E), IsIntegral F s ∧ Splits (algebraMap F K) (minpoly F s)
L : IntermediateField F E
f : ↥L →ₐ[F] K
hL : L ≤ adjoin F S
φ : Lifts F E K
hfφ : { carrier := L, emb := f } ≤ φ
hφ : ∀ (z : Lifts F E K), φ ≤ z → z ≤ φ
s : E
hs : s ∈ S
⊢ s ∈ ↑φ.carrier

Next tactic:
rcases φ.exists_lift_of_splits (hK s hs).1 (hK s hs).2 with ⟨y, h1, h2⟩
theorem exists_algHom_adjoin_of_splits : ∃ φ : adjoin F S →ₐ[F] K, φ.comp (inclusion hL) = f := by
  obtain ⟨φ, hfφ, hφ⟩ := zorn_nonempty_Ici₀ _
    (fun c _ hc _ _ ↦ Lifts.exists_upper_bound c hc) ⟨L, f⟩ le_rfl
  refine ⟨φ.emb.comp (inclusion <| adjoin_le_iff.mpr fun s hs ↦ ?_), ?_⟩
  · rcases φ.exists_lift_of_splits (hK s hs).1 (hK s hs).2 with ⟨y, h1, h2⟩
    

Proof state:
case intro.intro.refine_1.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
hK : ∀ s ∈ S, IsIntegral F s ∧ Splits (algebraMap F K) (minpoly F s)
hK' : ∀ (s : E), IsIntegral F s ∧ Splits (algebraMap F K) (minpoly F s)
L : IntermediateField F E
f : ↥L →ₐ[F] K
hL : L ≤ adjoin F S
φ : Lifts F E K
hfφ : { carrier := L, emb := f } ≤ φ
hφ : ∀ (z : Lifts F E K), φ ≤ z → z ≤ φ
s : E
hs : s ∈ S
y : Lifts F E K
h1 : φ ≤ y
h2 : s ∈ y.carrier
⊢ s ∈ ↑φ.carrier

Next tactic:
exact (hφ y h1).1 h2
theorem exists_algHom_adjoin_of_splits : ∃ φ : adjoin F S →ₐ[F] K, φ.comp (inclusion hL) = f := by
  obtain ⟨φ, hfφ, hφ⟩ := zorn_nonempty_Ici₀ _
    (fun c _ hc _ _ ↦ Lifts.exists_upper_bound c hc) ⟨L, f⟩ le_rfl
  refine ⟨φ.emb.comp (inclusion <| adjoin_le_iff.mpr fun s hs ↦ ?_), ?_⟩
  · rcases φ.exists_lift_of_splits (hK s hs).1 (hK s hs).2 with ⟨y, h1, h2⟩
    exact (hφ y h1).1 h2
  · 

Proof state:
case intro.intro.refine_2
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
hK : ∀ s ∈ S, IsIntegral F s ∧ Splits (algebraMap F K) (minpoly F s)
hK' : ∀ (s : E), IsIntegral F s ∧ Splits (algebraMap F K) (minpoly F s)
L : IntermediateField F E
f : ↥L →ₐ[F] K
hL : L ≤ adjoin F S
φ : Lifts F E K
hfφ : { carrier := L, emb := f } ≤ φ
hφ : ∀ (z : Lifts F E K), φ ≤ z → z ≤ φ
⊢ AlgHom.comp (AlgHom.comp φ.emb (inclusion (_ : adjoin F S ≤ φ.carrier))) (inclusion hL) = f

Next tactic:
ext
theorem exists_algHom_adjoin_of_splits : ∃ φ : adjoin F S →ₐ[F] K, φ.comp (inclusion hL) = f := by
  obtain ⟨φ, hfφ, hφ⟩ := zorn_nonempty_Ici₀ _
    (fun c _ hc _ _ ↦ Lifts.exists_upper_bound c hc) ⟨L, f⟩ le_rfl
  refine ⟨φ.emb.comp (inclusion <| adjoin_le_iff.mpr fun s hs ↦ ?_), ?_⟩
  · rcases φ.exists_lift_of_splits (hK s hs).1 (hK s hs).2 with ⟨y, h1, h2⟩
    exact (hφ y h1).1 h2
  · ext; 

Proof state:
case intro.intro.refine_2.H
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
hK : ∀ s ∈ S, IsIntegral F s ∧ Splits (algebraMap F K) (minpoly F s)
hK' : ∀ (s : E), IsIntegral F s ∧ Splits (algebraMap F K) (minpoly F s)
L : IntermediateField F E
f : ↥L →ₐ[F] K
hL : L ≤ adjoin F S
φ : Lifts F E K
hfφ : { carrier := L, emb := f } ≤ φ
hφ : ∀ (z : Lifts F E K), φ ≤ z → z ≤ φ
x✝ : ↥L
⊢ (AlgHom.comp (AlgHom.comp φ.emb (inclusion (_ : adjoin F S ≤ φ.carrier))) (inclusion hL)) x✝ = f x✝

Next tactic:
apply hfφ.2
theorem exists_algHom_adjoin_of_splits_of_aeval : ∃ φ : adjoin F S →ₐ[F] K, φ ⟨x, hx⟩ = y := 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
hK : ∀ s ∈ S, IsIntegral F s ∧ Splits (algebraMap F K) (minpoly F s)
hK' : ∀ (s : E), IsIntegral F s ∧ Splits (algebraMap F K) (minpoly F s)
L : IntermediateField F E
f : ↥L →ₐ[F] K
hL : L ≤ adjoin F S
hS : adjoin F S = ⊤
x : E
hx : x ∈ adjoin F S
y : K
hy : (aeval y) (minpoly F x) = 0
⊢ ∃ φ, φ { val := x, property := hx } = y

Next tactic:
have ix := isAlgebraic_adjoin (fun s hs ↦ (hK s hs).1) ⟨x, hx⟩
theorem exists_algHom_adjoin_of_splits_of_aeval : ∃ φ : adjoin F S →ₐ[F] K, φ ⟨x, hx⟩ = y := by
  have ix := isAlgebraic_adjoin (fun s hs ↦ (hK s hs).1) ⟨x, hx⟩
  

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
hK : ∀ s ∈ S, IsIntegral F s ∧ Splits (algebraMap F K) (minpoly F s)
hK' : ∀ (s : E), IsIntegral F s ∧ Splits (algebraMap F K) (minpoly F s)
L : IntermediateField F E
f : ↥L →ₐ[F] K
hL : L ≤ adjoin F S
hS : adjoin F S = ⊤
x : E
hx : x ∈ adjoin F S
y : K
hy : (aeval y) (minpoly F x) = 0
ix : IsAlgebraic F { val := x, property := hx }
⊢ ∃ φ, φ { val := x, property := hx } = y

Next tactic:
rw [isAlgebraic_iff_isIntegral, isIntegral_iff] at ix
theorem exists_algHom_adjoin_of_splits_of_aeval : ∃ φ : adjoin F S →ₐ[F] K, φ ⟨x, hx⟩ = y := by
  have ix := isAlgebraic_adjoin (fun s hs ↦ (hK s hs).1) ⟨x, hx⟩
  rw [isAlgebraic_iff_isIntegral, isIntegral_iff] at ix
  

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
hK : ∀ s ∈ S, IsIntegral F s ∧ Splits (algebraMap F K) (minpoly F s)
hK' : ∀ (s : E), IsIntegral F s ∧ Splits (algebraMap F K) (minpoly F s)
L : IntermediateField F E
f : ↥L →ₐ[F] K
hL : L ≤ adjoin F S
hS : adjoin F S = ⊤
x : E
hx : x ∈ adjoin F S
y : K
hy : (aeval y) (minpoly F x) = 0
ix : IsIntegral F ↑{ val := x, property := hx }
⊢ ∃ φ, φ { val := x, property := hx } = y

Next tactic:
obtain ⟨φ, hφ⟩ := exists_algHom_adjoin_of_splits hK ((algHomAdjoinIntegralEquiv F ix).symm
    ⟨y, mem_aroots.mpr ⟨minpoly.ne_zero ix, hy⟩⟩) (adjoin_simple_le_iff.mpr hx)