If you are going to prove existentiality directly, and not through a lemma, you can use eapply ex_intro . This introduces an existential variable (recorded ?42 ). Then you can manipulate the term. To complete the proof, you need to ultimately provide a way to construct the value for this variable. You can do this explicitly using instantiate tactics or implicitly using tactics like eauto .
Beware that it is often cumbersome to work with existential variables. Many tactics suggest that all conditions are created and can hide existences in subgoals; you will find out when Qed reports "Error: attempt to save incomplete evidence." You should only use existential variables if you have a plan to create them in the near future.
Here is a silly example illustrating the use of eapply .
Goal exists x, 1 + x = 3. Proof. (* β’ exists x, 1 + x = 3 *) eapply ex_intro. (* β’ 1 + ?42 = 3 *) simpl. (* β’ S ?42 = 3 *) apply f_equal. (* β’ ?42 = 2 *) reflexivity. (* proof completed *) Qed.
Gilles
source share