Using the same proof for two subgoals in Coq

Viewed 203

After an induction on an inductive type, I have two subgoals to prove. The hypotheses and goals are slightly different but can be solved by the same (long) proof, which currently looks likes this:

induction x.
{
  admit.
}
{
  <long proof>
}
{
  <copy-paste of long proof>
}

Is there a way to avoid this copy-paste and keep the interactivity, for example by writing something similar to the following?

induction x.
{
  admit.
}
all:
{
  <long proof>
}
1 Answers

Sometimes you can solve these goals with an intermediate lemma:

assert (H : statement_of_lemma).
{ 
  proof...
}

Later, you just have to apply H to each subcase.

Related