285
|
1 |
%% $Id$
|
|
2 |
|
|
3 |
\appendix
|
|
4 |
\newlinechar=-1 %mathsing.sty sets \newlinechar=`\|, which would cause mayhem
|
|
5 |
|
|
6 |
\chapter{Syntax of Isabelle Theories}\label{app:TheorySyntax}
|
325
|
7 |
Chapter~\ref{sec:ref-defining-theories} explains the meanings of these
|
|
8 |
constructs. The syntax obeys the following conventions:
|
285
|
9 |
\begin{itemize}
|
|
10 |
\item {\tt Typewriter font} denotes terminal symbols.
|
|
11 |
\item $id$, $tid$, $nat$, $string$ and $text$ are the lexical classes of
|
|
12 |
identifiers, type identifiers, natural numbers, \ML\ strings (with their
|
1148
|
13 |
quotation marks, but without the need for \verb$\$ at the end of a line and
|
|
14 |
the beginning of the next line) and arbitrary \ML\ text. The first three
|
|
15 |
are fully defined in \iflabelundefined{Defining-Logics}%
|
325
|
16 |
{{\it The Isabelle Reference Manual}, chapter `Defining Logics'}%
|
|
17 |
{Chap.\ts\ref{Defining-Logics}}.
|
285
|
18 |
\end{itemize}
|
325
|
19 |
Comments in theories take the form {\tt (*} {\it text\/} {\tt*)}, where
|
|
20 |
{\it text\/} should not contain the character sequence {\tt*)}.
|
285
|
21 |
|
|
22 |
\begin{rail}
|
|
23 |
|
|
24 |
theoryDef : id '=' (name + '+') ('+' extension | ());
|
|
25 |
|
|
26 |
name: id | string;
|
|
27 |
|
1082
|
28 |
extension : (section +) 'end' ( () | ml );
|
285
|
29 |
|
1080
|
30 |
section : classes
|
|
31 |
| default
|
|
32 |
| types
|
|
33 |
| arities
|
|
34 |
| consts
|
1650
|
35 |
| constdefs
|
1080
|
36 |
| trans
|
|
37 |
| defs
|
|
38 |
| rules
|
1846
|
39 |
| oracle
|
1080
|
40 |
;
|
|
41 |
|
|
42 |
classes : 'classes' ( ( id ( ()
|
285
|
43 |
| '<' (id + ',')
|
|
44 |
)
|
|
45 |
) + )
|
|
46 |
;
|
|
47 |
|
1080
|
48 |
default : 'default' sort
|
285
|
49 |
;
|
|
50 |
|
|
51 |
sort : id
|
|
52 |
| '\{' (id * ',') '\}'
|
|
53 |
;
|
|
54 |
|
1080
|
55 |
types : 'types' ( ( typeDecl ( () | '(' infix ')' ) ) + )
|
285
|
56 |
;
|
|
57 |
|
1488
|
58 |
infix : ( 'infixr' | 'infixl' ) nat;
|
|
59 |
|
|
60 |
typeDecl : typevarlist name
|
1385
|
61 |
( () | '=' ( string | type ) );
|
|
62 |
|
1488
|
63 |
typevarlist : () | tid | '(' ( tid + ',' ) ')';
|
|
64 |
|
1385
|
65 |
type : simpleType | '(' type ')' | type '=>' type |
|
|
66 |
'[' ( type + "," ) ']' '=>' type;
|
|
67 |
|
|
68 |
simpleType: id | ( tid ( () | '::' id ) ) |
|
|
69 |
'(' ( type + "," ) ')' id | simpleType id;
|
285
|
70 |
|
|
71 |
|
1080
|
72 |
arities : 'arities' ((( name + ',' ) '::' arity ) + )
|
285
|
73 |
;
|
|
74 |
|
|
75 |
arity : ( ()
|
|
76 |
| '(' (sort + ',') ')'
|
|
77 |
) id
|
|
78 |
;
|
|
79 |
|
|
80 |
|
1080
|
81 |
consts : 'consts' ( ( constDecl ( () | ( '(' mixfix ')' ) ) ) + )
|
285
|
82 |
;
|
|
83 |
|
1382
|
84 |
constDecl : ( name + ',') '::' (string | type);
|
285
|
85 |
|
|
86 |
mixfix : string ( () | ( () | ('[' (nat + ',') ']')) nat )
|
|
87 |
| infix
|
|
88 |
| 'binder' string nat ;
|
|
89 |
|
1650
|
90 |
constdefs : 'constdefs' (id '::' (string | type) string +)
|
|
91 |
;
|
|
92 |
|
1080
|
93 |
trans : 'translations' ( pat ( '==' | '=>' | '<=' ) pat + )
|
285
|
94 |
;
|
|
95 |
|
|
96 |
pat : ( () | ( '(' id ')' ) ) string;
|
|
97 |
|
1080
|
98 |
rules : 'rules' (( id string ) + )
|
285
|
99 |
;
|
|
100 |
|
1080
|
101 |
defs : 'defs' (( id string ) + )
|
|
102 |
;
|
|
103 |
|
1846
|
104 |
oracle : 'oracle' name
|
|
105 |
;
|
|
106 |
|
1082
|
107 |
ml : 'ML' text
|
285
|
108 |
;
|
|
109 |
|
|
110 |
\end{rail}
|