src/ZF/datatype.ML
author paulson
Fri, 16 Feb 1996 18:00:47 +0100
changeset 1512 ce37c64244c0
parent 120 09287f26bfb8
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:
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     1
(*  Title: 	ZF/datatype.ML
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     2
    ID:         $Id$
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     3
    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
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
(*Datatype definitions use least fixedpoints, standard products and sums*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    11
functor Datatype_Fun (Const: CONSTRUCTOR) 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    12
         : sig include CONSTRUCTOR_RESULT INTR_ELIM INDRULE end =
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    13
struct
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    14
structure Constructor = Constructor_Fun (structure Const=Const and 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    15
  		                      Pr=Standard_Prod and Su=Standard_Sum);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    16
open Const Constructor;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    17
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    18
structure Inductive = Inductive_Fun
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    19
        (val thy = con_thy;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    20
	 val rec_doms = (map #1 rec_specs) ~~ (map #2 rec_specs);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    21
	 val sintrs = sintrs;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    22
	 val monos = monos;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    23
	 val con_defs = con_defs;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    24
	 val type_intrs = type_intrs;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    25
	 val type_elims = type_elims);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    26
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    27
open Inductive
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    28
end;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    29
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    30
120
09287f26bfb8 changed all co- and co_ to co
lcp
parents: 70
diff changeset
    31
(*Codatatype definitions use greatest fixedpoints, Quine products and sums*)
09287f26bfb8 changed all co- and co_ to co
lcp
parents: 70
diff changeset
    32
functor CoDatatype_Fun (Const: CONSTRUCTOR) 
09287f26bfb8 changed all co- and co_ to co
lcp
parents: 70
diff changeset
    33
         : sig include CONSTRUCTOR_RESULT INTR_ELIM COINDRULE end =
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    34
struct
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    35
structure Constructor = Constructor_Fun (structure Const=Const and 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    36
  		                      Pr=Quine_Prod and Su=Quine_Sum);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    37
open Const Constructor;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    38
120
09287f26bfb8 changed all co- and co_ to co
lcp
parents: 70
diff changeset
    39
structure CoInductive = CoInductive_Fun
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    40
        (val thy = con_thy;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    41
	 val rec_doms = (map #1 rec_specs) ~~ (map #2 rec_specs);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    42
	 val sintrs = sintrs;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    43
	 val monos = monos;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    44
	 val con_defs = con_defs;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    45
	 val type_intrs = type_intrs;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    46
	 val type_elims = type_elims);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    47
120
09287f26bfb8 changed all co- and co_ to co
lcp
parents: 70
diff changeset
    48
open CoInductive
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    49
end;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    50
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    51
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    52
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    53
(*For most datatypes involving univ*)
70
8a29f8b4aca1 ZF/ind-syntax/fold_con_tac: deleted, since fold_tac now works
lcp
parents: 55
diff changeset
    54
val datatype_intrs = 
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    55
    [SigmaI, InlI, InrI,
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    56
     Pair_in_univ, Inl_in_univ, Inr_in_univ, 
55
331d93292ee0 ZF/ind-syntax/refl_thin: new
lcp
parents: 0
diff changeset
    57
     zero_in_univ, A_into_univ, nat_into_univ, UnCI];
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    58
55
331d93292ee0 ZF/ind-syntax/refl_thin: new
lcp
parents: 0
diff changeset
    59
(*Needed for mutual recursion*)
70
8a29f8b4aca1 ZF/ind-syntax/fold_con_tac: deleted, since fold_tac now works
lcp
parents: 55
diff changeset
    60
val datatype_elims = [make_elim InlD, make_elim InrD];
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    61
120
09287f26bfb8 changed all co- and co_ to co
lcp
parents: 70
diff changeset
    62
(*For most codatatypes involving quniv*)
09287f26bfb8 changed all co- and co_ to co
lcp
parents: 70
diff changeset
    63
val codatatype_intrs = 
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    64
    [QSigmaI, QInlI, QInrI,
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    65
     QPair_in_quniv, QInl_in_quniv, QInr_in_quniv, 
55
331d93292ee0 ZF/ind-syntax/refl_thin: new
lcp
parents: 0
diff changeset
    66
     zero_in_quniv, A_into_quniv, nat_into_quniv, UnCI];
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    67
120
09287f26bfb8 changed all co- and co_ to co
lcp
parents: 70
diff changeset
    68
val codatatype_elims = [make_elim QInlD, make_elim QInrD];
55
331d93292ee0 ZF/ind-syntax/refl_thin: new
lcp
parents: 0
diff changeset
    69