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