简体   繁体   English

如何在 Coq 中证明以下内容?

[英]How to prove the following in Coq?

How to prove the following in Coq?如何在 Coq 中证明以下内容?

(p->q)->(~q->~p) (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 .每当您有A -> B形式的目标时,您都可以使用intros H命令将H: A添加到您的前提列表中,并留下目标B

  • ~P is a syntactic sugar for P -> False . ~PP -> False的语法糖。 Thus, if your goal is ~P , then intros H will add H: P to your premises list and reduce the goal to False因此,如果您的目标是~P ,那么intros H会将H: P添加到您的前提列表并将目标减少到False

  • If your goal is Q and you have a premise H: P -> Q , executing command apply H will change your goal to P如果您的目标是Q并且您有一个前提H: P -> Q ,则执行命令apply H会将您的目标更改为P

  • Consecutive intros commands can be merged into one, so the proof can be shortened to连续的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.

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