coq impredicative逻辑中的存在量词(系统F)

时间:2013-09-29 20:58:11

标签: logic coq impredicativetypes

我正在尝试编写用lambda演算编码的Coq逻辑连接词,类型为àlaSystem F.这是我写的一堆代码(标准的东西,我认为)

Definition True := forall X: Prop, X -> X.

Lemma I: True.
Proof.
  unfold True. intros. apply H.
Qed.

Section s.
Variables A B: Prop.


(* conjunction *)

Definition and := forall X: Prop, (A -> B -> X) -> X.
Infix "/\" := and.

Lemma and_intro: A -> B -> A/\B.
Proof.
  intros HA HB. split.
  apply HA.
  apply HB.
Qed.

Lemma and_elim_l: A/\B -> A.
Proof.
  intros H. destruct H as [HA HB]. apply HA.
Qed.

Lemma and_elim_r: A/\B -> B.
Proof.
  intros H. destruct H as [HA HB]. apply HB.
Qed.



(* disjunction *)

Definition or := forall X:Prop, (A -> X) -> (B -> X) -> X.
Infix "\/" := or.

Lemma or_intro_l: A -> A\/B.
  intros HA. left. apply HA.
Qed.

Lemma or_elim: forall C:Prop, A \/ B -> (A -> C) -> (B -> C) -> C.
Proof.
  intros C HOR HAC HBC. destruct HOR.
    apply (HAC H).
    apply (HBC H).
Qed.


(* falsity *)

Definition False := forall Y:Prop, Y.

Lemma false_elim: False -> A.
Proof.
  unfold False. intros. apply (H A).
Qed.

End s.

基本上,我写下了关于联合,分离,真与假的消除和引入法则。我不确定是否正确完成了事情,但我认为事情应该是这样的。现在我想定义存在量化,但我不知道如何继续。有没有人有建议?

1 个答案:

答案 0 :(得分:2)

存在量化只是连词的推广,其中对的第二个组成部分的类型取决于第一个组成部分的值。如果没有依赖关系,他们就相当于:

Goal forall P1 P2 : Prop, (exists _ : P1, P2) <-> P1 /\ P2.
Proof. split. intros [H1 H2]. eauto. intros [H1 H2]. eauto. Qed.

Coq'Art从第130页开始有关于不可信度的部分。

Definition ex (T1 : Type) (P1 : T1 -> Prop) : Prop :=
  forall P2 : Prop, (forall x1, P1 x1 -> P2) -> P2.

Notation "'exists' x1 .. x2 , P1" :=
  (ex (fun x1 => .. (ex (fun x2 => P1)) ..))
  (at level 200, x1 binder, right associativity,
  format "'[' 'exists' '/ ' x1 .. x2 , '/ ' P1 ']'") : type_scope.

隐含定义的问题(除非我误解)是没有依赖消除。它可能证明

forall (A : Type) (P : A -> Prop) (Q : Prop),
  (forall x : A, P x -> Q) -> (exists x, P x) -> Q,

但不是

 forall (A : Type) (P : A -> Prop) (Q : (exists x, P x) -> Prop),
   (forall (x : A) (H : P x), Q (ex_intro P x H)) ->
   forall H : exists x, P x, Q H