| author | wenzelm | 
| Tue, 03 Jul 2007 17:17:06 +0200 | |
| changeset 23531 | 38a304b3fe1e | 
| parent 20571 | cbcca0d536bf | 
| child 24177 | 9229d09363c0 | 
| 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: 
6623diff
changeset | 104 | \begin{ttbox}
 | 
| 7861 | 105 | isatool usedir -i true HOL Foo | 
| 7251 
35de2117b5dd
Modified section about generation of theory browsing information.
 berghofe parents: 
6623diff
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: | |
| 20571 
cbcca0d536bf
isatool browser: renamed option -d to -c (cf. isatool tool)
 wenzelm parents: 
17195diff
changeset | 150 | -c cleanup -- remove GRAPHFILE 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 | |
| 20571 
cbcca0d536bf
isatool browser: renamed option -d to -c (cf. isatool tool)
 wenzelm parents: 
17195diff
changeset | 156 | \medskip The \texttt{-c} option causes the input file to be removed after use.
 | 
| 12583 | 157 | |
| 158 | The \texttt{-o} option indicates batch-mode operation, with the output written
 | |
| 159 | to the indicated file; note that \texttt{pdf} produces an \texttt{eps} copy as
 | |
| 160 | well. | |
| 161 | ||
| 13047 | 162 | \medskip The applet version of the browser is part of the standard WWW theory | 
| 163 | presentation, see the link ``theory dependencies'' within each session index. | |
| 4540 | 164 | |
| 3188 | 165 | |
| 3753 | 166 | \subsection{Using the graph browser}
 | 
| 4540 | 167 | |
| 168 | The browser's main window, which is shown in figure | |
| 12464 | 169 | \ref{fig:browserwindow}, consists of two sub-windows: In the left
 | 
| 7849 | 170 | sub-window, the directory tree is displayed. The graph itself is | 
| 171 | displayed in the right sub-window. | |
| 172 | \begin{figure}[ht]
 | |
| 6623 | 173 |   \includegraphics[width=\textwidth]{browser_screenshot}
 | 
| 12464 | 174 |   \caption{\label{fig:browserwindow} Browser main window}
 | 
| 3753 | 175 | \end{figure}
 | 
| 176 | ||
| 4540 | 177 | |
| 3753 | 178 | \subsubsection*{The directory tree window}
 | 
| 4540 | 179 | |
| 7882 | 180 | We describe the usage of the directory browser and the meaning of the | 
| 181 | different items in the browser window. | |
| 3753 | 182 | \begin{itemize}
 | 
| 4540 | 183 | |
| 184 | \item A red arrow before a directory name indicates that the directory | |
| 185 | is currently ``folded'', i.e.~the nodes in this directory are | |
| 7849 | 186 | collapsed to one single node. In the right sub-window, the names of | 
| 4540 | 187 | nodes corresponding to folded directories are enclosed in square | 
| 7849 | 188 | brackets and displayed in red color. | 
| 4540 | 189 | |
| 190 | \item A green downward arrow before a directory name indicates that | |
| 191 | the directory is currently ``unfolded''. It can be folded by | |
| 192 | clicking on the directory name. Clicking on the name for a second | |
| 193 | time unfolds the directory again. Alternatively, a directory can | |
| 194 | also be unfolded by clicking on the corresponding node in the right | |
| 7849 | 195 | sub-window. | 
| 4540 | 196 | |
| 7882 | 197 | \item Blue arrows stand before ordinary node names. When clicking on such a | 
| 198 | name (i.e.\ that of a theory), the graph display window focuses to the | |
| 199 | corresponding node. Double clicking invokes a text viewer window in which | |
| 200 | the contents of the theory file are displayed. | |
| 4540 | 201 | |
| 3753 | 202 | \end{itemize}
 | 
| 3188 | 203 | |
| 4540 | 204 | |
| 3753 | 205 | \subsubsection*{The graph display window}
 | 
| 4540 | 206 | |
| 207 | When pointing on an ordinary node, an upward and a downward arrow is | |
| 208 | shown. Initially, both of these arrows are green. Clicking on the | |
| 3753 | 209 | upward or downward arrow collapses all predecessor or successor nodes, | 
| 7849 | 210 | respectively. The arrow's color then changes to red, indicating that | 
| 3753 | 211 | the predecessor or successor nodes are currently collapsed. The node | 
| 4540 | 212 | corresponding to the collapsed nodes has the name ``{\tt [....]}''. To
 | 
| 213 | uncollapse the nodes again, simply click on the red arrow or on the | |
| 214 | node with the name ``{\tt [....]}''. Similar to the directory browser,
 | |
| 215 | the contents of theory files can be displayed by double clicking on | |
| 216 | the corresponding node. | |
| 3188 | 217 | |
| 4540 | 218 | |
| 219 | \subsubsection*{The ``File'' menu}
 | |
| 220 | ||
| 4555 | 221 | Please note that due to Java security restrictions this menu is not | 
| 4540 | 222 | available in the applet version. The meaning of the menu items is as | 
| 223 | follows: | |
| 3753 | 224 | \begin{description}
 | 
| 4540 | 225 | |
| 7882 | 226 | \item[Open \dots] Open a new graph file. | 
| 4540 | 227 | |
| 11582 | 228 | \item[Export to PostScript] Outputs the current graph in Postscript format, | 
| 12464 | 229 | appropriately scaled to fit on one single sheet of A4 paper. The resulting | 
| 11582 | 230 | file can be printed directly. | 
| 4540 | 231 | |
| 11582 | 232 | \item[Export to EPS] Outputs the current graph in Encapsulated Postscript | 
| 233 | format. The resulting file can be included in other documents. | |
| 4540 | 234 | |
| 3753 | 235 | \item[Quit] Quit the graph browser. | 
| 4540 | 236 | |
| 3753 | 237 | \end{description}
 | 
| 238 | ||
| 4540 | 239 | |
| 3753 | 240 | \subsection*{*Syntax of graph definition files}
 | 
| 4540 | 241 | |
| 3753 | 242 | A graph definition file has the following syntax: | 
| 243 | \begin{eqnarray*}
 | |
| 4540 | 244 |   \mbox{\it graph} & = & \{ \: \mbox{\it vertex \tt ;} \: \} ^ + \\
 | 
| 245 |   vertex & = & \mbox{\it vertexname} \: \mbox{\it vertexID} \: \mbox{\it dirname} \: [ \mbox{\tt +} ]
 | |
| 246 |   \: \mbox{\it path} \: [ \mbox{\tt <} | \mbox{\tt >} ] \: \{ \: \mbox{\it vertexID} \: \} ^ *
 | |
| 3753 | 247 | \end{eqnarray*}
 | 
| 4540 | 248 | |
| 3753 | 249 | The meaning of the items in a vertex description is as follows: | 
| 250 | \begin{description}
 | |
| 4540 | 251 | |
| 3753 | 252 | \item[vertexname] The name of the vertex. | 
| 4540 | 253 | |
| 254 | \item[vertexID] The vertex identifier. Note that there may be two | |
| 255 | vertices with equal names, whereas identifiers must be unique. | |
| 256 | ||
| 257 | \item[dirname] The name of the ``directory'' the vertex should be | |
| 258 |   placed in.  A ``{\tt +}'' sign after {\it dirname} indicates that
 | |
| 259 | the nodes in the directory are initially visible. Directories are | |
| 260 | initially invisible by default. | |
| 261 | ||
| 262 | \item[path] The path of the corresponding theory file. This is | |
| 263 | specified relatively to the path of the graph definition file. | |
| 264 | ||
| 265 | \item[List of successor/predecessor nodes] A ``{\tt <}'' sign before
 | |
| 266 |   the list means that successor nodes are listed, a ``{\tt >}'' sign
 | |
| 267 |   means that predecessor nodes are listed. If neither ``{\tt <}'' nor
 | |
| 268 |   ``{\tt >}'' is found, the browser assumes that successor nodes are
 | |
| 269 | listed. | |
| 270 | ||
| 3753 | 271 | \end{description}
 | 
| 5364 | 272 | |
| 273 | ||
| 8363 | 274 | \section{Creating Isabelle session directories --- \texttt{isatool mkdir}}
 | 
| 275 | \label{sec:tool-mkdir}
 | |
| 7849 | 276 | |
| 8363 | 277 | The \tooldx{mkdir} utility prepares Isabelle session source directories,
 | 
| 11582 | 278 | including a sensible default setup of \texttt{IsaMakefile}, \texttt{ROOT.ML},
 | 
| 279 | and a \texttt{document} directory with a minimal \texttt{root.tex} that is
 | |
| 13047 | 280 | sufficient to print all theories of the session (in the order of appearance); | 
| 281 | see \S\ref{sec:tool-document} for further information on Isabelle document
 | |
| 12464 | 282 | preparation.  The usage of \texttt{isatool mkdir} is:
 | 
| 8363 | 283 | \begin{ttbox}
 | 
| 9237 | 284 | Usage: mkdir [OPTIONS] [LOGIC] NAME | 
| 8363 | 285 | |
| 286 | Options are: | |
| 287 | -I FILE alternative IsaMakefile output | |
| 288 | -P include parent logic target | |
| 289 | -b setup build mode (session outputs heap image) | |
| 11582 | 290 | -q quiet mode | 
| 8363 | 291 | |
| 11582 | 292 | Prepare session directory, including IsaMakefile and document source, | 
| 8363 | 293 | with parent LOGIC (default ISABELLE_LOGIC=\$ISABELLE_LOGIC) | 
| 294 | \end{ttbox}
 | |
| 295 | ||
| 296 | The \texttt{mkdir} tool is conservative in the sense that any existing
 | |
| 297 | \texttt{IsaMakefile} etc.\ is left unchanged.  Thus it is safe to invoke it
 | |
| 12464 | 298 | multiple times, although later runs may not have the desired effect. | 
| 8363 | 299 | |
| 300 | Note that \texttt{mkdir} is unable to change \texttt{IsaMakefile}
 | |
| 301 | incrementally --- manual changes are required for multiple sub-sessions. On | |
| 302 | order to get an initial working session, the only editing needed is to add | |
| 303 | appropriate \texttt{use_thy} calls to the generated \texttt{ROOT.ML} file.
 | |
| 304 | ||
| 305 | ||
| 306 | \subsection*{Options}
 | |
| 307 | ||
| 308 | The \texttt{-I} option specifies an alternative to \texttt{IsaMakefile} for
 | |
| 309 | dependencies.  Note that ``\texttt{-}'' refers to \emph{stdout}, i.e.\ 
 | |
| 310 | ``\texttt{-I-}'' provides an easy way to peek at \texttt{mkdir}'s idea of
 | |
| 311 | \texttt{make} setup required for some particular of Isabelle session.
 | |
| 312 | ||
| 313 | \medskip The \texttt{-P} option includes a target for the parent
 | |
| 314 | \texttt{LOGIC} session in the generated \texttt{IsaMakefile}.  The
 | |
| 315 | corresponding sources are assumed to be located within the Isabelle | |
| 316 | distribution. | |
| 317 | ||
| 318 | \medskip The \texttt{-b} option sets up the current directory as the base for
 | |
| 319 | a new session that provides an actual logic image, as opposed to one that only | |
| 320 | runs several theories based on an existing image. Note that in the latter | |
| 321 | case, everything except \texttt{IsaMakefile} would be placed into a separate
 | |
| 322 | directory \texttt{NAME}, rather than the current one.  See
 | |
| 323 | \S\ref{sec:tool-usedir} for further information on \emph{build mode} vs.\ 
 | |
| 324 | \emph{example mode} of the \texttt{usedir} utility.
 | |
| 325 | ||
| 11582 | 326 | \medskip The \texttt{-q} enables quiet mode, suppressing further notes on how
 | 
| 327 | to proceed. | |
| 8363 | 328 | |
| 329 | ||
| 330 | \subsection*{Examples}
 | |
| 331 | ||
| 332 | The standard setup of a single ``example session'' based on the default logic, | |
| 333 | with proper document generation is generated like this: | |
| 334 | \begin{ttbox}
 | |
| 12464 | 335 | isatool mkdir Foo && isatool make | 
| 8363 | 336 | \end{ttbox}
 | 
| 337 | \noindent The theory sources should be put into the \texttt{Foo} directory, and its
 | |
| 338 | \texttt{ROOT.ML} should be edited to load all required theories.  Invoking
 | |
| 12464 | 339 | \texttt{isatool make} again would run the whole session, generating browser
 | 
| 8363 | 340 | information and the document automatically.  The \texttt{IsaMakefile} is
 | 
| 13047 | 341 | typically tuned manually later, e.g.\ adding source dependencies, or changing | 
| 342 | the options passed to \texttt{usedir}.
 | |
| 8363 | 343 | |
| 12464 | 344 | \medskip Large projects may demand further sessions, potentially with separate | 
| 345 | logic images being created. This usually requires manual editing of the | |
| 346 | generated \texttt{IsaMakefile}, which is meant to cover all of the sub-session
 | |
| 347 | directories at the same time (this is the deeper reasong why | |
| 348 | \texttt{IsaMakefile} is not made part of the initial session directory created
 | |
| 349 | by \texttt{isatool mkdir}).  See \texttt{src/HOL/IsaMakefile} of the Isabelle
 | |
| 350 | distribution for a full-blown example. | |
| 351 | ||
| 8363 | 352 | |
| 353 | \section{Running Isabelle sessions --- \texttt{isatool usedir}} \label{sec:tool-usedir}
 | |
| 7849 | 354 | |
| 355 | The \tooldx{usedir} utility builds object-logic images, or runs example
 | |
| 356 | sessions based on existing logics. Its usage is: | |
| 357 | \begin{ttbox}
 | |
| 11582 | 358 | |
| 9237 | 359 | Usage: usedir [OPTIONS] LOGIC NAME | 
| 7849 | 360 | |
| 361 | Options are: | |
| 17195 | 362 | -C BOOL copy existing document directory to -D PATH (default true) | 
| 8363 | 363 | -D PATH dump generated document sources into PATH | 
| 7849 | 364 | -P PATH set path for remote theory browsing information | 
| 17054 | 365 | -V VERSION declare alternative document VERSION | 
| 7849 | 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) | 
| 17054 | 369 | -f NAME use ML file NAME (default ROOT.ML) | 
| 12464 | 370 | -g BOOL generate session graph image for document (default false) | 
| 10564 | 371 | -i BOOL generate theory browser information (default false) | 
| 372 | -m MODE add print mode for output | |
| 11582 | 373 | -p LEVEL set level of detail for proof objects | 
| 7849 | 374 | -r reset session path | 
| 375 | -s NAME override session NAME | |
| 11582 | 376 | -v BOOL be verbose (default false) | 
| 7849 | 377 | |
| 378 | Build object-logic or run examples. Also creates browsing | |
| 379 | information (HTML etc.) according to settings. | |
| 380 | ||
| 381 | ISABELLE_USEDIR_OPTIONS= | |
| 382 | \end{ttbox}
 | |
| 383 | ||
| 384 | Note that the value of the \settdx{ISABELLE_USEDIR_OPTIONS} setting is
 | |
| 385 | implicitly prefixed to \emph{any} \texttt{usedir} call. Since the
 | |
| 386 | \ttindex{IsaMakefile}s of all object-logics distributed with Isabelle just
 | |
| 387 | invoke \texttt{usedir} for the real work, one may control compilation options
 | |
| 388 | globally via above variable. In particular, generation of \rmindex{HTML}
 | |
| 7882 | 389 | browsing information and document preparation is controlled here. | 
| 7849 | 390 | |
| 391 | ||
| 392 | \subsection*{Options}
 | |
| 393 | ||
| 7882 | 394 | Basically, there are two different modes of operation: \emph{build mode}
 | 
| 395 | (enabled through the \texttt{-b} option) and \emph{example mode} (default).
 | |
| 7849 | 396 | |
| 397 | Calling \texttt{usedir} with \texttt{-b} runs \texttt{isabelle} with input
 | |
| 398 | image \texttt{LOGIC} and output to \texttt{NAME}, as provided on the command
 | |
| 399 | line. This will be a batch session, running \texttt{ROOT.ML} from the current
 | |
| 400 | directory and then quitting.  It is assumed that \texttt{ROOT.ML} contains all
 | |
| 7883 | 401 | {\ML} commands required to build the logic.
 | 
| 7849 | 402 | |
| 403 | In example mode, \texttt{usedir} runs a read-only session of \texttt{LOGIC}
 | |
| 7882 | 404 | and automatically runs \texttt{ROOT.ML} from within directory \texttt{NAME}.
 | 
| 405 | It assumes that this file contains appropriate {\ML} commands to run the
 | |
| 406 | desired examples. | |
| 7849 | 407 | |
| 7882 | 408 | \medskip The \texttt{-i} option controls theory browser data generation. It
 | 
| 409 | may be explicitly turned on or off --- as usual, the last occurrence of | |
| 10564 | 410 | \texttt{-i} on the command line wins.
 | 
| 411 | ||
| 412 | The \texttt{-P} option specifies a path (or actual URL) to be prefixed to any
 | |
| 413 | \emph{non-local} reference of existing theories.  Thus user sessions may
 | |
| 414 | easily link to existing Isabelle libraries already present on the WWW. | |
| 415 | ||
| 416 | The \texttt{-m} options specifies additional print modes to be activated
 | |
| 417 | temporarily while the session is processed. | |
| 7849 | 418 | |
| 419 | \medskip The \texttt{-d} option controls document preparation.  Valid
 | |
| 7882 | 420 | arguments are \texttt{false} (do not prepare any document; this is default),
 | 
| 421 | or any of \texttt{dvi}, \texttt{dvi.gz}, \texttt{ps}, \texttt{ps.gz},
 | |
| 7849 | 422 | \texttt{pdf}.  The logic session has to provide a properly setup
 | 
| 423 | \texttt{document} directory.  See \S\ref{sec:tool-document} and
 | |
| 424 | \S\ref{sec:tool-latex} for more details.
 | |
| 425 | ||
| 17099 | 426 | \medskip The \texttt{-V} option declares alternative document versions,
 | 
| 427 | consisting of name/tags pairs (cf.\ options \texttt{-n} and \texttt{-t} of the
 | |
| 428 | \texttt{document} tool, \S\ref{sec:tool-document}).  The standard document is
 | |
| 429 | equivalent to ``\texttt{document=theory,proof,ML}'', which means that all
 | |
| 430 | theory begin/end commands, proof body texts, and ML code will be presented | |
| 431 | faithfully.  An alternative version ``\texttt{outline=/proof/ML}'' would fold
 | |
| 432 | proof and ML parts, replacing the original text by a short place-holder. The | |
| 433 | form ``$name$\verb,=-,'' means to remove document $name$ from the list of | |
| 434 | versions to be processed.  Any number of \texttt{-V} options may be given;
 | |
| 435 | later declarations have precedence over earlier ones. | |
| 17054 | 436 | |
| 437 | \medskip The \texttt{-g} option produces images of the theory dependency graph
 | |
| 438 | (cf.\ \S\ref{sec:browse}) for inclusion in the generated document, both as
 | |
| 12464 | 439 | \texttt{session_graph.eps} and \texttt{session_graph.pdf} at the same time.
 | 
| 13047 | 440 | To include this in the final {\LaTeX} document one could say
 | 
| 441 | \verb,\includegraphics{session_graph}, in \texttt{document/root.tex} (omitting
 | |
| 442 | the file-name extension enables {\LaTeX} to select to correct version, either
 | |
| 443 | for the DVI or PDF output path). | |
| 12464 | 444 | |
| 17195 | 445 | \medskip The \texttt{-D} option causes the generated document sources to be
 | 
| 13018 
5164177cf0a6
isatool usedir -D generated Foo && isatool document Foo/generated;
 wenzelm parents: 
12689diff
changeset | 446 | dumped at location \texttt{PATH}; this path is relative to the session's main
 | 
| 17195 | 447 | directory.  If the \texttt{-C} option is true, this will include a copy of an
 | 
| 448 | existing \texttt{document} directory as provided by the user.  For example,
 | |
| 449 | \texttt{isatool usedir -D generated HOL Foo} produces a complete set of
 | |
| 450 | document sources at \texttt{Foo/generated}.  Subsequent invocation of
 | |
| 451 | \texttt{isatool document Foo/generated} (see also \S\ref{sec:tool-document})
 | |
| 452 | will process the final result independently of an Isabelle job. This | |
| 453 | decoupled mode of operation facilitates debugging of serious {\LaTeX} errors,
 | |
| 454 | for example. | |
| 8363 | 455 | |
| 11582 | 456 | \medskip The \texttt{-p} option determines the level of detail for internal
 | 
| 457 | proof objects, see also the \emph{Isabelle Reference
 | |
| 458 |   Manual}~\cite{isabelle-ref}.
 | |
| 459 | ||
| 460 | \medskip The \texttt{-v} option causes additional information to be printed
 | |
| 13047 | 461 | while running the session, notably the location of prepared documents. | 
| 11582 | 462 | |
| 7849 | 463 | \medskip Any \texttt{usedir} session is named by some \emph{session
 | 
| 7882 | 464 | identifier}. These accumulate, documenting the way sessions depend on | 
| 465 | others. For example, consider \texttt{Pure/FOL/ex}, which refers to the
 | |
| 9695 | 466 | examples of FOL, which in turn is built upon Pure. | 
| 7849 | 467 | |
| 7882 | 468 | The current session's identifier is by default just the base name of the | 
| 469 | \texttt{LOGIC} argument (in build mode), or of the \texttt{NAME} argument (in
 | |
| 470 | example mode). This may be overridden explicitly via the \texttt{-s} option.
 | |
| 7849 | 471 | |
| 472 | ||
| 473 | \subsection*{Examples}
 | |
| 474 | ||
| 475 | Refer to the \texttt{IsaMakefile}s of the Isabelle distribution's
 | |
| 476 | object-logics as a model for your own developments. For example, see | |
| 8363 | 477 | \texttt{src/FOL/IsaMakefile}.  The Isabelle \texttt{mkdir} tool (see
 | 
| 478 | \S\ref{sec:tool-mkdir}) creates \texttt{IsaMakefile}s with proper invocation
 | |
| 479 | of \texttt{usedir} as well.
 | |
| 480 | ||
| 12464 | 481 | |
| 482 | \section{Preparing Isabelle session documents --- \texttt{isatool document}}
 | |
| 483 | \label{sec:tool-document}
 | |
| 484 | ||
| 485 | The \tooldx{document} utility prepares logic session documents, processing the
 | |
| 486 | sources both as provided by the user and generated by Isabelle. Its usage is: | |
| 487 | \begin{ttbox}
 | |
| 488 | Usage: document [OPTIONS] [DIR] | |
| 489 | ||
| 490 | Options are: | |
| 491 | -c cleanup -- be aggressive in removing old stuff | |
| 17054 | 492 | -n NAME specify document name (default 'document') | 
| 12464 | 493 | -o FORMAT specify output format: dvi (default), dvi.gz, ps, | 
| 494 | ps.gz, pdf | |
| 17054 | 495 | -t TAGS specify tagged region markup | 
| 12464 | 496 | |
| 497 | Prepare the theory session document in DIR (default 'document') | |
| 498 | producing the specified output format. | |
| 499 | \end{ttbox}
 | |
| 500 | This tool is usually run automatically as part of the corresponding Isabelle | |
| 501 | batch process, provided document preparation has been enabled (cf.\ the | |
| 502 | \texttt{-d} option of the \texttt{usedir} utility, \S\ref{sec:tool-usedir}).
 | |
| 503 | It may be manually invoked on the generated browser information document | |
| 504 | output as well, e.g.\ in case of errors encountered in the batch run. | |
| 505 | ||
| 17054 | 506 | \medskip The \texttt{-c} option tells the \texttt{document} tool to dispose
 | 
| 507 | the document sources after successful operation. This is the right thing to | |
| 508 | do for sources generated by an Isabelle process, but take care of your files | |
| 509 | in manual document preparation! | |
| 510 | ||
| 511 | \medskip The \texttt{-n} and \texttt{-o} option specify the final output file
 | |
| 512 | name and format, the default is ``\texttt{document.dvi}''.  Note that the
 | |
| 513 | result will appear in the parent of the target \texttt{DIR}.
 | |
| 514 | ||
| 515 | \medskip The \texttt{-t} option tells {\LaTeX} how to interpret tagged
 | |
| 516 | Isabelle command regions. Tags are specified as a comma separated list of | |
| 517 | modifier/name pairs: ``\verb,+,$foo$'' (or just ``$foo$'') means to keep, | |
| 518 | ``\verb,-,$foo$'' to drop, and ``\verb,/,$foo$'' to fold text tagged as $foo$. | |
| 519 | The builtin default is equivalent to the tag specification | |
| 520 | ``\texttt{/theory,/proof,/ML,+visible,-invisible}''; see also the {\LaTeX}
 | |
| 521 | macros \verb,\isakeeptag,, \verb,\isadroptag,, and \verb,\isafoldtag, in | |
| 522 | \texttt{isabelle.sty}.
 | |
| 523 | ||
| 12464 | 524 | \medskip Document preparation requires a properly setup ``\texttt{document}''
 | 
| 525 | directory within the logic session sources. This directory is supposed to | |
| 526 | contain all the files needed to produce the final document --- apart from the | |
| 527 | actual theories which are generated by Isabelle. | |
| 528 | ||
| 529 | \medskip For most practical purposes, the \texttt{document} tool is smart
 | |
| 530 | enough to create any of the specified output formats, taking \texttt{root.tex}
 | |
| 531 | supplied by the user as a starting point. This even includes multiple runs of | |
| 532 | {\LaTeX} to accommodate references and bibliographies (the latter assumes
 | |
| 533 | \texttt{root.bib} within the same directory).
 | |
| 534 | ||
| 535 | In more complex situations, a separate \texttt{IsaMakefile} for the document
 | |
| 536 | sources may be given instead. This should provide targets for any admissible | |
| 537 | document format; these have to produce corresponding output files named after | |
| 538 | \texttt{root} as well, e.g.\ \texttt{root.dvi} for target format \texttt{dvi}.
 | |
| 539 | ||
| 540 | \medskip When running the session, Isabelle copies the original | |
| 541 | \texttt{document} directory into its proper place within
 | |
| 542 | \texttt{ISABELLE_BROWSER_INFO} according to the session path.  Then, for any
 | |
| 543 | processed theory $A$ some {\LaTeX} source is generated and put there as
 | |
| 544 | $A$\texttt{.tex}.  Furthermore, a list of all generated theory files is put
 | |
| 545 | into \texttt{session.tex}.  Typically, the root {\LaTeX} file provided by the
 | |
| 546 | user would include \texttt{session.tex} to get a document containing all the
 | |
| 547 | theories. | |
| 548 | ||
| 549 | The {\LaTeX} versions of the theories require some macros defined in
 | |
| 550 | \texttt{isabelle.sty} as distributed with Isabelle.  Doing
 | |
| 13047 | 551 | \verb,\usepackage{isabelle}, in \texttt{root.tex} should be fine; the
 | 
| 552 | underlying Isabelle \texttt{latex} utility already includes an appropriate
 | |
| 12464 | 553 | {\TeX} inputs path.
 | 
| 554 | ||
| 555 | If the text contains any references to Isabelle symbols (such as | |
| 556 | \verb,\<forall>,) then \texttt{isabellesym.sty} should be included as well.
 | |
| 557 | This package contains a standard set of {\LaTeX} macro definitions
 | |
| 558 | \verb,\isasym,$foo$ corresponding to \verb,\<,$foo$\verb,>, (see | |
| 559 | Appendix~\ref{app:symbols} for a complete list of predefined Isabelle
 | |
| 560 | symbols). Users may invent further symbols as well, just by providing | |
| 561 | {\LaTeX} macros in a similar fashion as in \texttt{isabellesym.sty} of the
 | |
| 562 | distribution. | |
| 563 | ||
| 564 | For proper setup of PDF documents (with hyperlinks, bookmarks, and thumbnail | |
| 565 | images), we recommend to include \verb,pdfsetup.sty, as well. It is safe to | |
| 566 | do so even without using PDF~\LaTeX. | |
| 567 | ||
| 568 | \medskip As a final step of document preparation within Isabelle, | |
| 569 | \texttt{isatool document -c} is run on the resulting \texttt{document}
 | |
| 570 | directory. Thus the actual output document is built and installed in its | |
| 571 | proper place (as linked by the session's \texttt{index.html} if option
 | |
| 572 | \texttt{-i} of \texttt{usedir} has been enabled, cf.\ \S\ref{sec:info}).  The
 | |
| 573 | generated sources are deleted after successful run of {\LaTeX} and friends.
 | |
| 574 | Note that a separate copy of the sources may be retained by passing an option | |
| 575 | \texttt{-D} to the \texttt{usedir} utility when running the session (see also
 | |
| 576 | \S\ref{sec:tool-usedir}).
 | |
| 577 | ||
| 578 | ||
| 579 | \section{Running {\LaTeX} within the Isabelle environment --- \texttt{isatool latex}}
 | |
| 580 | \label{sec:tool-latex}
 | |
| 581 | ||
| 582 | The \tooldx{latex} utility provides the basic interface for Isabelle document
 | |
| 583 | preparation. Its usage is: | |
| 584 | \begin{ttbox}
 | |
| 585 | Usage: latex [OPTIONS] [FILE] | |
| 586 | ||
| 587 | Options are: | |
| 588 | -o FORMAT specify output format: dvi (default), dvi.gz, ps, | |
| 14921 | 589 | ps.gz, pdf, bbl, png, sty, syms | 
| 12464 | 590 | |
| 591 | Run LaTeX (and related tools) on FILE (default root.tex), | |
| 592 | producing the specified output format. | |
| 593 | \end{ttbox}
 | |
| 594 | Appropriate {\LaTeX}-related programs are run on the input file, according to
 | |
| 595 | the given output format: \texttt{latex}, \texttt{pdflatex}, \texttt{dvips},
 | |
| 596 | \texttt{bibtex} (for \texttt{bbl}), and \texttt{thumbpdf} (for \texttt{png}).
 | |
| 597 | The actual commands are determined from the settings environment | |
| 598 | (\texttt{ISABELLE_LATEX} etc., see \S\ref{sec:settings}).
 | |
| 599 | ||
| 600 | The \texttt{sty} output format causes the Isabelle style files to be updated
 | |
| 601 | from the distribution. This is useful in special situations where the | |
| 602 | document sources are to be processed another time by separate tools (cf.\ | |
| 603 | option \texttt{-D} of the \texttt{usedir} utility, see
 | |
| 604 | \S\ref{sec:tool-usedir}).
 | |
| 605 | ||
| 14921 | 606 | The \texttt{syms} output is for internal use; it generates lists of symbols
 | 
| 607 | that are available without loading additional {\LaTeX} packages.
 | |
| 608 | ||
| 12464 | 609 | |
| 610 | \subsubsection*{Examples}
 | |
| 611 | ||
| 612 | Invoking \texttt{isatool latex} by hand may be occasionally useful when
 | |
| 613 | debugging failed attempts of the automatic document preparation stage of | |
| 614 | batch-mode Isabelle. The abortive process leaves the sources at a certain | |
| 615 | place within \texttt{ISABELLE_BROWSER_INFO}, see the runtime error message for
 | |
| 616 | details.  This enables users to inspect {\LaTeX} runs in further detail, e.g.\ 
 | |
| 617 | like this: | |
| 618 | ||
| 619 | \begin{ttbox}
 | |
| 620 | cd ~/isabelle/browser_info/HOL/Test/document | |
| 621 | isatool latex -o pdf | |
| 622 | \end{ttbox}
 | |
| 623 | ||
| 624 | ||
| 5364 | 625 | %%% Local Variables: | 
| 626 | %%% mode: latex | |
| 627 | %%% TeX-master: "system" | |
| 628 | %%% End: |