src/ZF/ex/Term.thy
author clasohm
Thu, 22 Jun 1995 17:13:05 +0200
changeset 1155 928a16e02f9f
parent 753 ec86863e87c8
child 1401 0c439768f45c
permissions -rw-r--r--
removed \...\ inside strings
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
     1
(*  Title: 	ZF/ex/Term.thy
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
     2
    ID:         $Id$
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
     3
    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
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
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    12
  term_rec  :: "[i, [i,i,i]=>i] => i"
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    13
  term_map  :: "[i=>i, i] => i"
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    14
  term_size :: "i=>i"
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    15
  reflect   :: "i=>i"
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    16
  preorder  :: "i=>i"
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    17
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    18
  term      :: "i=>i"
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))")
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
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) == 
928a16e02f9f removed \...\ inside strings
clasohm
parents: 753
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
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    34
  term_map_def	"term_map(f,t) == term_rec(t, %x zs rs. Apply(f(x), rs))"
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    35
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    36
  term_size_def	"term_size(t) == term_rec(t, %x zs rs. succ(list_add(rs)))"
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    37
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    38
  reflect_def	"reflect(t) == term_rec(t, %x zs rs. Apply(x, rev(rs)))"
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    39
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    40
  preorder_def	"preorder(t) == term_rec(t, %x zs rs. Cons(x, flat(rs)))"
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