1 %% $Id$ |
1 %% $Id$ |
|
2 |
2 \chapter{Basic Use of Isabelle}\index{sessions|(} |
3 \chapter{Basic Use of Isabelle}\index{sessions|(} |
3 The Reference Manual is a comprehensive description of Isabelle, including |
4 The Reference Manual is a comprehensive description of Isabelle |
4 all commands, functions and packages. It really is intended for reference, |
5 proper, including all \ML{} commands, functions and packages. It |
5 perhaps for browsing, but not for reading through. It is not a tutorial, |
6 really is intended for reference, perhaps for browsing, but not for |
6 but assumes familiarity with the basic concepts of Isabelle. |
7 reading through. It is not a tutorial, but assumes familiarity with |
|
8 the basic logical concepts of Isabelle. |
7 |
9 |
8 When you are looking for a way of performing some task, scan the Table of |
10 When you are looking for a way of performing some task, scan the Table of |
9 Contents for a relevant heading. Functions are organized by their purpose, |
11 Contents for a relevant heading. Functions are organized by their purpose, |
10 by their operands (subgoals, tactics, theorems), and by their usefulness. |
12 by their operands (subgoals, tactics, theorems), and by their usefulness. |
11 In each section, basic functions appear first, then advanced functions, and |
13 In each section, basic functions appear first, then advanced functions, and |
17 |
19 |
18 |
20 |
19 \section{Basic interaction with Isabelle} |
21 \section{Basic interaction with Isabelle} |
20 \index{starting up|bold}\nobreak |
22 \index{starting up|bold}\nobreak |
21 % |
23 % |
22 First, read the instructions on file {\tt README} in the top-level |
24 We assume that your local Isabelle administrator (this might be you!) |
23 distribution directory. Follow them to create the object-logics you need |
25 has already installed the \Pure\ system and several object-logics |
24 on a directory you have created to hold binary images. Suppose the |
26 properly --- otherwise see the {\tt INSTALL} file in the top-level |
25 environment variable {\tt ISABELLEBIN} refers to this directory. The |
27 directory of the distribution on how to build it. |
26 instructions for starting up a logic (say {\tt HOL}) depend upon which |
28 |
27 Standard ML compiler you are using. |
29 \medskip Let $\langle isabellehome \rangle$ denote the location where |
28 \begin{itemize} |
30 the distribution has been installed. To run Isabelle from a the shell |
29 \item With Standard ML of New Jersey, type \verb|$ISABELLEBIN/HOL|. |
31 prompt within an ordinary text terminal session, simply type: |
30 \item With Poly/ML, type \verb|poly $ISABELLEBIN/HOL|, possibly prefixing the |
32 \begin{ttbox} |
31 command with the directory where {\tt poly} is kept. |
33 \({\langle}isabellehome{\rangle}\)/bin/isabelle |
32 \end{itemize} |
34 \end{ttbox} |
33 Either way, you will find yourself at the \ML{} top level. All Isabelle |
35 This should start an interactive \ML{} session with the default |
34 commands are bound to \ML{} identifiers. |
36 object-logic already preloaded. All Isabelle commands are bound to |
35 |
37 \ML{} identifiers. |
36 \index{saving your work|bold} |
38 |
37 Isabelle provides no means of storing theorems or proofs on files. |
39 Subsequently we assume that {\tt \(\langle isabellehome \rangle\)/bin} |
38 Theorems are simply part of the \ML{} state and are named by \ML{} |
40 has been added to your shell's search path, in order to avoid typing |
39 identifiers. To save your work between sessions, you must save a copy of |
41 full path specifications of the executable files. |
40 the \ML{} image. The procedure for doing so is compiler-dependent: |
42 |
41 \begin{itemize}\index{Poly/{\ML} compiler} |
43 The object-logic image to load may be also specified explicitly as an |
42 \item At the end of a session, Poly/\ML{} saves the state, provided you |
44 argument to the {\tt isabelle} command, e.g.: |
43 have created a database for your own use. You can create a database by |
45 \begin{ttbox} |
44 copying an existing one, or by calling the Poly/\ML{} function {\tt |
46 isabelle FOL |
45 make_database}; the latter course uses much less disc space. A |
47 \end{ttbox} |
46 Poly/\ML{} database {\em does not\/} save the contents of references, |
48 This should put you into the world of polymorphic first-order logic |
47 such as the current state of a backward proof. |
49 (assuming that {\FOL} has been pre-built). |
48 |
50 |
49 \item With New Jersey \ML{} you must save the state explicitly before |
51 \index{saving your work|bold} Isabelle provides no means of storing |
50 ending the session. While a Poly/\ML{} database can be small, a New Jersey |
52 theorems or proofs on files. Theorems are simply part of the \ML{} |
51 image occupies several megabytes. |
53 state and are named by \ML{} identifiers. To save your work between |
52 \end{itemize} |
54 sessions, you must dump the \ML{} system state to a file. This is done |
53 See your \ML{} compiler's documentation for full instructions on saving the |
55 automatically when ending the session normally (e.g.\ by typing |
54 state. |
56 control-D), provided that the image has been opened \emph{writable} in |
55 |
57 the first place. The standard object-logics are usually read-only, so |
56 Saving the state is not enough. Record, on a file, the top-level commands |
58 you probably have to create a private working copy first. For example, |
57 that generate your theories and proofs. Such a record allows you to replay |
59 the following shell command puts you into a writable Isabelle session |
58 the proofs whenever required, for instance after making minor changes to |
60 of name \texttt{Foo} that initially contains just \FOL: |
59 the axioms. Ideally, your record will be intelligible to others as a |
61 \begin{ttbox} |
60 formal description of your work. |
62 isabelle FOL Foo |
61 |
63 \end{ttbox} |
62 Since Isabelle's user interface is the \ML{} top level, some kind of window |
64 Ending the \texttt{Foo} session with control-D will cause the complete |
63 support is essential. One window displays the Isabelle session, while the |
65 \ML{} world to be saved somewhere in your home directory\footnote{The |
64 other displays a file --- your proof record --- being edited. The Emacs |
66 default location is in \texttt{\~\relax/isabelle/heaps}, but this |
65 editor supports windows and can manage interactive sessions. |
67 depends on your local configuration.}. Make sure there is enough |
|
68 space available! Then one may later continue at exactly the same point |
|
69 by running |
|
70 \begin{ttbox} |
|
71 isabelle Foo |
|
72 \end{ttbox} |
|
73 |
|
74 %FIXME not yet |
|
75 %More details about \texttt{isabelle} may be found in the \emph{System |
|
76 % Manual}. |
|
77 |
|
78 \medskip Saving the state is not enough. Record, on a file, the |
|
79 top-level commands that generate your theories and proofs. Such a |
|
80 record allows you to replay the proofs whenever required, for instance |
|
81 after making minor changes to the axioms. Ideally, your record will |
|
82 be somewhat intelligible to others as a formal description of your |
|
83 work. |
|
84 |
|
85 \medskip There are more comfortable user interfaces than the |
|
86 bare-bones \ML{} top-level run from a text terminal. The |
|
87 \texttt{Isabelle} executable (note the capital I) runs one such |
|
88 interface, depending on your local configuration. Furthermore there |
|
89 are a number of external utilities available. These are started |
|
90 uniformly via the \texttt{isatool} wrapper. |
|
91 |
|
92 %FIXME not yet |
|
93 %Again, see the \emph{System Manual} for more information user |
|
94 %interfaces and utilities. |
66 |
95 |
67 |
96 |
68 \section{Ending a session} |
97 \section{Ending a session} |
69 \begin{ttbox} |
98 \begin{ttbox} |
70 quit : unit -> unit |
99 quit : unit -> unit |
71 commit : unit -> unit \hfill{\bf Poly/ML only} |
100 exit : int -> unit |
72 exportML : string -> bool \hfill{\bf New Jersey ML only} |
101 commit : unit -> unit |
73 \end{ttbox} |
102 \end{ttbox} |
74 \begin{ttdescription} |
103 \begin{ttdescription} |
75 \item[\ttindexbold{quit}();] |
104 \item[\ttindexbold{quit}();] ends the Isabelle session, without saving |
76 aborts the Isabelle session, without saving the state. |
105 the state. |
77 |
106 |
78 \item[\ttindexbold{commit}();] |
107 \item[\ttindexbold{exit}();] same as {\tt quit}, passing a return code |
79 saves the current state in your Poly/\ML{} database without ending the |
108 to the operating system. |
80 session. The contents of references are lost, so never do this during an |
109 |
81 interactive proof!\index{Poly/{\ML} compiler} |
110 \item[\ttindexbold{commit}();] saves the current state without ending |
82 |
111 the session, provided that the logic image is opened read-write. |
83 \item[\ttindexbold{exportML} "{\it file}";] saves an |
112 \end{ttdescription} |
84 image of your session to the given {\it file}. |
113 |
85 \end{ttdescription} |
114 Typing control-D also finishes the session in essentially the same way |
86 |
115 as the sequence {\tt commit(); quit();} would. |
87 \begin{warn} |
|
88 Typing control-D also finishes the session, but its effect is |
|
89 compiler-dependent. Poly/\ML{} will then save the state, if you have a |
|
90 private database. New Jersey \ML{} will discard the state! |
|
91 \end{warn} |
|
92 |
116 |
93 |
117 |
94 \section{Reading ML files} |
118 \section{Reading ML files} |
95 \index{files!reading} |
119 \index{files!reading} |
96 \begin{ttbox} |
120 \begin{ttbox} |
103 \begin{ttdescription} |
127 \begin{ttdescription} |
104 \item[\ttindexbold{cd} "{\it dir}";] |
128 \item[\ttindexbold{cd} "{\it dir}";] |
105 changes the current directory to {\it dir}. This is the default directory |
129 changes the current directory to {\it dir}. This is the default directory |
106 for reading files and for writing temporary files. |
130 for reading files and for writing temporary files. |
107 |
131 |
108 \item[\ttindexbold{pwd} ();] returns the path of the current directory. |
132 \item[\ttindexbold{pwd}();] returns the path of the current directory. |
109 |
133 |
110 \item[\ttindexbold{use} "$file$";] |
134 \item[\ttindexbold{use} "$file$";] |
111 reads the given {\it file} as input to the \ML{} session. Reading a file |
135 reads the given {\it file} as input to the \ML{} session. Reading a file |
112 of Isabelle commands is the usual way of replaying a proof. |
136 of Isabelle commands is the usual way of replaying a proof. |
113 |
137 |
114 \item[\ttindexbold{time_use} "$file$";] |
138 \item[\ttindexbold{time_use} "$file$";] |
115 performs {\tt use~"$file$"} and prints the total execution time. |
139 performs {\tt use~"$file$"} and prints the total execution time. |
116 \end{ttdescription} |
140 \end{ttdescription} |
|
141 |
|
142 |
|
143 \section{Setting flags} |
|
144 \begin{ttbox} |
|
145 set : bool ref -> bool |
|
146 reset : bool ref -> bool |
|
147 toggle : bool ref -> bool |
|
148 \end{ttbox}\index{*set}\index{*reset}\index{*toggle} |
|
149 These are some shorthands for manipulating boolean references. The new |
|
150 value is returned. |
117 |
151 |
118 |
152 |
119 \section{Printing of terms and theorems}\label{sec:printing-control} |
153 \section{Printing of terms and theorems}\label{sec:printing-control} |
120 \index{printing control|(} |
154 \index{printing control|(} |
121 Isabelle's pretty printer is controlled by a number of parameters. |
155 Isabelle's pretty printer is controlled by a number of parameters. |
234 pretty printing information from the proof state last stored in the |
268 pretty printing information from the proof state last stored in the |
235 subgoal module. The appearance of the output thus depends upon the |
269 subgoal module. The appearance of the output thus depends upon the |
236 theory used in the last interactive proof. |
270 theory used in the last interactive proof. |
237 \end{warn} |
271 \end{warn} |
238 |
272 |
239 \section{Shell scripts}\label{sec:shell-scripts} |
273 %FIXME remove |
240 \index{shell scripts|bold} The following files are distributed with |
274 %\section{Shell scripts}\label{sec:shell-scripts} |
241 Isabelle, and work under Unix$^{\rm TM}$. They can be executed as commands |
275 %\index{shell scripts|bold} The following files are distributed with |
242 to the Unix shell. Some of them depend upon shell environment variables. |
276 %Isabelle, and work under Unix$^{\rm TM}$. They can be executed as commands |
243 \begin{ttdescription} |
277 %to the Unix shell. Some of them depend upon shell environment variables. |
244 \item[make-all $switches$] \index{*make-all shell script} |
278 %\begin{ttdescription} |
245 compiles the Isabelle system, when executed on the source directory. |
279 %\item[make-all $switches$] \index{*make-all shell script} |
246 Environment variables specify which \ML{} compiler to use. These |
280 % compiles the Isabelle system, when executed on the source directory. |
247 variables, and the {\it switches}, are documented on the file itself. |
281 % Environment variables specify which \ML{} compiler to use. These |
248 |
282 % variables, and the {\it switches}, are documented on the file itself. |
249 \item[teeinput $program$] \index{*teeinput shell script} |
283 % |
250 executes the {\it program}, while piping the standard input to a log file |
284 %\item[teeinput $program$] \index{*teeinput shell script} |
251 designated by the \verb|$LISTEN| environment variable. Normally the |
285 % executes the {\it program}, while piping the standard input to a log file |
252 program is Isabelle, and the log file receives a copy of all the Isabelle |
286 % designated by the \verb|$LISTEN| environment variable. Normally the |
253 commands. |
287 % program is Isabelle, and the log file receives a copy of all the Isabelle |
254 |
288 % commands. |
255 \item[xlisten $program$] \index{*xlisten shell script} |
289 % |
256 is a trivial `user interface' for the X Window System. It creates two |
290 %\item[xlisten $program$] \index{*xlisten shell script} |
257 windows using {\tt xterm}. One executes an interactive session via |
291 % is a trivial `user interface' for the X Window System. It creates two |
258 \hbox{\tt teeinput $program$}, while the other displays the log file. To |
292 % windows using {\tt xterm}. One executes an interactive session via |
259 make a proof record, simply paste lines from the log file into an editor |
293 % \hbox{\tt teeinput $program$}, while the other displays the log file. To |
260 window. |
294 % make a proof record, simply paste lines from the log file into an editor |
261 |
295 % window. |
262 \item[expandshort $files$] \index{*expandshort shell script} |
296 % |
263 reads the {\it files\/} and replaces all occurrences of the shorthand |
297 %\item[expandshort $files$] \index{*expandshort shell script} |
264 commands {\tt br}, {\tt be}, {\tt brs}, {\tt bes}, etc., with the |
298 % reads the {\it files\/} and replaces all occurrences of the shorthand |
265 corresponding full commands. Shorthand commands should appear one |
299 % commands {\tt br}, {\tt be}, {\tt brs}, {\tt bes}, etc., with the |
266 per line. The old versions of the files |
300 % corresponding full commands. Shorthand commands should appear one |
267 are renamed to have the suffix~\verb'~~'. |
301 % per line. The old versions of the files |
268 \end{ttdescription} |
302 % are renamed to have the suffix~\verb'~~'. |
|
303 %\end{ttdescription} |
269 |
304 |
270 \index{sessions|)} |
305 \index{sessions|)} |