src/HOL/Sexp.thy
author clasohm
Fri, 03 Mar 1995 12:02:25 +0100
changeset 923 ff1574a81019
child 972 e61b058d58d2
permissions -rw-r--r--
new version of HOL with curried function application
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     1
(*  Title: 	HOL/Sexp
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     2
    ID:         $Id$
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     3
    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     4
    Copyright   1992  University of Cambridge
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     5
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     6
S-expressions, general binary trees for defining recursive data structures
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     7
*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     8
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     9
Sexp = Univ +
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    10
consts
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    11
  sexp      :: "'a item set"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    12
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    13
  sexp_case :: "['a=>'b, nat=>'b, ['a item, 'a item]=>'b, \
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    14
\                'a item] => 'b"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    15
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    16
  sexp_rec  :: "['a item, 'a=>'b, nat=>'b, 	\
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    17
\                ['a item, 'a item, 'b, 'b]=>'b] => 'b"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    18
  
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    19
  pred_sexp :: "('a item * 'a item)set"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    20
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    21
inductive "sexp"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    22
  intrs
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    23
    LeafI  "Leaf(a): sexp"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    24
    NumbI  "Numb(a): sexp"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    25
    SconsI "[| M: sexp;  N: sexp |] ==> M$N : sexp"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    26
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    27
defs
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    28
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    29
  sexp_case_def	
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    30
   "sexp_case c d e M == @ z. (? x.   M=Leaf(x) & z=c(x))  \
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    31
\                           | (? k.   M=Numb(k) & z=d(k))  \
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    32
\                           | (? N1 N2. M = N1 $ N2  & z=e N1 N2)"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    33
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    34
  pred_sexp_def
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    35
     "pred_sexp == UN M: sexp. UN N: sexp. {<M, M$N>, <N, M$N>}"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    36
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    37
  sexp_rec_def
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    38
   "sexp_rec M c d e == wfrec pred_sexp M  \
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    39
\             (%M g. sexp_case c d (%N1 N2. e N1 N2 (g N1) (g N2)) M)"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    40
end