1

When my proof state is of the form H -> goal I often use the pattern intros H. *some tactic* H. where some tactic could be "inversion" or "apply _ in", etc. It would be nice if there was some tactical which combined these two steps, ie, something which would introduce the top hypothesis and then apply a specified tactic to it. I've looked around in the ssreflect documentation for move, because move can do similar useful things, but haven't found anything. Is there such a tactical?

Thanks.

push33n
  • 398
  • 4
  • 12

1 Answers1

2

As mentioned ssreflect can move the variables, for example using ssreflect you don't even need to introduce the variable if the variable is at the top of the stack.

Lemma blah : H -> Goal                  Lemma blah : H -> Goal 
intro H. induction H.           ~       elim.

Lemma blahh : P -> H -> Goal            Lemma blah : P -> H -> Goal 
intros P H. induction H.         ~      move=> P; elim. or shorten intros;elim : H.
intro P H. apply P in H.         ~      apply : P.

I recommend An ssreflect tutorial is very comfortable for beginners.

Tiago Campos
  • 503
  • 3
  • 14
  • Thanks for this great answer Tiago Campos, but these tactic work specifically when using `ssreflect`. I think you should add this information in the beginning of your answer. For instance, you can start your sentence with something like "When using the `ssreflect`tactic language, .." – Yves Jun 15 '20 at 06:20
  • Oh thanks, @Yves to your recommendation, I made some fixes. – Tiago Campos Jun 15 '20 at 20:54
  • Is there a way to do intros followed by an arbitrary tactic? Instead of the specific examples you gave like induction, or apply? – push33n Jun 17 '20 at 15:57
  • Humm, in that case, I think doing "intro H; destruct H" using sequence it's a more comfortable way. But you can try some better using Ltac, for example : Ltac top tac := let T := fresh in move => T; tac T. And, Lemma blah : H -> Goal. tac eq_case. let inv k := ltac :(inversion k) in top inv., to destruct your goal and try inversion respectively. – Tiago Campos Jun 17 '20 at 23:35