src/HOL/Sexp.thy
author paulson
Thu Jun 06 13:13:18 1996 +0200 (1996-06-06)
changeset 1788 ca62fab4ce92
parent 1475 7f5a4cd08209
child 5101 52e7c75acfe6
permissions -rw-r--r--
Quotes now optional around inductive set
clasohm@1475
     1
(*  Title:      HOL/Sexp
clasohm@923
     2
    ID:         $Id$
clasohm@1475
     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@1370
    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@1475
    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
paulson@1788
    21
inductive sexp
clasohm@923
    22
  intrs
clasohm@923
    23
    LeafI  "Leaf(a): sexp"
paulson@1395
    24
    NumbI  "Numb(i): sexp"
clasohm@923
    25
    SconsI "[| M: sexp;  N: sexp |] ==> M$N : sexp"
clasohm@923
    26
clasohm@923
    27
defs
clasohm@923
    28
clasohm@1475
    29
  sexp_case_def 
clasohm@1151
    30
   "sexp_case c d e M == @ z. (? x.   M=Leaf(x) & z=c(x))  
paulson@1395
    31
                            | (? k.   M=Numb(k) & z=d(k))  
paulson@1395
    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@1475
    38
   "sexp_rec M c d e == wfrec pred_sexp
clasohm@1475
    39
             (%g. sexp_case c d (%N1 N2. e N1 N2 (g N1) (g N2))) M"
clasohm@923
    40
end