Variant edivp_spec (m d : {poly R}) :
nat * {poly R} * {poly R} -> bool -> Type :=
|Redivp_spec k (q r: {poly R}) of
(lead_coef d ^+ k) *: m = q * d + r & lead_coef d \notin GRing.unit &
(d != 0 -> size r < size d) : edivp_spec m d (k, q, r) false
|Fedivp_spec (q r: {poly R}) of m = q * d + r & (lead_coef d \in GRing.unit) &
(d != 0 -> size r < size d) : edivp_spec m d (0%N, q, r) true.

Lemma divpK d p : d %| p -> p %/ d * d = ((lead_coef d) ^+ (scalp p d)) *: p.