doc-src/Ref/theory-syntax.tex
author lcp
Mon, 21 Mar 1994 10:51:28 +0100
changeset 285 fd4a6585e5bf
child 295 dcde5024895d
permissions -rw-r--r--
first draft of Springer book
lcp@285
     1
%% $Id$
lcp@285
     2
lcp@285
     3
\appendix
lcp@285
     4
\newlinechar=-1  %mathsing.sty sets \newlinechar=`\|, which would cause mayhem
lcp@285
     5
lcp@285
     6
\chapter{Syntax of Isabelle Theories}\label{app:TheorySyntax}
lcp@285
     7
\begin{itemize}
lcp@285
     8
\item {\tt Typewriter font} denotes terminal symbols.
lcp@285
     9
\item $id$, $tid$, $nat$, $string$ and $text$ are the lexical classes of
lcp@285
    10
  identifiers, type identifiers, natural numbers, \ML\ strings (with their
lcp@285
    11
  quotation marks) and arbitrary \ML\ text.  The first three are fully defined
lcp@285
    12
  in the {\it Defining Logics} chapter of {\it Isabelle's Object Logics}.
lcp@285
    13
\end{itemize}
lcp@285
    14
lcp@285
    15
\begin{rail}
lcp@285
    16
lcp@285
    17
theoryDef : id '=' (name + '+') ('+' extension | ());
lcp@285
    18
lcp@285
    19
name: id | string;
lcp@285
    20
lcp@285
    21
extension : classes default types arities consts trans rules 'end' ml
lcp@285
    22
          ;
lcp@285
    23
lcp@285
    24
classes : ()
lcp@285
    25
        | 'classes' ( ( id (  ()
lcp@285
    26
                            | '<' (id + ',')
lcp@285
    27
                           ) 
lcp@285
    28
                       ) + )
lcp@285
    29
        ;
lcp@285
    30
lcp@285
    31
default : ()
lcp@285
    32
        | 'default' sort 
lcp@285
    33
        ;
lcp@285
    34
lcp@285
    35
sort :  id
lcp@285
    36
     | '\{' (id * ',') '\}'
lcp@285
    37
     ;
lcp@285
    38
lcp@285
    39
types :  ()
lcp@285
    40
      | 'types' ( ( type ( () | '(' infix ')' ) ) + )
lcp@285
    41
      ;
lcp@285
    42
lcp@285
    43
type : ( () | tid | '(' ( tid + ',' ) ')') name ( () | '='  string );
lcp@285
    44
lcp@285
    45
infix : ( 'infixr' | 'infixl' ) nat;
lcp@285
    46
lcp@285
    47
lcp@285
    48
arities :  ()
lcp@285
    49
        | 'arities' ((( name + ',' ) '::' arity ) + )
lcp@285
    50
        ;
lcp@285
    51
lcp@285
    52
arity   : ( () 
lcp@285
    53
          | '(' (sort + ',') ')' 
lcp@285
    54
          ) id
lcp@285
    55
        ;
lcp@285
    56
lcp@285
    57
lcp@285
    58
consts :  ()
lcp@285
    59
       | 'consts' ( ( constDecl ( () | ( '(' mixfix ')' ) ) ) + )
lcp@285
    60
       ;
lcp@285
    61
lcp@285
    62
constDecl : ( name + ',') '::' string ;
lcp@285
    63
lcp@285
    64
lcp@285
    65
mixfix :  string ( () | ( () | ('[' (nat + ',') ']')) nat )
lcp@285
    66
       | infix
lcp@285
    67
       | 'binder' string nat ;
lcp@285
    68
lcp@285
    69
trans : ()
lcp@285
    70
      | 'translations' ( pat ( '==' | '=>' | '<=' ) pat + )
lcp@285
    71
      ;
lcp@285
    72
lcp@285
    73
pat : ( () | ( '(' id ')' ) ) string;
lcp@285
    74
lcp@285
    75
rules :  ()
lcp@285
    76
      | 'rules' (( id string ) + )
lcp@285
    77
      ;
lcp@285
    78
lcp@285
    79
ml :  ()
lcp@285
    80
   | 'ML' text
lcp@285
    81
   ;
lcp@285
    82
lcp@285
    83
\end{rail}