Section ZModulo.
Variable digits : positive.
Hypothesis digits_ne_1 : digits <> 1%positive.
Definition wB := base digits.
Definition t := Z.
Definition zdigits := Zpos digits.
Definition to_Z x := x mod wB.
Notation "[| x |]" := (to_Z x)  (at level 0, x at level 99).
Notation "[+| c |]" :=
(interp_carry 1 wB to_Z c)  (at level 0, c at level 99).
Notation "[-| c |]" :=
(interp_carry (-1) wB to_Z c)  (at level 0, c at level 99).
Notation "[|| x ||]" :=
(zn2z_to_Z wB to_Z x)  (at level 0, x at level 99).
Let digits_gt_1 := spec_more_than_1_digit.
Hint Resolve wB_pos : core.
Hint Resolve spec_to_Z_1 spec_to_Z_2 : core.
Definition of_pos x :=
let (q,r) := Z.pos_div_eucl x wB in (N_of_Z q, r).
Definition zero := 0.
Definition one := 1.
Definition minus_one := wB - 1.

Lemma spec_Bm1 : [|minus_one|] = wB - 1.