(* This program is free software; you can redistribute it and/or      *)
(* modify it under the terms of the GNU Lesser General Public License *)
(* as published by the Free Software Foundation; either version 2.1   *)
(* of the License, or (at your option) any later version.             *)
(*                                                                    *)
(* This program is distributed in the hope that it will be useful,    *)
(* but WITHOUT ANY WARRANTY; without even the implied warranty of     *)
(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      *)
(* GNU General Public License for more details.                       *)
(*                                                                    *)
(* You should have received a copy of the GNU Lesser General Public   *)
(* License along with this program; if not, write to the Free         *)
(* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *)
(* 02110-1301 USA                                                     *)
(** order. The order of elements in the multgroup modulo p.  @author Olga Caprotti and Martijn Oostdijk @version $Revision$ *)
(** (Order b q p) means the order of b is q in multgroup(Z_p). *)
Definition Order (b : Z) (q p : nat) :=
0 < q /\
Mod (Exp b q) 1 p /\ (forall d : nat, 0 < d -> Mod (Exp b d) 1 p -> q <= d).

Lemma order_div :
forall (b : Z) (x p : nat),
Order b x p -> forall y : nat, 0 < y -> Mod (Exp b y) 1 p -> Divides x y.