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
      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 ≠ 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 ≠ 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 ≠ 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' ≠ 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' ≠ 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' ≠ 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
          try simp only [← map_mul, ← Submonoid.coe_mul]
          exact nonZeroDivisors.ne_zero (hφ (SetLike.coe_mem _))
      · 

Proof state:
case inr.ofFractionRing.ofFractionRing.f.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
y : FractionRing R[X]
p : R[X]
q : ↥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 p q } + { toFractionRing := Localization.mk c✝ d✝ }) =
        (liftMonoidWithZeroHom (RingHom.toMonoidWithZeroHom φ) hφ) { toFractionRing := Localization.mk p q } +
          (liftMonoidWithZeroHom (RingHom.toMonoidWithZeroHom φ) hφ) { toFractionRing := Localization.mk c✝ d✝ }) =
    (_ :
      (liftMonoidWithZeroHom (RingHom.toMonoidWithZeroHom φ) hφ)
          ({ toFractionRing := Localization.mk p q } + { toFractionRing := Localization.mk c✝ d✝ }) =
        (liftMonoidWithZeroHom (RingHom.toMonoidWithZeroHom φ) hφ) { toFractionRing := Localization.mk p q } +
          (liftMonoidWithZeroHom (RingHom.toMonoidWithZeroHom φ) hφ) { toFractionRing := Localization.mk c✝ d✝ })

Next tactic:
rfl
/-- 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]
          exact nonZeroDivisors.ne_zero (hφ (SetLike.coe_mem _))
      · rfl
      · 

Proof state:
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:
rfl
instance instField [IsDomain K] : Field (RatFunc K) :=
  { RatFunc.instCommRing K, RatFunc.instNontrivial K with
    inv := Inv.inv
    -- porting note: used to be `by frac_tac`
    inv_zero := by rw [← ofFractionRing_zero, ← ofFractionRing_inv, inv_zero]
    div := (· / ·)
    div_eq_mul_inv := by 

Proof state:
K : Type u
inst✝¹ : CommRing K
inst✝ : IsDomain K
src✝¹ : CommRing (RatFunc K) := instCommRing K
src✝ : Nontrivial (RatFunc K) := instNontrivial K
⊢ ∀ (a b : RatFunc K), a / b = a * b⁻¹

Next tactic:
frac_tac
instance instField [IsDomain K] : Field (RatFunc K) :=
  { RatFunc.instCommRing K, RatFunc.instNontrivial K with
    inv := Inv.inv
    -- porting note: used to be `by frac_tac`
    inv_zero := by 

Proof state:
K : Type u
inst✝¹ : CommRing K
inst✝ : IsDomain K
src✝¹ : CommRing (RatFunc K) := instCommRing K
src✝ : Nontrivial (RatFunc K) := instNontrivial K
⊢ 0⁻¹ = 0

Next tactic:
rw [← ofFractionRing_zero, ← ofFractionRing_inv, inv_zero]
instance (R : Type*) [CommSemiring R] [Algebra R K[X]] : Algebra R (RatFunc K) where
  toFun x := RatFunc.mk (algebraMap _ _ x) 1
  map_add' x y := by simp only [mk_one', RingHom.map_add, ofFractionRing_add]
  map_mul' x y := by simp only [mk_one', RingHom.map_mul, ofFractionRing_mul]
  map_one' := by 

Proof state:
K : Type u
inst✝³ : CommRing K
inst✝² : IsDomain K
R : Type u_1
inst✝¹ : CommSemiring R
inst✝ : Algebra R K[X]
⊢ (fun x => RatFunc.mk ((algebraMap R K[X]) x) 1) 1 = 1

Next tactic:
simp only [mk_one', RingHom.map_one, ofFractionRing_one]
instance (R : Type*) [CommSemiring R] [Algebra R K[X]] : Algebra R (RatFunc K) where
  toFun x := RatFunc.mk (algebraMap _ _ x) 1
  map_add' x y := by simp only [mk_one', RingHom.map_add, ofFractionRing_add]
  map_mul' x y := by 

Proof state:
K : Type u
inst✝³ : CommRing K
inst✝² : IsDomain K
R : Type u_1
inst✝¹ : CommSemiring R
inst✝ : Algebra R K[X]
x y : R
⊢ OneHom.toFun
      { toFun := fun x => RatFunc.mk ((algebraMap R K[X]) x) 1,
        map_one' := (_ : RatFunc.mk ((algebraMap R K[X]) 1) 1 = 1) }
      (x * y) =
    OneHom.toFun
        { toFun := fun x => RatFunc.mk ((algebraMap R K[X]) x) 1,
          map_one' := (_ : RatFunc.mk ((algebraMap R K[X]) 1) 1 = 1) }
        x *
      OneHom.toFun
        { toFun := fun x => RatFunc.mk ((algebraMap R K[X]) x) 1,
          map_one' := (_ : RatFunc.mk ((algebraMap R K[X]) 1) 1 = 1) }
        y

Next tactic:
simp only [mk_one', RingHom.map_mul, ofFractionRing_mul]
instance (R : Type*) [CommSemiring R] [Algebra R K[X]] : Algebra R (RatFunc K) where
  toFun x := RatFunc.mk (algebraMap _ _ x) 1
  map_add' x y := by simp only [mk_one', RingHom.map_add, ofFractionRing_add]
  map_mul' x y := by simp only [mk_one', RingHom.map_mul, ofFractionRing_mul]
  map_one' := by simp only [mk_one', RingHom.map_one, ofFractionRing_one]
  map_zero' := by 

Proof state:
K : Type u
inst✝³ : CommRing K
inst✝² : IsDomain K
R : Type u_1
inst✝¹ : CommSemiring R
inst✝ : Algebra R K[X]
⊢ OneHom.toFun
      (↑{
          toOneHom :=
            { toFun := fun x => RatFunc.mk ((algebraMap R K[X]) x) 1,
              map_one' := (_ : RatFunc.mk ((algebraMap R K[X]) 1) 1 = 1) },
          map_mul' :=
            (_ :
              ∀ (x y : R),
                RatFunc.mk ((algebraMap R K[X]) (x * y)) 1 =
                  RatFunc.mk ((algebraMap R K[X]) x) 1 * RatFunc.mk ((algebraMap R K[X]) y) 1) })
      0 =
    0

Next tactic:
simp only [mk_one', RingHom.map_zero, ofFractionRing_zero]
instance (R : Type*) [CommSemiring R] [Algebra R K[X]] : Algebra R (RatFunc K) where
  toFun x := RatFunc.mk (algebraMap _ _ x) 1
  map_add' x y := by 

Proof state:
K : Type u
inst✝³ : CommRing K
inst✝² : IsDomain K
R : Type u_1
inst✝¹ : CommSemiring R
inst✝ : Algebra R K[X]
x y : R
⊢ OneHom.toFun
      (↑{
          toOneHom :=
            { toFun := fun x => RatFunc.mk ((algebraMap R K[X]) x) 1,
              map_one' := (_ : RatFunc.mk ((algebraMap R K[X]) 1) 1 = 1) },
          map_mul' :=
            (_ :
              ∀ (x y : R),
                RatFunc.mk ((algebraMap R K[X]) (x * y)) 1 =
                  RatFunc.mk ((algebraMap R K[X]) x) 1 * RatFunc.mk ((algebraMap R K[X]) y) 1) })
      (x + y) =
    OneHom.toFun
        (↑{
            toOneHom :=
              { toFun := fun x => RatFunc.mk ((algebraMap R K[X]) x) 1,
                map_one' := (_ : RatFunc.mk ((algebraMap R K[X]) 1) 1 = 1) },
            map_mul' :=
              (_ :
                ∀ (x y : R),
                  RatFunc.mk ((algebraMap R K[X]) (x * y)) 1 =
                    RatFunc.mk ((algebraMap R K[X]) x) 1 * RatFunc.mk ((algebraMap R K[X]) y) 1) })
        x +
      OneHom.toFun
        (↑{
            toOneHom :=
              { toFun := fun x => RatFunc.mk ((algebraMap R K[X]) x) 1,
                map_one' := (_ : RatFunc.mk ((algebraMap R K[X]) 1) 1 = 1) },
            map_mul' :=
              (_ :
                ∀ (x y : R),
                  RatFunc.mk ((algebraMap R K[X]) (x * y)) 1 =
                    RatFunc.mk ((algebraMap R K[X]) x) 1 * RatFunc.mk ((algebraMap R K[X]) y) 1) })
        y

Next tactic:
simp only [mk_one', RingHom.map_add, ofFractionRing_add]
instance (R : Type*) [CommSemiring R] [Algebra R K[X]] : Algebra R (RatFunc K) where
  toFun x := RatFunc.mk (algebraMap _ _ x) 1
  map_add' x y := by simp only [mk_one', RingHom.map_add, ofFractionRing_add]
  map_mul' x y := by simp only [mk_one', RingHom.map_mul, ofFractionRing_mul]
  map_one' := by simp only [mk_one', RingHom.map_one, ofFractionRing_one]
  map_zero' := by simp only [mk_one', RingHom.map_zero, ofFractionRing_zero]
  smul := (· • ·)
  smul_def' c x := by
    

Proof state:
K : Type u
inst✝³ : CommRing K
inst✝² : IsDomain K
R : Type u_1
inst✝¹ : CommSemiring R
inst✝ : Algebra R K[X]
c : R
x : RatFunc K
⊢ c • x =
    {
          toMonoidHom :=
            {
              toOneHom :=
                { toFun := fun x => RatFunc.mk ((algebraMap R K[X]) x) 1,
                  map_one' := (_ : RatFunc.mk ((algebraMap R K[X]) 1) 1 = 1) },
              map_mul' :=
                (_ :
                  ∀ (x y : R),
                    RatFunc.mk ((algebraMap R K[X]) (x * y)) 1 =
                      RatFunc.mk ((algebraMap R K[X]) x) 1 * RatFunc.mk ((algebraMap R K[X]) y) 1) },
          map_zero' := (_ : RatFunc.mk ((algebraMap R K[X]) 0) 1 = 0),
          map_add' :=
            (_ :
              ∀ (x y : R),
                RatFunc.mk ((algebraMap R K[X]) (x + y)) 1 =
                  RatFunc.mk ((algebraMap R K[X]) x) 1 + RatFunc.mk ((algebraMap R K[X]) y) 1) }
        c *
      x

Next tactic:
induction' x using RatFunc.induction_on' with p q hq
instance (R : Type*) [CommSemiring R] [Algebra R K[X]] : Algebra R (RatFunc K) where
  toFun x := RatFunc.mk (algebraMap _ _ x) 1
  map_add' x y := by simp only [mk_one', RingHom.map_add, ofFractionRing_add]
  map_mul' x y := by simp only [mk_one', RingHom.map_mul, ofFractionRing_mul]
  map_one' := by simp only [mk_one', RingHom.map_one, ofFractionRing_one]
  map_zero' := by simp only [mk_one', RingHom.map_zero, ofFractionRing_zero]
  smul := (· • ·)
  smul_def' c x := by
    induction' x using RatFunc.induction_on' with p q hq
      -- porting note: the first `rw [...]` was not needed
    · 

Proof state:
case _pq
K : Type u
inst✝³ : CommRing K
inst✝² : IsDomain K
R : Type u_1
inst✝¹ : CommSemiring R
inst✝ : Algebra R K[X]
c : R
p q : K[X]
hq : q ≠ 0
⊢ c • RatFunc.mk p q =
    {
          toMonoidHom :=
            {
              toOneHom :=
                { toFun := fun x => RatFunc.mk ((algebraMap R K[X]) x) 1,
                  map_one' := (_ : RatFunc.mk ((algebraMap R K[X]) 1) 1 = 1) },
              map_mul' :=
                (_ :
                  ∀ (x y : R),
                    RatFunc.mk ((algebraMap R K[X]) (x * y)) 1 =
                      RatFunc.mk ((algebraMap R K[X]) x) 1 * RatFunc.mk ((algebraMap R K[X]) y) 1) },
          map_zero' := (_ : RatFunc.mk ((algebraMap R K[X]) 0) 1 = 0),
          map_add' :=
            (_ :
              ∀ (x y : R),
                RatFunc.mk ((algebraMap R K[X]) (x + y)) 1 =
                  RatFunc.mk ((algebraMap R K[X]) x) 1 + RatFunc.mk ((algebraMap R K[X]) y) 1) }
        c *
      RatFunc.mk p q

Next tactic:
rw [RingHom.coe_mk, MonoidHom.coe_mk, OneHom.coe_mk]