Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Strange Ltac behavior

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Strange Ltac behavior


chronological Thread 
  • From: Aaron Bohannon <bohannon AT cis.upenn.edu>
  • To: Coq Club <coq-club AT inria.fr>
  • Subject: Re: [Coq-Club] Strange Ltac behavior
  • Date: Wed, 23 Feb 2011 15:39:59 -0500
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; b=VOFinB2tsCEQ100U+hxQCOtT2xVGVLgXDXyQd3DjNEwYoDROFdaPCY3Aui2QNJnSMv grIOzhODSmBeGAOe8gNjfF9SA1u7wFN4lOrlS5IVbAnijNO7LoruNJJJ+mqIVlMq9+EF lpawR50CHoSEKaC+FuveKU2fN3MyrRCUGKxUo=

Alternatively, instead of using a nested match, you can use
"constr_eq", which compares the ASTs of the terms.  So you can do
something like this:

match goal with
| v : T ?n |- context name [?v1] =>  constr_eq v v1; idtac v
end.

 - Aaron

On Wed, Feb 23, 2011 at 11:39 AM, Adam Chlipala 
<adam AT chlipala.net>
 wrote:
> Thomas Braibant wrote:
>>
>> I have a problem that can be reduced to the snippet below.
>>
>> Section t.
>>   Variable T : nat ->  Type.
>>   Variable f : forall n, T n ->  Prop.
>>   Goal forall n m (x : T n) (y : T m), f n (x).
>>     intros.
>>     match goal with
>>       | v : T ?n |- context name [?v] =>  idtac v (* prints [f n x],
>> while I would like [x]*)
>>     end.
>> End.
>>
>
> Hypothesis variable names are not treated as bound elsewhere in the same
> Ltac pattern.  You can achieve what you want by nesting one [match] inside
> another, making each responsible for just one part of the pattern above.
>




Archive powered by MhonArc 2.6.16.

Top of Page