(** Let [f] be a function over a set [A] *)

Parameter A : Set.Parameter eq_A_dec : forall (x y:A), {x=y}+{~x=y}.Parameter f : A -> A.Parameter x0 : A.(** We consider the sequence $x_i = f^i(x_0)$ *)

Fixpoint x (i:nat) { struct i } : A := match i with
  | O => x0
  | S j => f (x j)
  end.(** We assume this sequence cycles after [lambda+mu] iterations, [mu]
    being the length of the cycle (we actually don't require [lambda] and
    [mu] to be minimal, because it is not needed for the remaining of the 
    proof *)

Parameter lambda : nat.Parameter mu : nat.Axiom mu_positive : mu > 0.Axiom lambda_mu : forall i j, x (lambda+i) = x (lambda+i+j*mu).(** Hilbert's epsilon operator. *)

Parameter epsilon : (nat -> Prop) -> nat.Axiom epsilon_spec : forall P, ex P -> P (epsilon P).(** The distance between [x (2m)] and [x m] defined using [epsilon] *)

Definition sep_x2m_xm m i := x (2*m+i) = x m.Definition min P i := P i /\ forall j, P j -> i <= j.Definition dist_x2m_xm m := epsilon (min (sep_x2m_xm m)).(** Existence of this distance whenever [lambda <= m] *)

Axiom ex_min_P : forall P, (forall x, {P x}+{~(P x)}) -> ex P -> ex (min P).Axiom div : forall a, a > 0 -> forall b, exists k, k*a >= b.

Lemma ex_dist_x2m_xm : forall m, lambda <= m -> ex (min (sep_x2m_xm m)).