Zulip Chat Archive

Stream: Is there code for X?

Topic: p divided q iff p divides k * q for nonzero k (polynomials)


Ilmārs Cīrulis (May 04 2025 at 10:31):

How can one prove this? Is there something in Mathlib, maybe? (I didn't find yet.)

import Mathlib

open Polynomial

theorem thm (p q: [X]) (Hp: Monic p) (k: ) (Hk: k  0):
    p  C k * q  p  q := by
  sorry

Yaël Dillies (May 04 2025 at 10:36):

This is a direct consequence of docs#IsUnit.dvd_mul_left, docs#Polynomial.isUnit_C

Yaël Dillies (May 04 2025 at 10:37):

Hmm, it would be if was a field

Ruben Van de Velde (May 04 2025 at 11:52):

Is it true?

Junyan Xu (May 04 2025 at 12:16):

One possible proof:

import Mathlib.Algebra.GCDMonoid.Nat
import Mathlib.RingTheory.Polynomial.Content

open Polynomial in
theorem thm (p q : [X]) (hp : Monic p) (k : ) (hk : k  0):
    p  C k * q  p  q := by
  obtain rfl | hq := eq_or_ne q 0; · simp
  have := mul_ne_zero (C_ne_zero.mpr hk) hq
  rw [ hp.isPrimitive.dvd_primPart_iff_dvd this,  hp.isPrimitive.dvd_primPart_iff_dvd hq,
    primPart_mul this, (isUnit_primPart_C _).dvd_mul_left]

Ilmārs Cīrulis (May 04 2025 at 13:06):

Thank you!


Last updated: Dec 20 2025 at 21:32 UTC