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

时间:2014-12-11 00:00:35

标签: logic coq proof

如何在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

1 个答案:

答案 0 :(得分:2)

您可以使用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),一个是使用左侧结论(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.