src/Doc/System/Sessions.thy
changeset 51055 5c4be88f8747
parent 50546 1b01a57d2749
child 51417 d266f9329368
equal deleted inserted replaced
51054:d6de6e81574d 51055:5c4be88f8747
     3 begin
     3 begin
     4 
     4 
     5 chapter {* Isabelle sessions and build management \label{ch:session} *}
     5 chapter {* Isabelle sessions and build management \label{ch:session} *}
     6 
     6 
     7 text {* An Isabelle \emph{session} consists of a collection of related
     7 text {* An Isabelle \emph{session} consists of a collection of related
     8   theories that may be associated with formal documents (see also
     8   theories that may be associated with formal documents
     9   \chref{ch:present}).  There is also a notion of \emph{persistent
     9   (\chref{ch:present}).  There is also a notion of \emph{persistent
    10   heap} image to capture the state of a session, similar to
    10   heap} image to capture the state of a session, similar to
    11   object-code in compiled programming languages.  Thus the concept of
    11   object-code in compiled programming languages.  Thus the concept of
    12   session resembles that of a ``project'' in common IDE environments,
    12   session resembles that of a ``project'' in common IDE environments,
    13   but the specific name emphasizes the connection to interactive
    13   but the specific name emphasizes the connection to interactive
    14   theorem proving: the session wraps-up the results of
    14   theorem proving: the session wraps-up the results of
    41   etc.  The grammar for a single @{syntax session_entry} is given as
    41   etc.  The grammar for a single @{syntax session_entry} is given as
    42   syntax diagram below; each ROOT file may contain multiple session
    42   syntax diagram below; each ROOT file may contain multiple session
    43   specifications like this.
    43   specifications like this.
    44 
    44 
    45   Isabelle/jEdit (\secref{sec:tool-jedit}) includes a simple editing
    45   Isabelle/jEdit (\secref{sec:tool-jedit}) includes a simple editing
    46   mode @{verbatim "isabelle-root"} for session ROOT files.
    46   mode @{verbatim "isabelle-root"} for session ROOT files, which is
       
    47   enabled by default for any file of that name.
    47 
    48 
    48   @{rail "
    49   @{rail "
    49     @{syntax_def session_entry}: @'session' spec '=' (@{syntax name} '+')? body
    50     @{syntax_def session_entry}: @'session' spec '=' (@{syntax name} '+')? body
    50     ;
    51     ;
    51     body: description? options? ( theories + ) files?
    52     body: description? options? ( theories + ) files?
    77   Note that a parent (like @{text "HOL"}) is mandatory in practical
    78   Note that a parent (like @{text "HOL"}) is mandatory in practical
    78   applications: only Isabelle/Pure can bootstrap itself from nothing.
    79   applications: only Isabelle/Pure can bootstrap itself from nothing.
    79 
    80 
    80   All such session specifications together describe a hierarchy (tree)
    81   All such session specifications together describe a hierarchy (tree)
    81   of sessions, with globally unique names.  The new session name
    82   of sessions, with globally unique names.  The new session name
    82   @{text "A"} should be sufficiently long to stand on its own in a
    83   @{text "A"} should be sufficiently long and descriptive to stand on
    83   potentially large library.
    84   its own in a potentially large library.
    84 
    85 
    85   \item \isakeyword{session}~@{text "A (groups)"} indicates a
    86   \item \isakeyword{session}~@{text "A (groups)"} indicates a
    86   collection of groups where the new session is a member.  Group names
    87   collection of groups where the new session is a member.  Group names
    87   are uninterpreted and merely follow certain conventions.  For
    88   are uninterpreted and merely follow certain conventions.  For
    88   example, the Isabelle distribution tags some important sessions by
    89   example, the Isabelle distribution tags some important sessions by
   116 
   117 
   117   \item \isakeyword{files}~@{text "files"} lists additional source
   118   \item \isakeyword{files}~@{text "files"} lists additional source
   118   files that are involved in the processing of this session.  This
   119   files that are involved in the processing of this session.  This
   119   should cover anything outside the formal content of the theory
   120   should cover anything outside the formal content of the theory
   120   sources, say some auxiliary {\TeX} files that are required for
   121   sources, say some auxiliary {\TeX} files that are required for
   121   document processing.  In contrast, files that are specified in
   122   document processing.  In contrast, files that are loaded formally
   122   formal theory headers as @{keyword "uses"} need not be declared
   123   within a theory, e.g.\ via @{keyword "ML_file"}, need not be
   123   again.
   124   declared again.
   124 
   125 
   125   \end{description}
   126   \end{description}
   126 *}
   127 *}
   127 
   128 
       
   129 
   128 subsubsection {* Examples *}
   130 subsubsection {* Examples *}
   129 
   131 
   130 text {* See @{file "~~/src/HOL/ROOT"} for a diversity of practically
   132 text {* See @{file "~~/src/HOL/ROOT"} for a diversity of practically
   131   relevant situations, but it uses relatively complex quasi-hierarchic
   133   relevant situations, although it uses relatively complex
   132   naming conventions like @{text "HOL\<dash>SPARK"}, @{text
   134   quasi-hierarchic naming conventions like @{text "HOL\<dash>SPARK"},
   133   "HOL\<dash>SPARK\<dash>Examples"}.  An alternative is to use
   135   @{text "HOL\<dash>SPARK\<dash>Examples"}.  An alternative is to use
   134   unqualified names that are relatively long and descriptive, as in
   136   unqualified names that are relatively long and descriptive, as in
   135   the Archive of Formal Proofs (\url{http://afp.sf.net}), for
   137   the Archive of Formal Proofs (\url{http://afp.sf.net}), for
   136   example. *}
   138   example. *}
   137 
   139 
   138 
   140 
   140 
   142 
   141 text {* See @{file "~~/etc/options"} for the main defaults provided by
   143 text {* See @{file "~~/etc/options"} for the main defaults provided by
   142   the Isabelle distribution.  Isabelle/jEdit (\secref{sec:tool-jedit})
   144   the Isabelle distribution.  Isabelle/jEdit (\secref{sec:tool-jedit})
   143   includes a simple editing mode @{verbatim "isabelle-options"} for
   145   includes a simple editing mode @{verbatim "isabelle-options"} for
   144   this file-format.
   146   this file-format.
       
   147 
       
   148   The following options are particulary relevant to build Isabelle
       
   149   sessions, in particular with document preparation
       
   150   (\chref{ch:present}).
       
   151 
       
   152   \begin{itemize}
       
   153 
       
   154   \item @{system_option_def "browser_info"} controls output of HTML
       
   155   browser info, see also \secref{sec:info}.
       
   156 
       
   157   \item @{system_option_def "document"} specifies the document output
       
   158   format, see @{tool document} option @{verbatim "-o"} in
       
   159   \secref{sec:tool-document}.  In practice, the most relevant values
       
   160   are @{verbatim "document=false"} or @{verbatim "document=pdf"}.
       
   161 
       
   162   \item @{system_option_def "document_output"} specifies an
       
   163   alternative directory for generated output of the document
       
   164   preparation system; the default is within the @{setting
       
   165   "ISABELLE_BROWSER_INFO"} hierarchy as explained in
       
   166   \secref{sec:info}.  See also @{tool mkroot}, which generates a
       
   167   default configuration with output readily available to the author of
       
   168   the document.
       
   169 
       
   170   \item @{system_option_def "document_variants"} specifies document
       
   171   variants as a colon-separated list of @{text "name=tags"} entries,
       
   172   corresponding to @{tool document} options @{verbatim "-n"} and
       
   173   @{verbatim "-t"}.
       
   174 
       
   175   For example, @{verbatim
       
   176   "document_variants=document:outline=/proof,/ML"} indicates two
       
   177   documents: the one called @{verbatim document} with default tags,
       
   178   and the other called @{verbatim outline} where proofs and ML
       
   179   sections are folded.
       
   180 
       
   181   Document variant names are just a matter of conventions.  It is also
       
   182   possible to use different document variant names (without tags) for
       
   183   different document root entries, see also
       
   184   \secref{sec:tool-document}.
       
   185 
       
   186   \item @{system_option_def "document_graph"} tells whether the
       
   187   generated document files should include a theory graph (cf.\
       
   188   \secref{sec:browse} and \secref{sec:info}).  The resulting EPS or
       
   189   PDF file can be included as graphics in {\LaTeX}.
       
   190 
       
   191   Note that this option is usually determined as static parameter of
       
   192   some session (e.g.\ within its @{verbatim ROOT} file) and \emph{not}
       
   193   given globally or on the command line of @{tool build}.
       
   194 
       
   195   \item @{system_option_def "threads"} determines the number of worker
       
   196   threads for parallel checking of theories and proofs.  The default
       
   197   @{text "0"} means that a sensible maximum value is determined by the
       
   198   underlying hardware.  For machines with many cores or with
       
   199   hyperthreading, this is often requires manual adjustment (on the
       
   200   command-line or within personal settings or preferences, not within
       
   201   a session @{verbatim ROOT}).
       
   202 
       
   203   \item @{system_option_def "condition"} specifies a comma-separated
       
   204   list of process environment variables (or Isabelle settings) that
       
   205   are required for the subsequent theories to be processed.
       
   206   Conditions are considered ``true'' if the corresponding environment
       
   207   value is defined and non-empty.
       
   208 
       
   209   For example, the @{verbatim "condition=ISABELLE_FULL_TEST"} may be
       
   210   used to guard extraordinary theories, which are meant to be enabled
       
   211   explicitly via some shell prefix @{verbatim "env ISABELLE_FULL_TEST=true"}
       
   212   before invoking @{tool build}.
       
   213 
       
   214   \item @{system_option_def "timeout"} specifies a real wall-clock
       
   215   timeout (in seconds) for the session as a whole.  The timer is
       
   216   controlled outside the ML process by the JVM that runs
       
   217   Isabelle/Scala.  Thus it is relatively reliable in canceling
       
   218   processes that get out of control, even if there is a deadlock
       
   219   without CPU time usage.
       
   220 
       
   221   \end{itemize}
   145 
   222 
   146   The @{tool_def options} tool prints Isabelle system options.  Its
   223   The @{tool_def options} tool prints Isabelle system options.  Its
   147   command-line usage is:
   224   command-line usage is:
   148 \begin{ttbox}
   225 \begin{ttbox}
   149 Usage: isabelle options [OPTIONS] [MORE_OPTIONS ...]
   226 Usage: isabelle options [OPTIONS] [MORE_OPTIONS ...]