src/Doc/System/Sessions.thy
changeset 65504 b80477da30eb
parent 65374 a5b38d8d3c1e
child 65505 741fad555d82
equal deleted inserted replaced
65503:a3fffad8f217 65504:b80477da30eb
    68     ;
    68     ;
    69     opts: '[' ( (@{syntax name} '=' value | @{syntax name}) + ',' ) ']'
    69     opts: '[' ( (@{syntax name} '=' value | @{syntax name}) + ',' ) ']'
    70     ;
    70     ;
    71     value: @{syntax name} | @{syntax real}
    71     value: @{syntax name} | @{syntax real}
    72     ;
    72     ;
       
    73     sessions: @'sessions' (@{syntax name}+)
       
    74     ;
       
    75     theories: @'theories' opts? (theory_entry*)
       
    76     ;
    73     theory_entry: @{syntax name} ('(' @'global' ')')?
    77     theory_entry: @{syntax name} ('(' @'global' ')')?
    74     ;
       
    75     theories: @'theories' opts? (theory_entry*)
       
    76     ;
    78     ;
    77     files: @'files' (@{syntax name}+)
    79     files: @'files' (@{syntax name}+)
    78     ;
    80     ;
    79     document_files: @'document_files' ('(' dir ')')? (@{syntax name}+)
    81     document_files: @'document_files' ('(' dir ')')? (@{syntax name}+)
    80   \<close>}
    82   \<close>}
    81 
    83 
    82   \<^descr> \isakeyword{session}~\<open>A = B + body\<close> defines a new session \<open>A\<close> based on
    84   \<^descr> \isakeyword{session}~\<open>A = B + body\<close> defines a new session \<open>A\<close> based on
    83   parent session \<open>B\<close>, with its content given in \<open>body\<close> (theories and auxiliary
    85   parent session \<open>B\<close>, with its content given in \<open>body\<close> (imported sessions,
    84   source files). Note that a parent (like \<open>HOL\<close>) is mandatory in practical
    86   theories and auxiliary source files). Note that a parent (like \<open>HOL\<close>) is
    85   applications: only Isabelle/Pure can bootstrap itself from nothing.
    87   mandatory in practical applications: only Isabelle/Pure can bootstrap itself
    86 
    88   from nothing.
    87   All such session specifications together describe a hierarchy (tree) of
    89 
       
    90   All such session specifications together describe a hierarchy (graph) of
    88   sessions, with globally unique names. The new session name \<open>A\<close> should be
    91   sessions, with globally unique names. The new session name \<open>A\<close> should be
    89   sufficiently long and descriptive to stand on its own in a potentially large
    92   sufficiently long and descriptive to stand on its own in a potentially large
    90   library.
    93   library.
    91 
    94 
    92   \<^descr> \isakeyword{session}~\<open>A (groups)\<close> indicates a collection of groups where
    95   \<^descr> \isakeyword{session}~\<open>A (groups)\<close> indicates a collection of groups where
   110   \<^descr> \isakeyword{options}~\<open>[x = a, y = b, z]\<close> defines separate options
   113   \<^descr> \isakeyword{options}~\<open>[x = a, y = b, z]\<close> defines separate options
   111   (\secref{sec:system-options}) that are used when processing this session,
   114   (\secref{sec:system-options}) that are used when processing this session,
   112   but \<^emph>\<open>without\<close> propagation to child sessions. Note that \<open>z\<close> abbreviates \<open>z =
   115   but \<^emph>\<open>without\<close> propagation to child sessions. Note that \<open>z\<close> abbreviates \<open>z =
   113   true\<close> for Boolean options.
   116   true\<close> for Boolean options.
   114 
   117 
       
   118   \<^descr> \isakeyword{sessions}~\<open>names\<close> specifies sessions that are \<^emph>\<open>imported\<close> into
       
   119   the current name space of theories. This allows to refer to a theory \<open>A\<close>
       
   120   from session \<open>B\<close> by the qualified name \<open>B.A\<close> --- although it is loaded again
       
   121   into the current ML process, which is in contrast to a theory that is
       
   122   already present in the \<^emph>\<open>parent\<close> session.
       
   123 
   115   \<^descr> \isakeyword{theories}~\<open>options names\<close> specifies a block of theories that
   124   \<^descr> \isakeyword{theories}~\<open>options names\<close> specifies a block of theories that
   116   are processed within an environment that is augmented by the given options,
   125   are processed within an environment that is augmented by the given options,
   117   in addition to the global session options given before. Any number of blocks
   126   in addition to the global session options given before. Any number of blocks
   118   of \isakeyword{theories} may be given. Options are only active for each
   127   of \isakeyword{theories} may be given. Options are only active for each
   119   \isakeyword{theories} block separately.
   128   \isakeyword{theories} block separately.
   120 
   129 
   121   A theory name that is followed by \<open>(\<close>\isakeyword{global}\<open>)\<close> is treated
   130   A theory name that is followed by \<open>(\<close>\isakeyword{global}\<open>)\<close> is treated
   122   literally in other session specifications or theory imports. In contrast,
   131   literally in other session specifications or theory imports. In contrast,
   123   the default is to qualify theory names by the session name, in order to
   132   the default is to qualify theory names by the session name, in order to
   124   ensure globally unique names in big session trees.
   133   ensure globally unique names in big session graphs.
   125 
   134 
   126   \<^descr> \isakeyword{files}~\<open>files\<close> lists additional source files that are involved
   135   \<^descr> \isakeyword{files}~\<open>files\<close> lists additional source files that are involved
   127   in the processing of this session. This should cover anything outside the
   136   in the processing of this session. This should cover anything outside the
   128   formal content of the theory sources. In contrast, files that are loaded
   137   formal content of the theory sources. In contrast, files that are loaded
   129   formally within a theory, e.g.\ via @{command "ML_file"}, need not be
   138   formally within a theory, e.g.\ via @{command "ML_file"}, need not be