src/HOL/Sexp.thy
author wenzelm
Tue, 24 Nov 1998 12:03:09 +0100
changeset 5953 d6017ce6b93e
parent 5191 8ceaa19f7717
permissions -rw-r--r--
setup Blast.setup; setup Clasimp.setup;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1475
7f5a4cd08209 expanded tabs; renamed subtype to typedef;
clasohm
parents: 1395
diff changeset
     1
(*  Title:      HOL/Sexp
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     2
    ID:         $Id$
1475
7f5a4cd08209 expanded tabs; renamed subtype to typedef;
clasohm
parents: 1395
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
923
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
5101
52e7c75acfe6 Adapted to new inductive package.
berghofe
parents: 1788
diff changeset
     9
Sexp = Univ + Inductive +
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    10
consts
1370
7361ac9b024d removed quotes from types in consts and syntax sections
clasohm
parents: 1151
diff changeset
    11
  sexp      :: 'a item set
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    12
1151
c820b3cc3df0 removed \...\ inside strings
clasohm
parents: 972
diff changeset
    13
  sexp_case :: "['a=>'b, nat=>'b, ['a item, 'a item]=>'b, 
c820b3cc3df0 removed \...\ inside strings
clasohm
parents: 972
diff changeset
    14
                'a item] => 'b"
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    15
1475
7f5a4cd08209 expanded tabs; renamed subtype to typedef;
clasohm
parents: 1395
diff changeset
    16
  sexp_rec  :: "['a item, 'a=>'b, nat=>'b,      
1151
c820b3cc3df0 removed \...\ inside strings
clasohm
parents: 972
diff changeset
    17
                ['a item, 'a item, 'b, 'b]=>'b] => 'b"
923
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
1788
ca62fab4ce92 Quotes now optional around inductive set
paulson
parents: 1475
diff changeset
    21
inductive sexp
923
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"
1395
7095d6b89734 improved indentation
paulson
parents: 1370
diff changeset
    24
    NumbI  "Numb(i): sexp"
5191
8ceaa19f7717 Renamed '$' to 'Scons' because of clashes with constants of the same
berghofe
parents: 5101
diff changeset
    25
    SconsI "[| M: sexp;  N: sexp |] ==> Scons M N : sexp"
923
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
1475
7f5a4cd08209 expanded tabs; renamed subtype to typedef;
clasohm
parents: 1395
diff changeset
    29
  sexp_case_def 
1151
c820b3cc3df0 removed \...\ inside strings
clasohm
parents: 972
diff changeset
    30
   "sexp_case c d e M == @ z. (? x.   M=Leaf(x) & z=c(x))  
1395
7095d6b89734 improved indentation
paulson
parents: 1370
diff changeset
    31
                            | (? k.   M=Numb(k) & z=d(k))  
5191
8ceaa19f7717 Renamed '$' to 'Scons' because of clashes with constants of the same
berghofe
parents: 5101
diff changeset
    32
                            | (? N1 N2. M = Scons N1 N2  & z=e N1 N2)"
923
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
5191
8ceaa19f7717 Renamed '$' to 'Scons' because of clashes with constants of the same
berghofe
parents: 5101
diff changeset
    35
     "pred_sexp == UN M: sexp. UN N: sexp. {(M, Scons M N), (N, Scons M N)}"
923
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
1475
7f5a4cd08209 expanded tabs; renamed subtype to typedef;
clasohm
parents: 1395
diff changeset
    38
   "sexp_rec M c d e == wfrec pred_sexp
7f5a4cd08209 expanded tabs; renamed subtype to typedef;
clasohm
parents: 1395
diff changeset
    39
             (%g. sexp_case c d (%N1 N2. e N1 N2 (g N1) (g N2))) M"
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    40
end