(* 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 *)
(** De Morgan's law holds for decidable P if the quantifiers are bounded *)
(** Some nice boolean stuff... *)
Definition istrue (b : bool) := if b then True else False.

Lemma beq_nat_neq : forall n m : nat, n <> m <-> beq_nat n m = false.