| author | blanchet | 
| Thu, 10 May 2012 16:56:23 +0200 | |
| changeset 47904 | 67663c968d70 | 
| parent 43564 | 9864182c6bad | 
| child 47978 | f8f503a1782a | 
| permissions | -rw-r--r-- | 
| 28221 | 1 | theory Presentation | 
| 43564 
9864182c6bad
document antiquotations are managed as theory data, with proper name space and entity markup;
 wenzelm parents: 
42009diff
changeset | 2 | imports Base | 
| 28221 | 3 | begin | 
| 4 | ||
| 5 | chapter {* Presenting theories \label{ch:present} *}
 | |
| 6 | ||
| 7 | text {*
 | |
| 8 | Isabelle provides several ways to present the outcome of formal | |
| 9 | developments, including WWW-based browsable libraries or actual | |
| 10 | printable documents. Presentation is centered around the concept of | |
| 11 |   \emph{logic sessions}.  The global session structure is that of a
 | |
| 12 | tree, with Isabelle Pure at its root, further object-logics derived | |
| 13 | (e.g.\ HOLCF from HOL, and HOL from Pure), and application sessions | |
| 14 | in leaf positions (usually without a separate image). | |
| 15 | ||
| 16 |   The Isabelle tools @{tool_ref mkdir} and @{tool_ref make} provide
 | |
| 17 | the primary means for managing Isabelle sessions, including proper | |
| 18 |   setup for presentation.  Here the @{tool_ref usedir} tool takes care
 | |
| 19 |   to let @{executable_ref "isabelle-process"} process run any
 | |
| 20 | additional stages required for document preparation, notably the | |
| 21 |   tools @{tool_ref document} and @{tool_ref latex}.  The complete tool
 | |
| 22 | chain for managing batch-mode Isabelle sessions is illustrated in | |
| 23 |   \figref{fig:session-tools}.
 | |
| 24 | ||
| 25 |   \begin{figure}[htbp]
 | |
| 26 |   \begin{center}
 | |
| 27 |   \begin{tabular}{lp{0.6\textwidth}}
 | |
| 28 | ||
| 28504 
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
 wenzelm parents: 
28238diff
changeset | 29 |       @{verbatim isabelle} @{tool_ref mkdir} & invoked once by the user
 | 
| 28238 | 30 |       to create the initial source setup (common @{verbatim
 | 
| 31 | IsaMakefile} plus a single session directory); \\ | |
| 28221 | 32 | |
| 28504 
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
 wenzelm parents: 
28238diff
changeset | 33 |       @{verbatim isabelle} @{tool make} & invoked repeatedly by the
 | 
| 28238 | 34 | user to keep session output up-to-date (HTML, documents etc.); \\ | 
| 35 | ||
| 28504 
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
 wenzelm parents: 
28238diff
changeset | 36 |       @{verbatim isabelle} @{tool usedir} & part of the standard
 | 
| 28238 | 37 |       @{verbatim IsaMakefile} entry of a session; \\
 | 
| 28221 | 38 | |
| 28238 | 39 |       @{executable "isabelle-process"} & run through @{verbatim
 | 
| 28504 
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
 wenzelm parents: 
28238diff
changeset | 40 |       isabelle} @{tool_ref usedir}; \\
 | 
| 28221 | 41 | |
| 28504 
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
 wenzelm parents: 
28238diff
changeset | 42 |       @{verbatim isabelle} @{tool_ref document} & run by the Isabelle
 | 
| 28238 | 43 | process if document preparation is enabled; \\ | 
| 28221 | 44 | |
| 28504 
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
 wenzelm parents: 
28238diff
changeset | 45 |       @{verbatim isabelle} @{tool_ref latex} & universal {\LaTeX} tool
 | 
| 
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
 wenzelm parents: 
28238diff
changeset | 46 |       wrapper invoked multiple times by @{verbatim isabelle} @{tool_ref
 | 
| 28238 | 47 | document}; also useful for manual experiments; \\ | 
| 28221 | 48 | |
| 49 |   \end{tabular}
 | |
| 50 |   \caption{The tool chain of Isabelle session presentation} \label{fig:session-tools}
 | |
| 51 |   \end{center}
 | |
| 52 |   \end{figure}
 | |
| 53 | *} | |
| 54 | ||
| 55 | ||
| 56 | section {* Generating theory browser information \label{sec:info} *}
 | |
| 57 | ||
| 58 | text {*
 | |
| 59 |   \index{theory browsing information|bold}
 | |
| 60 | ||
| 61 | As a side-effect of running a logic sessions, Isabelle is able to | |
| 62 | generate theory browsing information, including HTML documents that | |
| 63 | show a theory's definition, the theorems proved in its ML file and | |
| 64 | the relationship with its ancestors and descendants. Besides the | |
| 65 | HTML file that is generated for every theory, Isabelle stores links | |
| 66 | to all theories in an index file. These indexes are linked with | |
| 67 | other indexes to represent the overall tree structure of logic | |
| 68 | sessions. | |
| 69 | ||
| 70 | Isabelle also generates graph files that represent the theory | |
| 71 | hierarchy of a logic. There is a graph browser Java applet embedded | |
| 72 | in the generated HTML pages, and also a stand-alone application that | |
| 73 | allows browsing theory graphs without having to start a WWW client | |
| 74 | first. The latter version also includes features such as generating | |
| 75 | Postscript files, which are not available in the applet version. | |
| 76 |   See \secref{sec:browse} for further information.
 | |
| 77 | ||
| 78 | \medskip | |
| 79 | ||
| 80 | The easiest way to let Isabelle generate theory browsing information | |
| 81 |   for existing sessions is to append ``@{verbatim "-i true"}'' to the
 | |
| 82 |   @{setting_ref ISABELLE_USEDIR_OPTIONS} before invoking @{verbatim
 | |
| 40800 
330eb65c9469
Parse.liberal_name for document antiquotations and attributes;
 wenzelm parents: 
40387diff
changeset | 83 |   isabelle} @{tool make} (or @{file "$ISABELLE_HOME/build"}).  For
 | 
| 28221 | 84 | example, add something like this to your Isabelle settings file | 
| 85 | ||
| 86 | \begin{ttbox}
 | |
| 87 | ISABELLE_USEDIR_OPTIONS="-i true" | |
| 88 | \end{ttbox}
 | |
| 89 | ||
| 40800 
330eb65c9469
Parse.liberal_name for document antiquotations and attributes;
 wenzelm parents: 
40387diff
changeset | 90 |   and then change into the @{file "~~/src/FOL"} directory and run
 | 
| 40387 
e4c9e0dad473
moved ISABELLE_IDENTIFIER from ISABELLE_OUTPUT further up to ISABELLE_HOME_USER;
 wenzelm parents: 
35587diff
changeset | 91 |   @{verbatim isabelle} @{tool make}, or even @{verbatim isabelle}
 | 
| 
e4c9e0dad473
moved ISABELLE_IDENTIFIER from ISABELLE_OUTPUT further up to ISABELLE_HOME_USER;
 wenzelm parents: 
35587diff
changeset | 92 |   @{tool make}~@{verbatim all}.  The presentation output will appear
 | 
| 
e4c9e0dad473
moved ISABELLE_IDENTIFIER from ISABELLE_OUTPUT further up to ISABELLE_HOME_USER;
 wenzelm parents: 
35587diff
changeset | 93 |   in @{verbatim "ISABELLE_BROWSER_INFO/FOL"}, which usually refers to
 | 
| 
e4c9e0dad473
moved ISABELLE_IDENTIFIER from ISABELLE_OUTPUT further up to ISABELLE_HOME_USER;
 wenzelm parents: 
35587diff
changeset | 94 |   something like @{verbatim
 | 
| 
e4c9e0dad473
moved ISABELLE_IDENTIFIER from ISABELLE_OUTPUT further up to ISABELLE_HOME_USER;
 wenzelm parents: 
35587diff
changeset | 95 | "~/.isabelle/IsabelleXXXX/browser_info/FOL"}. Note that option | 
| 28221 | 96 |   @{verbatim "-v true"} will make the internal runs of @{tool usedir}
 | 
| 97 | more explicit about such details. | |
| 98 | ||
| 40800 
330eb65c9469
Parse.liberal_name for document antiquotations and attributes;
 wenzelm parents: 
40387diff
changeset | 99 |   Many standard Isabelle sessions (such as @{file "~~/src/HOL/ex"})
 | 
| 28238 | 100 | also provide actual printable documents. These are prepared | 
| 28221 | 101 |   automatically as well if enabled like this, using the @{verbatim
 | 
| 102 | "-d"} option | |
| 103 | \begin{ttbox}
 | |
| 104 | ISABELLE_USEDIR_OPTIONS="-i true -d dvi" | |
| 105 | \end{ttbox}
 | |
| 106 |   Enabling options @{verbatim "-i"} and @{verbatim "-d"}
 | |
| 28225 | 107 | simultaneously as shown above causes an appropriate ``document'' | 
| 28221 | 108 | link to be included in the HTML index. Documents (or raw document | 
| 109 | sources) may be generated independently of browser information as | |
| 110 |   well, see \secref{sec:tool-document} for further details.
 | |
| 111 | ||
| 112 | \bigskip The theory browsing information is stored in a | |
| 113 |   sub-directory directory determined by the @{setting_ref
 | |
| 114 | ISABELLE_BROWSER_INFO} setting plus a prefix corresponding to the | |
| 115 | session identifier (according to the tree structure of sub-sessions | |
| 116 | by default). A complete WWW view of all standard object-logics and | |
| 28225 | 117 | examples of the Isabelle distribution is available at the usual | 
| 118 | Isabelle sites: | |
| 28221 | 119 |   \begin{center}\small
 | 
| 120 |   \begin{tabular}{l}
 | |
| 28225 | 121 |     \url{http://isabelle.in.tum.de/dist/library/} \\
 | 
| 122 |     \url{http://www.cl.cam.ac.uk/research/hvg/Isabelle/dist/library/} \\
 | |
| 123 |     \url{http://mirror.cse.unsw.edu.au/pub/isabelle/dist/library/} \\
 | |
| 28221 | 124 |   \end{tabular}
 | 
| 125 |   \end{center}
 | |
| 126 | ||
| 127 | \medskip In order to present your own theories on the web, simply | |
| 128 |   copy the corresponding subdirectory from @{setting
 | |
| 129 | ISABELLE_BROWSER_INFO} to your WWW server, having generated browser | |
| 130 | info like this: | |
| 131 | \begin{ttbox}
 | |
| 28504 
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
 wenzelm parents: 
28238diff
changeset | 132 | isabelle usedir -i true HOL Foo | 
| 28221 | 133 | \end{ttbox}
 | 
| 134 | ||
| 135 |   This assumes that directory @{verbatim Foo} contains some @{verbatim
 | |
| 136 | ROOT.ML} file to load all your theories, and HOL is your parent | |
| 28504 
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
 wenzelm parents: 
28238diff
changeset | 137 |   logic image (@{verbatim isabelle} @{tool_ref mkdir} assists in
 | 
| 28221 | 138 | setting up Isabelle session directories. Theory browser information | 
| 139 | for HOL should have been generated already beforehand. | |
| 140 | Alternatively, one may specify an external link to an existing body | |
| 141 |   of HTML data by giving @{tool usedir} a @{verbatim "-P"} option like
 | |
| 142 | this: | |
| 143 | \begin{ttbox}
 | |
| 28504 
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
 wenzelm parents: 
28238diff
changeset | 144 | isabelle usedir -i true -P http://isabelle.in.tum.de/library/ HOL Foo | 
| 28221 | 145 | \end{ttbox}
 | 
| 146 | ||
| 147 |   \medskip For production use, the @{tool usedir} tool is usually
 | |
| 148 |   invoked in an appropriate @{verbatim IsaMakefile}, via the Isabelle
 | |
| 149 |   @{tool make} tool.  There is a separate @{tool mkdir} tool to
 | |
| 150 | provide easy setup of all this, with only minimal manual editing | |
| 151 | required. | |
| 152 | \begin{ttbox}
 | |
| 28504 
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
 wenzelm parents: 
28238diff
changeset | 153 | isabelle mkdir HOL Foo && isabelle make | 
| 28221 | 154 | \end{ttbox}
 | 
| 155 |   See \secref{sec:tool-mkdir} for more information on preparing
 | |
| 156 | Isabelle session directories, including the setup for documents. | |
| 157 | *} | |
| 158 | ||
| 159 | ||
| 160 | section {* Browsing theory graphs \label{sec:browse} *}
 | |
| 161 | ||
| 162 | text {*
 | |
| 163 |   \index{theory graph browser|bold} 
 | |
| 164 | ||
| 165 | The Isabelle graph browser is a general tool for visualizing | |
| 166 | dependency graphs. Certain nodes of the graph (i.e.~theories) can | |
| 167 | be grouped together in ``directories'', whose contents may be | |
| 168 | hidden, thus enabling the user to collapse irrelevant portions of | |
| 169 | information. The browser is written in Java, it can be used both as | |
| 170 | a stand-alone application and as an applet. Note that the option | |
| 28504 
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
 wenzelm parents: 
28238diff
changeset | 171 |   @{verbatim "-g"} of @{verbatim isabelle} @{tool_ref usedir} creates
 | 
| 28221 | 172 | graph presentations in batch mode for inclusion in session | 
| 173 | documents. | |
| 174 | *} | |
| 175 | ||
| 176 | ||
| 177 | subsection {* Invoking the graph browser *}
 | |
| 178 | ||
| 179 | text {*
 | |
| 180 | The stand-alone version of the graph browser is wrapped up as an | |
| 181 |   Isabelle tool called @{tool_def browser}:
 | |
| 182 | ||
| 183 | \begin{ttbox}
 | |
| 184 | Usage: browser [OPTIONS] [GRAPHFILE] | |
| 185 | ||
| 186 | Options are: | |
| 35587 | 187 | -b Admin/build only | 
| 28221 | 188 | -c cleanup -- remove GRAPHFILE after use | 
| 189 | -o FILE output to FILE (ps, eps, pdf) | |
| 190 | \end{ttbox}
 | |
| 191 | When no filename is specified, the browser automatically changes to | |
| 192 |   the directory @{setting ISABELLE_BROWSER_INFO}.
 | |
| 193 | ||
| 35587 | 194 |   \medskip The @{verbatim "-b"} option indicates that this is for
 | 
| 195 | administrative build only, i.e.\ no browser popup if no files are | |
| 196 | given. | |
| 197 | ||
| 198 |   The @{verbatim "-c"} option causes the input file to be removed
 | |
| 199 | after use. | |
| 28221 | 200 | |
| 201 |   The @{verbatim "-o"} option indicates batch-mode operation, with the
 | |
| 202 |   output written to the indicated file; note that @{verbatim pdf}
 | |
| 203 |   produces an @{verbatim eps} copy as well.
 | |
| 204 | ||
| 205 | \medskip The applet version of the browser is part of the standard | |
| 206 | WWW theory presentation, see the link ``theory dependencies'' within | |
| 207 | each session index. | |
| 208 | *} | |
| 209 | ||
| 210 | ||
| 211 | subsection {* Using the graph browser *}
 | |
| 212 | ||
| 213 | text {*
 | |
| 214 | The browser's main window, which is shown in | |
| 215 |   \figref{fig:browserwindow}, consists of two sub-windows.  In the
 | |
| 216 | left sub-window, the directory tree is displayed. The graph itself | |
| 217 | is displayed in the right sub-window. | |
| 218 | ||
| 219 |   \begin{figure}[ht]
 | |
| 220 |   \includegraphics[width=\textwidth]{browser_screenshot}
 | |
| 221 |   \caption{\label{fig:browserwindow} Browser main window}
 | |
| 222 |   \end{figure}
 | |
| 223 | *} | |
| 224 | ||
| 225 | ||
| 226 | subsubsection {* The directory tree window *}
 | |
| 227 | ||
| 228 | text {*
 | |
| 229 | We describe the usage of the directory browser and the meaning of | |
| 230 | the different items in the browser window. | |
| 231 | ||
| 232 |   \begin{itemize}
 | |
| 233 | ||
| 234 | \item A red arrow before a directory name indicates that the | |
| 235 | directory is currently ``folded'', i.e.~the nodes in this directory | |
| 236 | are collapsed to one single node. In the right sub-window, the names | |
| 237 | of nodes corresponding to folded directories are enclosed in square | |
| 238 | brackets and displayed in red color. | |
| 239 | ||
| 240 | \item A green downward arrow before a directory name indicates that | |
| 241 | the directory is currently ``unfolded''. It can be folded by | |
| 242 | clicking on the directory name. Clicking on the name for a second | |
| 243 | time unfolds the directory again. Alternatively, a directory can | |
| 244 | also be unfolded by clicking on the corresponding node in the right | |
| 245 | sub-window. | |
| 246 | ||
| 247 | \item Blue arrows stand before ordinary node names. When clicking on | |
| 248 | such a name (i.e.\ that of a theory), the graph display window | |
| 249 | focuses to the corresponding node. Double clicking invokes a text | |
| 250 | viewer window in which the contents of the theory file are | |
| 251 | displayed. | |
| 252 | ||
| 253 |   \end{itemize}
 | |
| 254 | *} | |
| 255 | ||
| 256 | ||
| 257 | subsubsection {* The graph display window *}
 | |
| 258 | ||
| 259 | text {*
 | |
| 260 | When pointing on an ordinary node, an upward and a downward arrow is | |
| 261 | shown. Initially, both of these arrows are green. Clicking on the | |
| 262 | upward or downward arrow collapses all predecessor or successor | |
| 263 | nodes, respectively. The arrow's color then changes to red, | |
| 264 | indicating that the predecessor or successor nodes are currently | |
| 265 | collapsed. The node corresponding to the collapsed nodes has the | |
| 266 |   name ``@{verbatim "[....]"}''. To uncollapse the nodes again, simply
 | |
| 267 |   click on the red arrow or on the node with the name ``@{verbatim
 | |
| 268 | "[....]"}''. Similar to the directory browser, the contents of | |
| 269 | theory files can be displayed by double clicking on the | |
| 270 | corresponding node. | |
| 271 | *} | |
| 272 | ||
| 273 | ||
| 274 | subsubsection {* The ``File'' menu *}
 | |
| 275 | ||
| 276 | text {*
 | |
| 277 | Due to Java Applet security restrictions this menu is only available | |
| 278 | in the full application version. The meaning of the menu items is as | |
| 279 | follows: | |
| 280 | ||
| 281 |   \begin{description}
 | |
| 282 | ||
| 283 | \item[Open \dots] Open a new graph file. | |
| 284 | ||
| 285 | \item[Export to PostScript] Outputs the current graph in Postscript | |
| 286 | format, appropriately scaled to fit on one single sheet of A4 paper. | |
| 287 | The resulting file can be printed directly. | |
| 288 | ||
| 289 | \item[Export to EPS] Outputs the current graph in Encapsulated | |
| 290 | Postscript format. The resulting file can be included in other | |
| 291 | documents. | |
| 292 | ||
| 293 | \item[Quit] Quit the graph browser. | |
| 294 | ||
| 295 |   \end{description}
 | |
| 296 | *} | |
| 297 | ||
| 298 | ||
| 299 | subsection {* Syntax of graph definition files *}
 | |
| 300 | ||
| 301 | text {*
 | |
| 302 | A graph definition file has the following syntax: | |
| 303 | ||
| 28225 | 304 |   \begin{center}\small
 | 
| 28221 | 305 |   \begin{tabular}{rcl}
 | 
| 31688 | 306 |     @{text graph} & @{text "="} & @{text "{ vertex"}~@{verbatim ";"}~@{text "}+"} \\
 | 
| 307 |     @{text vertex} & @{text "="} & @{text "vertex_name vertex_ID dir_name ["}~@{verbatim "+"}~@{text "] path ["}~@{verbatim "<"}~@{text "|"}~@{verbatim ">"}~@{text "] { vertex_ID }*"}
 | |
| 28221 | 308 |   \end{tabular}
 | 
| 28225 | 309 |   \end{center}
 | 
| 28221 | 310 | |
| 311 | The meaning of the items in a vertex description is as follows: | |
| 312 | ||
| 313 |   \begin{description}
 | |
| 314 | ||
| 315 |   \item[@{text vertex_name}] The name of the vertex.
 | |
| 316 | ||
| 317 |   \item[@{text vertex_ID}] The vertex identifier. Note that there may
 | |
| 318 | be several vertices with equal names, whereas identifiers must be | |
| 319 | unique. | |
| 320 | ||
| 321 |   \item[@{text dir_name}] The name of the ``directory'' the vertex
 | |
| 322 |   should be placed in.  A ``@{verbatim "+"}'' sign after @{text
 | |
| 323 | dir_name} indicates that the nodes in the directory are initially | |
| 324 | visible. Directories are initially invisible by default. | |
| 325 | ||
| 326 |   \item[@{text path}] The path of the corresponding theory file. This
 | |
| 327 | is specified relatively to the path of the graph definition file. | |
| 328 | ||
| 329 |   \item[List of successor/predecessor nodes] A ``@{verbatim "<"}''
 | |
| 330 | sign before the list means that successor nodes are listed, a | |
| 331 |   ``@{verbatim ">"}'' sign means that predecessor nodes are listed. If
 | |
| 332 |   neither ``@{verbatim "<"}'' nor ``@{verbatim ">"}'' is found, the
 | |
| 333 | browser assumes that successor nodes are listed. | |
| 334 | ||
| 335 |   \end{description}
 | |
| 336 | *} | |
| 337 | ||
| 338 | ||
| 339 | section {* Creating Isabelle session directories
 | |
| 340 |   \label{sec:tool-mkdir} *}
 | |
| 341 | ||
| 342 | text {*
 | |
| 343 |   The @{tool_def mkdir} utility prepares Isabelle session source
 | |
| 344 |   directories, including a sensible default setup of @{verbatim
 | |
| 345 |   IsaMakefile}, @{verbatim ROOT.ML}, and a @{verbatim document}
 | |
| 346 |   directory with a minimal @{verbatim root.tex} that is sufficient to
 | |
| 347 | print all theories of the session (in the order of appearance); see | |
| 348 |   \secref{sec:tool-document} for further information on Isabelle
 | |
| 28504 
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
 wenzelm parents: 
28238diff
changeset | 349 |   document preparation.  The usage of @{verbatim isabelle} @{tool
 | 
| 28238 | 350 | mkdir} is: | 
| 28221 | 351 | |
| 352 | \begin{ttbox}
 | |
| 353 | Usage: mkdir [OPTIONS] [LOGIC] NAME | |
| 354 | ||
| 355 | Options are: | |
| 356 | -I FILE alternative IsaMakefile output | |
| 357 | -P include parent logic target | |
| 358 | -b setup build mode (session outputs heap image) | |
| 359 | -q quiet mode | |
| 360 | ||
| 361 | Prepare session directory, including IsaMakefile and document source, | |
| 362 | with parent LOGIC (default ISABELLE_LOGIC=\$ISABELLE_LOGIC) | |
| 363 | \end{ttbox}
 | |
| 364 | ||
| 365 |   The @{tool mkdir} tool is conservative in the sense that any
 | |
| 366 |   existing @{verbatim IsaMakefile} etc.\ is left unchanged.  Thus it
 | |
| 367 | is safe to invoke it multiple times, although later runs may not | |
| 368 | have the desired effect. | |
| 369 | ||
| 370 |   Note that @{tool mkdir} is unable to change @{verbatim IsaMakefile}
 | |
| 371 | incrementally --- manual changes are required for multiple | |
| 372 | sub-sessions. On order to get an initial working session, the only | |
| 373 |   editing needed is to add appropriate @{ML use_thy} calls to the
 | |
| 374 |   generated @{verbatim ROOT.ML} file.
 | |
| 375 | *} | |
| 376 | ||
| 377 | ||
| 378 | subsubsection {* Options *}
 | |
| 379 | ||
| 380 | text {*
 | |
| 381 |   The @{verbatim "-I"} option specifies an alternative to @{verbatim
 | |
| 382 |   IsaMakefile} for dependencies.  Note that ``@{verbatim "-"}'' refers
 | |
| 383 |   to \emph{stdout}, i.e.\ ``@{verbatim "-I-"}'' provides an easy way
 | |
| 384 |   to peek at @{tool mkdir}'s idea of @{tool make} setup required for
 | |
| 385 | some particular of Isabelle session. | |
| 386 | ||
| 387 |   \medskip The @{verbatim "-P"} option includes a target for the
 | |
| 388 |   parent @{verbatim LOGIC} session in the generated @{verbatim
 | |
| 389 | IsaMakefile}. The corresponding sources are assumed to be located | |
| 390 | within the Isabelle distribution. | |
| 391 | ||
| 392 |   \medskip The @{verbatim "-b"} option sets up the current directory
 | |
| 393 | as the base for a new session that provides an actual logic image, | |
| 394 | as opposed to one that only runs several theories based on an | |
| 395 | existing image. Note that in the latter case, everything except | |
| 396 |   @{verbatim IsaMakefile} would be placed into a separate directory
 | |
| 397 |   @{verbatim NAME}, rather than the current one.  See
 | |
| 398 |   \secref{sec:tool-usedir} for further information on \emph{build
 | |
| 399 |   mode} vs.\ \emph{example mode} of the @{tool usedir} utility.
 | |
| 400 | ||
| 401 |   \medskip The @{verbatim "-q"} option enables quiet mode, suppressing
 | |
| 402 | further notes on how to proceed. | |
| 403 | *} | |
| 404 | ||
| 405 | ||
| 406 | subsubsection {* Examples *}
 | |
| 407 | ||
| 408 | text {*
 | |
| 409 | The standard setup of a single ``example session'' based on the | |
| 410 | default logic, with proper document generation is generated like | |
| 411 | this: | |
| 412 | \begin{ttbox}
 | |
| 28504 
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
 wenzelm parents: 
28238diff
changeset | 413 | isabelle mkdir Foo && isabelle make | 
| 28221 | 414 | \end{ttbox}
 | 
| 415 | ||
| 416 |   \noindent The theory sources should be put into the @{verbatim Foo}
 | |
| 417 |   directory, and its @{verbatim ROOT.ML} should be edited to load all
 | |
| 28504 
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
 wenzelm parents: 
28238diff
changeset | 418 |   required theories.  Invoking @{verbatim isabelle} @{tool make} again
 | 
| 28238 | 419 | would run the whole session, generating browser information and the | 
| 28221 | 420 |   document automatically.  The @{verbatim IsaMakefile} is typically
 | 
| 421 | tuned manually later, e.g.\ adding source dependencies, or changing | |
| 422 |   the options passed to @{tool usedir}.
 | |
| 423 | ||
| 424 | \medskip Large projects may demand further sessions, potentially | |
| 425 | with separate logic images being created. This usually requires | |
| 426 |   manual editing of the generated @{verbatim IsaMakefile}, which is
 | |
| 427 | meant to cover all of the sub-session directories at the same time | |
| 428 |   (this is the deeper reasong why @{verbatim IsaMakefile} is not made
 | |
| 28238 | 429 |   part of the initial session directory created by @{verbatim
 | 
| 40800 
330eb65c9469
Parse.liberal_name for document antiquotations and attributes;
 wenzelm parents: 
40387diff
changeset | 430 |   isabelle} @{tool mkdir}).  See @{file "~~/src/HOL/IsaMakefile"} for
 | 
| 28238 | 431 | a full-blown example. | 
| 28221 | 432 | *} | 
| 433 | ||
| 434 | ||
| 435 | section {* Running Isabelle sessions \label{sec:tool-usedir} *}
 | |
| 436 | ||
| 437 | text {*
 | |
| 438 |   The @{tool_def usedir} utility builds object-logic images, or runs
 | |
| 439 | example sessions based on existing logics. Its usage is: | |
| 440 | \begin{ttbox}
 | |
| 441 | ||
| 442 | Usage: usedir [OPTIONS] LOGIC NAME | |
| 443 | ||
| 444 | Options are: | |
| 445 | -C BOOL copy existing document directory to -D PATH (default true) | |
| 446 | -D PATH dump generated document sources into PATH | |
| 447 | -M MAX multithreading: maximum number of worker threads (default 1) | |
| 448 | -P PATH set path for remote theory browsing information | |
| 41819 
2d84831dc1a0
scale parallel_proofs_threshold with max_threads_value to improve saturation of cores;
 wenzelm parents: 
41703diff
changeset | 449 | -Q INT set threshold for sub-proof parallelization (default 50) | 
| 28221 | 450 | -T LEVEL multithreading: trace level (default 0) | 
| 42004 | 451 | -V VARIANT declare alternative document VARIANT | 
| 28221 | 452 | -b build mode (output heap image, using current dir) | 
| 453 | -d FORMAT build document as FORMAT (default false) | |
| 454 | -f NAME use ML file NAME (default ROOT.ML) | |
| 455 | -g BOOL generate session graph image for document (default false) | |
| 456 | -i BOOL generate theory browser information (default false) | |
| 457 | -m MODE add print mode for output | |
| 32061 
11f8ee55662d
parallel_proofs: more fine-grained control with optional parallel checking of nested Isar proofs;
 wenzelm parents: 
31688diff
changeset | 458 | -p LEVEL set level of detail for proof objects (default 0) | 
| 
11f8ee55662d
parallel_proofs: more fine-grained control with optional parallel checking of nested Isar proofs;
 wenzelm parents: 
31688diff
changeset | 459 | -q LEVEL set level of parallel proof checking (default 1) | 
| 28221 | 460 | -r reset session path | 
| 461 | -s NAME override session NAME | |
| 31688 | 462 | -t BOOL internal session timing (default false) | 
| 28221 | 463 | -v BOOL be verbose (default false) | 
| 464 | ||
| 465 | Build object-logic or run examples. Also creates browsing | |
| 466 | information (HTML etc.) according to settings. | |
| 467 | ||
| 468 | ISABELLE_USEDIR_OPTIONS= | |
| 29435 
a5f84ac14609
added parallel_proofs flag (default true, cf. usedir option -Q), which can be disabled in low-memory situations;
 wenzelm parents: 
28914diff
changeset | 469 | |
| 
a5f84ac14609
added parallel_proofs flag (default true, cf. usedir option -Q), which can be disabled in low-memory situations;
 wenzelm parents: 
28914diff
changeset | 470 | ML_PLATFORM=x86-linux | 
| 
a5f84ac14609
added parallel_proofs flag (default true, cf. usedir option -Q), which can be disabled in low-memory situations;
 wenzelm parents: 
28914diff
changeset | 471 | ML_HOME=/usr/local/polyml-5.2.1/x86-linux | 
| 
a5f84ac14609
added parallel_proofs flag (default true, cf. usedir option -Q), which can be disabled in low-memory situations;
 wenzelm parents: 
28914diff
changeset | 472 | ML_SYSTEM=polyml-5.2.1 | 
| 
a5f84ac14609
added parallel_proofs flag (default true, cf. usedir option -Q), which can be disabled in low-memory situations;
 wenzelm parents: 
28914diff
changeset | 473 | ML_OPTIONS=-H 500 | 
| 28221 | 474 | \end{ttbox}
 | 
| 475 | ||
| 476 |   Note that the value of the @{setting_ref ISABELLE_USEDIR_OPTIONS}
 | |
| 477 |   setting is implicitly prefixed to \emph{any} @{tool usedir}
 | |
| 478 |   call. Since the @{verbatim IsaMakefile}s of all object-logics
 | |
| 28238 | 479 |   distributed with Isabelle just invoke @{tool usedir} for the real
 | 
| 28221 | 480 | work, one may control compilation options globally via above | 
| 481 |   variable. In particular, generation of \rmindex{HTML} browsing
 | |
| 482 | information and document preparation is controlled here. | |
| 483 | *} | |
| 484 | ||
| 485 | ||
| 486 | subsubsection {* Options *}
 | |
| 487 | ||
| 488 | text {*
 | |
| 489 |   Basically, there are two different modes of operation: \emph{build
 | |
| 490 |   mode} (enabled through the @{verbatim "-b"} option) and
 | |
| 491 |   \emph{example mode} (default).
 | |
| 492 | ||
| 493 |   Calling @{tool usedir} with @{verbatim "-b"} runs @{executable
 | |
| 494 |   "isabelle-process"} with input image @{verbatim LOGIC} and output to
 | |
| 495 |   @{verbatim NAME}, as provided on the command line. This will be a
 | |
| 496 |   batch session, running @{verbatim ROOT.ML} from the current
 | |
| 497 |   directory and then quitting.  It is assumed that @{verbatim ROOT.ML}
 | |
| 498 | contains all ML commands required to build the logic. | |
| 499 | ||
| 28238 | 500 |   In example mode, @{tool usedir} runs a read-only session of
 | 
| 28221 | 501 |   @{verbatim LOGIC} and automatically runs @{verbatim ROOT.ML} from
 | 
| 502 |   within directory @{verbatim NAME}.  It assumes that this file
 | |
| 503 | contains appropriate ML commands to run the desired examples. | |
| 504 | ||
| 505 |   \medskip The @{verbatim "-i"} option controls theory browser data
 | |
| 506 | generation. It may be explicitly turned on or off --- as usual, the | |
| 507 |   last occurrence of @{verbatim "-i"} on the command line wins.
 | |
| 508 | ||
| 509 |   The @{verbatim "-P"} option specifies a path (or actual URL) to be
 | |
| 510 |   prefixed to any \emph{non-local} reference of existing theories.
 | |
| 511 | Thus user sessions may easily link to existing Isabelle libraries | |
| 512 | already present on the WWW. | |
| 513 | ||
| 514 |   The @{verbatim "-m"} options specifies additional print modes to be
 | |
| 515 | activated temporarily while the session is processed. | |
| 516 | ||
| 517 |   \medskip The @{verbatim "-d"} option controls document preparation.
 | |
| 518 |   Valid arguments are @{verbatim false} (do not prepare any document;
 | |
| 519 |   this is default), or any of @{verbatim dvi}, @{verbatim dvi.gz},
 | |
| 520 |   @{verbatim ps}, @{verbatim ps.gz}, @{verbatim pdf}.  The logic
 | |
| 521 |   session has to provide a properly setup @{verbatim document}
 | |
| 522 |   directory.  See \secref{sec:tool-document} and
 | |
| 523 |   \secref{sec:tool-latex} for more details.
 | |
| 524 | ||
| 525 |   \medskip The @{verbatim "-V"} option declares alternative document
 | |
| 42004 | 526 |   variants, consisting of name/tags pairs (cf.\ options @{verbatim
 | 
| 28221 | 527 |   "-n"} and @{verbatim "-t"} of the @{tool_ref document} tool).  The
 | 
| 528 |   standard document is equivalent to ``@{verbatim
 | |
| 529 | "document=theory,proof,ML"}'', which means that all theory begin/end | |
| 530 | commands, proof body texts, and ML code will be presented | |
| 42004 | 531 |   faithfully.  An alternative variant ``@{verbatim
 | 
| 28221 | 532 | "outline=/proof/ML"}'' would fold proof and ML parts, replacing the | 
| 533 |   original text by a short place-holder.  The form ``@{text
 | |
| 534 |   name}@{verbatim "=-"},'' means to remove document @{text name} from
 | |
| 42004 | 535 |   the list of variants to be processed.  Any number of @{verbatim
 | 
| 28221 | 536 | "-V"} options may be given; later declarations have precedence over | 
| 537 | earlier ones. | |
| 538 | ||
| 539 |   \medskip The @{verbatim "-g"} option produces images of the theory
 | |
| 540 |   dependency graph (cf.\ \secref{sec:browse}) for inclusion in the
 | |
| 541 |   generated document, both as @{verbatim session_graph.eps} and
 | |
| 542 |   @{verbatim session_graph.pdf} at the same time.  To include this in
 | |
| 543 |   the final {\LaTeX} document one could say @{verbatim
 | |
| 544 |   "\\includegraphics{session_graph}"} in @{verbatim
 | |
| 545 | "document/root.tex"} (omitting the file-name extension enables | |
| 546 |   {\LaTeX} to select to correct version, either for the DVI or PDF
 | |
| 547 | output path). | |
| 548 | ||
| 549 |   \medskip The @{verbatim "-D"} option causes the generated document
 | |
| 550 |   sources to be dumped at location @{verbatim PATH}; this path is
 | |
| 551 |   relative to the session's main directory.  If the @{verbatim "-C"}
 | |
| 552 |   option is true, this will include a copy of an existing @{verbatim
 | |
| 553 | document} directory as provided by the user. For example, | |
| 28504 
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
 wenzelm parents: 
28238diff
changeset | 554 |   @{verbatim isabelle} @{tool usedir}~@{verbatim "-D generated HOL
 | 
| 28238 | 555 |   Foo"} produces a complete set of document sources at @{verbatim
 | 
| 556 |   "Foo/generated"}.  Subsequent invocation of @{verbatim
 | |
| 28504 
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
 wenzelm parents: 
28238diff
changeset | 557 |   isabelle} @{tool document}~@{verbatim "Foo/generated"} (see also
 | 
| 28238 | 558 |   \secref{sec:tool-document}) will process the final result
 | 
| 559 | independently of an Isabelle job. This decoupled mode of operation | |
| 560 |   facilitates debugging of serious {\LaTeX} errors, for example.
 | |
| 28221 | 561 | |
| 562 |   \medskip The @{verbatim "-p"} option determines the level of detail
 | |
| 563 |   for internal proof objects, see also the \emph{Isabelle Reference
 | |
| 564 |   Manual}~\cite{isabelle-ref}.
 | |
| 565 | ||
| 32061 
11f8ee55662d
parallel_proofs: more fine-grained control with optional parallel checking of nested Isar proofs;
 wenzelm parents: 
31688diff
changeset | 566 |   \medskip The @{verbatim "-q"} option specifies the level of parallel
 | 
| 
11f8ee55662d
parallel_proofs: more fine-grained control with optional parallel checking of nested Isar proofs;
 wenzelm parents: 
31688diff
changeset | 567 |   proof checking: @{verbatim 0} no proofs, @{verbatim 1} toplevel
 | 
| 
11f8ee55662d
parallel_proofs: more fine-grained control with optional parallel checking of nested Isar proofs;
 wenzelm parents: 
31688diff
changeset | 568 |   proofs (default), @{verbatim 2} toplevel and nested Isar proofs.
 | 
| 41703 
d27950860514
parallelization of nested Isar proofs is subject to Goal.parallel_proofs_threshold;
 wenzelm parents: 
40800diff
changeset | 569 |   The option @{verbatim "-Q"} specifies a threshold for @{verbatim
 | 
| 
d27950860514
parallelization of nested Isar proofs is subject to Goal.parallel_proofs_threshold;
 wenzelm parents: 
40800diff
changeset | 570 | "-q2"}: nested proofs are only parallelized when the current number | 
| 41819 
2d84831dc1a0
scale parallel_proofs_threshold with max_threads_value to improve saturation of cores;
 wenzelm parents: 
41703diff
changeset | 571 | of forked proofs falls below the given value (default 50), | 
| 
2d84831dc1a0
scale parallel_proofs_threshold with max_threads_value to improve saturation of cores;
 wenzelm parents: 
41703diff
changeset | 572 |   multiplied by the number of worker threads (see option @{verbatim
 | 
| 
2d84831dc1a0
scale parallel_proofs_threshold with max_threads_value to improve saturation of cores;
 wenzelm parents: 
41703diff
changeset | 573 | "-M"}). | 
| 32061 
11f8ee55662d
parallel_proofs: more fine-grained control with optional parallel checking of nested Isar proofs;
 wenzelm parents: 
31688diff
changeset | 574 | |
| 31688 | 575 |   \medskip The @{verbatim "-t"} option produces a more detailed
 | 
| 576 | internal timing report of the session. | |
| 577 | ||
| 28221 | 578 |   \medskip The @{verbatim "-v"} option causes additional information
 | 
| 579 | to be printed while running the session, notably the location of | |
| 580 | prepared documents. | |
| 581 | ||
| 582 |   \medskip The @{verbatim "-M"} option specifies the maximum number of
 | |
| 41819 
2d84831dc1a0
scale parallel_proofs_threshold with max_threads_value to improve saturation of cores;
 wenzelm parents: 
41703diff
changeset | 583 | parallel worker threads used for processing independent tasks when | 
| 
2d84831dc1a0
scale parallel_proofs_threshold with max_threads_value to improve saturation of cores;
 wenzelm parents: 
41703diff
changeset | 584 | checking theory sources (multithreading only works on suitable ML | 
| 
2d84831dc1a0
scale parallel_proofs_threshold with max_threads_value to improve saturation of cores;
 wenzelm parents: 
41703diff
changeset | 585 |   platforms).  The special value of @{verbatim 0} or @{verbatim max}
 | 
| 
2d84831dc1a0
scale parallel_proofs_threshold with max_threads_value to improve saturation of cores;
 wenzelm parents: 
41703diff
changeset | 586 | refers to the number of actual CPU cores of the underlying machine, | 
| 
2d84831dc1a0
scale parallel_proofs_threshold with max_threads_value to improve saturation of cores;
 wenzelm parents: 
41703diff
changeset | 587 | which is a good starting point for optimal performance tuning. The | 
| 
2d84831dc1a0
scale parallel_proofs_threshold with max_threads_value to improve saturation of cores;
 wenzelm parents: 
41703diff
changeset | 588 |   @{verbatim "-T"} option determines the level of detail in tracing
 | 
| 
2d84831dc1a0
scale parallel_proofs_threshold with max_threads_value to improve saturation of cores;
 wenzelm parents: 
41703diff
changeset | 589 | output concerning the internal locking and scheduling in | 
| 
2d84831dc1a0
scale parallel_proofs_threshold with max_threads_value to improve saturation of cores;
 wenzelm parents: 
41703diff
changeset | 590 | multithreaded operation. This may be helpful in isolating | 
| 
2d84831dc1a0
scale parallel_proofs_threshold with max_threads_value to improve saturation of cores;
 wenzelm parents: 
41703diff
changeset | 591 | performance bottle-necks, e.g.\ due to excessive wait states when | 
| 
2d84831dc1a0
scale parallel_proofs_threshold with max_threads_value to improve saturation of cores;
 wenzelm parents: 
41703diff
changeset | 592 | locking critical code sections. | 
| 28221 | 593 | |
| 594 |   \medskip Any @{tool usedir} session is named by some \emph{session
 | |
| 595 | identifier}. These accumulate, documenting the way sessions depend | |
| 596 |   on others. For example, consider @{verbatim "Pure/FOL/ex"}, which
 | |
| 597 | refers to the examples of FOL, which in turn is built upon Pure. | |
| 598 | ||
| 599 | The current session's identifier is by default just the base name of | |
| 600 |   the @{verbatim LOGIC} argument (in build mode), or of the @{verbatim
 | |
| 601 | NAME} argument (in example mode). This may be overridden explicitly | |
| 602 |   via the @{verbatim "-s"} option.
 | |
| 603 | *} | |
| 604 | ||
| 605 | ||
| 606 | subsubsection {* Examples *}
 | |
| 607 | ||
| 608 | text {*
 | |
| 609 |   Refer to the @{verbatim IsaMakefile}s of the Isabelle distribution's
 | |
| 610 | object-logics as a model for your own developments. For example, | |
| 40800 
330eb65c9469
Parse.liberal_name for document antiquotations and attributes;
 wenzelm parents: 
40387diff
changeset | 611 |   see @{file "~~/src/FOL/IsaMakefile"}.  The Isabelle @{tool_ref
 | 
| 28221 | 612 |   mkdir} tool creates @{verbatim IsaMakefile}s with proper invocation
 | 
| 613 |   of @{tool usedir} as well.
 | |
| 614 | *} | |
| 615 | ||
| 616 | ||
| 617 | section {* Preparing Isabelle session documents
 | |
| 618 |   \label{sec:tool-document} *}
 | |
| 619 | ||
| 620 | text {*
 | |
| 621 |   The @{tool_def document} utility prepares logic session documents,
 | |
| 622 | processing the sources both as provided by the user and generated by | |
| 623 | Isabelle. Its usage is: | |
| 624 | \begin{ttbox}
 | |
| 625 | Usage: document [OPTIONS] [DIR] | |
| 626 | ||
| 627 | Options are: | |
| 628 | -c cleanup -- be aggressive in removing old stuff | |
| 629 | -n NAME specify document name (default 'document') | |
| 630 | -o FORMAT specify output format: dvi (default), dvi.gz, ps, | |
| 631 | ps.gz, pdf | |
| 632 | -t TAGS specify tagged region markup | |
| 633 | ||
| 634 | Prepare the theory session document in DIR (default 'document') | |
| 635 | producing the specified output format. | |
| 636 | \end{ttbox}
 | |
| 637 | This tool is usually run automatically as part of the corresponding | |
| 638 | Isabelle batch process, provided document preparation has been | |
| 639 |   enabled (cf.\ the @{verbatim "-d"} option of the @{tool_ref usedir}
 | |
| 640 | tool). It may be manually invoked on the generated browser | |
| 641 | information document output as well, e.g.\ in case of errors | |
| 642 | encountered in the batch run. | |
| 643 | ||
| 644 |   \medskip The @{verbatim "-c"} option tells the @{tool document} tool
 | |
| 645 | to dispose the document sources after successful operation. This is | |
| 646 | the right thing to do for sources generated by an Isabelle process, | |
| 647 | but take care of your files in manual document preparation! | |
| 648 | ||
| 649 |   \medskip The @{verbatim "-n"} and @{verbatim "-o"} option specify
 | |
| 650 |   the final output file name and format, the default is ``@{verbatim
 | |
| 651 | document.dvi}''. Note that the result will appear in the parent of | |
| 652 |   the target @{verbatim DIR}.
 | |
| 653 | ||
| 654 |   \medskip The @{verbatim "-t"} option tells {\LaTeX} how to interpret
 | |
| 655 | tagged Isabelle command regions. Tags are specified as a comma | |
| 656 |   separated list of modifier/name pairs: ``@{verbatim "+"}@{text
 | |
| 657 |   foo}'' (or just ``@{text foo}'') means to keep, ``@{verbatim
 | |
| 658 |   "-"}@{text foo}'' to drop, and ``@{verbatim "/"}@{text foo}'' to
 | |
| 659 |   fold text tagged as @{text foo}.  The builtin default is equivalent
 | |
| 660 |   to the tag specification ``@{verbatim
 | |
| 30113 
5ea17e90b08a
isabelle document: adapted (postulated) defaults for tags to actual isabelle.sty;
 wenzelm parents: 
29435diff
changeset | 661 |   "+theory,+proof,+ML,+visible,-invisible"}''; see also the {\LaTeX}
 | 
| 28221 | 662 |   macros @{verbatim "\\isakeeptag"}, @{verbatim "\\isadroptag"}, and
 | 
| 40800 
330eb65c9469
Parse.liberal_name for document antiquotations and attributes;
 wenzelm parents: 
40387diff
changeset | 663 |   @{verbatim "\\isafoldtag"}, in @{file
 | 
| 28238 | 664 | "~~/lib/texinputs/isabelle.sty"}. | 
| 28221 | 665 | |
| 666 |   \medskip Document preparation requires a properly setup ``@{verbatim
 | |
| 667 | document}'' directory within the logic session sources. This | |
| 668 | directory is supposed to contain all the files needed to produce the | |
| 669 | final document --- apart from the actual theories which are | |
| 670 | generated by Isabelle. | |
| 671 | ||
| 672 |   \medskip For most practical purposes, the @{tool document} tool is
 | |
| 673 | smart enough to create any of the specified output formats, taking | |
| 674 |   @{verbatim root.tex} supplied by the user as a starting point.  This
 | |
| 675 |   even includes multiple runs of {\LaTeX} to accommodate references
 | |
| 676 |   and bibliographies (the latter assumes @{verbatim root.bib} within
 | |
| 677 | the same directory). | |
| 678 | ||
| 679 |   In more complex situations, a separate @{verbatim IsaMakefile} for
 | |
| 680 | the document sources may be given instead. This should provide | |
| 681 | targets for any admissible document format; these have to produce | |
| 682 |   corresponding output files named after @{verbatim root} as well,
 | |
| 683 |   e.g.\ @{verbatim root.dvi} for target format @{verbatim dvi}.
 | |
| 684 | ||
| 42009 
b008525c4399
parallel preparation of document variants, within separate directories;
 wenzelm parents: 
42004diff
changeset | 685 | \medskip When running the session, Isabelle copies the content of | 
| 
b008525c4399
parallel preparation of document variants, within separate directories;
 wenzelm parents: 
42004diff
changeset | 686 |   the original @{verbatim document} directory into its proper place
 | 
| 
b008525c4399
parallel preparation of document variants, within separate directories;
 wenzelm parents: 
42004diff
changeset | 687 |   within @{setting ISABELLE_BROWSER_INFO}, according to the session
 | 
| 
b008525c4399
parallel preparation of document variants, within separate directories;
 wenzelm parents: 
42004diff
changeset | 688 |   path and document variant.  Then, for any processed theory @{text A}
 | 
| 
b008525c4399
parallel preparation of document variants, within separate directories;
 wenzelm parents: 
42004diff
changeset | 689 |   some {\LaTeX} source is generated and put there as @{text
 | 
| 
b008525c4399
parallel preparation of document variants, within separate directories;
 wenzelm parents: 
42004diff
changeset | 690 |   A}@{verbatim ".tex"}.  Furthermore, a list of all generated theory
 | 
| 
b008525c4399
parallel preparation of document variants, within separate directories;
 wenzelm parents: 
42004diff
changeset | 691 |   files is put into @{verbatim session.tex}.  Typically, the root
 | 
| 
b008525c4399
parallel preparation of document variants, within separate directories;
 wenzelm parents: 
42004diff
changeset | 692 |   {\LaTeX} file provided by the user would include @{verbatim
 | 
| 
b008525c4399
parallel preparation of document variants, within separate directories;
 wenzelm parents: 
42004diff
changeset | 693 | session.tex} to get a document containing all the theories. | 
| 28221 | 694 | |
| 695 |   The {\LaTeX} versions of the theories require some macros defined in
 | |
| 40800 
330eb65c9469
Parse.liberal_name for document antiquotations and attributes;
 wenzelm parents: 
40387diff
changeset | 696 |   @{file "~~/lib/texinputs/isabelle.sty"}.  Doing @{verbatim
 | 
| 28238 | 697 |   "\\usepackage{isabelle}"} in @{verbatim root.tex} should be fine;
 | 
| 698 |   the underlying Isabelle @{tool latex} tool already includes an
 | |
| 699 |   appropriate path specification for {\TeX} inputs.
 | |
| 28221 | 700 | |
| 701 | If the text contains any references to Isabelle symbols (such as | |
| 702 |   @{verbatim "\\"}@{verbatim "<forall>"}) then @{verbatim
 | |
| 28238 | 703 | "isabellesym.sty"} should be included as well. This package | 
| 704 |   contains a standard set of {\LaTeX} macro definitions @{verbatim
 | |
| 28221 | 705 |   "\\isasym"}@{text foo} corresponding to @{verbatim "\\"}@{verbatim
 | 
| 28838 
d5db6dfcb34a
moved table of standard Isabelle symbols to isar-ref manual;
 wenzelm parents: 
28504diff
changeset | 706 |   "<"}@{text foo}@{verbatim ">"}, see \cite{isabelle-implementation} for a
 | 
| 
d5db6dfcb34a
moved table of standard Isabelle symbols to isar-ref manual;
 wenzelm parents: 
28504diff
changeset | 707 | complete list of predefined Isabelle symbols. Users may invent | 
| 28221 | 708 |   further symbols as well, just by providing {\LaTeX} macros in a
 | 
| 40800 
330eb65c9469
Parse.liberal_name for document antiquotations and attributes;
 wenzelm parents: 
40387diff
changeset | 709 |   similar fashion as in @{file "~~/lib/texinputs/isabellesym.sty"} of
 | 
| 28238 | 710 | the distribution. | 
| 28221 | 711 | |
| 712 | For proper setup of DVI and PDF documents (with hyperlinks and | |
| 40800 
330eb65c9469
Parse.liberal_name for document antiquotations and attributes;
 wenzelm parents: 
40387diff
changeset | 713 |   bookmarks), we recommend to include @{file
 | 
| 28238 | 714 | "~~/lib/texinputs/pdfsetup.sty"} as well. | 
| 28221 | 715 | |
| 716 | \medskip As a final step of document preparation within Isabelle, | |
| 28504 
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
 wenzelm parents: 
28238diff
changeset | 717 |   @{verbatim isabelle} @{tool document}~@{verbatim "-c"} is run on the
 | 
| 28238 | 718 |   resulting @{verbatim document} directory.  Thus the actual output
 | 
| 719 | document is built and installed in its proper place (as linked by | |
| 720 |   the session's @{verbatim index.html} if option @{verbatim "-i"} of
 | |
| 721 |   @{tool_ref usedir} has been enabled, cf.\ \secref{sec:info}).  The
 | |
| 722 |   generated sources are deleted after successful run of {\LaTeX} and
 | |
| 723 | friends. Note that a separate copy of the sources may be retained | |
| 724 |   by passing an option @{verbatim "-D"} to the @{tool usedir} utility
 | |
| 725 | when running the session. | |
| 28221 | 726 | *} | 
| 727 | ||
| 728 | ||
| 729 | section {* Running {\LaTeX} within the Isabelle environment
 | |
| 730 |   \label{sec:tool-latex} *}
 | |
| 731 | ||
| 732 | text {*
 | |
| 733 |   The @{tool_def latex} utility provides the basic interface for
 | |
| 734 | Isabelle document preparation. Its usage is: | |
| 735 | \begin{ttbox}
 | |
| 736 | Usage: latex [OPTIONS] [FILE] | |
| 737 | ||
| 738 | Options are: | |
| 739 | -o FORMAT specify output format: dvi (default), dvi.gz, ps, | |
| 740 | ps.gz, pdf, bbl, idx, sty, syms | |
| 741 | ||
| 742 | Run LaTeX (and related tools) on FILE (default root.tex), | |
| 743 | producing the specified output format. | |
| 744 | \end{ttbox}
 | |
| 745 | ||
| 746 |   Appropriate {\LaTeX}-related programs are run on the input file,
 | |
| 747 |   according to the given output format: @{executable latex},
 | |
| 748 |   @{executable pdflatex}, @{executable dvips}, @{executable bibtex}
 | |
| 749 |   (for @{verbatim bbl}), and @{executable makeindex} (for @{verbatim
 | |
| 750 | idx}). The actual commands are determined from the settings | |
| 751 |   environment (@{setting ISABELLE_LATEX} etc.).
 | |
| 752 | ||
| 753 |   The @{verbatim sty} output format causes the Isabelle style files to
 | |
| 754 | be updated from the distribution. This is useful in special | |
| 755 | situations where the document sources are to be processed another | |
| 756 |   time by separate tools (cf.\ option @{verbatim "-D"} of the @{tool
 | |
| 757 | usedir} utility). | |
| 758 | ||
| 759 |   The @{verbatim syms} output is for internal use; it generates lists
 | |
| 760 |   of symbols that are available without loading additional {\LaTeX}
 | |
| 761 | packages. | |
| 762 | *} | |
| 763 | ||
| 764 | ||
| 765 | subsubsection {* Examples *}
 | |
| 766 | ||
| 767 | text {*
 | |
| 28504 
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
 wenzelm parents: 
28238diff
changeset | 768 |   Invoking @{verbatim isabelle} @{tool latex} by hand may be
 | 
| 28238 | 769 | occasionally useful when debugging failed attempts of the automatic | 
| 770 | document preparation stage of batch-mode Isabelle. The abortive | |
| 771 |   process leaves the sources at a certain place within @{setting
 | |
| 28221 | 772 | ISABELLE_BROWSER_INFO}, see the runtime error message for details. | 
| 773 |   This enables users to inspect {\LaTeX} runs in further detail, e.g.\
 | |
| 774 | like this: | |
| 775 | \begin{ttbox}
 | |
| 40387 
e4c9e0dad473
moved ISABELLE_IDENTIFIER from ISABELLE_OUTPUT further up to ISABELLE_HOME_USER;
 wenzelm parents: 
35587diff
changeset | 776 | cd ~/.isabelle/IsabelleXXXX/browser_info/HOL/Test/document | 
| 28504 
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
 wenzelm parents: 
28238diff
changeset | 777 | isabelle latex -o pdf | 
| 28221 | 778 | \end{ttbox}
 | 
| 779 | *} | |
| 780 | ||
| 781 | end |