Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] A question about declaration and definition

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] A question about declaration and definition


chronological Thread 
  • From: Pierre Courtieu <Pierre.Courtieu AT cnam.fr>
  • To: geng chen <chengeng4001 AT gmail.com>
  • Cc: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] A question about declaration and definition
  • Date: Wed, 5 May 2010 09:45:28 +0200
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; b=HjxthvPcvNQpHcccUPKXNUCN4MewN3TmR1dpbLYOpQ6PI1xzSS9Yu6LNH6LgSbGKyR 8YI43C0K6pzmw8uvIJOwFsAv8MOTn3FwTG3OGNss0ijxgfMNF3w0KFNBb04LScNaIWQR /lx+v+uC41/c+Tgdbw8t2C6eOfeUSHKMBHcxo=

Hello,
First of all your comp type is not a valid inductive type, it should
be more like

Inductive comp : Set := E: list all -> comp

Since you need to define comp and all simultaneously, you need to
define them as mutual indutive types:

Inductive comp : Set := E: list all -> comp
with all : Set :=
   C : prim -> all
 | D : comp -> all.

However I would recommend you to use one of the following instead:

(* 1 *)
 Inductive all : Set :=
   C : prim -> all
 | D : list all -> all.

OR:
(* 2 *)
Inductive comp : Set :=
 compNil: comp
 | compCons: all
with Inductive all : Set :=
   C : prim -> all
 | D : comp -> all.


1 is the recommended choice because you will be able to use lemmas of
file List.v of coq library, but you will probably need to define and
prove induction principles by hand because the default one generated
by coq is not so good (it is not merged with the principle of lists).


2 will produce much better induction principles using this command:

Scheme compind := Induction for comp Sort Prop
with allind := Induction for all Sort Prop.

but you will not be able to use List.v. I would recommend to use this
definition only to see how the induction principle build by hand of 1
should look like.

Hope this helps,
Pierre Courtieu

2010/5/5 geng chen 
<chengeng4001 AT gmail.com>:
> Inductive prim : Set :=
>   A : prim
> | B : prim.
>
> Inductive comp : Set := list all.
>
> Inductive all : Set :=
>   C : prim -> all
> | D : comp -> all.




Archive powered by MhonArc 2.6.16.

Top of Page