doc-src/System/Thy/Basics.thy
author wenzelm
Sun Nov 30 14:03:46 2008 +0100 (2008-11-30)
changeset 28916 0a802cdda340
parent 28914 f993cbffc42a
child 30195 9152fc3af67f
permissions -rw-r--r--
removed obsolete isabelle-interface executable and ISABELLE_INTERFACE setting;
separate chapter on interfaces as Isabelle tools;
wenzelm@28215
     1
(* $Id$ *)
wenzelm@28215
     2
wenzelm@28215
     3
theory Basics
wenzelm@28215
     4
imports Pure
wenzelm@28215
     5
begin
wenzelm@28215
     6
wenzelm@28215
     7
chapter {* The Isabelle system environment *}
wenzelm@28215
     8
wenzelm@28215
     9
text {*
wenzelm@28215
    10
  This manual describes Isabelle together with related tools and user
wenzelm@28916
    11
  interfaces as seen from a system oriented view.  See also the
wenzelm@28916
    12
  \emph{Isabelle/Isar Reference Manual}~\cite{isabelle-isar-ref} for
wenzelm@28916
    13
  the actual Isabelle input language and related concepts.
wenzelm@28215
    14
wenzelm@28916
    15
  \medskip The Isabelle system environment provides the following
wenzelm@28916
    16
  basic infrastructure to integrate tools smoothly.
wenzelm@28215
    17
wenzelm@28238
    18
  \begin{enumerate}
wenzelm@28215
    19
wenzelm@28916
    20
  \item The \emph{Isabelle settings} mechanism provides process
wenzelm@28916
    21
  environment variables to all Isabelle executables (including tools
wenzelm@28916
    22
  and user interfaces).
wenzelm@28215
    23
wenzelm@28504
    24
  \item The \emph{raw Isabelle process} (@{executable_ref
wenzelm@28504
    25
  "isabelle-process"}) runs logic sessions either interactively or in
wenzelm@28504
    26
  batch mode.  In particular, this view abstracts over the invocation
wenzelm@28504
    27
  of the actual ML system to be used.  Regular users rarely need to
wenzelm@28504
    28
  care about the low-level process.
wenzelm@28215
    29
wenzelm@28504
    30
  \item The \emph{Isabelle tools wrapper} (@{executable_ref isabelle})
wenzelm@28238
    31
  provides a generic startup environment Isabelle related utilities,
wenzelm@28238
    32
  user interfaces etc.  Such tools automatically benefit from the
wenzelm@28238
    33
  settings mechanism.
wenzelm@28215
    34
wenzelm@28238
    35
  \end{enumerate}
wenzelm@28215
    36
*}
wenzelm@28215
    37
wenzelm@28215
    38
wenzelm@28215
    39
section {* Isabelle settings \label{sec:settings} *}
wenzelm@28215
    40
wenzelm@28215
    41
text {*
wenzelm@28215
    42
  The Isabelle system heavily depends on the \emph{settings
wenzelm@28215
    43
  mechanism}\indexbold{settings}.  Essentially, this is a statically
wenzelm@28215
    44
  scoped collection of environment variables, such as @{setting
wenzelm@28215
    45
  ISABELLE_HOME}, @{setting ML_SYSTEM}, @{setting ML_HOME}.  These
wenzelm@28215
    46
  variables are \emph{not} intended to be set directly from the shell,
wenzelm@28215
    47
  though.  Isabelle employs a somewhat more sophisticated scheme of
wenzelm@28215
    48
  \emph{settings files} --- one for site-wide defaults, another for
wenzelm@28215
    49
  additional user-specific modifications.  With all configuration
wenzelm@28215
    50
  variables in at most two places, this scheme is more maintainable
wenzelm@28215
    51
  and user-friendly than global shell environment variables.
wenzelm@28215
    52
wenzelm@28215
    53
  In particular, we avoid the typical situation where prospective
wenzelm@28215
    54
  users of a software package are told to put several things into
wenzelm@28215
    55
  their shell startup scripts, before being able to actually run the
wenzelm@28215
    56
  program. Isabelle requires none such administrative chores of its
wenzelm@28215
    57
  end-users --- the executables can be invoked straight away.
wenzelm@28238
    58
  Occasionally, users would still want to put the @{"file"
wenzelm@28238
    59
  "$ISABELLE_HOME/bin"} directory into their shell's search path, but
wenzelm@28238
    60
  this is not required.
wenzelm@28215
    61
*}
wenzelm@28215
    62
wenzelm@28215
    63
wenzelm@28215
    64
subsection {* Building the environment *}
wenzelm@28215
    65
wenzelm@28215
    66
text {*
wenzelm@28215
    67
  Whenever any of the Isabelle executables is run, their settings
wenzelm@28215
    68
  environment is put together as follows.
wenzelm@28215
    69
wenzelm@28215
    70
  \begin{enumerate}
wenzelm@28215
    71
wenzelm@28215
    72
  \item The special variable @{setting_def ISABELLE_HOME} is
wenzelm@28215
    73
  determined automatically from the location of the binary that has
wenzelm@28215
    74
  been run.
wenzelm@28215
    75
  
wenzelm@28215
    76
  You should not try to set @{setting ISABELLE_HOME} manually. Also
wenzelm@28215
    77
  note that the Isabelle executables either have to be run from their
wenzelm@28215
    78
  original location in the distribution directory, or via the
wenzelm@28238
    79
  executable objects created by the @{tool install} utility.  Symbolic
wenzelm@28238
    80
  links are admissible, but a plain copy of the @{"file"
wenzelm@28238
    81
  "$ISABELLE_HOME/bin"} files will not work!
wenzelm@28238
    82
wenzelm@28238
    83
  \item The file @{"file" "$ISABELLE_HOME/etc/settings"} ist run as a
wenzelm@28238
    84
  @{executable_ref bash} shell script with the auto-export option for
wenzelm@28238
    85
  variables enabled.
wenzelm@28215
    86
  
wenzelm@28215
    87
  This file holds a rather long list of shell variable assigments,
wenzelm@28215
    88
  thus providing the site-wide default settings.  The Isabelle
wenzelm@28215
    89
  distribution already contains a global settings file with sensible
wenzelm@28215
    90
  defaults for most variables.  When installing the system, only a few
wenzelm@28215
    91
  of these may have to be adapted (probably @{setting ML_SYSTEM}
wenzelm@28215
    92
  etc.).
wenzelm@28215
    93
  
wenzelm@28285
    94
  \item The file @{verbatim "$ISABELLE_HOME_USER/etc/settings"} (if it
wenzelm@28215
    95
  exists) is run in the same way as the site default settings. Note
wenzelm@28215
    96
  that the variable @{setting ISABELLE_HOME_USER} has already been set
wenzelm@28914
    97
  before --- usually to @{verbatim "~/.isabelle"}.
wenzelm@28215
    98
  
wenzelm@28215
    99
  Thus individual users may override the site-wide defaults.  See also
wenzelm@28238
   100
  file @{"file" "$ISABELLE_HOME/etc/user-settings.sample"} in the
wenzelm@28238
   101
  distribution.  Typically, a user settings file would contain only a
wenzelm@28238
   102
  few lines, just the assigments that are really changed.  One should
wenzelm@28238
   103
  definitely \emph{not} start with a full copy the basic @{"file"
wenzelm@28215
   104
  "$ISABELLE_HOME/etc/settings"}. This could cause very annoying
wenzelm@28215
   105
  maintainance problems later, when the Isabelle installation is
wenzelm@28215
   106
  updated or changed otherwise.
wenzelm@28215
   107
  
wenzelm@28215
   108
  \end{enumerate}
wenzelm@28215
   109
wenzelm@28238
   110
  Since settings files are regular GNU @{executable_def bash} scripts,
wenzelm@28238
   111
  one may use complex shell commands, such as @{verbatim "if"} or
wenzelm@28215
   112
  @{verbatim "case"} statements to set variables depending on the
wenzelm@28215
   113
  system architecture or other environment variables.  Such advanced
wenzelm@28215
   114
  features should be added only with great care, though. In
wenzelm@28215
   115
  particular, external environment references should be kept at a
wenzelm@28215
   116
  minimum.
wenzelm@28215
   117
wenzelm@28215
   118
  \medskip A few variables are somewhat special:
wenzelm@28215
   119
wenzelm@28215
   120
  \begin{itemize}
wenzelm@28215
   121
wenzelm@28502
   122
  \item @{setting_def ISABELLE_PROCESS} and @{setting_def ISABELLE_TOOL} are set
wenzelm@28215
   123
  automatically to the absolute path names of the @{executable
wenzelm@28504
   124
  "isabelle-process"} and @{executable isabelle} executables,
wenzelm@28215
   125
  respectively.
wenzelm@28215
   126
  
wenzelm@28238
   127
  \item @{setting_ref ISABELLE_OUTPUT} will have the identifiers of
wenzelm@28215
   128
  the Isabelle distribution (cf.\ @{setting ISABELLE_IDENTIFIER}) and
wenzelm@28215
   129
  the ML system (cf.\ @{setting ML_IDENTIFIER}) appended automatically
wenzelm@28215
   130
  to its value.
wenzelm@28215
   131
wenzelm@28215
   132
  \end{itemize}
wenzelm@28215
   133
wenzelm@28238
   134
  \medskip Note that the settings environment may be inspected with
wenzelm@28238
   135
  the Isabelle tool @{tool getenv}.  This might help to figure out the
wenzelm@28238
   136
  effect of complex settings scripts.
wenzelm@28215
   137
*}
wenzelm@28215
   138
wenzelm@28215
   139
wenzelm@28215
   140
subsection{* Common variables *}
wenzelm@28215
   141
wenzelm@28215
   142
text {*
wenzelm@28215
   143
  This is a reference of common Isabelle settings variables. Note that
wenzelm@28215
   144
  the list is somewhat open-ended. Third-party utilities or interfaces
wenzelm@28215
   145
  may add their own selection. Variables that are special in some
wenzelm@28215
   146
  sense are marked with @{text "\<^sup>*"}.
wenzelm@28215
   147
wenzelm@28215
   148
  \begin{description}
wenzelm@28215
   149
wenzelm@28215
   150
  \item[@{setting_def ISABELLE_HOME}@{text "\<^sup>*"}] is the
wenzelm@28215
   151
  location of the top-level Isabelle distribution directory. This is
wenzelm@28215
   152
  automatically determined from the Isabelle executable that has been
wenzelm@28215
   153
  invoked.  Do not attempt to set @{setting ISABELLE_HOME} yourself
wenzelm@28238
   154
  from the shell!
wenzelm@28215
   155
  
wenzelm@28215
   156
  \item[@{setting_def ISABELLE_HOME_USER}] is the user-specific
wenzelm@28215
   157
  counterpart of @{setting ISABELLE_HOME}. The default value is
wenzelm@28914
   158
  @{verbatim "~/.isabelle"}, under rare circumstances this may be
wenzelm@28215
   159
  changed in the global setting file.  Typically, the @{setting
wenzelm@28215
   160
  ISABELLE_HOME_USER} directory mimics @{setting ISABELLE_HOME} to
wenzelm@28215
   161
  some extend. In particular, site-wide defaults may be overridden by
wenzelm@28285
   162
  a private @{verbatim "$ISABELLE_HOME_USER/etc/settings"}.
wenzelm@28215
   163
  
wenzelm@28502
   164
  \item[@{setting_def ISABELLE_PROCESS}@{text "\<^sup>*"}, @{setting
wenzelm@28500
   165
  ISABELLE_TOOL}@{text "\<^sup>*"}] are automatically set to the full path
wenzelm@28215
   166
  names of the @{executable "isabelle-process"} and @{executable
wenzelm@28504
   167
  isabelle} executables, respectively.  Thus other tools and scripts
wenzelm@28238
   168
  need not assume that the @{"file" "$ISABELLE_HOME/bin"} directory is
wenzelm@28238
   169
  on the current search path of the shell.
wenzelm@28215
   170
  
wenzelm@28215
   171
  \item[@{setting_def ISABELLE_IDENTIFIER}@{text "\<^sup>*"}] refers
wenzelm@28215
   172
  to the name of this Isabelle distribution, e.g.\ ``@{verbatim
wenzelm@28215
   173
  Isabelle2008}''.
wenzelm@28215
   174
wenzelm@28215
   175
  \item[@{setting_def ML_SYSTEM}, @{setting_def ML_HOME},
wenzelm@28215
   176
  @{setting_def ML_OPTIONS}, @{setting_def ML_PLATFORM}, @{setting_def
wenzelm@28215
   177
  ML_IDENTIFIER}@{text "\<^sup>*"}] specify the underlying ML system
wenzelm@28215
   178
  to be used for Isabelle.  There is only a fixed set of admissable
wenzelm@28238
   179
  @{setting ML_SYSTEM} names (see the @{"file"
wenzelm@28238
   180
  "$ISABELLE_HOME/etc/settings"} file of the distribution).
wenzelm@28215
   181
  
wenzelm@28215
   182
  The actual compiler binary will be run from the directory @{setting
wenzelm@28215
   183
  ML_HOME}, with @{setting ML_OPTIONS} as first arguments on the
wenzelm@28215
   184
  command line.  The optional @{setting ML_PLATFORM} may specify the
wenzelm@28215
   185
  binary format of ML heap images, which is useful for cross-platform
wenzelm@28215
   186
  installations.  The value of @{setting ML_IDENTIFIER} is
wenzelm@28215
   187
  automatically obtained by composing the values of @{setting
wenzelm@28215
   188
  ML_SYSTEM}, @{setting ML_PLATFORM} and the Isabelle version values.
wenzelm@28215
   189
  
wenzelm@28215
   190
  \item[@{setting_def ISABELLE_PATH}] is a list of directories
wenzelm@28215
   191
  (separated by colons) where Isabelle logic images may reside.  When
wenzelm@28215
   192
  looking up heaps files, the value of @{setting ML_IDENTIFIER} is
wenzelm@28215
   193
  appended to each component internally.
wenzelm@28215
   194
  
wenzelm@28215
   195
  \item[@{setting_def ISABELLE_OUTPUT}@{text "\<^sup>*"}] is a
wenzelm@28215
   196
  directory where output heap files should be stored by default. The
wenzelm@28215
   197
  ML system and Isabelle version identifier is appended here, too.
wenzelm@28215
   198
  
wenzelm@28215
   199
  \item[@{setting_def ISABELLE_BROWSER_INFO}] is the directory where
wenzelm@28215
   200
  theory browser information (HTML text, graph data, and printable
wenzelm@28215
   201
  documents) is stored (see also \secref{sec:info}).  The default
wenzelm@28215
   202
  value is @{verbatim "$ISABELLE_HOME_USER/browser_info"}.
wenzelm@28215
   203
  
wenzelm@28215
   204
  \item[@{setting_def ISABELLE_LOGIC}] specifies the default logic to
wenzelm@28215
   205
  load if none is given explicitely by the user.  The default value is
wenzelm@28215
   206
  @{verbatim HOL}.
wenzelm@28215
   207
  
wenzelm@28215
   208
  \item[@{setting_def ISABELLE_LINE_EDITOR}] specifies the default
wenzelm@28238
   209
  line editor for the @{tool_ref tty} interface.
wenzelm@28215
   210
wenzelm@28215
   211
  \item[@{setting_def ISABELLE_USEDIR_OPTIONS}] is implicitly prefixed
wenzelm@28238
   212
  to the command line of any @{tool_ref usedir} invocation. This
wenzelm@28238
   213
  typically contains compilation options for object-logics --- @{tool
wenzelm@28238
   214
  usedir} is the basic utility for managing logic sessions (cf.\ the
wenzelm@28238
   215
  @{verbatim IsaMakefile}s in the distribution).
wenzelm@28215
   216
wenzelm@28215
   217
  \item[@{setting_def ISABELLE_FILE_IDENT}] specifies a shell command
wenzelm@28215
   218
  for producing a source file identification, based on the actual
wenzelm@28215
   219
  content instead of the full physical path and date stamp (which is
wenzelm@28215
   220
  the default). A typical identification would produce a ``digest'' of
wenzelm@28215
   221
  the text, using a cryptographic hash function like SHA-1, for
wenzelm@28215
   222
  example.
wenzelm@28215
   223
  
wenzelm@28215
   224
  \item[@{setting_def ISABELLE_LATEX}, @{setting_def
wenzelm@28215
   225
  ISABELLE_PDFLATEX}, @{setting_def ISABELLE_BIBTEX}, @{setting_def
wenzelm@28215
   226
  ISABELLE_DVIPS}] refer to {\LaTeX} related tools for Isabelle
wenzelm@28215
   227
  document preparation (see also \secref{sec:tool-latex}).
wenzelm@28215
   228
  
wenzelm@28215
   229
  \item[@{setting_def ISABELLE_TOOLS}] is a colon separated list of
wenzelm@28504
   230
  directories that are scanned by @{executable isabelle} for external
wenzelm@28504
   231
  utility programs (see also \secref{sec:isabelle-tool}).
wenzelm@28215
   232
  
wenzelm@28215
   233
  \item[@{setting_def ISABELLE_DOCS}] is a colon separated list of
wenzelm@28215
   234
  directories with documentation files.
wenzelm@28215
   235
  
wenzelm@28215
   236
  \item[@{setting_def ISABELLE_DOC_FORMAT}] specifies the preferred
wenzelm@28215
   237
  document format, typically @{verbatim dvi} or @{verbatim pdf}.
wenzelm@28215
   238
  
wenzelm@28215
   239
  \item[@{setting_def DVI_VIEWER}] specifies the command to be used
wenzelm@28215
   240
  for displaying @{verbatim dvi} files.
wenzelm@28215
   241
  
wenzelm@28215
   242
  \item[@{setting_def PDF_VIEWER}] specifies the command to be used
wenzelm@28215
   243
  for displaying @{verbatim pdf} files.
wenzelm@28215
   244
  
wenzelm@28215
   245
  \item[@{setting_def PRINT_COMMAND}] specifies the standard printer
wenzelm@28215
   246
  spool command, which is expected to accept @{verbatim ps} files.
wenzelm@28215
   247
  
wenzelm@28215
   248
  \item[@{setting_def ISABELLE_TMP_PREFIX}@{text "\<^sup>*"}] is the
wenzelm@28238
   249
  prefix from which any running @{executable "isabelle-process"}
wenzelm@28238
   250
  derives an individual directory for temporary files.  The default is
wenzelm@28215
   251
  somewhere in @{verbatim "/tmp"}.
wenzelm@28215
   252
  
wenzelm@28215
   253
  \end{description}
wenzelm@28215
   254
*}
wenzelm@28215
   255
wenzelm@28215
   256
wenzelm@28215
   257
section {* The raw Isabelle process *}
wenzelm@28215
   258
wenzelm@28215
   259
text {*
wenzelm@28504
   260
  The @{executable_def "isabelle-process"} executable runs bare-bones
wenzelm@28504
   261
  Isabelle logic sessions --- either interactively or in batch mode.
wenzelm@28504
   262
  It provides an abstraction over the underlying ML system, and over
wenzelm@28504
   263
  the actual heap file locations.  Its usage is:
wenzelm@28215
   264
wenzelm@28215
   265
\begin{ttbox}
wenzelm@28238
   266
Usage: isabelle-process [OPTIONS] [INPUT] [OUTPUT]
wenzelm@28215
   267
wenzelm@28215
   268
  Options are:
wenzelm@28215
   269
    -C           tell ML system to copy output image
wenzelm@28215
   270
    -I           startup Isar interaction mode
wenzelm@28215
   271
    -P           startup Proof General interaction mode
wenzelm@28215
   272
    -S           secure mode -- disallow critical operations
wenzelm@28215
   273
    -W OUTPUT    startup process wrapper, with messages going to OUTPUT stream
wenzelm@28215
   274
    -X           startup PGIP interaction mode
wenzelm@28215
   275
    -c           tell ML system to compress output image
wenzelm@28215
   276
    -e MLTEXT    pass MLTEXT to the ML session
wenzelm@28215
   277
    -f           pass 'Session.finish();' to the ML session
wenzelm@28215
   278
    -m MODE      add print mode for output
wenzelm@28215
   279
    -q           non-interactive session
wenzelm@28215
   280
    -r           open heap file read-only
wenzelm@28215
   281
    -u           pass 'use"ROOT.ML";' to the ML session
wenzelm@28215
   282
    -w           reset write permissions on OUTPUT
wenzelm@28215
   283
wenzelm@28215
   284
  INPUT (default "\$ISABELLE_LOGIC") and OUTPUT specify in/out heaps.
wenzelm@28215
   285
  These are either names to be searched in the Isabelle path, or
wenzelm@28215
   286
  actual file names (containing at least one /).
wenzelm@28215
   287
  If INPUT is "RAW_ML_SYSTEM", just start the bare bones ML system.
wenzelm@28215
   288
\end{ttbox}
wenzelm@28215
   289
wenzelm@28215
   290
  Input files without path specifications are looked up in the
wenzelm@28215
   291
  @{setting ISABELLE_PATH} setting, which may consist of multiple
wenzelm@28215
   292
  components separated by colons --- these are tried in the given
wenzelm@28215
   293
  order with the value of @{setting ML_IDENTIFIER} appended
wenzelm@28215
   294
  internally.  In a similar way, base names are relative to the
wenzelm@28215
   295
  directory specified by @{setting ISABELLE_OUTPUT}.  In any case,
wenzelm@28215
   296
  actual file locations may also be given by including at least one
wenzelm@28215
   297
  slash (@{verbatim "/"}) in the name (hint: use @{verbatim "./"} to
wenzelm@28215
   298
  refer to the current directory).
wenzelm@28215
   299
*}
wenzelm@28215
   300
wenzelm@28215
   301
wenzelm@28223
   302
subsubsection {* Options *}
wenzelm@28215
   303
wenzelm@28215
   304
text {*
wenzelm@28215
   305
  If the input heap file does not have write permission bits set, or
wenzelm@28215
   306
  the @{verbatim "-r"} option is given explicitely, then the session
wenzelm@28215
   307
  started will be read-only.  That is, the ML world cannot be
wenzelm@28215
   308
  committed back into the image file.  Otherwise, a writable session
wenzelm@28215
   309
  enables commits into either the input file, or into another output
wenzelm@28215
   310
  heap file (if that is given as the second argument on the command
wenzelm@28215
   311
  line).
wenzelm@28215
   312
wenzelm@28215
   313
  The read-write state of sessions is determined at startup only, it
wenzelm@28215
   314
  cannot be changed intermediately. Also note that heap images may
wenzelm@28215
   315
  require considerable amounts of disk space (approximately
wenzelm@28215
   316
  50--200~MB). Users are responsible for themselves to dispose their
wenzelm@28215
   317
  heap files when they are no longer needed.
wenzelm@28215
   318
wenzelm@28215
   319
  \medskip The @{verbatim "-w"} option makes the output heap file
wenzelm@28215
   320
  read-only after terminating.  Thus subsequent invocations cause the
wenzelm@28215
   321
  logic image to be read-only automatically.
wenzelm@28215
   322
wenzelm@28215
   323
  \medskip The @{verbatim "-c"} option tells the underlying ML system
wenzelm@28215
   324
  to compress the output heap (fully transparently).  On Poly/ML for
wenzelm@28215
   325
  example, the image is garbage collected and all stored values are
wenzelm@28215
   326
  maximally shared, resulting in up to @{text "50%"} less disk space
wenzelm@28215
   327
  consumption.
wenzelm@28215
   328
wenzelm@28215
   329
  \medskip The @{verbatim "-C"} option tells the ML system to produce
wenzelm@28215
   330
  a completely self-contained output image, probably including a copy
wenzelm@28215
   331
  of the ML runtime system itself.
wenzelm@28215
   332
wenzelm@28215
   333
  \medskip Using the @{verbatim "-e"} option, arbitrary ML code may be
wenzelm@28215
   334
  passed to the Isabelle session from the command line. Multiple
wenzelm@28215
   335
  @{verbatim "-e"}'s are evaluated in the given order. Strange things
wenzelm@28215
   336
  may happen when errorneous ML code is provided. Also make sure that
wenzelm@28215
   337
  the ML commands are terminated properly by semicolon.
wenzelm@28215
   338
wenzelm@28215
   339
  \medskip The @{verbatim "-u"} option is a shortcut for @{verbatim
wenzelm@28215
   340
  "-e"} passing ``@{verbatim "use \"ROOT.ML\";"}'' to the ML session.
wenzelm@28223
   341
  The @{verbatim "-f"} option passes ``@{verbatim
wenzelm@28223
   342
  "Session.finish();"}'', which is intended mainly for administrative
wenzelm@28223
   343
  purposes.
wenzelm@28215
   344
wenzelm@28215
   345
  \medskip The @{verbatim "-m"} option adds identifiers of print modes
wenzelm@28215
   346
  to be made active for this session. Typically, this is used by some
wenzelm@28215
   347
  user interface, e.g.\ to enable output of proper mathematical
wenzelm@28215
   348
  symbols.
wenzelm@28215
   349
wenzelm@28215
   350
  \medskip Isabelle normally enters an interactive top-level loop
wenzelm@28215
   351
  (after processing the @{verbatim "-e"} texts). The @{verbatim "-q"}
wenzelm@28215
   352
  option inhibits interaction, thus providing a pure batch mode
wenzelm@28215
   353
  facility.
wenzelm@28215
   354
wenzelm@28215
   355
  \medskip The @{verbatim "-I"} option makes Isabelle enter Isar
wenzelm@28215
   356
  interaction mode on startup, instead of the primitive ML top-level.
wenzelm@28215
   357
  The @{verbatim "-P"} option configures the top-level loop for
wenzelm@28215
   358
  interaction with the Proof General user interface, and the
wenzelm@28215
   359
  @{verbatim "-X"} option enables XML-based PGIP communication.  The
wenzelm@28215
   360
  @{verbatim "-W"} option makes Isabelle enter a special process
wenzelm@28215
   361
  wrapper for interaction via an external program; the protocol is a
wenzelm@28238
   362
  stripped-down version of Proof General the interaction mode, see
wenzelm@28238
   363
  also @{"file" "~~/src/Pure/Tools/isabelle_process.ML"} and @{"file"
wenzelm@28238
   364
  "~~/src/Pure/Tools/isabelle_process.scala"}.
wenzelm@28215
   365
wenzelm@28215
   366
  \medskip The @{verbatim "-S"} option makes the Isabelle process more
wenzelm@28215
   367
  secure by disabling some critical operations, notably runtime
wenzelm@28215
   368
  compilation and evaluation of ML source code.
wenzelm@28215
   369
*}
wenzelm@28215
   370
wenzelm@28215
   371
wenzelm@28223
   372
subsubsection {* Examples *}
wenzelm@28215
   373
wenzelm@28215
   374
text {*
wenzelm@28215
   375
  Run an interactive session of the default object-logic (as specified
wenzelm@28215
   376
  by the @{setting ISABELLE_LOGIC} setting) like this:
wenzelm@28215
   377
\begin{ttbox}
wenzelm@28238
   378
isabelle-process
wenzelm@28215
   379
\end{ttbox}
wenzelm@28215
   380
wenzelm@28215
   381
  Usually @{setting ISABELLE_LOGIC} refers to one of the standard
wenzelm@28215
   382
  logic images, which are read-only by default.  A writable session
wenzelm@28215
   383
  --- based on @{verbatim FOL}, but output to @{verbatim Foo} (in the
wenzelm@28238
   384
  directory specified by the @{setting ISABELLE_OUTPUT} setting) ---
wenzelm@28215
   385
  may be invoked as follows:
wenzelm@28215
   386
\begin{ttbox}
wenzelm@28238
   387
isabelle-process FOL Foo
wenzelm@28215
   388
\end{ttbox}
wenzelm@28215
   389
  Ending this session normally (e.g.\ by typing control-D) dumps the
wenzelm@28215
   390
  whole ML system state into @{verbatim Foo}. Be prepared for several
wenzelm@28215
   391
  tens of megabytes.
wenzelm@28215
   392
wenzelm@28215
   393
  The @{verbatim Foo} session may be continued later (still in
wenzelm@28215
   394
  writable state) by:
wenzelm@28215
   395
\begin{ttbox}
wenzelm@28238
   396
isabelle-process Foo
wenzelm@28215
   397
\end{ttbox}
wenzelm@28215
   398
  A read-only @{verbatim Foo} session may be started by:
wenzelm@28215
   399
\begin{ttbox}
wenzelm@28238
   400
isabelle-process -r Foo
wenzelm@28215
   401
\end{ttbox}
wenzelm@28215
   402
wenzelm@28215
   403
  \medskip Note that manual session management like this does
wenzelm@28215
   404
  \emph{not} provide proper setup for theory presentation.  This would
wenzelm@28238
   405
  require the @{tool usedir} utility.
wenzelm@28215
   406
wenzelm@28238
   407
  \bigskip The next example demonstrates batch execution of Isabelle.
wenzelm@28238
   408
  We retrieve the @{verbatim FOL} theory value from the theory loader
wenzelm@28238
   409
  within ML:
wenzelm@28215
   410
\begin{ttbox}
wenzelm@28238
   411
isabelle-process -e 'theory "FOL";' -q -r FOL
wenzelm@28215
   412
\end{ttbox}
wenzelm@28215
   413
  Note that the output text will be interspersed with additional junk
wenzelm@28238
   414
  messages by the ML runtime environment.  The @{verbatim "-W"} option
wenzelm@28238
   415
  allows to communicate with the Isabelle process via an external
wenzelm@28238
   416
  program in a more robust fashion.
wenzelm@28238
   417
*}
wenzelm@28238
   418
wenzelm@28238
   419
wenzelm@28504
   420
section {* The Isabelle tools wrapper \label{sec:isabelle-tool} *}
wenzelm@28238
   421
wenzelm@28238
   422
text {*
wenzelm@28238
   423
  All Isabelle related tools and interfaces are called via a common
wenzelm@28504
   424
  wrapper --- @{executable isabelle}:
wenzelm@28238
   425
wenzelm@28238
   426
\begin{ttbox}
wenzelm@28504
   427
Usage: isabelle TOOL [ARGS ...]
wenzelm@28238
   428
wenzelm@28506
   429
  Start Isabelle tool NAME with ARGS; pass "-?" for tool specific help.
wenzelm@28238
   430
wenzelm@28238
   431
  Available tools are:
wenzelm@28238
   432
wenzelm@28238
   433
    browser - Isabelle graph browser
wenzelm@28238
   434
    \dots
wenzelm@28238
   435
\end{ttbox}
wenzelm@28238
   436
wenzelm@28238
   437
  In principle, Isabelle tools are ordinary executable scripts that
wenzelm@28238
   438
  are run within the Isabelle settings environment, see
wenzelm@28238
   439
  \secref{sec:settings}.  The set of available tools is collected by
wenzelm@28504
   440
  @{executable isabelle} from the directories listed in the @{setting
wenzelm@28238
   441
  ISABELLE_TOOLS} setting.  Do not try to call the scripts directly
wenzelm@28238
   442
  from the shell.  Neither should you add the tool directories to your
wenzelm@28238
   443
  shell's search path!
wenzelm@28238
   444
*}
wenzelm@28238
   445
wenzelm@28238
   446
wenzelm@28238
   447
subsubsection {* Examples *}
wenzelm@28238
   448
wenzelm@28238
   449
text {*
wenzelm@28238
   450
  Show the list of available documentation of the current Isabelle
wenzelm@28238
   451
  installation like this:
wenzelm@28238
   452
wenzelm@28238
   453
\begin{ttbox}
wenzelm@28504
   454
  isabelle doc
wenzelm@28238
   455
\end{ttbox}
wenzelm@28238
   456
wenzelm@28238
   457
  View a certain document as follows:
wenzelm@28238
   458
\begin{ttbox}
wenzelm@28504
   459
  isabelle doc isar-ref
wenzelm@28238
   460
\end{ttbox}
wenzelm@28238
   461
wenzelm@28238
   462
  Create an Isabelle session derived from HOL (see also
wenzelm@28238
   463
  \secref{sec:tool-mkdir} and \secref{sec:tool-make}):
wenzelm@28238
   464
\begin{ttbox}
wenzelm@28504
   465
  isabelle mkdir HOL Test && isabelle make
wenzelm@28238
   466
\end{ttbox}
wenzelm@28504
   467
  Note that @{verbatim "isabelle mkdir"} is usually only invoked once;
wenzelm@28238
   468
  existing sessions (including document output etc.) are then updated
wenzelm@28504
   469
  by @{verbatim "isabelle make"} alone.
wenzelm@28215
   470
*}
wenzelm@28215
   471
wenzelm@28223
   472
end