(** * The list of integers between 1 and n (inclusive) *)
Fixpoint until (n : nat) : Zlist :=
match n with
| O => Nil Z
| S n => Cons Z (Z_of_nat (S n)) (until n)
end.

(* Specifications: *)
Lemma until_ok :
forall (n : nat) (x : Z), (0 < x <= Z_of_nat n)%Z -> inlist Z x (until n).
Lemma until_mod_all :
forall (p : nat) (x : Z),
0 < p ->
~ Mod x 0 p -> exists y : Z, inlist Z y (until (pred p)) /\ Mod x y p.
Lemma until_pos : forall (n : nat) (x : Z), inlist Z x (until n) -> (0 < x)%Z.
Lemma until_le_n :
forall (n : nat) (x : Z), inlist Z x (until n) -> (x <= Z_of_nat n)%Z.
Lemma until_not_0mod :
forall (p : nat) (x : Z),
0 < p -> inlist Z x (until (pred p)) -> ~ Mod x 0 p.
Lemma untiln_prod_not_0modp :
forall p n : nat,
0 < n -> n < p -> Prime p -> ~ Mod (zproduct (until n)) 0 p.
Lemma until_prod_not_0mod :
forall p : nat, Prime p -> ~ Mod (zproduct (until (pred p))) 0 p.
Lemma until_mapmult_exp :
forall (a : Z) (n : nat),
zproduct (mapmult a (until n)) = (Exp a n * zproduct (until n))%Z.
Lemma until_mapmult_allex :
forall (p : nat) (a : Z),
Prime p ->
~ Mod a 0 p -> allex p (until (pred p)) (mapmult a (until (pred p))).
Lemma until_nodoubles1 :
forall p : nat, Prime p -> forall n : nat, n < p -> nodoubles p (until n).
Lemma until_nodoubles :
forall p : nat, Prime p -> nodoubles p (until (pred p)).