| author | wenzelm |
| Sun, 10 Oct 2010 20:12:10 +0100 | |
| changeset 39836 | a194f39cfcb4 |
| parent 39835 | 6cefd96bb71d |
| child 39838 | eb47307ab930 |
| permissions | -rw-r--r-- |
| 3108 | 1 |
|
| 286 | 2 |
\chapter{Basic Use of Isabelle}\index{sessions|(}
|
| 104 | 3 |
|
4 |
\section{Ending a session}
|
|
5 |
\begin{ttbox}
|
|
| 3108 | 6 |
quit : unit -> unit |
7 |
exit : int -> unit |
|
| 6067 | 8 |
commit : unit -> bool |
| 104 | 9 |
\end{ttbox}
|
| 322 | 10 |
\begin{ttdescription}
|
| 3108 | 11 |
\item[\ttindexbold{quit}();] ends the Isabelle session, without saving
|
12 |
the state. |
|
| 4317 | 13 |
|
14 |
\item[\ttindexbold{exit} \(i\);] similar to {\tt quit}, passing return
|
|
15 |
code \(i\) to the operating system. |
|
| 104 | 16 |
|
| 3108 | 17 |
\item[\ttindexbold{commit}();] saves the current state without ending
|
| 6067 | 18 |
the session, provided that the logic image is opened read-write; |
19 |
return value {\tt false} indicates an error.
|
|
| 322 | 20 |
\end{ttdescription}
|
| 104 | 21 |
|
| 3108 | 22 |
Typing control-D also finishes the session in essentially the same way |
23 |
as the sequence {\tt commit(); quit();} would.
|
|
| 104 | 24 |
|
25 |
||
| 322 | 26 |
\section{Reading ML files}
|
27 |
\index{files!reading}
|
|
| 104 | 28 |
\begin{ttbox}
|
|
138
9ba8bff1addc
added chapter "Defining Theories" and made changes for new Readthy functions
clasohm
parents:
104
diff
changeset
|
29 |
cd : string -> unit |
| 884 | 30 |
pwd : unit -> string |
|
138
9ba8bff1addc
added chapter "Defining Theories" and made changes for new Readthy functions
clasohm
parents:
104
diff
changeset
|
31 |
use : string -> unit |
|
9ba8bff1addc
added chapter "Defining Theories" and made changes for new Readthy functions
clasohm
parents:
104
diff
changeset
|
32 |
time_use : string -> unit |
| 104 | 33 |
\end{ttbox}
|
| 322 | 34 |
\begin{ttdescription}
|
| 4317 | 35 |
\item[\ttindexbold{cd} "{\it dir}";] changes the current directory to
|
36 |
{\it dir}. This is the default directory for reading files.
|
|
37 |
||
38 |
\item[\ttindexbold{pwd}();] returns the full path of the current
|
|
39 |
directory. |
|
| 884 | 40 |
|
| 322 | 41 |
\item[\ttindexbold{use} "$file$";]
|
| 104 | 42 |
reads the given {\it file} as input to the \ML{} session. Reading a file
|
43 |
of Isabelle commands is the usual way of replaying a proof. |
|
44 |
||
| 322 | 45 |
\item[\ttindexbold{time_use} "$file$";]
|
| 104 | 46 |
performs {\tt use~"$file$"} and prints the total execution time.
|
| 322 | 47 |
\end{ttdescription}
|
| 104 | 48 |
|
| 6343 | 49 |
The $dir$ and $file$ specifications of the \texttt{cd} and \texttt{use}
|
50 |
commands may contain path variables (e.g.\ \texttt{\$ISABELLE_HOME}) that are
|
|
51 |
expanded appropriately. Note that \texttt{\~\relax} abbreviates
|
|
52 |
\texttt{\$HOME}, and \texttt{\~\relax\~\relax} abbreviates
|
|
| 6571 | 53 |
\texttt{\$ISABELLE_HOME}\index{*\$ISABELLE_HOME}. The syntax for path
|
54 |
specifications follows Unix conventions. |
|
| 6568 | 55 |
|
56 |
||
57 |
\section{Reading theories}\label{sec:intro-theories}
|
|
58 |
\index{theories!reading}
|
|
59 |
||
60 |
In Isabelle, any kind of declarations, definitions, etc.\ are organized around |
|
61 |
named \emph{theory} objects. Logical reasoning always takes place within a
|
|
62 |
certain theory context, which may be switched at any time. Theory $name$ is |
|
63 |
defined by a theory file $name$\texttt{.thy}, containing declarations of
|
|
64 |
\texttt{consts}, \texttt{types}, \texttt{defs}, etc.\ (see
|
|
65 |
\S\ref{sec:ref-defining-theories} for more details on concrete syntax).
|
|
66 |
Furthermore, there may be an associated {\ML} file $name$\texttt{.ML} with
|
|
67 |
proof scripts that are to be run in the context of the theory. |
|
68 |
||
69 |
\begin{ttbox}
|
|
70 |
context : theory -> unit |
|
71 |
the_context : unit -> theory |
|
72 |
theory : string -> theory |
|
73 |
use_thy : string -> unit |
|
74 |
time_use_thy : string -> unit |
|
| 7136 | 75 |
update_thy : string -> unit |
| 6568 | 76 |
\end{ttbox}
|
77 |
||
78 |
\begin{ttdescription}
|
|
79 |
||
80 |
\item[\ttindexbold{context} $thy$;] switches the current theory context. Any
|
|
81 |
subsequent command with ``implicit theory argument'' (e.g.\ \texttt{Goal})
|
|
82 |
will refer to $thy$ as its theory. |
|
83 |
||
84 |
\item[\ttindexbold{the_context}();] obtains the current theory context, or
|
|
85 |
raises an error if absent. |
|
86 |
||
| 6569 | 87 |
\item[\ttindexbold{theory} "$name$";] retrieves the theory called $name$ from
|
| 8136 | 88 |
the internal data\-base of loaded theories, raising an error if absent. |
| 6568 | 89 |
|
| 6569 | 90 |
\item[\ttindexbold{use_thy} "$name$";] reads theory $name$ from the file
|
| 6571 | 91 |
system, looking for $name$\texttt{.thy} and $name$\texttt{.ML} (the latter
|
92 |
being optional). It also ensures that all parent theories are loaded as |
|
93 |
well. In case some older versions have already been present, |
|
94 |
\texttt{use_thy} only tries to reload $name$ itself, but is content with any
|
|
95 |
version of its ancestors. |
|
| 6568 | 96 |
|
| 6569 | 97 |
\item[\ttindexbold{time_use_thy} "$name$";] same as \texttt{use_thy}, but
|
| 6568 | 98 |
reports the time taken to process the actual theory parts and {\ML} files
|
99 |
separately. |
|
| 7592 | 100 |
|
| 7136 | 101 |
\item[\ttindexbold{update_thy} "$name$";] is similar to \texttt{use_thy}, but
|
102 |
ensures that theory $name$ is fully up-to-date with respect to the file |
|
| 7592 | 103 |
system --- apart from theory $name$ itself, any of its ancestors may be |
104 |
reloaded as well. |
|
| 6568 | 105 |
|
106 |
\end{ttdescription}
|
|
107 |
||
| 9695 | 108 |
Note that theories of pre-built logic images (e.g.\ HOL) are marked as |
| 7282 | 109 |
\emph{finished} and cannot be updated any more. See \S\ref{sec:more-theories}
|
110 |
for further information on Isabelle's theory loader. |
|
| 4274 | 111 |
|
| 104 | 112 |
|
|
30184
37969710e61f
removed parts of the manual that are clearly obsolete, or covered by
wenzelm
parents:
28504
diff
changeset
|
113 |
\section{Timing}
|
|
37969710e61f
removed parts of the manual that are clearly obsolete, or covered by
wenzelm
parents:
28504
diff
changeset
|
114 |
\index{timing statistics}\index{proofs!timing}
|
| 104 | 115 |
\begin{ttbox}
|
|
30184
37969710e61f
removed parts of the manual that are clearly obsolete, or covered by
wenzelm
parents:
28504
diff
changeset
|
116 |
timing: bool ref \hfill{\bf initially false}
|
| 104 | 117 |
\end{ttbox}
|
118 |
||
| 322 | 119 |
\begin{ttdescription}
|
|
30184
37969710e61f
removed parts of the manual that are clearly obsolete, or covered by
wenzelm
parents:
28504
diff
changeset
|
120 |
\item[set \ttindexbold{timing};] enables global timing in Isabelle.
|
|
37969710e61f
removed parts of the manual that are clearly obsolete, or covered by
wenzelm
parents:
28504
diff
changeset
|
121 |
This information is compiler-dependent. |
| 322 | 122 |
\end{ttdescription}
|
| 104 | 123 |
|
124 |
\index{sessions|)}
|
|
| 5371 | 125 |
|
126 |
||
127 |
%%% Local Variables: |
|
128 |
%%% mode: latex |
|
129 |
%%% TeX-master: "ref" |
|
130 |
%%% End: |