Skip to Content.
Sympa Menu

coq-club - [Coq-Club] Mutually inductive types referring to each other

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

[Coq-Club] Mutually inductive types referring to each other


chronological Thread 
  • From: Nadeem Abdul Hamid <nadeem AT acm.org>
  • To: coq-club AT pauillac.inria.fr
  • Subject: [Coq-Club] Mutually inductive types referring to each other
  • Date: Thu, 30 Oct 2008 00:13:16 -0400
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:from:to:content-type:content-transfer-encoding :mime-version:subject:date:x-mailer:sender; b=unWShQlCjOgb7mbK6BCg+T3pfGnUIB7Bt0qV0AVa7jDrnRpwWIgCImzsMZYF0M1sAa wzd0TqDlioUZqTo4v5RsFmVfsbRItkCrWiBf37VnAjNOgVltdZemgEBhYeuH3r6biF8B RERiaeb87IG9M8exBmjhzMaoogi733csRla1g=
  • List-archive: <http://pauillac.inria.fr/pipermail/coq-club/>

I was trying to reproduce an example similar to one from the Agda documentation, using dependent types to define the type of a sorted list of numbers:

Inductive sortedlist : Set :=
  | snil : sortedlist
  | scons : forall (n:nat) (l:sortedlist), leq_all' n l -> sortedlist
with leq_all : nat -> sortedlist -> Prop :=
  | srt_nil : forall n, leq_all n nil
| srt_cons : forall n n' l', n <= n' -> leq_all n l' -> leq_all n (cons n' l')
.

but it gives an error on "sortedlist" in the type of leq_all:
    leq_all : nat -> sortedlist -> Prop :=
"Error: The reference sortedlist was not found in the current environment."

Apparently, the names of the types being defined cannot be used in the types of other mutually referential definitions? Is there any way to do this?

--- nadeem





Archive powered by MhonArc 2.6.16.

Top of Page