简体   繁体   English

如何在 Coq 中将 P->Q->R 形式的命题同时应用于两个假设 P 和 Q?

[英]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.您可以自己直接将H1H2应用到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 ,它接受PQ的证明并返回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.

相关问题 使用Coq Proof Assistant证明(p-&gt; q)-&gt;(〜q-&gt;〜p) - Proving (p->q)->(~q->~p) using Coq Proof Assistant 我如何证明所有 PQ:Prop, ((((P -> Q) -> P) -> P) -> Q) ->Q。 在考克? - how do I prove forall P Q : Prop, ((((P -> Q) -> P) -> P) -> Q) ->Q. in coq? 如何证明所有人(pq:Prop),〜p-&gt;〜((p-&gt; q)-&gt; p) 使用coq - How to prove forall (p q:Prop), ~p->~((p ->q) ->p). using coq 如何在 Coq 中证明 (~Q -&gt; ~P) - &gt; (P -&gt; Q) - How to prove (~Q -> ~P) - > (P -> Q) in Coq 如何在Coq中证明(p-&gt; q)-&gt;(〜p \\ / q) - How to prove (p -> q) -> (~ p \/ q) in Coq 在 Coq 中如何证明或证伪 `forall (PQ : Prop), (P -&gt; Q) -&gt; (Q -&gt; P) -&gt; P = Q.`? - How or is that possible to prove or falsify `forall (P Q : Prop), (P -> Q) -> (Q -> P) -> P = Q.` in Coq? Coq 证明 p <q or p>=q</q> - Coq proof that p<q or p>=q 如何在coq中证明引理“(P \\ / Q)/ \\ ~P - &gt; Q.” - How to prove the lemma “(P \/ Q) /\ ~P -> Q.” in coq? 如何用给定的假设证明排除中间(forall PQ: Prop, (P -&gt; Q) -&gt; (~P \/ Q))? - How can I prove excluded middle with the given hypothesis (forall P Q : Prop, (P -> Q) -> (~P \/ Q))? HoTT 的 Coq:证明 || P-&gt; X || -&gt; (P-&gt; ||X||) - Coq for HoTT: proving || P-> X || -> (P-> ||X||)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM