Section PolynomialIdomain.
(* Integral domain structure on poly *)
Variable R : idomainType.
Implicit Types (a b x y : R) (p q r m : {poly R}).
Fact poly_idomainAxiom p q : p * q = 0 -> (p == 0) || (q == 0).
Definition poly_unit : pred {poly R} :=
fun p => (size p == 1%N) && (p`_0 \in GRing.unit).
Definition poly_inv p := if p \in poly_unit then (p`_0)^-1%:P else p.
Fact poly_mulVp : {in poly_unit, left_inverse 1 poly_inv *%R}.
Fact poly_intro_unit p q : q * p = 1 -> p \in poly_unit.
Fact poly_inv_out : {in [predC poly_unit], poly_inv =1 id}.

Lemma lead_coefZ a p : lead_coef (a *: p) = a * lead_coef p.