简体   繁体   English

如何在 Coq 中证明 (~Q -> ~P) - > (P -> Q)

[英]How to prove (~Q -> ~P) - > (P -> Q) in Coq

I am trying to prove (~Q -> ~P) - > (P -> Q) in coq, which is the reverse of the contrapositive theorem (P-> Q) (~Q -> ~P).我试图在 coq 中证明 (~Q -> ~P) - > (P -> Q),这是对立定理 (P-> Q) (~Q -> ~P) 的逆。 Currently I was thinking about using the same logic of proving the contrapositive theorem like this:目前我正在考虑使用相同的逻辑来证明对立定理,如下所示:

unfold not.展开不。 intros P Q. intros AB C.介绍 P Q. 介绍 AB C。 apply B. apply A. apply C.应用 B. 应用 A. 应用 C。

However I am stuck at the beginning.但是我一开始就卡住了。 Maybe I need additional axioms to prove the reverse of the contrapositive theorem.也许我需要额外的公理来证明对立定理的反面。 Can anyone help me?谁能帮我?

Require Import Classical.

Lemma myproof :  forall (P Q : Prop), (~Q -> ~P) -> (P -> Q) . 
unfold not. intros P Q. intros A B.
destruct (classic Q) as [Q_holds|NQ_holds].
apply Q_holds.
apply False_ind.
apply A.
apply NQ_holds.
apply B.
Qed.

Yep, you need some extra power (classical logic) to do this.是的,你需要一些额外的力量(经典逻辑)来做到这一点。 Put

Require Import Classical.

at the beginning of your file.在文件的开头。 Now when you have a proposition Q with现在当你有一个命题Q

destruct (classic Q) as [Q_holds|NQ_holds].

it creates two subgoals: one when Q holds and one when ~Q holds.它创建了两个子目标:一个当Q成立时,一个当~Q成立时。

Together with the theorem False_ind (that let you prove anything from False ) it should be enough to conclude your proof.连同定理False_ind (让你证明任何东西False )应该足以得出你的证明。

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

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