简体   繁体   English

如何证明排除中间在Coq中无可辩驳?

[英]How to prove excluded middle is irrefutable in Coq?

I was trying to prove the following simple theorem from an online course that excluded middle is irrefutable, but got stuck pretty much at step 1: 我试图从一个排除中间的在线课程中证明以下简单定理是无可辩驳的,但在第1步被卡住了:

Theorem excluded_middle_irrefutable: forall (P:Prop), ~~(P \/ ~ P).
Proof.
  intros P. unfold not. intros H.

Now I get: 现在我得到:

1 subgoals
P : Prop
H : P \/ (P -> False) -> False
______________________________________(1/1)
False

If I apply H , then the goal would be P \\/ ~P , which is excluded middle and can't be proven constructively. 如果我apply H ,那么目标就是P \\/ ~P ,它被排除在中间,无法建设性地证明。 But other than apply , I don't know what can be done about the hypothesis P \\/ (P -> False) -> False : implication -> is primitive, and I don't know how to destruct or decompose it. 但除了apply ,我不知道可以做什么关于假设P \\/ (P -> False) -> False :暗示->是原始的,我不知道如何destruct或分解它。 And this is the only hypothesis. 这是唯一的假设。

My question is, how can this be proven using only primitive tactics ( as characterized here , ie no mysterious auto s)? 我的问题是,如何才能使用原始战术证明这一点( 如此处所表征的 ,即没有神秘的auto )?

Thanks. 谢谢。

I'm not an expert on this subject, but it was recently discussed on the Coq mailing-list . 我不是这方面的专家,但最近在Coq邮件列表上进行了讨论。 I'll summarize the conclusion from this thread. 我将从这个帖子中总结出结论。 If you want to understand these kinds of problems more thoroughly, you should look at double-negation translation . 如果你想更彻底地理解这些问题,你应该看看双重否定翻译

The problem falls within intuitionistic propositional calculus and can thus be decided by tauto . 问题属于直觉主义命题演算,因此可以由tauto决定。

Theorem excluded_middle_irrefutable: forall (P:Prop), ~~(P \/ ~ P).
  tauto.
Qed.

The thread also provides a more elaborate proof. 该线程还提供了更精细的证据。 I'll attempt to explain how I would have come up with this proof. 我将尝试解释如何提出这个证据。 Note that it's usually easier for me to deal with the programming language interpretation of lemmas, so that's what I'll do: 请注意,我通常更容易处理lemmas的编程语言解释,所以这就是我要做的:

Theorem excluded_middle_irrefutable: forall (P:Prop), ~~(P \/ ~ P).
  unfold not.
  intros P f.

We are asked to write a function that takes the function f and produces a value of type False . 我们被要求编写一个函数,它接受函数f并产生一个False类型的值。 The only way to get to False at this point is to invoke the function f . 此时获取False的唯一方法是调用函数f

 apply f.

Consequently, we are asked to provide the arguments to the function f . 因此,我们被要求提供函数f的参数。 We have two choices, either pass P or P -> False . 我们有两个选择,传递PP -> False I don't see a way to construct a P so I'm choosing the second option. 我没有看到构建P所以我选择了第二个选项。

  right.
  intro p.

We are back at square one, except that we now have a p to work with! 我们回到了第一个方向,除了我们现在有一个合作p So we apply f because that's the only thing we can do. 因此我们应用f因为这是我们唯一可以做的事情。

  apply f.

And again, we are asked to provide the argument to f . 再次,我们被要求提供f的论点。 This is easy now though, because we have a p to work with. 现在这很容易,因为我们有一个p可以使用。

  left.
  apply p.
Qed. 

The thread also mentions a proof that is based on some easier lemmas. 该线程还提到了一个基于一些更简单的引理的证明。 The first lemma is ~(P /\\ ~P) . 第一个引理是~(P /\\ ~P)

Lemma lma (P:Prop) : ~(P /\ ~P).
  unfold not.
  intros H.
  destruct H as [p].
  apply H.
  apply p.
Qed.

The second lemma is ~(P \\/ Q) -> ~P /\\ ~Q : 第二个引理是~(P \\/ Q) -> ~P /\\ ~Q

Lemma lma' (P Q:Prop) : ~(P \/ Q) -> ~P /\ ~Q.
  unfold not.
  intros H.
  constructor.
  - intro p.
    apply H.
    left.
    apply p.
  - intro q.
    apply H.
    right.
    apply q.
Qed.   

These lemmas suffice to the show: 这些lemmas足以显示:

Theorem excluded_middle_irrefutable: forall (P:Prop), ~~(P \/ ~ P).
  intros P H.
  apply lma' in H.
  apply lma in H.
  apply H.
Qed.

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

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