src/ZF/ex/Term.thy
author wenzelm
Fri, 10 Oct 1997 18:23:31 +0200
changeset 3840 e0baea4d485a
parent 1478 2b8c2a7547ab
child 6112 5e4871c5136b
permissions -rw-r--r--
fixed dots;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1478
2b8c2a7547ab expanded tabs
clasohm
parents: 1401
diff changeset
     1
(*  Title:      ZF/ex/Term.thy
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
     2
    ID:         $Id$
1478
2b8c2a7547ab expanded tabs
clasohm
parents: 1401
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
     4
    Copyright   1994  University of Cambridge
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
     5
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
     6
Terms over an alphabet.
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
     7
Illustrates the list functor (essentially the same type as in Trees & Forests)
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
     8
*)
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
     9
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    10
Term = List +
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    11
consts
1401
0c439768f45c removed quotes from consts and syntax sections
clasohm
parents: 1155
diff changeset
    12
  term_rec  :: [i, [i,i,i]=>i] => i
0c439768f45c removed quotes from consts and syntax sections
clasohm
parents: 1155
diff changeset
    13
  term_map  :: [i=>i, i] => i
0c439768f45c removed quotes from consts and syntax sections
clasohm
parents: 1155
diff changeset
    14
  term_size :: i=>i
0c439768f45c removed quotes from consts and syntax sections
clasohm
parents: 1155
diff changeset
    15
  reflect   :: i=>i
0c439768f45c removed quotes from consts and syntax sections
clasohm
parents: 1155
diff changeset
    16
  preorder  :: i=>i
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    17
1401
0c439768f45c removed quotes from consts and syntax sections
clasohm
parents: 1155
diff changeset
    18
  term      :: i=>i
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    19
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    20
datatype
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    21
  "term(A)" = Apply ("a: A", "l: list(term(A))")
1478
2b8c2a7547ab expanded tabs
clasohm
parents: 1401
diff changeset
    22
  monos       "[list_mono]"
740
281881c08397 added comments on alternative uses of type_intrs/elims
lcp
parents: 515
diff changeset
    23
281881c08397 added comments on alternative uses of type_intrs/elims
lcp
parents: 515
diff changeset
    24
  type_elims  "[make_elim (list_univ RS subsetD)]"
281881c08397 added comments on alternative uses of type_intrs/elims
lcp
parents: 515
diff changeset
    25
(*Or could have
281881c08397 added comments on alternative uses of type_intrs/elims
lcp
parents: 515
diff changeset
    26
    type_intrs  "[list_univ RS subsetD]"
281881c08397 added comments on alternative uses of type_intrs/elims
lcp
parents: 515
diff changeset
    27
*)
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    28
753
ec86863e87c8 replaced "rules" by "defs"
lcp
parents: 740
diff changeset
    29
defs
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    30
  term_rec_def
1155
928a16e02f9f removed \...\ inside strings
clasohm
parents: 753
diff changeset
    31
   "term_rec(t,d) == 
3840
e0baea4d485a fixed dots;
wenzelm
parents: 1478
diff changeset
    32
   Vrec(t, %t g. term_case(%x zs. d(x, zs, map(%z. g`z, zs)), t))"
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    33
1478
2b8c2a7547ab expanded tabs
clasohm
parents: 1401
diff changeset
    34
  term_map_def  "term_map(f,t) == term_rec(t, %x zs rs. Apply(f(x), rs))"
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    35
1478
2b8c2a7547ab expanded tabs
clasohm
parents: 1401
diff changeset
    36
  term_size_def "term_size(t) == term_rec(t, %x zs rs. succ(list_add(rs)))"
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    37
1478
2b8c2a7547ab expanded tabs
clasohm
parents: 1401
diff changeset
    38
  reflect_def   "reflect(t) == term_rec(t, %x zs rs. Apply(x, rev(rs)))"
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    39
1478
2b8c2a7547ab expanded tabs
clasohm
parents: 1401
diff changeset
    40
  preorder_def  "preorder(t) == term_rec(t, %x zs rs. Cons(x, flat(rs)))"
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    41
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    42
end