proposition: Lemma eqdP a b : reflect (exists2 c12 : R, (c12 \is a GRing.unit) & c12 * a = b) (a %= b).
proof: Proof. apply: (iffP andP). case=> /dvdrP [x Hx] /dvdrP [y Hy]. case: (eqVneq b 0) => Hb. rewrite Hb mulr0 in Hy. by exists 1; rewrite ?unitr1 // Hy mulr0 Hb. exists x; last by rewrite Hx. apply/GRing.unitrPr; exists y. rewrite Hy mulrA in Hx. by apply: (mulIf Hb); rewrite -Hx mul1r. case=> c Hc H; split; apply/dvdrP. by exists c; rewrite H. exists (c^-1); apply: (@mulfI _ c). by apply/eqP=> Habs; rewrite Habs unitr0 in Hc. by rewrite mulrA mulrV // mul1r. Qed.
imports: HB(structures) Coq(ssreflect ssrfun ssrbool Arith.Wf_nat) mathcomp(eqtype ssrnat div seq path) mathcomp(ssralg fintype perm tuple choice generic_quotient) mathcomp(matrix bigop zmodp mxalgebra poly) stronglydiscrete