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