l3lab/ntp-mathlib huggingface dataset:
theorem num_div_dvd (p : K[X]) {q : K[X]} (hq : q ≠ 0) :
    num (algebraMap _ _ p / algebraMap _ _ q) ∣ p := by
  rw [num_div _ q, C_mul_dvd]
  · exact EuclideanDomain.div_dvd_of_dvd (gcd_dvd_left p q)
  · 

Proof state:
K : Type u
inst✝ : Field K
p q : K[X]
hq : q ≠ 0
⊢ (leadingCoeff (q / gcd p q))⁻¹ ≠ 0

Next tactic:
simpa only [Ne.def, inv_eq_zero, Polynomial.leadingCoeff_eq_zero] using right_div_gcd_ne_zero hq
/-- A version of `num_div_dvd` with the LHS in simp normal form -/
@[simp]
theorem num_div_dvd' (p : K[X]) {q : K[X]} (hq : q ≠ 0) :
    C (q / gcd p q).leadingCoeff⁻¹ * (p / gcd p q) ∣ p := by 

Proof state:
K : Type u
inst✝ : Field K
p q : K[X]
hq : q ≠ 0
⊢ C (leadingCoeff (q / gcd p q))⁻¹ * (p / gcd p q) ∣ p

Next tactic:
simpa using num_div_dvd p hq
@[simp]
theorem denom_div (p : K[X]) {q : K[X]} (hq : q ≠ 0) :
    denom (algebraMap _ _ p / algebraMap _ _ q) =
      Polynomial.C (q / gcd p q).leadingCoeff⁻¹ * (q / gcd p q) := by
  

Proof state:
K : Type u
inst✝ : Field K
p q : K[X]
hq : q ≠ 0
⊢ denom ((algebraMap K[X] (RatFunc K)) p / (algebraMap K[X] (RatFunc K)) q) =
    C (leadingCoeff (q / gcd p q))⁻¹ * (q / gcd p q)

Next tactic:
rw [denom, numDenom_div _ hq]
theorem monic_denom (x : RatFunc K) : (denom x).Monic := by
  

Proof state:
K : Type u
inst✝ : Field K
x : RatFunc K
⊢ Monic (denom x)

Next tactic:
induction x using RatFunc.induction_on with
  | f p q hq =>
    rw [denom_div p hq, mul_comm]
    exact Polynomial.monic_mul_leadingCoeff_inv (right_div_gcd_ne_zero hq)
theorem monic_denom (x : RatFunc K) : (denom x).Monic := by
  induction x using RatFunc.induction_on with
  

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

Next tactic:
| f p q hq =>
    rw [denom_div p hq, mul_comm]
    exact Polynomial.monic_mul_leadingCoeff_inv (right_div_gcd_ne_zero hq)
theorem monic_denom (x : RatFunc K) : (denom x).Monic := by
  induction x using RatFunc.induction_on with
  | f p q hq =>
    

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

Next tactic:
rw [denom_div p hq, mul_comm]
theorem monic_denom (x : RatFunc K) : (denom x).Monic := by
  induction x using RatFunc.induction_on with
  | f p q hq =>
    rw [denom_div p hq, mul_comm]
    

Proof state:
case f
K : Type u
inst✝ : Field K
p q : K[X]
hq : q ≠ 0
⊢ Monic (q / gcd p q * C (leadingCoeff (q / gcd p q))⁻¹)

Next tactic:
exact Polynomial.monic_mul_leadingCoeff_inv (right_div_gcd_ne_zero hq)
@[simp]
theorem denom_zero : denom (0 : RatFunc K) = 1 := by
  

Proof state:
K : Type u
inst✝ : Field K
⊢ denom 0 = 1

Next tactic:
convert denom_div (0 : K[X]) one_ne_zero
@[simp]
theorem denom_zero : denom (0 : RatFunc K) = 1 := by
  convert denom_div (0 : K[X]) one_ne_zero <;> 

Proof state:
case h.e'_2.h.e'_3
K : Type u
inst✝ : Field K
⊢ 0 = (algebraMap K[X] (RatFunc K)) 0 / (algebraMap K[X] (RatFunc K)) 1

Next tactic:
simp
@[simp]
theorem denom_zero : denom (0 : RatFunc K) = 1 := by
  convert denom_div (0 : K[X]) one_ne_zero <;> 

Proof state:
case h.e'_3
K : Type u
inst✝ : Field K
⊢ 1 = C (leadingCoeff (1 / gcd 0 1))⁻¹ * (1 / gcd 0 1)

Next tactic:
simp
@[simp]
theorem denom_one : denom (1 : RatFunc K) = 1 := by
  

Proof state:
K : Type u
inst✝ : Field K
⊢ denom 1 = 1

Next tactic:
convert denom_div (1 : K[X]) one_ne_zero
@[simp]
theorem denom_one : denom (1 : RatFunc K) = 1 := by
  convert denom_div (1 : K[X]) one_ne_zero <;> 

Proof state:
case h.e'_2.h.e'_3
K : Type u
inst✝ : Field K
⊢ 1 = (algebraMap K[X] (RatFunc K)) 1 / (algebraMap K[X] (RatFunc K)) 1

Next tactic:
simp
@[simp]
theorem denom_one : denom (1 : RatFunc K) = 1 := by
  convert denom_div (1 : K[X]) one_ne_zero <;> 

Proof state:
case h.e'_3
K : Type u
inst✝ : Field K
⊢ 1 = C (leadingCoeff (1 / gcd 1 1))⁻¹ * (1 / gcd 1 1)

Next tactic:
simp
@[simp]
theorem denom_algebraMap (p : K[X]) : denom (algebraMap _ (RatFunc K) p) = 1 := by
  

Proof state:
K : Type u
inst✝ : Field K
p : K[X]
⊢ denom ((algebraMap K[X] (RatFunc K)) p) = 1

Next tactic:
convert denom_div p one_ne_zero
@[simp]
theorem denom_algebraMap (p : K[X]) : denom (algebraMap _ (RatFunc K) p) = 1 := by
  convert denom_div p one_ne_zero <;> 

Proof state:
case h.e'_2.h.e'_3
K : Type u
inst✝ : Field K
p : K[X]
⊢ (algebraMap K[X] (RatFunc K)) p = (algebraMap K[X] (RatFunc K)) p / (algebraMap K[X] (RatFunc K)) 1

Next tactic:
simp
@[simp]
theorem denom_algebraMap (p : K[X]) : denom (algebraMap _ (RatFunc K) p) = 1 := by
  convert denom_div p one_ne_zero <;> 

Proof state:
case h.e'_3
K : Type u
inst✝ : Field K
p : K[X]
⊢ 1 = C (leadingCoeff (1 / gcd p 1))⁻¹ * (1 / gcd p 1)

Next tactic:
simp
@[simp]
theorem denom_div_dvd (p q : K[X]) : denom (algebraMap _ _ p / algebraMap _ _ q) ∣ q := by
  

Proof state:
K : Type u
inst✝ : Field K
p q : K[X]
⊢ denom ((algebraMap K[X] (RatFunc K)) p / (algebraMap K[X] (RatFunc K)) q) ∣ q

Next tactic:
by_cases hq : q = 0
@[simp]
theorem denom_div_dvd (p q : K[X]) : denom (algebraMap _ _ p / algebraMap _ _ q) ∣ q := by
  by_cases hq : q = 0
  · 

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

Next tactic:
simp [hq]
@[simp]
theorem denom_div_dvd (p q : K[X]) : denom (algebraMap _ _ p / algebraMap _ _ q) ∣ q := by
  by_cases hq : q = 0
  · simp [hq]
  

Proof state:
case neg
K : Type u
inst✝ : Field K
p q : K[X]
hq : ¬q = 0
⊢ denom ((algebraMap K[X] (RatFunc K)) p / (algebraMap K[X] (RatFunc K)) q) ∣ q

Next tactic:
rw [denom_div _ hq, C_mul_dvd]
@[simp]
theorem denom_div_dvd (p q : K[X]) : denom (algebraMap _ _ p / algebraMap _ _ q) ∣ q := by
  by_cases hq : q = 0
  · simp [hq]
  rw [denom_div _ hq, C_mul_dvd]
  · 

Proof state:
case neg
K : Type u
inst✝ : Field K
p q : K[X]
hq : ¬q = 0
⊢ q / gcd p q ∣ q

Next tactic:
exact EuclideanDomain.div_dvd_of_dvd (gcd_dvd_right p q)
@[simp]
theorem denom_div_dvd (p q : K[X]) : denom (algebraMap _ _ p / algebraMap _ _ q) ∣ q := by
  by_cases hq : q = 0
  · simp [hq]
  rw [denom_div _ hq, C_mul_dvd]
  · exact EuclideanDomain.div_dvd_of_dvd (gcd_dvd_right p q)
  · 

Proof state:
case neg
K : Type u
inst✝ : Field K
p q : K[X]
hq : ¬q = 0
⊢ (leadingCoeff (q / gcd p q))⁻¹ ≠ 0

Next tactic:
simpa only [Ne.def, inv_eq_zero, Polynomial.leadingCoeff_eq_zero] using right_div_gcd_ne_zero hq
@[simp]
theorem num_div_denom (x : RatFunc K) : algebraMap _ _ (num x) / algebraMap _ _ (denom x) = x := by
  

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

Next tactic:
induction' x using RatFunc.induction_on with p q hq
@[simp]
theorem num_div_denom (x : RatFunc K) : algebraMap _ _ (num x) / algebraMap _ _ (denom x) = x := by
  induction' x using RatFunc.induction_on with p q hq
  -- porting note: had to hint the type of this `have`
  

Proof state:
case f
K : Type u
inst✝ : Field K
p q : K[X]
hq : q ≠ 0
⊢ (algebraMap K[X] (RatFunc K)) (num ((algebraMap K[X] (RatFunc K)) p / (algebraMap K[X] (RatFunc K)) q)) /
      (algebraMap K[X] (RatFunc K)) (denom ((algebraMap K[X] (RatFunc K)) p / (algebraMap K[X] (RatFunc K)) q)) =
    (algebraMap K[X] (RatFunc K)) p / (algebraMap K[X] (RatFunc K)) q

Next tactic:
have q_div_ne_zero : q / gcd p q ≠ 0 := right_div_gcd_ne_zero hq
@[simp]
theorem num_div_denom (x : RatFunc K) : algebraMap _ _ (num x) / algebraMap _ _ (denom x) = x := by
  induction' x using RatFunc.induction_on with p q hq
  -- porting note: had to hint the type of this `have`
  have q_div_ne_zero : q / gcd p q ≠ 0 := right_div_gcd_ne_zero hq
  

Proof state:
case f
K : Type u
inst✝ : Field K
p q : K[X]
hq : q ≠ 0
q_div_ne_zero : q / gcd p q ≠ 0
⊢ (algebraMap K[X] (RatFunc K)) (num ((algebraMap K[X] (RatFunc K)) p / (algebraMap K[X] (RatFunc K)) q)) /
      (algebraMap K[X] (RatFunc K)) (denom ((algebraMap K[X] (RatFunc K)) p / (algebraMap K[X] (RatFunc K)) q)) =
    (algebraMap K[X] (RatFunc K)) p / (algebraMap K[X] (RatFunc K)) q

Next tactic:
rw [num_div p q, denom_div p hq, RingHom.map_mul, RingHom.map_mul, mul_div_mul_left,
    div_eq_div_iff, ← RingHom.map_mul, ← RingHom.map_mul, mul_comm _ q, ←
    EuclideanDomain.mul_div_assoc, ← EuclideanDomain.mul_div_assoc, mul_comm]
@[simp]
theorem num_div_denom (x : RatFunc K) : algebraMap _ _ (num x) / algebraMap _ _ (denom x) = x := by
  induction' x using RatFunc.induction_on with p q hq
  -- porting note: had to hint the type of this `have`
  have q_div_ne_zero : q / gcd p q ≠ 0 := right_div_gcd_ne_zero hq
  rw [num_div p q, denom_div p hq, RingHom.map_mul, RingHom.map_mul, mul_div_mul_left,
    div_eq_div_iff, ← RingHom.map_mul, ← RingHom.map_mul, mul_comm _ q, ←
    EuclideanDomain.mul_div_assoc, ← EuclideanDomain.mul_div_assoc, mul_comm]
  · 

Proof state:
case f.h
K : Type u
inst✝ : Field K
p q : K[X]
hq : q ≠ 0
q_div_ne_zero : q / gcd p q ≠ 0
⊢ gcd p q ∣ q

Next tactic:
apply gcd_dvd_right
@[simp]
theorem num_div_denom (x : RatFunc K) : algebraMap _ _ (num x) / algebraMap _ _ (denom x) = x := by
  induction' x using RatFunc.induction_on with p q hq
  -- porting note: had to hint the type of this `have`
  have q_div_ne_zero : q / gcd p q ≠ 0 := right_div_gcd_ne_zero hq
  rw [num_div p q, denom_div p hq, RingHom.map_mul, RingHom.map_mul, mul_div_mul_left,
    div_eq_div_iff, ← RingHom.map_mul, ← RingHom.map_mul, mul_comm _ q, ←
    EuclideanDomain.mul_div_assoc, ← EuclideanDomain.mul_div_assoc, mul_comm]
  · apply gcd_dvd_right
  · 

Proof state:
case f.h
K : Type u
inst✝ : Field K
p q : K[X]
hq : q ≠ 0
q_div_ne_zero : q / gcd p q ≠ 0
⊢ gcd p q ∣ p

Next tactic:
apply gcd_dvd_left
@[simp]
theorem num_div_denom (x : RatFunc K) : algebraMap _ _ (num x) / algebraMap _ _ (denom x) = x := by
  induction' x using RatFunc.induction_on with p q hq
  -- porting note: had to hint the type of this `have`
  have q_div_ne_zero : q / gcd p q ≠ 0 := right_div_gcd_ne_zero hq
  rw [num_div p q, denom_div p hq, RingHom.map_mul, RingHom.map_mul, mul_div_mul_left,
    div_eq_div_iff, ← RingHom.map_mul, ← RingHom.map_mul, mul_comm _ q, ←
    EuclideanDomain.mul_div_assoc, ← EuclideanDomain.mul_div_assoc, mul_comm]
  · apply gcd_dvd_right
  · apply gcd_dvd_left
  · 

Proof state:
case f.hb
K : Type u
inst✝ : Field K
p q : K[X]
hq : q ≠ 0
q_div_ne_zero : q / gcd p q ≠ 0
⊢ (algebraMap K[X] (RatFunc K)) (q / gcd p q) ≠ 0

Next tactic:
exact algebraMap_ne_zero q_div_ne_zero
@[simp]
theorem num_div_denom (x : RatFunc K) : algebraMap _ _ (num x) / algebraMap _ _ (denom x) = x := by
  induction' x using RatFunc.induction_on with p q hq
  -- porting note: had to hint the type of this `have`
  have q_div_ne_zero : q / gcd p q ≠ 0 := right_div_gcd_ne_zero hq
  rw [num_div p q, denom_div p hq, RingHom.map_mul, RingHom.map_mul, mul_div_mul_left,
    div_eq_div_iff, ← RingHom.map_mul, ← RingHom.map_mul, mul_comm _ q, ←
    EuclideanDomain.mul_div_assoc, ← EuclideanDomain.mul_div_assoc, mul_comm]
  · apply gcd_dvd_right
  · apply gcd_dvd_left
  · exact algebraMap_ne_zero q_div_ne_zero
  · 

Proof state:
case f.hd
K : Type u
inst✝ : Field K
p q : K[X]
hq : q ≠ 0
q_div_ne_zero : q / gcd p q ≠ 0
⊢ (algebraMap K[X] (RatFunc K)) q ≠ 0

Next tactic:
exact algebraMap_ne_zero hq
@[simp]
theorem num_div_denom (x : RatFunc K) : algebraMap _ _ (num x) / algebraMap _ _ (denom x) = x := by
  induction' x using RatFunc.induction_on with p q hq
  -- porting note: had to hint the type of this `have`
  have q_div_ne_zero : q / gcd p q ≠ 0 := right_div_gcd_ne_zero hq
  rw [num_div p q, denom_div p hq, RingHom.map_mul, RingHom.map_mul, mul_div_mul_left,
    div_eq_div_iff, ← RingHom.map_mul, ← RingHom.map_mul, mul_comm _ q, ←
    EuclideanDomain.mul_div_assoc, ← EuclideanDomain.mul_div_assoc, mul_comm]
  · apply gcd_dvd_right
  · apply gcd_dvd_left
  · exact algebraMap_ne_zero q_div_ne_zero
  · exact algebraMap_ne_zero hq
  · 

Proof state:
case f.hc
K : Type u
inst✝ : Field K
p q : K[X]
hq : q ≠ 0
q_div_ne_zero : q / gcd p q ≠ 0
⊢ (algebraMap K[X] (RatFunc K)) (C (leadingCoeff (q / gcd p q))⁻¹) ≠ 0

Next tactic:
refine' algebraMap_ne_zero (mt Polynomial.C_eq_zero.mp _)
@[simp]
theorem num_div_denom (x : RatFunc K) : algebraMap _ _ (num x) / algebraMap _ _ (denom x) = x := by
  induction' x using RatFunc.induction_on with p q hq
  -- porting note: had to hint the type of this `have`
  have q_div_ne_zero : q / gcd p q ≠ 0 := right_div_gcd_ne_zero hq
  rw [num_div p q, denom_div p hq, RingHom.map_mul, RingHom.map_mul, mul_div_mul_left,
    div_eq_div_iff, ← RingHom.map_mul, ← RingHom.map_mul, mul_comm _ q, ←
    EuclideanDomain.mul_div_assoc, ← EuclideanDomain.mul_div_assoc, mul_comm]
  · apply gcd_dvd_right
  · apply gcd_dvd_left
  · exact algebraMap_ne_zero q_div_ne_zero
  · exact algebraMap_ne_zero hq
  · refine' algebraMap_ne_zero (mt Polynomial.C_eq_zero.mp _)
    

Proof state:
case f.hc
K : Type u
inst✝ : Field K
p q : K[X]
hq : q ≠ 0
q_div_ne_zero : q / gcd p q ≠ 0
⊢ ¬(leadingCoeff (q / gcd p q))⁻¹ = 0

Next tactic:
exact inv_ne_zero (Polynomial.leadingCoeff_ne_zero.mpr q_div_ne_zero)
theorem isCoprime_num_denom (x : RatFunc K) : IsCoprime x.num x.denom := by
  

Proof state:
K : Type u
inst✝ : Field K
x : RatFunc K
⊢ IsCoprime (num x) (denom x)

Next tactic:
induction' x using RatFunc.induction_on with p q hq
theorem isCoprime_num_denom (x : RatFunc K) : IsCoprime x.num x.denom := by
  induction' x using RatFunc.induction_on with p q hq
  

Proof state:
case f
K : Type u
inst✝ : Field K
p q : K[X]
hq : q ≠ 0
⊢ IsCoprime (num ((algebraMap K[X] (RatFunc K)) p / (algebraMap K[X] (RatFunc K)) q))
    (denom ((algebraMap K[X] (RatFunc K)) p / (algebraMap K[X] (RatFunc K)) q))

Next tactic:
rw [num_div, denom_div _ hq]
theorem isCoprime_num_denom (x : RatFunc K) : IsCoprime x.num x.denom := by
  induction' x using RatFunc.induction_on with p q hq
  rw [num_div, denom_div _ hq]
  

Proof state:
case f
K : Type u
inst✝ : Field K
p q : K[X]
hq : q ≠ 0
⊢ IsCoprime (C (leadingCoeff (q / gcd p q))⁻¹ * (p / gcd p q)) (C (leadingCoeff (q / gcd p q))⁻¹ * (q / gcd p q))

Next tactic:
exact (isCoprime_mul_unit_left
    ((leadingCoeff_ne_zero.2 <| right_div_gcd_ne_zero hq).isUnit.inv.map C) _ _).2
      (isCoprime_div_gcd_div_gcd hq)
@[simp]
theorem num_eq_zero_iff {x : RatFunc K} : num x = 0 ↔ x = 0 :=
  ⟨fun h => by 

Proof state:
K : Type u
inst✝ : Field K
x : RatFunc K
h : num x = 0
⊢ x = 0

Next tactic:
rw [← num_div_denom x, h, RingHom.map_zero, zero_div]
theorem num_mul_eq_mul_denom_iff {x : RatFunc K} {p q : K[X]} (hq : q ≠ 0) :
    x.num * q = p * x.denom ↔ x = algebraMap _ _ p / algebraMap _ _ q := by
  

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

Next tactic:
rw [← (algebraMap_injective K).eq_iff, eq_div_iff (algebraMap_ne_zero hq)]
theorem num_mul_eq_mul_denom_iff {x : RatFunc K} {p q : K[X]} (hq : q ≠ 0) :
    x.num * q = p * x.denom ↔ x = algebraMap _ _ p / algebraMap _ _ q := by
  rw [← (algebraMap_injective K).eq_iff, eq_div_iff (algebraMap_ne_zero hq)]
  

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

Next tactic:
conv_rhs => rw [← num_div_denom x]
theorem num_mul_eq_mul_denom_iff {x : RatFunc K} {p q : K[X]} (hq : q ≠ 0) :
    x.num * q = p * x.denom ↔ x = algebraMap _ _ p / algebraMap _ _ q := by
  rw [← (algebraMap_injective K).eq_iff, eq_div_iff (algebraMap_ne_zero hq)]
  conv_rhs => 

Proof state:
K : Type u
inst✝ : Field K
x : RatFunc K
p q : K[X]
hq : q ≠ 0
| x * (algebraMap K[X] (RatFunc K)) q = (algebraMap K[X] (RatFunc K)) p

Next tactic:
rw [← num_div_denom x]
theorem num_mul_eq_mul_denom_iff {x : RatFunc K} {p q : K[X]} (hq : q ≠ 0) :
    x.num * q = p * x.denom ↔ x = algebraMap _ _ p / algebraMap _ _ q := by
  rw [← (algebraMap_injective K).eq_iff, eq_div_iff (algebraMap_ne_zero hq)]
  conv_rhs => rw [← num_div_denom x]
  

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

Next tactic:
rw [RingHom.map_mul, RingHom.map_mul, div_eq_mul_inv, mul_assoc, mul_comm (Inv.inv _), ←
    mul_assoc, ← div_eq_mul_inv, div_eq_iff]
theorem num_mul_eq_mul_denom_iff {x : RatFunc K} {p q : K[X]} (hq : q ≠ 0) :
    x.num * q = p * x.denom ↔ x = algebraMap _ _ p / algebraMap _ _ q := by
  rw [← (algebraMap_injective K).eq_iff, eq_div_iff (algebraMap_ne_zero hq)]
  conv_rhs => rw [← num_div_denom x]
  rw [RingHom.map_mul, RingHom.map_mul, div_eq_mul_inv, mul_assoc, mul_comm (Inv.inv _), ←
    mul_assoc, ← div_eq_mul_inv, div_eq_iff]
  

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

Next tactic:
exact algebraMap_ne_zero (denom_ne_zero x)
theorem num_denom_add (x y : RatFunc K) :
    (x + y).num * (x.denom * y.denom) = (x.num * y.denom + x.denom * y.num) * (x + y).denom :=
  (num_mul_eq_mul_denom_iff (mul_ne_zero (denom_ne_zero x) (denom_ne_zero y))).mpr <| by
    

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:
conv_lhs => rw [← num_div_denom x, ← num_div_denom y]
theorem num_denom_add (x y : RatFunc K) :
    (x + y).num * (x.denom * y.denom) = (x.num * y.denom + x.denom * y.num) * (x + y).denom :=
  (num_mul_eq_mul_denom_iff (mul_ne_zero (denom_ne_zero x) (denom_ne_zero y))).mpr <| by
    conv_lhs => 

Proof state:
K : Type u
inst✝ : Field K
x y : RatFunc K
| x + y

Next tactic:
rw [← num_div_denom x, ← num_div_denom y]
theorem num_denom_add (x y : RatFunc K) :
    (x + y).num * (x.denom * y.denom) = (x.num * y.denom + x.denom * y.num) * (x + y).denom :=
  (num_mul_eq_mul_denom_iff (mul_ne_zero (denom_ne_zero x) (denom_ne_zero y))).mpr <| by
    conv_lhs => rw [← num_div_denom x, ← num_div_denom y]
    

Proof state:
K : Type u
inst✝ : Field K
x y : RatFunc K
⊢ (algebraMap K[X] (RatFunc K)) (num x) / (algebraMap K[X] (RatFunc K)) (denom x) +
      (algebraMap K[X] (RatFunc K)) (num y) / (algebraMap K[X] (RatFunc K)) (denom 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 [div_add_div, RingHom.map_mul, RingHom.map_add, RingHom.map_mul, RingHom.map_mul]
theorem num_denom_add (x y : RatFunc K) :
    (x + y).num * (x.denom * y.denom) = (x.num * y.denom + x.denom * y.num) * (x + y).denom :=
  (num_mul_eq_mul_denom_iff (mul_ne_zero (denom_ne_zero x) (denom_ne_zero y))).mpr <| by
    conv_lhs => rw [← num_div_denom x, ← num_div_denom y]
    rw [div_add_div, RingHom.map_mul, RingHom.map_add, RingHom.map_mul, RingHom.map_mul]
    · 

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 num_denom_add (x y : RatFunc K) :
    (x + y).num * (x.denom * y.denom) = (x.num * y.denom + x.denom * y.num) * (x + y).denom :=
  (num_mul_eq_mul_denom_iff (mul_ne_zero (denom_ne_zero x) (denom_ne_zero y))).mpr <| by
    conv_lhs => rw [← num_div_denom x, ← num_div_denom y]
    rw [div_add_div, RingHom.map_mul, RingHom.map_add, RingHom.map_mul, RingHom.map_mul]
    · 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 num_denom_neg (x : RatFunc K) : (-x).num * x.denom = -x.num * (-x).denom := by
  

Proof state:
K : Type u
inst✝ : Field K
x : RatFunc K
⊢ num (-x) * denom x = -num x * denom (-x)

Next tactic:
rw [num_mul_eq_mul_denom_iff (denom_ne_zero x), _root_.map_neg, neg_div, num_div_denom]
theorem num_denom_mul (x y : RatFunc K) :
    (x * y).num * (x.denom * y.denom) = x.num * y.num * (x * y).denom :=
  (num_mul_eq_mul_denom_iff (mul_ne_zero (denom_ne_zero x) (denom_ne_zero y))).mpr <| by
    

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:
conv_lhs =>
      rw [← num_div_denom x, ← num_div_denom y, div_mul_div_comm, ← RingHom.map_mul, ←
        RingHom.map_mul]
theorem num_denom_mul (x y : RatFunc K) :
    (x * y).num * (x.denom * y.denom) = x.num * y.num * (x * y).denom :=
  (num_mul_eq_mul_denom_iff (mul_ne_zero (denom_ne_zero x) (denom_ne_zero y))).mpr <| by
    conv_lhs =>
      

Proof state:
K : Type u
inst✝ : Field K
x y : RatFunc K
| x * y

Next tactic:
rw [← num_div_denom x, ← num_div_denom y, div_mul_div_comm, ← RingHom.map_mul, ←
        RingHom.map_mul]
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
  

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

Next tactic:
constructor
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
  · 

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

Next tactic:
rintro ⟨q, 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⟩
    

Proof state:
case mp.intro
K : Type u
inst✝ : Field K
x : RatFunc K
q : K[X]
hp : num x * q ≠ 0
⊢ ∃ q_1, q_1 ≠ 0 ∧ x = (algebraMap K[X] (RatFunc K)) (num x * q) / (algebraMap K[X] (RatFunc K)) q_1

Next tactic:
obtain ⟨_hx, hq⟩ := mul_ne_zero_iff.mp hp
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
    

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

Next tactic:
use denom x * q
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
    

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
⊢ denom x * q ≠ 0 ∧ x = (algebraMap K[X] (RatFunc K)) (num x * q) / (algebraMap K[X] (RatFunc K)) (denom x * q)

Next tactic:
rw [RingHom.map_mul, RingHom.map_mul, ← div_mul_div_comm, div_self, mul_one, num_div_denom]
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]
    · 

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
⊢ denom x * q ≠ 0 ∧ x = x

Next tactic:
exact ⟨mul_ne_zero (denom_ne_zero x) hq, rfl⟩