(* 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                                                     *)
(** dec. Some utilities for proving decidability of predicates.  @author Olga Caprotti and Martijn Oostdijk @version $Revision$ *)
(** Checks that all nats before n are P *)
Fixpoint allbefore (P : nat -> Prop) (n : nat) {struct n} : Prop :=
match n with
| O => True
| S x => allbefore P x /\ P x
end.
(** Checks that some nat before n is P *)
Fixpoint exbefore (P : nat -> Prop) (n : nat) {struct n} : Prop :=
match n with
| O => False
| S x => exbefore P x \/ P x
end.
(** some decidable relations on nat *)
(** relations on Z *)
(** the connectives preserve decidability *)
(** bounded quantifiers preserve decidability *)

Theorem exdec :
forall (P : nat -> Prop) (N : nat),
(forall n : nat, P n \/ ~ P n) ->
(exists x : nat, x < N /\ P x) \/ ~ (exists x : nat, x < N /\ P x).