[英]How to prove logic equivalence in Coq?
I want to prove the following logic equivalence in Coq. 我想证明Coq中的以下逻辑等效性。
(p->q)->(~q->~p) (对 - > Q) - >(〜Q->〜p)的
Here is what I attempted. 这是我尝试过的。 How can I fix this?
我怎样才能解决这个问题?
Lemma work : (forall p q : Prop, (p->q)->(~q->~p)).
Proof.
intros p q.
intros p_implies_q not_q_implies_not_p.
refine (not_q_implies_not_p).
refine (p_implies_q).
Qed.
Two things that might help. 有两件事可能会有所帮助。
First, in your second intros
, the second hypothesis is not not_q_implies_not_p
, but rather, simply not_q
. 首先,在您的第二个
intros
,第二个假设不是not_q_implies_not_p
,而仅仅是not_q
。 This is because the goal is (after intros p_implies_q
) ~q -> ~p
, so another invocation of intros
only brings in the hypothesis of this goal: ~q
, and leaves ~p
as the new goal. 这是因为我们的目标是(后
intros p_implies_q
) ~q -> ~p
,那么另一个调用intros
只带来了这一目标的假设: ~q
,和叶~p
作为新的目标。
Second, remember that ~p
simply means p -> False
, which allows us to introduce another hypothesis from the goal of ~p
. 其次,要记住
~p
仅仅意味着p -> False
,这使我们能够从目标引入另一个假设~p
。 This also means that you can use a premise like ~p
to prove False
, assuming you know that p
is true. 这也意味着,你可以使用一个类似的前提下
~p
证明False
,假设你知道p
是真的。
So your proof should start out something like 所以你的证明应该开始像
Lemma work : (forall p q : Prop, (p->q)->(~q->~p)).
Proof.
intros p q.
intros p_implies_q not_q.
intros p_true.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.