src/HOL/Sexp.thy
 changeset 923 ff1574a81019 child 972 e61b058d58d2
```     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/src/HOL/Sexp.thy	Fri Mar 03 12:02:25 1995 +0100
1.3 @@ -0,0 +1,40 @@
1.4 +(*  Title: 	HOL/Sexp
1.5 +    ID:         \$Id\$
1.6 +    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
1.7 +    Copyright   1992  University of Cambridge
1.8 +
1.9 +S-expressions, general binary trees for defining recursive data structures
1.10 +*)
1.11 +
1.12 +Sexp = Univ +
1.13 +consts
1.14 +  sexp      :: "'a item set"
1.15 +
1.16 +  sexp_case :: "['a=>'b, nat=>'b, ['a item, 'a item]=>'b, \
1.17 +\                'a item] => 'b"
1.18 +
1.19 +  sexp_rec  :: "['a item, 'a=>'b, nat=>'b, 	\
1.20 +\                ['a item, 'a item, 'b, 'b]=>'b] => 'b"
1.21 +
1.22 +  pred_sexp :: "('a item * 'a item)set"
1.23 +
1.24 +inductive "sexp"
1.25 +  intrs
1.26 +    LeafI  "Leaf(a): sexp"
1.27 +    NumbI  "Numb(a): sexp"
1.28 +    SconsI "[| M: sexp;  N: sexp |] ==> M\$N : sexp"
1.29 +
1.30 +defs
1.31 +
1.32 +  sexp_case_def
1.33 +   "sexp_case c d e M == @ z. (? x.   M=Leaf(x) & z=c(x))  \
1.34 +\                           | (? k.   M=Numb(k) & z=d(k))  \
1.35 +\                           | (? N1 N2. M = N1 \$ N2  & z=e N1 N2)"
1.36 +
1.37 +  pred_sexp_def
1.38 +     "pred_sexp == UN M: sexp. UN N: sexp. {<M, M\$N>, <N, M\$N>}"
1.39 +
1.40 +  sexp_rec_def
1.41 +   "sexp_rec M c d e == wfrec pred_sexp M  \
1.42 +\             (%M g. sexp_case c d (%N1 N2. e N1 N2 (g N1) (g N2)) M)"
1.43 +end
```