Fact ratz_frac n : ratz n = fracq (n, 1).
Fact scalq_key : unit. Proof. by []. Qed.
Definition scalq_def x := sgr x.2 * (gcdn `|x.1| `|x.2|)%:Z.
Definition scalq := locked_with scalq_key scalq_def.
Canonical scalq_unlockable := [unlockable fun scalq].
Fact scalq_eq0 x : (scalq x == 0) = (x.2 == 0).

(* Specifications: *)
Lemma sgr_scalq x : sgr (scalq x) = sgr x.2.
Lemma signr_scalq x : (scalq x < 0) = (x.2 < 0).
Definition zeroq := fracq (0, 1).