src/ZF/ex/TF.thy
author lcp
Tue Aug 16 18:58:42 1994 +0200 (1994-08-16)
changeset 532 851df239ac8b
parent 515 abcc438e7c27
child 581 465075fd257b
permissions -rw-r--r--
ZF/Makefile,ROOT.ML, ZF/ex/Integ.thy: updated for EquivClass
lcp@515
     1
(*  Title: 	ZF/ex/TF.thy
lcp@515
     2
    ID:         $Id$
lcp@515
     3
    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
lcp@515
     4
    Copyright   1994  University of Cambridge
lcp@515
     5
lcp@515
     6
Trees & forests, a mutually recursive type definition.
lcp@515
     7
*)
lcp@515
     8
lcp@515
     9
TF = List +
lcp@515
    10
consts
lcp@515
    11
  TF_rec      :: "[i, [i,i,i]=>i, i, [i,i,i,i]=>i] => i"
lcp@515
    12
  TF_map      :: "[i=>i, i] => i"
lcp@515
    13
  TF_size     :: "i=>i"
lcp@515
    14
  TF_preorder :: "i=>i"
lcp@515
    15
  list_of_TF  :: "i=>i"
lcp@515
    16
  TF_of_list  :: "i=>i"
lcp@515
    17
lcp@515
    18
  tree, forest, tree_forest    :: "i=>i"
lcp@515
    19
lcp@515
    20
datatype
lcp@515
    21
  "tree(A)"   = "Tcons" ("a: A",  "f: forest(A)")
lcp@515
    22
and
lcp@515
    23
  "forest(A)" = "Fnil"  |  "Fcons" ("t: tree(A)",  "f: forest(A)")
lcp@515
    24
lcp@515
    25
rules
lcp@515
    26
  TF_rec_def
lcp@515
    27
    "TF_rec(z,b,c,d) == Vrec(z,  			\
lcp@515
    28
\      %z r. tree_forest_case(%x f. b(x, f, r`f), 	\
lcp@515
    29
\                             c, 			\
lcp@515
    30
\		              %t f. d(t, f, r`t, r`f), z))"
lcp@515
    31
lcp@515
    32
  list_of_TF_def
lcp@515
    33
    "list_of_TF(z) == TF_rec(z, %x f r. [Tcons(x,f)], [], \
lcp@515
    34
\		             %t f r1 r2. Cons(t, r2))"
lcp@515
    35
lcp@515
    36
  TF_of_list_def
lcp@515
    37
    "TF_of_list(f) == list_rec(f, Fnil,  %t f r. Fcons(t,r))"
lcp@515
    38
lcp@515
    39
  TF_map_def
lcp@515
    40
    "TF_map(h,z) == TF_rec(z, %x f r.Tcons(h(x),r), Fnil, \
lcp@515
    41
\                           %t f r1 r2. Fcons(r1,r2))"
lcp@515
    42
lcp@515
    43
  TF_size_def
lcp@515
    44
    "TF_size(z) == TF_rec(z, %x f r.succ(r), 0, %t f r1 r2. r1#+r2)"
lcp@515
    45
lcp@515
    46
  TF_preorder_def
lcp@515
    47
    "TF_preorder(z) == TF_rec(z, %x f r.Cons(x,r), Nil, %t f r1 r2. r1@r2)"
lcp@515
    48
lcp@515
    49
end