doc-src/Ref/introduction.tex
author huffman
Mon, 22 Mar 2010 15:45:54 -0700
changeset 35908 21e45c81e828
parent 30184 37969710e61f
child 37368 1c816f2abb0e
permissions -rw-r--r--
remove unused adm_tac.ML
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3108
335efc3f5632 misc updates, tuning, cleanup;
wenzelm
parents: 2225
diff changeset
     1
286
e7efbf03562b first draft of Springer book
lcp
parents: 159
diff changeset
     2
\chapter{Basic Use of Isabelle}\index{sessions|(} 
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
     3
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
     4
\section{Basic interaction with Isabelle}
2225
78a8faae780f Added instructions on starting up
paulson
parents: 1372
diff changeset
     5
\index{starting up|bold}\nobreak
78a8faae780f Added instructions on starting up
paulson
parents: 1372
diff changeset
     6
%
6568
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
     7
We assume that your local Isabelle administrator (this might be you!) has
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
     8
already installed the Isabelle system together with appropriate object-logics
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
     9
--- otherwise see the \texttt{README} and \texttt{INSTALL} files in the
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
    10
top-level directory of the distribution on how to do this.
3108
335efc3f5632 misc updates, tuning, cleanup;
wenzelm
parents: 2225
diff changeset
    11
335efc3f5632 misc updates, tuning, cleanup;
wenzelm
parents: 2225
diff changeset
    12
\medskip Let $\langle isabellehome \rangle$ denote the location where
3485
f27a30a18a17 Now there are TWO spaces after each full stop, so that the Emacs sentence
paulson
parents: 3200
diff changeset
    13
the distribution has been installed.  To run Isabelle from a the shell
4317
7264fa2ff2ec several minor updates;
wenzelm
parents: 4274
diff changeset
    14
prompt within an ordinary text terminal session, simply type
3108
335efc3f5632 misc updates, tuning, cleanup;
wenzelm
parents: 2225
diff changeset
    15
\begin{ttbox}
335efc3f5632 misc updates, tuning, cleanup;
wenzelm
parents: 2225
diff changeset
    16
\({\langle}isabellehome{\rangle}\)/bin/isabelle
335efc3f5632 misc updates, tuning, cleanup;
wenzelm
parents: 2225
diff changeset
    17
\end{ttbox}
6568
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
    18
This should start an interactive \ML{} session with the default object-logic
9695
ec7d7f877712 proper setup of iman.sty/extra.sty/ttbox.sty;
wenzelm
parents: 9231
diff changeset
    19
(usually HOL) already pre-loaded.
3108
335efc3f5632 misc updates, tuning, cleanup;
wenzelm
parents: 2225
diff changeset
    20
6568
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
    21
Subsequently, we assume that the \texttt{isabelle} executable is determined
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
    22
automatically by the shell, e.g.\ by adding {\tt \(\langle isabellehome
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
    23
  \rangle\)/bin} to your search path.\footnote{Depending on your installation,
7990
0a604b2fc2b1 updated;
wenzelm
parents: 7592
diff changeset
    24
  there may be stand-alone binaries located in some global directory such as
0a604b2fc2b1 updated;
wenzelm
parents: 7592
diff changeset
    25
  \texttt{/usr/bin}.  Do not attempt to copy {\tt \(\langle isabellehome
28504
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 12831
diff changeset
    26
    \rangle\)/bin/isabelle}, though!  See \texttt{isabelle install} in
7990
0a604b2fc2b1 updated;
wenzelm
parents: 7592
diff changeset
    27
  \emph{The Isabelle System Manual} of how to do this properly.}
3108
335efc3f5632 misc updates, tuning, cleanup;
wenzelm
parents: 2225
diff changeset
    28
6571
wenzelm
parents: 6569
diff changeset
    29
\medskip
wenzelm
parents: 6569
diff changeset
    30
6568
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
    31
The object-logic image to load may be also specified explicitly as an argument
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
    32
to the {\tt isabelle} command, e.g.
3108
335efc3f5632 misc updates, tuning, cleanup;
wenzelm
parents: 2225
diff changeset
    33
\begin{ttbox}
335efc3f5632 misc updates, tuning, cleanup;
wenzelm
parents: 2225
diff changeset
    34
isabelle FOL
335efc3f5632 misc updates, tuning, cleanup;
wenzelm
parents: 2225
diff changeset
    35
\end{ttbox}
6568
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
    36
This should put you into the world of polymorphic first-order logic (assuming
9695
ec7d7f877712 proper setup of iman.sty/extra.sty/ttbox.sty;
wenzelm
parents: 9231
diff changeset
    37
that an image of FOL has been pre-built).
2225
78a8faae780f Added instructions on starting up
paulson
parents: 1372
diff changeset
    38
6568
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
    39
\index{saving your session|bold} Isabelle provides no means of storing
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
    40
theorems or internal proof objects on files.  Theorems are simply part of the
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
    41
\ML{} state.  To save your work between sessions, you may dump the \ML{}
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
    42
system state to a file.  This is done automatically when ending the session
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
    43
normally (e.g.\ by typing control-D), provided that the image has been opened
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
    44
\emph{writable} in the first place.  The standard object-logic images are
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
    45
usually read-only, so you have to create a private working copy first.  For
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
    46
example, the following shell command puts you into a writable Isabelle session
9695
ec7d7f877712 proper setup of iman.sty/extra.sty/ttbox.sty;
wenzelm
parents: 9231
diff changeset
    47
of name \texttt{Foo} that initially contains just plain HOL:
3108
335efc3f5632 misc updates, tuning, cleanup;
wenzelm
parents: 2225
diff changeset
    48
\begin{ttbox}
6568
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
    49
isabelle HOL Foo
3108
335efc3f5632 misc updates, tuning, cleanup;
wenzelm
parents: 2225
diff changeset
    50
\end{ttbox}
335efc3f5632 misc updates, tuning, cleanup;
wenzelm
parents: 2225
diff changeset
    51
Ending the \texttt{Foo} session with control-D will cause the complete
6568
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
    52
\ML-world to be saved somewhere in your home directory\footnote{The default
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
    53
  location is in \texttt{\~\relax/isabelle/heaps}, but this depends on your
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
    54
  local configuration.}.  Make sure there is enough space available! Then one
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
    55
may later continue at exactly the same point by running
3108
335efc3f5632 misc updates, tuning, cleanup;
wenzelm
parents: 2225
diff changeset
    56
\begin{ttbox}
335efc3f5632 misc updates, tuning, cleanup;
wenzelm
parents: 2225
diff changeset
    57
isabelle Foo  
335efc3f5632 misc updates, tuning, cleanup;
wenzelm
parents: 2225
diff changeset
    58
\end{ttbox}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    59
6568
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
    60
\medskip Saving the {\ML} state is not enough.  Record, on a file, the
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
    61
top-level commands that generate your theories and proofs.  Such a record
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
    62
allows you to replay the proofs whenever required, for instance after making
6571
wenzelm
parents: 6569
diff changeset
    63
minor changes to the axioms.  Ideally, these sources will be somewhat
6568
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
    64
intelligible to others as a formal description of your work.
3108
335efc3f5632 misc updates, tuning, cleanup;
wenzelm
parents: 2225
diff changeset
    65
6568
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
    66
It is good practice to put all source files that constitute a separate
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
    67
Isabelle session into an individual directory, together with an {\ML} file
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
    68
called \texttt{ROOT.ML} that contains appropriate commands to load all other
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
    69
files required.  Running \texttt{isabelle} with option \texttt{-u}
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
    70
automatically loads \texttt{ROOT.ML} on entering the session.  The
28504
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 12831
diff changeset
    71
\texttt{isabelle usedir} utility provides some more options to manage Isabelle
6568
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
    72
sessions, such as automatic generation of theory browsing information.
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    73
28504
7ad7d7d6df47 simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents: 12831
diff changeset
    74
\medskip More details about the \texttt{isabelle} and \texttt{isabelle}
6568
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
    75
commands may be found in \emph{The Isabelle System Manual}.
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
    76
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
    77
\medskip There are more comfortable user interfaces than the bare-bones \ML{}
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
    78
top-level run from a text terminal.  The \texttt{Isabelle} executable (note
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
    79
the capital I) runs one such interface, depending on your local configuration.
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
    80
Again, see \emph{The Isabelle System Manual} for more information.
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    81
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    82
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    83
\section{Ending a session}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    84
\begin{ttbox} 
3108
335efc3f5632 misc updates, tuning, cleanup;
wenzelm
parents: 2225
diff changeset
    85
quit    : unit -> unit
335efc3f5632 misc updates, tuning, cleanup;
wenzelm
parents: 2225
diff changeset
    86
exit    : int -> unit
6067
0f8ab32093ae fixed commit spec;
wenzelm
parents: 5371
diff changeset
    87
commit  : unit -> bool
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    88
\end{ttbox}
322
bacfaeeea007 penultimate Springer draft
lcp
parents: 286
diff changeset
    89
\begin{ttdescription}
3108
335efc3f5632 misc updates, tuning, cleanup;
wenzelm
parents: 2225
diff changeset
    90
\item[\ttindexbold{quit}();] ends the Isabelle session, without saving
335efc3f5632 misc updates, tuning, cleanup;
wenzelm
parents: 2225
diff changeset
    91
  the state.
4317
7264fa2ff2ec several minor updates;
wenzelm
parents: 4274
diff changeset
    92
  
7264fa2ff2ec several minor updates;
wenzelm
parents: 4274
diff changeset
    93
\item[\ttindexbold{exit} \(i\);] similar to {\tt quit}, passing return
7264fa2ff2ec several minor updates;
wenzelm
parents: 4274
diff changeset
    94
  code \(i\) to the operating system.
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
    95
3108
335efc3f5632 misc updates, tuning, cleanup;
wenzelm
parents: 2225
diff changeset
    96
\item[\ttindexbold{commit}();] saves the current state without ending
6067
0f8ab32093ae fixed commit spec;
wenzelm
parents: 5371
diff changeset
    97
  the session, provided that the logic image is opened read-write;
0f8ab32093ae fixed commit spec;
wenzelm
parents: 5371
diff changeset
    98
  return value {\tt false} indicates an error.
322
bacfaeeea007 penultimate Springer draft
lcp
parents: 286
diff changeset
    99
\end{ttdescription}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   100
3108
335efc3f5632 misc updates, tuning, cleanup;
wenzelm
parents: 2225
diff changeset
   101
Typing control-D also finishes the session in essentially the same way
335efc3f5632 misc updates, tuning, cleanup;
wenzelm
parents: 2225
diff changeset
   102
as the sequence {\tt commit(); quit();} would.
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   103
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   104
322
bacfaeeea007 penultimate Springer draft
lcp
parents: 286
diff changeset
   105
\section{Reading ML files}
bacfaeeea007 penultimate Springer draft
lcp
parents: 286
diff changeset
   106
\index{files!reading}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   107
\begin{ttbox} 
138
9ba8bff1addc added chapter "Defining Theories" and made changes for new Readthy functions
clasohm
parents: 104
diff changeset
   108
cd              : string -> unit
884
35c836adf48f added documentation of pwd
clasohm
parents: 508
diff changeset
   109
pwd             : unit -> string
138
9ba8bff1addc added chapter "Defining Theories" and made changes for new Readthy functions
clasohm
parents: 104
diff changeset
   110
use             : string -> unit
9ba8bff1addc added chapter "Defining Theories" and made changes for new Readthy functions
clasohm
parents: 104
diff changeset
   111
time_use        : string -> unit
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   112
\end{ttbox}
322
bacfaeeea007 penultimate Springer draft
lcp
parents: 286
diff changeset
   113
\begin{ttdescription}
4317
7264fa2ff2ec several minor updates;
wenzelm
parents: 4274
diff changeset
   114
\item[\ttindexbold{cd} "{\it dir}";] changes the current directory to
7264fa2ff2ec several minor updates;
wenzelm
parents: 4274
diff changeset
   115
  {\it dir}.  This is the default directory for reading files.
7264fa2ff2ec several minor updates;
wenzelm
parents: 4274
diff changeset
   116
  
7264fa2ff2ec several minor updates;
wenzelm
parents: 4274
diff changeset
   117
\item[\ttindexbold{pwd}();] returns the full path of the current
7264fa2ff2ec several minor updates;
wenzelm
parents: 4274
diff changeset
   118
  directory.
884
35c836adf48f added documentation of pwd
clasohm
parents: 508
diff changeset
   119
322
bacfaeeea007 penultimate Springer draft
lcp
parents: 286
diff changeset
   120
\item[\ttindexbold{use} "$file$";]  
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   121
reads the given {\it file} as input to the \ML{} session.  Reading a file
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   122
of Isabelle commands is the usual way of replaying a proof.
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   123
322
bacfaeeea007 penultimate Springer draft
lcp
parents: 286
diff changeset
   124
\item[\ttindexbold{time_use} "$file$";]  
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   125
performs {\tt use~"$file$"} and prints the total execution time.
322
bacfaeeea007 penultimate Springer draft
lcp
parents: 286
diff changeset
   126
\end{ttdescription}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   127
6343
97c697a32b73 updated;
wenzelm
parents: 6067
diff changeset
   128
The $dir$ and $file$ specifications of the \texttt{cd} and \texttt{use}
97c697a32b73 updated;
wenzelm
parents: 6067
diff changeset
   129
commands may contain path variables (e.g.\ \texttt{\$ISABELLE_HOME}) that are
97c697a32b73 updated;
wenzelm
parents: 6067
diff changeset
   130
expanded appropriately.  Note that \texttt{\~\relax} abbreviates
97c697a32b73 updated;
wenzelm
parents: 6067
diff changeset
   131
\texttt{\$HOME}, and \texttt{\~\relax\~\relax} abbreviates
6571
wenzelm
parents: 6569
diff changeset
   132
\texttt{\$ISABELLE_HOME}\index{*\$ISABELLE_HOME}.  The syntax for path
wenzelm
parents: 6569
diff changeset
   133
specifications follows Unix conventions.
6568
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
   134
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
   135
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
   136
\section{Reading theories}\label{sec:intro-theories}
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
   137
\index{theories!reading}
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
   138
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
   139
In Isabelle, any kind of declarations, definitions, etc.\ are organized around
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
   140
named \emph{theory} objects.  Logical reasoning always takes place within a
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
   141
certain theory context, which may be switched at any time.  Theory $name$ is
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
   142
defined by a theory file $name$\texttt{.thy}, containing declarations of
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
   143
\texttt{consts}, \texttt{types}, \texttt{defs}, etc.\ (see
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
   144
\S\ref{sec:ref-defining-theories} for more details on concrete syntax).
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
   145
Furthermore, there may be an associated {\ML} file $name$\texttt{.ML} with
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
   146
proof scripts that are to be run in the context of the theory.
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
   147
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
   148
\begin{ttbox}
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
   149
context      : theory -> unit
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
   150
the_context  : unit -> theory
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
   151
theory       : string -> theory
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
   152
use_thy      : string -> unit
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
   153
time_use_thy : string -> unit
7136
71f6eef45713 added update_thy_only;
wenzelm
parents: 6618
diff changeset
   154
update_thy   : string -> unit
6568
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
   155
\end{ttbox}
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
   156
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
   157
\begin{ttdescription}
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
   158
  
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
   159
\item[\ttindexbold{context} $thy$;] switches the current theory context.  Any
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
   160
  subsequent command with ``implicit theory argument'' (e.g.\ \texttt{Goal})
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
   161
  will refer to $thy$ as its theory.
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
   162
  
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
   163
\item[\ttindexbold{the_context}();] obtains the current theory context, or
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
   164
  raises an error if absent.
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
   165
  
6569
wenzelm
parents: 6568
diff changeset
   166
\item[\ttindexbold{theory} "$name$";] retrieves the theory called $name$ from
8136
8c65f3ca13f2 fixed many bad line & page breaks
paulson
parents: 7990
diff changeset
   167
  the internal data\-base of loaded theories, raising an error if absent.
6568
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
   168
  
6569
wenzelm
parents: 6568
diff changeset
   169
\item[\ttindexbold{use_thy} "$name$";] reads theory $name$ from the file
6571
wenzelm
parents: 6569
diff changeset
   170
  system, looking for $name$\texttt{.thy} and $name$\texttt{.ML} (the latter
wenzelm
parents: 6569
diff changeset
   171
  being optional).  It also ensures that all parent theories are loaded as
wenzelm
parents: 6569
diff changeset
   172
  well.  In case some older versions have already been present,
wenzelm
parents: 6569
diff changeset
   173
  \texttt{use_thy} only tries to reload $name$ itself, but is content with any
wenzelm
parents: 6569
diff changeset
   174
  version of its ancestors.
6568
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
   175
  
6569
wenzelm
parents: 6568
diff changeset
   176
\item[\ttindexbold{time_use_thy} "$name$";] same as \texttt{use_thy}, but
6568
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
   177
  reports the time taken to process the actual theory parts and {\ML} files
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
   178
  separately.
7592
wenzelm
parents: 7282
diff changeset
   179
  
7136
71f6eef45713 added update_thy_only;
wenzelm
parents: 6618
diff changeset
   180
\item[\ttindexbold{update_thy} "$name$";] is similar to \texttt{use_thy}, but
71f6eef45713 added update_thy_only;
wenzelm
parents: 6618
diff changeset
   181
  ensures that theory $name$ is fully up-to-date with respect to the file
7592
wenzelm
parents: 7282
diff changeset
   182
  system --- apart from theory $name$ itself, any of its ancestors may be
wenzelm
parents: 7282
diff changeset
   183
  reloaded as well.
6568
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
   184
  
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
   185
\end{ttdescription}
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
   186
9695
ec7d7f877712 proper setup of iman.sty/extra.sty/ttbox.sty;
wenzelm
parents: 9231
diff changeset
   187
Note that theories of pre-built logic images (e.g.\ HOL) are marked as
7282
69d601df351c finished theories;
wenzelm
parents: 7136
diff changeset
   188
\emph{finished} and cannot be updated any more.  See \S\ref{sec:more-theories}
69d601df351c finished theories;
wenzelm
parents: 7136
diff changeset
   189
for further information on Isabelle's theory loader.
4274
2048e7a79d09 cd, use: path variables;
wenzelm
parents: 3485
diff changeset
   190
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   191
3108
335efc3f5632 misc updates, tuning, cleanup;
wenzelm
parents: 2225
diff changeset
   192
\section{Setting flags}
335efc3f5632 misc updates, tuning, cleanup;
wenzelm
parents: 2225
diff changeset
   193
\begin{ttbox}
335efc3f5632 misc updates, tuning, cleanup;
wenzelm
parents: 2225
diff changeset
   194
set     : bool ref -> bool
335efc3f5632 misc updates, tuning, cleanup;
wenzelm
parents: 2225
diff changeset
   195
reset   : bool ref -> bool
335efc3f5632 misc updates, tuning, cleanup;
wenzelm
parents: 2225
diff changeset
   196
toggle  : bool ref -> bool
335efc3f5632 misc updates, tuning, cleanup;
wenzelm
parents: 2225
diff changeset
   197
\end{ttbox}\index{*set}\index{*reset}\index{*toggle}
3485
f27a30a18a17 Now there are TWO spaces after each full stop, so that the Emacs sentence
paulson
parents: 3200
diff changeset
   198
These are some shorthands for manipulating boolean references.  The new
3108
335efc3f5632 misc updates, tuning, cleanup;
wenzelm
parents: 2225
diff changeset
   199
value is returned.
335efc3f5632 misc updates, tuning, cleanup;
wenzelm
parents: 2225
diff changeset
   200
335efc3f5632 misc updates, tuning, cleanup;
wenzelm
parents: 2225
diff changeset
   201
4317
7264fa2ff2ec several minor updates;
wenzelm
parents: 4274
diff changeset
   202
\section{Diagnostic messages}
7264fa2ff2ec several minor updates;
wenzelm
parents: 4274
diff changeset
   203
\index{error messages}
7264fa2ff2ec several minor updates;
wenzelm
parents: 4274
diff changeset
   204
\index{warnings}
7264fa2ff2ec several minor updates;
wenzelm
parents: 4274
diff changeset
   205
6568
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
   206
Isabelle conceptually provides three output channels for different kinds of
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
   207
messages: ordinary text, warnings, errors.  Depending on the user interface
b38bc78d9a9d theory loader stuff updated and improved;
wenzelm
parents: 6343
diff changeset
   208
involved, these messages may appear in different text styles or colours.
4317
7264fa2ff2ec several minor updates;
wenzelm
parents: 4274
diff changeset
   209
7264fa2ff2ec several minor updates;
wenzelm
parents: 4274
diff changeset
   210
The default setup of an \texttt{isabelle} terminal session is as
7264fa2ff2ec several minor updates;
wenzelm
parents: 4274
diff changeset
   211
follows: plain output of ordinary text, warnings prefixed by
7264fa2ff2ec several minor updates;
wenzelm
parents: 4274
diff changeset
   212
\texttt{\#\#\#}'s, errors prefixed by \texttt{***}'s.  For example, a
7264fa2ff2ec several minor updates;
wenzelm
parents: 4274
diff changeset
   213
typical warning would look like this:
7264fa2ff2ec several minor updates;
wenzelm
parents: 4274
diff changeset
   214
\begin{ttbox}
7264fa2ff2ec several minor updates;
wenzelm
parents: 4274
diff changeset
   215
\#\#\# Beware the Jabberwock, my son!
7264fa2ff2ec several minor updates;
wenzelm
parents: 4274
diff changeset
   216
\#\#\# The jaws that bite, the claws that catch!
7264fa2ff2ec several minor updates;
wenzelm
parents: 4274
diff changeset
   217
\#\#\# Beware the Jubjub Bird, and shun
7264fa2ff2ec several minor updates;
wenzelm
parents: 4274
diff changeset
   218
\#\#\# The frumious Bandersnatch!
7264fa2ff2ec several minor updates;
wenzelm
parents: 4274
diff changeset
   219
\end{ttbox}
7264fa2ff2ec several minor updates;
wenzelm
parents: 4274
diff changeset
   220
7264fa2ff2ec several minor updates;
wenzelm
parents: 4274
diff changeset
   221
\texttt{ML} programs may output diagnostic messages using the
7264fa2ff2ec several minor updates;
wenzelm
parents: 4274
diff changeset
   222
following functions:
7264fa2ff2ec several minor updates;
wenzelm
parents: 4274
diff changeset
   223
\begin{ttbox}
7264fa2ff2ec several minor updates;
wenzelm
parents: 4274
diff changeset
   224
writeln : string -> unit
7264fa2ff2ec several minor updates;
wenzelm
parents: 4274
diff changeset
   225
warning : string -> unit
7264fa2ff2ec several minor updates;
wenzelm
parents: 4274
diff changeset
   226
error   : string -> 'a
7264fa2ff2ec several minor updates;
wenzelm
parents: 4274
diff changeset
   227
\end{ttbox}
7264fa2ff2ec several minor updates;
wenzelm
parents: 4274
diff changeset
   228
Note that \ttindex{error} fails by raising exception \ttindex{ERROR}
7264fa2ff2ec several minor updates;
wenzelm
parents: 4274
diff changeset
   229
after having output the text, while \ttindex{writeln} and
7264fa2ff2ec several minor updates;
wenzelm
parents: 4274
diff changeset
   230
\ttindex{warning} resume normal program execution.
7264fa2ff2ec several minor updates;
wenzelm
parents: 4274
diff changeset
   231
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   232
30184
37969710e61f removed parts of the manual that are clearly obsolete, or covered by
wenzelm
parents: 28504
diff changeset
   233
\section{Timing}
37969710e61f removed parts of the manual that are clearly obsolete, or covered by
wenzelm
parents: 28504
diff changeset
   234
\index{timing statistics}\index{proofs!timing}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   235
\begin{ttbox} 
30184
37969710e61f removed parts of the manual that are clearly obsolete, or covered by
wenzelm
parents: 28504
diff changeset
   236
timing: bool ref \hfill{\bf initially false}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   237
\end{ttbox}
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   238
322
bacfaeeea007 penultimate Springer draft
lcp
parents: 286
diff changeset
   239
\begin{ttdescription}
30184
37969710e61f removed parts of the manual that are clearly obsolete, or covered by
wenzelm
parents: 28504
diff changeset
   240
\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
   241
  This information is compiler-dependent.
322
bacfaeeea007 penultimate Springer draft
lcp
parents: 286
diff changeset
   242
\end{ttdescription}
104
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   243
d8205bb279a7 Initial revision
lcp
parents:
diff changeset
   244
\index{sessions|)}
5371
e27558a68b8d emacs local vars;
wenzelm
parents: 4543
diff changeset
   245
e27558a68b8d emacs local vars;
wenzelm
parents: 4543
diff changeset
   246
e27558a68b8d emacs local vars;
wenzelm
parents: 4543
diff changeset
   247
%%% Local Variables: 
e27558a68b8d emacs local vars;
wenzelm
parents: 4543
diff changeset
   248
%%% mode: latex
e27558a68b8d emacs local vars;
wenzelm
parents: 4543
diff changeset
   249
%%% TeX-master: "ref"
e27558a68b8d emacs local vars;
wenzelm
parents: 4543
diff changeset
   250
%%% End: