Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] matching variables in Ltac

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] matching variables in Ltac


chronological Thread 
  • From: Arthur Chargu�raud<arthur.chargueraud AT inria.fr>
  • To: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] matching variables in Ltac
  • Date: Thu, 6 May 2010 13:08:56 +0200

The trick I use is to perform an anonymous intro, 
then use "match" to obtain the name of the most-recently
introduced hypothesis, and then revert this hypothesis.
On the way, I'm able to access the name that used to
be bound in the goal. Here is the demo script:


Ltac get_last_name := 
  match goal with x:_ |- _ => x end.

Lemma test : forall a:nat, a = a.
  intro; let x := get_last_name in revert x; 
  let x2 := fresh x "2" in idtac x2.
  (* displays a2 *)


Arthur



Archive powered by MhonArc 2.6.16.

Top of Page