-- Lean 4 proof step from Mathlib.RingTheory.FinitePresentation (goal)
Goal:
R : Type w₁
A : Type w₂
B : Type w₃
inst : CommRing R
inst_1 : CommRing A
inst_2 : Algebra R A
inst_3 : CommRing B
inst_4 : Algebra R B
inst_5 : Algebra A B
inst_6 : IsScalarTower R A B
inst_7 : FinitePresentation R B
inst_8 : FiniteType R A
n : ℕ
f : MvPolynomial (Fin n) R →ₐ[R] B
hf : Surjective.{w₁ + 1, w₃ + 1} (α := MvPolynomial (Fin n) R) (β := B) (⇑f : (a : MvPolynomial (Fin n) R) → B)
s : Finset (MvPolynomial (Fin n) R)
hs : Eq (α := Ideal (MvPolynomial (Fin n) R)) (Ideal.span (↑s : Set (MvPolynomial (Fin n) R))) (RingHom.ker f.toRingHom)
RX : Type w₁ := MvPolynomial (Fin n) R
AX : Type w₂ := MvPolynomial (Fin n) A
t : Finset A
ht : Eq (α := Subalgebra R A) (adjoin R (↑t : Set A)) ⊤
t' : (i : ↥t) → MvPolynomial (Fin n) R
ht' :
  ∀ (i : ↥t),
    Eq.{w₃ + 1} (α := B) ((f : (a : MvPolynomial (Fin n) R) → B) (t' i) : B)
      ((algebraMap A B : (a : A) → B) (↑i : A) : B)
ht'' :
  Eq (α := Subalgebra R AX) (adjoin R ((⇑(algebraMap A AX) : (a : A) → AX) '' (↑t : Set A) ∪ Set.range MvPolynomial.X))
    ⊤
g : ↥t → AX :=
  fun (x : ↥t) ↦
    HSub.hSub (α := MvPolynomial (Fin n) A) (β := MvPolynomial (Fin n) A)
      ((MvPolynomial.C : (a : A) → MvPolynomial (Fin n) A) (↑x : A) : MvPolynomial (Fin n) A)
      (((MvPolynomial.map (algebraMap R A) : RingHom.{w₁, w₂} (MvPolynomial (Fin n) R) (MvPolynomial (Fin n) A)) :
            (a : MvPolynomial (Fin n) R) → MvPolynomial (Fin n) A)
          (t' x) :
        MvPolynomial (Fin n) A)
s₀_1 : Set (MvPolynomial (Fin n) A) :=
  (⇑(MvPolynomial.map (algebraMap R A)) : (a : MvPolynomial (Fin n) R) → MvPolynomial (Fin n) A) ''
      (↑s : Set (MvPolynomial (Fin n) R)) ∪
    Set.range g
I : Ideal (MvPolynomial (Fin n) A) :=
  RingHom.ker (F := MvPolynomial (Fin n) A →ₐ[A] B)
    (MvPolynomial.aeval
      (Function.comp.{1, w₁ + 1, w₃ + 1} (β := MvPolynomial (Fin n) R) (⇑f : (a : MvPolynomial (Fin n) R) → B)
        MvPolynomial.X))
leI :
  LE.le (α := Ideal (MvPolynomial (Fin n) A))
    (Ideal.span
      ((⇑(MvPolynomial.map (algebraMap R A)) : (a : MvPolynomial (Fin n) R) → MvPolynomial (Fin n) A) ''
          (↑s : Set (MvPolynomial (Fin n) R)) ∪
        Set.range g))
    (RingHom.ker (F := MvPolynomial (Fin n) A →ₐ[A] B)
      (MvPolynomial.aeval
        (Function.comp.{1, w₁ + 1, w₃ + 1} (β := MvPolynomial (Fin n) R) (⇑f : (a : MvPolynomial (Fin n) R) → B)
          MvPolynomial.X)))
x : MvPolynomial (Fin n) A
hx :
  Eq.{w₃ + 1} (α := B)
    ((MvPolynomial.aeval
            (Function.comp.{1, w₁ + 1, w₃ + 1} (β := MvPolynomial (Fin n) R) (⇑f : (a : MvPolynomial (Fin n) R) → B)
              MvPolynomial.X) :
          (a : MvPolynomial (Fin n) A) → B)
        x :
      B)
    (0 : B)
s₀ : Set (MvPolynomial (Fin n) A) :=
  (⇑(MvPolynomial.map (algebraMap R A)) : (a : MvPolynomial (Fin n) R) → MvPolynomial (Fin n) A) ''
      (↑s : Set (MvPolynomial (Fin n) R)) ∪
    Set.range g
this :
  Membership.mem (γ := Subalgebra R AX)
    (adjoin R ((⇑(algebraMap A AX) : (a : A) → AX) '' (↑t : Set A) ∪ Set.range MvPolynomial.X)) x
x₁ x₂ : MvPolynomial (Fin n) A
hx_1 :
  Membership.mem (γ := Subalgebra R (MvPolynomial (Fin n) A))
    (adjoin R ((⇑(algebraMap A AX) : (a : A) → AX) '' (↑t : Set A) ∪ Set.range MvPolynomial.X)) x₁
hy :
  Membership.mem (γ := Subalgebra R (MvPolynomial (Fin n) A))
    (adjoin R ((⇑(algebraMap A AX) : (a : A) → AX) '' (↑t : Set A) ∪ Set.range MvPolynomial.X)) x₂
h₁ :
  x₁ ∈
    Subsemiring.toAddSubmonoid
        (Subring.toSubsemiring
          (RingHom.range.{w₁, w₂} (R := MvPolynomial (Fin n) R) (MvPolynomial.map (algebraMap R A)))) ⊔
      Submodule.toAddSubmonoid (Ideal.span s₀)
h₂ :
  x₂ ∈
    Subsemiring.toAddSubmonoid
        (Subring.toSubsemiring
          (RingHom.range.{w₁, w₂} (R := MvPolynomial (Fin n) R) (MvPolynomial.map (algebraMap R A)))) ⊔
      Submodule.toAddSubmonoid (Ideal.span s₀)
⊢ x₁ * x₂ ∈
    Subsemiring.toAddSubmonoid
        (Subring.toSubsemiring
          (RingHom.range.{w₁, w₂} (R := MvPolynomial (Fin n) R) (MvPolynomial.map (algebraMap R A)))) ⊔
      Submodule.toAddSubmonoid (Ideal.span s₀)
have refine_4 : ∀ (p₁ : MvPolynomial (Fin n) R) (q₁ : MvPolynomial (Fin n) A)
  (hq₁ : Membership.mem (γ := AddSubmonoid (MvPolynomial (Fin n) A)) (Submodule.toAddSubmonoid (Ideal.span s₀)) q₁),
  Membership.mem (γ := Subalgebra R (MvPolynomial (Fin n) A))
      (adjoin R ((⇑(algebraMap A AX) : (a : A) → AX) '' (↑t : Set A) ∪ Set.range MvPolynomial.X))
      (HAdd.hAdd (α := MvPolynomial (Fin n) A)
        (((MvPolynomial.map (algebraMap R A) : RingHom.{w₁, w₂} (MvPolynomial (Fin n) R) (MvPolynomial (Fin n) A)) :
              (a : MvPolynomial (Fin n) R) → MvPolynomial (Fin n) A)
            p₁ :
          MvPolynomial (Fin n) A)
        q₁) →
    ∀
      (h₁ :
        HAdd.hAdd (α := MvPolynomial (Fin n) A)
            (((MvPolynomial.map (algebraMap R A) : RingHom.{w₁, w₂} (MvPolynomial (Fin n) R) (MvPolynomial (Fin n) A)) :
                  (a : MvPolynomial (Fin n) R) → MvPolynomial (Fin n) A)
                p₁ :
              MvPolynomial (Fin n) A)
            q₁ ∈
          Subsemiring.toAddSubmonoid
              (Subring.toSubsemiring
                (RingHom.range.{w₁, w₂} (R := MvPolynomial (Fin n) R) (MvPolynomial.map (algebraMap R A)))) ⊔
            Submodule.toAddSubmonoid (Ideal.span s₀)),
      HAdd.hAdd (α := MvPolynomial (Fin n) A)
            (((MvPolynomial.map (algebraMap R A) : RingHom.{w₁, w₂} (MvPolynomial (Fin n) R) (MvPolynomial (Fin n) A)) :
                  (a : MvPolynomial (Fin n) R) → MvPolynomial (Fin n) A)
                p₁ :
              MvPolynomial (Fin n) A)
            q₁ *
          x₂ ∈
        Subsemiring.toAddSubmonoid
            (Subring.toSubsemiring
              (RingHom.range.{w₁, w₂} (R := MvPolynomial (Fin n) R) (MvPolynomial.map (algebraMap R A)))) ⊔
          Submodule.toAddSubmonoid (Ideal.span s₀)
Tactic: obtain ⟨_, ⟨p₁, rfl⟩, q₁, hq₁, rfl⟩ := AddSubmonoid.mem_sup.mp h₁
Cleared hypotheses: x₁, hx_1, h₁