src/ZF/ex/data.ML
author lcp
Tue Aug 16 18:58:42 1994 +0200 (1994-08-16)
changeset 532 851df239ac8b
parent 279 7738aed3f84d
permissions -rw-r--r--
ZF/Makefile,ROOT.ML, ZF/ex/Integ.thy: updated for EquivClass
lcp@56
     1
(*  Title: 	ZF/ex/data.ML
lcp@56
     2
    ID:         $Id$
lcp@56
     3
    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
lcp@56
     4
    Copyright   1993  University of Cambridge
lcp@56
     5
lcp@56
     6
Sample datatype definition.  
lcp@56
     7
It has four contructors, of arities 0-3, and two parameters A and B.
lcp@56
     8
*)
lcp@56
     9
lcp@56
    10
structure Data = Datatype_Fun
lcp@279
    11
 (val thy        = Univ.thy
lcp@279
    12
  val rec_specs  = [("data", "univ(A Un B)",
lcp@279
    13
                       [(["Con0"],   "i"),
lcp@279
    14
                        (["Con1"],   "i=>i"),
lcp@279
    15
                        (["Con2"],   "[i,i]=>i"),
lcp@279
    16
                        (["Con3"],   "[i,i,i]=>i")])]
lcp@279
    17
  val rec_styp   = "[i,i]=>i"
lcp@279
    18
  val ext        = None
lcp@279
    19
  val sintrs     = 
lcp@279
    20
          ["Con0 : data(A,B)",
lcp@279
    21
           "[| a: A |] ==> Con1(a) : data(A,B)",
lcp@279
    22
           "[| a: A; b: B |] ==> Con2(a,b) : data(A,B)",
lcp@279
    23
           "[| a: A; b: B;  d: data(A,B) |] ==> Con3(a,b,d) : data(A,B)"]
lcp@279
    24
  val monos      = []
lcp@71
    25
  val type_intrs = datatype_intrs
lcp@71
    26
  val type_elims = datatype_elims);
lcp@56
    27
lcp@56
    28
lcp@56
    29
(**  Lemmas to justify using "data" in other recursive type definitions **)
lcp@56
    30
lcp@56
    31
goalw Data.thy Data.defs "!!A B. [| A<=C; B<=D |] ==> data(A,B) <= data(C,D)";
lcp@56
    32
by (rtac lfp_mono 1);
lcp@56
    33
by (REPEAT (rtac Data.bnd_mono 1));
lcp@56
    34
by (REPEAT (ares_tac (univ_mono::Un_mono::basic_monos) 1));
lcp@56
    35
val data_mono = result();
lcp@56
    36
lcp@56
    37
goalw Data.thy (Data.defs@Data.con_defs) "data(univ(A),univ(A)) <= univ(A)";
lcp@56
    38
by (rtac lfp_lowerbound 1);
lcp@56
    39
by (rtac ([A_subset_univ, Un_upper1] MRS subset_trans RS univ_mono) 2);
lcp@56
    40
by (fast_tac (ZF_cs addSIs [zero_in_univ, Inl_in_univ, Inr_in_univ,
lcp@56
    41
			    Pair_in_univ]) 1);
lcp@56
    42
val data_univ = result();
lcp@56
    43
lcp@56
    44
val data_subset_univ = standard ([data_mono, data_univ] MRS subset_trans);
lcp@56
    45
lcp@56
    46