src/ZF/Datatype.ML
author paulson
Mon Dec 28 16:59:28 1998 +0100 (1998-12-28)
changeset 6053 8a1059aa01f0
parent 1461 6bcb44e4d6e5
child 6112 5e4871c5136b
permissions -rw-r--r--
new inductive, datatype and primrec packages, etc.
lcp@516
     1
(*  Title:      ZF/Datatype.ML
clasohm@0
     2
    ID:         $Id$
lcp@516
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
clasohm@0
     4
    Copyright   1993  University of Cambridge
clasohm@0
     5
lcp@120
     6
(Co)Datatype Definitions for Zermelo-Fraenkel Set Theory
clasohm@0
     7
*)
clasohm@0
     8
clasohm@0
     9
paulson@6053
    10
(*Typechecking rules for most datatypes involving univ*)
paulson@6053
    11
structure Data_Arg =
paulson@6053
    12
  struct
paulson@6053
    13
  val intrs = 
paulson@6053
    14
      [SigmaI, InlI, InrI,
paulson@6053
    15
       Pair_in_univ, Inl_in_univ, Inr_in_univ, 
paulson@6053
    16
       zero_in_univ, A_into_univ, nat_into_univ, UnCI];
clasohm@0
    17
paulson@6053
    18
  (*Needed for mutual recursion*)
paulson@6053
    19
  val elims = [make_elim InlD, make_elim InrD];
lcp@516
    20
  end;
lcp@516
    21
lcp@516
    22
paulson@6053
    23
structure Data_Package = 
paulson@6053
    24
    Add_datatype_def_Fun
paulson@6053
    25
      (structure Fp=Lfp and Pr=Standard_Prod and CP=Standard_CP
paulson@6053
    26
       and Su=Standard_Sum
paulson@6053
    27
       and Ind_Package = Ind_Package
paulson@6053
    28
       and Datatype_Arg = Data_Arg);
lcp@516
    29
lcp@516
    30
paulson@6053
    31
(*Typechecking rules for most codatatypes involving quniv*)
paulson@6053
    32
structure CoData_Arg =
paulson@6053
    33
  struct
paulson@6053
    34
  val intrs = 
paulson@6053
    35
      [QSigmaI, QInlI, QInrI,
paulson@6053
    36
       QPair_in_quniv, QInl_in_quniv, QInr_in_quniv, 
paulson@6053
    37
       zero_in_quniv, A_into_quniv, nat_into_quniv, UnCI];
lcp@516
    38
paulson@6053
    39
  val elims = [make_elim QInlD, make_elim QInrD];
paulson@6053
    40
  end;
lcp@516
    41
paulson@6053
    42
structure CoData_Package = 
paulson@6053
    43
    Add_datatype_def_Fun(structure Fp=Gfp and Pr=Quine_Prod and CP=Quine_CP
paulson@6053
    44
                          and Su=Quine_Sum
paulson@6053
    45
			  and Ind_Package = CoInd_Package
paulson@6053
    46
			  and Datatype_Arg = CoData_Arg);
lcp@516
    47