Local Notation simp := Monoid.simpm.Implicit Types d p q r : {poly R}.Fact redivp_key : unit.Definition redivp : {poly R} -> {poly R} -> nat * {poly R} * {poly R} :=
  locked_with redivp_key redivp_expanded_def.

(* Specifications: *)
Lemma redivp_def p q : redivp p q = (rscalp p q, rdivp p q, rmodp p q).
Lemma rdiv0p p : rdivp 0 p = 0.
Lemma rdivp0 p : rdivp p 0 = 0.
Lemma rdivp_small p q : size p < size q -> rdivp p q = 0.
Lemma leq_rdivp p q : size (rdivp p q) <= size p.
Lemma rmod0p p : rmodp 0 p = 0.
Lemma rmodp0 p : rmodp p 0 = p.
Lemma rscalp_small p q : size p < size q -> rscalp p q = 0%N.
Lemma rmodp1 p : rmodp p 1 = 0.
Lemma rmodp_small p q : size p < size q -> rmodp p q = p.
Lemma leq_rmodp m d : size (rmodp m d) <= size m.
Lemma rdvdp0 d : rdvdp d 0.
Lemma rdvd0pP n : reflect (n = 0) (rdvdp 0 n).
Lemma rdvd1p m : rdvdp 1 m.
Lemma rmodp_eq0P p q : reflect (rmodp p q = 0) (rdvdp q p).
Lemma rmodp_eq0 p q : rdvdp q p -> rmodp p q = 0.
Lemma rgcd0p : left_id 0 rgcdp.
Lemma rgcdp0 : right_id 0 rgcdp.
Lemma rgcdpE p q : rgcdp p q = if size p < size q then rgcdp (rmodp q p) p else rgcdp (rmodp p q) q.
Lemma comm_redivpP m d : comm_redivp_spec m d (redivp m d).