Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Problem with definition from CPDT

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Problem with definition from CPDT


chronological Thread 
  • From: Thomas Schilling <nominolo AT googlemail.com>
  • To: Adam Chlipala <adam AT chlipala.net>
  • Cc: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] Problem with definition from CPDT
  • Date: Tue, 15 Feb 2011 13:36:38 +0000
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer; b=VUBEv+qVL0iWDMzkEbMxcEWSSfD30wkFlmCBlSyXmI6ynLtpK5KwdxfIphebF1xXgM xJfG4qmkjWsOSxx+LD71rXpypZdIGsTHDvM1e4EjpsN/4TCduGj9JT5PXYydW3weBzLA fEQbtJemSwn195ZB4t/TbFJ1XZmEomRoJYZ4k=


On 15 Feb 2011, at 13:26, Adam Chlipala wrote:

> Thomas Schilling wrote:
>> I'm working through Adam's Certified Programming with Dependent Types and 
>> Coq fails to accept the following definition from the book:
>> [...]
>
>> Is this a limitation of my version of Coq?  I'm using Coq 8.2pl1 (latest 
>> on MacPorts).  Or am I missing something obvious?
>>   
> 
> The book is only tested with Coq 8.2pl2 and 8.3pl1.  There were definitely 
> some bugs in 8.2pl1 that prevented some of the code from type-checking, 
> though I don't remember seeing your particular example mentioned before.

Ok, I managed to fix it.  I used "Print nat_rect" to figure out the 
definition of the auto-generated induction principles and then via trial and 
error I got it to accept the following.  (The changes are the "as .. return 
.." annotations.)


  Fixpoint nat_tree_ind' (tr : nat_tree) : P tr :=
    match tr as tr0 return (P tr0) with
      | NLeaf => NLeaf_case
      | NNode n ls => NNode_case n ls
          ((fix list_nat_tree_ind (ls : list nat_tree) : All P ls :=
            match ls as ls0 return All P ls0 with
              | nil => I
              | cons tr rest =>
                  conj (nat_tree_ind' tr) (list_nat_tree_ind rest)
            end) ls)
    end.

It indeed appears to be a limitation of my version of Coq.

BTW, thank you for making the sources for your book available.  It allowed me 
to create a special version for easier reading on my Kindle.

 / Thomas





Archive powered by MhonArc 2.6.16.

Top of Page