src/ZF/ex/termfn.thy
author lcp
Tue Aug 16 18:58:42 1994 +0200 (1994-08-16)
changeset 532 851df239ac8b
parent 0 a5a9c433f639
permissions -rw-r--r--
ZF/Makefile,ROOT.ML, ZF/ex/Integ.thy: updated for EquivClass
clasohm@0
     1
(*  Title: 	ZF/ex/term-fn.thy
clasohm@0
     2
    ID:         $Id$
clasohm@0
     3
    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
clasohm@0
     4
    Copyright   1993  University of Cambridge
clasohm@0
     5
clasohm@0
     6
Terms over an alphabet.
clasohm@0
     7
Illustrates the list functor (essentially the same type as in Trees & Forests)
clasohm@0
     8
*)
clasohm@0
     9
clasohm@0
    10
TermFn = Term + ListFn +
clasohm@0
    11
consts
clasohm@0
    12
    term_rec    :: "[i, [i,i,i]=>i] => i"
clasohm@0
    13
    term_map    :: "[i=>i, i] => i"
clasohm@0
    14
    term_size   :: "i=>i"
clasohm@0
    15
    reflect     :: "i=>i"
clasohm@0
    16
    preorder    :: "i=>i"
clasohm@0
    17
clasohm@0
    18
rules
clasohm@0
    19
  term_rec_def
clasohm@0
    20
   "term_rec(t,d) == \
clasohm@0
    21
\   Vrec(t, %t g. term_case(%x zs. d(x, zs, map(%z.g`z, zs)), t))"
clasohm@0
    22
clasohm@0
    23
  term_map_def	"term_map(f,t) == term_rec(t, %x zs rs. Apply(f(x), rs))"
clasohm@0
    24
clasohm@0
    25
  term_size_def	"term_size(t) == term_rec(t, %x zs rs. succ(list_add(rs)))"
clasohm@0
    26
clasohm@0
    27
  reflect_def	"reflect(t) == term_rec(t, %x zs rs. Apply(x, rev(rs)))"
clasohm@0
    28
clasohm@0
    29
  preorder_def	"preorder(t) == term_rec(t, %x zs rs. Cons(x, flat(rs)))"
clasohm@0
    30
clasohm@0
    31
end