-- Lean 4 proof step from Mathlib.RingTheory.IntegralClosure.IntegralRestrict (goal)
Goal:
A : Type u_1
B : Type u_6
inst : CommRing A
inst_1 : CommRing B
inst_2 : Algebra A B
Aₘ : Type u_9
Bₘ : Type u_10
inst_3 : CommRing Aₘ
inst_4 : CommRing Bₘ
inst_5 : Algebra Aₘ Bₘ
inst_6 : Algebra A Aₘ
inst_7 : Algebra B Bₘ
inst_8 : Algebra A Bₘ
inst_9 : IsScalarTower A Aₘ Bₘ
inst_10 : IsScalarTower A B Bₘ
M : Submonoid A
inst_11 : IsLocalization M Aₘ
inst_12 : IsLocalization (algebraMapSubmonoid B M) Bₘ
inst_13 : IsDomain A
inst_14 : IsIntegrallyClosed A
inst_15 : IsDomain B
inst_16 : IsIntegrallyClosed B
inst_17 : Module.Finite A B
inst_18 : IsTorsionFree A B
inst_19 : IsDomain Aₘ
inst_20 : IsIntegrallyClosed Aₘ
inst_21 : IsDomain Bₘ
inst_22 : IsIntegrallyClosed Bₘ
inst_23 : IsTorsionFree Aₘ Bₘ
inst_24 : Module.Finite Aₘ Bₘ
x : B
hM : M ≤ A⁰
K : Type u_1 := FractionRing A
L : Type u_6 := FractionRing B
this_1 : IsIntegralClosure B A L
this_2 : Algebra.IsAlgebraic.{u_1, u_6} (FractionRing A) (FractionRing B)
this_3 : IsLocalization (algebraMapSubmonoid.{u_1, u_6} (R := A) B A⁰) L
f : Aₘ →+* K := IsLocalization.map (M := M) (T := A⁰) K (RingHom.id A) hM
this_4 : Algebra Aₘ K := f.toAlgebra
this_5 : IsScalarTower A Aₘ K
this_6 : IsFractionRing Aₘ K := ⋯
g : Bₘ →+* L :=
  IsLocalization.map (M := algebraMapSubmonoid B M) (T := algebraMapSubmonoid.{u_1, u_6} (R := A) B A⁰) L (RingHom.id B)
    ⋯
this_7 : Algebra Bₘ L := g.toAlgebra
this_8 : IsScalarTower B Bₘ L
this_9 : Algebra Aₘ L := RingHom.toAlgebra (RingHom.comp (algebraMap K L) f)
this : IsScalarTower Aₘ K L
h :
  Eq (α := A →+* L) (RingHom.comp (RingHom.comp (algebraMap K L) f) (algebraMap A Aₘ))
    (@RingHom.comp _ _ _ _ Semiring.toNonAssocSemiring _
      (@RingHom.comp _ _ _ _ Semiring.toNonAssocSemiring _ (algebraMap Bₘ L) (algebraMap Aₘ Bₘ)) (algebraMap A Aₘ))
h₁ :
  Eq (α := A →+* L) (RingHom.comp (RingHom.comp (algebraMap K L) f) (algebraMap A Aₘ))
    (@RingHom.comp _ _ _ _ Semiring.toNonAssocSemiring _ (g.comp (algebraMap Aₘ Bₘ)) (algebraMap A Aₘ))
h₂ :
  Eq (α := A →+* L) (RingHom.comp (algebraMap K L) (f.comp (algebraMap A Aₘ)))
    (@RingHom.comp _ _ _ _ Semiring.toNonAssocSemiring _ (g.comp (algebraMap Aₘ Bₘ)) (algebraMap A Aₘ))
h₃ :
  Eq (α := A →+* L) (RingHom.comp (algebraMap K L) (f.comp (algebraMap A Aₘ)))
    (g.comp (@RingHom.comp _ _ _ _ Semiring.toNonAssocSemiring _ (algebraMap Aₘ Bₘ) (algebraMap A Aₘ)))
h₄ : Eq (α := A →+* L) (RingHom.comp (algebraMap K L) (f.comp (algebraMap A Aₘ))) (g.comp (algebraMap A Bₘ))
h₅ :
  Eq (α := A →+* L) (RingHom.comp (algebraMap K L) (f.comp (algebraMap A Aₘ)))
    (g.comp (@RingHom.comp _ _ _ _ Semiring.toNonAssocSemiring _ (algebraMap B Bₘ) (algebraMap A B)))
h₆ :
  Eq (α := A →+* L) (RingHom.comp (algebraMap K L) (RingHom.comp (algebraMap A K) (RingHom.id A)))
    (g.comp (@RingHom.comp _ _ _ _ Semiring.toNonAssocSemiring _ (algebraMap B Bₘ) (algebraMap A B)))
h₇ :
  Eq (α := A →+* L) (RingHom.comp (algebraMap K L) (algebraMap A K))
    (g.comp (@RingHom.comp _ _ _ _ Semiring.toNonAssocSemiring _ (algebraMap B Bₘ) (algebraMap A B)))
h₈ :
  Eq (α := A →+* L) (RingHom.comp (algebraMap K L) (algebraMap A K))
    (@RingHom.comp _ _ _ _ Semiring.toNonAssocSemiring _ (g.comp (algebraMap B Bₘ)) (algebraMap A B))
h₉ :
  Eq (α := A →+* L) (RingHom.comp (algebraMap K L) (algebraMap A K))
    (@RingHom.comp _ _ _ _ Semiring.toNonAssocSemiring _ (RingHom.comp (algebraMap B L) (RingHom.id B))
      (algebraMap A B))
h₁₀ :
  Eq (α := A →+* L) (RingHom.comp (algebraMap K L) (algebraMap A K))
    (@RingHom.comp _ _ _ _ Semiring.toNonAssocSemiring _ (algebraMap B L) (algebraMap A B))
h₁₁ :
  Eq (α := A →+* L) (algebraMap A L)
    (@RingHom.comp _ _ _ _ Semiring.toNonAssocSemiring _ (algebraMap B L) (algebraMap A B))
⊢ Eq (α := A →+* L) (@RingHom.comp _ _ _ _ Semiring.toNonAssocSemiring _ (algebraMap Aₘ L) (algebraMap A Aₘ))
    (@RingHom.comp _ _ _ _ Semiring.toNonAssocSemiring _
      (@RingHom.comp _ _ _ _ Semiring.toNonAssocSemiring _ (algebraMap Bₘ L) (algebraMap Aₘ Bₘ)) (algebraMap A Aₘ))
have h₁₂ : Eq (α := A →+* L) (algebraMap A L) (algebraMap A L)
Tactic: rw [RingHom.algebraMap_toAlgebra, RingHom.algebraMap_toAlgebra (R := Bₘ), RingHom.comp_assoc,
      RingHom.comp_assoc, ← IsScalarTower.algebraMap_eq, IsScalarTower.algebraMap_eq A B Bₘ,
      IsLocalization.map_comp, RingHom.comp_id, ← RingHom.comp_assoc, IsLocalization.map_comp,
      RingHom.comp_id, ← IsScalarTower.algebraMap_eq, ← IsScalarTower.algebraMap_eq]