src/ZF/ex/Term.thy
author clasohm
Tue Feb 06 12:27:17 1996 +0100 (1996-02-06)
changeset 1478 2b8c2a7547ab
parent 1401 0c439768f45c
child 3840 e0baea4d485a
permissions -rw-r--r--
expanded tabs
clasohm@1478
     1
(*  Title:      ZF/ex/Term.thy
lcp@515
     2
    ID:         $Id$
clasohm@1478
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
lcp@515
     4
    Copyright   1994  University of Cambridge
lcp@515
     5
lcp@515
     6
Terms over an alphabet.
lcp@515
     7
Illustrates the list functor (essentially the same type as in Trees & Forests)
lcp@515
     8
*)
lcp@515
     9
lcp@515
    10
Term = List +
lcp@515
    11
consts
clasohm@1401
    12
  term_rec  :: [i, [i,i,i]=>i] => i
clasohm@1401
    13
  term_map  :: [i=>i, i] => i
clasohm@1401
    14
  term_size :: i=>i
clasohm@1401
    15
  reflect   :: i=>i
clasohm@1401
    16
  preorder  :: i=>i
lcp@515
    17
clasohm@1401
    18
  term      :: i=>i
lcp@515
    19
lcp@515
    20
datatype
lcp@515
    21
  "term(A)" = Apply ("a: A", "l: list(term(A))")
clasohm@1478
    22
  monos       "[list_mono]"
lcp@740
    23
lcp@740
    24
  type_elims  "[make_elim (list_univ RS subsetD)]"
lcp@740
    25
(*Or could have
lcp@740
    26
    type_intrs  "[list_univ RS subsetD]"
lcp@740
    27
*)
lcp@515
    28
lcp@753
    29
defs
lcp@515
    30
  term_rec_def
clasohm@1155
    31
   "term_rec(t,d) == 
clasohm@1155
    32
   Vrec(t, %t g. term_case(%x zs. d(x, zs, map(%z.g`z, zs)), t))"
lcp@515
    33
clasohm@1478
    34
  term_map_def  "term_map(f,t) == term_rec(t, %x zs rs. Apply(f(x), rs))"
lcp@515
    35
clasohm@1478
    36
  term_size_def "term_size(t) == term_rec(t, %x zs rs. succ(list_add(rs)))"
lcp@515
    37
clasohm@1478
    38
  reflect_def   "reflect(t) == term_rec(t, %x zs rs. Apply(x, rev(rs)))"
lcp@515
    39
clasohm@1478
    40
  preorder_def  "preorder(t) == term_rec(t, %x zs rs. Cons(x, flat(rs)))"
lcp@515
    41
lcp@515
    42
end