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 B." <aaron678 AT gmail.com>
  • To: Adam Chlipala <adam AT chlipala.net>
  • Cc: Thomas Braibant <thomas.braibant AT gmail.com>, coq-club <coq-club AT inria.fr>
  • Subject: Re: [Coq-Club] Strange Ltac behavior
  • Date: Wed, 23 Feb 2011 15:08:55 -0500
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=LMpLekn4OTs/lNUgQZG6/+u44I04GXCP8esIGuDMP11DvtqoMJxocvfWyRf1CxE/51 Xupkx9icPYA6ZugKOahd5u6ny4E8kAUSExZyZikWmepAqiU2VQsbFBm/XwHlmzNGNTwE iDrYtKQ7fPz3wgUsIxvGIATLHXTp1Xoxa1YPA=

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