l3lab/ntp-mathlib huggingface dataset:
theorem num_dvd {x : RatFunc K} {p : K[X]} (hp : p ≠ 0) :
    num x ∣ p ↔ ∃ q : K[X], q ≠ 0 ∧ x = algebraMap _ _ p / algebraMap _ _ q := by
  constructor
  · rintro ⟨q, rfl⟩
    obtain ⟨_hx, hq⟩ := mul_ne_zero_iff.mp hp
    use denom x * q
    rw [RingHom.map_mul, RingHom.map_mul, ← div_mul_div_comm, div_self, mul_one, num_div_denom]
    · exact ⟨mul_ne_zero (denom_ne_zero x) hq, rfl⟩
    · 

Proof state:
case h
K : Type u
inst✝ : Field K
x : RatFunc K
q : K[X]
hp : num x * q ≠ 0
_hx : num x ≠ 0
hq : q ≠ 0
⊢ (algebraMap K[X] (RatFunc K)) q ≠ 0

Next tactic:
exact algebraMap_ne_zero hq
theorem num_dvd {x : RatFunc K} {p : K[X]} (hp : p ≠ 0) :
    num x ∣ p ↔ ∃ q : K[X], q ≠ 0 ∧ x = algebraMap _ _ p / algebraMap _ _ q := by
  constructor
  · rintro ⟨q, rfl⟩
    obtain ⟨_hx, hq⟩ := mul_ne_zero_iff.mp hp
    use denom x * q
    rw [RingHom.map_mul, RingHom.map_mul, ← div_mul_div_comm, div_self, mul_one, num_div_denom]
    · exact ⟨mul_ne_zero (denom_ne_zero x) hq, rfl⟩
    · exact algebraMap_ne_zero hq
  · 

Proof state:
case mpr
K : Type u
inst✝ : Field K
x : RatFunc K
p : K[X]
hp : p ≠ 0
⊢ (∃ q, q ≠ 0 ∧ x = (algebraMap K[X] (RatFunc K)) p / (algebraMap K[X] (RatFunc K)) q) → num x ∣ p

Next tactic:
rintro ⟨q, hq, rfl⟩
theorem num_dvd {x : RatFunc K} {p : K[X]} (hp : p ≠ 0) :
    num x ∣ p ↔ ∃ q : K[X], q ≠ 0 ∧ x = algebraMap _ _ p / algebraMap _ _ q := by
  constructor
  · rintro ⟨q, rfl⟩
    obtain ⟨_hx, hq⟩ := mul_ne_zero_iff.mp hp
    use denom x * q
    rw [RingHom.map_mul, RingHom.map_mul, ← div_mul_div_comm, div_self, mul_one, num_div_denom]
    · exact ⟨mul_ne_zero (denom_ne_zero x) hq, rfl⟩
    · exact algebraMap_ne_zero hq
  · rintro ⟨q, hq, rfl⟩
    

Proof state:
case mpr.intro.intro
K : Type u
inst✝ : Field K
p : K[X]
hp : p ≠ 0
q : K[X]
hq : q ≠ 0
⊢ num ((algebraMap K[X] (RatFunc K)) p / (algebraMap K[X] (RatFunc K)) q) ∣ p

Next tactic:
exact num_div_dvd p hq
theorem denom_dvd {x : RatFunc K} {q : K[X]} (hq : q ≠ 0) :
    denom x ∣ q ↔ ∃ p : K[X], x = algebraMap _ _ p / algebraMap _ _ q := by
  

Proof state:
K : Type u
inst✝ : Field K
x : RatFunc K
q : K[X]
hq : q ≠ 0
⊢ denom x ∣ q ↔ ∃ p, x = (algebraMap K[X] (RatFunc K)) p / (algebraMap K[X] (RatFunc K)) q

Next tactic:
constructor
theorem denom_dvd {x : RatFunc K} {q : K[X]} (hq : q ≠ 0) :
    denom x ∣ q ↔ ∃ p : K[X], x = algebraMap _ _ p / algebraMap _ _ q := by
  constructor
  · 

Proof state:
case mp
K : Type u
inst✝ : Field K
x : RatFunc K
q : K[X]
hq : q ≠ 0
⊢ denom x ∣ q → ∃ p, x = (algebraMap K[X] (RatFunc K)) p / (algebraMap K[X] (RatFunc K)) q

Next tactic:
rintro ⟨p, rfl⟩
theorem denom_dvd {x : RatFunc K} {q : K[X]} (hq : q ≠ 0) :
    denom x ∣ q ↔ ∃ p : K[X], x = algebraMap _ _ p / algebraMap _ _ q := by
  constructor
  · rintro ⟨p, rfl⟩
    

Proof state:
case mp.intro
K : Type u
inst✝ : Field K
x : RatFunc K
p : K[X]
hq : denom x * p ≠ 0
⊢ ∃ p_1, x = (algebraMap K[X] (RatFunc K)) p_1 / (algebraMap K[X] (RatFunc K)) (denom x * p)

Next tactic:
obtain ⟨_hx, hp⟩ := mul_ne_zero_iff.mp hq
theorem denom_dvd {x : RatFunc K} {q : K[X]} (hq : q ≠ 0) :
    denom x ∣ q ↔ ∃ p : K[X], x = algebraMap _ _ p / algebraMap _ _ q := by
  constructor
  · rintro ⟨p, rfl⟩
    obtain ⟨_hx, hp⟩ := mul_ne_zero_iff.mp hq
    

Proof state:
case mp.intro.intro
K : Type u
inst✝ : Field K
x : RatFunc K
p : K[X]
hq : denom x * p ≠ 0
_hx : denom x ≠ 0
hp : p ≠ 0
⊢ ∃ p_1, x = (algebraMap K[X] (RatFunc K)) p_1 / (algebraMap K[X] (RatFunc K)) (denom x * p)

Next tactic:
use num x * p
theorem denom_dvd {x : RatFunc K} {q : K[X]} (hq : q ≠ 0) :
    denom x ∣ q ↔ ∃ p : K[X], x = algebraMap _ _ p / algebraMap _ _ q := by
  constructor
  · rintro ⟨p, rfl⟩
    obtain ⟨_hx, hp⟩ := mul_ne_zero_iff.mp hq
    use num x * p
    

Proof state:
case h
K : Type u
inst✝ : Field K
x : RatFunc K
p : K[X]
hq : denom x * p ≠ 0
_hx : denom x ≠ 0
hp : p ≠ 0
⊢ x = (algebraMap K[X] (RatFunc K)) (num x * p) / (algebraMap K[X] (RatFunc K)) (denom x * p)

Next tactic:
rw [RingHom.map_mul, RingHom.map_mul, ← div_mul_div_comm, div_self, mul_one, num_div_denom]
theorem denom_dvd {x : RatFunc K} {q : K[X]} (hq : q ≠ 0) :
    denom x ∣ q ↔ ∃ p : K[X], x = algebraMap _ _ p / algebraMap _ _ q := by
  constructor
  · rintro ⟨p, rfl⟩
    obtain ⟨_hx, hp⟩ := mul_ne_zero_iff.mp hq
    use num x * p
    rw [RingHom.map_mul, RingHom.map_mul, ← div_mul_div_comm, div_self, mul_one, num_div_denom]
    · 

Proof state:
case h
K : Type u
inst✝ : Field K
x : RatFunc K
p : K[X]
hq : denom x * p ≠ 0
_hx : denom x ≠ 0
hp : p ≠ 0
⊢ (algebraMap K[X] (RatFunc K)) p ≠ 0

Next tactic:
exact algebraMap_ne_zero hp
theorem denom_dvd {x : RatFunc K} {q : K[X]} (hq : q ≠ 0) :
    denom x ∣ q ↔ ∃ p : K[X], x = algebraMap _ _ p / algebraMap _ _ q := by
  constructor
  · rintro ⟨p, rfl⟩
    obtain ⟨_hx, hp⟩ := mul_ne_zero_iff.mp hq
    use num x * p
    rw [RingHom.map_mul, RingHom.map_mul, ← div_mul_div_comm, div_self, mul_one, num_div_denom]
    · exact algebraMap_ne_zero hp
  · 

Proof state:
case mpr
K : Type u
inst✝ : Field K
x : RatFunc K
q : K[X]
hq : q ≠ 0
⊢ (∃ p, x = (algebraMap K[X] (RatFunc K)) p / (algebraMap K[X] (RatFunc K)) q) → denom x ∣ q

Next tactic:
rintro ⟨p, rfl⟩
theorem denom_dvd {x : RatFunc K} {q : K[X]} (hq : q ≠ 0) :
    denom x ∣ q ↔ ∃ p : K[X], x = algebraMap _ _ p / algebraMap _ _ q := by
  constructor
  · rintro ⟨p, rfl⟩
    obtain ⟨_hx, hp⟩ := mul_ne_zero_iff.mp hq
    use num x * p
    rw [RingHom.map_mul, RingHom.map_mul, ← div_mul_div_comm, div_self, mul_one, num_div_denom]
    · exact algebraMap_ne_zero hp
  · rintro ⟨p, rfl⟩
    

Proof state:
case mpr.intro
K : Type u
inst✝ : Field K
q : K[X]
hq : q ≠ 0
p : K[X]
⊢ denom ((algebraMap K[X] (RatFunc K)) p / (algebraMap K[X] (RatFunc K)) q) ∣ q

Next tactic:
exact denom_div_dvd p q
theorem num_mul_dvd (x y : RatFunc K) : num (x * y) ∣ num x * num y := by
  

Proof state:
K : Type u
inst✝ : Field K
x y : RatFunc K
⊢ num (x * y) ∣ num x * num y

Next tactic:
by_cases hx : x = 0
theorem num_mul_dvd (x y : RatFunc K) : num (x * y) ∣ num x * num y := by
  by_cases hx : x = 0
  · 

Proof state:
case pos
K : Type u
inst✝ : Field K
x y : RatFunc K
hx : x = 0
⊢ num (x * y) ∣ num x * num y

Next tactic:
simp [hx]
theorem num_mul_dvd (x y : RatFunc K) : num (x * y) ∣ num x * num y := by
  by_cases hx : x = 0
  · simp [hx]
  

Proof state:
case neg
K : Type u
inst✝ : Field K
x y : RatFunc K
hx : ¬x = 0
⊢ num (x * y) ∣ num x * num y

Next tactic:
by_cases hy : y = 0
theorem num_mul_dvd (x y : RatFunc K) : num (x * y) ∣ num x * num y := by
  by_cases hx : x = 0
  · simp [hx]
  by_cases hy : y = 0
  · 

Proof state:
case pos
K : Type u
inst✝ : Field K
x y : RatFunc K
hx : ¬x = 0
hy : y = 0
⊢ num (x * y) ∣ num x * num y

Next tactic:
simp [hy]
theorem num_mul_dvd (x y : RatFunc K) : num (x * y) ∣ num x * num y := by
  by_cases hx : x = 0
  · simp [hx]
  by_cases hy : y = 0
  · simp [hy]
  

Proof state:
case neg
K : Type u
inst✝ : Field K
x y : RatFunc K
hx : ¬x = 0
hy : ¬y = 0
⊢ num (x * y) ∣ num x * num y

Next tactic:
rw [num_dvd (mul_ne_zero (num_ne_zero hx) (num_ne_zero hy))]
theorem num_mul_dvd (x y : RatFunc K) : num (x * y) ∣ num x * num y := by
  by_cases hx : x = 0
  · simp [hx]
  by_cases hy : y = 0
  · simp [hy]
  rw [num_dvd (mul_ne_zero (num_ne_zero hx) (num_ne_zero hy))]
  

Proof state:
case neg
K : Type u
inst✝ : Field K
x y : RatFunc K
hx : ¬x = 0
hy : ¬y = 0
⊢ ∃ q, q ≠ 0 ∧ x * y = (algebraMap K[X] (RatFunc K)) (num x * num y) / (algebraMap K[X] (RatFunc K)) q

Next tactic:
refine' ⟨x.denom * y.denom, mul_ne_zero (denom_ne_zero x) (denom_ne_zero y), _⟩
theorem num_mul_dvd (x y : RatFunc K) : num (x * y) ∣ num x * num y := by
  by_cases hx : x = 0
  · simp [hx]
  by_cases hy : y = 0
  · simp [hy]
  rw [num_dvd (mul_ne_zero (num_ne_zero hx) (num_ne_zero hy))]
  refine' ⟨x.denom * y.denom, mul_ne_zero (denom_ne_zero x) (denom_ne_zero y), _⟩
  

Proof state:
case neg
K : Type u
inst✝ : Field K
x y : RatFunc K
hx : ¬x = 0
hy : ¬y = 0
⊢ x * y = (algebraMap K[X] (RatFunc K)) (num x * num y) / (algebraMap K[X] (RatFunc K)) (denom x * denom y)

Next tactic:
rw [RingHom.map_mul, RingHom.map_mul, ← div_mul_div_comm, num_div_denom, num_div_denom]
theorem denom_mul_dvd (x y : RatFunc K) : denom (x * y) ∣ denom x * denom y := by
  

Proof state:
K : Type u
inst✝ : Field K
x y : RatFunc K
⊢ denom (x * y) ∣ denom x * denom y

Next tactic:
rw [denom_dvd (mul_ne_zero (denom_ne_zero x) (denom_ne_zero y))]
theorem denom_mul_dvd (x y : RatFunc K) : denom (x * y) ∣ denom x * denom y := by
  rw [denom_dvd (mul_ne_zero (denom_ne_zero x) (denom_ne_zero y))]
  

Proof state:
K : Type u
inst✝ : Field K
x y : RatFunc K
⊢ ∃ p, x * y = (algebraMap K[X] (RatFunc K)) p / (algebraMap K[X] (RatFunc K)) (denom x * denom y)

Next tactic:
refine' ⟨x.num * y.num, _⟩
theorem denom_mul_dvd (x y : RatFunc K) : denom (x * y) ∣ denom x * denom y := by
  rw [denom_dvd (mul_ne_zero (denom_ne_zero x) (denom_ne_zero y))]
  refine' ⟨x.num * y.num, _⟩
  

Proof state:
K : Type u
inst✝ : Field K
x y : RatFunc K
⊢ x * y = (algebraMap K[X] (RatFunc K)) (num x * num y) / (algebraMap K[X] (RatFunc K)) (denom x * denom y)

Next tactic:
rw [RingHom.map_mul, RingHom.map_mul, ← div_mul_div_comm, num_div_denom, num_div_denom]
theorem denom_add_dvd (x y : RatFunc K) : denom (x + y) ∣ denom x * denom y := by
  

Proof state:
K : Type u
inst✝ : Field K
x y : RatFunc K
⊢ denom (x + y) ∣ denom x * denom y

Next tactic:
rw [denom_dvd (mul_ne_zero (denom_ne_zero x) (denom_ne_zero y))]
theorem denom_add_dvd (x y : RatFunc K) : denom (x + y) ∣ denom x * denom y := by
  rw [denom_dvd (mul_ne_zero (denom_ne_zero x) (denom_ne_zero y))]
  

Proof state:
K : Type u
inst✝ : Field K
x y : RatFunc K
⊢ ∃ p, x + y = (algebraMap K[X] (RatFunc K)) p / (algebraMap K[X] (RatFunc K)) (denom x * denom y)

Next tactic:
refine' ⟨x.num * y.denom + x.denom * y.num, _⟩
theorem denom_add_dvd (x y : RatFunc K) : denom (x + y) ∣ denom x * denom y := by
  rw [denom_dvd (mul_ne_zero (denom_ne_zero x) (denom_ne_zero y))]
  refine' ⟨x.num * y.denom + x.denom * y.num, _⟩
  

Proof state:
K : Type u
inst✝ : Field K
x y : RatFunc K
⊢ x + y =
    (algebraMap K[X] (RatFunc K)) (num x * denom y + denom x * num y) /
      (algebraMap K[X] (RatFunc K)) (denom x * denom y)

Next tactic:
rw [RingHom.map_mul, RingHom.map_add, RingHom.map_mul, RingHom.map_mul, ← div_add_div,
    num_div_denom, num_div_denom]
theorem denom_add_dvd (x y : RatFunc K) : denom (x + y) ∣ denom x * denom y := by
  rw [denom_dvd (mul_ne_zero (denom_ne_zero x) (denom_ne_zero y))]
  refine' ⟨x.num * y.denom + x.denom * y.num, _⟩
  rw [RingHom.map_mul, RingHom.map_add, RingHom.map_mul, RingHom.map_mul, ← div_add_div,
    num_div_denom, num_div_denom]
  · 

Proof state:
case hb
K : Type u
inst✝ : Field K
x y : RatFunc K
⊢ (algebraMap K[X] (RatFunc K)) (denom x) ≠ 0

Next tactic:
exact algebraMap_ne_zero (denom_ne_zero x)
theorem denom_add_dvd (x y : RatFunc K) : denom (x + y) ∣ denom x * denom y := by
  rw [denom_dvd (mul_ne_zero (denom_ne_zero x) (denom_ne_zero y))]
  refine' ⟨x.num * y.denom + x.denom * y.num, _⟩
  rw [RingHom.map_mul, RingHom.map_add, RingHom.map_mul, RingHom.map_mul, ← div_add_div,
    num_div_denom, num_div_denom]
  · exact algebraMap_ne_zero (denom_ne_zero x)
  · 

Proof state:
case hd
K : Type u
inst✝ : Field K
x y : RatFunc K
⊢ (algebraMap K[X] (RatFunc K)) (denom y) ≠ 0

Next tactic:
exact algebraMap_ne_zero (denom_ne_zero y)
theorem map_apply {R F : Type*} [CommRing R] [IsDomain R] [MonoidHomClass F K[X] R[X]] (φ : F)
    (hφ : K[X]⁰ ≤ R[X]⁰.comap φ) (f : RatFunc K) :
    map φ hφ f = algebraMap _ _ (φ f.num) / algebraMap _ _ (φ f.denom) := by
  

Proof state:
K : Type u
inst✝³ : Field K
R : Type u_1
F : Type u_2
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : MonoidHomClass F K[X] R[X]
φ : F
hφ : K[X]⁰ ≤ Submonoid.comap φ R[X]⁰
f : RatFunc K
⊢ (map φ hφ) f = (algebraMap R[X] (RatFunc R)) (φ (num f)) / (algebraMap R[X] (RatFunc R)) (φ (denom f))

Next tactic:
rw [← num_div_denom f, map_apply_div_ne_zero, num_div_denom f]
theorem map_apply {R F : Type*} [CommRing R] [IsDomain R] [MonoidHomClass F K[X] R[X]] (φ : F)
    (hφ : K[X]⁰ ≤ R[X]⁰.comap φ) (f : RatFunc K) :
    map φ hφ f = algebraMap _ _ (φ f.num) / algebraMap _ _ (φ f.denom) := by
  rw [← num_div_denom f, map_apply_div_ne_zero, num_div_denom f]
  

Proof state:
case hq
K : Type u
inst✝³ : Field K
R : Type u_1
F : Type u_2
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : MonoidHomClass F K[X] R[X]
φ : F
hφ : K[X]⁰ ≤ Submonoid.comap φ R[X]⁰
f : RatFunc K
⊢ denom f ≠ 0

Next tactic:
exact denom_ne_zero _
theorem liftMonoidWithZeroHom_apply {L : Type*} [CommGroupWithZero L] (φ : K[X] →*₀ L)
    (hφ : K[X]⁰ ≤ L⁰.comap φ) (f : RatFunc K) :
    liftMonoidWithZeroHom φ hφ f = φ f.num / φ f.denom :=
  by 

Proof state:
K : Type u
inst✝¹ : Field K
L : Type u_1
inst✝ : CommGroupWithZero L
φ : K[X] →*₀ L
hφ : K[X]⁰ ≤ Submonoid.comap φ L⁰
f : RatFunc K
⊢ (liftMonoidWithZeroHom φ hφ) f = φ (num f) / φ (denom f)

Next tactic:
rw [← num_div_denom f, liftMonoidWithZeroHom_apply_div, num_div_denom]
theorem num_mul_denom_add_denom_mul_num_ne_zero {x y : RatFunc K} (hxy : x + y ≠ 0) :
    x.num * y.denom + x.denom * y.num ≠ 0 := by
  

Proof state:
K : Type u
inst✝ : Field K
x y : RatFunc K
hxy : x + y ≠ 0
⊢ num x * denom y + denom x * num y ≠ 0

Next tactic:
intro h_zero
theorem num_mul_denom_add_denom_mul_num_ne_zero {x y : RatFunc K} (hxy : x + y ≠ 0) :
    x.num * y.denom + x.denom * y.num ≠ 0 := by
  intro h_zero
  

Proof state:
K : Type u
inst✝ : Field K
x y : RatFunc K
hxy : x + y ≠ 0
h_zero : num x * denom y + denom x * num y = 0
⊢ False

Next tactic:
have h := num_denom_add x y
theorem num_mul_denom_add_denom_mul_num_ne_zero {x y : RatFunc K} (hxy : x + y ≠ 0) :
    x.num * y.denom + x.denom * y.num ≠ 0 := by
  intro h_zero
  have h := num_denom_add x y
  

Proof state:
K : Type u
inst✝ : Field K
x y : RatFunc K
hxy : x + y ≠ 0
h_zero : num x * denom y + denom x * num y = 0
h : num (x + y) * (denom x * denom y) = (num x * denom y + denom x * num y) * denom (x + y)
⊢ False

Next tactic:
rw [h_zero, zero_mul] at h
theorem num_mul_denom_add_denom_mul_num_ne_zero {x y : RatFunc K} (hxy : x + y ≠ 0) :
    x.num * y.denom + x.denom * y.num ≠ 0 := by
  intro h_zero
  have h := num_denom_add x y
  rw [h_zero, zero_mul] at h
  

Proof state:
K : Type u
inst✝ : Field K
x y : RatFunc K
hxy : x + y ≠ 0
h_zero : num x * denom y + denom x * num y = 0
h : num (x + y) * (denom x * denom y) = 0
⊢ False

Next tactic:
exact (mul_ne_zero (num_ne_zero hxy) (mul_ne_zero x.denom_ne_zero y.denom_ne_zero)) h
theorem smul_eq_C_mul (r : K) (x : RatFunc K) : r • x = C r * x := by
  

Proof state:
K : Type u
inst✝¹ : CommRing K
inst✝ : IsDomain K
r : K
x : RatFunc K
⊢ r • x = C r * x

Next tactic:
rw [Algebra.smul_def, algebraMap_eq_C]
theorem eval_eq_zero_of_eval₂_denom_eq_zero {x : RatFunc K}
    (h : Polynomial.eval₂ f a (denom x) = 0) : eval f a x = 0 := by 

Proof state:
K : Type u
inst✝¹ : Field K
L : Type u_1
inst✝ : Field L
f : K →+* L
a : L
x : RatFunc K
h : Polynomial.eval₂ f a (denom x) = 0
⊢ eval f a x = 0

Next tactic:
rw [eval, h, div_zero]
@[simp]
theorem eval_C {c : K} : eval f a (C c) = f c := by 

Proof state:
K : Type u
inst✝¹ : Field K
L : Type u_1
inst✝ : Field L
f : K →+* L
a : L
c : K
⊢ eval f a (C c) = f c

Next tactic:
simp [eval]
@[simp]
theorem eval_X : eval f a X = a := by 

Proof state:
K : Type u
inst✝¹ : Field K
L : Type u_1
inst✝ : Field L
f : K →+* L
a : L
⊢ eval f a X = a

Next tactic:
simp [eval]
@[simp]
theorem eval_zero : eval f a 0 = 0 := by 

Proof state:
K : Type u
inst✝¹ : Field K
L : Type u_1
inst✝ : Field L
f : K →+* L
a : L
⊢ eval f a 0 = 0

Next tactic:
simp [eval]
@[simp]
theorem eval_one : eval f a 1 = 1 := by 

Proof state:
K : Type u
inst✝¹ : Field K
L : Type u_1
inst✝ : Field L
f : K →+* L
a : L
⊢ eval f a 1 = 1

Next tactic:
simp [eval]
@[simp]
theorem eval_algebraMap {S : Type*} [CommSemiring S] [Algebra S K[X]] (p : S) :
    eval f a (algebraMap _ _ p) = (algebraMap _ K[X] p).eval₂ f a := by
  

Proof state:
K : Type u
inst✝³ : Field K
L : Type u_1
inst✝² : Field L
f : K →+* L
a : L
S : Type u_2
inst✝¹ : CommSemiring S
inst✝ : Algebra S K[X]
p : S
⊢ eval f a ((algebraMap S (RatFunc K)) p) = Polynomial.eval₂ f a ((algebraMap S K[X]) p)

Next tactic:
simp [eval, IsScalarTower.algebraMap_apply S K[X] (RatFunc K)]
/-- `eval` is an additive homomorphism except when a denominator evaluates to `0`.

Counterexample: `eval _ 1 (X / (X-1)) + eval _ 1 (-1 / (X-1)) = 0`
`... ≠ 1 = eval _ 1 ((X-1) / (X-1))`.

See also `RatFunc.eval₂_denom_ne_zero` to make the hypotheses simpler but less general.
-/
theorem eval_add {x y : RatFunc K} (hx : Polynomial.eval₂ f a (denom x) ≠ 0)
    (hy : Polynomial.eval₂ f a (denom y) ≠ 0) : eval f a (x + y) = eval f a x + eval f a y := by
  

Proof state:
K : Type u
inst✝¹ : Field K
L : Type u_1
inst✝ : Field L
f : K →+* L
a : L
x y : RatFunc K
hx : Polynomial.eval₂ f a (denom x) ≠ 0
hy : Polynomial.eval₂ f a (denom y) ≠ 0
⊢ eval f a (x + y) = eval f a x + eval f a y

Next tactic:
unfold eval
/-- `eval` is an additive homomorphism except when a denominator evaluates to `0`.

Counterexample: `eval _ 1 (X / (X-1)) + eval _ 1 (-1 / (X-1)) = 0`
`... ≠ 1 = eval _ 1 ((X-1) / (X-1))`.

See also `RatFunc.eval₂_denom_ne_zero` to make the hypotheses simpler but less general.
-/
theorem eval_add {x y : RatFunc K} (hx : Polynomial.eval₂ f a (denom x) ≠ 0)
    (hy : Polynomial.eval₂ f a (denom y) ≠ 0) : eval f a (x + y) = eval f a x + eval f a y := by
  unfold eval
  

Proof state:
K : Type u
inst✝¹ : Field K
L : Type u_1
inst✝ : Field L
f : K →+* L
a : L
x y : RatFunc K
hx : Polynomial.eval₂ f a (denom x) ≠ 0
hy : Polynomial.eval₂ f a (denom y) ≠ 0
⊢ Polynomial.eval₂ f a (num (x + y)) / Polynomial.eval₂ f a (denom (x + y)) =
    Polynomial.eval₂ f a (num x) / Polynomial.eval₂ f a (denom x) +
      Polynomial.eval₂ f a (num y) / Polynomial.eval₂ f a (denom y)

Next tactic:
by_cases hxy : Polynomial.eval₂ f a (denom (x + y)) = 0
/-- `eval` is an additive homomorphism except when a denominator evaluates to `0`.

Counterexample: `eval _ 1 (X / (X-1)) + eval _ 1 (-1 / (X-1)) = 0`
`... ≠ 1 = eval _ 1 ((X-1) / (X-1))`.

See also `RatFunc.eval₂_denom_ne_zero` to make the hypotheses simpler but less general.
-/
theorem eval_add {x y : RatFunc K} (hx : Polynomial.eval₂ f a (denom x) ≠ 0)
    (hy : Polynomial.eval₂ f a (denom y) ≠ 0) : eval f a (x + y) = eval f a x + eval f a y := by
  unfold eval
  by_cases hxy : Polynomial.eval₂ f a (denom (x + y)) = 0
  · 

Proof state:
case pos
K : Type u
inst✝¹ : Field K
L : Type u_1
inst✝ : Field L
f : K →+* L
a : L
x y : RatFunc K
hx : Polynomial.eval₂ f a (denom x) ≠ 0
hy : Polynomial.eval₂ f a (denom y) ≠ 0
hxy : Polynomial.eval₂ f a (denom (x + y)) = 0
⊢ Polynomial.eval₂ f a (num (x + y)) / Polynomial.eval₂ f a (denom (x + y)) =
    Polynomial.eval₂ f a (num x) / Polynomial.eval₂ f a (denom x) +
      Polynomial.eval₂ f a (num y) / Polynomial.eval₂ f a (denom y)

Next tactic:
have := Polynomial.eval₂_eq_zero_of_dvd_of_eval₂_eq_zero f a (denom_add_dvd x y) hxy
/-- `eval` is an additive homomorphism except when a denominator evaluates to `0`.

Counterexample: `eval _ 1 (X / (X-1)) + eval _ 1 (-1 / (X-1)) = 0`
`... ≠ 1 = eval _ 1 ((X-1) / (X-1))`.

See also `RatFunc.eval₂_denom_ne_zero` to make the hypotheses simpler but less general.
-/
theorem eval_add {x y : RatFunc K} (hx : Polynomial.eval₂ f a (denom x) ≠ 0)
    (hy : Polynomial.eval₂ f a (denom y) ≠ 0) : eval f a (x + y) = eval f a x + eval f a y := by
  unfold eval
  by_cases hxy : Polynomial.eval₂ f a (denom (x + y)) = 0
  · have := Polynomial.eval₂_eq_zero_of_dvd_of_eval₂_eq_zero f a (denom_add_dvd x y) hxy
    

Proof state:
case pos
K : Type u
inst✝¹ : Field K
L : Type u_1
inst✝ : Field L
f : K →+* L
a : L
x y : RatFunc K
hx : Polynomial.eval₂ f a (denom x) ≠ 0
hy : Polynomial.eval₂ f a (denom y) ≠ 0
hxy : Polynomial.eval₂ f a (denom (x + y)) = 0
this : Polynomial.eval₂ f a (denom x * denom y) = 0
⊢ Polynomial.eval₂ f a (num (x + y)) / Polynomial.eval₂ f a (denom (x + y)) =
    Polynomial.eval₂ f a (num x) / Polynomial.eval₂ f a (denom x) +
      Polynomial.eval₂ f a (num y) / Polynomial.eval₂ f a (denom y)

Next tactic:
rw [Polynomial.eval₂_mul] at this
/-- `eval` is an additive homomorphism except when a denominator evaluates to `0`.

Counterexample: `eval _ 1 (X / (X-1)) + eval _ 1 (-1 / (X-1)) = 0`
`... ≠ 1 = eval _ 1 ((X-1) / (X-1))`.

See also `RatFunc.eval₂_denom_ne_zero` to make the hypotheses simpler but less general.
-/
theorem eval_add {x y : RatFunc K} (hx : Polynomial.eval₂ f a (denom x) ≠ 0)
    (hy : Polynomial.eval₂ f a (denom y) ≠ 0) : eval f a (x + y) = eval f a x + eval f a y := by
  unfold eval
  by_cases hxy : Polynomial.eval₂ f a (denom (x + y)) = 0
  · have := Polynomial.eval₂_eq_zero_of_dvd_of_eval₂_eq_zero f a (denom_add_dvd x y) hxy
    rw [Polynomial.eval₂_mul] at this
    

Proof state:
case pos
K : Type u
inst✝¹ : Field K
L : Type u_1
inst✝ : Field L
f : K →+* L
a : L
x y : RatFunc K
hx : Polynomial.eval₂ f a (denom x) ≠ 0
hy : Polynomial.eval₂ f a (denom y) ≠ 0
hxy : Polynomial.eval₂ f a (denom (x + y)) = 0
this : Polynomial.eval₂ f a (denom x) * Polynomial.eval₂ f a (denom y) = 0
⊢ Polynomial.eval₂ f a (num (x + y)) / Polynomial.eval₂ f a (denom (x + y)) =
    Polynomial.eval₂ f a (num x) / Polynomial.eval₂ f a (denom x) +
      Polynomial.eval₂ f a (num y) / Polynomial.eval₂ f a (denom y)

Next tactic:
cases mul_eq_zero.mp this
/-- `eval` is an additive homomorphism except when a denominator evaluates to `0`.

Counterexample: `eval _ 1 (X / (X-1)) + eval _ 1 (-1 / (X-1)) = 0`
`... ≠ 1 = eval _ 1 ((X-1) / (X-1))`.

See also `RatFunc.eval₂_denom_ne_zero` to make the hypotheses simpler but less general.
-/
theorem eval_add {x y : RatFunc K} (hx : Polynomial.eval₂ f a (denom x) ≠ 0)
    (hy : Polynomial.eval₂ f a (denom y) ≠ 0) : eval f a (x + y) = eval f a x + eval f a y := by
  unfold eval
  by_cases hxy : Polynomial.eval₂ f a (denom (x + y)) = 0
  · have := Polynomial.eval₂_eq_zero_of_dvd_of_eval₂_eq_zero f a (denom_add_dvd x y) hxy
    rw [Polynomial.eval₂_mul] at this
    cases mul_eq_zero.mp this <;> 

Proof state:
case pos.inl
K : Type u
inst✝¹ : Field K
L : Type u_1
inst✝ : Field L
f : K →+* L
a : L
x y : RatFunc K
hx : Polynomial.eval₂ f a (denom x) ≠ 0
hy : Polynomial.eval₂ f a (denom y) ≠ 0
hxy : Polynomial.eval₂ f a (denom (x + y)) = 0
this : Polynomial.eval₂ f a (denom x) * Polynomial.eval₂ f a (denom y) = 0
h✝ : Polynomial.eval₂ f a (denom x) = 0
⊢ Polynomial.eval₂ f a (num (x + y)) / Polynomial.eval₂ f a (denom (x + y)) =
    Polynomial.eval₂ f a (num x) / Polynomial.eval₂ f a (denom x) +
      Polynomial.eval₂ f a (num y) / Polynomial.eval₂ f a (denom y)

Next tactic:
contradiction
/-- `eval` is an additive homomorphism except when a denominator evaluates to `0`.

Counterexample: `eval _ 1 (X / (X-1)) + eval _ 1 (-1 / (X-1)) = 0`
`... ≠ 1 = eval _ 1 ((X-1) / (X-1))`.

See also `RatFunc.eval₂_denom_ne_zero` to make the hypotheses simpler but less general.
-/
theorem eval_add {x y : RatFunc K} (hx : Polynomial.eval₂ f a (denom x) ≠ 0)
    (hy : Polynomial.eval₂ f a (denom y) ≠ 0) : eval f a (x + y) = eval f a x + eval f a y := by
  unfold eval
  by_cases hxy : Polynomial.eval₂ f a (denom (x + y)) = 0
  · have := Polynomial.eval₂_eq_zero_of_dvd_of_eval₂_eq_zero f a (denom_add_dvd x y) hxy
    rw [Polynomial.eval₂_mul] at this
    cases mul_eq_zero.mp this <;> 

Proof state:
case pos.inr
K : Type u
inst✝¹ : Field K
L : Type u_1
inst✝ : Field L
f : K →+* L
a : L
x y : RatFunc K
hx : Polynomial.eval₂ f a (denom x) ≠ 0
hy : Polynomial.eval₂ f a (denom y) ≠ 0
hxy : Polynomial.eval₂ f a (denom (x + y)) = 0
this : Polynomial.eval₂ f a (denom x) * Polynomial.eval₂ f a (denom y) = 0
h✝ : Polynomial.eval₂ f a (denom y) = 0
⊢ Polynomial.eval₂ f a (num (x + y)) / Polynomial.eval₂ f a (denom (x + y)) =
    Polynomial.eval₂ f a (num x) / Polynomial.eval₂ f a (denom x) +
      Polynomial.eval₂ f a (num y) / Polynomial.eval₂ f a (denom y)

Next tactic:
contradiction