src/Doc/System/Sessions.thy
changeset 61493 0debd22f0c0e
parent 61477 e467ae7aa808
child 61503 28e788ca2c5d
equal deleted inserted replaced
61492:3480725c71d2 61493:0debd22f0c0e
    15   user-interaction with the prover in a persistent form.
    15   user-interaction with the prover in a persistent form.
    16 
    16 
    17   Application sessions are built on a given parent session, which may
    17   Application sessions are built on a given parent session, which may
    18   be built recursively on other parents.  Following this path in the
    18   be built recursively on other parents.  Following this path in the
    19   hierarchy eventually leads to some major object-logic session like
    19   hierarchy eventually leads to some major object-logic session like
    20   @{text "HOL"}, which itself is based on @{text "Pure"} as the common
    20   \<open>HOL\<close>, which itself is based on \<open>Pure\<close> as the common
    21   root of all sessions.
    21   root of all sessions.
    22 
    22 
    23   Processing sessions may take considerable time.  Isabelle build
    23   Processing sessions may take considerable time.  Isabelle build
    24   management helps to organize this efficiently.  This includes
    24   management helps to organize this efficiently.  This includes
    25   support for parallel build jobs, in addition to the multithreaded
    25   support for parallel build jobs, in addition to the multithreaded
    40   identifiers, names, quoted strings, verbatim text, nested comments
    40   identifiers, names, quoted strings, verbatim text, nested comments
    41   etc.  The grammar for @{syntax session_chapter} and @{syntax
    41   etc.  The grammar for @{syntax session_chapter} and @{syntax
    42   session_entry} is given as syntax diagram below; each ROOT file may
    42   session_entry} is given as syntax diagram below; each ROOT file may
    43   contain multiple specifications like this.  Chapters help to
    43   contain multiple specifications like this.  Chapters help to
    44   organize browser info (\secref{sec:info}), but have no formal
    44   organize browser info (\secref{sec:info}), but have no formal
    45   meaning.  The default chapter is ``@{text "Unsorted"}''.
    45   meaning.  The default chapter is ``\<open>Unsorted\<close>''.
    46 
    46 
    47   Isabelle/jEdit @{cite "isabelle-jedit"} includes a simple editing
    47   Isabelle/jEdit @{cite "isabelle-jedit"} includes a simple editing
    48   mode @{verbatim "isabelle-root"} for session ROOT files, which is
    48   mode @{verbatim "isabelle-root"} for session ROOT files, which is
    49   enabled by default for any file of that name.
    49   enabled by default for any file of that name.
    50 
    50 
    75     files: @'files' (@{syntax name}+)
    75     files: @'files' (@{syntax name}+)
    76     ;
    76     ;
    77     document_files: @'document_files' ('(' dir ')')? (@{syntax name}+)
    77     document_files: @'document_files' ('(' dir ')')? (@{syntax name}+)
    78   \<close>}
    78   \<close>}
    79 
    79 
    80   \<^descr> \isakeyword{session}~@{text "A = B + body"} defines a new
    80   \<^descr> \isakeyword{session}~\<open>A = B + body\<close> defines a new
    81   session @{text "A"} based on parent session @{text "B"}, with its
    81   session \<open>A\<close> based on parent session \<open>B\<close>, with its
    82   content given in @{text body} (theories and auxiliary source files).
    82   content given in \<open>body\<close> (theories and auxiliary source files).
    83   Note that a parent (like @{text "HOL"}) is mandatory in practical
    83   Note that a parent (like \<open>HOL\<close>) is mandatory in practical
    84   applications: only Isabelle/Pure can bootstrap itself from nothing.
    84   applications: only Isabelle/Pure can bootstrap itself from nothing.
    85 
    85 
    86   All such session specifications together describe a hierarchy (tree)
    86   All such session specifications together describe a hierarchy (tree)
    87   of sessions, with globally unique names.  The new session name
    87   of sessions, with globally unique names.  The new session name
    88   @{text "A"} should be sufficiently long and descriptive to stand on
    88   \<open>A\<close> should be sufficiently long and descriptive to stand on
    89   its own in a potentially large library.
    89   its own in a potentially large library.
    90 
    90 
    91   \<^descr> \isakeyword{session}~@{text "A (groups)"} indicates a
    91   \<^descr> \isakeyword{session}~\<open>A (groups)\<close> indicates a
    92   collection of groups where the new session is a member.  Group names
    92   collection of groups where the new session is a member.  Group names
    93   are uninterpreted and merely follow certain conventions.  For
    93   are uninterpreted and merely follow certain conventions.  For
    94   example, the Isabelle distribution tags some important sessions by
    94   example, the Isabelle distribution tags some important sessions by
    95   the group name called ``@{text "main"}''.  Other projects may invent
    95   the group name called ``\<open>main\<close>''.  Other projects may invent
    96   their own conventions, but this requires some care to avoid clashes
    96   their own conventions, but this requires some care to avoid clashes
    97   within this unchecked name space.
    97   within this unchecked name space.
    98 
    98 
    99   \<^descr> \isakeyword{session}~@{text "A"}~\isakeyword{in}~@{text "dir"}
    99   \<^descr> \isakeyword{session}~\<open>A\<close>~\isakeyword{in}~\<open>dir\<close>
   100   specifies an explicit directory for this session; by default this is
   100   specifies an explicit directory for this session; by default this is
   101   the current directory of the @{verbatim ROOT} file.
   101   the current directory of the @{verbatim ROOT} file.
   102 
   102 
   103   All theories and auxiliary source files are located relatively to
   103   All theories and auxiliary source files are located relatively to
   104   the session directory.  The prover process is run within the same as
   104   the session directory.  The prover process is run within the same as
   105   its current working directory.
   105   its current working directory.
   106 
   106 
   107   \<^descr> \isakeyword{description}~@{text "text"} is a free-form
   107   \<^descr> \isakeyword{description}~\<open>text\<close> is a free-form
   108   annotation for this session.
   108   annotation for this session.
   109 
   109 
   110   \<^descr> \isakeyword{options}~@{text "[x = a, y = b, z]"} defines
   110   \<^descr> \isakeyword{options}~\<open>[x = a, y = b, z]\<close> defines
   111   separate options (\secref{sec:system-options}) that are used when
   111   separate options (\secref{sec:system-options}) that are used when
   112   processing this session, but \<^emph>\<open>without\<close> propagation to child
   112   processing this session, but \<^emph>\<open>without\<close> propagation to child
   113   sessions.  Note that @{text "z"} abbreviates @{text "z = true"} for
   113   sessions.  Note that \<open>z\<close> abbreviates \<open>z = true\<close> for
   114   Boolean options.
   114   Boolean options.
   115 
   115 
   116   \<^descr> \isakeyword{theories}~@{text "options names"} specifies a
   116   \<^descr> \isakeyword{theories}~\<open>options names\<close> specifies a
   117   block of theories that are processed within an environment that is
   117   block of theories that are processed within an environment that is
   118   augmented by the given options, in addition to the global session
   118   augmented by the given options, in addition to the global session
   119   options given before.  Any number of blocks of \isakeyword{theories}
   119   options given before.  Any number of blocks of \isakeyword{theories}
   120   may be given.  Options are only active for each
   120   may be given.  Options are only active for each
   121   \isakeyword{theories} block separately.
   121   \isakeyword{theories} block separately.
   122 
   122 
   123   \<^descr> \isakeyword{files}~@{text "files"} lists additional source
   123   \<^descr> \isakeyword{files}~\<open>files\<close> lists additional source
   124   files that are involved in the processing of this session.  This
   124   files that are involved in the processing of this session.  This
   125   should cover anything outside the formal content of the theory
   125   should cover anything outside the formal content of the theory
   126   sources.  In contrast, files that are loaded formally
   126   sources.  In contrast, files that are loaded formally
   127   within a theory, e.g.\ via @{command "ML_file"}, need not be
   127   within a theory, e.g.\ via @{command "ML_file"}, need not be
   128   declared again.
   128   declared again.
   129 
   129 
   130   \<^descr> \isakeyword{document_files}~@{text "("}\isakeyword{in}~@{text
   130   \<^descr> \isakeyword{document_files}~\<open>(\<close>\isakeyword{in}~\<open>base_dir) files\<close> lists source files for document preparation,
   131   "base_dir) files"} lists source files for document preparation,
       
   132   typically @{verbatim ".tex"} and @{verbatim ".sty"} for {\LaTeX}.
   131   typically @{verbatim ".tex"} and @{verbatim ".sty"} for {\LaTeX}.
   133   Only these explicitly given files are copied from the base directory
   132   Only these explicitly given files are copied from the base directory
   134   to the document output directory, before formal document processing
   133   to the document output directory, before formal document processing
   135   is started (see also \secref{sec:tool-document}).  The local path
   134   is started (see also \secref{sec:tool-document}).  The local path
   136   structure of the @{text files} is preserved, which allows to
   135   structure of the \<open>files\<close> is preserved, which allows to
   137   reconstruct the original directory hierarchy of @{text "base_dir"}.
   136   reconstruct the original directory hierarchy of \<open>base_dir\<close>.
   138 
   137 
   139   \<^descr> \isakeyword{document_files}~@{text "files"} abbreviates
   138   \<^descr> \isakeyword{document_files}~\<open>files\<close> abbreviates
   140   \isakeyword{document_files}~@{text "("}\isakeyword{in}~@{text
   139   \isakeyword{document_files}~\<open>(\<close>\isakeyword{in}~\<open>document) files\<close>, i.e.\ document sources are taken from the base
   141   "document) files"}, i.e.\ document sources are taken from the base
       
   142   directory @{verbatim document} within the session root directory.
   140   directory @{verbatim document} within the session root directory.
   143 \<close>
   141 \<close>
   144 
   142 
   145 
   143 
   146 subsubsection \<open>Examples\<close>
   144 subsubsection \<open>Examples\<close>
   147 
   145 
   148 text \<open>See @{file "~~/src/HOL/ROOT"} for a diversity of practically
   146 text \<open>See @{file "~~/src/HOL/ROOT"} for a diversity of practically
   149   relevant situations, although it uses relatively complex
   147   relevant situations, although it uses relatively complex
   150   quasi-hierarchic naming conventions like @{text "HOL\<dash>SPARK"},
   148   quasi-hierarchic naming conventions like \<open>HOL\<dash>SPARK\<close>,
   151   @{text "HOL\<dash>SPARK\<dash>Examples"}.  An alternative is to use
   149   \<open>HOL\<dash>SPARK\<dash>Examples\<close>.  An alternative is to use
   152   unqualified names that are relatively long and descriptive, as in
   150   unqualified names that are relatively long and descriptive, as in
   153   the Archive of Formal Proofs (@{url "http://afp.sourceforge.net"}), for
   151   the Archive of Formal Proofs (@{url "http://afp.sourceforge.net"}), for
   154   example.\<close>
   152   example.\<close>
   155 
   153 
   156 
   154 
   180   \secref{sec:info}.  See also @{tool mkroot}, which generates a
   178   \secref{sec:info}.  See also @{tool mkroot}, which generates a
   181   default configuration with output readily available to the author of
   179   default configuration with output readily available to the author of
   182   the document.
   180   the document.
   183 
   181 
   184   \<^item> @{system_option_def "document_variants"} specifies document
   182   \<^item> @{system_option_def "document_variants"} specifies document
   185   variants as a colon-separated list of @{text "name=tags"} entries,
   183   variants as a colon-separated list of \<open>name=tags\<close> entries,
   186   corresponding to @{tool document} options @{verbatim "-n"} and
   184   corresponding to @{tool document} options @{verbatim "-n"} and
   187   @{verbatim "-t"}.
   185   @{verbatim "-t"}.
   188 
   186 
   189   For example, @{verbatim
   187   For example, @{verbatim
   190   "document_variants=document:outline=/proof,/ML"} indicates two
   188   "document_variants=document:outline=/proof,/ML"} indicates two
   197   different document root entries, see also
   195   different document root entries, see also
   198   \secref{sec:tool-document}.
   196   \secref{sec:tool-document}.
   199 
   197 
   200   \<^item> @{system_option_def "threads"} determines the number of worker
   198   \<^item> @{system_option_def "threads"} determines the number of worker
   201   threads for parallel checking of theories and proofs.  The default
   199   threads for parallel checking of theories and proofs.  The default
   202   @{text "0"} means that a sensible maximum value is determined by the
   200   \<open>0\<close> means that a sensible maximum value is determined by the
   203   underlying hardware.  For machines with many cores or with
   201   underlying hardware.  For machines with many cores or with
   204   hyperthreading, this is often requires manual adjustment (on the
   202   hyperthreading, this is often requires manual adjustment (on the
   205   command-line or within personal settings or preferences, not within
   203   command-line or within personal settings or preferences, not within
   206   a session @{verbatim ROOT}).
   204   a session @{verbatim ROOT}).
   207 
   205 
   237 
   235 
   238   Report Isabelle system options, augmented by MORE_OPTIONS given as
   236   Report Isabelle system options, augmented by MORE_OPTIONS given as
   239   arguments NAME=VAL or NAME.\<close>}
   237   arguments NAME=VAL or NAME.\<close>}
   240 
   238 
   241   The command line arguments provide additional system options of the
   239   The command line arguments provide additional system options of the
   242   form @{text "name"}@{verbatim "="}@{text "value"} or @{text name}
   240   form \<open>name\<close>@{verbatim "="}\<open>value\<close> or \<open>name\<close>
   243   for Boolean options.
   241   for Boolean options.
   244 
   242 
   245   Option @{verbatim "-b"} augments the implicit environment of system
   243   Option @{verbatim "-b"} augments the implicit environment of system
   246   options by the ones of @{setting ISABELLE_BUILD_OPTIONS}, cf.\
   244   options by the ones of @{setting ISABELLE_BUILD_OPTIONS}, cf.\
   247   \secref{sec:tool-build}.
   245   \secref{sec:tool-build}.
   296   \<^medskip>
   294   \<^medskip>
   297   Isabelle sessions are defined via session ROOT files as
   295   Isabelle sessions are defined via session ROOT files as
   298   described in (\secref{sec:session-root}).  The totality of sessions
   296   described in (\secref{sec:session-root}).  The totality of sessions
   299   is determined by collecting such specifications from all Isabelle
   297   is determined by collecting such specifications from all Isabelle
   300   component directories (\secref{sec:components}), augmented by more
   298   component directories (\secref{sec:components}), augmented by more
   301   directories given via options @{verbatim "-d"}~@{text "DIR"} on the
   299   directories given via options @{verbatim "-d"}~\<open>DIR\<close> on the
   302   command line.  Each such directory may contain a session
   300   command line.  Each such directory may contain a session
   303   @{verbatim ROOT} file with several session specifications.
   301   @{verbatim ROOT} file with several session specifications.
   304 
   302 
   305   Any session root directory may refer recursively to further
   303   Any session root directory may refer recursively to further
   306   directories of the same kind, by listing them in a catalog file
   304   directories of the same kind, by listing them in a catalog file
   309   command line options persistent (say within @{verbatim
   307   command line options persistent (say within @{verbatim
   310   "$ISABELLE_HOME_USER/ROOTS"}).
   308   "$ISABELLE_HOME_USER/ROOTS"}).
   311 
   309 
   312   \<^medskip>
   310   \<^medskip>
   313   The subset of sessions to be managed is determined via
   311   The subset of sessions to be managed is determined via
   314   individual @{text "SESSIONS"} given as command-line arguments, or
   312   individual \<open>SESSIONS\<close> given as command-line arguments, or
   315   session groups that are given via one or more options @{verbatim
   313   session groups that are given via one or more options @{verbatim
   316   "-g"}~@{text "NAME"}.  Option @{verbatim "-a"} selects all sessions.
   314   "-g"}~\<open>NAME\<close>.  Option @{verbatim "-a"} selects all sessions.
   317   The build tool takes session dependencies into account: the set of
   315   The build tool takes session dependencies into account: the set of
   318   selected sessions is completed by including all ancestors.
   316   selected sessions is completed by including all ancestors.
   319 
   317 
   320   \<^medskip>
   318   \<^medskip>
   321   One or more options @{verbatim "-x"}~@{text NAME} specify
   319   One or more options @{verbatim "-x"}~\<open>NAME\<close> specify
   322   sessions to be excluded. All descendents of excluded sessions are removed
   320   sessions to be excluded. All descendents of excluded sessions are removed
   323   from the selection as specified above. Option @{verbatim "-X"} is
   321   from the selection as specified above. Option @{verbatim "-X"} is
   324   analogous to this, but excluded sessions are specified by session group
   322   analogous to this, but excluded sessions are specified by session group
   325   membership.
   323   membership.
   326 
   324 
   340   (\secref{sec:system-options}) that are passed to the prover
   338   (\secref{sec:system-options}) that are passed to the prover
   341   eventually.  The settings variable @{setting_ref
   339   eventually.  The settings variable @{setting_ref
   342   ISABELLE_BUILD_OPTIONS} allows to provide additional defaults, e.g.\
   340   ISABELLE_BUILD_OPTIONS} allows to provide additional defaults, e.g.\
   343   @{verbatim \<open>ISABELLE_BUILD_OPTIONS="document=pdf threads=4"\<close>}. Moreover,
   341   @{verbatim \<open>ISABELLE_BUILD_OPTIONS="document=pdf threads=4"\<close>}. Moreover,
   344   the environment of system build options may be augmented on the
   342   the environment of system build options may be augmented on the
   345   command line via @{verbatim "-o"}~@{text "name"}@{verbatim
   343   command line via @{verbatim "-o"}~\<open>name\<close>@{verbatim
   346   "="}@{text "value"} or @{verbatim "-o"}~@{text "name"}, which
   344   "="}\<open>value\<close> or @{verbatim "-o"}~\<open>name\<close>, which
   347   abbreviates @{verbatim "-o"}~@{text "name"}@{verbatim"=true"} for
   345   abbreviates @{verbatim "-o"}~\<open>name\<close>@{verbatim"=true"} for
   348   Boolean options.  Multiple occurrences of @{verbatim "-o"} on the
   346   Boolean options.  Multiple occurrences of @{verbatim "-o"} on the
   349   command-line are applied in the given order.
   347   command-line are applied in the given order.
   350 
   348 
   351   \<^medskip>
   349   \<^medskip>
   352   Option @{verbatim "-b"} ensures that heap images are
   350   Option @{verbatim "-b"} ensures that heap images are