I am learning Coq via the book software foundations, and have trouble proving the following lemma (which I require to prove other theorems.)
Lemma if_trans :
forall (P Q R: Prop),
(P -> Q) /\ (Q -> R) -> (P ->R).
Proof.
intros P Q R [E1 E2].
Admitted.
This is where I get stuck. I can't destruct on propositions, and I although I can apply E2 in E1
, it generates two subgoals (I don't understand why), and the second subgoal is logically incorrect to prove. Please help. Also I know only the following tactics:
simpl , reflexivity, symmetry, destruct, induction, apply, replace, .. in , exfalso, discriminate, injection, split, left , right, intros, unfold, assert, rewrite.
Q2: Another question on somewhat similar lines. I need to use the above proved lemma for proving other theorems. So suppose I have two hypothesis H1: P -> Q
and H2: Q -> R
and the goal is P -> R
. How can I use the above lemma to prove the goal in this case i.e. how can I combine H1
and H2
into a single hypothesis H : (P ->Q ) /\ (Q -> R)
?
apply E2 in E1
to do? I would suggest to do one more introduction to have somep : P
and try to proveR
from it instead. – Théo Winterhalter