src/ZF/Datatype.ML
author paulson
Fri, 16 Feb 1996 18:00:47 +0100
changeset 1512 ce37c64244c0
parent 1461 6bcb44e4d6e5
child 6053 8a1059aa01f0
permissions -rw-r--r--
Elimination of fully-functorial style. Type tactic changed to a type abbrevation (from a datatype). Constructor tactic and function apply deleted.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
516
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
     1
(*  Title:      ZF/Datatype.ML
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     2
    ID:         $Id$
516
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     4
    Copyright   1993  University of Cambridge
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     5
120
09287f26bfb8 changed all co- and co_ to co
lcp
parents: 70
diff changeset
     6
(Co)Datatype Definitions for Zermelo-Fraenkel Set Theory
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     7
*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     8
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     9
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    10
(*For most datatypes involving univ*)
70
8a29f8b4aca1 ZF/ind-syntax/fold_con_tac: deleted, since fold_tac now works
lcp
parents: 55
diff changeset
    11
val datatype_intrs = 
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    12
    [SigmaI, InlI, InrI,
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    13
     Pair_in_univ, Inl_in_univ, Inr_in_univ, 
55
331d93292ee0 ZF/ind-syntax/refl_thin: new
lcp
parents: 0
diff changeset
    14
     zero_in_univ, A_into_univ, nat_into_univ, UnCI];
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    15
55
331d93292ee0 ZF/ind-syntax/refl_thin: new
lcp
parents: 0
diff changeset
    16
(*Needed for mutual recursion*)
70
8a29f8b4aca1 ZF/ind-syntax/fold_con_tac: deleted, since fold_tac now works
lcp
parents: 55
diff changeset
    17
val datatype_elims = [make_elim InlD, make_elim InrD];
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    18
120
09287f26bfb8 changed all co- and co_ to co
lcp
parents: 70
diff changeset
    19
(*For most codatatypes involving quniv*)
09287f26bfb8 changed all co- and co_ to co
lcp
parents: 70
diff changeset
    20
val codatatype_intrs = 
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    21
    [QSigmaI, QInlI, QInrI,
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    22
     QPair_in_quniv, QInl_in_quniv, QInr_in_quniv, 
55
331d93292ee0 ZF/ind-syntax/refl_thin: new
lcp
parents: 0
diff changeset
    23
     zero_in_quniv, A_into_quniv, nat_into_quniv, UnCI];
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    24
120
09287f26bfb8 changed all co- and co_ to co
lcp
parents: 70
diff changeset
    25
val codatatype_elims = [make_elim QInlD, make_elim QInrD];
55
331d93292ee0 ZF/ind-syntax/refl_thin: new
lcp
parents: 0
diff changeset
    26
516
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    27
signature INDUCTIVE_THMS =
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    28
  sig
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 802
diff changeset
    29
  val monos      : thm list             (*monotonicity of each M operator*)
6bcb44e4d6e5 expanded tabs
clasohm
parents: 802
diff changeset
    30
  val type_intrs : thm list             (*type-checking intro rules*)
6bcb44e4d6e5 expanded tabs
clasohm
parents: 802
diff changeset
    31
  val type_elims : thm list             (*type-checking elim rules*)
516
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    32
  end;
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    33
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    34
functor Data_section_Fun
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    35
 (Arg: sig include CONSTRUCTOR_ARG INDUCTIVE_I INDUCTIVE_THMS end)  
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    36
    : sig include CONSTRUCTOR_RESULT INTR_ELIM INDRULE end =
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    37
struct
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    38
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    39
structure Con = Constructor_Fun 
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 802
diff changeset
    40
        (structure Const = Arg and Pr=Standard_Prod and Su=Standard_Sum);
516
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    41
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    42
structure Inductive = Ind_section_Fun
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    43
   (open Arg; 
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    44
    val con_defs = Con.con_defs
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    45
    val type_intrs = Arg.type_intrs @ datatype_intrs
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    46
    val type_elims = Arg.type_elims @ datatype_elims);
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    47
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    48
open Inductive Con
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    49
end;
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    50
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    51
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    52
functor CoData_section_Fun
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    53
 (Arg: sig include CONSTRUCTOR_ARG INDUCTIVE_I INDUCTIVE_THMS end)  
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    54
    : sig include CONSTRUCTOR_RESULT INTR_ELIM COINDRULE end =
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    55
struct
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    56
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    57
structure Con = Constructor_Fun 
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 802
diff changeset
    58
        (structure Const = Arg and Pr=Quine_Prod and Su=Quine_Sum);
516
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    59
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    60
structure CoInductive = CoInd_section_Fun
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    61
   (open Arg; 
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    62
    val con_defs = Con.con_defs
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    63
    val type_intrs = Arg.type_intrs @ codatatype_intrs
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    64
    val type_elims = Arg.type_elims @ codatatype_elims);
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    65
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    66
open CoInductive Con
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    67
end;
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    68
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 477
diff changeset
    69