Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club]Mutually dependent types

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club]Mutually dependent types


chronological Thread 
  • From: Charles Bouillaguet <Charles.Bouillaguet AT crans.org>
  • To: Alex Suzuki <as AT cynox.ch>
  • Cc: coq-club AT pauillac.inria.fr
  • Subject: Re: [Coq-Club]Mutually dependent types
  • Date: Tue, 06 Jun 2006 06:59:43 -0400
  • List-archive: <http://pauillac.inria.fr/pipermail/coq-club/>

Hi,

I think that what you want is :

Inductive A: Set :=
 | A1
 | A2 (x: B)

with B: Set :=
 | B1
 | B2 (x: A).

You may also want to define mutually recursive induction principle. You should probably read the section 10.3, about "Scheme" in the reference manual. You'll find some example there, too.

Good luck !

Charles Bouillaguet

Alex Suzuki wrote:
Hello list,

I'm a CS student at ETH Zurich and I'm using Coq to formalize a
translation from Java Bytecode to a guarded command language used
for verification. This is probably not the last question regarding
Coq from my side. ;-)

When a situation arises where we have types that depend on each
other, how do you do write this in Coq?

Inductive A: Set :=
  | A1
  | A2 (x: B).

Inductive B: Set :=
  | B1
  | B2 (x: A).

This will not work as Coq will complain that the reference B was
not found in the current environment. Is there some way to
"forward declare" type B, or am I doing something very wrong? :)

Regards,
  Alex





Archive powered by MhonArc 2.6.16.

Top of Page