4540
|
1 |
|
3753
|
2 |
%% $Id$
|
3188
|
3 |
|
|
4 |
\chapter{Presenting theories}
|
|
5 |
|
3753
|
6 |
\section{Generating theory browsing information} \label{sec:info}
|
4540
|
7 |
\index{theory browsing information|bold}
|
3188
|
8 |
|
4540
|
9 |
Isabelle is able to generate theory browsing information, such as HTML
|
|
10 |
documents that show a theory's definition, the theorems proved in its
|
|
11 |
ML file and the relationship with its ancestors and descendants. HTML
|
|
12 |
is the hypertext markup language used on the World Wide Web to
|
|
13 |
represent text containing links to other documents. These documents
|
|
14 |
may be viewed using Web browsers like Netscape or Lynx.
|
3188
|
15 |
|
|
16 |
Besides the three HTML files that are made for every theory
|
|
17 |
(definition and theorems, ancestors, descendants), Isabelle stores
|
|
18 |
links to all theories in an index file. These indexes are themself
|
|
19 |
linked with other indexes to represent the hierarchic structure of
|
|
20 |
Isabelle's logics.
|
|
21 |
|
4555
|
22 |
In addition to the HTML files, Isabelle also generates \emph{graph}
|
4540
|
23 |
files that represent the theory hierarchy of a logic. These graphs
|
|
24 |
can be comfortably displayed by a graph browser Java applet embedded
|
|
25 |
in the generated HTML pages. There is also a stand-alone version of
|
|
26 |
the graph browser which allows browsing theory graphs without having
|
|
27 |
to start a Web browser first. This version also includes features such
|
|
28 |
as generating {\sc PostScript} files, which are not available in the
|
|
29 |
applet version. The graph browser will be described later in this
|
|
30 |
chapter.
|
3753
|
31 |
|
4540
|
32 |
\medskip To generate theory browsing information for logics that are
|
|
33 |
part of the Isabelle distribution, simply append ``\texttt{-i true}''
|
|
34 |
to the \settdx{ISABELLE_USEDIR_OPTIONS} setting before making a logic.
|
|
35 |
For example, to generate browsing information for {\FOL}, first add
|
4555
|
36 |
something like this to your Isabelle settings file:
|
3188
|
37 |
\begin{ttbox}
|
3753
|
38 |
ISABELLE_USEDIR_OPTIONS="-i true"
|
3188
|
39 |
\end{ttbox}
|
3217
|
40 |
Then \texttt{cd} into the \texttt{src/FOL} directory of the Isabelle
|
4555
|
41 |
distribution and do \texttt{isatool make} (or even \texttt{isatool
|
|
42 |
make all}).
|
3753
|
43 |
|
4540
|
44 |
\medskip The directory in which to store theory browsing information
|
|
45 |
is determined by the \settdx{ISABELLE_BROWSER_INFO} setting.
|
3188
|
46 |
|
3217
|
47 |
\medskip As some of Isabelle's logics are based on others (e.g. {\tt
|
|
48 |
ZF} on {\tt FOL}) and because the HTML files list a theory's
|
|
49 |
ancestors, you should not make HTML files for a logic if the HTML
|
|
50 |
files for the base logic do not exist. Otherwise some of the hypertext
|
|
51 |
links might point to non-existing documents.
|
3188
|
52 |
|
|
53 |
The entry point to all logics is the {\tt index.html} file located in
|
3753
|
54 |
the directory denoted by \texttt{ISABELLE_BROWSER_INFO}.
|
3188
|
55 |
|
3217
|
56 |
A complete HTML version of all distributed Isabelle object-logics and
|
|
57 |
examples may be accessed on the WWW at:
|
3188
|
58 |
\begin{ttbox}
|
3753
|
59 |
http://www4.informatik.tu-muenchen.de/~isabelle/library/
|
3188
|
60 |
\end{ttbox}
|
4555
|
61 |
Of course, this is not necessarily consistent with your local version!
|
3188
|
62 |
|
3753
|
63 |
To present your own theories on the WWW, simply copy the whole
|
|
64 |
\texttt{ISABELLE_BROWSER_INFO} directory to your WWW server.
|
3188
|
65 |
|
4540
|
66 |
|
3753
|
67 |
\section{Extending or adding a logic}
|
3188
|
68 |
|
3217
|
69 |
If you add a new subdirectory to Isabelle's logics (or add a
|
3753
|
70 |
completely new logic), provide a {\tt ROOT.ML} file which reads in the
|
4540
|
71 |
theory files. The {\tt ROOT.ML} file will then be processed via the
|
|
72 |
function
|
3188
|
73 |
|
|
74 |
\begin{ttbox}\index{*use_dir}
|
|
75 |
use_dir : string -> unit
|
|
76 |
\end{ttbox}
|
|
77 |
|
4540
|
78 |
which takes a path as its parameter, changes the working directory,
|
|
79 |
executes {\tt ROOT.ML}, and makes sure that theory browsing
|
|
80 |
information is generated properly. The {\tt index.html} file written
|
|
81 |
in this directory will be automatically linked to the first index
|
|
82 |
found in the (recursively searched) super directories.
|
3188
|
83 |
|
3217
|
84 |
The \texttt{usedir} utility (see also \S\ref{sec:tool-usedir}) will
|
|
85 |
automatically take care of this.
|
3188
|
86 |
|
3217
|
87 |
\medskip The generated HTML files contain all theorems that were
|
|
88 |
proved in the theory's \ML{} file with {\tt qed}, {\tt qed_goal} and
|
|
89 |
{\tt qed_goalw}, or stored with {\tt bind_thm} and {\tt store_thm}.
|
|
90 |
Additionally, there is a hypertext link to the whole \ML{} file.
|
3188
|
91 |
|
|
92 |
You can add section headings to the list of theorems by using
|
|
93 |
|
|
94 |
\begin{ttbox}\index{*use_dir}
|
|
95 |
section: string -> unit
|
|
96 |
\end{ttbox}
|
|
97 |
|
4540
|
98 |
in a theory's ML file, which converts a plain string to a HTML heading
|
|
99 |
and inserts it before the next theorem proved or stored with one of
|
|
100 |
the above functions.
|
3188
|
101 |
|
|
102 |
|
3753
|
103 |
%\section*{*Using someone else's database}
|
|
104 |
%
|
|
105 |
%To make them independent from their storage place, the HTML files only
|
|
106 |
%contain relative paths which are derived from absolute ones like the
|
|
107 |
%current working directory, {\tt gif_path} or {\tt base_path}. The
|
|
108 |
%latter two are reference variables which are initialized at the time
|
|
109 |
%when the {\tt Pure} database is made. Because you need write access
|
|
110 |
%for the current directory to make HTML files and therefore (probably)
|
|
111 |
%generate them in your home directory, the absolute {\tt base_path} is
|
|
112 |
%not correct if you use someone else's database or a database derived
|
|
113 |
%from it.
|
|
114 |
%
|
|
115 |
%In that case you first should set {\tt base_path} to the value of {\em
|
|
116 |
%your} Isabelle main directory, i.e. the directory that contains the
|
|
117 |
%subdirectories where standard logics like {\tt FOL} and {\tt HOL} or
|
|
118 |
%your own logics are stored. If you do not do this, the generated HTML
|
|
119 |
%files will still be usable but may contain incomplete titles and lack
|
|
120 |
%some hypertext links.
|
|
121 |
%
|
|
122 |
%It's also a good idea to set {\tt gif_path} which points to the
|
|
123 |
%directory containing two GIF images used in the HTML documents.
|
|
124 |
%Normally this is the \texttt{src/Tools} subdirectory of Isabelle's
|
|
125 |
%main directory. While its value in general is still valid, your HTML
|
|
126 |
%files would depend on files not owned by you. This prevents you from
|
|
127 |
%changing the location of the HTML files (as they contain relative
|
|
128 |
%paths) and also causes trouble if the database's maker (re)moves the
|
|
129 |
%GIFs.
|
|
130 |
%
|
|
131 |
%Here's what you should do before invoking {\tt init_html} using
|
|
132 |
%someone else's \ML{} database:
|
|
133 |
%
|
|
134 |
%\begin{ttbox}
|
|
135 |
%base_path := "/home/someone/Isabelle-dist/src";
|
|
136 |
%gif_path := "/home/someone/Isabelle-dist/src/Tools";
|
|
137 |
%init_html();
|
|
138 |
%\dots
|
|
139 |
%\end{ttbox}
|
3188
|
140 |
|
3753
|
141 |
|
|
142 |
\section{Browsing theory graphs} \label{sec:browse}
|
|
143 |
\index{theory graph browser|bold}
|
|
144 |
|
4540
|
145 |
The graph browser is a tool for visualizing dependency graphs of
|
|
146 |
Isabelle theories. Certain nodes of the graph (i.e.~theories) can be
|
|
147 |
grouped together in ``directories'', whose contents may be hidden,
|
|
148 |
thus enabling the user to filter out irrelevant information. The
|
|
149 |
browser is written in Java, it can be used both as a stand-alone
|
|
150 |
application and as an applet.
|
|
151 |
|
3188
|
152 |
|
3753
|
153 |
\subsection{Invoking the graph browser}
|
4540
|
154 |
|
|
155 |
The stand-alone version of the graph browser is wrapped up as an
|
|
156 |
Isabelle tool called \tooldx{browser}:
|
3753
|
157 |
\begin{ttbox}
|
4540
|
158 |
Usage: browser [GRAPHFILE]
|
3753
|
159 |
\end{ttbox}
|
4540
|
160 |
When no filename is specified, the browser automatically changes to
|
|
161 |
the directory \texttt{ISABELLE_BROWSER_INFO/graph/data}.
|
3753
|
162 |
|
4540
|
163 |
\medskip The applet version of the browser can be invoked by opening
|
|
164 |
the {\tt index.html} file in the directory
|
|
165 |
\texttt{ISABELLE_BROWSER_INFO} from your Web browser and selecting
|
|
166 |
``version for Java capable browsers''. There is also a link to the
|
|
167 |
corresponding theory graph in every logic's {\tt index.html} file.
|
|
168 |
|
3188
|
169 |
|
3753
|
170 |
\subsection{Using the graph browser}
|
4540
|
171 |
|
|
172 |
The browser's main window, which is shown in figure
|
|
173 |
\ref{browserwindow}, consists of two subwindows: In the left
|
|
174 |
subwindow, the directory tree is displayed. The graph itself is
|
|
175 |
displayed in the right subwindow.
|
3753
|
176 |
\begin{figure}[h]
|
4540
|
177 |
\includegraphics[width=\textwidth]{browser_screenshot.eps}
|
|
178 |
\caption{\label{browserwindow} Browser main window}
|
3753
|
179 |
\end{figure}
|
|
180 |
|
4540
|
181 |
|
3753
|
182 |
\subsubsection*{The directory tree window}
|
4540
|
183 |
|
3753
|
184 |
This section describes the usage of the directory browser and the
|
|
185 |
meaning of the different items in the browser window.
|
|
186 |
\begin{itemize}
|
4540
|
187 |
|
|
188 |
\item A red arrow before a directory name indicates that the directory
|
|
189 |
is currently ``folded'', i.e.~the nodes in this directory are
|
|
190 |
collapsed to one single node. In the right subwindow, the names of
|
|
191 |
nodes corresponding to folded directories are enclosed in square
|
|
192 |
brackets and displayed in red colour.
|
|
193 |
|
|
194 |
\item A green downward arrow before a directory name indicates that
|
|
195 |
the directory is currently ``unfolded''. It can be folded by
|
|
196 |
clicking on the directory name. Clicking on the name for a second
|
|
197 |
time unfolds the directory again. Alternatively, a directory can
|
|
198 |
also be unfolded by clicking on the corresponding node in the right
|
|
199 |
subwindow.
|
|
200 |
|
3753
|
201 |
\item Blue arrows stand before ordinary node (i.e.~theory) names. When
|
4540
|
202 |
clicking on such a name, the graph display window focuses to the
|
|
203 |
corresponding node. Double clicking invokes a text viewer window in
|
|
204 |
which the contents of the theory file are displayed.
|
|
205 |
|
3753
|
206 |
\end{itemize}
|
3188
|
207 |
|
4540
|
208 |
|
3753
|
209 |
\subsubsection*{The graph display window}
|
4540
|
210 |
|
|
211 |
When pointing on an ordinary node, an upward and a downward arrow is
|
|
212 |
shown. Initially, both of these arrows are green. Clicking on the
|
3753
|
213 |
upward or downward arrow collapses all predecessor or successor nodes,
|
|
214 |
respectively. The arrow's colour then changes to red, indicating that
|
|
215 |
the predecessor or successor nodes are currently collapsed. The node
|
4540
|
216 |
corresponding to the collapsed nodes has the name ``{\tt [....]}''. To
|
|
217 |
uncollapse the nodes again, simply click on the red arrow or on the
|
|
218 |
node with the name ``{\tt [....]}''. Similar to the directory browser,
|
|
219 |
the contents of theory files can be displayed by double clicking on
|
|
220 |
the corresponding node.
|
3188
|
221 |
|
4540
|
222 |
|
|
223 |
\subsubsection*{The ``File'' menu}
|
|
224 |
|
4555
|
225 |
Please note that due to Java security restrictions this menu is not
|
4540
|
226 |
available in the applet version. The meaning of the menu items is as
|
|
227 |
follows:
|
3753
|
228 |
\begin{description}
|
4540
|
229 |
|
3753
|
230 |
\item[Open$\ldots$] Open a new graph file.
|
4540
|
231 |
|
|
232 |
\item[Export to PostScript] Outputs the current graph in {\sc
|
|
233 |
PostScript} format, appropriately scaled to fit on one single
|
|
234 |
sheet of paper. The resulting file can printed directly.
|
|
235 |
|
|
236 |
\item[Export to EPS] Outputs the current graph in Encapsulated {\sc
|
|
237 |
PostScript} format. The resulting file can be included in other
|
|
238 |
documents.
|
|
239 |
|
3753
|
240 |
\item[Quit] Quit the graph browser.
|
4540
|
241 |
|
3753
|
242 |
\end{description}
|
|
243 |
|
4540
|
244 |
|
3753
|
245 |
\subsection*{*Syntax of graph definition files}
|
4540
|
246 |
|
3753
|
247 |
A graph definition file has the following syntax:
|
|
248 |
\begin{eqnarray*}
|
4540
|
249 |
\mbox{\it graph} & = & \{ \: \mbox{\it vertex \tt ;} \: \} ^ + \\
|
|
250 |
vertex & = & \mbox{\it vertexname} \: \mbox{\it vertexID} \: \mbox{\it dirname} \: [ \mbox{\tt +} ]
|
|
251 |
\: \mbox{\it path} \: [ \mbox{\tt <} | \mbox{\tt >} ] \: \{ \: \mbox{\it vertexID} \: \} ^ *
|
3753
|
252 |
\end{eqnarray*}
|
4540
|
253 |
|
3753
|
254 |
The meaning of the items in a vertex description is as follows:
|
|
255 |
\begin{description}
|
4540
|
256 |
|
3753
|
257 |
\item[vertexname] The name of the vertex.
|
4540
|
258 |
|
|
259 |
\item[vertexID] The vertex identifier. Note that there may be two
|
|
260 |
vertices with equal names, whereas identifiers must be unique.
|
|
261 |
|
|
262 |
\item[dirname] The name of the ``directory'' the vertex should be
|
|
263 |
placed in. A ``{\tt +}'' sign after {\it dirname} indicates that
|
|
264 |
the nodes in the directory are initially visible. Directories are
|
|
265 |
initially invisible by default.
|
|
266 |
|
|
267 |
\item[path] The path of the corresponding theory file. This is
|
|
268 |
specified relatively to the path of the graph definition file.
|
|
269 |
|
|
270 |
\item[List of successor/predecessor nodes] A ``{\tt <}'' sign before
|
|
271 |
the list means that successor nodes are listed, a ``{\tt >}'' sign
|
|
272 |
means that predecessor nodes are listed. If neither ``{\tt <}'' nor
|
|
273 |
``{\tt >}'' is found, the browser assumes that successor nodes are
|
|
274 |
listed.
|
|
275 |
|
3753
|
276 |
\end{description}
|
5364
|
277 |
|
|
278 |
|
|
279 |
%%% Local Variables:
|
|
280 |
%%% mode: latex
|
|
281 |
%%% TeX-master: "system"
|
|
282 |
%%% End:
|