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: Damien Pous <Damien.Pous AT ens-lyon.fr>
  • To: coq-club <coq-club AT inria.fr>
  • Subject: Re: [Coq-Club] A question about declaration and definition
  • Date: Wed, 5 May 2010 09:14:55 +0200
  • 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:content-type :content-transfer-encoding; b=P1p9vcDQZiLke3FH5lnwvL9lJ9FcgcR134tDRRjtSHKUkwhD2QPsJXwmd//xH+Cv8Q tqQcluZa1+MLIb7gDTkQe7x/RbW0uoBZPAmyl9i8iyONcgZ7oTgcnDals5DmBW4YGBtf nwpGrTsZVcVxWa5g3lIX1NeEz+/2DM+GydXFM=

Hi,

Since these definitions are not mutually dependent, the simplest thing
to do would be:

Inductive prim : Set :=
  A : prim
| B : prim.

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

Definition comp : Set := list all.


Otherwise, you can use the keyword "with" to define mutually recursive
inductives:

Inductive all : Set :=
  C : prim -> all
| D : comp -> all
with comp : Set :=
  nil: comp
| cons: all -> comp -> comp.


(in both cases, "Lemma ... with" might be useful to reason about the
corresponding types)

Best,
Damien


2010/5/5 geng chen 
<chengeng4001 AT gmail.com>:
>  Hi everyone,
>   Recently, I need to develop a prototype in Coq. But I've met a problem, it
> seems naive, but it is important for me.
>
> Inductive prim : Set :=
>   A : prim
> | B : prim.
>
> Inductive comp : Set := list all.
>
> Inductive all : Set :=
>   C : prim -> all
> | D : comp -> all.
>
> Is there anyway to define the 3 types aboves? Do I need to use some special
> kinds of method to declare the type "all" in the front of the definition?
>
> Thanks, best regards
> Chen
>
>




Archive powered by MhonArc 2.6.16.

Top of Page