author | berghofe |
Thu, 14 Oct 1999 17:40:22 +0200 | |
changeset 7870 | 7941ce81cb30 |
parent 7868 | 0cb6508f190c |
child 7882 | 52fb3667f7df |
permissions | -rw-r--r-- |
4540 | 1 |
|
3753 | 2 |
%% $Id$ |
3188 | 3 |
|
4 |
\chapter{Presenting theories} |
|
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 |
|
9 |
structure of sessions is that of a tree, with Isabelle \texttt{Pure} at its |
|
10 |
root, further derived object-logics (e.g.\ \texttt{HOLCF} from \texttt{HOL}, |
|
11 |
and \texttt{HOL} from \texttt{Pure}), and application sessions at its leaves. |
|
12 |
The latter usually do not have a separate {\ML} image. |
|
13 |
||
14 |
The \texttt{usedir} utility (see \S\ref{sec:tool-usedir}) provides the prime |
|
15 |
means for managing Isabelle sessions, including proper setup for presentation. |
|
16 |
||
17 |
||
3753 | 18 |
\section{Generating theory browsing information} \label{sec:info} |
4540 | 19 |
\index{theory browsing information|bold} |
3188 | 20 |
|
7849 | 21 |
As a side-effect of running a logic sessions, Isabelle is able to generate |
22 |
theory browsing information, including HTML documents that show a theory's |
|
23 |
definition, the theorems proved in its ML file and the relationship with its |
|
24 |
ancestors and descendants. Besides the HTML file that is generated for every |
|
25 |
theory, Isabelle stores links to all theories in an index file. These indexes |
|
26 |
are linked with other indexes to represent the tree structure of Isabelle's |
|
27 |
logics. |
|
3188 | 28 |
|
7258 | 29 |
Isabelle also generates graph files that represent the theory hierarchy of a |
30 |
logic. There is a graph browser Java applet embedded in the generated HTML |
|
31 |
pages, and also a stand-alone application that allows browsing theory graphs |
|
32 |
without having to start a WWW browser first. The latter version also includes |
|
33 |
features such as generating {\sc PostScript} files, which are not available in |
|
34 |
the applet version. See \S\ref{sec:browse} for further information. |
|
3753 | 35 |
|
7258 | 36 |
\medskip |
37 |
||
7849 | 38 |
In order to let Isabelle generate theory browsing information for logics that |
39 |
are part of the Isabelle distribution, simply append ``\texttt{-i true}'' to |
|
40 |
the \settdx{ISABELLE_USEDIR_OPTIONS} setting before making a logic. For |
|
41 |
example, in order to do this for {\FOL}, add something like this to your |
|
42 |
Isabelle settings file |
|
3188 | 43 |
\begin{ttbox} |
3753 | 44 |
ISABELLE_USEDIR_OPTIONS="-i true" |
3188 | 45 |
\end{ttbox} |
7258 | 46 |
and then change into the \texttt{src/FOL} directory of the Isabelle |
47 |
distribution and run \texttt{isatool make}, or even \texttt{isatool make all}. |
|
48 |
||
7849 | 49 |
Some sessions (such as \texttt{HOL/Isar_examples}) even provide actual |
50 |
printable documents. These are prepared automatically as well if enabled by |
|
51 |
giving an appropriate \texttt{-d} option, e.g.\ |
|
52 |
\begin{ttbox} |
|
53 |
ISABELLE_USEDIR_OPTIONS="-i true -d dvi" |
|
54 |
\end{ttbox} |
|
55 |
See \S\ref{sec:tool-document} for further information on Isabelle document |
|
56 |
preparation. |
|
3753 | 57 |
|
7849 | 58 |
\bigskip The theory browsing information is stored within the directory |
59 |
determined by the \settdx{ISABELLE_BROWSER_INFO} setting. The |
|
60 |
\texttt{index.html} file located there provides an entry point to all standard |
|
61 |
Isabelle logics. A complete HTML version of all object-logics and examples of |
|
62 |
the Isabelle distribution is available at |
|
6623 | 63 |
\begin{center}\small |
64 |
\begin{tabular}{l} |
|
65 |
\url{http://www.cl.cam.ac.uk/Research/HVG/Isabelle/library/} \\ |
|
66 |
\url{http://isabelle.in.tum.de/library/} \\ |
|
67 |
\end{tabular} |
|
68 |
\end{center} |
|
69 |
||
7258 | 70 |
\medskip |
3188 | 71 |
|
7258 | 72 |
The generated HTML document of any theory includes all theorems proved in the |
73 |
corresponding {\ML} file, provided these have been stored properly via |
|
7849 | 74 |
\ttindex{qed}, \ttindex{qed_goal}, \ttindex{qed_goalw}, \ttindex{bind_thm}, |
75 |
\ttindex{bind_thms} or \ttindex{store_thm}. Section headings may be included |
|
76 |
in the presentation via the {\ML} function |
|
7258 | 77 |
\begin{ttbox}\index{*section} |
3188 | 78 |
section: string -> unit |
79 |
\end{ttbox} |
|
80 |
||
7258 | 81 |
\medskip |
3188 | 82 |
|
7258 | 83 |
In order to present your own theories on the web, simply copy the whole |
84 |
\texttt{ISABELLE_BROWSER_INFO} directory to your WWW server, after generating |
|
85 |
browser info like this: |
|
7251
35de2117b5dd
Modified section about generation of theory browsing information.
berghofe
parents:
6623
diff
changeset
|
86 |
\begin{ttbox} |
7861 | 87 |
isatool usedir -i true HOL Foo |
7251
35de2117b5dd
Modified section about generation of theory browsing information.
berghofe
parents:
6623
diff
changeset
|
88 |
\end{ttbox} |
7861 | 89 |
This assumes that directory \texttt{Foo} contains some \texttt{ROOT.ML} file |
90 |
to load all your theories, and {\HOL} is your parent logic image. Ideally, |
|
91 |
theory browser information would have been generated for {\HOL} already. |
|
7258 | 92 |
|
93 |
Alternatively, one may specify an external link to an existing body of HTML |
|
94 |
data by giving \texttt{usedir} a \texttt{-P} option like this: |
|
95 |
\begin{ttbox} |
|
7861 | 96 |
isatool usedir -i true -P http://isabelle.in.tum.de/library/ HOL Foo |
7258 | 97 |
\end{ttbox} |
98 |
||
3753 | 99 |
|
7849 | 100 |
|
3753 | 101 |
\section{Browsing theory graphs} \label{sec:browse} |
102 |
\index{theory graph browser|bold} |
|
103 |
||
4540 | 104 |
The graph browser is a tool for visualizing dependency graphs of |
105 |
Isabelle theories. Certain nodes of the graph (i.e.~theories) can be |
|
106 |
grouped together in ``directories'', whose contents may be hidden, |
|
107 |
thus enabling the user to filter out irrelevant information. The |
|
108 |
browser is written in Java, it can be used both as a stand-alone |
|
109 |
application and as an applet. |
|
110 |
||
3188 | 111 |
|
3753 | 112 |
\subsection{Invoking the graph browser} |
4540 | 113 |
|
114 |
The stand-alone version of the graph browser is wrapped up as an |
|
115 |
Isabelle tool called \tooldx{browser}: |
|
3753 | 116 |
\begin{ttbox} |
4540 | 117 |
Usage: browser [GRAPHFILE] |
3753 | 118 |
\end{ttbox} |
4540 | 119 |
When no filename is specified, the browser automatically changes to |
120 |
the directory \texttt{ISABELLE_BROWSER_INFO/graph/data}. |
|
3753 | 121 |
|
7849 | 122 |
\medskip The applet version of the browser can be invoked by opening the {\tt |
123 |
index.html} file in the directory \texttt{ISABELLE_BROWSER_INFO} from your |
|
124 |
Web browser and selecting ``version for Java capable browsers''. There is |
|
125 |
also a link to the corresponding theory graph in every logic's {\tt |
|
126 |
index.html} file. |
|
4540 | 127 |
|
3188 | 128 |
|
3753 | 129 |
\subsection{Using the graph browser} |
4540 | 130 |
|
131 |
The browser's main window, which is shown in figure |
|
7849 | 132 |
\ref{browserwindow}, consists of two sub-windows: In the left |
133 |
sub-window, the directory tree is displayed. The graph itself is |
|
134 |
displayed in the right sub-window. |
|
135 |
\begin{figure}[ht] |
|
6623 | 136 |
\includegraphics[width=\textwidth]{browser_screenshot} |
4540 | 137 |
\caption{\label{browserwindow} Browser main window} |
3753 | 138 |
\end{figure} |
139 |
||
4540 | 140 |
|
3753 | 141 |
\subsubsection*{The directory tree window} |
4540 | 142 |
|
3753 | 143 |
This section describes the usage of the directory browser and the |
144 |
meaning of the different items in the browser window. |
|
145 |
\begin{itemize} |
|
4540 | 146 |
|
147 |
\item A red arrow before a directory name indicates that the directory |
|
148 |
is currently ``folded'', i.e.~the nodes in this directory are |
|
7849 | 149 |
collapsed to one single node. In the right sub-window, the names of |
4540 | 150 |
nodes corresponding to folded directories are enclosed in square |
7849 | 151 |
brackets and displayed in red color. |
4540 | 152 |
|
153 |
\item A green downward arrow before a directory name indicates that |
|
154 |
the directory is currently ``unfolded''. It can be folded by |
|
155 |
clicking on the directory name. Clicking on the name for a second |
|
156 |
time unfolds the directory again. Alternatively, a directory can |
|
157 |
also be unfolded by clicking on the corresponding node in the right |
|
7849 | 158 |
sub-window. |
4540 | 159 |
|
3753 | 160 |
\item Blue arrows stand before ordinary node (i.e.~theory) names. When |
4540 | 161 |
clicking on such a name, the graph display window focuses to the |
162 |
corresponding node. Double clicking invokes a text viewer window in |
|
163 |
which the contents of the theory file are displayed. |
|
164 |
||
3753 | 165 |
\end{itemize} |
3188 | 166 |
|
4540 | 167 |
|
3753 | 168 |
\subsubsection*{The graph display window} |
4540 | 169 |
|
170 |
When pointing on an ordinary node, an upward and a downward arrow is |
|
171 |
shown. Initially, both of these arrows are green. Clicking on the |
|
3753 | 172 |
upward or downward arrow collapses all predecessor or successor nodes, |
7849 | 173 |
respectively. The arrow's color then changes to red, indicating that |
3753 | 174 |
the predecessor or successor nodes are currently collapsed. The node |
4540 | 175 |
corresponding to the collapsed nodes has the name ``{\tt [....]}''. To |
176 |
uncollapse the nodes again, simply click on the red arrow or on the |
|
177 |
node with the name ``{\tt [....]}''. Similar to the directory browser, |
|
178 |
the contents of theory files can be displayed by double clicking on |
|
179 |
the corresponding node. |
|
3188 | 180 |
|
4540 | 181 |
|
182 |
\subsubsection*{The ``File'' menu} |
|
183 |
||
4555 | 184 |
Please note that due to Java security restrictions this menu is not |
4540 | 185 |
available in the applet version. The meaning of the menu items is as |
186 |
follows: |
|
3753 | 187 |
\begin{description} |
4540 | 188 |
|
3753 | 189 |
\item[Open$\ldots$] Open a new graph file. |
4540 | 190 |
|
191 |
\item[Export to PostScript] Outputs the current graph in {\sc |
|
192 |
PostScript} format, appropriately scaled to fit on one single |
|
7870 | 193 |
sheet of paper. The resulting file can be printed directly. |
4540 | 194 |
|
195 |
\item[Export to EPS] Outputs the current graph in Encapsulated {\sc |
|
196 |
PostScript} format. The resulting file can be included in other |
|
197 |
documents. |
|
198 |
||
3753 | 199 |
\item[Quit] Quit the graph browser. |
4540 | 200 |
|
3753 | 201 |
\end{description} |
202 |
||
4540 | 203 |
|
3753 | 204 |
\subsection*{*Syntax of graph definition files} |
4540 | 205 |
|
3753 | 206 |
A graph definition file has the following syntax: |
207 |
\begin{eqnarray*} |
|
4540 | 208 |
\mbox{\it graph} & = & \{ \: \mbox{\it vertex \tt ;} \: \} ^ + \\ |
209 |
vertex & = & \mbox{\it vertexname} \: \mbox{\it vertexID} \: \mbox{\it dirname} \: [ \mbox{\tt +} ] |
|
210 |
\: \mbox{\it path} \: [ \mbox{\tt <} | \mbox{\tt >} ] \: \{ \: \mbox{\it vertexID} \: \} ^ * |
|
3753 | 211 |
\end{eqnarray*} |
4540 | 212 |
|
3753 | 213 |
The meaning of the items in a vertex description is as follows: |
214 |
\begin{description} |
|
4540 | 215 |
|
3753 | 216 |
\item[vertexname] The name of the vertex. |
4540 | 217 |
|
218 |
\item[vertexID] The vertex identifier. Note that there may be two |
|
219 |
vertices with equal names, whereas identifiers must be unique. |
|
220 |
||
221 |
\item[dirname] The name of the ``directory'' the vertex should be |
|
222 |
placed in. A ``{\tt +}'' sign after {\it dirname} indicates that |
|
223 |
the nodes in the directory are initially visible. Directories are |
|
224 |
initially invisible by default. |
|
225 |
||
226 |
\item[path] The path of the corresponding theory file. This is |
|
227 |
specified relatively to the path of the graph definition file. |
|
228 |
||
229 |
\item[List of successor/predecessor nodes] A ``{\tt <}'' sign before |
|
230 |
the list means that successor nodes are listed, a ``{\tt >}'' sign |
|
231 |
means that predecessor nodes are listed. If neither ``{\tt <}'' nor |
|
232 |
``{\tt >}'' is found, the browser assumes that successor nodes are |
|
233 |
listed. |
|
234 |
||
3753 | 235 |
\end{description} |
5364 | 236 |
|
237 |
||
7849 | 238 |
\section{Preparing Isabelle session documents --- \texttt{isatool document}} |
239 |
\label{sec:tool-document} |
|
240 |
||
241 |
The \tooldx{document} utility prepares logic session documents, processing the |
|
7861 | 242 |
sources both provided by the user and generated by Isabelle. Its usage is: |
7849 | 243 |
\begin{ttbox} |
244 |
Usage: document [OPTIONS] [DIR] |
|
245 |
||
246 |
Options are: |
|
247 |
-o FORMAT specify output format: dvi (default), dvi.gz, ps, |
|
248 |
ps.gz, pdf |
|
249 |
||
250 |
Prepare the theory session document in DIR (default '.') |
|
251 |
producing the specified output format. |
|
252 |
\end{ttbox} |
|
253 |
This tool is usually run automatically as part of the corresponding session, |
|
254 |
provided document preparation is enabled (cf.\ the \texttt{-d} option of the |
|
255 |
\texttt{usedir} utility, \S\ref{sec:tool-usedir}). It may be manually invoked |
|
256 |
on the generated browser information document output as well. |
|
257 |
||
258 |
\medskip Document preparation requires a properly setup ``\texttt{document}'' |
|
259 |
directory within the logic session sources. This directory is supposed to |
|
260 |
contain all the files needed to produce the actual document, apart from the |
|
261 |
actual theories as generated by Isabelle. |
|
262 |
||
263 |
\medskip For simple documents, the \texttt{document} tool is smart enough to |
|
264 |
create any of the output formats, taking \texttt{root.tex} supplied by the |
|
265 |
user as a starting point. This even includes multiple runs of {\LaTeX} to |
|
266 |
accommodate references and bibliographies (the latter assumes |
|
267 |
\texttt{root.bib} within the same directory). |
|
268 |
||
269 |
For complex documents, a separate \texttt{IsaMakefile} may be given instead. |
|
270 |
It should provide targets for any admissible document format; these have to |
|
271 |
produce corresponding output files named after \texttt{root} as well, e.g.\ |
|
272 |
\texttt{root.dvi} for target format \texttt{dvi}. |
|
273 |
||
274 |
\medskip When running the session, Isabelle copies the original |
|
275 |
\texttt{document} directory into its proper place within |
|
276 |
\texttt{ISABELLE_BROWSER_INFO} according to the session path. Then, for any |
|
277 |
processed theory $A$ some {\LaTeX} source is generated and put there as |
|
278 |
$A$\texttt{.tex}. Furthermore, a list of all generated theory files is put |
|
279 |
into \texttt{session.tex}. Typically, the root {\LaTeX} file provided by the |
|
280 |
user would include \texttt{session.tex} to get a document containing all the |
|
281 |
theories. |
|
282 |
||
283 |
The {\LaTeX} versions of the theories require some macros defined in |
|
284 |
\texttt{isabelle.sty} as distributed with Isabelle. Doing |
|
285 |
\verb,\usepackage{isabelle}, somewhere in \texttt{root.tex} should work fine; |
|
286 |
the underlying Isabelle \texttt{latex} utility already includes an appropriate |
|
287 |
{\TeX} inputs path. For proper setup of hyperlinks and bookmarks in PDF |
|
288 |
documents we recommend to include \verb,pdfsetup.sty, as well.\footnote{It is |
|
289 |
safe to do so even without using PDF~\LaTeX.} |
|
290 |
||
291 |
\medskip As a final step, \texttt{isatool document} is run on the resulting |
|
292 |
\texttt{document} directory. Thus the actual output document is built and |
|
293 |
installed in its proper place (as linked by the session's |
|
294 |
\texttt{index.html}). Note that the generated sources are left as is. While |
|
295 |
they may be safely deleted afterwards, this is \emph{not} done automatically. |
|
296 |
||
297 |
||
298 |
\section{Running {\LaTeX} within the Isabelle environment --- \texttt{isatool latex}} |
|
299 |
\label{sec:tool-latex} |
|
300 |
||
301 |
The \tooldx{latex} utility provides the basic interface for Isabelle document |
|
302 |
preparation. Its usage is: |
|
303 |
\begin{ttbox} |
|
304 |
Usage: latex [OPTIONS] [FILE] |
|
305 |
||
306 |
Options are: |
|
307 |
-o FORMAT specify output format: dvi (default), dvi.gz, ps, |
|
7868 | 308 |
ps.gz, pdf, bbl, png |
7849 | 309 |
|
310 |
Run LaTeX (and related tools) on FILE (default root.tex), |
|
311 |
producing the specified output format. |
|
312 |
\end{ttbox} |
|
313 |
Appropriate {\LaTeX}-related programs are run on the input file, according to |
|
7868 | 314 |
the given output format: \texttt{latex}, \texttt{pdflatex}, \texttt{dvips}, |
315 |
\texttt{bibtex} (for \texttt{bbl}), and \texttt{thumbpdf} (for \texttt{png}). |
|
316 |
The actual commands are determined from the settings environment |
|
317 |
(\texttt{ISABELLE_LATEX} etc.). |
|
7849 | 318 |
|
319 |
It is important to note that the {\LaTeX} inputs file space has to be properly |
|
320 |
setup to include the Isabelle styles. Usually, this may be done by modifying |
|
321 |
the \settdx{TEXINPUTS} variable in settings like this: |
|
322 |
\begin{ttbox} |
|
323 |
TEXINPUTS="$ISABELLE_HOME/lib/texinputs:$TEXINPUTS" |
|
324 |
\end{ttbox} |
|
325 |
This is known to work with recent versions of the \textsl{teTeX} distribution. |
|
326 |
||
327 |
||
328 |
||
329 |
\section{Managing logic sessions --- \texttt{isatool usedir}} \label{sec:tool-usedir} |
|
330 |
||
331 |
The \tooldx{usedir} utility builds object-logic images, or runs example |
|
332 |
sessions based on existing logics. Its usage is: |
|
333 |
\begin{ttbox} |
|
334 |
Usage: usedir LOGIC NAME |
|
335 |
||
336 |
Options are: |
|
337 |
-B build mode with THIS_IS_ISABELLE_BUILD indication |
|
338 |
-P PATH set path for remote theory browsing information |
|
339 |
-b build mode (output heap image, using current dir) |
|
340 |
-d FORMAT build document as FORMAT (default false) |
|
341 |
-i BOOL generate theory browsing information, |
|
342 |
i.e. HTML / graph data (default false) |
|
343 |
-r reset session path |
|
344 |
-s NAME override session NAME |
|
345 |
||
346 |
Build object-logic or run examples. Also creates browsing |
|
347 |
information (HTML etc.) according to settings. |
|
348 |
||
349 |
ISABELLE_USEDIR_OPTIONS= |
|
350 |
\end{ttbox} |
|
351 |
||
352 |
Note that the value of the \settdx{ISABELLE_USEDIR_OPTIONS} setting is |
|
353 |
implicitly prefixed to \emph{any} \texttt{usedir} call. Since the |
|
354 |
\ttindex{IsaMakefile}s of all object-logics distributed with Isabelle just |
|
355 |
invoke \texttt{usedir} for the real work, one may control compilation options |
|
356 |
globally via above variable. In particular, generation of \rmindex{HTML} |
|
357 |
browsing information and document preparation is controlled this way. |
|
358 |
||
359 |
||
360 |
\subsection*{Options} |
|
361 |
||
362 |
Basically, there are two different modes of operation: \emph{build |
|
363 |
mode} (enabled through the \texttt{-b} option) and \emph{example |
|
364 |
mode} (default). |
|
365 |
||
366 |
Calling \texttt{usedir} with \texttt{-b} runs \texttt{isabelle} with input |
|
367 |
image \texttt{LOGIC} and output to \texttt{NAME}, as provided on the command |
|
368 |
line. This will be a batch session, running \texttt{ROOT.ML} from the current |
|
369 |
directory and then quitting. It is assumed that \texttt{ROOT.ML} contains all |
|
370 |
{\ML} commands required to build the logic. The \texttt{-B} option is like |
|
371 |
\texttt{-b}, but also indicates \texttt{THIS_IS_ISABELLE_BUILD=true} via the |
|
372 |
process environment. This usually causes the \texttt{ISABELLE\_OUTPUT} and |
|
373 |
\texttt{ISABELLE_BROWSER_INFO} settings to refer to some location within the |
|
374 |
Isabelle distribution directory, rather than the user's home directory. |
|
375 |
||
376 |
In example mode, \texttt{usedir} runs a read-only session of \texttt{LOGIC} |
|
377 |
(typically just built before) and automatically runs \texttt{ROOT.ML} from |
|
378 |
within directory \texttt{NAME}. It assumes that file \texttt{ROOT.ML} in |
|
379 |
directory \texttt{NAME} contains appropriate {\ML} commands to run the desired |
|
380 |
examples. |
|
381 |
||
382 |
\medskip The \texttt{-i} option controls theory browsing data generation. It |
|
383 |
may be explicitly turned on or off --- the last occurrence of \texttt{-i} on |
|
384 |
the command line wins. The \texttt{-P} option specifies a path (or actual |
|
385 |
URL) to be prefixed to any \emph{non-local} reference of existing theories. |
|
386 |
Thus user sessions may easily link to existing Isabelle libraries already |
|
387 |
present on the WWW. |
|
388 |
||
389 |
\medskip The \texttt{-d} option controls document preparation. Valid |
|
390 |
arguments are \texttt{false} (do not prepare document; this is default), or |
|
391 |
any of \texttt{dvi}, \texttt{dvi.gz}, \texttt{ps}, \texttt{ps.gz}, |
|
392 |
\texttt{pdf}. The logic session has to provide a properly setup |
|
393 |
\texttt{document} directory. See \S\ref{sec:tool-document} and |
|
394 |
\S\ref{sec:tool-latex} for more details. |
|
395 |
||
396 |
\medskip Any \texttt{usedir} session is named by some \emph{session |
|
397 |
identifier}. These accumulate, documenting the way sessions depend |
|
398 |
on others. For example, consider \texttt{Pure/FOL/ex}, which refers to |
|
399 |
the examples of {\FOL} which is built upon {\Pure}. |
|
400 |
||
401 |
The current session's identifier is by default just the base name of |
|
402 |
the \texttt{LOGIC} argument (in build mode), or of the \texttt{NAME} |
|
403 |
argument (in example mode). This may be overridden explicitely via the |
|
404 |
\texttt{-s} option. |
|
405 |
||
406 |
||
407 |
\subsection*{Examples} |
|
408 |
||
409 |
Refer to the \texttt{IsaMakefile}s of the Isabelle distribution's |
|
410 |
object-logics as a model for your own developments. For example, see |
|
411 |
\texttt{src/FOL/IsaMakefile}. |
|
412 |
||
413 |
||
5364 | 414 |
%%% Local Variables: |
415 |
%%% mode: latex |
|
416 |
%%% TeX-master: "system" |
|
417 |
%%% End: |