(**************************************************************)
(*   Copyright Dominique Larchey-Wendling [*]                 *)
(*                                                            *)
(*                             [*] Affiliation LORIA -- CNRS  *)
(**************************************************************)
(*      This file is distributed under the terms of the       *)
(*         CeCILL v2 FREE SOFTWARE LICENSE AGREEMENT          *)
(**************************************************************)
Set Implicit Arguments.
(** We show that unbounded decidable predicates are exactly the direct images of strictly increasing sequences nat -> nat  Hence, this gives an easy construction of the sequence of all primes ...  *)
Section sinc_decidable.
Variable (P : nat -> Prop)
(f : nat -> nat)
(Hf : forall n, f n < f (S n))
(HP : forall n, P n <-> exists k, n = f k).
Let f_mono x y : x <= y -> f x <= f y.
Let f_smono x y : x < y -> f x < f y.
Let f_ge_n n : n <= f n.
Let unbounded n : exists k, n <= k /\ P k.

(* Specifications: *)
Theorem sinc_decidable : (forall n, exists k, n <= k /\ P k)
* (forall n, { P n } + { ~ P n }).