coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Eugene Kirpichov <ekirpichov AT gmail.com>
- To: Adam Chlipala <adamc AT hcoop.net>
- Cc: coq-club AT inria.fr
- Subject: Re: [Coq-Club] A strangely unaccepted mutually inductive definition
- Date: Sun, 24 Jan 2010 11:09:16 +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=KpRrpyvk6+UwaXjW7C5rNl3RLQTGWHAFTzc7sQwMI5OwPBtGG22D9Z1cBClrWdJxGq XeeqCaNpk+ZyESkKsrYpAWCpjUBJoMfjd7jyiUUcm/qbFxACFvb5m02ydx2QaHW4QHfE y2Zfj8lQVPDdoscDogwUirkmAI5rxmCthCstA=
2010/1/23 Adam Chlipala
<adamc AT hcoop.net>:
> Eugene Kirpichov wrote:
>>
>> Inductive btree (t:Set) :=
>> | BLeaf : t -> btree t
>> | BNode : btree t -> btree t -> btree t.
>>
>> Inductive trexp : Set :=
>> | TLeaf : nat -> trexp
>> | TNode : btree trexp -> trexp.
>>
>> Fixpoint total (t:trexp) :=
>> match t with
>> | TLeaf n => n
>> | TNode b => btotal b
>> end
>> with btotal (b:btree trexp) :=
>> match b with
>> | BLeaf t => total t (* An error here? *)
>> | BNode b1 b2 => btotal b1 + btotal b2
>> end.
>>
>> I get the following error...
>>
>
> This program is rejected for the same reason that the first version of
> [nat_tree_ind'] is rejected in the chapter where you got the exercise (on
> page 55). Recursion over nested inductive types needs to be implemented
> with nested recursion, not mutual recursion. It's a hard-coded restriction;
> I'm not aware of any intuition behind it.
>
Oh yes, indeed, thanks! By the time I solved the preceding exercises I
already forgot about that part of text :-|
--
Eugene Kirpichov
Web IR developer, market.yandex.ru
- [Coq-Club] A strangely unaccepted mutually inductive definition, Eugene Kirpichov
- Re: [Coq-Club] A strangely unaccepted mutually inductive definition,
Adam Chlipala
- Re: [Coq-Club] A strangely unaccepted mutually inductive definition, Eugene Kirpichov
- Re: [Coq-Club] A strangely unaccepted mutually inductive definition,
Adam Chlipala
Archive powered by MhonArc 2.6.16.