src/HOL/Sexp.thy
author clasohm
Wed Jun 21 15:47:10 1995 +0200 (1995-06-21)
changeset 1151 c820b3cc3df0
parent 972 e61b058d58d2
child 1370 7361ac9b024d
permissions -rw-r--r--
removed \...\ inside strings
clasohm@923
     1
(*  Title: 	HOL/Sexp
clasohm@923
     2
    ID:         $Id$
clasohm@923
     3
    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
clasohm@923
     4
    Copyright   1992  University of Cambridge
clasohm@923
     5
clasohm@923
     6
S-expressions, general binary trees for defining recursive data structures
clasohm@923
     7
*)
clasohm@923
     8
clasohm@923
     9
Sexp = Univ +
clasohm@923
    10
consts
clasohm@923
    11
  sexp      :: "'a item set"
clasohm@923
    12
clasohm@1151
    13
  sexp_case :: "['a=>'b, nat=>'b, ['a item, 'a item]=>'b, 
clasohm@1151
    14
                'a item] => 'b"
clasohm@923
    15
clasohm@1151
    16
  sexp_rec  :: "['a item, 'a=>'b, nat=>'b, 	
clasohm@1151
    17
                ['a item, 'a item, 'b, 'b]=>'b] => 'b"
clasohm@923
    18
  
clasohm@923
    19
  pred_sexp :: "('a item * 'a item)set"
clasohm@923
    20
clasohm@923
    21
inductive "sexp"
clasohm@923
    22
  intrs
clasohm@923
    23
    LeafI  "Leaf(a): sexp"
clasohm@923
    24
    NumbI  "Numb(a): sexp"
clasohm@923
    25
    SconsI "[| M: sexp;  N: sexp |] ==> M$N : sexp"
clasohm@923
    26
clasohm@923
    27
defs
clasohm@923
    28
clasohm@923
    29
  sexp_case_def	
clasohm@1151
    30
   "sexp_case c d e M == @ z. (? x.   M=Leaf(x) & z=c(x))  
clasohm@1151
    31
                           | (? k.   M=Numb(k) & z=d(k))  
clasohm@1151
    32
                           | (? N1 N2. M = N1 $ N2  & z=e N1 N2)"
clasohm@923
    33
clasohm@923
    34
  pred_sexp_def
clasohm@972
    35
     "pred_sexp == UN M: sexp. UN N: sexp. {(M, M$N), (N, M$N)}"
clasohm@923
    36
clasohm@923
    37
  sexp_rec_def
clasohm@1151
    38
   "sexp_rec M c d e == wfrec pred_sexp M  
clasohm@1151
    39
             (%M g. sexp_case c d (%N1 N2. e N1 N2 (g N1) (g N2)) M)"
clasohm@923
    40
end