繁体   English   中英

在 Coq 中如何证明或证伪 `forall (PQ : Prop), (P -> Q) -> (Q -> P) -> P = Q.`?

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

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

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使得无法证明One = Two -> False。 但如果是这样,为什么必须用 coq 消除证明的内容?

没有上述命题,我无法证明以下或它们的否定。

Lemma True_neq_True2 : True = True2 -> False.

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

所以我的问题是:

  1. 在 Coq 中,如何或是否可以证明或证伪forall (PQ : Prop), (P -> Q) -> (Q -> P) -> P = Q.
  2. 为什么inversion H什么都不做; 是不是因为 coq 的证明独立性,如果是这样,为什么 Coq 这样做会浪费精力。
  1. 你提到的原则,对于所有forall PQ : Prop, (P <-> Q) -> P = Q ,通常被称为命题外延性 这个原理在 Coq 的逻辑中是无法证明的,最初这个逻辑被设计成可以作为公理添加而不会造成伤害。 因此,在标准库 ( Coq.Logic.ClassicalFacts ) 中,可以找到许多关于这一原则的定理,并将其与其他著名的经典推理逻辑原则联系起来。 令人惊讶的是,最近发现 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.

    如果您尝试对Propbool版本执行相同操作,则会收到一个信息量更大的错误:

     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 被设计为与另一个称为证明无关性的原则兼容(我认为这就是你所说的“证明独立性”)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM