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