proposition: Theorem div_mod_unique : forall b q1 q2 r1 r2 : t, 0<=r1<abs b -> 0<=r2<abs b -> b*q1+r1 == b*q2+r2 -> q1 == q2 /\ r1 == r2.
proof: Proof. intros b q1 q2 r1 r2 Hr1 Hr2 EQ. pos_or_neg b. - rewrite abs_eq in * by trivial. apply div_mod_unique with b; trivial. - rewrite abs_neq' in * by auto using lt_le_incl. rewrite eq_sym_iff. apply div_mod_unique with (-b); trivial. rewrite 2 mul_opp_l. rewrite add_move_l, sub_opp_r. rewrite <-add_assoc. symmetry. rewrite add_move_l, sub_opp_r. now rewrite (add_comm r2), (add_comm r1). Qed.
imports: ZAxioms ZMulOrder ZSgnAbs NZDiv