
wenzelm@28215: theory Basics
wenzelm@28215: imports Pure
wenzelm@28215: begin
wenzelm@28215: 
wenzelm@28215: chapter {* The Isabelle system environment *}
wenzelm@28215: 
wenzelm@28215: text {*
wenzelm@28215:   This manual describes Isabelle together with related tools and user
wenzelm@28916:   interfaces as seen from a system oriented view.  See also the
wenzelm@28916:   \emph{Isabelle/Isar Reference Manual}~\cite{isabelle-isar-ref} for
wenzelm@28916:   the actual Isabelle input language and related concepts.
wenzelm@28215: 
wenzelm@28916:   \medskip The Isabelle system environment provides the following
wenzelm@28916:   basic infrastructure to integrate tools smoothly.
wenzelm@28215: 
wenzelm@28238:   \begin{enumerate}
wenzelm@28215: 
wenzelm@28916:   \item The \emph{Isabelle settings} mechanism provides process
wenzelm@28916:   environment variables to all Isabelle executables (including tools
wenzelm@28916:   and user interfaces).
wenzelm@28215: 
wenzelm@28504:   \item The \emph{raw Isabelle process} (@{executable_ref
wenzelm@28504:   "isabelle-process"}) runs logic sessions either interactively or in
wenzelm@28504:   batch mode.  In particular, this view abstracts over the invocation
wenzelm@28504:   of the actual ML system to be used.  Regular users rarely need to
wenzelm@28504:   care about the low-level process.
wenzelm@28215: 
wenzelm@28504:   \item The \emph{Isabelle tools wrapper} (@{executable_ref isabelle})
wenzelm@28238:   provides a generic startup environment Isabelle related utilities,
wenzelm@28238:   user interfaces etc.  Such tools automatically benefit from the
wenzelm@28238:   settings mechanism.
wenzelm@28215: 
wenzelm@28238:   \end{enumerate}
wenzelm@28215: *}
wenzelm@28215: 
wenzelm@28215: 
wenzelm@28215: section {* Isabelle settings \label{sec:settings} *}
wenzelm@28215: 
wenzelm@28215: text {*
wenzelm@28215:   The Isabelle system heavily depends on the \emph{settings
wenzelm@28215:   mechanism}\indexbold{settings}.  Essentially, this is a statically
wenzelm@28215:   scoped collection of environment variables, such as @{setting
wenzelm@28215:   ISABELLE_HOME}, @{setting ML_SYSTEM}, @{setting ML_HOME}.  These
wenzelm@28215:   variables are \emph{not} intended to be set directly from the shell,
wenzelm@28215:   though.  Isabelle employs a somewhat more sophisticated scheme of
wenzelm@28215:   \emph{settings files} --- one for site-wide defaults, another for
wenzelm@28215:   additional user-specific modifications.  With all configuration
wenzelm@28215:   variables in at most two places, this scheme is more maintainable
wenzelm@28215:   and user-friendly than global shell environment variables.
wenzelm@28215: 
wenzelm@28215:   In particular, we avoid the typical situation where prospective
wenzelm@28215:   users of a software package are told to put several things into
wenzelm@28215:   their shell startup scripts, before being able to actually run the
wenzelm@28215:   program. Isabelle requires none such administrative chores of its
wenzelm@28215:   end-users --- the executables can be invoked straight away.
wenzelm@28238:   Occasionally, users would still want to put the @{"file"
wenzelm@28238:   "$ISABELLE_HOME/bin"} directory into their shell's search path, but
wenzelm@28238:   this is not required.
wenzelm@28215: *}
wenzelm@28215: 
wenzelm@28215: 
wenzelm@32323: subsection {* Bootstrapping the environment \label{sec:boot} *}
wenzelm@28215: 
wenzelm@32323: text {* Isabelle executables need to be run within a proper settings
wenzelm@32323:   environment.  This is bootstrapped as described below, on the first
wenzelm@32323:   invocation of one of the outer wrapper scripts (such as
wenzelm@32323:   @{executable_ref isabelle}).  This happens only once for each
wenzelm@32323:   process tree, i.e.\ the environment is passed to subprocesses
wenzelm@32323:   according to regular Unix conventions.
wenzelm@28215: 
wenzelm@28215:   \begin{enumerate}
wenzelm@28215: 
wenzelm@28215:   \item The special variable @{setting_def ISABELLE_HOME} is
wenzelm@28215:   determined automatically from the location of the binary that has
wenzelm@28215:   been run.
wenzelm@28215:   
wenzelm@28215:   You should not try to set @{setting ISABELLE_HOME} manually. Also
wenzelm@28215:   note that the Isabelle executables either have to be run from their
wenzelm@28215:   original location in the distribution directory, or via the
wenzelm@28238:   executable objects created by the @{tool install} utility.  Symbolic
wenzelm@28238:   links are admissible, but a plain copy of the @{"file"
wenzelm@28238:   "$ISABELLE_HOME/bin"} files will not work!
wenzelm@28238: 
wenzelm@32324:   \item The file @{"file" "$ISABELLE_HOME/etc/settings"} is run as a
wenzelm@28238:   @{executable_ref bash} shell script with the auto-export option for
wenzelm@28238:   variables enabled.
wenzelm@28215:   
wenzelm@28215:   This file holds a rather long list of shell variable assigments,
wenzelm@28215:   thus providing the site-wide default settings.  The Isabelle
wenzelm@28215:   distribution already contains a global settings file with sensible
wenzelm@28215:   defaults for most variables.  When installing the system, only a few
wenzelm@28215:   of these may have to be adapted (probably @{setting ML_SYSTEM}
wenzelm@28215:   etc.).
wenzelm@28215:   
wenzelm@28285:   \item The file @{verbatim "$ISABELLE_HOME_USER/etc/settings"} (if it
wenzelm@28215:   exists) is run in the same way as the site default settings. Note
wenzelm@28215:   that the variable @{setting ISABELLE_HOME_USER} has already been set
wenzelm@28914:   before --- usually to @{verbatim "~/.isabelle"}.
wenzelm@28215:   
wenzelm@28215:   Thus individual users may override the site-wide defaults.  See also
wenzelm@28238:   file @{"file" "$ISABELLE_HOME/etc/user-settings.sample"} in the
wenzelm@28238:   distribution.  Typically, a user settings file would contain only a
wenzelm@28238:   few lines, just the assigments that are really changed.  One should
wenzelm@28238:   definitely \emph{not} start with a full copy the basic @{"file"
wenzelm@28215:   "$ISABELLE_HOME/etc/settings"}. This could cause very annoying
wenzelm@28215:   maintainance problems later, when the Isabelle installation is
wenzelm@28215:   updated or changed otherwise.
wenzelm@28215:   
wenzelm@28215:   \end{enumerate}
wenzelm@28215: 
wenzelm@28238:   Since settings files are regular GNU @{executable_def bash} scripts,
wenzelm@28238:   one may use complex shell commands, such as @{verbatim "if"} or
wenzelm@28215:   @{verbatim "case"} statements to set variables depending on the
wenzelm@28215:   system architecture or other environment variables.  Such advanced
wenzelm@28215:   features should be added only with great care, though. In
wenzelm@28215:   particular, external environment references should be kept at a
wenzelm@28215:   minimum.
wenzelm@28215: 
wenzelm@28215:   \medskip A few variables are somewhat special:
wenzelm@28215: 
wenzelm@28215:   \begin{itemize}
wenzelm@28215: 
wenzelm@28502:   \item @{setting_def ISABELLE_PROCESS} and @{setting_def ISABELLE_TOOL} are set
wenzelm@28215:   automatically to the absolute path names of the @{executable
wenzelm@28504:   "isabelle-process"} and @{executable isabelle} executables,
wenzelm@28215:   respectively.
wenzelm@28215:   
wenzelm@28238:   \item @{setting_ref ISABELLE_OUTPUT} will have the identifiers of
wenzelm@28215:   the Isabelle distribution (cf.\ @{setting ISABELLE_IDENTIFIER}) and
wenzelm@28215:   the ML system (cf.\ @{setting ML_IDENTIFIER}) appended automatically
wenzelm@28215:   to its value.
wenzelm@28215: 
wenzelm@28215:   \end{itemize}
wenzelm@28215: 
wenzelm@28238:   \medskip Note that the settings environment may be inspected with
wenzelm@28238:   the Isabelle tool @{tool getenv}.  This might help to figure out the
wenzelm@28238:   effect of complex settings scripts.
wenzelm@28215: *}
wenzelm@28215: 
wenzelm@28215: 
wenzelm@28215: subsection{* Common variables *}
wenzelm@28215: 
wenzelm@28215: text {*
wenzelm@28215:   This is a reference of common Isabelle settings variables. Note that
wenzelm@28215:   the list is somewhat open-ended. Third-party utilities or interfaces
wenzelm@28215:   may add their own selection. Variables that are special in some
wenzelm@28215:   sense are marked with @{text "\<^sup>*"}.
wenzelm@28215: 
wenzelm@28215:   \begin{description}
wenzelm@28215: 
wenzelm@28215:   \item[@{setting_def ISABELLE_HOME}@{text "\<^sup>*"}] is the
wenzelm@28215:   location of the top-level Isabelle distribution directory. This is
wenzelm@28215:   automatically determined from the Isabelle executable that has been
wenzelm@28215:   invoked.  Do not attempt to set @{setting ISABELLE_HOME} yourself
wenzelm@28238:   from the shell!
wenzelm@28215:   
wenzelm@28215:   \item[@{setting_def ISABELLE_HOME_USER}] is the user-specific
wenzelm@28215:   counterpart of @{setting ISABELLE_HOME}. The default value is
wenzelm@28914:   @{verbatim "~/.isabelle"}, under rare circumstances this may be
wenzelm@28215:   changed in the global setting file.  Typically, the @{setting
wenzelm@28215:   ISABELLE_HOME_USER} directory mimics @{setting ISABELLE_HOME} to
wenzelm@28215:   some extend. In particular, site-wide defaults may be overridden by
wenzelm@28285:   a private @{verbatim "$ISABELLE_HOME_USER/etc/settings"}.
wenzelm@28215:   
wenzelm@36196:   \item[@{setting_def ISABELLE_PLATFORM}@{text "\<^sup>*"}] is automatically
wenzelm@36196:   set to a symbolic identifier for the underlying hardware and
wenzelm@36196:   operating system.  The Isabelle platform identification always
wenzelm@36196:   refers to the 32 bit variant, even this is a 64 bit machine.  Note
wenzelm@36196:   that the ML or Java runtime may have a different idea, depending on
wenzelm@36196:   which binaries are actually run.
wenzelm@36196: 
wenzelm@36196:   \item[@{setting_def ISABELLE_PLATFORM64}@{text "\<^sup>*"}] is similar to
wenzelm@36196:   @{setting ISABELLE_PLATFORM} but refers to the proper 64 bit variant
wenzelm@36196:   on a platform that supports this; the value is empty for 32 bit.
wenzelm@36196: 
wenzelm@28502:   \item[@{setting_def ISABELLE_PROCESS}@{text "\<^sup>*"}, @{setting
wenzelm@28500:   ISABELLE_TOOL}@{text "\<^sup>*"}] are automatically set to the full path
wenzelm@28215:   names of the @{executable "isabelle-process"} and @{executable
wenzelm@28504:   isabelle} executables, respectively.  Thus other tools and scripts
wenzelm@28238:   need not assume that the @{"file" "$ISABELLE_HOME/bin"} directory is
wenzelm@28238:   on the current search path of the shell.
wenzelm@28215:   
wenzelm@28215:   \item[@{setting_def ISABELLE_IDENTIFIER}@{text "\<^sup>*"}] refers
wenzelm@28215:   to the name of this Isabelle distribution, e.g.\ ``@{verbatim
wenzelm@28215:   Isabelle2008}''.
wenzelm@28215: 
wenzelm@28215:   \item[@{setting_def ML_SYSTEM}, @{setting_def ML_HOME},
wenzelm@28215:   @{setting_def ML_OPTIONS}, @{setting_def ML_PLATFORM}, @{setting_def
wenzelm@28215:   ML_IDENTIFIER}@{text "\<^sup>*"}] specify the underlying ML system
wenzelm@28215:   to be used for Isabelle.  There is only a fixed set of admissable
wenzelm@28238:   @{setting ML_SYSTEM} names (see the @{"file"
wenzelm@28238:   "$ISABELLE_HOME/etc/settings"} file of the distribution).
wenzelm@28215:   
wenzelm@28215:   The actual compiler binary will be run from the directory @{setting
wenzelm@28215:   ML_HOME}, with @{setting ML_OPTIONS} as first arguments on the
wenzelm@28215:   command line.  The optional @{setting ML_PLATFORM} may specify the
wenzelm@28215:   binary format of ML heap images, which is useful for cross-platform
wenzelm@28215:   installations.  The value of @{setting ML_IDENTIFIER} is
wenzelm@28215:   automatically obtained by composing the values of @{setting
wenzelm@28215:   ML_SYSTEM}, @{setting ML_PLATFORM} and the Isabelle version values.
wenzelm@28215:   
wenzelm@28215:   \item[@{setting_def ISABELLE_PATH}] is a list of directories
wenzelm@28215:   (separated by colons) where Isabelle logic images may reside.  When
wenzelm@28215:   looking up heaps files, the value of @{setting ML_IDENTIFIER} is
wenzelm@28215:   appended to each component internally.
wenzelm@28215:   
wenzelm@28215:   \item[@{setting_def ISABELLE_OUTPUT}@{text "\<^sup>*"}] is a
wenzelm@28215:   directory where output heap files should be stored by default. The
wenzelm@28215:   ML system and Isabelle version identifier is appended here, too.
wenzelm@28215:   
wenzelm@28215:   \item[@{setting_def ISABELLE_BROWSER_INFO}] is the directory where
wenzelm@28215:   theory browser information (HTML text, graph data, and printable
wenzelm@28215:   documents) is stored (see also \secref{sec:info}).  The default
wenzelm@28215:   value is @{verbatim "$ISABELLE_HOME_USER/browser_info"}.
wenzelm@28215:   
wenzelm@28215:   \item[@{setting_def ISABELLE_LOGIC}] specifies the default logic to
wenzelm@28215:   load if none is given explicitely by the user.  The default value is
wenzelm@28215:   @{verbatim HOL}.
wenzelm@28215:   
wenzelm@28215:   \item[@{setting_def ISABELLE_LINE_EDITOR}] specifies the default
wenzelm@28238:   line editor for the @{tool_ref tty} interface.
wenzelm@28215: 
wenzelm@28215:   \item[@{setting_def ISABELLE_USEDIR_OPTIONS}] is implicitly prefixed
wenzelm@28238:   to the command line of any @{tool_ref usedir} invocation. This
wenzelm@28238:   typically contains compilation options for object-logics --- @{tool
wenzelm@28238:   usedir} is the basic utility for managing logic sessions (cf.\ the
wenzelm@28238:   @{verbatim IsaMakefile}s in the distribution).
wenzelm@28215: 
wenzelm@28215:   \item[@{setting_def ISABELLE_FILE_IDENT}] specifies a shell command
wenzelm@28215:   for producing a source file identification, based on the actual
wenzelm@28215:   content instead of the full physical path and date stamp (which is
wenzelm@28215:   the default). A typical identification would produce a ``digest'' of
wenzelm@28215:   the text, using a cryptographic hash function like SHA-1, for
wenzelm@28215:   example.
wenzelm@28215:   
wenzelm@28215:   \item[@{setting_def ISABELLE_LATEX}, @{setting_def
wenzelm@28215:   ISABELLE_PDFLATEX}, @{setting_def ISABELLE_BIBTEX}, @{setting_def
wenzelm@28215:   ISABELLE_DVIPS}] refer to {\LaTeX} related tools for Isabelle
wenzelm@28215:   document preparation (see also \secref{sec:tool-latex}).
wenzelm@28215:   
wenzelm@28215:   \item[@{setting_def ISABELLE_TOOLS}] is a colon separated list of
wenzelm@28504:   directories that are scanned by @{executable isabelle} for external
wenzelm@28504:   utility programs (see also \secref{sec:isabelle-tool}).
wenzelm@28215:   
wenzelm@28215:   \item[@{setting_def ISABELLE_DOCS}] is a colon separated list of
wenzelm@28215:   directories with documentation files.
wenzelm@28215:   
wenzelm@28215:   \item[@{setting_def ISABELLE_DOC_FORMAT}] specifies the preferred
wenzelm@28215:   document format, typically @{verbatim dvi} or @{verbatim pdf}.
wenzelm@28215:   
wenzelm@28215:   \item[@{setting_def DVI_VIEWER}] specifies the command to be used
wenzelm@28215:   for displaying @{verbatim dvi} files.
wenzelm@28215:   
wenzelm@28215:   \item[@{setting_def PDF_VIEWER}] specifies the command to be used
wenzelm@28215:   for displaying @{verbatim pdf} files.
wenzelm@28215:   
wenzelm@28215:   \item[@{setting_def PRINT_COMMAND}] specifies the standard printer
wenzelm@28215:   spool command, which is expected to accept @{verbatim ps} files.
wenzelm@28215:   
wenzelm@28215:   \item[@{setting_def ISABELLE_TMP_PREFIX}@{text "\<^sup>*"}] is the
wenzelm@28238:   prefix from which any running @{executable "isabelle-process"}
wenzelm@28238:   derives an individual directory for temporary files.  The default is
wenzelm@28215:   somewhere in @{verbatim "/tmp"}.
wenzelm@28215:   
wenzelm@28215:   \end{description}
wenzelm@28215: *}
wenzelm@28215: 
wenzelm@28215: 
wenzelm@32323: subsection {* Additional components \label{sec:components} *}
wenzelm@32323: 
wenzelm@32323: text {* Any directory may be registered as an explicit \emph{Isabelle
wenzelm@32323:   component}.  The general layout conventions are that of the main
wenzelm@32323:   Isabelle distribution itself, and the following two files (both
wenzelm@32323:   optional) have a special meaning:
wenzelm@32323: 
wenzelm@32323:   \begin{itemize}
wenzelm@32323: 
wenzelm@32323:   \item @{verbatim "etc/settings"} holds additional settings that are
wenzelm@32323:   initialized when bootstrapping the overall Isabelle environment,
wenzelm@32323:   cf.\ \secref{sec:boot}.  As usual, the content is interpreted as a
wenzelm@32323:   @{verbatim bash} script.  It may refer to the component's enclosing
wenzelm@32323:   directory via the @{verbatim "COMPONENT"} shell variable.
wenzelm@32323: 
wenzelm@32323:   For example, the following setting allows to refer to files within
wenzelm@32323:   the component later on, without having to hardwire absolute paths:
wenzelm@32323: 
wenzelm@32323:   \begin{ttbox}
wenzelm@32323:   MY_COMPONENT_HOME="$COMPONENT"
wenzelm@32323:   \end{ttbox}
wenzelm@32323: 
wenzelm@32323:   Components can also add to existing Isabelle settings such as
wenzelm@32323:   @{setting_def ISABELLE_TOOLS}, in order to provide
wenzelm@32323:   component-specific tools that can be invoked by end-users.  For
wenzelm@32323:   example:
wenzelm@32323: 
wenzelm@32323:   \begin{ttbox}
wenzelm@32323:   ISABELLE_TOOLS="$ISABELLE_TOOLS:$COMPONENT/lib/Tools"
wenzelm@32323:   \end{ttbox}
wenzelm@32323: 
wenzelm@32323:   \item @{verbatim "etc/components"} holds a list of further
wenzelm@32323:   sub-components of the same structure.  The directory specifications
wenzelm@32323:   given here can be either absolute (with leading @{verbatim "/"}) or
wenzelm@32323:   relative to the component's main directory.
wenzelm@32323: 
wenzelm@32323:   \end{itemize}
wenzelm@32323: 
wenzelm@32323:   The root of component initialization is @{setting ISABELLE_HOME}
wenzelm@32323:   itself.  After initializing all of its sub-components recursively,
wenzelm@32323:   @{setting ISABELLE_HOME_USER} is included in the same manner (if
wenzelm@32323:   that directory exists).  Thus users can easily add private
wenzelm@32323:   components to @{verbatim "$ISABELLE_HOME_USER/etc/components"}.
wenzelm@33952: 
wenzelm@33952:   It is also possible to initialize components programmatically via
wenzelm@33952:   the \verb,init_component, shell function, say within the
wenzelm@33952:   \verb,settings, script of another component.
wenzelm@32323: *}
wenzelm@32323: 
wenzelm@32323: 
wenzelm@28215: section {* The raw Isabelle process *}
wenzelm@28215: 
wenzelm@28215: text {*
wenzelm@28504:   The @{executable_def "isabelle-process"} executable runs bare-bones
wenzelm@28504:   Isabelle logic sessions --- either interactively or in batch mode.
wenzelm@28504:   It provides an abstraction over the underlying ML system, and over
wenzelm@28504:   the actual heap file locations.  Its usage is:
wenzelm@28215: 
wenzelm@28215: \begin{ttbox}
wenzelm@28238: Usage: isabelle-process [OPTIONS] [INPUT] [OUTPUT]
wenzelm@28215: 
wenzelm@28215:   Options are:
wenzelm@28215:     -I           startup Isar interaction mode
wenzelm@28215:     -P           startup Proof General interaction mode
wenzelm@28215:     -S           secure mode -- disallow critical operations
wenzelm@38253:     -W IN:OUT    startup process wrapper, with input/output fifos
wenzelm@28215:     -X           startup PGIP interaction mode
wenzelm@28215:     -e MLTEXT    pass MLTEXT to the ML session
wenzelm@28215:     -f           pass 'Session.finish();' to the ML session
wenzelm@28215:     -m MODE      add print mode for output
wenzelm@28215:     -q           non-interactive session
wenzelm@28215:     -r           open heap file read-only
wenzelm@28215:     -u           pass 'use"ROOT.ML";' to the ML session
wenzelm@28215:     -w           reset write permissions on OUTPUT
wenzelm@28215: 
wenzelm@28215:   INPUT (default "\$ISABELLE_LOGIC") and OUTPUT specify in/out heaps.
wenzelm@28215:   These are either names to be searched in the Isabelle path, or
wenzelm@28215:   actual file names (containing at least one /).
wenzelm@28215:   If INPUT is "RAW_ML_SYSTEM", just start the bare bones ML system.
wenzelm@28215: \end{ttbox}
wenzelm@28215: 
wenzelm@28215:   Input files without path specifications are looked up in the
wenzelm@28215:   @{setting ISABELLE_PATH} setting, which may consist of multiple
wenzelm@28215:   components separated by colons --- these are tried in the given
wenzelm@28215:   order with the value of @{setting ML_IDENTIFIER} appended
wenzelm@28215:   internally.  In a similar way, base names are relative to the
wenzelm@28215:   directory specified by @{setting ISABELLE_OUTPUT}.  In any case,
wenzelm@28215:   actual file locations may also be given by including at least one
wenzelm@28215:   slash (@{verbatim "/"}) in the name (hint: use @{verbatim "./"} to
wenzelm@28215:   refer to the current directory).
wenzelm@28215: *}
wenzelm@28215: 
wenzelm@28215: 
wenzelm@28223: subsubsection {* Options *}
wenzelm@28215: 
wenzelm@28215: text {*
wenzelm@28215:   If the input heap file does not have write permission bits set, or
wenzelm@28215:   the @{verbatim "-r"} option is given explicitely, then the session
wenzelm@28215:   started will be read-only.  That is, the ML world cannot be
wenzelm@28215:   committed back into the image file.  Otherwise, a writable session
wenzelm@28215:   enables commits into either the input file, or into another output
wenzelm@28215:   heap file (if that is given as the second argument on the command
wenzelm@28215:   line).
wenzelm@28215: 
wenzelm@28215:   The read-write state of sessions is determined at startup only, it
wenzelm@28215:   cannot be changed intermediately. Also note that heap images may
wenzelm@28215:   require considerable amounts of disk space (approximately
wenzelm@28215:   50--200~MB). Users are responsible for themselves to dispose their
wenzelm@28215:   heap files when they are no longer needed.
wenzelm@28215: 
wenzelm@28215:   \medskip The @{verbatim "-w"} option makes the output heap file
wenzelm@28215:   read-only after terminating.  Thus subsequent invocations cause the
wenzelm@28215:   logic image to be read-only automatically.
wenzelm@28215: 
wenzelm@28215:   \medskip Using the @{verbatim "-e"} option, arbitrary ML code may be
wenzelm@28215:   passed to the Isabelle session from the command line. Multiple
wenzelm@28215:   @{verbatim "-e"}'s are evaluated in the given order. Strange things
wenzelm@28215:   may happen when errorneous ML code is provided. Also make sure that
wenzelm@28215:   the ML commands are terminated properly by semicolon.
wenzelm@28215: 
wenzelm@28215:   \medskip The @{verbatim "-u"} option is a shortcut for @{verbatim
wenzelm@28215:   "-e"} passing ``@{verbatim "use \"ROOT.ML\";"}'' to the ML session.
wenzelm@28223:   The @{verbatim "-f"} option passes ``@{verbatim
wenzelm@28223:   "Session.finish();"}'', which is intended mainly for administrative
wenzelm@28223:   purposes.
wenzelm@28215: 
wenzelm@28215:   \medskip The @{verbatim "-m"} option adds identifiers of print modes
wenzelm@28215:   to be made active for this session. Typically, this is used by some
wenzelm@28215:   user interface, e.g.\ to enable output of proper mathematical
wenzelm@28215:   symbols.
wenzelm@28215: 
wenzelm@28215:   \medskip Isabelle normally enters an interactive top-level loop
wenzelm@28215:   (after processing the @{verbatim "-e"} texts). The @{verbatim "-q"}
wenzelm@28215:   option inhibits interaction, thus providing a pure batch mode
wenzelm@28215:   facility.
wenzelm@28215: 
wenzelm@28215:   \medskip The @{verbatim "-I"} option makes Isabelle enter Isar
wenzelm@28215:   interaction mode on startup, instead of the primitive ML top-level.
wenzelm@28215:   The @{verbatim "-P"} option configures the top-level loop for
wenzelm@28215:   interaction with the Proof General user interface, and the
wenzelm@38253:   @{verbatim "-X"} option enables XML-based PGIP communication.
wenzelm@38253: 
wenzelm@38253:   \medskip The @{verbatim "-W"} option makes Isabelle enter a special
wenzelm@38253:   process wrapper for interaction via the Isabelle/Scala layer, see
wenzelm@38253:   also @{"file" "~~/src/Pure/System/isabelle_process.scala"}.  The
wenzelm@38253:   protocol between the ML and JVM process is private to the
wenzelm@38253:   implementation.
wenzelm@28215: 
wenzelm@28215:   \medskip The @{verbatim "-S"} option makes the Isabelle process more
wenzelm@28215:   secure by disabling some critical operations, notably runtime
wenzelm@28215:   compilation and evaluation of ML source code.
wenzelm@28215: *}
wenzelm@28215: 
wenzelm@28215: 
wenzelm@28223: subsubsection {* Examples *}
wenzelm@28215: 
wenzelm@28215: text {*
wenzelm@28215:   Run an interactive session of the default object-logic (as specified
wenzelm@28215:   by the @{setting ISABELLE_LOGIC} setting) like this:
wenzelm@28215: \begin{ttbox}
wenzelm@28238: isabelle-process
wenzelm@28215: \end{ttbox}
wenzelm@28215: 
wenzelm@28215:   Usually @{setting ISABELLE_LOGIC} refers to one of the standard
wenzelm@28215:   logic images, which are read-only by default.  A writable session
wenzelm@28215:   --- based on @{verbatim FOL}, but output to @{verbatim Foo} (in the
wenzelm@28238:   directory specified by the @{setting ISABELLE_OUTPUT} setting) ---
wenzelm@28215:   may be invoked as follows:
wenzelm@28215: \begin{ttbox}
wenzelm@28238: isabelle-process FOL Foo
wenzelm@28215: \end{ttbox}
wenzelm@28215:   Ending this session normally (e.g.\ by typing control-D) dumps the
wenzelm@28215:   whole ML system state into @{verbatim Foo}. Be prepared for several
wenzelm@28215:   tens of megabytes.
wenzelm@28215: 
wenzelm@28215:   The @{verbatim Foo} session may be continued later (still in
wenzelm@28215:   writable state) by:
wenzelm@28215: \begin{ttbox}
wenzelm@28238: isabelle-process Foo
wenzelm@28215: \end{ttbox}
wenzelm@28215:   A read-only @{verbatim Foo} session may be started by:
wenzelm@28215: \begin{ttbox}
wenzelm@28238: isabelle-process -r Foo
wenzelm@28215: \end{ttbox}
wenzelm@28215: 
wenzelm@28215:   \medskip Note that manual session management like this does
wenzelm@28215:   \emph{not} provide proper setup for theory presentation.  This would
wenzelm@28238:   require the @{tool usedir} utility.
wenzelm@28215: 
wenzelm@28238:   \bigskip The next example demonstrates batch execution of Isabelle.
wenzelm@28238:   We retrieve the @{verbatim FOL} theory value from the theory loader
wenzelm@28238:   within ML:
wenzelm@28215: \begin{ttbox}
wenzelm@28238: isabelle-process -e 'theory "FOL";' -q -r FOL
wenzelm@28215: \end{ttbox}
wenzelm@28215:   Note that the output text will be interspersed with additional junk
wenzelm@28238:   messages by the ML runtime environment.  The @{verbatim "-W"} option
wenzelm@28238:   allows to communicate with the Isabelle process via an external
wenzelm@28238:   program in a more robust fashion.
wenzelm@28238: *}
wenzelm@28238: 
wenzelm@28238: 
wenzelm@28504: section {* The Isabelle tools wrapper \label{sec:isabelle-tool} *}
wenzelm@28238: 
wenzelm@28238: text {*
wenzelm@28238:   All Isabelle related tools and interfaces are called via a common
wenzelm@28504:   wrapper --- @{executable isabelle}:
wenzelm@28238: 
wenzelm@28238: \begin{ttbox}
wenzelm@28504: Usage: isabelle TOOL [ARGS ...]
wenzelm@28238: 
wenzelm@28506:   Start Isabelle tool NAME with ARGS; pass "-?" for tool specific help.
wenzelm@28238: 
wenzelm@28238:   Available tools are:
wenzelm@28238: 
wenzelm@28238:     browser - Isabelle graph browser
wenzelm@28238:     \dots
wenzelm@28238: \end{ttbox}
wenzelm@28238: 
wenzelm@28238:   In principle, Isabelle tools are ordinary executable scripts that
wenzelm@28238:   are run within the Isabelle settings environment, see
wenzelm@28238:   \secref{sec:settings}.  The set of available tools is collected by
wenzelm@28504:   @{executable isabelle} from the directories listed in the @{setting
wenzelm@28238:   ISABELLE_TOOLS} setting.  Do not try to call the scripts directly
wenzelm@28238:   from the shell.  Neither should you add the tool directories to your
wenzelm@28238:   shell's search path!
wenzelm@28238: *}
wenzelm@28238: 
wenzelm@28238: 
wenzelm@28238: subsubsection {* Examples *}
wenzelm@28238: 
wenzelm@28238: text {*
wenzelm@28238:   Show the list of available documentation of the current Isabelle
wenzelm@28238:   installation like this:
wenzelm@28238: 
wenzelm@28238: \begin{ttbox}
wenzelm@28504:   isabelle doc
wenzelm@28238: \end{ttbox}
wenzelm@28238: 
wenzelm@28238:   View a certain document as follows:
wenzelm@28238: \begin{ttbox}
wenzelm@28504:   isabelle doc isar-ref
wenzelm@28238: \end{ttbox}
wenzelm@28238: 
wenzelm@28238:   Create an Isabelle session derived from HOL (see also
wenzelm@28238:   \secref{sec:tool-mkdir} and \secref{sec:tool-make}):
wenzelm@28238: \begin{ttbox}
wenzelm@28504:   isabelle mkdir HOL Test && isabelle make
wenzelm@28238: \end{ttbox}
wenzelm@28504:   Note that @{verbatim "isabelle mkdir"} is usually only invoked once;
wenzelm@28238:   existing sessions (including document output etc.) are then updated
wenzelm@28504:   by @{verbatim "isabelle make"} alone.
wenzelm@28215: *}
wenzelm@28215: 
wenzelm@28223: end



