(**
   Below is an attempt to restate Pocklington's theorem
   using only numbers from Z. This will make concrete
   computations faster.
 *)

(** ZallLinCombMod is equivalent to AllLinCombMod but uses Z. *)

Definition ZallLinCombMod (a n m N : Z) (qlist : Zlist) :=
  alllist Z
    (fun q : Z => ZLinCombMod 1 (ZExp a (m * zmultDrop q qlist) - 1) n N)
    qlist.

(* Specifications: *)
Lemma ZallLinCombMod_ok : forall (a n m N : Z) (qlist : Zlist), ZallLinCombMod a n m N qlist -> forall qi : Z, inlist Z qi qlist -> ZLinCombMod 1 (ZExp a (m * zmultDrop qi qlist) - 1) n N.
Lemma alllincombzalllincomb : forall (a n m : Z) (qlist : Zlist), (0 <= n)%Z -> (0 <= m)%Z -> allPos qlist -> ZallLinCombMod a n m n qlist -> allLinCombMod a (Zabs_nat n) (Zabs_nat m) (map _ _ Zabs_nat qlist).
Theorem Zpocklington : forall (n q m a : Z) (qlist : Zlist), (n > 1)%Z -> (0 <= q)%Z -> (0 <= m)%Z -> n = (q * m + 1)%Z -> q = zproduct qlist -> allZPrime qlist -> ZMod (ZExp a (n - 1)) 1 n -> ZallLinCombMod a n m n qlist -> (n <= q * q)%Z -> ZPrime n.