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