End WeakTheoryForIDomainPseudoDivision.
Hint Resolve lc_expn_scalp_neq0 : core.
End WeakIdomain.
Module CommonIdomain.
Section IDomainPseudoDivision.
Variable R : idomainType.
Implicit Type p q r d m n : {poly R}.

(* Specifications: *)
Lemma scalp0 p : scalp p 0 = 0%N.
Lemma leq_divp p q : (size (p %/ q) <= size p).
Lemma div0p p : 0 %/ p = 0.
Lemma divp0 p : p %/ 0 = 0.
Lemma divp1 m : m %/ 1 = m.
Lemma modp0 p : p %% 0 = p.
Lemma mod0p p : 0 %% p = 0.
Lemma modp1 p : p %% 1 = 0.
Hint Resolve divp0 divp1 mod0p modp0 modp1 : core.
Lemma modp_small p q : size p < size q -> p %% q = p.
Lemma modpC p c : c != 0 -> p %% c%:P = 0.
Lemma modp_mull p q : (p * q) %% q = 0.
Lemma modp_mulr d p : (d * p) %% d = 0.
Lemma ltn_divpl d q p : d != 0 ->
(size (q %/ d) < size p) = (size q < size (p * d)).
Lemma leq_divpr d p q : d != 0 ->
(size p <= size (q %/ d)) = (size (p * d) <= size q).
Lemma size_divp p q : q != 0 -> size (p %/ q) = ((size p) - (size q).-1)%N.
Lemma ltn_modpN0 p q : q != 0 -> size (p %% q) < size q.
Lemma leq_modp m d : size (m %% d)  <= size m.
Lemma dvdp0 d : d %| 0.
Lemma dvd1p m : 1 %| m.
Lemma modp_eq0P p q : reflect (p %% q = 0) (q %| p).
Lemma dvdp_leq p q : q != 0 -> p %| q -> size p <= size q.
move=> nq0 /modp_eq0P => rpq; case: (ltnP (size p) (size q)).