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
     1 (*  Title: 	HOL/Sexp
     2     ID:         $Id$
     3     Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
     4     Copyright   1992  University of Cambridge
     5 
     6 S-expressions, general binary trees for defining recursive data structures
     7 *)
     8 
     9 Sexp = Univ +
    10 consts
    11   sexp      :: "'a item set"
    12 
    13   sexp_case :: "['a=>'b, nat=>'b, ['a item, 'a item]=>'b, 
    14                 'a item] => 'b"
    15 
    16   sexp_rec  :: "['a item, 'a=>'b, nat=>'b, 	
    17                 ['a item, 'a item, 'b, 'b]=>'b] => 'b"
    18   
    19   pred_sexp :: "('a item * 'a item)set"
    20 
    21 inductive "sexp"
    22   intrs
    23     LeafI  "Leaf(a): sexp"
    24     NumbI  "Numb(a): sexp"
    25     SconsI "[| M: sexp;  N: sexp |] ==> M$N : sexp"
    26 
    27 defs
    28 
    29   sexp_case_def	
    30    "sexp_case c d e M == @ z. (? x.   M=Leaf(x) & z=c(x))  
    31                            | (? k.   M=Numb(k) & z=d(k))  
    32                            | (? N1 N2. M = N1 $ N2  & z=e N1 N2)"
    33 
    34   pred_sexp_def
    35      "pred_sexp == UN M: sexp. UN N: sexp. {(M, M$N), (N, M$N)}"
    36 
    37   sexp_rec_def
    38    "sexp_rec M c d e == wfrec pred_sexp M  
    39              (%M g. sexp_case c d (%N1 N2. e N1 N2 (g N1) (g N2)) M)"
    40 end