CoRN.logic.Classic


Require Import List.

Classical Logic

This section introduces the classical logic connectives, "classical or" and "classical exists" through their double negation translation. Induction principles are given that allow you to destruct these formulas as you would their constructive counter parts, so long as the conclusion is double negataion stable.
No classical axioms are assumed.

Classical or


Section ClassicOr.

Definition orC (P Q:Prop) := ~((¬P)/\(¬Q)).

Lemma orWeaken : P Q, ({P}+{Q}) → orC P Q.
Proof.
 unfold orC.
 tauto.
Qed.

Lemma orC_ind : (P Q G:Prop),
 (~~GG) → (PG) → (QG) → (orC P Q) → G.
Proof.
 unfold orC.
 tauto.
Qed.

Lemma orC_stable : P Q, ~~(orC P Q)orC P Q.
Proof.
 unfold orC.
 auto.
Qed.

End ClassicOr.

Classical Existential

Section ClassicExists.

Variable A : Type.
Variable P : AProp.

Definition existsC : Prop :=
 ¬ x:A, ¬P x.

Lemma existsWeaken : ( x:A, P x) → existsC.
Proof.
 intros [x Hx] H.
 apply (H x).
 assumption.
Qed.

Lemma existsC_ind : (Q:Prop),
 (~~QQ) → ( x:A, P xQ) → existsCQ.
Proof.
 intros Q HQ H ex.
 apply HQ.
 intros Z.
 apply ex.
 intros x Hx.
 apply Z.
 apply H with x.
 assumption.
Qed.

Lemma existsC_stable : ~~existsCexistsC.
Proof.
 unfold existsC.
 auto.
Qed.

End ClassicExists.

Pidgeon Hole Principle

Here we show the classical result of the pigenon hole principle using the classical quantifiers.
Given a finite list of elements and a relation P(n,x) saying when items from the list are selected, there classically exists an item that is selected a classically infinite number of times.

Lemma infinitePidgeonHolePrinicple :
  (X:Type) (l:list X) (P:natXProp),
 ( n, existsC X (fun x~~In x l P n x)) →
 existsC X (fun xIn x l n, existsC nat (fun m ⇒ (n m)%nat (P m x))).
Proof.
 intros X l.
 induction l; intros P HP G.
  apply (HP O).
  intros x [Hx _].
  auto with ×.
 apply (G a).
 split; auto with ×.
 intros n Hn.
 set (P':= fun mP (m+n)%nat).
 assert (HP' : m : nat, existsC X (fun x~~In x l P' m x)).
  intros m.
  unfold P'.
  destruct (HP (m + n)%nat) as [HG | y [Hy0 Hy1]] using existsC_ind.
   apply existsC_stable; auto.
  apply existsWeaken.
   y.
  split; auto.
  revert Hy0.
  cut (In y (a :: l) → In y l);[tauto|].
  intros Hy0.
  destruct Hy0; auto.
  elim (Hn (m + n)%nat).
  rewrite H.
  auto with ×.
 destruct (IHl P' HP') as [HG | x [Hx0 Hx1]] using existsC_ind.
  tauto.
 apply (G x).
 split; auto with ×.
 unfold P' in Hx1.
 intros n0.
 destruct (Hx1 n0) as [HG | m [Hm0 Hm1]] using existsC_ind.
  apply existsC_stable; auto.
 apply existsWeaken.
  (m + n)%nat.
 split; auto.
 auto with ×.
Qed.

This weaker version of the pidgen hole principle uses a function to select elements from a list instead of a releation. It may be more convienent to use at times.
Lemma infinitePidgeonHolePrinicpleB :
  (X:Type) (l:list X) (f:natX),
 ( n, In (f n) l) →
 existsC X (fun xIn x l n, existsC nat (fun m ⇒ (n m)%nat (f m)=x)).
Proof.
 intros X l f H.
 apply infinitePidgeonHolePrinicple.
 intros n.
 apply existsWeaken.
  (f n).
 auto with ×.
Qed.