author | haftmann |
Sun, 29 Nov 2020 07:57:50 +0000 | |
changeset 72769 | 4dcd05a26795 |
parent 72648 | 1cbac4ae934d |
child 72876 | 626fcaebd049 |
permissions | -rw-r--r-- |
61656 | 1 |
(*:maxLineLen=78:*) |
61575 | 2 |
|
48578 | 3 |
theory Sessions |
4 |
imports Base |
|
5 |
begin |
|
6 |
||
58618 | 7 |
chapter \<open>Isabelle sessions and build management \label{ch:session}\<close> |
48584 | 8 |
|
61575 | 9 |
text \<open> |
10 |
An Isabelle \<^emph>\<open>session\<close> consists of a collection of related theories that may |
|
11 |
be associated with formal documents (\chref{ch:present}). There is also a |
|
12 |
notion of \<^emph>\<open>persistent heap\<close> image to capture the state of a session, |
|
13 |
similar to object-code in compiled programming languages. Thus the concept |
|
14 |
of session resembles that of a ``project'' in common IDE environments, but |
|
15 |
the specific name emphasizes the connection to interactive theorem proving: |
|
16 |
the session wraps-up the results of user-interaction with the prover in a |
|
17 |
persistent form. |
|
48584 | 18 |
|
61575 | 19 |
Application sessions are built on a given parent session, which may be built |
20 |
recursively on other parents. Following this path in the hierarchy |
|
21 |
eventually leads to some major object-logic session like \<open>HOL\<close>, which itself |
|
22 |
is based on \<open>Pure\<close> as the common root of all sessions. |
|
48584 | 23 |
|
61575 | 24 |
Processing sessions may take considerable time. Isabelle build management |
25 |
helps to organize this efficiently. This includes support for parallel build |
|
26 |
jobs, in addition to the multithreaded theory and proof checking that is |
|
27 |
already provided by the prover process itself. |
|
28 |
\<close> |
|
48604 | 29 |
|
48578 | 30 |
|
58618 | 31 |
section \<open>Session ROOT specifications \label{sec:session-root}\<close> |
48578 | 32 |
|
61575 | 33 |
text \<open> |
34 |
Session specifications reside in files called \<^verbatim>\<open>ROOT\<close> within certain |
|
35 |
directories, such as the home locations of registered Isabelle components or |
|
36 |
additional project directories given by the user. |
|
48579 | 37 |
|
61575 | 38 |
The ROOT file format follows the lexical conventions of the \<^emph>\<open>outer syntax\<close> |
39 |
of Isabelle/Isar, see also @{cite "isabelle-isar-ref"}. This defines common |
|
40 |
forms like identifiers, names, quoted strings, verbatim text, nested |
|
41 |
comments etc. The grammar for @{syntax session_chapter} and @{syntax |
|
42 |
session_entry} is given as syntax diagram below; each ROOT file may contain |
|
43 |
multiple specifications like this. Chapters help to organize browser info |
|
44 |
(\secref{sec:info}), but have no formal meaning. The default chapter is |
|
45 |
``\<open>Unsorted\<close>''. |
|
48579 | 46 |
|
61575 | 47 |
Isabelle/jEdit @{cite "isabelle-jedit"} includes a simple editing mode |
48 |
\<^verbatim>\<open>isabelle-root\<close> for session ROOT files, which is enabled by default for any |
|
49 |
file of that name. |
|
48579 | 50 |
|
69593 | 51 |
\<^rail>\<open> |
51417 | 52 |
@{syntax_def session_chapter}: @'chapter' @{syntax name} |
53 |
; |
|
54 |
||
66971 | 55 |
@{syntax_def session_entry}: @'session' @{syntax system_name} groups? dir? '=' \<newline> |
70678
36c8c32346cb
clarified syntax: 'directories' and 'theories' belong together;
wenzelm
parents:
70677
diff
changeset
|
56 |
(@{syntax system_name} '+')? description? options? \<newline> |
36c8c32346cb
clarified syntax: 'directories' and 'theories' belong together;
wenzelm
parents:
70677
diff
changeset
|
57 |
sessions? directories? (theories*) \<newline> |
72600
2fa4f25d9d07
official support for document theories from other sessions;
wenzelm
parents:
72574
diff
changeset
|
58 |
(document_theories?) (document_files*) \<newline> |
2fa4f25d9d07
official support for document theories from other sessions;
wenzelm
parents:
72574
diff
changeset
|
59 |
(export_files*) |
48579 | 60 |
; |
61 |
groups: '(' (@{syntax name} +) ')' |
|
62 |
; |
|
68808 | 63 |
dir: @'in' @{syntax embedded} |
48579 | 64 |
; |
65 |
description: @'description' @{syntax text} |
|
66 |
; |
|
67 |
options: @'options' opts |
|
68 |
; |
|
48605
e777363440d6
allow negative int values as well, according to real = int | float;
wenzelm
parents:
48604
diff
changeset
|
69 |
opts: '[' ( (@{syntax name} '=' value | @{syntax name}) + ',' ) ']' |
e777363440d6
allow negative int values as well, according to real = int | float;
wenzelm
parents:
48604
diff
changeset
|
70 |
; |
e777363440d6
allow negative int values as well, according to real = int | float;
wenzelm
parents:
48604
diff
changeset
|
71 |
value: @{syntax name} | @{syntax real} |
48579 | 72 |
; |
66916 | 73 |
sessions: @'sessions' (@{syntax system_name}+) |
65374 | 74 |
; |
70681 | 75 |
directories: @'directories' (dir+) |
70678
36c8c32346cb
clarified syntax: 'directories' and 'theories' belong together;
wenzelm
parents:
70677
diff
changeset
|
76 |
; |
66970
13857f49d215
clarified ROOT syntax: 'sessions' and 'theories' are optional, but need to be non-empty;
wenzelm
parents:
66916
diff
changeset
|
77 |
theories: @'theories' opts? (theory_entry+) |
48579 | 78 |
; |
66916 | 79 |
theory_entry: @{syntax system_name} ('(' @'global' ')')? |
65504 | 80 |
; |
72600
2fa4f25d9d07
official support for document theories from other sessions;
wenzelm
parents:
72574
diff
changeset
|
81 |
document_theories: @'document_theories' (@{syntax name}+) |
2fa4f25d9d07
official support for document theories from other sessions;
wenzelm
parents:
72574
diff
changeset
|
82 |
; |
68808 | 83 |
document_files: @'document_files' ('(' dir ')')? (@{syntax embedded}+) |
68292 | 84 |
; |
69671 | 85 |
export_files: @'export_files' ('(' dir ')')? ('[' nat ']')? \<newline> |
86 |
(@{syntax embedded}+) |
|
69593 | 87 |
\<close> |
48579 | 88 |
|
61575 | 89 |
\<^descr> \isakeyword{session}~\<open>A = B + body\<close> defines a new session \<open>A\<close> based on |
66759 | 90 |
parent session \<open>B\<close>, with its content given in \<open>body\<close> (imported sessions and |
91 |
theories). Note that a parent (like \<open>HOL\<close>) is mandatory in practical |
|
92 |
applications: only Isabelle/Pure can bootstrap itself from nothing. |
|
48579 | 93 |
|
65504 | 94 |
All such session specifications together describe a hierarchy (graph) of |
61575 | 95 |
sessions, with globally unique names. The new session name \<open>A\<close> should be |
96 |
sufficiently long and descriptive to stand on its own in a potentially large |
|
97 |
library. |
|
48579 | 98 |
|
61575 | 99 |
\<^descr> \isakeyword{session}~\<open>A (groups)\<close> indicates a collection of groups where |
100 |
the new session is a member. Group names are uninterpreted and merely follow |
|
101 |
certain conventions. For example, the Isabelle distribution tags some |
|
102 |
important sessions by the group name called ``\<open>main\<close>''. Other projects may |
|
103 |
invent their own conventions, but this requires some care to avoid clashes |
|
48604 | 104 |
within this unchecked name space. |
48579 | 105 |
|
61575 | 106 |
\<^descr> \isakeyword{session}~\<open>A\<close>~\isakeyword{in}~\<open>dir\<close> specifies an explicit |
107 |
directory for this session; by default this is the current directory of the |
|
108 |
\<^verbatim>\<open>ROOT\<close> file. |
|
48579 | 109 |
|
66759 | 110 |
All theory files are located relatively to the session directory. The prover |
111 |
process is run within the same as its current working directory. |
|
48579 | 112 |
|
61575 | 113 |
\<^descr> \isakeyword{description}~\<open>text\<close> is a free-form annotation for this |
114 |
session. |
|
48579 | 115 |
|
61575 | 116 |
\<^descr> \isakeyword{options}~\<open>[x = a, y = b, z]\<close> defines separate options |
117 |
(\secref{sec:system-options}) that are used when processing this session, |
|
118 |
but \<^emph>\<open>without\<close> propagation to child sessions. Note that \<open>z\<close> abbreviates \<open>z = |
|
119 |
true\<close> for Boolean options. |
|
120 |
||
65504 | 121 |
\<^descr> \isakeyword{sessions}~\<open>names\<close> specifies sessions that are \<^emph>\<open>imported\<close> into |
122 |
the current name space of theories. This allows to refer to a theory \<open>A\<close> |
|
123 |
from session \<open>B\<close> by the qualified name \<open>B.A\<close> --- although it is loaded again |
|
124 |
into the current ML process, which is in contrast to a theory that is |
|
125 |
already present in the \<^emph>\<open>parent\<close> session. |
|
126 |
||
65505 | 127 |
Theories that are imported from other sessions are excluded from the current |
128 |
session document. |
|
129 |
||
70678
36c8c32346cb
clarified syntax: 'directories' and 'theories' belong together;
wenzelm
parents:
70677
diff
changeset
|
130 |
\<^descr> \isakeyword{directories}~\<open>dirs\<close> specifies additional directories for |
36c8c32346cb
clarified syntax: 'directories' and 'theories' belong together;
wenzelm
parents:
70677
diff
changeset
|
131 |
import of theory files via \isakeyword{theories} within \<^verbatim>\<open>ROOT\<close> or |
36c8c32346cb
clarified syntax: 'directories' and 'theories' belong together;
wenzelm
parents:
70677
diff
changeset
|
132 |
\<^theory_text>\<open>imports\<close> within a theory; \<open>dirs\<close> are relative to the main session |
36c8c32346cb
clarified syntax: 'directories' and 'theories' belong together;
wenzelm
parents:
70677
diff
changeset
|
133 |
directory (cf.\ \isakeyword{session} \dots \isakeyword{in}~\<open>dir\<close>). These |
70681 | 134 |
directories need to be exclusively assigned to a unique session, without |
135 |
implicit sharing of file-system locations. |
|
70678
36c8c32346cb
clarified syntax: 'directories' and 'theories' belong together;
wenzelm
parents:
70677
diff
changeset
|
136 |
|
61575 | 137 |
\<^descr> \isakeyword{theories}~\<open>options names\<close> specifies a block of theories that |
138 |
are processed within an environment that is augmented by the given options, |
|
139 |
in addition to the global session options given before. Any number of blocks |
|
140 |
of \isakeyword{theories} may be given. Options are only active for each |
|
48604 | 141 |
\isakeyword{theories} block separately. |
48579 | 142 |
|
65374 | 143 |
A theory name that is followed by \<open>(\<close>\isakeyword{global}\<open>)\<close> is treated |
66993 | 144 |
literally in other session specifications or theory imports --- the normal |
145 |
situation is to qualify theory names by the session name; this ensures |
|
146 |
globally unique names in big session graphs. Global theories are usually the |
|
147 |
entry points to major logic sessions: \<open>Pure\<close>, \<open>Main\<close>, \<open>Complex_Main\<close>, |
|
148 |
\<open>HOLCF\<close>, \<open>IFOL\<close>, \<open>FOL\<close>, \<open>ZF\<close>, \<open>ZFC\<close> etc. Regular Isabelle applications |
|
149 |
should not claim any global theory names. |
|
65374 | 150 |
|
72600
2fa4f25d9d07
official support for document theories from other sessions;
wenzelm
parents:
72574
diff
changeset
|
151 |
\<^descr> \isakeyword{document_theories}~\<open>names\<close> specifies theories from other |
2fa4f25d9d07
official support for document theories from other sessions;
wenzelm
parents:
72574
diff
changeset
|
152 |
sessions that should be included in the generated document source directory. |
2fa4f25d9d07
official support for document theories from other sessions;
wenzelm
parents:
72574
diff
changeset
|
153 |
These theories need to be explicit imports in the current session, or |
72769 | 154 |
implicit imports from the underlying hierarchy of parent sessions. The |
72600
2fa4f25d9d07
official support for document theories from other sessions;
wenzelm
parents:
72574
diff
changeset
|
155 |
generated \<^verbatim>\<open>session.tex\<close> file is not affected: the session's {\LaTeX} setup |
2fa4f25d9d07
official support for document theories from other sessions;
wenzelm
parents:
72574
diff
changeset
|
156 |
needs to \<^verbatim>\<open>\input{\<close>\<open>\<dots>\<close>\<^verbatim>\<open>}\<close> generated \<^verbatim>\<open>.tex\<close> files separately. |
2fa4f25d9d07
official support for document theories from other sessions;
wenzelm
parents:
72574
diff
changeset
|
157 |
|
61575 | 158 |
\<^descr> \isakeyword{document_files}~\<open>(\<close>\isakeyword{in}~\<open>base_dir) files\<close> lists |
159 |
source files for document preparation, typically \<^verbatim>\<open>.tex\<close> and \<^verbatim>\<open>.sty\<close> for |
|
160 |
{\LaTeX}. Only these explicitly given files are copied from the base |
|
161 |
directory to the document output directory, before formal document |
|
162 |
processing is started (see also \secref{sec:tool-document}). The local path |
|
163 |
structure of the \<open>files\<close> is preserved, which allows to reconstruct the |
|
68292 | 164 |
original directory hierarchy of \<open>base_dir\<close>. The default \<open>base_dir\<close> is |
165 |
\<^verbatim>\<open>document\<close> within the session root directory. |
|
56533
cd8b6d849b6a
explicit 'document_files' in session ROOT specifications;
wenzelm
parents:
55112
diff
changeset
|
166 |
|
69671 | 167 |
\<^descr> \isakeyword{export_files}~\<open>(\<close>\isakeyword{in}~\<open>target_dir) [number] |
69811
18f61ce86425
clarified 'export_files' in session ROOT: require explicit "isabelle build -e";
wenzelm
parents:
69755
diff
changeset
|
168 |
patterns\<close> specifies theory exports that may get written to the file-system, |
18f61ce86425
clarified 'export_files' in session ROOT: require explicit "isabelle build -e";
wenzelm
parents:
69755
diff
changeset
|
169 |
e.g. via @{tool_ref build} with option \<^verbatim>\<open>-e\<close> (\secref{sec:tool-build}). The |
18f61ce86425
clarified 'export_files' in session ROOT: require explicit "isabelle build -e";
wenzelm
parents:
69755
diff
changeset
|
170 |
\<open>target_dir\<close> specification is relative to the session root directory; its |
18f61ce86425
clarified 'export_files' in session ROOT: require explicit "isabelle build -e";
wenzelm
parents:
69755
diff
changeset
|
171 |
default is \<^verbatim>\<open>export\<close>. Exports are selected via \<open>patterns\<close> as in @{tool_ref |
18f61ce86425
clarified 'export_files' in session ROOT: require explicit "isabelle build -e";
wenzelm
parents:
69755
diff
changeset
|
172 |
export} (\secref{sec:tool-export}). The number given in brackets (default: |
18f61ce86425
clarified 'export_files' in session ROOT: require explicit "isabelle build -e";
wenzelm
parents:
69755
diff
changeset
|
173 |
0) specifies elements that should be pruned from each name: it allows to |
18f61ce86425
clarified 'export_files' in session ROOT: require explicit "isabelle build -e";
wenzelm
parents:
69755
diff
changeset
|
174 |
reduce the resulting directory hierarchy at the danger of overwriting files |
18f61ce86425
clarified 'export_files' in session ROOT: require explicit "isabelle build -e";
wenzelm
parents:
69755
diff
changeset
|
175 |
due to loss of uniqueness. |
58618 | 176 |
\<close> |
48579 | 177 |
|
51055 | 178 |
|
58618 | 179 |
subsubsection \<open>Examples\<close> |
48580 | 180 |
|
61575 | 181 |
text \<open> |
63680 | 182 |
See \<^file>\<open>~~/src/HOL/ROOT\<close> for a diversity of practically relevant situations, |
183 |
although it uses relatively complex quasi-hierarchic naming conventions like |
|
184 |
\<^verbatim>\<open>HOL-SPARK\<close>, \<^verbatim>\<open>HOL-SPARK-Examples\<close>. An alternative is to use unqualified |
|
185 |
names that are relatively long and descriptive, as in the Archive of Formal |
|
67605 | 186 |
Proofs (\<^url>\<open>https://isa-afp.org\<close>), for example. |
61575 | 187 |
\<close> |
48578 | 188 |
|
189 |
||
58618 | 190 |
section \<open>System build options \label{sec:system-options}\<close> |
48578 | 191 |
|
61575 | 192 |
text \<open> |
63680 | 193 |
See \<^file>\<open>~~/etc/options\<close> for the main defaults provided by the Isabelle |
61575 | 194 |
distribution. Isabelle/jEdit @{cite "isabelle-jedit"} includes a simple |
195 |
editing mode \<^verbatim>\<open>isabelle-options\<close> for this file-format. |
|
48693
ceeea46bdeba
"isabelle options" prints Isabelle system options;
wenzelm
parents:
48684
diff
changeset
|
196 |
|
61575 | 197 |
The following options are particularly relevant to build Isabelle sessions, |
198 |
in particular with document preparation (\chref{ch:present}). |
|
51055 | 199 |
|
61575 | 200 |
\<^item> @{system_option_def "browser_info"} controls output of HTML browser |
201 |
info, see also \secref{sec:info}. |
|
51055 | 202 |
|
72574
d892f6d66402
build documents in Isabelle/Scala, based on generated tex files as session exports;
wenzelm
parents:
72515
diff
changeset
|
203 |
\<^item> @{system_option_def "document"} controls document output for a |
d892f6d66402
build documents in Isabelle/Scala, based on generated tex files as session exports;
wenzelm
parents:
72515
diff
changeset
|
204 |
particular session or theory; \<^verbatim>\<open>document=pdf\<close> means enabled, |
d892f6d66402
build documents in Isabelle/Scala, based on generated tex files as session exports;
wenzelm
parents:
72515
diff
changeset
|
205 |
\<^verbatim>\<open>document=false\<close> means disabled (especially for particular theories). |
51055 | 206 |
|
61575 | 207 |
\<^item> @{system_option_def "document_output"} specifies an alternative |
208 |
directory for generated output of the document preparation system; the |
|
209 |
default is within the @{setting "ISABELLE_BROWSER_INFO"} hierarchy as |
|
210 |
explained in \secref{sec:info}. See also @{tool mkroot}, which generates a |
|
211 |
default configuration with output readily available to the author of the |
|
212 |
document. |
|
51055 | 213 |
|
61575 | 214 |
\<^item> @{system_option_def "document_variants"} specifies document variants as |
72574
d892f6d66402
build documents in Isabelle/Scala, based on generated tex files as session exports;
wenzelm
parents:
72515
diff
changeset
|
215 |
a colon-separated list of \<open>name=tags\<close> entries. The default name |
d892f6d66402
build documents in Isabelle/Scala, based on generated tex files as session exports;
wenzelm
parents:
72515
diff
changeset
|
216 |
\<^verbatim>\<open>document\<close>, without additional tags. |
51055 | 217 |
|
72574
d892f6d66402
build documents in Isabelle/Scala, based on generated tex files as session exports;
wenzelm
parents:
72515
diff
changeset
|
218 |
Tags are specified as a comma separated list of modifier/name pairs and |
d892f6d66402
build documents in Isabelle/Scala, based on generated tex files as session exports;
wenzelm
parents:
72515
diff
changeset
|
219 |
tell {\LaTeX} how to interpret certain Isabelle command regions: |
d892f6d66402
build documents in Isabelle/Scala, based on generated tex files as session exports;
wenzelm
parents:
72515
diff
changeset
|
220 |
``\<^verbatim>\<open>+\<close>\<open>foo\<close>'' (or just ``\<open>foo\<close>'') means to keep, ``\<^verbatim>\<open>-\<close>\<open>foo\<close>'' to drop, |
d892f6d66402
build documents in Isabelle/Scala, based on generated tex files as session exports;
wenzelm
parents:
72515
diff
changeset
|
221 |
and ``\<^verbatim>\<open>/\<close>\<open>foo\<close>'' to fold text tagged as \<open>foo\<close>. The builtin default is |
d892f6d66402
build documents in Isabelle/Scala, based on generated tex files as session exports;
wenzelm
parents:
72515
diff
changeset
|
222 |
equivalent to the tag specification |
d892f6d66402
build documents in Isabelle/Scala, based on generated tex files as session exports;
wenzelm
parents:
72515
diff
changeset
|
223 |
``\<^verbatim>\<open>+document,+theory,+proof,+ML,+visible,-invisible,+important,+unimportant\<close>''; |
d892f6d66402
build documents in Isabelle/Scala, based on generated tex files as session exports;
wenzelm
parents:
72515
diff
changeset
|
224 |
see also the {\LaTeX} macros \<^verbatim>\<open>\isakeeptag\<close>, \<^verbatim>\<open>\isadroptag\<close>, and |
d892f6d66402
build documents in Isabelle/Scala, based on generated tex files as session exports;
wenzelm
parents:
72515
diff
changeset
|
225 |
\<^verbatim>\<open>\isafoldtag\<close>, in \<^file>\<open>~~/lib/texinputs/isabelle.sty\<close>. |
d892f6d66402
build documents in Isabelle/Scala, based on generated tex files as session exports;
wenzelm
parents:
72515
diff
changeset
|
226 |
|
d892f6d66402
build documents in Isabelle/Scala, based on generated tex files as session exports;
wenzelm
parents:
72515
diff
changeset
|
227 |
In contrast, \<^verbatim>\<open>document_variants=document:outline=/proof,/ML\<close> indicates |
61575 | 228 |
two documents: the one called \<^verbatim>\<open>document\<close> with default tags, and the other |
229 |
called \<^verbatim>\<open>outline\<close> where proofs and ML sections are folded. |
|
51055 | 230 |
|
61575 | 231 |
Document variant names are just a matter of conventions. It is also |
232 |
possible to use different document variant names (without tags) for |
|
233 |
different document root entries, see also \secref{sec:tool-document}. |
|
51055 | 234 |
|
68513 | 235 |
\<^item> @{system_option_def "document_tags"} specifies alternative command tags |
236 |
as a comma-separated list of items: either ``\<open>command\<close>\<^verbatim>\<open>%\<close>\<open>tag\<close>'' for a |
|
237 |
specific command, or ``\<^verbatim>\<open>%\<close>\<open>tag\<close>'' as default for all other commands. This |
|
238 |
is occasionally useful to control the global visibility of commands via |
|
239 |
session options (e.g.\ in \<^verbatim>\<open>ROOT\<close>). |
|
67140 | 240 |
|
61575 | 241 |
\<^item> @{system_option_def "threads"} determines the number of worker threads |
242 |
for parallel checking of theories and proofs. The default \<open>0\<close> means that a |
|
243 |
sensible maximum value is determined by the underlying hardware. For |
|
244 |
machines with many cores or with hyperthreading, this is often requires |
|
245 |
manual adjustment (on the command-line or within personal settings or |
|
246 |
preferences, not within a session \<^verbatim>\<open>ROOT\<close>). |
|
51055 | 247 |
|
61575 | 248 |
\<^item> @{system_option_def "condition"} specifies a comma-separated list of |
249 |
process environment variables (or Isabelle settings) that are required for |
|
250 |
the subsequent theories to be processed. Conditions are considered |
|
251 |
``true'' if the corresponding environment value is defined and non-empty. |
|
51055 | 252 |
|
61602 | 253 |
\<^item> @{system_option_def "timeout"} and @{system_option_def "timeout_scale"} |
254 |
specify a real wall-clock timeout for the session as a whole: the two |
|
255 |
values are multiplied and taken as the number of seconds. Typically, |
|
256 |
@{system_option "timeout"} is given for individual sessions, and |
|
257 |
@{system_option "timeout_scale"} as global adjustment to overall hardware |
|
258 |
performance. |
|
259 |
||
260 |
The timer is controlled outside the ML process by the JVM that runs |
|
261 |
Isabelle/Scala. Thus it is relatively reliable in canceling processes that |
|
262 |
get out of control, even if there is a deadlock without CPU time usage. |
|
51055 | 263 |
|
64308 | 264 |
\<^item> @{system_option_def "profiling"} specifies a mode for global ML |
265 |
profiling. Possible values are the empty string (disabled), \<^verbatim>\<open>time\<close> for |
|
69593 | 266 |
\<^ML>\<open>profile_time\<close> and \<^verbatim>\<open>allocations\<close> for \<^ML>\<open>profile_allocations\<close>. |
64308 | 267 |
Results appear near the bottom of the session log file. |
268 |
||
69854
cc0b3e177b49
system option "system_heaps" supersedes various command-line options for "system build mode";
wenzelm
parents:
69811
diff
changeset
|
269 |
\<^item> @{system_option_def "system_heaps"} determines the directories for |
cc0b3e177b49
system option "system_heaps" supersedes various command-line options for "system build mode";
wenzelm
parents:
69811
diff
changeset
|
270 |
session heap images: \<^path>\<open>$ISABELLE_HEAPS\<close> is the user directory and |
cc0b3e177b49
system option "system_heaps" supersedes various command-line options for "system build mode";
wenzelm
parents:
69811
diff
changeset
|
271 |
\<^path>\<open>$ISABELLE_HEAPS_SYSTEM\<close> the system directory (usually within the |
cc0b3e177b49
system option "system_heaps" supersedes various command-line options for "system build mode";
wenzelm
parents:
69811
diff
changeset
|
272 |
Isabelle application). For \<^verbatim>\<open>system_heaps=false\<close>, heaps are stored in the |
cc0b3e177b49
system option "system_heaps" supersedes various command-line options for "system build mode";
wenzelm
parents:
69811
diff
changeset
|
273 |
user directory and may be loaded from both directories. For |
cc0b3e177b49
system option "system_heaps" supersedes various command-line options for "system build mode";
wenzelm
parents:
69811
diff
changeset
|
274 |
\<^verbatim>\<open>system_heaps=true\<close>, store and load happens only in the system directory. |
cc0b3e177b49
system option "system_heaps" supersedes various command-line options for "system build mode";
wenzelm
parents:
69811
diff
changeset
|
275 |
|
61575 | 276 |
The @{tool_def options} tool prints Isabelle system options. Its |
48693
ceeea46bdeba
"isabelle options" prints Isabelle system options;
wenzelm
parents:
48684
diff
changeset
|
277 |
command-line usage is: |
61407
7ba7b8103565
@{verbatim [display]} supersedes old alltt/ttbox;
wenzelm
parents:
61406
diff
changeset
|
278 |
@{verbatim [display] |
7ba7b8103565
@{verbatim [display]} supersedes old alltt/ttbox;
wenzelm
parents:
61406
diff
changeset
|
279 |
\<open>Usage: isabelle options [OPTIONS] [MORE_OPTIONS ...] |
48693
ceeea46bdeba
"isabelle options" prints Isabelle system options;
wenzelm
parents:
48684
diff
changeset
|
280 |
|
ceeea46bdeba
"isabelle options" prints Isabelle system options;
wenzelm
parents:
48684
diff
changeset
|
281 |
Options are: |
ceeea46bdeba
"isabelle options" prints Isabelle system options;
wenzelm
parents:
48684
diff
changeset
|
282 |
-b include $ISABELLE_BUILD_OPTIONS |
52735 | 283 |
-g OPTION get value of OPTION |
50531
f841ac0cb757
clarified "isabelle options" command line, to make it more close to "isabelle components";
wenzelm
parents:
50406
diff
changeset
|
284 |
-l list options |
48693
ceeea46bdeba
"isabelle options" prints Isabelle system options;
wenzelm
parents:
48684
diff
changeset
|
285 |
-x FILE export to FILE in YXML format |
ceeea46bdeba
"isabelle options" prints Isabelle system options;
wenzelm
parents:
48684
diff
changeset
|
286 |
|
50531
f841ac0cb757
clarified "isabelle options" command line, to make it more close to "isabelle components";
wenzelm
parents:
50406
diff
changeset
|
287 |
Report Isabelle system options, augmented by MORE_OPTIONS given as |
61407
7ba7b8103565
@{verbatim [display]} supersedes old alltt/ttbox;
wenzelm
parents:
61406
diff
changeset
|
288 |
arguments NAME=VAL or NAME.\<close>} |
48693
ceeea46bdeba
"isabelle options" prints Isabelle system options;
wenzelm
parents:
48684
diff
changeset
|
289 |
|
61575 | 290 |
The command line arguments provide additional system options of the form |
291 |
\<open>name\<close>\<^verbatim>\<open>=\<close>\<open>value\<close> or \<open>name\<close> for Boolean options. |
|
292 |
||
293 |
Option \<^verbatim>\<open>-b\<close> augments the implicit environment of system options by the ones |
|
294 |
of @{setting ISABELLE_BUILD_OPTIONS}, cf.\ \secref{sec:tool-build}. |
|
48693
ceeea46bdeba
"isabelle options" prints Isabelle system options;
wenzelm
parents:
48684
diff
changeset
|
295 |
|
61575 | 296 |
Option \<^verbatim>\<open>-g\<close> prints the value of the given option. Option \<^verbatim>\<open>-l\<close> lists all |
297 |
options with their declaration and current value. |
|
48693
ceeea46bdeba
"isabelle options" prints Isabelle system options;
wenzelm
parents:
48684
diff
changeset
|
298 |
|
61575 | 299 |
Option \<^verbatim>\<open>-x\<close> specifies a file to export the result in YXML format, instead |
300 |
of printing it in human-readable form. |
|
58618 | 301 |
\<close> |
48578 | 302 |
|
303 |
||
58618 | 304 |
section \<open>Invoking the build process \label{sec:tool-build}\<close> |
48578 | 305 |
|
61575 | 306 |
text \<open> |
307 |
The @{tool_def build} tool invokes the build process for Isabelle sessions. |
|
308 |
It manages dependencies between sessions, related sources of theories and |
|
309 |
auxiliary files, and target heap images. Accordingly, it runs instances of |
|
310 |
the prover process with optional document preparation. Its command-line |
|
311 |
usage is:\<^footnote>\<open>Isabelle/Scala provides the same functionality via |
|
71896
ce06d6456cc8
clarified signature --- fit within limit of 22 arguments;
wenzelm
parents:
71893
diff
changeset
|
312 |
\<^scala_method>\<open>isabelle.Build.build\<close>.\<close> |
61407
7ba7b8103565
@{verbatim [display]} supersedes old alltt/ttbox;
wenzelm
parents:
61406
diff
changeset
|
313 |
@{verbatim [display] |
7ba7b8103565
@{verbatim [display]} supersedes old alltt/ttbox;
wenzelm
parents:
61406
diff
changeset
|
314 |
\<open>Usage: isabelle build [OPTIONS] [SESSIONS ...] |
48578 | 315 |
|
316 |
Options are: |
|
66737
2edc0c42c883
option -B for "isabelle build" and "isabelle imports";
wenzelm
parents:
66671
diff
changeset
|
317 |
-B NAME include session NAME and all descendants |
48737
f3bbb9ca57d6
added build option -D: include session directory and select its sessions;
wenzelm
parents:
48693
diff
changeset
|
318 |
-D DIR include session directory and select its sessions |
64265 | 319 |
-N cyclic shuffling of NUMA CPU nodes (performance tuning) |
72648 | 320 |
-P DIR enable HTML/PDF presentation in directory (":" for default) |
71807 | 321 |
-R refer to requirements of selected sessions |
66745 | 322 |
-S soft build: only observe changes of sources, not heap images |
60106 | 323 |
-X NAME exclude sessions from group NAME and all descendants |
48578 | 324 |
-a select all sessions |
325 |
-b build heap images |
|
48595 | 326 |
-c clean build |
48737
f3bbb9ca57d6
added build option -D: include session directory and select its sessions;
wenzelm
parents:
48693
diff
changeset
|
327 |
-d DIR include session directory |
69811
18f61ce86425
clarified 'export_files' in session ROOT: require explicit "isabelle build -e";
wenzelm
parents:
69755
diff
changeset
|
328 |
-e export files from session specification into file-system |
66841 | 329 |
-f fresh build |
48578 | 330 |
-g NAME select session group NAME |
331 |
-j INT maximum number of parallel jobs (default 1) |
|
59891
9ce697050455
added isabelle build option -k, for fast off-line checking of theory sources;
wenzelm
parents:
59446
diff
changeset
|
332 |
-k KEYWORD check theory sources for conflicts with proposed keywords |
48903 | 333 |
-l list session source files |
48578 | 334 |
-n no build -- test dependencies only |
52056 | 335 |
-o OPTION override Isabelle system OPTION (via NAME=VAL or NAME) |
48578 | 336 |
-v verbose |
60106 | 337 |
-x NAME exclude session NAME and all descendants |
48578 | 338 |
|
62596 | 339 |
Build and manage Isabelle sessions, depending on implicit settings: |
340 |
||
71982 | 341 |
ISABELLE_TOOL_JAVA_OPTIONS="..." |
48578 | 342 |
ISABELLE_BUILD_OPTIONS="..." |
343 |
||
344 |
ML_PLATFORM="..." |
|
345 |
ML_HOME="..." |
|
346 |
ML_SYSTEM="..." |
|
61407
7ba7b8103565
@{verbatim [display]} supersedes old alltt/ttbox;
wenzelm
parents:
61406
diff
changeset
|
347 |
ML_OPTIONS="..."\<close>} |
48578 | 348 |
|
61406 | 349 |
\<^medskip> |
61575 | 350 |
Isabelle sessions are defined via session ROOT files as described in |
351 |
(\secref{sec:session-root}). The totality of sessions is determined by |
|
352 |
collecting such specifications from all Isabelle component directories |
|
353 |
(\secref{sec:components}), augmented by more directories given via options |
|
354 |
\<^verbatim>\<open>-d\<close>~\<open>DIR\<close> on the command line. Each such directory may contain a session |
|
61503 | 355 |
\<^verbatim>\<open>ROOT\<close> file with several session specifications. |
48578 | 356 |
|
61575 | 357 |
Any session root directory may refer recursively to further directories of |
358 |
the same kind, by listing them in a catalog file \<^verbatim>\<open>ROOTS\<close> line-by-line. This |
|
359 |
helps to organize large collections of session specifications, or to make |
|
66576 | 360 |
\<^verbatim>\<open>-d\<close> command line options persistent (e.g.\ in |
61503 | 361 |
\<^verbatim>\<open>$ISABELLE_HOME_USER/ROOTS\<close>). |
48684
9170e10c651e
re-introduced ROOTS catalog files (cf. 47330b712f8f) which help to organize AFP or make -d options persistent;
wenzelm
parents:
48683
diff
changeset
|
362 |
|
61406 | 363 |
\<^medskip> |
61575 | 364 |
The subset of sessions to be managed is determined via individual \<open>SESSIONS\<close> |
365 |
given as command-line arguments, or session groups that are given via one or |
|
366 |
more options \<^verbatim>\<open>-g\<close>~\<open>NAME\<close>. Option \<^verbatim>\<open>-a\<close> selects all sessions. The build tool |
|
367 |
takes session dependencies into account: the set of selected sessions is |
|
368 |
completed by including all ancestors. |
|
48578 | 369 |
|
61406 | 370 |
\<^medskip> |
68734
c14a2cc9b5ef
isabelle build options -c -x -B refer to imports_graph;
wenzelm
parents:
68523
diff
changeset
|
371 |
One or more options \<^verbatim>\<open>-B\<close>~\<open>NAME\<close> specify base sessions to be included (all |
c14a2cc9b5ef
isabelle build options -c -x -B refer to imports_graph;
wenzelm
parents:
68523
diff
changeset
|
372 |
descendants wrt.\ the session parent or import graph). |
66737
2edc0c42c883
option -B for "isabelle build" and "isabelle imports";
wenzelm
parents:
66671
diff
changeset
|
373 |
|
2edc0c42c883
option -B for "isabelle build" and "isabelle imports";
wenzelm
parents:
66671
diff
changeset
|
374 |
\<^medskip> |
68734
c14a2cc9b5ef
isabelle build options -c -x -B refer to imports_graph;
wenzelm
parents:
68523
diff
changeset
|
375 |
One or more options \<^verbatim>\<open>-x\<close>~\<open>NAME\<close> specify sessions to be excluded (all |
c14a2cc9b5ef
isabelle build options -c -x -B refer to imports_graph;
wenzelm
parents:
68523
diff
changeset
|
376 |
descendants wrt.\ the session parent or import graph). Option \<^verbatim>\<open>-X\<close> is |
c14a2cc9b5ef
isabelle build options -c -x -B refer to imports_graph;
wenzelm
parents:
68523
diff
changeset
|
377 |
analogous to this, but excluded sessions are specified by session group |
c14a2cc9b5ef
isabelle build options -c -x -B refer to imports_graph;
wenzelm
parents:
68523
diff
changeset
|
378 |
membership. |
59892
2a616319c171
added isabelle build option -x, to exclude sessions;
wenzelm
parents:
59891
diff
changeset
|
379 |
|
61406 | 380 |
\<^medskip> |
61575 | 381 |
Option \<^verbatim>\<open>-R\<close> reverses the selection in the sense that it refers to its |
382 |
requirements: all ancestor sessions excluding the original selection. This |
|
383 |
allows to prepare the stage for some build process with different options, |
|
384 |
before running the main build itself (without option \<^verbatim>\<open>-R\<close>). |
|
49131 | 385 |
|
61406 | 386 |
\<^medskip> |
61575 | 387 |
Option \<^verbatim>\<open>-D\<close> is similar to \<^verbatim>\<open>-d\<close>, but selects all sessions that are defined |
388 |
in the given directories. |
|
48737
f3bbb9ca57d6
added build option -D: include session directory and select its sessions;
wenzelm
parents:
48693
diff
changeset
|
389 |
|
61406 | 390 |
\<^medskip> |
66745 | 391 |
Option \<^verbatim>\<open>-S\<close> indicates a ``soft build'': the selection is restricted to |
392 |
those sessions that have changed sources (according to actually imported |
|
393 |
theories). The status of heap images is ignored. |
|
394 |
||
395 |
\<^medskip> |
|
61406 | 396 |
The build process depends on additional options |
61575 | 397 |
(\secref{sec:system-options}) that are passed to the prover eventually. The |
398 |
settings variable @{setting_ref ISABELLE_BUILD_OPTIONS} allows to provide |
|
61602 | 399 |
additional defaults, e.g.\ \<^verbatim>\<open>ISABELLE_BUILD_OPTIONS="document=pdf threads=4"\<close>. |
400 |
Moreover, the environment of system build options may be augmented on the |
|
401 |
command line via \<^verbatim>\<open>-o\<close>~\<open>name\<close>\<^verbatim>\<open>=\<close>\<open>value\<close> or \<^verbatim>\<open>-o\<close>~\<open>name\<close>, which abbreviates |
|
402 |
\<^verbatim>\<open>-o\<close>~\<open>name\<close>\<^verbatim>\<open>=true\<close> for Boolean options. Multiple occurrences of \<^verbatim>\<open>-o\<close> on |
|
403 |
the command-line are applied in the given order. |
|
48578 | 404 |
|
61406 | 405 |
\<^medskip> |
72648 | 406 |
Option \<^verbatim>\<open>-P\<close> enables PDF/HTML presentation in the given directory, where |
407 |
``\<^verbatim>\<open>-P:\<close>'' refers to the default @{setting_ref ISABELLE_BROWSER_INFO} (or |
|
408 |
@{setting_ref ISABELLE_BROWSER_INFO_SYSTEM}). |
|
409 |
||
410 |
\<^medskip> |
|
61575 | 411 |
Option \<^verbatim>\<open>-b\<close> ensures that heap images are produced for all selected |
412 |
sessions. By default, images are only saved for inner nodes of the hierarchy |
|
413 |
of sessions, as required for other sessions to continue later on. |
|
48578 | 414 |
|
61406 | 415 |
\<^medskip> |
68734
c14a2cc9b5ef
isabelle build options -c -x -B refer to imports_graph;
wenzelm
parents:
68523
diff
changeset
|
416 |
Option \<^verbatim>\<open>-c\<close> cleans the selected sessions (all descendants wrt.\ the session |
c14a2cc9b5ef
isabelle build options -c -x -B refer to imports_graph;
wenzelm
parents:
68523
diff
changeset
|
417 |
parent or import graph) before performing the specified build operation. |
48595 | 418 |
|
61406 | 419 |
\<^medskip> |
69811
18f61ce86425
clarified 'export_files' in session ROOT: require explicit "isabelle build -e";
wenzelm
parents:
69755
diff
changeset
|
420 |
Option \<^verbatim>\<open>-e\<close> executes the \isakeyword{export_files} directives from the ROOT |
18f61ce86425
clarified 'export_files' in session ROOT: require explicit "isabelle build -e";
wenzelm
parents:
69755
diff
changeset
|
421 |
specification of all explicitly selected sessions: the status of the session |
18f61ce86425
clarified 'export_files' in session ROOT: require explicit "isabelle build -e";
wenzelm
parents:
69755
diff
changeset
|
422 |
build database needs to be OK, but the session could have been built |
18f61ce86425
clarified 'export_files' in session ROOT: require explicit "isabelle build -e";
wenzelm
parents:
69755
diff
changeset
|
423 |
earlier. Using \isakeyword{export_files}, a session may serve as abstract |
18f61ce86425
clarified 'export_files' in session ROOT: require explicit "isabelle build -e";
wenzelm
parents:
69755
diff
changeset
|
424 |
interface for add-on build artefacts, but these are only materialized on |
18f61ce86425
clarified 'export_files' in session ROOT: require explicit "isabelle build -e";
wenzelm
parents:
69755
diff
changeset
|
425 |
explicit request: without option \<^verbatim>\<open>-e\<close> there is no effect on the physical |
18f61ce86425
clarified 'export_files' in session ROOT: require explicit "isabelle build -e";
wenzelm
parents:
69755
diff
changeset
|
426 |
file-system yet. |
18f61ce86425
clarified 'export_files' in session ROOT: require explicit "isabelle build -e";
wenzelm
parents:
69755
diff
changeset
|
427 |
|
18f61ce86425
clarified 'export_files' in session ROOT: require explicit "isabelle build -e";
wenzelm
parents:
69755
diff
changeset
|
428 |
\<^medskip> |
66841 | 429 |
Option \<^verbatim>\<open>-f\<close> forces a fresh build of all selected sessions and their |
430 |
requirements. |
|
431 |
||
432 |
\<^medskip> |
|
61575 | 433 |
Option \<^verbatim>\<open>-n\<close> omits the actual build process after the preparatory stage |
434 |
(including optional cleanup). Note that the return code always indicates the |
|
435 |
status of the set of selected sessions. |
|
48595 | 436 |
|
61406 | 437 |
\<^medskip> |
61575 | 438 |
Option \<^verbatim>\<open>-j\<close> specifies the maximum number of parallel build jobs (prover |
439 |
processes). Each prover process is subject to a separate limit of parallel |
|
440 |
worker threads, cf.\ system option @{system_option_ref threads}. |
|
48578 | 441 |
|
61406 | 442 |
\<^medskip> |
64265 | 443 |
Option \<^verbatim>\<open>-N\<close> enables cyclic shuffling of NUMA CPU nodes. This may help |
444 |
performance tuning on Linux servers with separate CPU/memory modules. |
|
445 |
||
446 |
\<^medskip> |
|
61575 | 447 |
Option \<^verbatim>\<open>-v\<close> increases the general level of verbosity. Option \<^verbatim>\<open>-l\<close> lists |
448 |
the source files that contribute to a session. |
|
59891
9ce697050455
added isabelle build option -k, for fast off-line checking of theory sources;
wenzelm
parents:
59446
diff
changeset
|
449 |
|
61406 | 450 |
\<^medskip> |
61575 | 451 |
Option \<^verbatim>\<open>-k\<close> specifies a newly proposed keyword for outer syntax (multiple |
452 |
uses allowed). The theory sources are checked for conflicts wrt.\ this |
|
453 |
hypothetical change of syntax, e.g.\ to reveal occurrences of identifiers |
|
454 |
that need to be quoted. |
|
455 |
\<close> |
|
59891
9ce697050455
added isabelle build option -k, for fast off-line checking of theory sources;
wenzelm
parents:
59446
diff
changeset
|
456 |
|
48578 | 457 |
|
58618 | 458 |
subsubsection \<open>Examples\<close> |
48578 | 459 |
|
58618 | 460 |
text \<open> |
48578 | 461 |
Build a specific logic image: |
61407
7ba7b8103565
@{verbatim [display]} supersedes old alltt/ttbox;
wenzelm
parents:
61406
diff
changeset
|
462 |
@{verbatim [display] \<open>isabelle build -b HOLCF\<close>} |
48578 | 463 |
|
61406 | 464 |
\<^smallskip> |
465 |
Build the main group of logic images: |
|
61407
7ba7b8103565
@{verbatim [display]} supersedes old alltt/ttbox;
wenzelm
parents:
61406
diff
changeset
|
466 |
@{verbatim [display] \<open>isabelle build -b -g main\<close>} |
48578 | 467 |
|
61406 | 468 |
\<^smallskip> |
66748 | 469 |
Build all descendants (and requirements) of \<^verbatim>\<open>FOL\<close> and \<^verbatim>\<open>ZF\<close>: |
470 |
@{verbatim [display] \<open>isabelle build -B FOL -B ZF\<close>} |
|
471 |
||
472 |
\<^smallskip> |
|
473 |
Build all sessions where sources have changed (ignoring heaps): |
|
474 |
@{verbatim [display] \<open>isabelle build -a -S\<close>} |
|
475 |
||
476 |
\<^smallskip> |
|
61575 | 477 |
Provide a general overview of the status of all Isabelle sessions, without |
478 |
building anything: |
|
61407
7ba7b8103565
@{verbatim [display]} supersedes old alltt/ttbox;
wenzelm
parents:
61406
diff
changeset
|
479 |
@{verbatim [display] \<open>isabelle build -a -n -v\<close>} |
48578 | 480 |
|
61406 | 481 |
\<^smallskip> |
61575 | 482 |
Build all sessions with HTML browser info and PDF document preparation: |
61407
7ba7b8103565
@{verbatim [display]} supersedes old alltt/ttbox;
wenzelm
parents:
61406
diff
changeset
|
483 |
@{verbatim [display] \<open>isabelle build -a -o browser_info -o document=pdf\<close>} |
48578 | 484 |
|
61406 | 485 |
\<^smallskip> |
61575 | 486 |
Build all sessions with a maximum of 8 parallel prover processes and 4 |
487 |
worker threads each (on a machine with many cores): |
|
61407
7ba7b8103565
@{verbatim [display]} supersedes old alltt/ttbox;
wenzelm
parents:
61406
diff
changeset
|
488 |
@{verbatim [display] \<open>isabelle build -a -j8 -o threads=4\<close>} |
48595 | 489 |
|
61406 | 490 |
\<^smallskip> |
61575 | 491 |
Build some session images with cleanup of their descendants, while retaining |
492 |
their ancestry: |
|
72515
c7038c397ae3
moved most material from session HOL-Word to Word_Lib in the AFP
haftmann
parents:
71982
diff
changeset
|
493 |
@{verbatim [display] \<open>isabelle build -b -c HOL-Library HOL-Algebra\<close>} |
48595 | 494 |
|
61406 | 495 |
\<^smallskip> |
496 |
Clean all sessions without building anything: |
|
61407
7ba7b8103565
@{verbatim [display]} supersedes old alltt/ttbox;
wenzelm
parents:
61406
diff
changeset
|
497 |
@{verbatim [display] \<open>isabelle build -a -n -c\<close>} |
48737
f3bbb9ca57d6
added build option -D: include session directory and select its sessions;
wenzelm
parents:
48693
diff
changeset
|
498 |
|
61406 | 499 |
\<^smallskip> |
61575 | 500 |
Build all sessions from some other directory hierarchy, according to the |
501 |
settings variable \<^verbatim>\<open>AFP\<close> that happens to be defined inside the Isabelle |
|
502 |
environment: |
|
61407
7ba7b8103565
@{verbatim [display]} supersedes old alltt/ttbox;
wenzelm
parents:
61406
diff
changeset
|
503 |
@{verbatim [display] \<open>isabelle build -D '$AFP'\<close>} |
49131 | 504 |
|
61406 | 505 |
\<^smallskip> |
61575 | 506 |
Inform about the status of all sessions required for AFP, without building |
507 |
anything yet: |
|
61407
7ba7b8103565
@{verbatim [display]} supersedes old alltt/ttbox;
wenzelm
parents:
61406
diff
changeset
|
508 |
@{verbatim [display] \<open>isabelle build -D '$AFP' -R -v -n\<close>} |
58618 | 509 |
\<close> |
48578 | 510 |
|
66671 | 511 |
|
68152
619de043389f
guard result exports via export_pattern -- avoid bombing client via huge blobs;
wenzelm
parents:
68116
diff
changeset
|
512 |
section \<open>Retrieve theory exports \label{sec:tool-export}\<close> |
68116 | 513 |
|
514 |
text \<open> |
|
515 |
The @{tool_def "export"} tool retrieves theory exports from the session |
|
516 |
database. Its command-line usage is: @{verbatim [display] |
|
517 |
\<open>Usage: isabelle export [OPTIONS] SESSION |
|
518 |
||
519 |
Options are: |
|
68314
2acbf8129d8b
clarified option -O: avoid conflict with build/dump option -D;
wenzelm
parents:
68292
diff
changeset
|
520 |
-O DIR output directory for exported files (default: "export") |
68116 | 521 |
-d DIR include session directory |
522 |
-l list exports |
|
523 |
-n no build of session |
|
524 |
-o OPTION override Isabelle system OPTION (via NAME=VAL or NAME) |
|
69671 | 525 |
-p NUM prune path of exported files by NUM elements |
68514 | 526 |
-x PATTERN extract files matching pattern (e.g.\ "*:**" for all) |
68116 | 527 |
|
528 |
List or export theory exports for SESSION: named blobs produced by |
|
68290 | 529 |
isabelle build. Option -l or -x is required; option -x may be repeated. |
68116 | 530 |
|
531 |
The PATTERN language resembles glob patterns in the shell, with ? and * |
|
532 |
(both excluding ":" and "/"), ** (excluding ":"), and [abc] or [^abc], |
|
533 |
and variants {pattern1,pattern2,pattern3}.\<close>} |
|
534 |
||
535 |
\<^medskip> |
|
536 |
The specified session is updated via @{tool build} |
|
69854
cc0b3e177b49
system option "system_heaps" supersedes various command-line options for "system build mode";
wenzelm
parents:
69811
diff
changeset
|
537 |
(\secref{sec:tool-build}), with the same options \<^verbatim>\<open>-d\<close>, \<^verbatim>\<open>-o\<close>. The option |
cc0b3e177b49
system option "system_heaps" supersedes various command-line options for "system build mode";
wenzelm
parents:
69811
diff
changeset
|
538 |
\<^verbatim>\<open>-n\<close> suppresses the implicit build process: it means that a potentially |
cc0b3e177b49
system option "system_heaps" supersedes various command-line options for "system build mode";
wenzelm
parents:
69811
diff
changeset
|
539 |
outdated session database is used! |
68116 | 540 |
|
541 |
\<^medskip> |
|
542 |
Option \<^verbatim>\<open>-l\<close> lists all stored exports, with compound names |
|
543 |
\<open>theory\<close>\<^verbatim>\<open>:\<close>\<open>name\<close>. |
|
544 |
||
545 |
\<^medskip> |
|
546 |
Option \<^verbatim>\<open>-x\<close> extracts stored exports whose compound name matches the given |
|
547 |
pattern. Note that wild cards ``\<^verbatim>\<open>?\<close>'' and ``\<^verbatim>\<open>*\<close>'' do not match the |
|
548 |
separators ``\<^verbatim>\<open>:\<close>'' and ``\<^verbatim>\<open>/\<close>''; the wild card \<^verbatim>\<open>**\<close> matches over directory |
|
549 |
name hierarchies separated by ``\<^verbatim>\<open>/\<close>''. Thus the pattern ``\<^verbatim>\<open>*:**\<close>'' matches |
|
68290 | 550 |
\<^emph>\<open>all\<close> theory exports. Multiple options \<^verbatim>\<open>-x\<close> refer to the union of all |
551 |
specified patterns. |
|
68116 | 552 |
|
68314
2acbf8129d8b
clarified option -O: avoid conflict with build/dump option -D;
wenzelm
parents:
68292
diff
changeset
|
553 |
Option \<^verbatim>\<open>-O\<close> specifies an alternative output directory for option \<^verbatim>\<open>-x\<close>: the |
68116 | 554 |
default is \<^verbatim>\<open>export\<close> within the current directory. Each theory creates its |
555 |
own sub-directory hierarchy, using the session-qualified theory name. |
|
69671 | 556 |
|
557 |
Option \<^verbatim>\<open>-p\<close> specifies the number of elements that should be pruned from |
|
558 |
each name: it allows to reduce the resulting directory hierarchy at the |
|
559 |
danger of overwriting files due to loss of uniqueness. |
|
68116 | 560 |
\<close> |
561 |
||
68348 | 562 |
|
563 |
section \<open>Dump PIDE session database \label{sec:tool-dump}\<close> |
|
564 |
||
565 |
text \<open> |
|
566 |
The @{tool_def "dump"} tool dumps information from the cumulative PIDE |
|
567 |
session database (which is processed on the spot). Its command-line usage |
|
568 |
is: @{verbatim [display] |
|
569 |
\<open>Usage: isabelle dump [OPTIONS] [SESSIONS ...] |
|
570 |
||
571 |
Options are: |
|
572 |
-A NAMES dump named aspects (default: ...) |
|
573 |
-B NAME include session NAME and all descendants |
|
574 |
-D DIR include session directory and select its sessions |
|
575 |
-O DIR output directory for dumped files (default: "dump") |
|
71807 | 576 |
-R refer to requirements of selected sessions |
68348 | 577 |
-X NAME exclude sessions from group NAME and all descendants |
578 |
-a select all sessions |
|
70862 | 579 |
-b NAME base logic image (default "Pure") |
68348 | 580 |
-d DIR include session directory |
581 |
-g NAME select session group NAME |
|
582 |
-o OPTION override Isabelle system OPTION (via NAME=VAL or NAME) |
|
583 |
-v verbose |
|
584 |
-x NAME exclude session NAME and all descendants |
|
585 |
||
586 |
Dump cumulative PIDE session database, with the following aspects: |
|
587 |
...\<close>} |
|
588 |
||
589 |
\<^medskip> Options \<^verbatim>\<open>-B\<close>, \<^verbatim>\<open>-D\<close>, \<^verbatim>\<open>-R\<close>, \<^verbatim>\<open>-X\<close>, \<^verbatim>\<open>-a\<close>, \<^verbatim>\<open>-d\<close>, \<^verbatim>\<open>-g\<close>, \<^verbatim>\<open>-x\<close> and the |
|
590 |
remaining command-line arguments specify sessions as in @{tool build} |
|
591 |
(\secref{sec:tool-build}): the cumulative PIDE database of all their loaded |
|
592 |
theories is dumped to the output directory of option \<^verbatim>\<open>-O\<close> (default: \<^verbatim>\<open>dump\<close> |
|
593 |
in the current directory). |
|
594 |
||
70859
6e6254bbce1f
split into standard partitions, for improved scalability;
wenzelm
parents:
70858
diff
changeset
|
595 |
\<^medskip> Option \<^verbatim>\<open>-b\<close> specifies an optional base logic image, for improved |
70862 | 596 |
scalability of the PIDE session. Its theories are only processed if it is |
597 |
included in the overall session selection. |
|
70859
6e6254bbce1f
split into standard partitions, for improved scalability;
wenzelm
parents:
70858
diff
changeset
|
598 |
|
68348 | 599 |
\<^medskip> Option \<^verbatim>\<open>-o\<close> overrides Isabelle system options as for @{tool build} |
600 |
(\secref{sec:tool-build}). |
|
601 |
||
602 |
\<^medskip> Option \<^verbatim>\<open>-v\<close> increases the general level of verbosity. |
|
603 |
||
604 |
\<^medskip> Option \<^verbatim>\<open>-A\<close> specifies named aspects of the dump, as a comma-separated |
|
605 |
list. The default is to dump all known aspects, as given in the command-line |
|
71893 | 606 |
usage of the tool. The underlying Isabelle/Scala operation |
607 |
\<^scala_method>\<open>isabelle.Dump.dump\<close> takes aspects as user-defined |
|
608 |
operations on the final PIDE state and document version. This allows to |
|
609 |
imitate Prover IDE rendering under program control. |
|
68348 | 610 |
\<close> |
611 |
||
612 |
||
613 |
subsubsection \<open>Examples\<close> |
|
614 |
||
615 |
text \<open> |
|
616 |
Dump all Isabelle/ZF sessions (which are rather small): |
|
617 |
@{verbatim [display] \<open>isabelle dump -v -B ZF\<close>} |
|
618 |
||
619 |
\<^smallskip> |
|
70862 | 620 |
Dump the quite substantial \<^verbatim>\<open>HOL-Analysis\<close> session, with full bootstrap |
621 |
from Isabelle/Pure: |
|
622 |
@{verbatim [display] \<open>isabelle dump -v HOL-Analysis\<close>} |
|
68348 | 623 |
|
624 |
\<^smallskip> |
|
70862 | 625 |
Dump all sessions connected to HOL-Analysis, using main Isabelle/HOL as |
626 |
basis: |
|
627 |
@{verbatim [display] \<open>isabelle dump -v -b HOL -B HOL-Analysis\<close>} |
|
68348 | 628 |
|
629 |
This results in uniform PIDE markup for everything, except for the |
|
630 |
Isabelle/Pure bootstrap process itself. Producing that on the spot requires |
|
631 |
several GB of heap space, both for the Isabelle/Scala and Isabelle/ML |
|
632 |
process (in 64bit mode). Here are some relevant settings (\secref{sec:boot}) |
|
633 |
for such ambitious applications: |
|
634 |
@{verbatim [display] |
|
635 |
\<open>ISABELLE_TOOL_JAVA_OPTIONS="-Xms4g -Xmx32g -Xss16m" |
|
636 |
ML_OPTIONS="--minheap 4G --maxheap 32G" |
|
637 |
\<close>} |
|
69599 | 638 |
\<close> |
68348 | 639 |
|
69599 | 640 |
|
641 |
section \<open>Update theory sources based on PIDE markup \label{sec:tool-update}\<close> |
|
642 |
||
643 |
text \<open> |
|
644 |
The @{tool_def "update"} tool updates theory sources based on markup that is |
|
645 |
produced from a running PIDE session (similar to @{tool dump} |
|
646 |
\secref{sec:tool-dump}). Its command-line usage is: @{verbatim [display] |
|
647 |
\<open>Usage: isabelle update [OPTIONS] [SESSIONS ...] |
|
648 |
||
649 |
Options are: |
|
650 |
-B NAME include session NAME and all descendants |
|
651 |
-D DIR include session directory and select its sessions |
|
71807 | 652 |
-R refer to requirements of selected sessions |
69599 | 653 |
-X NAME exclude sessions from group NAME and all descendants |
654 |
-a select all sessions |
|
70863
d1299774543d
clarified "isabelle update" options -- more like "isabelle dump";
wenzelm
parents:
70862
diff
changeset
|
655 |
-b NAME base logic image (default "Pure") |
69599 | 656 |
-d DIR include session directory |
657 |
-g NAME select session group NAME |
|
658 |
-o OPTION override Isabelle system OPTION (via NAME=VAL or NAME) |
|
659 |
-u OPT overide update option: shortcut for "-o update_OPT" |
|
660 |
-v verbose |
|
661 |
-x NAME exclude session NAME and all descendants |
|
662 |
||
663 |
Update theory sources based on PIDE markup.\<close>} |
|
664 |
||
665 |
\<^medskip> Options \<^verbatim>\<open>-B\<close>, \<^verbatim>\<open>-D\<close>, \<^verbatim>\<open>-R\<close>, \<^verbatim>\<open>-X\<close>, \<^verbatim>\<open>-a\<close>, \<^verbatim>\<open>-d\<close>, \<^verbatim>\<open>-g\<close>, \<^verbatim>\<open>-x\<close> and the |
|
666 |
remaining command-line arguments specify sessions as in @{tool build} |
|
667 |
(\secref{sec:tool-build}) or @{tool dump} (\secref{sec:tool-dump}). |
|
668 |
||
70863
d1299774543d
clarified "isabelle update" options -- more like "isabelle dump";
wenzelm
parents:
70862
diff
changeset
|
669 |
\<^medskip> Option \<^verbatim>\<open>-b\<close> specifies an optional base logic image, for improved |
d1299774543d
clarified "isabelle update" options -- more like "isabelle dump";
wenzelm
parents:
70862
diff
changeset
|
670 |
scalability of the PIDE session. Its theories are only processed if it is |
d1299774543d
clarified "isabelle update" options -- more like "isabelle dump";
wenzelm
parents:
70862
diff
changeset
|
671 |
included in the overall session selection. |
69599 | 672 |
|
673 |
\<^medskip> Option \<^verbatim>\<open>-v\<close> increases the general level of verbosity. |
|
674 |
||
675 |
\<^medskip> Option \<^verbatim>\<open>-o\<close> overrides Isabelle system options as for @{tool build} |
|
676 |
(\secref{sec:tool-build}). Option \<^verbatim>\<open>-u\<close> refers to specific \<^verbatim>\<open>update\<close> |
|
677 |
options, by relying on naming convention: ``\<^verbatim>\<open>-u\<close>~\<open>OPT\<close>'' is a shortcut for |
|
678 |
``\<^verbatim>\<open>-o\<close>~\<^verbatim>\<open>update_\<close>\<open>OPT\<close>''. |
|
679 |
||
680 |
\<^medskip> The following update options are supported: |
|
681 |
||
682 |
\<^item> @{system_option update_inner_syntax_cartouches} to update inner syntax |
|
683 |
(types, terms, etc.)~to use cartouches, instead of double-quoted strings |
|
684 |
or atomic identifiers. For example, ``\<^theory_text>\<open>lemma \<doublequote>x = |
|
69610 | 685 |
x\<doublequote>\<close>'' is replaced by ``\<^theory_text>\<open>lemma \<open>x = x\<close>\<close>'', and ``\<^theory_text>\<open>assume |
686 |
A\<close>'' is replaced by ``\<^theory_text>\<open>assume \<open>A\<close>\<close>''. |
|
69599 | 687 |
|
688 |
\<^item> @{system_option update_mixfix_cartouches} to update mixfix templates to |
|
689 |
use cartouches instead of double-quoted strings. For example, ``\<^theory_text>\<open>(infixl |
|
690 |
\<doublequote>+\<doublequote> 65)\<close>'' is replaced by ``\<^theory_text>\<open>(infixl \<open>+\<close> |
|
691 |
65)\<close>''. |
|
692 |
||
693 |
\<^item> @{system_option update_control_cartouches} to update antiquotations to |
|
694 |
use the compact form with control symbol and cartouche argument. For |
|
695 |
example, ``\<open>@{term \<doublequote>x + y\<doublequote>}\<close>'' is replaced by |
|
696 |
``\<open>\<^term>\<open>x + y\<close>\<close>'' (the control symbol is literally \<^verbatim>\<open>\<^term>\<close>.) |
|
697 |
||
69603 | 698 |
\<^item> @{system_option update_path_cartouches} to update file-system paths to |
699 |
use cartouches: this depends on language markup provided by semantic |
|
700 |
processing of parsed input. |
|
701 |
||
69599 | 702 |
It is also possible to produce custom updates in Isabelle/ML, by reporting |
703 |
\<^ML>\<open>Markup.update\<close> with the precise source position and a replacement |
|
704 |
text. This operation should be made conditional on specific system options, |
|
705 |
similar to the ones above. Searching the above option names in ML sources of |
|
706 |
\<^dir>\<open>$ISABELLE_HOME/src/Pure\<close> provides some examples. |
|
707 |
||
69602 | 708 |
Updates can be in conflict by producing nested or overlapping edits: this |
709 |
may require to run @{tool update} multiple times. |
|
69599 | 710 |
\<close> |
711 |
||
712 |
||
713 |
subsubsection \<open>Examples\<close> |
|
714 |
||
715 |
text \<open> |
|
716 |
Update some cartouche notation in all theory sources required for session |
|
70863
d1299774543d
clarified "isabelle update" options -- more like "isabelle dump";
wenzelm
parents:
70862
diff
changeset
|
717 |
\<^verbatim>\<open>HOL-Analysis\<close> (and ancestors): |
69599 | 718 |
|
70863
d1299774543d
clarified "isabelle update" options -- more like "isabelle dump";
wenzelm
parents:
70862
diff
changeset
|
719 |
@{verbatim [display] \<open>isabelle update -u mixfix_cartouches HOL-Analysis\<close>} |
69599 | 720 |
|
721 |
\<^smallskip> Update the same for all application sessions based on \<^verbatim>\<open>HOL-Analysis\<close> --- |
|
70863
d1299774543d
clarified "isabelle update" options -- more like "isabelle dump";
wenzelm
parents:
70862
diff
changeset
|
722 |
using its image is taken starting point (for reduced resource requirements): |
69599 | 723 |
|
70863
d1299774543d
clarified "isabelle update" options -- more like "isabelle dump";
wenzelm
parents:
70862
diff
changeset
|
724 |
@{verbatim [display] \<open>isabelle update -u mixfix_cartouches -b HOL-Analysis -B HOL-Analysis\<close>} |
69599 | 725 |
|
726 |
\<^smallskip> Update sessions that build on \<^verbatim>\<open>HOL-Proofs\<close>, which need to be run |
|
727 |
separately with special options as follows: |
|
728 |
||
729 |
@{verbatim [display] \<open>isabelle update -u mixfix_cartouches -l HOL-Proofs -B HOL-Proofs |
|
69601 | 730 |
-o record_proofs=2\<close>} |
69599 | 731 |
|
732 |
\<^smallskip> See also the end of \secref{sec:tool-dump} for hints on increasing |
|
733 |
Isabelle/ML heap sizes for very big PIDE processes that include many |
|
734 |
sessions, notably from the Archive of Formal Proofs. |
|
68348 | 735 |
\<close> |
736 |
||
71808 | 737 |
|
738 |
section \<open>Explore sessions structure\<close> |
|
739 |
||
740 |
text \<open> |
|
741 |
The @{tool_def "sessions"} tool explores the sessions structure. Its |
|
742 |
command-line usage is: |
|
743 |
@{verbatim [display] |
|
744 |
\<open>Usage: isabelle sessions [OPTIONS] [SESSIONS ...] |
|
745 |
||
746 |
Options are: |
|
747 |
-B NAME include session NAME and all descendants |
|
748 |
-D DIR include session directory and select its sessions |
|
749 |
-R refer to requirements of selected sessions |
|
750 |
-X NAME exclude sessions from group NAME and all descendants |
|
751 |
-a select all sessions |
|
752 |
-d DIR include session directory |
|
753 |
-g NAME select session group NAME |
|
754 |
-x NAME exclude session NAME and all descendants |
|
755 |
||
756 |
Explore the structure of Isabelle sessions and print result names in |
|
757 |
topological order (on stdout).\<close>} |
|
758 |
||
759 |
Arguments and options for session selection resemble @{tool build} |
|
760 |
(\secref{sec:tool-build}). |
|
761 |
\<close> |
|
762 |
||
763 |
||
764 |
subsubsection \<open>Examples\<close> |
|
765 |
||
766 |
text \<open> |
|
767 |
All sessions of the Isabelle distribution: |
|
768 |
@{verbatim [display] \<open>isabelle sessions -a\<close>} |
|
769 |
||
770 |
\<^medskip> |
|
771 |
Sessions that are based on \<^verbatim>\<open>ZF\<close> (and required by it): |
|
772 |
@{verbatim [display] \<open>isabelle sessions -B ZF\<close>} |
|
773 |
||
774 |
\<^medskip> |
|
775 |
All sessions of Isabelle/AFP (based in directory \<^path>\<open>AFP\<close>): |
|
776 |
@{verbatim [display] \<open>isabelle sessions -D AFP/thys\<close>} |
|
777 |
||
778 |
\<^medskip> |
|
779 |
Sessions required by Isabelle/AFP (based in directory \<^path>\<open>AFP\<close>): |
|
780 |
@{verbatim [display] \<open>isabelle sessions -R -D AFP/thys\<close>} |
|
781 |
\<close> |
|
782 |
||
48578 | 783 |
end |