I am trying to prove (~Q -> ~P) - > (P -> Q) in coq, which is the reverse of the contrapositive theorem (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. apply B. apply A. apply 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
destruct (classic Q) as [Q_holds|NQ_holds].
it creates two subgoals: one when Q
holds and one when ~Q
holds.
Together with the theorem False_ind
(that let you prove anything from False
) it should be enough to conclude your proof.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.