[英]How do I apply the proposition of the form P->Q->R to two hypotheses P and Q simultaneously in Coq?
I tried to prove forall PQ R: Prop, P -> Q -> (P -> Q -> R) -> R
.我试图证明
forall PQ R: Prop, P -> Q -> (P -> Q -> R) -> R
。 My proof is the following.我的证明如下。
Goal forall P Q R : Prop, P -> Q -> (P -> Q -> R) -> R.
Proof.
intros P Q R H1 H2 H3.
apply H3 in H1.
exact H1.
exact H2.
Qed.
When apply H3 in H1, two goals will appear.在 H1 中应用 H3 时,会出现两个目标。 However, I want to obtain R more directly like
apply H3 in H1 and H2
.但是,我想更直接地获得 R ,就像
apply H3 in H1 and H2
一样。 But I couldn't find such a way.但是我找不到这样的方法。 How do I achieve this?
我如何实现这一目标?
I already know that the following is also fine.我已经知道以下也可以。 But this is not what I want.
但这不是我想要的。 I don't want to increase goals.
我不想增加目标。
Goal forall P Q R : Prop, P -> Q -> (P -> Q -> R) -> R.
Proof.
intros P Q R H1 H2 H3.
apply H3.
exact H1.
exact H2.
Qed.
You can apply H1
and H2
to H3
yourself directly, without using the apply
tactic.您可以自己直接将
H1
和H2
应用到H3
,而无需使用apply
策略。
Your H3
is of type P -> Q -> R
(a function that takes proofs of P
and Q
and returns a proof of R
).您的
H3
的类型为P -> Q -> R
(一个 function ,它接受P
和Q
的证明并返回R
的证明)。 So, the expression H3 H1 H2
has type R
.因此,表达式
H3 H1 H2
的类型为R
。
With this you can simplify your proof to the following:有了这个,您可以将证明简化为以下内容:
Goal forall P Q R : Prop, P -> Q -> (P -> Q -> R) -> R.
Proof.
intros P Q R H1 H2 H3.
apply (H3 H1 H2).
Qed.
In fact, your proof is exactly the same as the one above because all the apply
tactic does is applying a function to an argument.实际上,您的证明与上述证明完全相同,因为所有
apply
策略所做的都是将 function 应用于参数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.