How to prove the following in Coq?
(p->q)->(~q->~p)
Here is what I started with:
Lemma work : (forall p q : Prop, (p->q)->(~q->~p)).
Proof.
intros p q.
intros p_implies_q not_q.
intros p_true.
Lemma work : (forall p q : Prop, (p->q)->(~q->~p)).
Proof.
intros p q.
intros p_implies_q not_q.
intros p_true.
apply not_q.
apply p_implies_q.
auto.
Qed.
Some remarks:
whenever you have a goal of the form A -> B
, you can use intros H
command to add H: A
into your list of premises and be left with a goal B
.
~P
is a syntactic sugar for P -> False
. Thus, if your goal is ~P
, then intros H
will add H: P
to your premises list and reduce the goal to False
If your goal is Q
and you have a premise H: P -> Q
, executing command apply H
will change your goal to P
Consecutive intros
commands can be merged into one, so the proof can be shortened to
Proof. intros pq p_implies_q not_q p_true. apply not_q. apply p_implies_q. auto. Qed.
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.