/-- Lift a ring homomorphism that maps polynomials `φ : R[X] →+* S[X]`
to a `RatFunc R →+* RatFunc S`,
on the condition that `φ` maps non zero divisors to non zero divisors,
by mapping both the numerator and denominator and quotienting them. -/
def mapRingHom [RingHomClass F R[X] S[X]] (φ : F) (hφ : R[X]⁰ ≤ S[X]⁰.comap φ) :
    RatFunc R →+* RatFunc S :=
  { map φ hφ with
    map_zero' := by
      simp_rw [MonoidHom.toFun_eq_coe, ← ofFractionRing_zero, ← Localization.mk_zero (1 : R[X]⁰),
        ← Localization.mk_zero (1 : S[X]⁰), map_apply_ofFractionRing_mk, map_zero,
        Localization.mk_eq_mk', IsLocalization.mk'_zero]
    map_add' := by
      rintro ⟨x⟩ ⟨y⟩
      -- porting note: had to hint `induction` which induction principle to use
      induction x using Localization.rec
      induction y using Localization.rec
      · simp only [← ofFractionRing_add, Localization.add_mk, map_add, map_mul,
          MonoidHom.toFun_eq_coe, map_apply_ofFractionRing_mk, Submonoid.coe_mul]
        -- Porting note: `Submonoid.mk_mul_mk` couldn't be applied: motive incorrect,
        -- even though it is a rfl lemma.
        rfl
      · rfl
      · 

Proof state:
case ofFractionRing.ofFractionRing.H
K : Type u
inst✝⁵ : CommRing K
G₀ : Type u_1
L : Type u_2
R : Type u_3
S : Type u_4
F : Type u_5
inst✝⁴ : CommGroupWithZero G₀
inst✝³ : Field L
inst✝² : CommRing R
inst✝¹ : CommRing S
inst✝ : RingHomClass F R[X] S[X]
φ : F
hφ : R[X]⁰ ≤ Submonoid.comap φ S[X]⁰
src✝ : RatFunc R →* RatFunc S := map φ hφ
x y : FractionRing R[X]
a✝ c✝ : R[X]
b✝ d✝ : ↥R[X]⁰
h✝ : (Localization.r R[X]⁰) (a✝, b✝) (c✝, d✝)
⊢ (_ :
      OneHom.toFun
          (↑{ toOneHom := ↑src✝,
              map_mul' :=
                (_ :
                  ∀ (x y : RatFunc R),
                    OneHom.toFun (↑src✝) (x * y) = OneHom.toFun (↑src✝) x * OneHom.toFun (↑src✝) y) })
          ({ toFractionRing := Localization.mk c✝ d✝ } + { toFractionRing := y }) =
        OneHom.toFun
            ↑{ toOneHom := ↑src✝,
                map_mul' :=
                  (_ :
                    ∀ (x y : RatFunc R),
                      OneHom.toFun (↑src✝) (x * y) = OneHom.toFun (↑src✝) x * OneHom.toFun (↑src✝) y) }
            { toFractionRing := Localization.mk c✝ d✝ } +
          OneHom.toFun
            ↑{ toOneHom := ↑src✝,
                map_mul' :=
                  (_ :
                    ∀ (x y : RatFunc R),
                      OneHom.toFun (↑src✝) (x * y) = OneHom.toFun (↑src✝) x * OneHom.toFun (↑src✝) y) }
            { toFractionRing := y }) =
    (_ :
      OneHom.toFun
          (↑{ toOneHom := ↑src✝,
              map_mul' :=
                (_ :
                  ∀ (x y : RatFunc R),
                    OneHom.toFun (↑src✝) (x * y) = OneHom.toFun (↑src✝) x * OneHom.toFun (↑src✝) y) })
          ({ toFractionRing := Localization.mk c✝ d✝ } + { toFractionRing := y }) =
        OneHom.toFun
            ↑{ toOneHom := ↑src✝,
                map_mul' :=
                  (_ :
                    ∀ (x y : RatFunc R),
                      OneHom.toFun (↑src✝) (x * y) = OneHom.toFun (↑src✝) x * OneHom.toFun (↑src✝) y) }
            { toFractionRing := Localization.mk c✝ d✝ } +
          OneHom.toFun
            ↑{ toOneHom := ↑src✝,
                map_mul' :=
                  (_ :
                    ∀ (x y : RatFunc R),
                      OneHom.toFun (↑src✝) (x * y) = OneHom.toFun (↑src✝) x * OneHom.toFun (↑src✝) y) }
            { toFractionRing := y })

Next tactic:
rfl