How or is that possible to prove or falsify `forall (P Q : Prop), (P -> Q) -> (Q -> P) -> P = Q.` in Coq?

最后都变了- 提交于 2019-11-28 11:18:32
  1. The principle you're mentioning, forall P Q : Prop, (P <-> Q) -> P = Q, is usually known as propositional extensionality. This principle is not provable in Coq's logic, and originally the logic had been designed so that it could be added as an axiom with no harm. Thus, in the standard library (Coq.Logic.ClassicalFacts), one can find many theorems about this principle, relating it to other well-known logical principles of classical reasoning. Surprisingly, it was recently found out that Coq's logic is incompatible with this principle, but for a very subtle reason. This is considered a bug, since the logic had been designed so that this could be added as an axiom with no harm. They wanted to fix this problem in the new version of Coq, but I don't know what the current status of that is. As of version 8.4, propositional extensionality is inconsistent in Coq.

    In any case, if this bug is fixed in future versions of Coq, it should not be possible to prove nor disprove this principle in Coq. In other words, the Coq team wants this principle to be independent of Coq's logic.

  2. inversion H doesn't do anything there because the rules for reasoning about proofs (things whose type is a Prop) are different from the ones for reasoning about non-proofs (things whose type is a Type). You may know that proofs in Coq are just terms. Under the hood, inversion is essentially constructing the following term:

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

    If you try to do the same with a version of bool in Prop, you get a more informative error:

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

    Indeed, one of the reasons for this is that Coq was designed to be compatible with another principle called proof irrelevance (I think that's what you meant by "proof independence").

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!