End ITERATION.
End PrimIter.
(** * General iteration *)
(* An implementation using classical logic and unbounded iteration, in the style of Yves Bertot's paper, "Extending the Calculus of Constructions with Tarski's fix-point theorem".  As in the bounded case, the [iterate] function returns an option type. [None] means that iteration does not terminate. [Some b] means that iteration terminates with the result [b]. *)
Module GenIter.
Section ITERATION.
Variables A B: Type.
Variable step: A -> B + A.
Definition B_le (x y: option B) : Prop := x = None \/ y = x.
Definition F_le (x y: A -> option B) : Prop := forall a, B_le (x a) (y a).
Definition F_iter (next: A -> option B) (a: A) : option B :=
match step a with
| inl b => Some b
| inr a' => next a'
end.

Lemma F_iter_monot:
forall f g, F_le f g -> F_le (F_iter f) (F_iter g).