l3lab/ntp-mathlib huggingface dataset:
/-- If `U` is qcqs, then `Γ(X, D(f)) ≃ Γ(X, U)_f` for every `f : Γ(X, U)`.
This is known as the **Qcqs lemma** in [R. Vakil, *The rising sea*][RisingSea]. -/
theorem is_localization_basicOpen_of_qcqs {X : Scheme} {U : Opens X.carrier} (hU : IsCompact U.1)
    (hU' : IsQuasiSeparated U.1) (f : X.presheaf.obj (op U)) :
    IsLocalization.Away f (X.presheaf.obj (op <| X.basicOpen f)) := by
  constructor
  · rintro ⟨_, n, rfl⟩
    simp only [map_pow, Subtype.coe_mk, RingHom.algebraMap_toAlgebra]
    exact IsUnit.pow _ (RingedSpace.isUnit_res_basicOpen _ f)
  · intro z
    obtain ⟨n, y, e⟩ := exists_eq_pow_mul_of_isCompact_of_isQuasiSeparated X U hU hU' f z
    refine' ⟨⟨y, _, n, rfl⟩, _⟩
    simpa only [map_pow, Subtype.coe_mk, RingHom.algebraMap_toAlgebra, mul_comm z] using e.symm
  · 

Proof state:
case exists_of_eq
X✝ Y : Scheme
f✝ : X✝ ⟶ Y
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsCompact U.carrier
hU' : IsQuasiSeparated U.carrier
f : ↑(X.presheaf.obj (op U))
⊢ ∀ {x y : ↑(X.presheaf.obj (op U))},
    (algebraMap ↑(X.presheaf.obj (op U)) ↑(X.presheaf.obj (op (X.basicOpen f)))) x =
        (algebraMap ↑(X.presheaf.obj (op U)) ↑(X.presheaf.obj (op (X.basicOpen f)))) y →
      ∃ c, ↑c * x = ↑c * y

Next tactic:
intro x y
/-- If `U` is qcqs, then `Γ(X, D(f)) ≃ Γ(X, U)_f` for every `f : Γ(X, U)`.
This is known as the **Qcqs lemma** in [R. Vakil, *The rising sea*][RisingSea]. -/
theorem is_localization_basicOpen_of_qcqs {X : Scheme} {U : Opens X.carrier} (hU : IsCompact U.1)
    (hU' : IsQuasiSeparated U.1) (f : X.presheaf.obj (op U)) :
    IsLocalization.Away f (X.presheaf.obj (op <| X.basicOpen f)) := by
  constructor
  · rintro ⟨_, n, rfl⟩
    simp only [map_pow, Subtype.coe_mk, RingHom.algebraMap_toAlgebra]
    exact IsUnit.pow _ (RingedSpace.isUnit_res_basicOpen _ f)
  · intro z
    obtain ⟨n, y, e⟩ := exists_eq_pow_mul_of_isCompact_of_isQuasiSeparated X U hU hU' f z
    refine' ⟨⟨y, _, n, rfl⟩, _⟩
    simpa only [map_pow, Subtype.coe_mk, RingHom.algebraMap_toAlgebra, mul_comm z] using e.symm
  · intro x y
    

Proof state:
case exists_of_eq
X✝ Y : Scheme
f✝ : X✝ ⟶ Y
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsCompact U.carrier
hU' : IsQuasiSeparated U.carrier
f x y : ↑(X.presheaf.obj (op U))
⊢ (algebraMap ↑(X.presheaf.obj (op U)) ↑(X.presheaf.obj (op (X.basicOpen f)))) x =
      (algebraMap ↑(X.presheaf.obj (op U)) ↑(X.presheaf.obj (op (X.basicOpen f)))) y →
    ∃ c, ↑c * x = ↑c * y

Next tactic:
rw [← sub_eq_zero, ← map_sub, RingHom.algebraMap_toAlgebra]
/-- If `U` is qcqs, then `Γ(X, D(f)) ≃ Γ(X, U)_f` for every `f : Γ(X, U)`.
This is known as the **Qcqs lemma** in [R. Vakil, *The rising sea*][RisingSea]. -/
theorem is_localization_basicOpen_of_qcqs {X : Scheme} {U : Opens X.carrier} (hU : IsCompact U.1)
    (hU' : IsQuasiSeparated U.1) (f : X.presheaf.obj (op U)) :
    IsLocalization.Away f (X.presheaf.obj (op <| X.basicOpen f)) := by
  constructor
  · rintro ⟨_, n, rfl⟩
    simp only [map_pow, Subtype.coe_mk, RingHom.algebraMap_toAlgebra]
    exact IsUnit.pow _ (RingedSpace.isUnit_res_basicOpen _ f)
  · intro z
    obtain ⟨n, y, e⟩ := exists_eq_pow_mul_of_isCompact_of_isQuasiSeparated X U hU hU' f z
    refine' ⟨⟨y, _, n, rfl⟩, _⟩
    simpa only [map_pow, Subtype.coe_mk, RingHom.algebraMap_toAlgebra, mul_comm z] using e.symm
  · intro x y
    rw [← sub_eq_zero, ← map_sub, RingHom.algebraMap_toAlgebra]
    

Proof state:
case exists_of_eq
X✝ Y : Scheme
f✝ : X✝ ⟶ Y
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsCompact U.carrier
hU' : IsQuasiSeparated U.carrier
f x y : ↑(X.presheaf.obj (op U))
⊢ (X.presheaf.map (homOfLE (_ : X.basicOpen f ≤ U)).op) (x - y) = 0 → ∃ c, ↑c * x = ↑c * y

Next tactic:
simp_rw [← @sub_eq_zero _ _ (_ * x) (_ * y), ← mul_sub]
/-- If `U` is qcqs, then `Γ(X, D(f)) ≃ Γ(X, U)_f` for every `f : Γ(X, U)`.
This is known as the **Qcqs lemma** in [R. Vakil, *The rising sea*][RisingSea]. -/
theorem is_localization_basicOpen_of_qcqs {X : Scheme} {U : Opens X.carrier} (hU : IsCompact U.1)
    (hU' : IsQuasiSeparated U.1) (f : X.presheaf.obj (op U)) :
    IsLocalization.Away f (X.presheaf.obj (op <| X.basicOpen f)) := by
  constructor
  · rintro ⟨_, n, rfl⟩
    simp only [map_pow, Subtype.coe_mk, RingHom.algebraMap_toAlgebra]
    exact IsUnit.pow _ (RingedSpace.isUnit_res_basicOpen _ f)
  · intro z
    obtain ⟨n, y, e⟩ := exists_eq_pow_mul_of_isCompact_of_isQuasiSeparated X U hU hU' f z
    refine' ⟨⟨y, _, n, rfl⟩, _⟩
    simpa only [map_pow, Subtype.coe_mk, RingHom.algebraMap_toAlgebra, mul_comm z] using e.symm
  · intro x y
    rw [← sub_eq_zero, ← map_sub, RingHom.algebraMap_toAlgebra]
    simp_rw [← @sub_eq_zero _ _ (_ * x) (_ * y), ← mul_sub]
    

Proof state:
case exists_of_eq
X✝ Y : Scheme
f✝ : X✝ ⟶ Y
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsCompact U.carrier
hU' : IsQuasiSeparated U.carrier
f x y : ↑(X.presheaf.obj (op U))
⊢ (X.presheaf.map (homOfLE (_ : X.basicOpen f ≤ U)).op) (x - y) = 0 → ∃ c, ↑c * (x - y) = 0

Next tactic:
generalize x - y = z
/-- If `U` is qcqs, then `Γ(X, D(f)) ≃ Γ(X, U)_f` for every `f : Γ(X, U)`.
This is known as the **Qcqs lemma** in [R. Vakil, *The rising sea*][RisingSea]. -/
theorem is_localization_basicOpen_of_qcqs {X : Scheme} {U : Opens X.carrier} (hU : IsCompact U.1)
    (hU' : IsQuasiSeparated U.1) (f : X.presheaf.obj (op U)) :
    IsLocalization.Away f (X.presheaf.obj (op <| X.basicOpen f)) := by
  constructor
  · rintro ⟨_, n, rfl⟩
    simp only [map_pow, Subtype.coe_mk, RingHom.algebraMap_toAlgebra]
    exact IsUnit.pow _ (RingedSpace.isUnit_res_basicOpen _ f)
  · intro z
    obtain ⟨n, y, e⟩ := exists_eq_pow_mul_of_isCompact_of_isQuasiSeparated X U hU hU' f z
    refine' ⟨⟨y, _, n, rfl⟩, _⟩
    simpa only [map_pow, Subtype.coe_mk, RingHom.algebraMap_toAlgebra, mul_comm z] using e.symm
  · intro x y
    rw [← sub_eq_zero, ← map_sub, RingHom.algebraMap_toAlgebra]
    simp_rw [← @sub_eq_zero _ _ (_ * x) (_ * y), ← mul_sub]
    generalize x - y = z
    

Proof state:
case exists_of_eq
X✝ Y : Scheme
f✝ : X✝ ⟶ Y
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsCompact U.carrier
hU' : IsQuasiSeparated U.carrier
f x y z : ↑(X.presheaf.obj (op U))
⊢ (X.presheaf.map (homOfLE (_ : X.basicOpen f ≤ U)).op) z = 0 → ∃ c, ↑c * z = 0

Next tactic:
intro H
/-- If `U` is qcqs, then `Γ(X, D(f)) ≃ Γ(X, U)_f` for every `f : Γ(X, U)`.
This is known as the **Qcqs lemma** in [R. Vakil, *The rising sea*][RisingSea]. -/
theorem is_localization_basicOpen_of_qcqs {X : Scheme} {U : Opens X.carrier} (hU : IsCompact U.1)
    (hU' : IsQuasiSeparated U.1) (f : X.presheaf.obj (op U)) :
    IsLocalization.Away f (X.presheaf.obj (op <| X.basicOpen f)) := by
  constructor
  · rintro ⟨_, n, rfl⟩
    simp only [map_pow, Subtype.coe_mk, RingHom.algebraMap_toAlgebra]
    exact IsUnit.pow _ (RingedSpace.isUnit_res_basicOpen _ f)
  · intro z
    obtain ⟨n, y, e⟩ := exists_eq_pow_mul_of_isCompact_of_isQuasiSeparated X U hU hU' f z
    refine' ⟨⟨y, _, n, rfl⟩, _⟩
    simpa only [map_pow, Subtype.coe_mk, RingHom.algebraMap_toAlgebra, mul_comm z] using e.symm
  · intro x y
    rw [← sub_eq_zero, ← map_sub, RingHom.algebraMap_toAlgebra]
    simp_rw [← @sub_eq_zero _ _ (_ * x) (_ * y), ← mul_sub]
    generalize x - y = z
    intro H
    

Proof state:
case exists_of_eq
X✝ Y : Scheme
f✝ : X✝ ⟶ Y
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsCompact U.carrier
hU' : IsQuasiSeparated U.carrier
f x y z : ↑(X.presheaf.obj (op U))
H : (X.presheaf.map (homOfLE (_ : X.basicOpen f ≤ U)).op) z = 0
⊢ ∃ c, ↑c * z = 0

Next tactic:
obtain ⟨n, e⟩ := exists_pow_mul_eq_zero_of_res_basicOpen_eq_zero_of_isCompact X hU _ _ H
/-- If `U` is qcqs, then `Γ(X, D(f)) ≃ Γ(X, U)_f` for every `f : Γ(X, U)`.
This is known as the **Qcqs lemma** in [R. Vakil, *The rising sea*][RisingSea]. -/
theorem is_localization_basicOpen_of_qcqs {X : Scheme} {U : Opens X.carrier} (hU : IsCompact U.1)
    (hU' : IsQuasiSeparated U.1) (f : X.presheaf.obj (op U)) :
    IsLocalization.Away f (X.presheaf.obj (op <| X.basicOpen f)) := by
  constructor
  · rintro ⟨_, n, rfl⟩
    simp only [map_pow, Subtype.coe_mk, RingHom.algebraMap_toAlgebra]
    exact IsUnit.pow _ (RingedSpace.isUnit_res_basicOpen _ f)
  · intro z
    obtain ⟨n, y, e⟩ := exists_eq_pow_mul_of_isCompact_of_isQuasiSeparated X U hU hU' f z
    refine' ⟨⟨y, _, n, rfl⟩, _⟩
    simpa only [map_pow, Subtype.coe_mk, RingHom.algebraMap_toAlgebra, mul_comm z] using e.symm
  · intro x y
    rw [← sub_eq_zero, ← map_sub, RingHom.algebraMap_toAlgebra]
    simp_rw [← @sub_eq_zero _ _ (_ * x) (_ * y), ← mul_sub]
    generalize x - y = z
    intro H
    obtain ⟨n, e⟩ := exists_pow_mul_eq_zero_of_res_basicOpen_eq_zero_of_isCompact X hU _ _ H
    

Proof state:
case exists_of_eq.intro
X✝ Y : Scheme
f✝ : X✝ ⟶ Y
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsCompact U.carrier
hU' : IsQuasiSeparated U.carrier
f x y z : ↑(X.presheaf.obj (op U))
H : (X.presheaf.map (homOfLE (_ : X.basicOpen f ≤ U)).op) z = 0
n : ℕ
e : f ^ n * z = 0
⊢ ∃ c, ↑c * z = 0

Next tactic:
refine' ⟨⟨_, n, rfl⟩, _⟩
/-- If `U` is qcqs, then `Γ(X, D(f)) ≃ Γ(X, U)_f` for every `f : Γ(X, U)`.
This is known as the **Qcqs lemma** in [R. Vakil, *The rising sea*][RisingSea]. -/
theorem is_localization_basicOpen_of_qcqs {X : Scheme} {U : Opens X.carrier} (hU : IsCompact U.1)
    (hU' : IsQuasiSeparated U.1) (f : X.presheaf.obj (op U)) :
    IsLocalization.Away f (X.presheaf.obj (op <| X.basicOpen f)) := by
  constructor
  · rintro ⟨_, n, rfl⟩
    simp only [map_pow, Subtype.coe_mk, RingHom.algebraMap_toAlgebra]
    exact IsUnit.pow _ (RingedSpace.isUnit_res_basicOpen _ f)
  · intro z
    obtain ⟨n, y, e⟩ := exists_eq_pow_mul_of_isCompact_of_isQuasiSeparated X U hU hU' f z
    refine' ⟨⟨y, _, n, rfl⟩, _⟩
    simpa only [map_pow, Subtype.coe_mk, RingHom.algebraMap_toAlgebra, mul_comm z] using e.symm
  · intro x y
    rw [← sub_eq_zero, ← map_sub, RingHom.algebraMap_toAlgebra]
    simp_rw [← @sub_eq_zero _ _ (_ * x) (_ * y), ← mul_sub]
    generalize x - y = z
    intro H
    obtain ⟨n, e⟩ := exists_pow_mul_eq_zero_of_res_basicOpen_eq_zero_of_isCompact X hU _ _ H
    refine' ⟨⟨_, n, rfl⟩, _⟩
    

Proof state:
case exists_of_eq.intro
X✝ Y : Scheme
f✝ : X✝ ⟶ Y
X : Scheme
U : Opens ↑↑X.toPresheafedSpace
hU : IsCompact U.carrier
hU' : IsQuasiSeparated U.carrier
f x y z : ↑(X.presheaf.obj (op U))
H : (X.presheaf.map (homOfLE (_ : X.basicOpen f ≤ U)).op) z = 0
n : ℕ
e : f ^ n * z = 0
⊢ ↑{ val := (fun x => f ^ x) n, property := (_ : ∃ y, (fun x => f ^ x) y = (fun x => f ^ x) n) } * z = 0

Next tactic:
simpa [mul_comm z] using e
theorem fg_trans (h1 : (adjoin R s).toSubmodule.FG) (h2 : (adjoin (adjoin R s) t).toSubmodule.FG) :
    (adjoin R (s ∪ t)).toSubmodule.FG := by
  

Proof state:
R : Type u
A : Type v
B : Type w
inst✝² : CommSemiring R
inst✝¹ : CommSemiring A
inst✝ : Algebra R A
s t : Set A
h1 : FG (Subalgebra.toSubmodule (adjoin R s))
h2 : FG (Subalgebra.toSubmodule (adjoin (↥(adjoin R s)) t))
⊢ FG (Subalgebra.toSubmodule (adjoin R (s ∪ t)))

Next tactic:
rcases fg_def.1 h1 with ⟨p, hp, hp'⟩
theorem fg_trans (h1 : (adjoin R s).toSubmodule.FG) (h2 : (adjoin (adjoin R s) t).toSubmodule.FG) :
    (adjoin R (s ∪ t)).toSubmodule.FG := by
  rcases fg_def.1 h1 with ⟨p, hp, hp'⟩
  

Proof state:
case intro.intro
R : Type u
A : Type v
B : Type w
inst✝² : CommSemiring R
inst✝¹ : CommSemiring A
inst✝ : Algebra R A
s t : Set A
h1 : FG (Subalgebra.toSubmodule (adjoin R s))
h2 : FG (Subalgebra.toSubmodule (adjoin (↥(adjoin R s)) t))
p : Set A
hp : Set.Finite p
hp' : span R p = Subalgebra.toSubmodule (adjoin R s)
⊢ FG (Subalgebra.toSubmodule (adjoin R (s ∪ t)))

Next tactic:
rcases fg_def.1 h2 with ⟨q, hq, hq'⟩
theorem fg_trans (h1 : (adjoin R s).toSubmodule.FG) (h2 : (adjoin (adjoin R s) t).toSubmodule.FG) :
    (adjoin R (s ∪ t)).toSubmodule.FG := by
  rcases fg_def.1 h1 with ⟨p, hp, hp'⟩
  rcases fg_def.1 h2 with ⟨q, hq, hq'⟩
  

Proof state:
case intro.intro.intro.intro
R : Type u
A : Type v
B : Type w
inst✝² : CommSemiring R
inst✝¹ : CommSemiring A
inst✝ : Algebra R A
s t : Set A
h1 : FG (Subalgebra.toSubmodule (adjoin R s))
h2 : FG (Subalgebra.toSubmodule (adjoin (↥(adjoin R s)) t))
p : Set A
hp : Set.Finite p
hp' : span R p = Subalgebra.toSubmodule (adjoin R s)
q : Set A
hq : Set.Finite q
hq' : span (↥(adjoin R s)) q = Subalgebra.toSubmodule (adjoin (↥(adjoin R s)) t)
⊢ FG (Subalgebra.toSubmodule (adjoin R (s ∪ t)))

Next tactic:
refine' fg_def.2 ⟨p * q, hp.mul hq, le_antisymm _ _⟩
theorem fg_trans (h1 : (adjoin R s).toSubmodule.FG) (h2 : (adjoin (adjoin R s) t).toSubmodule.FG) :
    (adjoin R (s ∪ t)).toSubmodule.FG := by
  rcases fg_def.1 h1 with ⟨p, hp, hp'⟩
  rcases fg_def.1 h2 with ⟨q, hq, hq'⟩
  refine' fg_def.2 ⟨p * q, hp.mul hq, le_antisymm _ _⟩
  · 

Proof state:
case intro.intro.intro.intro.refine'_1
R : Type u
A : Type v
B : Type w
inst✝² : CommSemiring R
inst✝¹ : CommSemiring A
inst✝ : Algebra R A
s t : Set A
h1 : FG (Subalgebra.toSubmodule (adjoin R s))
h2 : FG (Subalgebra.toSubmodule (adjoin (↥(adjoin R s)) t))
p : Set A
hp : Set.Finite p
hp' : span R p = Subalgebra.toSubmodule (adjoin R s)
q : Set A
hq : Set.Finite q
hq' : span (↥(adjoin R s)) q = Subalgebra.toSubmodule (adjoin (↥(adjoin R s)) t)
⊢ span R (p * q) ≤ Subalgebra.toSubmodule (adjoin R (s ∪ t))

Next tactic:
rw [span_le]
theorem fg_trans (h1 : (adjoin R s).toSubmodule.FG) (h2 : (adjoin (adjoin R s) t).toSubmodule.FG) :
    (adjoin R (s ∪ t)).toSubmodule.FG := by
  rcases fg_def.1 h1 with ⟨p, hp, hp'⟩
  rcases fg_def.1 h2 with ⟨q, hq, hq'⟩
  refine' fg_def.2 ⟨p * q, hp.mul hq, le_antisymm _ _⟩
  · rw [span_le]
    

Proof state:
case intro.intro.intro.intro.refine'_1
R : Type u
A : Type v
B : Type w
inst✝² : CommSemiring R
inst✝¹ : CommSemiring A
inst✝ : Algebra R A
s t : Set A
h1 : FG (Subalgebra.toSubmodule (adjoin R s))
h2 : FG (Subalgebra.toSubmodule (adjoin (↥(adjoin R s)) t))
p : Set A
hp : Set.Finite p
hp' : span R p = Subalgebra.toSubmodule (adjoin R s)
q : Set A
hq : Set.Finite q
hq' : span (↥(adjoin R s)) q = Subalgebra.toSubmodule (adjoin (↥(adjoin R s)) t)
⊢ p * q ⊆ ↑(Subalgebra.toSubmodule (adjoin R (s ∪ t)))

Next tactic:
rintro _ ⟨x, y, hx, hy, rfl⟩
theorem fg_trans (h1 : (adjoin R s).toSubmodule.FG) (h2 : (adjoin (adjoin R s) t).toSubmodule.FG) :
    (adjoin R (s ∪ t)).toSubmodule.FG := by
  rcases fg_def.1 h1 with ⟨p, hp, hp'⟩
  rcases fg_def.1 h2 with ⟨q, hq, hq'⟩
  refine' fg_def.2 ⟨p * q, hp.mul hq, le_antisymm _ _⟩
  · rw [span_le]
    rintro _ ⟨x, y, hx, hy, rfl⟩
    

Proof state:
case intro.intro.intro.intro.refine'_1.intro.intro.intro.intro
R : Type u
A : Type v
B : Type w
inst✝² : CommSemiring R
inst✝¹ : CommSemiring A
inst✝ : Algebra R A
s t : Set A
h1 : FG (Subalgebra.toSubmodule (adjoin R s))
h2 : FG (Subalgebra.toSubmodule (adjoin (↥(adjoin R s)) t))
p : Set A
hp : Set.Finite p
hp' : span R p = Subalgebra.toSubmodule (adjoin R s)
q : Set A
hq : Set.Finite q
hq' : span (↥(adjoin R s)) q = Subalgebra.toSubmodule (adjoin (↥(adjoin R s)) t)
x y : A
hx : x ∈ p
hy : y ∈ q
⊢ (fun x x_1 => x * x_1) x y ∈ ↑(Subalgebra.toSubmodule (adjoin R (s ∪ t)))

Next tactic:
change x * y ∈ adjoin R (s ∪ t)
theorem fg_trans (h1 : (adjoin R s).toSubmodule.FG) (h2 : (adjoin (adjoin R s) t).toSubmodule.FG) :
    (adjoin R (s ∪ t)).toSubmodule.FG := by
  rcases fg_def.1 h1 with ⟨p, hp, hp'⟩
  rcases fg_def.1 h2 with ⟨q, hq, hq'⟩
  refine' fg_def.2 ⟨p * q, hp.mul hq, le_antisymm _ _⟩
  · rw [span_le]
    rintro _ ⟨x, y, hx, hy, rfl⟩
    change x * y ∈ adjoin R (s ∪ t)
    

Proof state:
case intro.intro.intro.intro.refine'_1.intro.intro.intro.intro
R : Type u
A : Type v
B : Type w
inst✝² : CommSemiring R
inst✝¹ : CommSemiring A
inst✝ : Algebra R A
s t : Set A
h1 : FG (Subalgebra.toSubmodule (adjoin R s))
h2 : FG (Subalgebra.toSubmodule (adjoin (↥(adjoin R s)) t))
p : Set A
hp : Set.Finite p
hp' : span R p = Subalgebra.toSubmodule (adjoin R s)
q : Set A
hq : Set.Finite q
hq' : span (↥(adjoin R s)) q = Subalgebra.toSubmodule (adjoin (↥(adjoin R s)) t)
x y : A
hx : x ∈ p
hy : y ∈ q
⊢ x * y ∈ adjoin R (s ∪ t)

Next tactic:
refine' Subalgebra.mul_mem _ _ _
theorem fg_trans (h1 : (adjoin R s).toSubmodule.FG) (h2 : (adjoin (adjoin R s) t).toSubmodule.FG) :
    (adjoin R (s ∪ t)).toSubmodule.FG := by
  rcases fg_def.1 h1 with ⟨p, hp, hp'⟩
  rcases fg_def.1 h2 with ⟨q, hq, hq'⟩
  refine' fg_def.2 ⟨p * q, hp.mul hq, le_antisymm _ _⟩
  · rw [span_le]
    rintro _ ⟨x, y, hx, hy, rfl⟩
    change x * y ∈ adjoin R (s ∪ t)
    refine' Subalgebra.mul_mem _ _ _
    · 

Proof state:
case intro.intro.intro.intro.refine'_1.intro.intro.intro.intro.refine'_1
R : Type u
A : Type v
B : Type w
inst✝² : CommSemiring R
inst✝¹ : CommSemiring A
inst✝ : Algebra R A
s t : Set A
h1 : FG (Subalgebra.toSubmodule (adjoin R s))
h2 : FG (Subalgebra.toSubmodule (adjoin (↥(adjoin R s)) t))
p : Set A
hp : Set.Finite p
hp' : span R p = Subalgebra.toSubmodule (adjoin R s)
q : Set A
hq : Set.Finite q
hq' : span (↥(adjoin R s)) q = Subalgebra.toSubmodule (adjoin (↥(adjoin R s)) t)
x y : A
hx : x ∈ p
hy : y ∈ q
⊢ x ∈ adjoin R (s ∪ t)

Next tactic:
have : x ∈ Subalgebra.toSubmodule (adjoin R s) := by
        rw [← hp']
        exact subset_span hx
theorem fg_trans (h1 : (adjoin R s).toSubmodule.FG) (h2 : (adjoin (adjoin R s) t).toSubmodule.FG) :
    (adjoin R (s ∪ t)).toSubmodule.FG := by
  rcases fg_def.1 h1 with ⟨p, hp, hp'⟩
  rcases fg_def.1 h2 with ⟨q, hq, hq'⟩
  refine' fg_def.2 ⟨p * q, hp.mul hq, le_antisymm _ _⟩
  · rw [span_le]
    rintro _ ⟨x, y, hx, hy, rfl⟩
    change x * y ∈ adjoin R (s ∪ t)
    refine' Subalgebra.mul_mem _ _ _
    · have : x ∈ Subalgebra.toSubmodule (adjoin R s) := by
        

Proof state:
R : Type u
A : Type v
B : Type w
inst✝² : CommSemiring R
inst✝¹ : CommSemiring A
inst✝ : Algebra R A
s t : Set A
h1 : FG (Subalgebra.toSubmodule (adjoin R s))
h2 : FG (Subalgebra.toSubmodule (adjoin (↥(adjoin R s)) t))
p : Set A
hp : Set.Finite p
hp' : span R p = Subalgebra.toSubmodule (adjoin R s)
q : Set A
hq : Set.Finite q
hq' : span (↥(adjoin R s)) q = Subalgebra.toSubmodule (adjoin (↥(adjoin R s)) t)
x y : A
hx : x ∈ p
hy : y ∈ q
⊢ x ∈ Subalgebra.toSubmodule (adjoin R s)

Next tactic:
rw [← hp']
theorem fg_trans (h1 : (adjoin R s).toSubmodule.FG) (h2 : (adjoin (adjoin R s) t).toSubmodule.FG) :
    (adjoin R (s ∪ t)).toSubmodule.FG := by
  rcases fg_def.1 h1 with ⟨p, hp, hp'⟩
  rcases fg_def.1 h2 with ⟨q, hq, hq'⟩
  refine' fg_def.2 ⟨p * q, hp.mul hq, le_antisymm _ _⟩
  · rw [span_le]
    rintro _ ⟨x, y, hx, hy, rfl⟩
    change x * y ∈ adjoin R (s ∪ t)
    refine' Subalgebra.mul_mem _ _ _
    · have : x ∈ Subalgebra.toSubmodule (adjoin R s) := by
        rw [← hp']
        

Proof state:
R : Type u
A : Type v
B : Type w
inst✝² : CommSemiring R
inst✝¹ : CommSemiring A
inst✝ : Algebra R A
s t : Set A
h1 : FG (Subalgebra.toSubmodule (adjoin R s))
h2 : FG (Subalgebra.toSubmodule (adjoin (↥(adjoin R s)) t))
p : Set A
hp : Set.Finite p
hp' : span R p = Subalgebra.toSubmodule (adjoin R s)
q : Set A
hq : Set.Finite q
hq' : span (↥(adjoin R s)) q = Subalgebra.toSubmodule (adjoin (↥(adjoin R s)) t)
x y : A
hx : x ∈ p
hy : y ∈ q
⊢ x ∈ span R p

Next tactic:
exact subset_span hx
theorem fg_trans (h1 : (adjoin R s).toSubmodule.FG) (h2 : (adjoin (adjoin R s) t).toSubmodule.FG) :
    (adjoin R (s ∪ t)).toSubmodule.FG := by
  rcases fg_def.1 h1 with ⟨p, hp, hp'⟩
  rcases fg_def.1 h2 with ⟨q, hq, hq'⟩
  refine' fg_def.2 ⟨p * q, hp.mul hq, le_antisymm _ _⟩
  · rw [span_le]
    rintro _ ⟨x, y, hx, hy, rfl⟩
    change x * y ∈ adjoin R (s ∪ t)
    refine' Subalgebra.mul_mem _ _ _
    · have : x ∈ Subalgebra.toSubmodule (adjoin R s) := by
        rw [← hp']
        exact subset_span hx
      

Proof state:
case intro.intro.intro.intro.refine'_1.intro.intro.intro.intro.refine'_1
R : Type u
A : Type v
B : Type w
inst✝² : CommSemiring R
inst✝¹ : CommSemiring A
inst✝ : Algebra R A
s t : Set A
h1 : FG (Subalgebra.toSubmodule (adjoin R s))
h2 : FG (Subalgebra.toSubmodule (adjoin (↥(adjoin R s)) t))
p : Set A
hp : Set.Finite p
hp' : span R p = Subalgebra.toSubmodule (adjoin R s)
q : Set A
hq : Set.Finite q
hq' : span (↥(adjoin R s)) q = Subalgebra.toSubmodule (adjoin (↥(adjoin R s)) t)
x y : A
hx : x ∈ p
hy : y ∈ q
this : x ∈ Subalgebra.toSubmodule (adjoin R s)
⊢ x ∈ adjoin R (s ∪ t)

Next tactic:
exact adjoin_mono (Set.subset_union_left _ _) this
theorem fg_trans (h1 : (adjoin R s).toSubmodule.FG) (h2 : (adjoin (adjoin R s) t).toSubmodule.FG) :
    (adjoin R (s ∪ t)).toSubmodule.FG := by
  rcases fg_def.1 h1 with ⟨p, hp, hp'⟩
  rcases fg_def.1 h2 with ⟨q, hq, hq'⟩
  refine' fg_def.2 ⟨p * q, hp.mul hq, le_antisymm _ _⟩
  · rw [span_le]
    rintro _ ⟨x, y, hx, hy, rfl⟩
    change x * y ∈ adjoin R (s ∪ t)
    refine' Subalgebra.mul_mem _ _ _
    · have : x ∈ Subalgebra.toSubmodule (adjoin R s) := by
        rw [← hp']
        exact subset_span hx
      exact adjoin_mono (Set.subset_union_left _ _) this
    

Proof state:
case intro.intro.intro.intro.refine'_1.intro.intro.intro.intro.refine'_2
R : Type u
A : Type v
B : Type w
inst✝² : CommSemiring R
inst✝¹ : CommSemiring A
inst✝ : Algebra R A
s t : Set A
h1 : FG (Subalgebra.toSubmodule (adjoin R s))
h2 : FG (Subalgebra.toSubmodule (adjoin (↥(adjoin R s)) t))
p : Set A
hp : Set.Finite p
hp' : span R p = Subalgebra.toSubmodule (adjoin R s)
q : Set A
hq : Set.Finite q
hq' : span (↥(adjoin R s)) q = Subalgebra.toSubmodule (adjoin (↥(adjoin R s)) t)
x y : A
hx : x ∈ p
hy : y ∈ q
⊢ y ∈ adjoin R (s ∪ t)

Next tactic:
have : y ∈ Subalgebra.toSubmodule (adjoin (adjoin R s) t) := by
      rw [← hq']
      exact subset_span hy
theorem fg_trans (h1 : (adjoin R s).toSubmodule.FG) (h2 : (adjoin (adjoin R s) t).toSubmodule.FG) :
    (adjoin R (s ∪ t)).toSubmodule.FG := by
  rcases fg_def.1 h1 with ⟨p, hp, hp'⟩
  rcases fg_def.1 h2 with ⟨q, hq, hq'⟩
  refine' fg_def.2 ⟨p * q, hp.mul hq, le_antisymm _ _⟩
  · rw [span_le]
    rintro _ ⟨x, y, hx, hy, rfl⟩
    change x * y ∈ adjoin R (s ∪ t)
    refine' Subalgebra.mul_mem _ _ _
    · have : x ∈ Subalgebra.toSubmodule (adjoin R s) := by
        rw [← hp']
        exact subset_span hx
      exact adjoin_mono (Set.subset_union_left _ _) this
    have : y ∈ Subalgebra.toSubmodule (adjoin (adjoin R s) t) := by
      

Proof state:
R : Type u
A : Type v
B : Type w
inst✝² : CommSemiring R
inst✝¹ : CommSemiring A
inst✝ : Algebra R A
s t : Set A
h1 : FG (Subalgebra.toSubmodule (adjoin R s))
h2 : FG (Subalgebra.toSubmodule (adjoin (↥(adjoin R s)) t))
p : Set A
hp : Set.Finite p
hp' : span R p = Subalgebra.toSubmodule (adjoin R s)
q : Set A
hq : Set.Finite q
hq' : span (↥(adjoin R s)) q = Subalgebra.toSubmodule (adjoin (↥(adjoin R s)) t)
x y : A
hx : x ∈ p
hy : y ∈ q
⊢ y ∈ Subalgebra.toSubmodule (adjoin (↥(adjoin R s)) t)

Next tactic:
rw [← hq']
theorem fg_trans (h1 : (adjoin R s).toSubmodule.FG) (h2 : (adjoin (adjoin R s) t).toSubmodule.FG) :
    (adjoin R (s ∪ t)).toSubmodule.FG := by
  rcases fg_def.1 h1 with ⟨p, hp, hp'⟩
  rcases fg_def.1 h2 with ⟨q, hq, hq'⟩
  refine' fg_def.2 ⟨p * q, hp.mul hq, le_antisymm _ _⟩
  · rw [span_le]
    rintro _ ⟨x, y, hx, hy, rfl⟩
    change x * y ∈ adjoin R (s ∪ t)
    refine' Subalgebra.mul_mem _ _ _
    · have : x ∈ Subalgebra.toSubmodule (adjoin R s) := by
        rw [← hp']
        exact subset_span hx
      exact adjoin_mono (Set.subset_union_left _ _) this
    have : y ∈ Subalgebra.toSubmodule (adjoin (adjoin R s) t) := by
      rw [← hq']
      

Proof state:
R : Type u
A : Type v
B : Type w
inst✝² : CommSemiring R
inst✝¹ : CommSemiring A
inst✝ : Algebra R A
s t : Set A
h1 : FG (Subalgebra.toSubmodule (adjoin R s))
h2 : FG (Subalgebra.toSubmodule (adjoin (↥(adjoin R s)) t))
p : Set A
hp : Set.Finite p
hp' : span R p = Subalgebra.toSubmodule (adjoin R s)
q : Set A
hq : Set.Finite q
hq' : span (↥(adjoin R s)) q = Subalgebra.toSubmodule (adjoin (↥(adjoin R s)) t)
x y : A
hx : x ∈ p
hy : y ∈ q
⊢ y ∈ span (↥(adjoin R s)) q

Next tactic:
exact subset_span hy