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}
|
|
18 |
If called without arguments, it lists all available documents. Each
|
|
19 |
line starts with an identifier, followed by some comment. Any of these
|
|
20 |
identifiers may be specified as the first argument in order to have
|
|
21 |
the corresponding document displayed.
|
|
22 |
|
|
23 |
\medskip The \texttt{ISABELLE_DOCS} setting specifies the list of
|
|
24 |
directories (separated by colons) to be scanned for documentations.
|
4540
|
25 |
The program for viewing \texttt{dvi} files is determined by the
|
|
26 |
\texttt{DVI_VIEWER} setting.
|
3217
|
27 |
|
|
28 |
|
|
29 |
\section{Tuning proof scripts --- \texttt{isatool expandshort}}
|
|
30 |
|
|
31 |
The \tooldx{expandshort} utility tunes {\ML} proof scripts to enhance
|
4540
|
32 |
readability:
|
3217
|
33 |
\begin{ttbox}
|
4540
|
34 |
Usage: expandshort [FILES|DIRS...]
|
3217
|
35 |
|
4540
|
36 |
Recursively find .ML files, expand shorthand goal commands.
|
|
37 |
Also contracts uses of resolve_tac, dresolve_tac, eresolve_tac,
|
|
38 |
rewrite_goals_tac on 1-element lists; furthermore expands tabs,
|
|
39 |
since they are now forbidden in ML string constants.
|
3217
|
40 |
|
4540
|
41 |
Renames old versions of files by appending "~~".
|
3217
|
42 |
\end{ttbox}
|
4540
|
43 |
In the files or directories supplied as arguments, all occurrences of
|
|
44 |
the shorthand commands \texttt{br}, \texttt{be} etc.\ in proof scripts
|
|
45 |
are replaced with the corresponding full commands. The old versions
|
|
46 |
of the files are renamed to have the suffix~\verb'~~'.
|
|
47 |
|
3217
|
48 |
|
|
49 |
\section{Get logic images --- \texttt{isatool findlogics}}
|
|
50 |
|
|
51 |
The \tooldx{findlogics} utility traverses all directories specified in
|
|
52 |
\texttt{ISABELLE_PATH}, looking for Isabelle logic images. Its usage
|
|
53 |
is:
|
|
54 |
\begin{ttbox}
|
|
55 |
Usage: isatool findlogics
|
|
56 |
|
|
57 |
Collect heap file names from ISABELLE_PATH.
|
|
58 |
\end{ttbox}
|
|
59 |
The base names of all files found on the path are printed --- sorted
|
|
60 |
and with duplicates removed. Also note that \texttt{ISABELLE_PATH}
|
3262
|
61 |
implicitly depends upon \texttt{ML_SYSTEM}. Thus switching to another
|
3217
|
62 |
{\ML} compiler may change the set of logic images available.
|
|
63 |
|
3188
|
64 |
|
|
65 |
\section{Inspecting the settings environment -- \texttt{isatool getenv}}
|
|
66 |
\label{sec:tool-getenv}
|
|
67 |
|
|
68 |
The Isabelle settings environment --- as provided by the site-default
|
|
69 |
and user-specific settings files --- can be inspected with the
|
|
70 |
\tooldx{getenv} utility:
|
|
71 |
\begin{ttbox}
|
|
72 |
Usage: isatool getenv [OPTIONS] [VARNAMES ...]
|
|
73 |
|
|
74 |
Options are:
|
|
75 |
-a display complete environment
|
|
76 |
-b print values only (doesn't work for -a)
|
|
77 |
|
|
78 |
Get value of VARNAMES from the Isabelle settings.
|
|
79 |
\end{ttbox}
|
|
80 |
|
|
81 |
With the \texttt{-a} option, one may inspect the full process
|
|
82 |
environment that Isabelle related programs are run in. This usually
|
|
83 |
contains much more variables than are actually Isabelle settings.
|
4540
|
84 |
Normally, output is a list of lines of the form
|
3217
|
85 |
\mbox{$varname$\texttt{=}$value$}. The \texttt{-b} option causes only
|
|
86 |
the values to be printed.
|
3188
|
87 |
|
|
88 |
|
|
89 |
\subsection*{Examples}
|
|
90 |
|
|
91 |
Get the {\ML} system identifier and the location where the compiler
|
3217
|
92 |
binaries are supposed to reside as follows:
|
3188
|
93 |
\begin{ttbox}
|
|
94 |
isatool getenv ML_SYSTEM ML_HOME
|
4540
|
95 |
{\out ML_SYSTEM=smlnj-110}
|
|
96 |
{\out ML_HOME=/usr/local/smlnj-110/bin}
|
3188
|
97 |
\end{ttbox}
|
|
98 |
|
3217
|
99 |
The next one peeks at the search path that \texttt{isabelle} uses to
|
3188
|
100 |
locate logic images:
|
|
101 |
\begin{ttbox}
|
|
102 |
isatool getenv -b ISABELLE_PATH
|
4540
|
103 |
{\out /home/me/isabelle/heaps/smlnj-110:/usr/local/isabelle/heaps/smlnj-110}
|
3188
|
104 |
\end{ttbox}
|
|
105 |
We used the \texttt{-b} option to suppress the \texttt{ISABELLE_PATH=}
|
|
106 |
prefix. The value above is what became of the following assignment in
|
|
107 |
the default settings file:
|
|
108 |
\begin{ttbox}
|
|
109 |
ISABELLE_PATH=\$ISABELLE_HOME_USER/heaps:\$ISABELLE_HOME/heaps
|
|
110 |
\end{ttbox}
|
3217
|
111 |
Note how the \texttt{ML_SYSTEM} value got appended automatically to
|
|
112 |
each path component. This is a special feature of
|
|
113 |
\texttt{ISABELLE_PATH} (and also of \texttt{ISABELLE_OUTPUT}).
|
3188
|
114 |
|
|
115 |
|
|
116 |
\section{Isabelle's version of make --- \texttt{isatool make}}
|
|
117 |
|
3217
|
118 |
The Isabelle \tooldx{make} utility is a very simple wrapper for
|
|
119 |
ordinary Unix \texttt{make}:
|
3188
|
120 |
\begin{ttbox}
|
|
121 |
Usage: isatool make [ARGS ...]
|
|
122 |
|
|
123 |
Compiles logic in current directory using IsaMakefile.
|
|
124 |
ARGS are directly passed to the system make program.
|
|
125 |
\end{ttbox}
|
3217
|
126 |
Note that the Isabelle settings environment is also active. Thus one
|
3278
|
127 |
may refer to its values within the \ttindex{IsaMakefile}, e.g.\
|
3217
|
128 |
\texttt{\$(ISABELLE_OUTPUT)}. Furthermore, programs started from the
|
3278
|
129 |
make file also inherit this environment. Typically,
|
|
130 |
\texttt{IsaMakefile}s defer the real work to the \texttt{usedir}
|
|
131 |
utility, see \S\ref{sec:tool-usedir}.
|
3217
|
132 |
|
3278
|
133 |
\medskip The basic \texttt{IsaMakefile} convention is that the default
|
4540
|
134 |
target builds the actual logic, including its parents if appropriate.
|
|
135 |
The \texttt{images} target is intended to build all logic images,
|
|
136 |
while the \texttt{test} target shall build all related examples. The
|
|
137 |
\texttt{all} target shall build the images and run the examples.
|
|
138 |
|
|
139 |
|
|
140 |
\subsection*{Examples}
|
|
141 |
|
|
142 |
Refer to the \texttt{IsaMakefile}s of the Isabelle distribution's
|
|
143 |
object-logics as a model for your own developements.
|
|
144 |
|
|
145 |
|
|
146 |
\section{Make all logics -- \texttt{isatool makeall}}
|
|
147 |
|
|
148 |
The \tooldx{makeall} utility applies Isabelle make to all logic
|
|
149 |
directories of the Isabelle distribution:
|
|
150 |
\begin{ttbox}
|
|
151 |
Usage: makeall [ARGS ...]
|
|
152 |
|
|
153 |
Apply isatool make to all logics (passing ARGS).
|
|
154 |
\end{ttbox}
|
|
155 |
The arguments \texttt{ARGS} are just passed verbatim to any
|
|
156 |
\texttt{make} invocation.
|
3188
|
157 |
|
|
158 |
|
3217
|
159 |
\section{Running complete logics --- \texttt{isatool usedir}} \label{sec:tool-usedir}
|
3188
|
160 |
|
3262
|
161 |
The \tooldx{usedir} utility builds object-logic images, or runs
|
|
162 |
example sessions based on existing logics. Its usage is:
|
3188
|
163 |
\begin{ttbox}
|
3752
|
164 |
Usage: usedir LOGIC NAME
|
3188
|
165 |
|
|
166 |
Options are:
|
|
167 |
-b build mode (output heap image, use dir ".")
|
3752
|
168 |
-i BOOL generate theory browsing information,
|
|
169 |
i.e. HTML / graph data (default false)
|
3188
|
170 |
-s NAME override session NAME
|
|
171 |
|
|
172 |
Build object-logic or run examples. Also creates browsing
|
|
173 |
information (HTML etc.) according to settings.
|
|
174 |
\end{ttbox}
|
|
175 |
|
3262
|
176 |
The value of the \settdx{ISABELLE_USEDIR_OPTIONS} setting is
|
3278
|
177 |
implicitly prefixed to \emph{any} \texttt{usedir} call. Since the
|
3262
|
178 |
\ttindex{IsaMakefile}s of all object-logics distributed with Isabelle
|
|
179 |
just invoke \texttt{usedir} for the real work, one may control
|
|
180 |
compilation options globally via above variable. In particular,
|
|
181 |
generation of \rmindex{HTML} browsing information is enabled or
|
|
182 |
disabled this way.
|
|
183 |
|
|
184 |
|
|
185 |
\subsection*{Options}
|
|
186 |
|
3278
|
187 |
Basically, there are two different modes of operation: \emph{build
|
|
188 |
mode} (enabled through the \texttt{-b} option) and \emph{example
|
4540
|
189 |
mode} (default).
|
3262
|
190 |
|
|
191 |
Calling \texttt{usedir} with \texttt{-b} runs \texttt{isabelle} with
|
3278
|
192 |
input image \texttt{LOGIC} and output to \texttt{NAME}, as provided on
|
4540
|
193 |
the command line. This will be a batch session, running
|
|
194 |
\texttt{ROOT.ML} from the current directory and then quitting. It is
|
|
195 |
assumed that \texttt{ROOT.ML} contains all {\ML} commands required to
|
|
196 |
build the logic.
|
3262
|
197 |
|
|
198 |
In example mode, on the other hand, \texttt{usedir} runs a read-only
|
4540
|
199 |
session of \texttt{LOGIC} (typically just built before) and
|
|
200 |
automatically runs \texttt{ROOT.ML} from within directory
|
|
201 |
\texttt{NAME}. I.e.\ it assumes that some file \texttt{ROOT.ML} in
|
|
202 |
directory \texttt{NAME} contains appropriate {\ML} commands to run the
|
|
203 |
desired examples.
|
3262
|
204 |
|
3752
|
205 |
\medskip The \texttt{-i} option controls theory browsing data
|
3262
|
206 |
generation. It may be explicitely turned on or off --- the last
|
3752
|
207 |
occurrence of some \texttt{-i} on the command line wins.
|
3262
|
208 |
|
|
209 |
\medskip Any \texttt{usedir} session is named by some \emph{session
|
3278
|
210 |
identifier}. These accumulate, documenting the way sessions depend
|
|
211 |
on others. For example, consider \texttt{Pure/FOL/ZF/ex}, which refers
|
|
212 |
to the examples of {\ZF} set theory, built upon {\FOL}, built upon
|
3262
|
213 |
{\Pure}.
|
|
214 |
|
|
215 |
The current session's identifier is by default just the base name of
|
3278
|
216 |
the \texttt{LOGIC} argument (in build mode), or of the \texttt{NAME}
|
3262
|
217 |
argument (in example mode). This may be overridden explicitely via the
|
|
218 |
\texttt{-s} option.
|
|
219 |
|
|
220 |
|
|
221 |
\subsection*{Examples}
|
|
222 |
|
|
223 |
Refer to the \texttt{IsaMakefile}s of the Isabelle distribution's
|
|
224 |
object-logics as a model for your own developements.
|