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

后端 未结 1 476
北荒
北荒 2020-12-10 16:18

I want to prove or falsify forall (P Q : Prop), (P -> Q) -> (Q -> P) -> P = Q. in Coq. Here is my approach.

Inductive True2 : Prop :         


        
相关标签:
1条回答
  • 2020-12-10 16:42
    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").

    0 讨论(0)
提交回复
热议问题