![](/img/trans.png)
[英]How to easily prove the following in Coq such as using only assumptions?
[英]How to prove the following in Coq?
如何在 Coq 中证明以下内容?
(p->q)->(~q->~p)
这是我的开始:
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.
一些备注:
每当您有A -> B
形式的目标时,您都可以使用intros H
命令将H: A
添加到您的前提列表中,并留下目标B
。
~P
是P -> False
的语法糖。 因此,如果您的目标是~P
,那么intros H
会将H: P
添加到您的前提列表并将目标减少到False
如果您的目标是Q
并且您有一个前提H: P -> Q
,则执行命令apply H
会将您的目标更改为P
连续的intros
命令可以合并为一个,因此证明可以缩短为
Proof. intros pq p_implies_q not_q p_true. apply not_q. apply p_implies_q. auto. Qed.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.