-- 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₀ : 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))
x : A
hx : x ∈ t
inr :
  HSub.hSub (α := B) (β := 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)
          ((MvPolynomial.C : (a : A) → MvPolynomial (Fin n) A) (↑(Subtype.mk (p := fun (x : A) ↦ x ∈ t) x hx) : A) :
            MvPolynomial (Fin n) A) :
        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)
          (((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' (Subtype.mk (p := fun (x : A) ↦ x ∈ t) x hx)) :
            MvPolynomial (Fin n) A) :
        B) =
    0
inr₁ :
  HSub.hSub (α := B) (β := 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)
          ((MvPolynomial.C : (a : A) → MvPolynomial (Fin n) A) (↑(Subtype.mk (p := fun (x : A) ↦ x ∈ t) x hx) : A) :
            MvPolynomial (Fin n) A) :
        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) R) → B)
          (t' (Subtype.mk (p := fun (x : A) ↦ x ∈ t) x hx)) :
        B) =
    0
⊢ 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)
        (g (Subtype.mk (p := fun (x : A) ↦ x ∈ t) x hx)) :
      B)
    (0 : B)
have inr₂ : HSub.hSub (α := B) (β := 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)
        ((MvPolynomial.C : (a : A) → MvPolynomial (Fin n) A) (↑(Subtype.mk (p := fun (x : A) ↦ x ∈ t) x hx) : A) :
          MvPolynomial (Fin n) A) :
      B)
    ((f : (a : MvPolynomial (Fin n) R) → B) (t' (Subtype.mk (p := fun (x : A) ↦ x ∈ t) x hx)) : B) =
  0
Tactic: rw [map_sub, MvPolynomial.aeval_map_algebraMap, ← aeval_unique,
          MvPolynomial.aeval_C, ht', Subtype.coe_mk, sub_self]