End Of_Z.
End ZnZ.
(** A modular specification grouping the earlier records. *)
Module Type CyclicType.
Parameter t : Set.
#[global]
Declare Instance ops : ZnZ.Ops t.
#[global]
Declare Instance specs : ZnZ.Specs ops.
End CyclicType.
(** A Cyclic structure can be seen as a ring *)
Module CyclicRing (Import Cyclic : CyclicType).
Local Notation "[| x |]" := (ZnZ.to_Z x) (at level 0, x at level 99).
Definition eq (n m : t) := [| n |] = [| m |].
Local Infix "=="  := eq (at level 70).
Local Notation "0" := ZnZ.zero.
Local Notation "1" := ZnZ.one.
Local Infix "+" := ZnZ.add.
Local Infix "-" := ZnZ.sub.
Local Notation "- x" := (ZnZ.opp x).
Local Infix "*" := ZnZ.mul.
Local Notation wB := (base ZnZ.digits).
Global Hint Rewrite ZnZ.spec_0 ZnZ.spec_1 ZnZ.spec_add ZnZ.spec_mul
ZnZ.spec_opp ZnZ.spec_sub
: cyclic.
Ltac zify := unfold eq in *; autorewrite with cyclic.

Lemma eqb_eq : forall x y, eqb x y = true <-> x == y.