l3lab/ntp-mathlib huggingface dataset:
/-- Lift an injective ring homomorphism `R[X] →+* L` to a `RatFunc R →+* L`
by mapping both the numerator and denominator and quotienting them. -/
def liftRingHom (φ : R[X] →+* L) (hφ : R[X]⁰ ≤ L⁰.comap φ) : RatFunc R →+* L :=
  { liftMonoidWithZeroHom φ.toMonoidWithZeroHom hφ with
    map_add' := fun x y => by
      -- porting note: used to invoke `MonoidWithZeroHom.toFun_eq_coe`
      simp only [ZeroHom.toFun_eq_coe, MonoidWithZeroHom.toZeroHom_coe]
      cases subsingleton_or_nontrivial R
      · rw [Subsingleton.elim (x + y) y, Subsingleton.elim x 0, map_zero, zero_add]
      cases' x with x
      cases' y with y
      -- Porting note: had to add the recursor explicitly below
      induction' x using Localization.rec with p q
      

Proof state:
case inr.ofFractionRing.ofFractionRing.f
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
φ : R[X] →+* L
hφ : R[X]⁰ ≤ Submonoid.comap φ L⁰
src✝ : RatFunc R →*₀ L := liftMonoidWithZeroHom (RingHom.toMonoidWithZeroHom φ) hφ
h✝ : Nontrivial R
y : FractionRing R[X]
p : R[X]
q : ↥R[X]⁰
⊢ (liftMonoidWithZeroHom (RingHom.toMonoidWithZeroHom φ) hφ)
      ({ toFractionRing := Localization.mk p q } + { toFractionRing := y }) =
    (liftMonoidWithZeroHom (RingHom.toMonoidWithZeroHom φ) hφ) { toFractionRing := Localization.mk p q } +
      (liftMonoidWithZeroHom (RingHom.toMonoidWithZeroHom φ) hφ) { toFractionRing := y }
case inr.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
φ : R[X] →+* L
hφ : R[X]⁰ ≤ Submonoid.comap φ L⁰
src✝ : RatFunc R →*₀ L := liftMonoidWithZeroHom (RingHom.toMonoidWithZeroHom φ) hφ
h✝¹ : Nontrivial R
x y : FractionRing R[X]
a✝ c✝ : R[X]
b✝ d✝ : ↥R[X]⁰
h✝ : (Localization.r R[X]⁰) (a✝, b✝) (c✝, d✝)
⊢ (_ :
      (liftMonoidWithZeroHom (RingHom.toMonoidWithZeroHom φ) hφ)
          ({ toFractionRing := Localization.mk c✝ d✝ } + { toFractionRing := y }) =
        (liftMonoidWithZeroHom (RingHom.toMonoidWithZeroHom φ) hφ) { toFractionRing := Localization.mk c✝ d✝ } +
          (liftMonoidWithZeroHom (RingHom.toMonoidWithZeroHom φ) hφ) { toFractionRing := y }) =
    (_ :
      (liftMonoidWithZeroHom (RingHom.toMonoidWithZeroHom φ) hφ)
          ({ toFractionRing := Localization.mk c✝ d✝ } + { toFractionRing := y }) =
        (liftMonoidWithZeroHom (RingHom.toMonoidWithZeroHom φ) hφ) { toFractionRing := Localization.mk c✝ d✝ } +
          (liftMonoidWithZeroHom (RingHom.toMonoidWithZeroHom φ) hφ) { toFractionRing := y })

Next tactic:
induction' y using Localization.rec with p' q'
/-- Lift an injective ring homomorphism `R[X] →+* L` to a `RatFunc R →+* L`
by mapping both the numerator and denominator and quotienting them. -/
def liftRingHom (φ : R[X] →+* L) (hφ : R[X]⁰ ≤ L⁰.comap φ) : RatFunc R →+* L :=
  { liftMonoidWithZeroHom φ.toMonoidWithZeroHom hφ with
    map_add' := fun x y => by
      -- porting note: used to invoke `MonoidWithZeroHom.toFun_eq_coe`
      simp only [ZeroHom.toFun_eq_coe, MonoidWithZeroHom.toZeroHom_coe]
      cases subsingleton_or_nontrivial R
      · rw [Subsingleton.elim (x + y) y, Subsingleton.elim x 0, map_zero, zero_add]
      cases' x with x
      cases' y with y
      -- Porting note: had to add the recursor explicitly below
      induction' x using Localization.rec with p q
      induction' y using Localization.rec with p' q'
      · 

Proof state:
case inr.ofFractionRing.ofFractionRing.f.f
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
φ : R[X] →+* L
hφ : R[X]⁰ ≤ Submonoid.comap φ L⁰
src✝ : RatFunc R →*₀ L := liftMonoidWithZeroHom (RingHom.toMonoidWithZeroHom φ) hφ
h✝ : Nontrivial R
p : R[X]
q : ↥R[X]⁰
p' : R[X]
q' : ↥R[X]⁰
⊢ (liftMonoidWithZeroHom (RingHom.toMonoidWithZeroHom φ) hφ)
      ({ toFractionRing := Localization.mk p q } + { toFractionRing := Localization.mk p' q' }) =
    (liftMonoidWithZeroHom (RingHom.toMonoidWithZeroHom φ) hφ) { toFractionRing := Localization.mk p q } +
      (liftMonoidWithZeroHom (RingHom.toMonoidWithZeroHom φ) hφ) { toFractionRing := Localization.mk p' q' }

Next tactic:
rw [← ofFractionRing_add, Localization.add_mk]
/-- Lift an injective ring homomorphism `R[X] →+* L` to a `RatFunc R →+* L`
by mapping both the numerator and denominator and quotienting them. -/
def liftRingHom (φ : R[X] →+* L) (hφ : R[X]⁰ ≤ L⁰.comap φ) : RatFunc R →+* L :=
  { liftMonoidWithZeroHom φ.toMonoidWithZeroHom hφ with
    map_add' := fun x y => by
      -- porting note: used to invoke `MonoidWithZeroHom.toFun_eq_coe`
      simp only [ZeroHom.toFun_eq_coe, MonoidWithZeroHom.toZeroHom_coe]
      cases subsingleton_or_nontrivial R
      · rw [Subsingleton.elim (x + y) y, Subsingleton.elim x 0, map_zero, zero_add]
      cases' x with x
      cases' y with y
      -- Porting note: had to add the recursor explicitly below
      induction' x using Localization.rec with p q
      induction' y using Localization.rec with p' q'
      · rw [← ofFractionRing_add, Localization.add_mk]
        

Proof state:
case inr.ofFractionRing.ofFractionRing.f.f
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
φ : R[X] →+* L
hφ : R[X]⁰ ≤ Submonoid.comap φ L⁰
src✝ : RatFunc R →*₀ L := liftMonoidWithZeroHom (RingHom.toMonoidWithZeroHom φ) hφ
h✝ : Nontrivial R
p : R[X]
q : ↥R[X]⁰
p' : R[X]
q' : ↥R[X]⁰
⊢ (liftMonoidWithZeroHom (RingHom.toMonoidWithZeroHom φ) hφ)
      { toFractionRing := Localization.mk (↑q * p' + ↑q' * p) (q * q') } =
    (liftMonoidWithZeroHom (RingHom.toMonoidWithZeroHom φ) hφ) { toFractionRing := Localization.mk p q } +
      (liftMonoidWithZeroHom (RingHom.toMonoidWithZeroHom φ) hφ) { toFractionRing := Localization.mk p' q' }

Next tactic:
simp only [RingHom.toMonoidWithZeroHom_eq_coe,
          liftMonoidWithZeroHom_apply_ofFractionRing_mk]
/-- Lift an injective ring homomorphism `R[X] →+* L` to a `RatFunc R →+* L`
by mapping both the numerator and denominator and quotienting them. -/
def liftRingHom (φ : R[X] →+* L) (hφ : R[X]⁰ ≤ L⁰.comap φ) : RatFunc R →+* L :=
  { liftMonoidWithZeroHom φ.toMonoidWithZeroHom hφ with
    map_add' := fun x y => by
      -- porting note: used to invoke `MonoidWithZeroHom.toFun_eq_coe`
      simp only [ZeroHom.toFun_eq_coe, MonoidWithZeroHom.toZeroHom_coe]
      cases subsingleton_or_nontrivial R
      · rw [Subsingleton.elim (x + y) y, Subsingleton.elim x 0, map_zero, zero_add]
      cases' x with x
      cases' y with y
      -- Porting note: had to add the recursor explicitly below
      induction' x using Localization.rec with p q
      induction' y using Localization.rec with p' q'
      · rw [← ofFractionRing_add, Localization.add_mk]
        simp only [RingHom.toMonoidWithZeroHom_eq_coe,
          liftMonoidWithZeroHom_apply_ofFractionRing_mk]
        

Proof state:
case inr.ofFractionRing.ofFractionRing.f.f
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
φ : R[X] →+* L
hφ : R[X]⁰ ≤ Submonoid.comap φ L⁰
src✝ : RatFunc R →*₀ L := liftMonoidWithZeroHom (RingHom.toMonoidWithZeroHom φ) hφ
h✝ : Nontrivial R
p : R[X]
q : ↥R[X]⁰
p' : R[X]
q' : ↥R[X]⁰
⊢ φ (↑q * p' + ↑q' * p) / φ ↑(q * q') = φ p / φ ↑q + φ p' / φ ↑q'

Next tactic:
rw [div_add_div, div_eq_div_iff]
/-- Lift an injective ring homomorphism `R[X] →+* L` to a `RatFunc R →+* L`
by mapping both the numerator and denominator and quotienting them. -/
def liftRingHom (φ : R[X] →+* L) (hφ : R[X]⁰ ≤ L⁰.comap φ) : RatFunc R →+* L :=
  { liftMonoidWithZeroHom φ.toMonoidWithZeroHom hφ with
    map_add' := fun x y => by
      -- porting note: used to invoke `MonoidWithZeroHom.toFun_eq_coe`
      simp only [ZeroHom.toFun_eq_coe, MonoidWithZeroHom.toZeroHom_coe]
      cases subsingleton_or_nontrivial R
      · rw [Subsingleton.elim (x + y) y, Subsingleton.elim x 0, map_zero, zero_add]
      cases' x with x
      cases' y with y
      -- Porting note: had to add the recursor explicitly below
      induction' x using Localization.rec with p q
      induction' y using Localization.rec with p' q'
      · rw [← ofFractionRing_add, Localization.add_mk]
        simp only [RingHom.toMonoidWithZeroHom_eq_coe,
          liftMonoidWithZeroHom_apply_ofFractionRing_mk]
        rw [div_add_div, div_eq_div_iff]
        · 

Proof state:
case inr.ofFractionRing.ofFractionRing.f.f
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
φ : R[X] →+* L
hφ : R[X]⁰ ≤ Submonoid.comap φ L⁰
src✝ : RatFunc R →*₀ L := liftMonoidWithZeroHom (RingHom.toMonoidWithZeroHom φ) hφ
h✝ : Nontrivial R
p : R[X]
q : ↥R[X]⁰
p' : R[X]
q' : ↥R[X]⁰
⊢ φ (↑q * p' + ↑q' * p) * (φ ↑q * φ ↑q') = (φ p * φ ↑q' + φ ↑q * φ p') * φ ↑(q * q')

Next tactic:
rw [mul_comm _ p, mul_comm _ p', mul_comm _ (φ p'), add_comm]
/-- Lift an injective ring homomorphism `R[X] →+* L` to a `RatFunc R →+* L`
by mapping both the numerator and denominator and quotienting them. -/
def liftRingHom (φ : R[X] →+* L) (hφ : R[X]⁰ ≤ L⁰.comap φ) : RatFunc R →+* L :=
  { liftMonoidWithZeroHom φ.toMonoidWithZeroHom hφ with
    map_add' := fun x y => by
      -- porting note: used to invoke `MonoidWithZeroHom.toFun_eq_coe`
      simp only [ZeroHom.toFun_eq_coe, MonoidWithZeroHom.toZeroHom_coe]
      cases subsingleton_or_nontrivial R
      · rw [Subsingleton.elim (x + y) y, Subsingleton.elim x 0, map_zero, zero_add]
      cases' x with x
      cases' y with y
      -- Porting note: had to add the recursor explicitly below
      induction' x using Localization.rec with p q
      induction' y using Localization.rec with p' q'
      · rw [← ofFractionRing_add, Localization.add_mk]
        simp only [RingHom.toMonoidWithZeroHom_eq_coe,
          liftMonoidWithZeroHom_apply_ofFractionRing_mk]
        rw [div_add_div, div_eq_div_iff]
        · rw [mul_comm _ p, mul_comm _ p', mul_comm _ (φ p'), add_comm]
          

Proof state:
case inr.ofFractionRing.ofFractionRing.f.f
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
φ : R[X] →+* L
hφ : R[X]⁰ ≤ Submonoid.comap φ L⁰
src✝ : RatFunc R →*₀ L := liftMonoidWithZeroHom (RingHom.toMonoidWithZeroHom φ) hφ
h✝ : Nontrivial R
p : R[X]
q : ↥R[X]⁰
p' : R[X]
q' : ↥R[X]⁰
⊢ φ (p * ↑q' + p' * ↑q) * (φ ↑q * φ ↑q') = (φ p * φ ↑q' + φ p' * φ ↑q) * φ ↑(q * q')

Next tactic:
simp only [map_add, map_mul, Submonoid.coe_mul]
/-- Lift an injective ring homomorphism `R[X] →+* L` to a `RatFunc R →+* L`
by mapping both the numerator and denominator and quotienting them. -/
def liftRingHom (φ : R[X] →+* L) (hφ : R[X]⁰ ≤ L⁰.comap φ) : RatFunc R →+* L :=
  { liftMonoidWithZeroHom φ.toMonoidWithZeroHom hφ with
    map_add' := fun x y => by
      -- porting note: used to invoke `MonoidWithZeroHom.toFun_eq_coe`
      simp only [ZeroHom.toFun_eq_coe, MonoidWithZeroHom.toZeroHom_coe]
      cases subsingleton_or_nontrivial R
      · rw [Subsingleton.elim (x + y) y, Subsingleton.elim x 0, map_zero, zero_add]
      cases' x with x
      cases' y with y
      -- Porting note: had to add the recursor explicitly below
      induction' x using Localization.rec with p q
      induction' y using Localization.rec with p' q'
      · rw [← ofFractionRing_add, Localization.add_mk]
        simp only [RingHom.toMonoidWithZeroHom_eq_coe,
          liftMonoidWithZeroHom_apply_ofFractionRing_mk]
        rw [div_add_div, div_eq_div_iff]
        · rw [mul_comm _ p, mul_comm _ p', mul_comm _ (φ p'), add_comm]
          simp only [map_add, map_mul, Submonoid.coe_mul]
        

Proof state:
case inr.ofFractionRing.ofFractionRing.f.f.hb
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
φ : R[X] →+* L
hφ : R[X]⁰ ≤ Submonoid.comap φ L⁰
src✝ : RatFunc R →*₀ L := liftMonoidWithZeroHom (RingHom.toMonoidWithZeroHom φ) hφ
h✝ : Nontrivial R
p : R[X]
q : ↥R[X]⁰
p' : R[X]
q' : ↥R[X]⁰
⊢ φ ↑(q * q') ≠ 0
case inr.ofFractionRing.ofFractionRing.f.f.hd
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
φ : R[X] →+* L
hφ : R[X]⁰ ≤ Submonoid.comap φ L⁰
src✝ : RatFunc R →*₀ L := liftMonoidWithZeroHom (RingHom.toMonoidWithZeroHom φ) hφ
h✝ : Nontrivial R
p : R[X]
q : ↥R[X]⁰
p' : R[X]
q' : ↥R[X]⁰
⊢ φ ↑q * φ ↑q' ≠ 0
case inr.ofFractionRing.ofFractionRing.f.f.hb
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
φ : R[X] →+* L
hφ : R[X]⁰ ≤ Submonoid.comap φ L⁰
src✝ : RatFunc R →*₀ L := liftMonoidWithZeroHom (RingHom.toMonoidWithZeroHom φ) hφ
h✝ : Nontrivial R
p : R[X]
q : ↥R[X]⁰
p' : R[X]
q' : ↥R[X]⁰
⊢ φ ↑q ≠ 0
case inr.ofFractionRing.ofFractionRing.f.f.hd
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
φ : R[X] →+* L
hφ : R[X]⁰ ≤ Submonoid.comap φ L⁰
src✝ : RatFunc R →*₀ L := liftMonoidWithZeroHom (RingHom.toMonoidWithZeroHom φ) hφ
h✝ : Nontrivial R
p : R[X]
q : ↥R[X]⁰
p' : R[X]
q' : ↥R[X]⁰
⊢ φ ↑q' ≠ 0

Next tactic:
all_goals
          try simp only [← map_mul, ← Submonoid.coe_mul]
          exact nonZeroDivisors.ne_zero (hφ (SetLike.coe_mem _))
/-- Lift an injective ring homomorphism `R[X] →+* L` to a `RatFunc R →+* L`
by mapping both the numerator and denominator and quotienting them. -/
def liftRingHom (φ : R[X] →+* L) (hφ : R[X]⁰ ≤ L⁰.comap φ) : RatFunc R →+* L :=
  { liftMonoidWithZeroHom φ.toMonoidWithZeroHom hφ with
    map_add' := fun x y => by
      -- porting note: used to invoke `MonoidWithZeroHom.toFun_eq_coe`
      simp only [ZeroHom.toFun_eq_coe, MonoidWithZeroHom.toZeroHom_coe]
      cases subsingleton_or_nontrivial R
      · rw [Subsingleton.elim (x + y) y, Subsingleton.elim x 0, map_zero, zero_add]
      cases' x with x
      cases' y with y
      -- Porting note: had to add the recursor explicitly below
      induction' x using Localization.rec with p q
      induction' y using Localization.rec with p' q'
      · rw [← ofFractionRing_add, Localization.add_mk]
        simp only [RingHom.toMonoidWithZeroHom_eq_coe,
          liftMonoidWithZeroHom_apply_ofFractionRing_mk]
        rw [div_add_div, div_eq_div_iff]
        · rw [mul_comm _ p, mul_comm _ p', mul_comm _ (φ p'), add_comm]
          simp only [map_add, map_mul, Submonoid.coe_mul]
        all_goals
          

Proof state:
case inr.ofFractionRing.ofFractionRing.f.f.hb
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
φ : R[X] →+* L
hφ : R[X]⁰ ≤ Submonoid.comap φ L⁰
src✝ : RatFunc R →*₀ L := liftMonoidWithZeroHom (RingHom.toMonoidWithZeroHom φ) hφ
h✝ : Nontrivial R
p : R[X]
q : ↥R[X]⁰
p' : R[X]
q' : ↥R[X]⁰
⊢ φ ↑(q * q') ≠ 0

Next tactic:
try simp only [← map_mul, ← Submonoid.coe_mul]
/-- Lift an injective ring homomorphism `R[X] →+* L` to a `RatFunc R →+* L`
by mapping both the numerator and denominator and quotienting them. -/
def liftRingHom (φ : R[X] →+* L) (hφ : R[X]⁰ ≤ L⁰.comap φ) : RatFunc R →+* L :=
  { liftMonoidWithZeroHom φ.toMonoidWithZeroHom hφ with
    map_add' := fun x y => by
      -- porting note: used to invoke `MonoidWithZeroHom.toFun_eq_coe`
      simp only [ZeroHom.toFun_eq_coe, MonoidWithZeroHom.toZeroHom_coe]
      cases subsingleton_or_nontrivial R
      · rw [Subsingleton.elim (x + y) y, Subsingleton.elim x 0, map_zero, zero_add]
      cases' x with x
      cases' y with y
      -- Porting note: had to add the recursor explicitly below
      induction' x using Localization.rec with p q
      induction' y using Localization.rec with p' q'
      · rw [← ofFractionRing_add, Localization.add_mk]
        simp only [RingHom.toMonoidWithZeroHom_eq_coe,
          liftMonoidWithZeroHom_apply_ofFractionRing_mk]
        rw [div_add_div, div_eq_div_iff]
        · rw [mul_comm _ p, mul_comm _ p', mul_comm _ (φ p'), add_comm]
          simp only [map_add, map_mul, Submonoid.coe_mul]
        all_goals
          try 

Proof state:
case inr.ofFractionRing.ofFractionRing.f.f.hb
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
φ : R[X] →+* L
hφ : R[X]⁰ ≤ Submonoid.comap φ L⁰
src✝ : RatFunc R →*₀ L := liftMonoidWithZeroHom (RingHom.toMonoidWithZeroHom φ) hφ
h✝ : Nontrivial R
p : R[X]
q : ↥R[X]⁰
p' : R[X]
q' : ↥R[X]⁰
⊢ φ ↑(q * q') ≠ 0

Next tactic:
simp only [← map_mul, ← Submonoid.coe_mul]
/-- Lift an injective ring homomorphism `R[X] →+* L` to a `RatFunc R →+* L`
by mapping both the numerator and denominator and quotienting them. -/
def liftRingHom (φ : R[X] →+* L) (hφ : R[X]⁰ ≤ L⁰.comap φ) : RatFunc R →+* L :=
  { liftMonoidWithZeroHom φ.toMonoidWithZeroHom hφ with
    map_add' := fun x y => by
      -- porting note: used to invoke `MonoidWithZeroHom.toFun_eq_coe`
      simp only [ZeroHom.toFun_eq_coe, MonoidWithZeroHom.toZeroHom_coe]
      cases subsingleton_or_nontrivial R
      · rw [Subsingleton.elim (x + y) y, Subsingleton.elim x 0, map_zero, zero_add]
      cases' x with x
      cases' y with y
      -- Porting note: had to add the recursor explicitly below
      induction' x using Localization.rec with p q
      induction' y using Localization.rec with p' q'
      · rw [← ofFractionRing_add, Localization.add_mk]
        simp only [RingHom.toMonoidWithZeroHom_eq_coe,
          liftMonoidWithZeroHom_apply_ofFractionRing_mk]
        rw [div_add_div, div_eq_div_iff]
        · rw [mul_comm _ p, mul_comm _ p', mul_comm _ (φ p'), add_comm]
          simp only [map_add, map_mul, Submonoid.coe_mul]
        all_goals
          try simp only [← map_mul, ← Submonoid.coe_mul]
          

Proof state:
case inr.ofFractionRing.ofFractionRing.f.f.hb
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
φ : R[X] →+* L
hφ : R[X]⁰ ≤ Submonoid.comap φ L⁰
src✝ : RatFunc R →*₀ L := liftMonoidWithZeroHom (RingHom.toMonoidWithZeroHom φ) hφ
h✝ : Nontrivial R
p : R[X]
q : ↥R[X]⁰
p' : R[X]
q' : ↥R[X]⁰
⊢ φ ↑(q * q') ≠ 0

Next tactic:
exact nonZeroDivisors.ne_zero (hφ (SetLike.coe_mem _))
/-- Lift an injective ring homomorphism `R[X] →+* L` to a `RatFunc R →+* L`
by mapping both the numerator and denominator and quotienting them. -/
def liftRingHom (φ : R[X] →+* L) (hφ : R[X]⁰ ≤ L⁰.comap φ) : RatFunc R →+* L :=
  { liftMonoidWithZeroHom φ.toMonoidWithZeroHom hφ with
    map_add' := fun x y => by
      -- porting note: used to invoke `MonoidWithZeroHom.toFun_eq_coe`
      simp only [ZeroHom.toFun_eq_coe, MonoidWithZeroHom.toZeroHom_coe]
      cases subsingleton_or_nontrivial R
      · rw [Subsingleton.elim (x + y) y, Subsingleton.elim x 0, map_zero, zero_add]
      cases' x with x
      cases' y with y
      -- Porting note: had to add the recursor explicitly below
      induction' x using Localization.rec with p q
      induction' y using Localization.rec with p' q'
      · rw [← ofFractionRing_add, Localization.add_mk]
        simp only [RingHom.toMonoidWithZeroHom_eq_coe,
          liftMonoidWithZeroHom_apply_ofFractionRing_mk]
        rw [div_add_div, div_eq_div_iff]
        · rw [mul_comm _ p, mul_comm _ p', mul_comm _ (φ p'), add_comm]
          simp only [map_add, map_mul, Submonoid.coe_mul]
        all_goals
          

Proof state:
case inr.ofFractionRing.ofFractionRing.f.f.hd
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
φ : R[X] →+* L
hφ : R[X]⁰ ≤ Submonoid.comap φ L⁰
src✝ : RatFunc R →*₀ L := liftMonoidWithZeroHom (RingHom.toMonoidWithZeroHom φ) hφ
h✝ : Nontrivial R
p : R[X]
q : ↥R[X]⁰
p' : R[X]
q' : ↥R[X]⁰
⊢ φ ↑q * φ ↑q' ≠ 0

Next tactic:
try simp only [← map_mul, ← Submonoid.coe_mul]
/-- Lift an injective ring homomorphism `R[X] →+* L` to a `RatFunc R →+* L`
by mapping both the numerator and denominator and quotienting them. -/
def liftRingHom (φ : R[X] →+* L) (hφ : R[X]⁰ ≤ L⁰.comap φ) : RatFunc R →+* L :=
  { liftMonoidWithZeroHom φ.toMonoidWithZeroHom hφ with
    map_add' := fun x y => by
      -- porting note: used to invoke `MonoidWithZeroHom.toFun_eq_coe`
      simp only [ZeroHom.toFun_eq_coe, MonoidWithZeroHom.toZeroHom_coe]
      cases subsingleton_or_nontrivial R
      · rw [Subsingleton.elim (x + y) y, Subsingleton.elim x 0, map_zero, zero_add]
      cases' x with x
      cases' y with y
      -- Porting note: had to add the recursor explicitly below
      induction' x using Localization.rec with p q
      induction' y using Localization.rec with p' q'
      · rw [← ofFractionRing_add, Localization.add_mk]
        simp only [RingHom.toMonoidWithZeroHom_eq_coe,
          liftMonoidWithZeroHom_apply_ofFractionRing_mk]
        rw [div_add_div, div_eq_div_iff]
        · rw [mul_comm _ p, mul_comm _ p', mul_comm _ (φ p'), add_comm]
          simp only [map_add, map_mul, Submonoid.coe_mul]
        all_goals
          try 

Proof state:
case inr.ofFractionRing.ofFractionRing.f.f.hd
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
φ : R[X] →+* L
hφ : R[X]⁰ ≤ Submonoid.comap φ L⁰
src✝ : RatFunc R →*₀ L := liftMonoidWithZeroHom (RingHom.toMonoidWithZeroHom φ) hφ
h✝ : Nontrivial R
p : R[X]
q : ↥R[X]⁰
p' : R[X]
q' : ↥R[X]⁰
⊢ φ ↑q * φ ↑q' ≠ 0

Next tactic:
simp only [← map_mul, ← Submonoid.coe_mul]
/-- Lift an injective ring homomorphism `R[X] →+* L` to a `RatFunc R →+* L`
by mapping both the numerator and denominator and quotienting them. -/
def liftRingHom (φ : R[X] →+* L) (hφ : R[X]⁰ ≤ L⁰.comap φ) : RatFunc R →+* L :=
  { liftMonoidWithZeroHom φ.toMonoidWithZeroHom hφ with
    map_add' := fun x y => by
      -- porting note: used to invoke `MonoidWithZeroHom.toFun_eq_coe`
      simp only [ZeroHom.toFun_eq_coe, MonoidWithZeroHom.toZeroHom_coe]
      cases subsingleton_or_nontrivial R
      · rw [Subsingleton.elim (x + y) y, Subsingleton.elim x 0, map_zero, zero_add]
      cases' x with x
      cases' y with y
      -- Porting note: had to add the recursor explicitly below
      induction' x using Localization.rec with p q
      induction' y using Localization.rec with p' q'
      · rw [← ofFractionRing_add, Localization.add_mk]
        simp only [RingHom.toMonoidWithZeroHom_eq_coe,
          liftMonoidWithZeroHom_apply_ofFractionRing_mk]
        rw [div_add_div, div_eq_div_iff]
        · rw [mul_comm _ p, mul_comm _ p', mul_comm _ (φ p'), add_comm]
          simp only [map_add, map_mul, Submonoid.coe_mul]
        all_goals
          try simp only [← map_mul, ← Submonoid.coe_mul]
          

Proof state:
case inr.ofFractionRing.ofFractionRing.f.f.hd
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
φ : R[X] →+* L
hφ : R[X]⁰ ≤ Submonoid.comap φ L⁰
src✝ : RatFunc R →*₀ L := liftMonoidWithZeroHom (RingHom.toMonoidWithZeroHom φ) hφ
h✝ : Nontrivial R
p : R[X]
q : ↥R[X]⁰
p' : R[X]
q' : ↥R[X]⁰
⊢ φ ↑(q * q') ≠ 0

Next tactic:
exact nonZeroDivisors.ne_zero (hφ (SetLike.coe_mem _))