coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Eugene Kirpichov <ekirpichov AT gmail.com>
- To: Adam Chlipala <adam AT chlipala.net>
- Cc: coq-club AT inria.fr
- Subject: Re: [Coq-Club] Ltac-matching a "match..with"
- Date: Sat, 30 Jan 2010 01:01:01 +0300
- 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=HrQTMQmBRtbXSheaQRQytwo5i154gZZQdlh6NiLeZOOwrmSP9Due7WbPYoFGLPb9lc Wr9HngA3aTK3C3mYrmSsMittfaMeUE+ktA+pIFX/Wooa2WTfTwpWdmcew+iXUBfSzEqs cTW2/6VUbSQrYbOS8zT47sMVaZ8Z/76nYXLyc=
2010/1/30 Adam Chlipala
<adam AT chlipala.net>:
> Eugene Kirpichov wrote:
>>
>> Suppose I'm proving the following theorem.
>> Theorem t : forall n, match n with | O => O | S x => S x end = n.
>> intros n.
>>
>> (* Here I could just do "destruct n", but I'd like to do that
>> automatically *)
>>
>> match goal with [ |- match ?n with _ end ] => destruct n end.
>>
>> This doesn't work. Replacing _ with _ => _ doesn't work, either, and
>> neither does work anything that I managed to invent.
>>
>> Is there a way to achieve what I'm trying to do? namely, say,
>> "destruct" all variables that are being the head of a match?
>>
>
> The only way I know is to write a pattern that includes the [O] and [S]
> cases explicitly. You can safely leave underscores for the case bodies and
> pattern variables, but Coq needs to know which inductive type you're
> matching on.
>
Thanks, but the following statement also doesn't work.
match goal with [ |- match ?n with | O => _ | S _ => _ end ] =>
destruct n end.
Which way are you refering to?
By the way, I still don't understand why Coq needs type information in
this case, if Ltac is untyped and operates over syntax...
--
Eugene Kirpichov
Web IR developer, market.yandex.ru
- [Coq-Club] Ltac-matching a "match..with", Eugene Kirpichov
- Re: [Coq-Club] Ltac-matching a "match..with",
Adam Chlipala
- Re: [Coq-Club] Ltac-matching a "match..with", Eugene Kirpichov
- Re: [Coq-Club] Ltac-matching a "match..with", Adam Chlipala
- Re: [Coq-Club] Ltac-matching a "match..with", Eugene Kirpichov
- Re: [Coq-Club] Ltac-matching a "match..with",
Adam Chlipala
Archive powered by MhonArc 2.6.16.