Return-Path: <John.Harrison-request@cl.cam.ac.uk>
Delivery-Date: 
Received: from leopard.cs.byu.edu (no rfc931) by swan.cl.cam.ac.uk 
          with SMTP (PP-6.5) outside ac.uk; Thu, 9 Dec 1993 17:45:37 +0000
Received: by leopard.cs.byu.edu (1.37.109.8/16.2) id AA26881;
          Thu, 9 Dec 1993 10:33:12 -0700
Sender: info-hol-request@leopard.cs.byu.edu
Errors-To: info-hol-request@leopard.cs.byu.edu
Precedence: bulk
Received: from dworshak.cs.uidaho.edu by leopard.cs.byu.edu 
          with SMTP (1.37.109.8/16.2) id AA26877;
          Thu, 9 Dec 1993 10:33:00 -0700
Received: from tuminfo2.informatik.tu-muenchen.de by dworshak.cs.uidaho.edu 
          with SMTP (1.37.109.8/16.2) id AA03634;
          Thu, 9 Dec 1993 09:29:29 -0800
Received: from sunbroy14.informatik.tu-muenchen.de ([131.159.0.114]) 
          by tuminfo2.informatik.tu-muenchen.de with SMTP id <57659>;
          Thu, 9 Dec 1993 18:29:07 +0100
Received: by sunbroy14.informatik.tu-muenchen.de id <8086>;
          Thu, 9 Dec 1993 18:28:38 +0100
From: Konrad Slind <slind@informatik.tu-muenchen.de>
To: info-hol@cs.uidaho.edu, reetz@ira.uka.de
Cc: schneide@ira.uka.de
In-Reply-To: reetz's message of Thu, 9 Dec 1993 23:28:26 +0100 <"i80fs2.ira.005:09.11.93.16.28.29"@ira.uka.de>
Subject: define_type within hol90.5 and hol90.6
Message-Id: <93Dec9.182838met.8086@sunbroy14.informatik.tu-muenchen.de>
Date: Thu, 9 Dec 1993 18:28:28 +0100


> new_theory "demo";
>
> define_type
>    {fixities =[Prefix,Prefix,Prefix],
>    name     ="CompTree",
>    type_spec=`CompTree=C_Compnode  of CompTree#CompTree#('M->'M->'M)|
>                        C_Varleaf   of 'VN|
>                        C_Constleaf of 'M`};
> 
> using hol90.6, I get the following:
> 
> define_type
>   {fixities =[Prefix,Prefix,Prefix],
>    name     ="CompTree",
>    type_spec=`CompTree=C_Compnode  of CompTree#CompTree#('M->'M->'M)|
>                        C_Varleaf   of 'VN|
>                        C_Constleaf of 'M`};
>
> Exception raised at Parse_support.make_type_clause.check:
> recursive occurrence of defined type is deeper than the first level
>  
> uncaught exception HOL_ERR
>
> does anybody have an idea?

Yes, I do: try 

> define_type
  {fixities =[Prefix,Prefix,Prefix],
   name     ="CompTree",
   type_spec=`CompTree=C_Compnode  of CompTree => CompTree|
                       C_Varleaf   of 'VN|
                       C_Constleaf of 'M`};

This is a difference between version5 and version6: it is noted in the
file doc/5.changes in the hol90.6 distribution. The change notice reads

> 7. Changed the parsing of type specifications. The syntax of the hol88
>    version is more subtle than I thought; it allows the defined constructor
>    to be curried or not. My boneheaded version in hol90.5 wouldn't allow
>    type constructors that took paired arguments. Now that has been fixed,
>    at the cost of some special syntax. A curried constructor has "=>"
>    between its arguments, while an uncurried constructor has just a single
>    argument, which can have the form of any type. The "=>" is merely a
>    delimiter that makes parsing simple, plus I hope that it has an
>    intuitive reading if one confuses the "=>" with "->".

Since C_Compnode is a curried constructor of type 

    :('VN,'M)CompTree -> ('VN,'M)CompTree -> ('VN,'M)CompTree

it needs to appear as 

    C_Compnode  of CompTree => CompTree

in the type specification. If it had been uncurried, it would appear as 

    C_Compnode  of CompTree#CompTree

in the type specification.

Konrad.
