(* Copyright 2012-2015 by Adam Petcher.				* * Use of this source code is governed by the license described	* * in the LICENSE file at the root of the source tree.		*)
(* Sampling an element from a finite cyclic group *)
Require Export FCF.GroupTheory.
Local Open Scope group_scope.
Definition RndGrpElem`{FCG : FiniteCyclicGroup}{eqd : EqDec GroupElement} :=
n <-$ [0 .. order);
ret (g^n).
Section RndGrpElem.
Context`{FCG : FiniteCyclicGroup}.
Hypothesis GroupElement_EqDec : EqDec GroupElement.

(* Specifications: *)
Theorem RndGrpElem_wf : well_formed_comp RndGrpElem.
unfold RndGrpElem.