src/ZF/ex/TF.thy
author clasohm
Sat Dec 09 13:36:11 1995 +0100 (1995-12-09 ago)
changeset 1401 0c439768f45c
parent 1155 928a16e02f9f
child 1478 2b8c2a7547ab
permissions -rw-r--r--
removed quotes from consts and syntax sections
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
clasohm@1401
    11
  TF_rec      :: [i, [i,i,i]=>i, i, [i,i,i,i]=>i] => i
clasohm@1401
    12
  TF_map      :: [i=>i, i] => i
clasohm@1401
    13
  TF_size     :: i=>i
clasohm@1401
    14
  TF_preorder :: i=>i
clasohm@1401
    15
  list_of_TF  :: i=>i
clasohm@1401
    16
  TF_of_list  :: i=>i
lcp@515
    17
clasohm@1401
    18
  tree, forest, tree_forest    :: i=>i
lcp@515
    19
lcp@515
    20
datatype
lcp@581
    21
  "tree(A)"   = Tcons ("a: A",  "f: forest(A)")
lcp@515
    22
and
lcp@581
    23
  "forest(A)" = Fnil  |  Fcons ("t: tree(A)",  "f: forest(A)")
lcp@515
    24
lcp@753
    25
defs
lcp@515
    26
  TF_rec_def
clasohm@1155
    27
    "TF_rec(z,b,c,d) == Vrec(z,  			
clasohm@1155
    28
      %z r. tree_forest_case(%x f. b(x, f, r`f), 	
clasohm@1155
    29
                             c, 			
clasohm@1155
    30
		              %t f. d(t, f, r`t, r`f), z))"
lcp@515
    31
lcp@515
    32
  list_of_TF_def
clasohm@1155
    33
    "list_of_TF(z) == TF_rec(z, %x f r. [Tcons(x,f)], [], 
clasohm@1155
    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
clasohm@1155
    40
    "TF_map(h,z) == TF_rec(z, %x f r.Tcons(h(x),r), Fnil, 
clasohm@1155
    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