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: Thomas Braibant <thomas.braibant AT gmail.com>
  • Cc: Coq Club <coq-club AT inria.fr>
  • Subject: Re: [Coq-Club] Strange Ltac behavior
  • Date: Wed, 23 Feb 2011 17:31:50 -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:cc:content-type :content-transfer-encoding; b=TScgMrweCa+y29d5HI2fLvxkhRYgK2KCINZr8xULJxtiCxVKEqSqgBJb08kgqAoVQM 9Sc76On8NbUJLzrS0cvDWHM0dNpMrXIVL5ZH/Ja3TJ3g3FeK3TvomISPeTDiNoUbuBR3 P4u1ej/Ifw8Gdg9wYjGG77ZErj4XFa4KSDMeQ=

Since we're on the topic of pattern matching, another trick I recently
learned was this:  I think it is well known you can look for local
definitions in your match like this...

match goal with
| a := _ |- _ => ...
end.

But how do you ensure that a matched hypothesis is *not* as local
definition?  Like this...

match goal with
| a: _ |- _ =>
    let e := eval compute in a in
    constr_eq a e;
    ...
end.

 - Aaron

On Wed, Feb 23, 2011 at 3:58 PM, Thomas Braibant
<thomas.braibant AT gmail.com>
 wrote:
> On Wed, Feb 23, 2011 at 9:39 PM, Aaron Bohannon 
> <bohannon AT cis.upenn.edu>
>  wrote:
>> 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.
>>
>
> Nice solution, and thanks to both.
>
> Thomas
>




Archive powered by MhonArc 2.6.16.

Top of Page