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}.

(* Specifications: *)
Lemma rootM p q x : root (p * q) x = root p x || root q x.
Lemma lead_coefZ a p : lead_coef (a *: p) = a * lead_coef p.
Lemma size_prod_seq (I : eqType)  (s : seq I) (F : I -> {poly R}) :
(forall i, i \in s -> F i != 0) ->
size (\prod_(i <- s) F i) = ((\sum_(i <- s) size (F i)).+1 - size s)%N.
Lemma size_mul_eq1 p q :
(size (p * q) == 1%N) = ((size p == 1%N) && (size q == 1%N)).
Lemma size_prod_seq_eq1 (I : eqType) (s : seq I) (P : pred I) (F : I -> {poly R}) :
reflect (forall i, P i && (i \in s) -> size (F i) = 1%N)
(size (\prod_(i <- s | P i) F i) == 1%N).
Lemma size_prod_eq1 (I : finType) (P : pred I) (F : I -> {poly R}) :
reflect (forall i, P i -> size (F i) = 1%N)
(size (\prod_(i | P i) F i) == 1%N).
Lemma size_exp p n : (size (p ^+ n)).-1 = ((size p).-1 * n)%N.
Lemma lead_coef_exp p n : lead_coef (p ^+ n) = lead_coef p ^+ n.
Lemma root_prod_XsubC rs x :
root (\prod_(a <- rs) ('X - a%:P)) x = (x \in rs).
Lemma root_exp_XsubC n a x : root (('X - a%:P) ^+ n.+1) x = (x == a).
Lemma lead_coef_comp p q : size q > 1 ->
lead_coef (p \Po q) = (lead_coef p) * lead_coef q ^+ (size p).-1.
Lemma comp_poly_eq0 p q : size q > 1 -> (p \Po q == 0) = (p == 0).
Lemma size_comp_poly2 p q : size q = 2 -> size (p \Po q) = size p.
Lemma comp_poly2_eq0 p q : size q = 2 -> (p \Po q == 0) = (p == 0).
Lemma roots_geq_poly_eq0 p (rs : seq R) : all (root p) rs -> uniq rs ->
(size rs >= size p)%N -> p = 0.
Lemma lead_coef_map p : lead_coef p^f = f (lead_coef p).
Lemma map_poly_eq0 p : (p^f == 0) = (p == 0).
Lemma map_monic p : (p^f \is monic) = (p \is monic).
End MapFieldPoly.