Lemma x: forall P Q: Set -> Prop,
forall f: Set -> Set,
forall x, (P x -> Q (f x)) ->
(exists x, P x) -> (exists x, Q x).
I try to do it many different ways and I dont know whats wrong. This is my latest attempt:
Lemma x: forall P Q: Set -> Prop,
forall f: Set -> Set,
forall x, (P x -> Q (f x)) ->
(exists x, P x) -> (exists x, Q x).
Proof.
intros P Q f x H1 [x0 H2].
exists (f x0).
apply H1.
assumption.
Qed.
but it produces this error: In environment P, Q : Set -> Prop f : Set -> Set x : Set H1 : P x -> Q (f x) x0 : Set H2 : P x0 Unable to unify "Q (f x)" with "Q (f x0)".
Your Lemma is actually false. Here is a proof that it is false:
However, it is likely that the lemma you are trying to prove is not the one you want to prove. Is it possible you wanted to prove this lemma here instead?
The difference is that the assumption is
forall x, P x -> Q (f x), instead of just beingP x -> Q (f x)for one specificxthat is not otherwise mentioned in your goal (since it is shadowed by bothexists x, P/Q x).