author | wenzelm |
Tue, 27 Aug 2002 17:25:44 +0200 | |
changeset 13542 | bb3e8a86d610 |
parent 13047 | f27cc0a43feb |
child 14921 | 4ad751fa50c1 |
permissions | -rw-r--r-- |
4540 | 1 |
|
3753 | 2 |
%% $Id$ |
3188 | 3 |
|
10580 | 4 |
\chapter{Presenting theories}\label{ch:present} |
3188 | 5 |
|
7849 | 6 |
Isabelle provides several ways to present the outcome of formal developments, |
7 |
including WWW-based browsable libraries or actual printable documents. |
|
8 |
Presentation is centered around the concept of \emph{logic sessions}. The |
|
12464 | 9 |
global session structure is that of a tree, with Isabelle Pure at its root, |
10 |
further object-logics derived (e.g.\ HOLCF from HOL, and HOL from Pure), and |
|
11 |
application sessions in leaf positions (usually without a separate image). |
|
7849 | 12 |
|
11616 | 13 |
The \texttt{mkdir} (see \S\ref{sec:tool-mkdir}) and \texttt{make} (see |
14 |
\S\ref{sec:tool-make}) tools of Isabelle provide the primary means for |
|
15 |
managing Isabelle sessions, including proper setup for presentation. Here the |
|
12464 | 16 |
\texttt{usedir} (see \S\ref{sec:tool-usedir}) tool takes care to let the |
17 |
\texttt{isabelle} process run any additional stages required for document |
|
18 |
preparation, notably the tools \texttt{document} (see |
|
19 |
\S\ref{sec:tool-document}) and \texttt{latex} (see \S\ref{sec:tool-latex}). |
|
20 |
The complete tool chain for managing batch-mode Isabelle sessions is |
|
21 |
illustrated in figure~\ref{fig:session-tools}. |
|
22 |
||
23 |
\begin{figure}[htbp] |
|
24 |
\begin{center} |
|
25 |
\begin{tabular}{lp{0.6\textwidth}} |
|
26 |
\texttt{isatool mkdir} & invoked once by the user to create the initial |
|
27 |
source setup (common \texttt{IsaMakefile} plus a single session directory); \\ |
|
28 |
\texttt{isatool make} & invoked repeatedly by the user to |
|
29 |
keep session output up-to-date (HTML, documents etc.); \\ |
|
30 |
\texttt{isatool usedir} & part of the standard \texttt{IsaMakefile} entry of a session; \\ |
|
31 |
\texttt{isabelle} & run through \texttt{isatool usedir}; \\ |
|
32 |
\texttt{isatool document} & run by the Isabelle process if document preparation is enabled; \\ |
|
33 |
\texttt{isatool latex} & universal {\LaTeX} tool wrapper invoked multiple times |
|
34 |
by \texttt{isatool document}; also useful for manual experiments; \\ |
|
35 |
\end{tabular} |
|
36 |
\caption{The tool chain of Isabelle session presentation} |
|
37 |
\label{fig:session-tools} |
|
38 |
\end{center} |
|
39 |
\end{figure} |
|
7849 | 40 |
|
41 |
||
12464 | 42 |
\section{Generating theory browser information} \label{sec:info} |
4540 | 43 |
\index{theory browsing information|bold} |
3188 | 44 |
|
7849 | 45 |
As a side-effect of running a logic sessions, Isabelle is able to generate |
46 |
theory browsing information, including HTML documents that show a theory's |
|
47 |
definition, the theorems proved in its ML file and the relationship with its |
|
48 |
ancestors and descendants. Besides the HTML file that is generated for every |
|
49 |
theory, Isabelle stores links to all theories in an index file. These indexes |
|
7882 | 50 |
are linked with other indexes to represent the overall tree structure of logic |
51 |
sessions. |
|
3188 | 52 |
|
7258 | 53 |
Isabelle also generates graph files that represent the theory hierarchy of a |
54 |
logic. There is a graph browser Java applet embedded in the generated HTML |
|
55 |
pages, and also a stand-alone application that allows browsing theory graphs |
|
12464 | 56 |
without having to start a WWW client first. The latter version also includes |
11582 | 57 |
features such as generating Postscript files, which are not available in the |
58 |
applet version. See \S\ref{sec:browse} for further information. |
|
3753 | 59 |
|
7258 | 60 |
\medskip |
61 |
||
12464 | 62 |
The easiest way to let Isabelle generate theory browsing information for |
63 |
existing sessions is to append ``\texttt{-i true}'' to the |
|
64 |
\settdx{ISABELLE_USEDIR_OPTIONS} before invoking \texttt{isatool make} (or |
|
65 |
\texttt{./build} in the distribution). For example, add something like this |
|
66 |
to your Isabelle settings file |
|
3188 | 67 |
\begin{ttbox} |
3753 | 68 |
ISABELLE_USEDIR_OPTIONS="-i true" |
3188 | 69 |
\end{ttbox} |
7258 | 70 |
and then change into the \texttt{src/FOL} directory of the Isabelle |
71 |
distribution and run \texttt{isatool make}, or even \texttt{isatool make all}. |
|
12464 | 72 |
The presentation output will appear in \texttt{\$ISABELLE_BROWSER_INFO/FOL}, |
73 |
which usually refers to \verb,~/isabelle/browser_info/FOL,. Note that option |
|
74 |
\texttt{-v true} will make the internal runs of \texttt{usedir} more explicit |
|
75 |
about such details. |
|
7258 | 76 |
|
12464 | 77 |
Many standard Isabelle sessions (such as \texttt{HOL/ex}) also provide actual |
7882 | 78 |
printable documents. These are prepared automatically as well if enabled like |
79 |
this, using the \texttt{-d} option |
|
7849 | 80 |
\begin{ttbox} |
81 |
ISABELLE_USEDIR_OPTIONS="-i true -d dvi" |
|
82 |
\end{ttbox} |
|
12464 | 83 |
Enabling options \texttt{-i} and \texttt{-d} simultaneausly as shown above |
84 |
causes an appropriate ``document'' link to be included in the HTML index. |
|
85 |
Documents (or raw document sources) may be generated independently of browser |
|
86 |
information as well, see \S\ref{sec:tool-document} for further details. |
|
3753 | 87 |
|
12464 | 88 |
\bigskip The theory browsing information is stored in a sub-directory |
89 |
directory determined by the \settdx{ISABELLE_BROWSER_INFO} setting plus a |
|
90 |
prefix corresponding to the session identifier (according to the tree |
|
91 |
structure of sub-sessions by default). A complete WWW view of all standard |
|
92 |
object-logics and examples of the Isabelle distribution is available at the |
|
93 |
Cambridge or Munich Isabelle sites: |
|
6623 | 94 |
\begin{center}\small |
95 |
\begin{tabular}{l} |
|
96 |
\url{http://www.cl.cam.ac.uk/Research/HVG/Isabelle/library/} \\ |
|
97 |
\url{http://isabelle.in.tum.de/library/} \\ |
|
98 |
\end{tabular} |
|
99 |
\end{center} |
|
100 |
||
12464 | 101 |
\medskip In order to present your own theories on the web, simply copy the |
9209 | 102 |
corresponding subdirectory from \texttt{ISABELLE_BROWSER_INFO} to your WWW |
12464 | 103 |
server, having generated browser info like this: |
7251
35de2117b5dd
Modified section about generation of theory browsing information.
berghofe
parents:
6623
diff
changeset
|
104 |
\begin{ttbox} |
7861 | 105 |
isatool usedir -i true HOL Foo |
7251
35de2117b5dd
Modified section about generation of theory browsing information.
berghofe
parents:
6623
diff
changeset
|
106 |
\end{ttbox} |
7861 | 107 |
This assumes that directory \texttt{Foo} contains some \texttt{ROOT.ML} file |
12464 | 108 |
to load all your theories, and HOL is your parent logic image (\texttt{isatool |
109 |
mkdir} assists in setting up Isabelle session directories, see |
|
110 |
\S\ref{sec:tool-mkdir}). Theory browser information for HOL should have been |
|
111 |
generated already beforehand. Alternatively, one may specify an external link |
|
112 |
to an existing body of HTML data by giving \texttt{usedir} a \texttt{-P} |
|
113 |
option like this: |
|
7258 | 114 |
\begin{ttbox} |
7861 | 115 |
isatool usedir -i true -P http://isabelle.in.tum.de/library/ HOL Foo |
7258 | 116 |
\end{ttbox} |
117 |
||
8363 | 118 |
\medskip For production use, the \texttt{usedir} tool is usually invoked in an |
119 |
appropriate \texttt{IsaMakefile}, via the Isabelle \texttt{make} utility. |
|
120 |
There is a separate \texttt{mkdir} tool to provide easy setup of all this, |
|
121 |
with only minimal manual editing required. |
|
122 |
\begin{ttbox} |
|
12464 | 123 |
isatool mkdir HOL Foo && isatool make |
8363 | 124 |
\end{ttbox} |
125 |
See \S\ref{sec:tool-mkdir} for more information on preparing Isabelle session |
|
126 |
directories, including the setup for documents. |
|
3753 | 127 |
|
7849 | 128 |
|
3753 | 129 |
\section{Browsing theory graphs} \label{sec:browse} |
130 |
\index{theory graph browser|bold} |
|
131 |
||
12464 | 132 |
The Isabelle graph browser is a general tool for visualizing dependency |
133 |
graphs. Certain nodes of the graph (i.e.~theories) can be grouped together in |
|
134 |
``directories'', whose contents may be hidden, thus enabling the user to |
|
135 |
collapse irrelevant portions of information. The browser is written in Java, |
|
136 |
it can be used both as a stand-alone application and as an applet. Note that |
|
137 |
the option \texttt{-g} of \texttt{isatool usedir} (see |
|
138 |
\S\ref{sec:tool-usedir}) creates graph presentations in batch mode for |
|
139 |
inclusion in session documents. |
|
4540 | 140 |
|
3188 | 141 |
|
3753 | 142 |
\subsection{Invoking the graph browser} |
4540 | 143 |
|
144 |
The stand-alone version of the graph browser is wrapped up as an |
|
145 |
Isabelle tool called \tooldx{browser}: |
|
3753 | 146 |
\begin{ttbox} |
9237 | 147 |
Usage: browser [OPTIONS] [GRAPHFILE] |
148 |
||
149 |
Options are: |
|
150 |
-d delete file after use |
|
12583 | 151 |
-o FILE output to FILE (ps, eps, pdf) |
3753 | 152 |
\end{ttbox} |
9209 | 153 |
When no filename is specified, the browser automatically changes to the |
154 |
directory \texttt{ISABELLE_BROWSER_INFO}. |
|
3753 | 155 |
|
13047 | 156 |
\medskip The \texttt{-d} option causes the source file (!)\ to be deleted |
157 |
after the browser terminates; this is mainly intended for detaching |
|
158 |
interactive graph views from a running Isabelle session. |
|
12583 | 159 |
|
160 |
The \texttt{-o} option indicates batch-mode operation, with the output written |
|
161 |
to the indicated file; note that \texttt{pdf} produces an \texttt{eps} copy as |
|
162 |
well. |
|
163 |
||
13047 | 164 |
\medskip The applet version of the browser is part of the standard WWW theory |
165 |
presentation, see the link ``theory dependencies'' within each session index. |
|
4540 | 166 |
|
3188 | 167 |
|
3753 | 168 |
\subsection{Using the graph browser} |
4540 | 169 |
|
170 |
The browser's main window, which is shown in figure |
|
12464 | 171 |
\ref{fig:browserwindow}, consists of two sub-windows: In the left |
7849 | 172 |
sub-window, the directory tree is displayed. The graph itself is |
173 |
displayed in the right sub-window. |
|
174 |
\begin{figure}[ht] |
|
6623 | 175 |
\includegraphics[width=\textwidth]{browser_screenshot} |
12464 | 176 |
\caption{\label{fig:browserwindow} Browser main window} |
3753 | 177 |
\end{figure} |
178 |
||
4540 | 179 |
|
3753 | 180 |
\subsubsection*{The directory tree window} |
4540 | 181 |
|
7882 | 182 |
We describe the usage of the directory browser and the meaning of the |
183 |
different items in the browser window. |
|
3753 | 184 |
\begin{itemize} |
4540 | 185 |
|
186 |
\item A red arrow before a directory name indicates that the directory |
|
187 |
is currently ``folded'', i.e.~the nodes in this directory are |
|
7849 | 188 |
collapsed to one single node. In the right sub-window, the names of |
4540 | 189 |
nodes corresponding to folded directories are enclosed in square |
7849 | 190 |
brackets and displayed in red color. |
4540 | 191 |
|
192 |
\item A green downward arrow before a directory name indicates that |
|
193 |
the directory is currently ``unfolded''. It can be folded by |
|
194 |
clicking on the directory name. Clicking on the name for a second |
|
195 |
time unfolds the directory again. Alternatively, a directory can |
|
196 |
also be unfolded by clicking on the corresponding node in the right |
|
7849 | 197 |
sub-window. |
4540 | 198 |
|
7882 | 199 |
\item Blue arrows stand before ordinary node names. When clicking on such a |
200 |
name (i.e.\ that of a theory), the graph display window focuses to the |
|
201 |
corresponding node. Double clicking invokes a text viewer window in which |
|
202 |
the contents of the theory file are displayed. |
|
4540 | 203 |
|
3753 | 204 |
\end{itemize} |
3188 | 205 |
|
4540 | 206 |
|
3753 | 207 |
\subsubsection*{The graph display window} |
4540 | 208 |
|
209 |
When pointing on an ordinary node, an upward and a downward arrow is |
|
210 |
shown. Initially, both of these arrows are green. Clicking on the |
|
3753 | 211 |
upward or downward arrow collapses all predecessor or successor nodes, |
7849 | 212 |
respectively. The arrow's color then changes to red, indicating that |
3753 | 213 |
the predecessor or successor nodes are currently collapsed. The node |
4540 | 214 |
corresponding to the collapsed nodes has the name ``{\tt [....]}''. To |
215 |
uncollapse the nodes again, simply click on the red arrow or on the |
|
216 |
node with the name ``{\tt [....]}''. Similar to the directory browser, |
|
217 |
the contents of theory files can be displayed by double clicking on |
|
218 |
the corresponding node. |
|
3188 | 219 |
|
4540 | 220 |
|
221 |
\subsubsection*{The ``File'' menu} |
|
222 |
||
4555 | 223 |
Please note that due to Java security restrictions this menu is not |
4540 | 224 |
available in the applet version. The meaning of the menu items is as |
225 |
follows: |
|
3753 | 226 |
\begin{description} |
4540 | 227 |
|
7882 | 228 |
\item[Open \dots] Open a new graph file. |
4540 | 229 |
|
11582 | 230 |
\item[Export to PostScript] Outputs the current graph in Postscript format, |
12464 | 231 |
appropriately scaled to fit on one single sheet of A4 paper. The resulting |
11582 | 232 |
file can be printed directly. |
4540 | 233 |
|
11582 | 234 |
\item[Export to EPS] Outputs the current graph in Encapsulated Postscript |
235 |
format. The resulting file can be included in other documents. |
|
4540 | 236 |
|
3753 | 237 |
\item[Quit] Quit the graph browser. |
4540 | 238 |
|
3753 | 239 |
\end{description} |
240 |
||
4540 | 241 |
|
3753 | 242 |
\subsection*{*Syntax of graph definition files} |
4540 | 243 |
|
3753 | 244 |
A graph definition file has the following syntax: |
245 |
\begin{eqnarray*} |
|
4540 | 246 |
\mbox{\it graph} & = & \{ \: \mbox{\it vertex \tt ;} \: \} ^ + \\ |
247 |
vertex & = & \mbox{\it vertexname} \: \mbox{\it vertexID} \: \mbox{\it dirname} \: [ \mbox{\tt +} ] |
|
248 |
\: \mbox{\it path} \: [ \mbox{\tt <} | \mbox{\tt >} ] \: \{ \: \mbox{\it vertexID} \: \} ^ * |
|
3753 | 249 |
\end{eqnarray*} |
4540 | 250 |
|
3753 | 251 |
The meaning of the items in a vertex description is as follows: |
252 |
\begin{description} |
|
4540 | 253 |
|
3753 | 254 |
\item[vertexname] The name of the vertex. |
4540 | 255 |
|
256 |
\item[vertexID] The vertex identifier. Note that there may be two |
|
257 |
vertices with equal names, whereas identifiers must be unique. |
|
258 |
||
259 |
\item[dirname] The name of the ``directory'' the vertex should be |
|
260 |
placed in. A ``{\tt +}'' sign after {\it dirname} indicates that |
|
261 |
the nodes in the directory are initially visible. Directories are |
|
262 |
initially invisible by default. |
|
263 |
||
264 |
\item[path] The path of the corresponding theory file. This is |
|
265 |
specified relatively to the path of the graph definition file. |
|
266 |
||
267 |
\item[List of successor/predecessor nodes] A ``{\tt <}'' sign before |
|
268 |
the list means that successor nodes are listed, a ``{\tt >}'' sign |
|
269 |
means that predecessor nodes are listed. If neither ``{\tt <}'' nor |
|
270 |
``{\tt >}'' is found, the browser assumes that successor nodes are |
|
271 |
listed. |
|
272 |
||
3753 | 273 |
\end{description} |
5364 | 274 |
|
275 |
||
8363 | 276 |
\section{Creating Isabelle session directories --- \texttt{isatool mkdir}} |
277 |
\label{sec:tool-mkdir} |
|
7849 | 278 |
|
8363 | 279 |
The \tooldx{mkdir} utility prepares Isabelle session source directories, |
11582 | 280 |
including a sensible default setup of \texttt{IsaMakefile}, \texttt{ROOT.ML}, |
281 |
and a \texttt{document} directory with a minimal \texttt{root.tex} that is |
|
13047 | 282 |
sufficient to print all theories of the session (in the order of appearance); |
283 |
see \S\ref{sec:tool-document} for further information on Isabelle document |
|
12464 | 284 |
preparation. The usage of \texttt{isatool mkdir} is: |
8363 | 285 |
\begin{ttbox} |
9237 | 286 |
Usage: mkdir [OPTIONS] [LOGIC] NAME |
8363 | 287 |
|
288 |
Options are: |
|
289 |
-I FILE alternative IsaMakefile output |
|
290 |
-P include parent logic target |
|
291 |
-b setup build mode (session outputs heap image) |
|
11582 | 292 |
-q quiet mode |
8363 | 293 |
|
11582 | 294 |
Prepare session directory, including IsaMakefile and document source, |
8363 | 295 |
with parent LOGIC (default ISABELLE_LOGIC=\$ISABELLE_LOGIC) |
296 |
\end{ttbox} |
|
297 |
||
298 |
The \texttt{mkdir} tool is conservative in the sense that any existing |
|
299 |
\texttt{IsaMakefile} etc.\ is left unchanged. Thus it is safe to invoke it |
|
12464 | 300 |
multiple times, although later runs may not have the desired effect. |
8363 | 301 |
|
302 |
Note that \texttt{mkdir} is unable to change \texttt{IsaMakefile} |
|
303 |
incrementally --- manual changes are required for multiple sub-sessions. On |
|
304 |
order to get an initial working session, the only editing needed is to add |
|
305 |
appropriate \texttt{use_thy} calls to the generated \texttt{ROOT.ML} file. |
|
306 |
||
307 |
||
308 |
\subsection*{Options} |
|
309 |
||
310 |
The \texttt{-I} option specifies an alternative to \texttt{IsaMakefile} for |
|
311 |
dependencies. Note that ``\texttt{-}'' refers to \emph{stdout}, i.e.\ |
|
312 |
``\texttt{-I-}'' provides an easy way to peek at \texttt{mkdir}'s idea of |
|
313 |
\texttt{make} setup required for some particular of Isabelle session. |
|
314 |
||
315 |
\medskip The \texttt{-P} option includes a target for the parent |
|
316 |
\texttt{LOGIC} session in the generated \texttt{IsaMakefile}. The |
|
317 |
corresponding sources are assumed to be located within the Isabelle |
|
318 |
distribution. |
|
319 |
||
320 |
\medskip The \texttt{-b} option sets up the current directory as the base for |
|
321 |
a new session that provides an actual logic image, as opposed to one that only |
|
322 |
runs several theories based on an existing image. Note that in the latter |
|
323 |
case, everything except \texttt{IsaMakefile} would be placed into a separate |
|
324 |
directory \texttt{NAME}, rather than the current one. See |
|
325 |
\S\ref{sec:tool-usedir} for further information on \emph{build mode} vs.\ |
|
326 |
\emph{example mode} of the \texttt{usedir} utility. |
|
327 |
||
11582 | 328 |
\medskip The \texttt{-q} enables quiet mode, suppressing further notes on how |
329 |
to proceed. |
|
8363 | 330 |
|
331 |
||
332 |
\subsection*{Examples} |
|
333 |
||
334 |
The standard setup of a single ``example session'' based on the default logic, |
|
335 |
with proper document generation is generated like this: |
|
336 |
\begin{ttbox} |
|
12464 | 337 |
isatool mkdir Foo && isatool make |
8363 | 338 |
\end{ttbox} |
339 |
\noindent The theory sources should be put into the \texttt{Foo} directory, and its |
|
340 |
\texttt{ROOT.ML} should be edited to load all required theories. Invoking |
|
12464 | 341 |
\texttt{isatool make} again would run the whole session, generating browser |
8363 | 342 |
information and the document automatically. The \texttt{IsaMakefile} is |
13047 | 343 |
typically tuned manually later, e.g.\ adding source dependencies, or changing |
344 |
the options passed to \texttt{usedir}. |
|
8363 | 345 |
|
12464 | 346 |
\medskip Large projects may demand further sessions, potentially with separate |
347 |
logic images being created. This usually requires manual editing of the |
|
348 |
generated \texttt{IsaMakefile}, which is meant to cover all of the sub-session |
|
349 |
directories at the same time (this is the deeper reasong why |
|
350 |
\texttt{IsaMakefile} is not made part of the initial session directory created |
|
351 |
by \texttt{isatool mkdir}). See \texttt{src/HOL/IsaMakefile} of the Isabelle |
|
352 |
distribution for a full-blown example. |
|
353 |
||
8363 | 354 |
|
355 |
\section{Running Isabelle sessions --- \texttt{isatool usedir}} \label{sec:tool-usedir} |
|
7849 | 356 |
|
357 |
The \tooldx{usedir} utility builds object-logic images, or runs example |
|
358 |
sessions based on existing logics. Its usage is: |
|
359 |
\begin{ttbox} |
|
11582 | 360 |
|
9237 | 361 |
Usage: usedir [OPTIONS] LOGIC NAME |
7849 | 362 |
|
363 |
Options are: |
|
8363 | 364 |
-D PATH dump generated document sources into PATH |
7849 | 365 |
-P PATH set path for remote theory browsing information |
366 |
-b build mode (output heap image, using current dir) |
|
8363 | 367 |
-c BOOL tell ML system to compress output image (default true) |
7849 | 368 |
-d FORMAT build document as FORMAT (default false) |
12464 | 369 |
-g BOOL generate session graph image for document (default false) |
10564 | 370 |
-i BOOL generate theory browser information (default false) |
371 |
-m MODE add print mode for output |
|
11582 | 372 |
-p LEVEL set level of detail for proof objects |
7849 | 373 |
-r reset session path |
374 |
-s NAME override session NAME |
|
11582 | 375 |
-v BOOL be verbose (default false) |
7849 | 376 |
|
377 |
Build object-logic or run examples. Also creates browsing |
|
378 |
information (HTML etc.) according to settings. |
|
379 |
||
380 |
ISABELLE_USEDIR_OPTIONS= |
|
381 |
\end{ttbox} |
|
382 |
||
383 |
Note that the value of the \settdx{ISABELLE_USEDIR_OPTIONS} setting is |
|
384 |
implicitly prefixed to \emph{any} \texttt{usedir} call. Since the |
|
385 |
\ttindex{IsaMakefile}s of all object-logics distributed with Isabelle just |
|
386 |
invoke \texttt{usedir} for the real work, one may control compilation options |
|
387 |
globally via above variable. In particular, generation of \rmindex{HTML} |
|
7882 | 388 |
browsing information and document preparation is controlled here. |
7849 | 389 |
|
390 |
||
391 |
\subsection*{Options} |
|
392 |
||
7882 | 393 |
Basically, there are two different modes of operation: \emph{build mode} |
394 |
(enabled through the \texttt{-b} option) and \emph{example mode} (default). |
|
7849 | 395 |
|
396 |
Calling \texttt{usedir} with \texttt{-b} runs \texttt{isabelle} with input |
|
397 |
image \texttt{LOGIC} and output to \texttt{NAME}, as provided on the command |
|
398 |
line. This will be a batch session, running \texttt{ROOT.ML} from the current |
|
399 |
directory and then quitting. It is assumed that \texttt{ROOT.ML} contains all |
|
7883 | 400 |
{\ML} commands required to build the logic. |
7849 | 401 |
|
402 |
In example mode, \texttt{usedir} runs a read-only session of \texttt{LOGIC} |
|
7882 | 403 |
and automatically runs \texttt{ROOT.ML} from within directory \texttt{NAME}. |
404 |
It assumes that this file contains appropriate {\ML} commands to run the |
|
405 |
desired examples. |
|
7849 | 406 |
|
7882 | 407 |
\medskip The \texttt{-i} option controls theory browser data generation. It |
408 |
may be explicitly turned on or off --- as usual, the last occurrence of |
|
10564 | 409 |
\texttt{-i} on the command line wins. |
410 |
||
411 |
The \texttt{-P} option specifies a path (or actual URL) to be prefixed to any |
|
412 |
\emph{non-local} reference of existing theories. Thus user sessions may |
|
413 |
easily link to existing Isabelle libraries already present on the WWW. |
|
414 |
||
415 |
The \texttt{-m} options specifies additional print modes to be activated |
|
416 |
temporarily while the session is processed. |
|
7849 | 417 |
|
418 |
\medskip The \texttt{-d} option controls document preparation. Valid |
|
7882 | 419 |
arguments are \texttt{false} (do not prepare any document; this is default), |
420 |
or any of \texttt{dvi}, \texttt{dvi.gz}, \texttt{ps}, \texttt{ps.gz}, |
|
7849 | 421 |
\texttt{pdf}. The logic session has to provide a properly setup |
422 |
\texttt{document} directory. See \S\ref{sec:tool-document} and |
|
423 |
\S\ref{sec:tool-latex} for more details. |
|
424 |
||
12464 | 425 |
The \texttt{-g} option produces images of the theory dependency graph (cf.\ |
426 |
\S\ref{sec:browse}) for inclusion in the generated document, both as |
|
427 |
\texttt{session_graph.eps} and \texttt{session_graph.pdf} at the same time. |
|
13047 | 428 |
To include this in the final {\LaTeX} document one could say |
429 |
\verb,\includegraphics{session_graph}, in \texttt{document/root.tex} (omitting |
|
430 |
the file-name extension enables {\LaTeX} to select to correct version, either |
|
431 |
for the DVI or PDF output path). |
|
12464 | 432 |
|
13018
5164177cf0a6
isatool usedir -D generated Foo && isatool document Foo/generated;
wenzelm
parents:
12689
diff
changeset
|
433 |
\medskip The \texttt{-D} option causes the generated document sources |
5164177cf0a6
isatool usedir -D generated Foo && isatool document Foo/generated;
wenzelm
parents:
12689
diff
changeset
|
434 |
(including the user's template of \texttt{document/root.tex} etc.) to be |
5164177cf0a6
isatool usedir -D generated Foo && isatool document Foo/generated;
wenzelm
parents:
12689
diff
changeset
|
435 |
dumped at location \texttt{PATH}; this path is relative to the session's main |
5164177cf0a6
isatool usedir -D generated Foo && isatool document Foo/generated;
wenzelm
parents:
12689
diff
changeset
|
436 |
directory. For example, \texttt{isatool usedir -D generated HOL Foo} will |
5164177cf0a6
isatool usedir -D generated Foo && isatool document Foo/generated;
wenzelm
parents:
12689
diff
changeset
|
437 |
produces a complete set of document sources at \texttt{Foo/generated}. |
5164177cf0a6
isatool usedir -D generated Foo && isatool document Foo/generated;
wenzelm
parents:
12689
diff
changeset
|
438 |
Subsequent invocation of \texttt{isatool document Foo/generated} (see also |
5164177cf0a6
isatool usedir -D generated Foo && isatool document Foo/generated;
wenzelm
parents:
12689
diff
changeset
|
439 |
\S\ref{sec:tool-document}) will process the final result independently of an |
5164177cf0a6
isatool usedir -D generated Foo && isatool document Foo/generated;
wenzelm
parents:
12689
diff
changeset
|
440 |
Isabelle job. This decoupled mode of operation facilitates debugging of |
5164177cf0a6
isatool usedir -D generated Foo && isatool document Foo/generated;
wenzelm
parents:
12689
diff
changeset
|
441 |
serious {\LaTeX} errors, for example. |
8363 | 442 |
|
11582 | 443 |
\medskip The \texttt{-p} option determines the level of detail for internal |
444 |
proof objects, see also the \emph{Isabelle Reference |
|
445 |
Manual}~\cite{isabelle-ref}. |
|
446 |
||
447 |
\medskip The \texttt{-v} option causes additional information to be printed |
|
13047 | 448 |
while running the session, notably the location of prepared documents. |
11582 | 449 |
|
7849 | 450 |
\medskip Any \texttt{usedir} session is named by some \emph{session |
7882 | 451 |
identifier}. These accumulate, documenting the way sessions depend on |
452 |
others. For example, consider \texttt{Pure/FOL/ex}, which refers to the |
|
9695 | 453 |
examples of FOL, which in turn is built upon Pure. |
7849 | 454 |
|
7882 | 455 |
The current session's identifier is by default just the base name of the |
456 |
\texttt{LOGIC} argument (in build mode), or of the \texttt{NAME} argument (in |
|
457 |
example mode). This may be overridden explicitly via the \texttt{-s} option. |
|
7849 | 458 |
|
459 |
||
460 |
\subsection*{Examples} |
|
461 |
||
462 |
Refer to the \texttt{IsaMakefile}s of the Isabelle distribution's |
|
463 |
object-logics as a model for your own developments. For example, see |
|
8363 | 464 |
\texttt{src/FOL/IsaMakefile}. The Isabelle \texttt{mkdir} tool (see |
465 |
\S\ref{sec:tool-mkdir}) creates \texttt{IsaMakefile}s with proper invocation |
|
466 |
of \texttt{usedir} as well. |
|
467 |
||
12464 | 468 |
|
469 |
\section{Preparing Isabelle session documents --- \texttt{isatool document}} |
|
470 |
\label{sec:tool-document} |
|
471 |
||
472 |
The \tooldx{document} utility prepares logic session documents, processing the |
|
473 |
sources both as provided by the user and generated by Isabelle. Its usage is: |
|
474 |
\begin{ttbox} |
|
475 |
Usage: document [OPTIONS] [DIR] |
|
476 |
||
477 |
Options are: |
|
478 |
-c cleanup -- be aggressive in removing old stuff |
|
479 |
-o FORMAT specify output format: dvi (default), dvi.gz, ps, |
|
480 |
ps.gz, pdf |
|
481 |
||
482 |
Prepare the theory session document in DIR (default 'document') |
|
483 |
producing the specified output format. |
|
484 |
\end{ttbox} |
|
485 |
This tool is usually run automatically as part of the corresponding Isabelle |
|
486 |
batch process, provided document preparation has been enabled (cf.\ the |
|
487 |
\texttt{-d} option of the \texttt{usedir} utility, \S\ref{sec:tool-usedir}). |
|
488 |
It may be manually invoked on the generated browser information document |
|
489 |
output as well, e.g.\ in case of errors encountered in the batch run. |
|
490 |
||
491 |
\medskip Document preparation requires a properly setup ``\texttt{document}'' |
|
492 |
directory within the logic session sources. This directory is supposed to |
|
493 |
contain all the files needed to produce the final document --- apart from the |
|
494 |
actual theories which are generated by Isabelle. |
|
495 |
||
496 |
\medskip For most practical purposes, the \texttt{document} tool is smart |
|
497 |
enough to create any of the specified output formats, taking \texttt{root.tex} |
|
498 |
supplied by the user as a starting point. This even includes multiple runs of |
|
499 |
{\LaTeX} to accommodate references and bibliographies (the latter assumes |
|
500 |
\texttt{root.bib} within the same directory). |
|
501 |
||
502 |
In more complex situations, a separate \texttt{IsaMakefile} for the document |
|
503 |
sources may be given instead. This should provide targets for any admissible |
|
504 |
document format; these have to produce corresponding output files named after |
|
505 |
\texttt{root} as well, e.g.\ \texttt{root.dvi} for target format \texttt{dvi}. |
|
506 |
||
507 |
\medskip When running the session, Isabelle copies the original |
|
508 |
\texttt{document} directory into its proper place within |
|
509 |
\texttt{ISABELLE_BROWSER_INFO} according to the session path. Then, for any |
|
510 |
processed theory $A$ some {\LaTeX} source is generated and put there as |
|
511 |
$A$\texttt{.tex}. Furthermore, a list of all generated theory files is put |
|
512 |
into \texttt{session.tex}. Typically, the root {\LaTeX} file provided by the |
|
513 |
user would include \texttt{session.tex} to get a document containing all the |
|
514 |
theories. |
|
515 |
||
516 |
The {\LaTeX} versions of the theories require some macros defined in |
|
517 |
\texttt{isabelle.sty} as distributed with Isabelle. Doing |
|
13047 | 518 |
\verb,\usepackage{isabelle}, in \texttt{root.tex} should be fine; the |
519 |
underlying Isabelle \texttt{latex} utility already includes an appropriate |
|
12464 | 520 |
{\TeX} inputs path. |
521 |
||
522 |
If the text contains any references to Isabelle symbols (such as |
|
523 |
\verb,\<forall>,) then \texttt{isabellesym.sty} should be included as well. |
|
524 |
This package contains a standard set of {\LaTeX} macro definitions |
|
525 |
\verb,\isasym,$foo$ corresponding to \verb,\<,$foo$\verb,>, (see |
|
526 |
Appendix~\ref{app:symbols} for a complete list of predefined Isabelle |
|
527 |
symbols). Users may invent further symbols as well, just by providing |
|
528 |
{\LaTeX} macros in a similar fashion as in \texttt{isabellesym.sty} of the |
|
529 |
distribution. |
|
530 |
||
531 |
For proper setup of PDF documents (with hyperlinks, bookmarks, and thumbnail |
|
532 |
images), we recommend to include \verb,pdfsetup.sty, as well. It is safe to |
|
533 |
do so even without using PDF~\LaTeX. |
|
534 |
||
535 |
\medskip As a final step of document preparation within Isabelle, |
|
536 |
\texttt{isatool document -c} is run on the resulting \texttt{document} |
|
537 |
directory. Thus the actual output document is built and installed in its |
|
538 |
proper place (as linked by the session's \texttt{index.html} if option |
|
539 |
\texttt{-i} of \texttt{usedir} has been enabled, cf.\ \S\ref{sec:info}). The |
|
540 |
generated sources are deleted after successful run of {\LaTeX} and friends. |
|
541 |
Note that a separate copy of the sources may be retained by passing an option |
|
542 |
\texttt{-D} to the \texttt{usedir} utility when running the session (see also |
|
543 |
\S\ref{sec:tool-usedir}). |
|
544 |
||
545 |
||
546 |
\section{Running {\LaTeX} within the Isabelle environment --- \texttt{isatool latex}} |
|
547 |
\label{sec:tool-latex} |
|
548 |
||
549 |
The \tooldx{latex} utility provides the basic interface for Isabelle document |
|
550 |
preparation. Its usage is: |
|
551 |
\begin{ttbox} |
|
552 |
Usage: latex [OPTIONS] [FILE] |
|
553 |
||
554 |
Options are: |
|
555 |
-o FORMAT specify output format: dvi (default), dvi.gz, ps, |
|
556 |
ps.gz, pdf, bbl, png, sty |
|
557 |
||
558 |
Run LaTeX (and related tools) on FILE (default root.tex), |
|
559 |
producing the specified output format. |
|
560 |
\end{ttbox} |
|
561 |
Appropriate {\LaTeX}-related programs are run on the input file, according to |
|
562 |
the given output format: \texttt{latex}, \texttt{pdflatex}, \texttt{dvips}, |
|
563 |
\texttt{bibtex} (for \texttt{bbl}), and \texttt{thumbpdf} (for \texttt{png}). |
|
564 |
The actual commands are determined from the settings environment |
|
565 |
(\texttt{ISABELLE_LATEX} etc., see \S\ref{sec:settings}). |
|
566 |
||
567 |
The \texttt{sty} output format causes the Isabelle style files to be updated |
|
568 |
from the distribution. This is useful in special situations where the |
|
569 |
document sources are to be processed another time by separate tools (cf.\ |
|
570 |
option \texttt{-D} of the \texttt{usedir} utility, see |
|
571 |
\S\ref{sec:tool-usedir}). |
|
572 |
||
573 |
||
574 |
\subsubsection*{Examples} |
|
575 |
||
576 |
Invoking \texttt{isatool latex} by hand may be occasionally useful when |
|
577 |
debugging failed attempts of the automatic document preparation stage of |
|
578 |
batch-mode Isabelle. The abortive process leaves the sources at a certain |
|
579 |
place within \texttt{ISABELLE_BROWSER_INFO}, see the runtime error message for |
|
580 |
details. This enables users to inspect {\LaTeX} runs in further detail, e.g.\ |
|
581 |
like this: |
|
582 |
||
583 |
\begin{ttbox} |
|
584 |
cd ~/isabelle/browser_info/HOL/Test/document |
|
585 |
isatool latex -o pdf |
|
586 |
\end{ttbox} |
|
587 |
||
588 |
||
5364 | 589 |
%%% Local Variables: |
590 |
%%% mode: latex |
|
591 |
%%% TeX-master: "system" |
|
592 |
%%% End: |