简体   繁体   中英

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 . 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. However, I want to obtain R more directly like 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.

Your H3 is of type P -> Q -> R (a function that takes proofs of P and Q and returns a proof of R ). So, the expression H3 H1 H2 has type 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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