src/ZF/ex/Data.ML
author lcp
Fri, 12 Aug 1994 12:28:46 +0200
changeset 515 abcc438e7c27
parent 503 15375d7b379c
child 529 f0d16216e394
permissions -rw-r--r--
installation of new inductive/datatype sections
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 503
diff changeset
     1
(*  Title: 	ZF/ex/Data.ML
56
2caa6f49f06e ZF/ex/tf/tree,forest_unfold: streamlined the proofs
lcp
parents:
diff changeset
     2
    ID:         $Id$
2caa6f49f06e ZF/ex/tf/tree,forest_unfold: streamlined the proofs
lcp
parents:
diff changeset
     3
    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
2caa6f49f06e ZF/ex/tf/tree,forest_unfold: streamlined the proofs
lcp
parents:
diff changeset
     4
    Copyright   1993  University of Cambridge
2caa6f49f06e ZF/ex/tf/tree,forest_unfold: streamlined the proofs
lcp
parents:
diff changeset
     5
2caa6f49f06e ZF/ex/tf/tree,forest_unfold: streamlined the proofs
lcp
parents:
diff changeset
     6
Sample datatype definition.  
2caa6f49f06e ZF/ex/tf/tree,forest_unfold: streamlined the proofs
lcp
parents:
diff changeset
     7
It has four contructors, of arities 0-3, and two parameters A and B.
2caa6f49f06e ZF/ex/tf/tree,forest_unfold: streamlined the proofs
lcp
parents:
diff changeset
     8
*)
2caa6f49f06e ZF/ex/tf/tree,forest_unfold: streamlined the proofs
lcp
parents:
diff changeset
     9
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 503
diff changeset
    10
open Data;
56
2caa6f49f06e ZF/ex/tf/tree,forest_unfold: streamlined the proofs
lcp
parents:
diff changeset
    11
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 503
diff changeset
    12
goal Data.thy "data(A,B) = ({0} + A) + (A*B + A*B*data(A,B))";
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 503
diff changeset
    13
by (rtac (data.unfold RS trans) 1);
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 503
diff changeset
    14
bws data.con_defs;
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 503
diff changeset
    15
br equalityI 1;
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 503
diff changeset
    16
by (fast_tac sum_cs 1);
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 503
diff changeset
    17
(*for this direction, fast_tac is just too slow!*)
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 503
diff changeset
    18
by (safe_tac sum_cs);
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 503
diff changeset
    19
by (REPEAT_FIRST (swap_res_tac [refl, conjI, disjCI, exI]));
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 503
diff changeset
    20
by (REPEAT (fast_tac (sum_cs addIs datatype_intrs
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 503
diff changeset
    21
  		             addDs [data.dom_subset RS subsetD]) 1));
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 503
diff changeset
    22
val data_unfold = result();
56
2caa6f49f06e ZF/ex/tf/tree,forest_unfold: streamlined the proofs
lcp
parents:
diff changeset
    23
2caa6f49f06e ZF/ex/tf/tree,forest_unfold: streamlined the proofs
lcp
parents:
diff changeset
    24
(**  Lemmas to justify using "data" in other recursive type definitions **)
2caa6f49f06e ZF/ex/tf/tree,forest_unfold: streamlined the proofs
lcp
parents:
diff changeset
    25
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 503
diff changeset
    26
goalw Data.thy data.defs "!!A B. [| A<=C; B<=D |] ==> data(A,B) <= data(C,D)";
56
2caa6f49f06e ZF/ex/tf/tree,forest_unfold: streamlined the proofs
lcp
parents:
diff changeset
    27
by (rtac lfp_mono 1);
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 503
diff changeset
    28
by (REPEAT (rtac data.bnd_mono 1));
56
2caa6f49f06e ZF/ex/tf/tree,forest_unfold: streamlined the proofs
lcp
parents:
diff changeset
    29
by (REPEAT (ares_tac (univ_mono::Un_mono::basic_monos) 1));
2caa6f49f06e ZF/ex/tf/tree,forest_unfold: streamlined the proofs
lcp
parents:
diff changeset
    30
val data_mono = result();
2caa6f49f06e ZF/ex/tf/tree,forest_unfold: streamlined the proofs
lcp
parents:
diff changeset
    31
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents: 503
diff changeset
    32
goalw Data.thy (data.defs@data.con_defs) "data(univ(A),univ(A)) <= univ(A)";
56
2caa6f49f06e ZF/ex/tf/tree,forest_unfold: streamlined the proofs
lcp
parents:
diff changeset
    33
by (rtac lfp_lowerbound 1);
2caa6f49f06e ZF/ex/tf/tree,forest_unfold: streamlined the proofs
lcp
parents:
diff changeset
    34
by (rtac ([A_subset_univ, Un_upper1] MRS subset_trans RS univ_mono) 2);
2caa6f49f06e ZF/ex/tf/tree,forest_unfold: streamlined the proofs
lcp
parents:
diff changeset
    35
by (fast_tac (ZF_cs addSIs [zero_in_univ, Inl_in_univ, Inr_in_univ,
2caa6f49f06e ZF/ex/tf/tree,forest_unfold: streamlined the proofs
lcp
parents:
diff changeset
    36
			    Pair_in_univ]) 1);
2caa6f49f06e ZF/ex/tf/tree,forest_unfold: streamlined the proofs
lcp
parents:
diff changeset
    37
val data_univ = result();
2caa6f49f06e ZF/ex/tf/tree,forest_unfold: streamlined the proofs
lcp
parents:
diff changeset
    38
2caa6f49f06e ZF/ex/tf/tree,forest_unfold: streamlined the proofs
lcp
parents:
diff changeset
    39
val data_subset_univ = standard ([data_mono, data_univ] MRS subset_trans);
2caa6f49f06e ZF/ex/tf/tree,forest_unfold: streamlined the proofs
lcp
parents:
diff changeset
    40
2caa6f49f06e ZF/ex/tf/tree,forest_unfold: streamlined the proofs
lcp
parents:
diff changeset
    41