| 3188 |      1 | 
 | 
|  |      2 | % $Id$
 | 
|  |      3 | 
 | 
| 3278 |      4 | \chapter{Miscellaneous tools} \label{ch:tools}
 | 
| 3188 |      5 | 
 | 
| 3217 |      6 | Subsequently we describe various Isabelle related utilities --- in
 | 
|  |      7 | alphabetical order.
 | 
|  |      8 | 
 | 
|  |      9 | 
 | 
|  |     10 | \section{Viewing documentation --- \texttt{isatool doc}} \label{sec:tool-doc}
 | 
|  |     11 | 
 | 
|  |     12 | The \tooldx{doc} utility displays online documentation:
 | 
|  |     13 | \begin{ttbox}
 | 
|  |     14 | Usage: isatool doc [DOC]
 | 
|  |     15 | 
 | 
|  |     16 |   View Isabelle documentation DOC, or show list of available documents.
 | 
|  |     17 | \end{ttbox}
 | 
| 7882 |     18 | If called without arguments, it lists all available documents. Each line
 | 
|  |     19 | starts with an identifier, followed by a short description. Any of these
 | 
|  |     20 | identifiers may be specified as the first argument in order to have the
 | 
|  |     21 | corresponding document displayed.
 | 
| 3217 |     22 | 
 | 
| 7882 |     23 | \medskip The \texttt{ISABELLE_DOCS} setting specifies the list of directories
 | 
|  |     24 | (separated by colons) to be scanned for documentations.  The program for
 | 
|  |     25 | viewing \texttt{dvi} files is determined by the \texttt{DVI_VIEWER} setting.
 | 
| 3217 |     26 | 
 | 
|  |     27 | 
 | 
|  |     28 | \section{Tuning proof scripts --- \texttt{isatool expandshort}}
 | 
|  |     29 | 
 | 
|  |     30 | The \tooldx{expandshort} utility tunes {\ML} proof scripts to enhance
 | 
| 4540 |     31 | readability:
 | 
| 3217 |     32 | \begin{ttbox}
 | 
| 4540 |     33 | Usage: expandshort [FILES|DIRS...]
 | 
| 3217 |     34 | 
 | 
| 7498 |     35 |   Recursively find .ML files, expand shorthand goal commands.  Also
 | 
|  |     36 |   contracts uses of resolve_tac, dresolve_tac, eresolve_tac,
 | 
| 7883 |     37 |   forward_tac, rewrite_goals_tac on 1-element lists; furthermore
 | 
|  |     38 |   expands tabs, which are forbidden in SML string constants.
 | 
| 3217 |     39 | 
 | 
| 4540 |     40 |   Renames old versions of files by appending "~~".
 | 
| 3217 |     41 | \end{ttbox}
 | 
| 7882 |     42 | In the files or directories supplied as arguments, all occurrences of the
 | 
|  |     43 | shorthand commands \texttt{br}, \texttt{be} etc.\ in proof scripts are
 | 
|  |     44 | replaced with the corresponding full commands.  The old versions of the files
 | 
|  |     45 | are renamed to have the suffix``~\verb'~~'''.
 | 
| 4540 |     46 | 
 | 
| 3217 |     47 | 
 | 
| 5366 |     48 | \section{Getting logic images --- \texttt{isatool findlogics}}
 | 
| 3217 |     49 | 
 | 
|  |     50 | The \tooldx{findlogics} utility traverses all directories specified in
 | 
| 7882 |     51 | \texttt{ISABELLE_PATH}, looking for Isabelle logic images. Its usage is:
 | 
| 3217 |     52 | \begin{ttbox}
 | 
|  |     53 | Usage: isatool findlogics
 | 
|  |     54 | 
 | 
|  |     55 |   Collect heap file names from ISABELLE_PATH.
 | 
|  |     56 | \end{ttbox}
 | 
| 6414 |     57 | The base names of all files found on the path are printed --- sorted and with
 | 
| 9790 |     58 | duplicates removed. Also note that lookup in \texttt{ISABELLE_PATH} includes
 | 
|  |     59 | the current values of \texttt{ML_SYSTEM} and \texttt{ML_PLATFORM}. Thus
 | 
|  |     60 | switching to another {\ML} compiler may change the set of logic images
 | 
|  |     61 | available.
 | 
| 3217 |     62 | 
 | 
| 3188 |     63 | 
 | 
|  |     64 | \section{Inspecting the settings environment -- \texttt{isatool getenv}}
 | 
|  |     65 | \label{sec:tool-getenv}
 | 
|  |     66 | 
 | 
| 7882 |     67 | The Isabelle settings environment --- as provided by the site-default and
 | 
|  |     68 | user-specific settings files --- can be inspected with the \tooldx{getenv}
 | 
|  |     69 | utility:
 | 
| 3188 |     70 | \begin{ttbox}
 | 
|  |     71 | Usage: isatool getenv [OPTIONS] [VARNAMES ...]
 | 
|  |     72 | 
 | 
|  |     73 |   Options are:
 | 
|  |     74 |     -a           display complete environment
 | 
|  |     75 |     -b           print values only (doesn't work for -a)
 | 
|  |     76 | 
 | 
|  |     77 |   Get value of VARNAMES from the Isabelle settings.
 | 
|  |     78 | \end{ttbox}
 | 
|  |     79 | 
 | 
| 7882 |     80 | With the \texttt{-a} option, one may inspect the full process environment that
 | 
|  |     81 | Isabelle related programs are run in. This usually contains much more
 | 
|  |     82 | variables than are actually Isabelle settings.  Normally, output is a list of
 | 
|  |     83 | lines of the form \mbox{$name$\texttt{=}$value$}. The \texttt{-b} option
 | 
|  |     84 | causes only the values to be printed.
 | 
| 3188 |     85 | 
 | 
|  |     86 | 
 | 
|  |     87 | \subsection*{Examples}
 | 
|  |     88 | 
 | 
| 9790 |     89 | Get the {\ML} system name and the location where the compiler binaries are
 | 
|  |     90 | supposed to reside as follows:
 | 
| 3188 |     91 | \begin{ttbox}
 | 
|  |     92 | isatool getenv ML_SYSTEM ML_HOME
 | 
| 9790 |     93 | {\out ML_SYSTEM=polyml}
 | 
|  |     94 | {\out ML_HOME=/usr/share/polyml/x86-linux}
 | 
| 3188 |     95 | \end{ttbox}
 | 
|  |     96 | 
 | 
| 9790 |     97 | The next one peeks at the output directory for \texttt{isabelle} logic images:
 | 
| 3188 |     98 | \begin{ttbox}
 | 
| 9790 |     99 | isatool getenv -b ISABELLE_OUTPUT
 | 
|  |    100 | {\out /home/me/isabelle/heaps/polyml_x86-linux}
 | 
| 3188 |    101 | \end{ttbox}
 | 
| 4555 |    102 | Here we have used the \texttt{-b} option to suppress the
 | 
| 9790 |    103 | \texttt{ISABELLE_OUTPUT=} prefix.  The value above is what became of the
 | 
| 4555 |    104 | following assignment in the default settings file:
 | 
| 3188 |    105 | \begin{ttbox}
 | 
| 9790 |    106 | ISABELLE_OUTPUT="\$ISABELLE_HOME_USER/heaps"
 | 
| 3188 |    107 | \end{ttbox}
 | 
| 9790 |    108 | Note how the \texttt{ML_IDENTIFIER} value got appended automatically to each
 | 
|  |    109 | path component. This is a special feature of \texttt{ISABELLE_OUTPUT}.
 | 
| 3188 |    110 | 
 | 
|  |    111 | 
 | 
| 6418 |    112 | \section{Installing standalone Isabelle executables -- \texttt{isatool install}}
 | 
| 7882 |    113 | \label{sec:tool-install}
 | 
| 5366 |    114 | 
 | 
| 7882 |    115 | By default, the Isabelle binaries (\texttt{isabelle}, \texttt{isatool} etc.)
 | 
|  |    116 | are just run from their location within the distribution directory, probably
 | 
| 6418 |    117 | indirectly by the shell through its \texttt{PATH}.  Other schemes of
 | 
|  |    118 | installation are supported by the \tooldx{install} utility:
 | 
| 5366 |    119 | \begin{ttbox}
 | 
| 6418 |    120 | Usage: install [OPTIONS]
 | 
| 5366 |    121 | 
 | 
| 5405 |    122 |   Options are:
 | 
| 7883 |    123 |     -d DISTDIR   use DISTDIR as Isabelle distribution
 | 
|  |    124 |                  (default ISABELLE_HOME)
 | 
| 6418 |    125 |     -k           install KDE application icon on Desktop
 | 
|  |    126 |     -p DIR       install standalone binaries in DIR
 | 
| 5405 |    127 | 
 | 
| 6418 |    128 |   Install Isabelle executables with absolute references to the current
 | 
|  |    129 |   distribution directory.
 | 
| 5366 |    130 | \end{ttbox}
 | 
|  |    131 | 
 | 
| 6418 |    132 | The \texttt{-d} option overrides the current Isabelle distribution directory
 | 
|  |    133 | as determined by \texttt{ISABELLE_HOME}.
 | 
|  |    134 | 
 | 
|  |    135 | The \texttt{-p} option installs executable wrapper scripts for
 | 
|  |    136 | \texttt{isabelle}, \texttt{isatool}, \texttt{Isabelle}, containing proper
 | 
|  |    137 | absolute references to the Isabelle distribution directory.  A typical
 | 
|  |    138 | \texttt{DIR} specification would be some directory expected to be in the
 | 
|  |    139 | shell's \texttt{PATH}, such as \texttt{/usr/local/bin}.  It is important to
 | 
|  |    140 | note that a plain manual copy of the original Isabelle executables just would
 | 
|  |    141 | not work!
 | 
|  |    142 | 
 | 
| 7882 |    143 | The \texttt{-k} option creates an Isabelle application object for the popular
 | 
|  |    144 | \textsl{K~Desktop Environment} (KDE)\index{KDE}.  The icon will appear
 | 
|  |    145 | directly on Desktop.
 | 
| 5366 |    146 | 
 | 
|  |    147 | 
 | 
| 5571 |    148 | \section{Creating instances of the Isabelle logo -- \texttt{isatool
 | 
|  |    149 |     logo}}
 | 
|  |    150 | 
 | 
|  |    151 | The \tooldx{logo} utility creates any instance of the generic Isabelle logo as
 | 
|  |    152 | an Encapsuled Postscript file (EPS):
 | 
|  |    153 | \begin{ttbox}
 | 
|  |    154 | Usage: logo [OPTIONS] NAME
 | 
|  |    155 | 
 | 
|  |    156 |   Create instance NAME of the Isabelle logo (as EPS).
 | 
|  |    157 | 
 | 
|  |    158 |   Options are:
 | 
|  |    159 |     -o OUTFILE   set output file (default determined from NAME)
 | 
|  |    160 |     -q           quiet mode
 | 
|  |    161 | \end{ttbox}
 | 
|  |    162 | You are encouraged to use this to create a derived logo for your Isabelle
 | 
|  |    163 | project.  For example, \texttt{isatool logo HOOL} creates
 | 
|  |    164 | \texttt{isabelle_hool.eps}.
 | 
|  |    165 | 
 | 
|  |    166 | 
 | 
| 3188 |    167 | \section{Isabelle's version of make --- \texttt{isatool make}}
 | 
|  |    168 | 
 | 
| 3217 |    169 | The Isabelle \tooldx{make} utility is a very simple wrapper for
 | 
|  |    170 | ordinary Unix \texttt{make}:
 | 
| 3188 |    171 | \begin{ttbox}
 | 
|  |    172 | Usage: isatool make [ARGS ...]
 | 
|  |    173 | 
 | 
| 7801 |    174 |   Compile the logic in current directory using IsaMakefile.
 | 
| 3188 |    175 |   ARGS are directly passed to the system make program.
 | 
|  |    176 | \end{ttbox}
 | 
| 3217 |    177 | Note that the Isabelle settings environment is also active. Thus one
 | 
| 3278 |    178 | may refer to its values within the \ttindex{IsaMakefile}, e.g.\ 
 | 
| 3217 |    179 | \texttt{\$(ISABELLE_OUTPUT)}. Furthermore, programs started from the
 | 
| 3278 |    180 | make file also inherit this environment.  Typically,
 | 
|  |    181 | \texttt{IsaMakefile}s defer the real work to the \texttt{usedir}
 | 
|  |    182 | utility, see \S\ref{sec:tool-usedir}.
 | 
| 3217 |    183 | 
 | 
| 3278 |    184 | \medskip The basic \texttt{IsaMakefile} convention is that the default
 | 
| 4540 |    185 | target builds the actual logic, including its parents if appropriate.
 | 
| 4555 |    186 | The \texttt{images} target is intended to build all local logic
 | 
|  |    187 | images, while the \texttt{test} target shall build all related
 | 
|  |    188 | examples.  The \texttt{all} target shall do \texttt{images} and
 | 
|  |    189 | \texttt{test}.
 | 
| 4540 |    190 | 
 | 
|  |    191 | 
 | 
|  |    192 | \subsection*{Examples}
 | 
|  |    193 | 
 | 
|  |    194 | Refer to the \texttt{IsaMakefile}s of the Isabelle distribution's
 | 
| 4555 |    195 | object-logics as a model for your own developements.  For example, see
 | 
|  |    196 | \texttt{src/FOL/IsaMakefile}.
 | 
| 4540 |    197 | 
 | 
|  |    198 | 
 | 
|  |    199 | \section{Make all logics -- \texttt{isatool makeall}}
 | 
|  |    200 | 
 | 
|  |    201 | The \tooldx{makeall} utility applies Isabelle make to all logic
 | 
| 4555 |    202 | directories of the distribution:
 | 
| 4540 |    203 | \begin{ttbox}
 | 
|  |    204 | Usage: makeall [ARGS ...]
 | 
|  |    205 | 
 | 
|  |    206 |   Apply isatool make to all logics (passing ARGS).
 | 
|  |    207 | \end{ttbox}
 | 
| 4555 |    208 | The arguments \texttt{ARGS} are just passed verbatim to each
 | 
| 4540 |    209 | \texttt{make} invocation.
 | 
| 3188 |    210 | 
 | 
| 5366 |    211 | %%% Local Variables: 
 | 
|  |    212 | %%% mode: latex
 | 
|  |    213 | %%% TeX-master: "system"
 | 
|  |    214 | %%% End: 
 |