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

Logic 如何证明(R->;P)[在Coq证明助手中]?,logic,coq,proof,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. V

如何证明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),一个用来证明目标(P),使用or的左结论(P),一个用来证明目标(P),使用右结论(Q)

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.