繁体   English   中英

如何证明(R-> P)[在Coq证明助手中]?

[英]How to prove (R -> P) [in the Coq proof assistant]?

如何证明Coq中的(R-> P)。 我是一个初学者,对这个工具不太了解。 这是我写的:

Require Import Classical.

Theorem intro_neg : forall P Q : Prop,(P -> Q /\ ~Q) -> ~P.
Proof.
 intros P Q H.
 intro HP.
 apply H in HP.
 inversion HP.
 apply H1.
 assumption.
Qed.

Section Question1.
Variables P Q R: Prop.
Hypotheses H1 : R -> P \/ Q.
Hypotheses H2 : R -> ~Q.
Theorem trans : R -> P.
Proof.
 intro HR.
 apply NNPP.
 apply intro_neg with (Q := Q).
 intro HNP.

我只能说到这一点。

此时的子目标为:

1 subgoals
P : Prop
Q : Prop
R : Prop
H1 : R -> P \/ Q
H2 : R -> ~ Q
HR : R
HNP : ~ P
______________________________________(1/1)
Q /\ ~ Q

您可以使用tauto来自动证明:

Section Question1.
Variables P Q R: Prop.
Hypotheses H1 : R -> P \/ Q.
Hypotheses H2 : R -> ~Q.
Theorem trans : R -> P.
Proof.
 intro HR.
 tauto.
Qed.

如果要手动证明​​,则H1说给定R,则P或Q为真。 因此,如果破坏H1,您将获得3个目标。 一种是证明前提(R),一种是使用or的左结论(P)证明目标(P),另一种是使用正确的结论(Q)证明目标(P)。

Theorem trans' : R -> P.
Proof.
 intro HR.
 destruct H1.
 - (* Prove the premise, R *)
   assumption.
 - (* Prove that P is true given that P is true *)
   assumption.
 - (* Prove that P is true given that Q is false *)
   contradiction H2.
Qed.
End Question1.

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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