(** 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.

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