-- Lean 4 proof step from Mathlib.RingTheory.Etale.QuasiFinite (goal)
Goal:
R : Type u_2
S : Type u_3
R' : Type u_4
R'' : Type u_5
inst : CommRing R
inst_1 : CommRing S
inst_2 : Algebra R S
inst_3 : FiniteType R S
inst_4 : CommRing R'
inst_5 : Algebra R R'
inst_6 : CommRing R''
inst_7 : Algebra R R''
inst_8 : Algebra R'' S
inst_9 : Algebra.IsIntegral R R''
inst_10 : IsScalarTower R R'' S
q : Ideal S
P : Ideal R'
inst_11 : P.IsPrime
e : R' ⊗[R] S
e₀ : R' ⊗[R] R''
he₀ : IsIdempotentElem e₀
he₀e :
  ((TensorProduct.map (AlgHom.id R' R') (IsScalarTower.toAlgHom R R'' S) : R' ⊗[R] R'' →ₐ[R'] R' ⊗[R] S) :
        (a : R' ⊗[R] R'') → R' ⊗[R] S)
      e₀ =
    e
P' : Ideal (R' ⊗[R] S)
hP'q : Ideal.comap (F := S →+* R' ⊗[R] S) (AlgHom.toRingHom TensorProduct.includeRight) P' = q
H :
  ∀ (P'' : Ideal (R' ⊗[R] R'')),
    P''.IsPrime →
      P''.LiesOver P →
        e₀ ∉ P'' →
          P'' =
            Ideal.comap (F := R' ⊗[R] R'' →+* R' ⊗[R] S)
              (AlgHom.toRingHom
                (TensorProduct.map (AlgHom.id R' R') (IsScalarTower.toAlgHom R R'' S) : R' ⊗[R] R'' →ₐ[R'] R' ⊗[R] S))
              P'
g : R''
hgq : ((algebraMap R'' S : (a : R'') → S) g : S) ∉ q
hg :
  Function.Surjective.{u_5 + 1, u_3 + 1} (α := Localization.Away g) (β :=
    Localization.Away (M := S) ((algebraMap R'' S : (a : R'') → S) g : S))
    (⇑(Localization.awayMap (algebraMap R'' S) g) :
      (a : Localization.Away g) → Localization.Away ((algebraMap R'' S : (a : R'') → S) g))
this : Algebra.IsIntegral R' (Localization.Away e₀)
⊢ Function.Surjective (α :=
    Localization.Away (M := Localization.Away e₀)
      ((algebraMap (R' ⊗[R] R'') (Localization.Away e₀) : (a : R' ⊗[R] R'') → Localization.Away e₀) (1 ⊗ₜ[R] g)))
    (β :=
    Localization.Away (M :=
      Localization.Away (M := R' ⊗[R] S)
        (((TensorProduct.map (AlgHom.id R' R') (IsScalarTower.toAlgHom R R'' S) : R' ⊗[R] R'' →ₐ[R'] R' ⊗[R] S) :
              (a : R' ⊗[R] R'') → R' ⊗[R] S)
            e₀ :
          R' ⊗[R] S))
      ((Localization.awayMapₐ (TensorProduct.map (AlgHom.id R' R') (IsScalarTower.toAlgHom R R'' S)) e₀ :
            (a : Localization.Away e₀) →
              Localization.Away
                ((TensorProduct.map (AlgHom.id R' R') (IsScalarTower.toAlgHom R R'' S) : (a : R' ⊗[R] R'') → R' ⊗[R] S)
                  e₀))
          ((algebraMap (R' ⊗[R] R'') (Localization.Away e₀) : (a : R' ⊗[R] R'') → Localization.Away e₀) (1 ⊗ₜ[R] g)) :
        Localization.Away (M := R' ⊗[R] S)
          (((TensorProduct.map (AlgHom.id R' R') (IsScalarTower.toAlgHom R R'' S) : R' ⊗[R] R'' →ₐ[R'] R' ⊗[R] S) :
                (a : R' ⊗[R] R'') → R' ⊗[R] S)
              e₀ :
            R' ⊗[R] S)))
    (⇑(Localization.awayMapₐ
          (Localization.awayMapₐ (TensorProduct.map (AlgHom.id R' R') (IsScalarTower.toAlgHom R R'' S)) e₀)
          ((algebraMap (R' ⊗[R] R'') (Localization.Away e₀) : (a : R' ⊗[R] R'') → Localization.Away e₀) (1 ⊗ₜ[R] g))) :
      (a :
          Localization.Away
            ((algebraMap (R' ⊗[R] R'') (Localization.Away e₀) : (a : R' ⊗[R] R'') → Localization.Away e₀)
              (1 ⊗ₜ[R] g))) →
        Localization.Away
          ((Localization.awayMapₐ (TensorProduct.map (AlgHom.id R' R') (IsScalarTower.toAlgHom R R'' S)) e₀ :
              (a : Localization.Away e₀) →
                Localization.Away
                  ((TensorProduct.map (AlgHom.id R' R') (IsScalarTower.toAlgHom R R'' S) :
                      (a : R' ⊗[R] R'') → R' ⊗[R] S)
                    e₀))
            ((algebraMap (R' ⊗[R] R'') (Localization.Away e₀) : (a : R' ⊗[R] R'') → Localization.Away e₀) (1 ⊗ₜ[R] g))))
have H₁ : Function.Surjective (α := Localization.Away (e₀ * 1 ⊗ₜ[R] g)) (β :=
  Localization.Away (M := R' ⊗[R] S)
    (((AlgHom.toRingHom
              (TensorProduct.map (AlgHom.id R' R') (IsScalarTower.toAlgHom R R'' S) : R' ⊗[R] R'' →ₐ[R'] R' ⊗[R] S) :
            R' ⊗[R] R'' →+* R' ⊗[R] S) :
          (a : R' ⊗[R] R'') → R' ⊗[R] S)
        (e₀ * 1 ⊗ₜ[R] g) :
      R' ⊗[R] S))
  (⇑(Localization.awayMap
        (AlgHom.toRingHom
          (TensorProduct.map (AlgHom.id R' R') (IsScalarTower.toAlgHom R R'' S) : R' ⊗[R] R'' →ₐ[R'] R' ⊗[R] S))
        (e₀ * 1 ⊗ₜ[R] g)) :
    (a : Localization.Away (e₀ * 1 ⊗ₜ[R] g)) →
      Localization.Away
        (((TensorProduct.map (AlgHom.id R' R') (IsScalarTower.toAlgHom R R'' S)).toRingHom :
            (a : R' ⊗[R] R'') → R' ⊗[R] S)
          (e₀ * 1 ⊗ₜ[R] g)))
Tactic: apply Localization.awayMap_awayMap_surjective