Variant comm_redivp_spec m d : nat * {poly R} * {poly R} -> Type :=
ComEdivnSpec k (q r : {poly R}) of
(GRing.comm d (lead_coef d)%:P -> m * (lead_coef d ^+ k)%:P = q * d + r) &
(d != 0 -> size r < size d) : comm_redivp_spec m d (k, q, r).

(* Specifications: *)
Lemma comm_redivpP m d : comm_redivp_spec m d (redivp m d).
Lemma rmodpp p : GRing.comm p (lead_coef p)%:P -> rmodp p p = 0.
Definition rcoprimep (p q : {poly R}) := size (rgcdp p q) == 1%N.