如何或可能证明或伪造“forall(P Q:Prop),(P - > Q) - > (Q - > P) - > Coq中的P = Q。?

时间:2014-10-26 10:39:04

标签: equality coq proof dependent-type curry-howard

我想在Coq中证明或伪造forall (P Q : Prop), (P -> Q) -> (Q -> P) -> P = Q.。这是我的方法。

Inductive True2 : Prop :=
 | One : True2
 | Two : True2.

Lemma True_has_one : forall (t0 t1 : True), t0 = t1.
Proof.
  intros.
  destruct t0. destruct t1.
  reflexivity.
Qed.

Lemma not_True2_has_one : (forall (t0 t1 : True2), t0 = t1) -> False.
Proof.
  intros.
  specialize (H One Two).
  inversion H.

但是,inversion H什么也没做。我想也许是因为coq的证明独立性(我不是英语母语人士,我不知道确切的词,请原谅我的无知),而且coq使得不可能证明一个=两个 - >假。但是,如果是这样,为什么必须消除证据的内容?

如果没有上述主张,我无法证明以下内容或他们的否定。

Lemma True_neq_True2 : True = True2 -> False.

Theorem iff_eq : forall (P Q : Prop), (P -> Q) -> (Q -> P) -> P = Q.

所以我的问题是:

  1. 如何或可能在Coq中证明或伪造forall (P Q : Prop), (P -> Q) -> (Q -> P) -> P = Q.
  2. 为什么inversion H什么都不做;这是因为coq的证明独立性,如果是这样,为什么Coq会浪费精力去做这件事。

1 个答案:

答案 0 :(得分:12)

  1. 您提及的原则forall P Q : Prop, (P <-> Q) -> P = Q通常称为命题扩展。这个原则在Coq的逻辑中是不可证明的,并且最初逻辑的设计使得它可以作为公理添加而没有任何伤害。因此,在标准库(Coq.Logic.ClassicalFacts)中,人们可以找到关于这个原理的许多定理,将它与其他众所周知的经典推理逻辑原理联系起来。令人惊讶的是,recently发现Coq的逻辑与这个原则不相符,但是有一个非常微妙的原因。这被认为是一个错误,因为逻辑的设计使得这可以作为一个没有伤害的公理添加。他们想在新版本的Coq中修复这个问题,但我不知道它的当前状态是什么。从版本8.4开始,命题扩展性在Coq中是不一致的。

    在任何情况下,如果在Coq的未来版本中修复了此错误,则无法在Coq中证明或反驳此原则。换句话说,Coq团队希望这个原则是Coq逻辑的独立

  2. inversion H之所以没有做任何事情,因为关于证明的推理规则(类型为Prop的事物)与推理非证据的规则不同(类型为Type的东西。您可能知道Coq中的证据只是条款。在幕后,inversion基本上构建了以下术语:

    Definition true_not_false : true <> false :=
      fun H =>
        match H in _ = b
                return if b then True else False
        with
        | eq_refl => I
        end.
    

    如果您尝试对bool中的Prop版本执行相同操作,则会收到更多信息错误:

    Inductive Pbool : Prop :=
    | Ptrue : Pbool
    | Pfalse : Pbool.
    
    Fail Definition Ptrue_not_Pfalse : Ptrue <> Pfalse :=
      fun H =>
        match H in _ = b
                return if b then True else False
        with
        | eq_refl => I
        end.
    
    (* The command has indeed failed with message: *)
    (* => Error: *)
    (*    Incorrect elimination of "b" in the inductive type "Pbool": *)
    (*    the return type has sort "Type" while it should be "Prop". *)
    (*    Elimination of an inductive object of sort Prop *)
    (*    is not allowed on a predicate in sort Type *)
    (*    because proofs can be eliminated only to build proofs. *)
    

    事实上,其中一个原因是Coq被设计为与另一个称为证明不相关的原则相兼容(我认为这就是你所说的&#34;证明独立性& #34;。)

相关问题