src/Doc/System/Presentation.thy
author wenzelm
Sun, 02 Feb 2025 16:04:09 +0100
changeset 82051 1be62b17bed9
parent 82033 17436dc0d3d4
child 82225 d3b401fe8188
permissions -rw-r--r--
tuned documentation;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
61656
cfabbc083977 more uniform jEdit properties;
wenzelm
parents: 61575
diff changeset
     1
(*:maxLineLen=78:*)
61575
f18f6e51e901 tuned whitespace;
wenzelm
parents: 61504
diff changeset
     2
28221
ca9fdab0f971 converted present.tex;
wenzelm
parents:
diff changeset
     3
theory Presentation
43564
9864182c6bad document antiquotations are managed as theory data, with proper name space and entity markup;
wenzelm
parents: 42009
diff changeset
     4
imports Base
28221
ca9fdab0f971 converted present.tex;
wenzelm
parents:
diff changeset
     5
begin
ca9fdab0f971 converted present.tex;
wenzelm
parents:
diff changeset
     6
58618
782f0b662cae more cartouches;
wenzelm
parents: 58553
diff changeset
     7
chapter \<open>Presenting theories \label{ch:present}\<close>
28221
ca9fdab0f971 converted present.tex;
wenzelm
parents:
diff changeset
     8
61575
f18f6e51e901 tuned whitespace;
wenzelm
parents: 61504
diff changeset
     9
text \<open>
f18f6e51e901 tuned whitespace;
wenzelm
parents: 61504
diff changeset
    10
  Isabelle provides several ways to present the outcome of formal
f18f6e51e901 tuned whitespace;
wenzelm
parents: 61504
diff changeset
    11
  developments, including WWW-based browsable libraries or actual printable
f18f6e51e901 tuned whitespace;
wenzelm
parents: 61504
diff changeset
    12
  documents. Presentation is centered around the concept of \<^emph>\<open>sessions\<close>
f18f6e51e901 tuned whitespace;
wenzelm
parents: 61504
diff changeset
    13
  (\chref{ch:session}). The global session structure is that of a tree, with
f18f6e51e901 tuned whitespace;
wenzelm
parents: 61504
diff changeset
    14
  Isabelle Pure at its root, further object-logics derived (e.g.\ HOLCF from
f18f6e51e901 tuned whitespace;
wenzelm
parents: 61504
diff changeset
    15
  HOL, and HOL from Pure), and application sessions further on in the
f18f6e51e901 tuned whitespace;
wenzelm
parents: 61504
diff changeset
    16
  hierarchy.
28221
ca9fdab0f971 converted present.tex;
wenzelm
parents:
diff changeset
    17
72574
d892f6d66402 build documents in Isabelle/Scala, based on generated tex files as session exports;
wenzelm
parents: 72309
diff changeset
    18
  The command-line tools @{tool_ref mkroot} and @{tool_ref build} provide the
d892f6d66402 build documents in Isabelle/Scala, based on generated tex files as session exports;
wenzelm
parents: 72309
diff changeset
    19
  primary means for managing Isabelle sessions, including options for
d892f6d66402 build documents in Isabelle/Scala, based on generated tex files as session exports;
wenzelm
parents: 72309
diff changeset
    20
  presentation: ``\<^verbatim>\<open>document=pdf\<close>'' generates PDF output from the theory
d892f6d66402 build documents in Isabelle/Scala, based on generated tex files as session exports;
wenzelm
parents: 72309
diff changeset
    21
  session, and ``\<^verbatim>\<open>document_output=dir\<close>'' emits a copy of the document sources
d892f6d66402 build documents in Isabelle/Scala, based on generated tex files as session exports;
wenzelm
parents: 72309
diff changeset
    22
  with the PDF into the given directory (relative to the session directory).
28221
ca9fdab0f971 converted present.tex;
wenzelm
parents:
diff changeset
    23
72574
d892f6d66402 build documents in Isabelle/Scala, based on generated tex files as session exports;
wenzelm
parents: 72309
diff changeset
    24
  Alternatively, @{tool_ref document} may be used to turn the generated
77554
4465d9dff448 clarified terminology of "session build database", while "build database" is the one underlying Build_Process;
wenzelm
parents: 76556
diff changeset
    25
  {\LaTeX} sources of a session (exports from its session build database) into PDF.
58618
782f0b662cae more cartouches;
wenzelm
parents: 58553
diff changeset
    26
\<close>
28221
ca9fdab0f971 converted present.tex;
wenzelm
parents:
diff changeset
    27
ca9fdab0f971 converted present.tex;
wenzelm
parents:
diff changeset
    28
62013
92a2372a226b discontinued documentation of old browser;
wenzelm
parents: 61656
diff changeset
    29
section \<open>Generating HTML browser information \label{sec:info}\<close>
28221
ca9fdab0f971 converted present.tex;
wenzelm
parents:
diff changeset
    30
58618
782f0b662cae more cartouches;
wenzelm
parents: 58553
diff changeset
    31
text \<open>
61575
f18f6e51e901 tuned whitespace;
wenzelm
parents: 61504
diff changeset
    32
  As a side-effect of building sessions, Isabelle is able to generate theory
f18f6e51e901 tuned whitespace;
wenzelm
parents: 61504
diff changeset
    33
  browsing information, including HTML documents that show the theory sources
f18f6e51e901 tuned whitespace;
wenzelm
parents: 61504
diff changeset
    34
  and the relationship with its ancestors and descendants. Besides the HTML
f18f6e51e901 tuned whitespace;
wenzelm
parents: 61504
diff changeset
    35
  file that is generated for every theory, Isabelle stores links to all
f18f6e51e901 tuned whitespace;
wenzelm
parents: 61504
diff changeset
    36
  theories of a session in an index file. As a second hierarchy, groups of
f18f6e51e901 tuned whitespace;
wenzelm
parents: 61504
diff changeset
    37
  sessions are organized as \<^emph>\<open>chapters\<close>, with a separate index. Note that the
f18f6e51e901 tuned whitespace;
wenzelm
parents: 61504
diff changeset
    38
  implicit tree structure of the session build hierarchy is \<^emph>\<open>not\<close> relevant
51417
d266f9329368 sessions may be organized via 'chapter' in ROOT;
wenzelm
parents: 51054
diff changeset
    39
  for the presentation.
28221
ca9fdab0f971 converted present.tex;
wenzelm
parents:
diff changeset
    40
61406
eb2463fc4d7b more symbols;
wenzelm
parents: 58618
diff changeset
    41
  \<^medskip>
62013
92a2372a226b discontinued documentation of old browser;
wenzelm
parents: 61656
diff changeset
    42
  To generate theory browsing information for an existing session, just invoke
92a2372a226b discontinued documentation of old browser;
wenzelm
parents: 61656
diff changeset
    43
  @{tool build} with suitable options:
61407
7ba7b8103565 @{verbatim [display]} supersedes old alltt/ttbox;
wenzelm
parents: 61406
diff changeset
    44
  @{verbatim [display] \<open>isabelle build -o browser_info -v -c FOL\<close>}
28221
ca9fdab0f971 converted present.tex;
wenzelm
parents:
diff changeset
    45
75161
95612f330c93 misc tuning based on comments by Heiko Eißfeldt;
wenzelm
parents: 74873
diff changeset
    46
  The presentation output will appear in a sub-directory
95612f330c93 misc tuning based on comments by Heiko Eißfeldt;
wenzelm
parents: 74873
diff changeset
    47
  \<^path>\<open>$ISABELLE_BROWSER_INFO\<close>, according to the chapter and session name.
28221
ca9fdab0f971 converted present.tex;
wenzelm
parents:
diff changeset
    48
67219
81e9804b2014 added document antiquotation @{session name};
wenzelm
parents: 67185
diff changeset
    49
  Many Isabelle sessions (such as \<^session>\<open>HOL-Library\<close> in
73826
72900f34dbb3 allow system option short form NAME for NAME=true for type string, not just bool;
wenzelm
parents: 73741
diff changeset
    50
  \<^dir>\<open>~~/src/HOL/Library\<close>) also provide theory documents in PDF. These are
67219
81e9804b2014 added document antiquotation @{session name};
wenzelm
parents: 67185
diff changeset
    51
  prepared automatically as well if enabled like this:
73826
72900f34dbb3 allow system option short form NAME for NAME=true for type string, not just bool;
wenzelm
parents: 73741
diff changeset
    52
  @{verbatim [display] \<open>isabelle build -o browser_info -o document -v -c HOL-Library\<close>}
48814
d488a5f25bf6 some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents: 48722
diff changeset
    53
61575
f18f6e51e901 tuned whitespace;
wenzelm
parents: 61504
diff changeset
    54
  Enabling both browser info and document preparation simultaneously causes an
f18f6e51e901 tuned whitespace;
wenzelm
parents: 61504
diff changeset
    55
  appropriate ``document'' link to be included in the HTML index. Documents
f18f6e51e901 tuned whitespace;
wenzelm
parents: 61504
diff changeset
    56
  may be generated independently of browser information as well, see
f18f6e51e901 tuned whitespace;
wenzelm
parents: 61504
diff changeset
    57
  \secref{sec:tool-document} for further details.
28221
ca9fdab0f971 converted present.tex;
wenzelm
parents:
diff changeset
    58
61406
eb2463fc4d7b more symbols;
wenzelm
parents: 58618
diff changeset
    59
  \<^bigskip>
75161
95612f330c93 misc tuning based on comments by Heiko Eißfeldt;
wenzelm
parents: 74873
diff changeset
    60
  The theory browsing information is stored in the directory determined by the
95612f330c93 misc tuning based on comments by Heiko Eißfeldt;
wenzelm
parents: 74873
diff changeset
    61
  @{setting_ref ISABELLE_BROWSER_INFO} setting, with sub-directory structure
95612f330c93 misc tuning based on comments by Heiko Eißfeldt;
wenzelm
parents: 74873
diff changeset
    62
  according to the chapter and session name. In order to present Isabelle
95612f330c93 misc tuning based on comments by Heiko Eißfeldt;
wenzelm
parents: 74873
diff changeset
    63
  applications on the web, the corresponding subdirectory from @{setting
95612f330c93 misc tuning based on comments by Heiko Eißfeldt;
wenzelm
parents: 74873
diff changeset
    64
  ISABELLE_BROWSER_INFO} can be put on a WWW server.
61575
f18f6e51e901 tuned whitespace;
wenzelm
parents: 61504
diff changeset
    65
\<close>
28221
ca9fdab0f971 converted present.tex;
wenzelm
parents:
diff changeset
    66
61406
eb2463fc4d7b more symbols;
wenzelm
parents: 58618
diff changeset
    67
76556
c7f3e94fce7b tuned messages and options;
wenzelm
parents: 75700
diff changeset
    68
section \<open>Creating session root directories \label{sec:tool-mkroot}\<close>
28221
ca9fdab0f971 converted present.tex;
wenzelm
parents:
diff changeset
    69
61575
f18f6e51e901 tuned whitespace;
wenzelm
parents: 61504
diff changeset
    70
text \<open>
f18f6e51e901 tuned whitespace;
wenzelm
parents: 61504
diff changeset
    71
  The @{tool_def mkroot} tool configures a given directory as session root,
f18f6e51e901 tuned whitespace;
wenzelm
parents: 61504
diff changeset
    72
  with some \<^verbatim>\<open>ROOT\<close> file and optional document source directory. Its usage is:
61407
7ba7b8103565 @{verbatim [display]} supersedes old alltt/ttbox;
wenzelm
parents: 61406
diff changeset
    73
  @{verbatim [display]
67043
848672fcaee5 more options for "isabelle mkroot";
wenzelm
parents: 67042
diff changeset
    74
\<open>Usage: isabelle mkroot [OPTIONS] [DIRECTORY]
28221
ca9fdab0f971 converted present.tex;
wenzelm
parents:
diff changeset
    75
ca9fdab0f971 converted present.tex;
wenzelm
parents:
diff changeset
    76
  Options are:
67043
848672fcaee5 more options for "isabelle mkroot";
wenzelm
parents: 67042
diff changeset
    77
    -A LATEX     provide author in LaTeX notation (default: user name)
67069
f11486d31586 init Mercurial repository for the generated session files;
wenzelm
parents: 67043
diff changeset
    78
    -I           init Mercurial repository and add generated files
67043
848672fcaee5 more options for "isabelle mkroot";
wenzelm
parents: 67042
diff changeset
    79
    -T LATEX     provide title in LaTeX notation (default: session name)
848672fcaee5 more options for "isabelle mkroot";
wenzelm
parents: 67042
diff changeset
    80
    -n NAME      alternative session name (default: directory base name)
76556
c7f3e94fce7b tuned messages and options;
wenzelm
parents: 75700
diff changeset
    81
    -q           quiet mode: less verbosity
28221
ca9fdab0f971 converted present.tex;
wenzelm
parents:
diff changeset
    82
76556
c7f3e94fce7b tuned messages and options;
wenzelm
parents: 75700
diff changeset
    83
  Create session root directory (default: current directory).
67043
848672fcaee5 more options for "isabelle mkroot";
wenzelm
parents: 67042
diff changeset
    84
\<close>}
28221
ca9fdab0f971 converted present.tex;
wenzelm
parents:
diff changeset
    85
61575
f18f6e51e901 tuned whitespace;
wenzelm
parents: 61504
diff changeset
    86
  The results are placed in the given directory \<open>dir\<close>, which refers to the
f18f6e51e901 tuned whitespace;
wenzelm
parents: 61504
diff changeset
    87
  current directory by default. The @{tool mkroot} tool is conservative in the
f18f6e51e901 tuned whitespace;
wenzelm
parents: 61504
diff changeset
    88
  sense that it does not overwrite existing files or directories. Earlier
f18f6e51e901 tuned whitespace;
wenzelm
parents: 61504
diff changeset
    89
  attempts to generate a session root need to be deleted manually.
28221
ca9fdab0f971 converted present.tex;
wenzelm
parents:
diff changeset
    90
67042
677cab7c2b85 adapted to changed ROOT syntax (see 13857f49d215);
wenzelm
parents: 63680
diff changeset
    91
  The generated session template will be accompanied by a formal document,
67043
848672fcaee5 more options for "isabelle mkroot";
wenzelm
parents: 67042
diff changeset
    92
  with \<open>DIRECTORY\<close>\<^verbatim>\<open>/document/root.tex\<close> as its {\LaTeX} entry point (see also
67042
677cab7c2b85 adapted to changed ROOT syntax (see 13857f49d215);
wenzelm
parents: 63680
diff changeset
    93
  \chref{ch:present}).
28221
ca9fdab0f971 converted present.tex;
wenzelm
parents:
diff changeset
    94
67043
848672fcaee5 more options for "isabelle mkroot";
wenzelm
parents: 67042
diff changeset
    95
  Options \<^verbatim>\<open>-T\<close> and \<^verbatim>\<open>-A\<close> specify the document title and author explicitly,
848672fcaee5 more options for "isabelle mkroot";
wenzelm
parents: 67042
diff changeset
    96
  using {\LaTeX} source notation.
848672fcaee5 more options for "isabelle mkroot";
wenzelm
parents: 67042
diff changeset
    97
67069
f11486d31586 init Mercurial repository for the generated session files;
wenzelm
parents: 67043
diff changeset
    98
  Option \<^verbatim>\<open>-I\<close> initializes a Mercurial repository in the target directory, and
f11486d31586 init Mercurial repository for the generated session files;
wenzelm
parents: 67043
diff changeset
    99
  adds all generated files (without commit).
f11486d31586 init Mercurial repository for the generated session files;
wenzelm
parents: 67043
diff changeset
   100
67043
848672fcaee5 more options for "isabelle mkroot";
wenzelm
parents: 67042
diff changeset
   101
  Option \<^verbatim>\<open>-n\<close> specifies an alternative session name; otherwise the base name
848672fcaee5 more options for "isabelle mkroot";
wenzelm
parents: 67042
diff changeset
   102
  of the given directory is used.
28221
ca9fdab0f971 converted present.tex;
wenzelm
parents:
diff changeset
   103
76556
c7f3e94fce7b tuned messages and options;
wenzelm
parents: 75700
diff changeset
   104
  Option \<^verbatim>\<open>-q\<close> reduces verbosity.
c7f3e94fce7b tuned messages and options;
wenzelm
parents: 75700
diff changeset
   105
61406
eb2463fc4d7b more symbols;
wenzelm
parents: 58618
diff changeset
   106
  \<^medskip>
61575
f18f6e51e901 tuned whitespace;
wenzelm
parents: 61504
diff changeset
   107
  The implicit Isabelle settings variable @{setting ISABELLE_LOGIC} specifies
67043
848672fcaee5 more options for "isabelle mkroot";
wenzelm
parents: 67042
diff changeset
   108
  the parent session.
61503
28e788ca2c5d more control symbols;
wenzelm
parents: 61493
diff changeset
   109
\<close>
28221
ca9fdab0f971 converted present.tex;
wenzelm
parents:
diff changeset
   110
ca9fdab0f971 converted present.tex;
wenzelm
parents:
diff changeset
   111
58618
782f0b662cae more cartouches;
wenzelm
parents: 58553
diff changeset
   112
subsubsection \<open>Examples\<close>
28221
ca9fdab0f971 converted present.tex;
wenzelm
parents:
diff changeset
   113
61575
f18f6e51e901 tuned whitespace;
wenzelm
parents: 61504
diff changeset
   114
text \<open>
67042
677cab7c2b85 adapted to changed ROOT syntax (see 13857f49d215);
wenzelm
parents: 63680
diff changeset
   115
  Produce session \<^verbatim>\<open>Test\<close> within a separate directory of the same name:
76556
c7f3e94fce7b tuned messages and options;
wenzelm
parents: 75700
diff changeset
   116
  @{verbatim [display] \<open>isabelle mkroot -q Test && isabelle build -D Test\<close>}
28221
ca9fdab0f971 converted present.tex;
wenzelm
parents:
diff changeset
   117
61406
eb2463fc4d7b more symbols;
wenzelm
parents: 58618
diff changeset
   118
  \<^medskip>
61575
f18f6e51e901 tuned whitespace;
wenzelm
parents: 61504
diff changeset
   119
  Upgrade the current directory into a session ROOT with document preparation,
f18f6e51e901 tuned whitespace;
wenzelm
parents: 61504
diff changeset
   120
  and build it:
76556
c7f3e94fce7b tuned messages and options;
wenzelm
parents: 75700
diff changeset
   121
  @{verbatim [display] \<open>isabelle mkroot -q && isabelle build -D .\<close>}
58618
782f0b662cae more cartouches;
wenzelm
parents: 58553
diff changeset
   122
\<close>
28221
ca9fdab0f971 converted present.tex;
wenzelm
parents:
diff changeset
   123
ca9fdab0f971 converted present.tex;
wenzelm
parents:
diff changeset
   124
61407
7ba7b8103565 @{verbatim [display]} supersedes old alltt/ttbox;
wenzelm
parents: 61406
diff changeset
   125
section \<open>Preparing Isabelle session documents \label{sec:tool-document}\<close>
28221
ca9fdab0f971 converted present.tex;
wenzelm
parents:
diff changeset
   126
61575
f18f6e51e901 tuned whitespace;
wenzelm
parents: 61504
diff changeset
   127
text \<open>
72574
d892f6d66402 build documents in Isabelle/Scala, based on generated tex files as session exports;
wenzelm
parents: 72309
diff changeset
   128
  The @{tool_def document} tool prepares logic session documents. Its usage
d892f6d66402 build documents in Isabelle/Scala, based on generated tex files as session exports;
wenzelm
parents: 72309
diff changeset
   129
  is:
61407
7ba7b8103565 @{verbatim [display]} supersedes old alltt/ttbox;
wenzelm
parents: 61406
diff changeset
   130
  @{verbatim [display]
72574
d892f6d66402 build documents in Isabelle/Scala, based on generated tex files as session exports;
wenzelm
parents: 72309
diff changeset
   131
\<open>Usage: isabelle document [OPTIONS] SESSION
28221
ca9fdab0f971 converted present.tex;
wenzelm
parents:
diff changeset
   132
ca9fdab0f971 converted present.tex;
wenzelm
parents:
diff changeset
   133
  Options are:
72675
cc1347c8c804 clarified document output;
wenzelm
parents: 72653
diff changeset
   134
    -O DIR       output directory for LaTeX sources and resulting PDF
cc1347c8c804 clarified document output;
wenzelm
parents: 72653
diff changeset
   135
    -P DIR       output directory for resulting PDF
cc1347c8c804 clarified document output;
wenzelm
parents: 72653
diff changeset
   136
    -S DIR       output directory for LaTeX sources
72574
d892f6d66402 build documents in Isabelle/Scala, based on generated tex files as session exports;
wenzelm
parents: 72309
diff changeset
   137
    -V           verbose latex
d892f6d66402 build documents in Isabelle/Scala, based on generated tex files as session exports;
wenzelm
parents: 72309
diff changeset
   138
    -d DIR       include session directory
d892f6d66402 build documents in Isabelle/Scala, based on generated tex files as session exports;
wenzelm
parents: 72309
diff changeset
   139
    -o OPTION    override Isabelle system OPTION (via NAME=VAL or NAME)
d892f6d66402 build documents in Isabelle/Scala, based on generated tex files as session exports;
wenzelm
parents: 72309
diff changeset
   140
    -v           verbose build
61407
7ba7b8103565 @{verbatim [display]} supersedes old alltt/ttbox;
wenzelm
parents: 61406
diff changeset
   141
72574
d892f6d66402 build documents in Isabelle/Scala, based on generated tex files as session exports;
wenzelm
parents: 72309
diff changeset
   142
  Prepare the theory document of a session.\<close>}
67176
13b5c3ff1954 re-implemented "isabelle document" in Isabelle/Scala, include latex_errors here;
wenzelm
parents: 67151
diff changeset
   143
72574
d892f6d66402 build documents in Isabelle/Scala, based on generated tex files as session exports;
wenzelm
parents: 72309
diff changeset
   144
  Generated {\LaTeX} sources are taken from the session build database:
72650
787ba1d19d3a more robust: ensure coherence wrt. build database;
wenzelm
parents: 72648
diff changeset
   145
  @{tool_ref build} is invoked beforehand to ensure that it is up-to-date.
787ba1d19d3a more robust: ensure coherence wrt. build database;
wenzelm
parents: 72648
diff changeset
   146
  Further files are generated on the spot, notably essential Isabelle style
787ba1d19d3a more robust: ensure coherence wrt. build database;
wenzelm
parents: 72648
diff changeset
   147
  files, and \<^verbatim>\<open>session.tex\<close> to input all theory sources from the session
787ba1d19d3a more robust: ensure coherence wrt. build database;
wenzelm
parents: 72648
diff changeset
   148
  (excluding imports from other sessions).
28221
ca9fdab0f971 converted present.tex;
wenzelm
parents:
diff changeset
   149
72653
ea35afdb1366 store documents within session database, instead of browser_info directory;
wenzelm
parents: 72650
diff changeset
   150
  \<^medskip> Options \<^verbatim>\<open>-d\<close>, \<^verbatim>\<open>-o\<close>, \<^verbatim>\<open>-v\<close> have the same meaning as for @{tool
72648
1cbac4ae934d more explicit presentation directory;
wenzelm
parents: 72574
diff changeset
   151
  build}.
28221
ca9fdab0f971 converted present.tex;
wenzelm
parents:
diff changeset
   152
72574
d892f6d66402 build documents in Isabelle/Scala, based on generated tex files as session exports;
wenzelm
parents: 72309
diff changeset
   153
  \<^medskip> Option \<^verbatim>\<open>-V\<close> prints full output of {\LaTeX} tools.
28221
ca9fdab0f971 converted present.tex;
wenzelm
parents:
diff changeset
   154
72675
cc1347c8c804 clarified document output;
wenzelm
parents: 72653
diff changeset
   155
  \<^medskip> Option \<^verbatim>\<open>-O\<close>~\<open>dir\<close> specifies the output directory for generated {\LaTeX}
cc1347c8c804 clarified document output;
wenzelm
parents: 72653
diff changeset
   156
  sources and the result PDF file. Options \<^verbatim>\<open>-P\<close> and \<^verbatim>\<open>-S\<close> only refer to the
cc1347c8c804 clarified document output;
wenzelm
parents: 72653
diff changeset
   157
  PDF and sources, respectively.
28221
ca9fdab0f971 converted present.tex;
wenzelm
parents:
diff changeset
   158
72574
d892f6d66402 build documents in Isabelle/Scala, based on generated tex files as session exports;
wenzelm
parents: 72309
diff changeset
   159
  For example, for output directory ``\<^verbatim>\<open>output\<close>'' and the default document
d892f6d66402 build documents in Isabelle/Scala, based on generated tex files as session exports;
wenzelm
parents: 72309
diff changeset
   160
  variant ``\<^verbatim>\<open>document\<close>'', the generated document sources are placed into the
d892f6d66402 build documents in Isabelle/Scala, based on generated tex files as session exports;
wenzelm
parents: 72309
diff changeset
   161
  subdirectory \<^verbatim>\<open>output/document/\<close> and the resulting PDF into
d892f6d66402 build documents in Isabelle/Scala, based on generated tex files as session exports;
wenzelm
parents: 72309
diff changeset
   162
  \<^verbatim>\<open>output/document.pdf\<close>.
28221
ca9fdab0f971 converted present.tex;
wenzelm
parents:
diff changeset
   163
72574
d892f6d66402 build documents in Isabelle/Scala, based on generated tex files as session exports;
wenzelm
parents: 72309
diff changeset
   164
  \<^medskip> Isabelle is usually smart enough to create the PDF from the given
d892f6d66402 build documents in Isabelle/Scala, based on generated tex files as session exports;
wenzelm
parents: 72309
diff changeset
   165
  \<^verbatim>\<open>root.tex\<close> and optional \<^verbatim>\<open>root.bib\<close> (bibliography) and \<^verbatim>\<open>root.idx\<close> (index)
73741
941915a3b811 discontinued obsolete "isabelle latex";
wenzelm
parents: 73724
diff changeset
   166
  using standard {\LaTeX} tools. Actual command-lines are given by settings
74873
0ab2ed1489eb more documentation about document build options;
wenzelm
parents: 73826
diff changeset
   167
  @{setting_ref ISABELLE_LUALATEX} (or @{setting_ref ISABELLE_PDFLATEX}),
73741
941915a3b811 discontinued obsolete "isabelle latex";
wenzelm
parents: 73724
diff changeset
   168
  @{setting_ref ISABELLE_BIBTEX}, @{setting_ref ISABELLE_MAKEINDEX}: these
941915a3b811 discontinued obsolete "isabelle latex";
wenzelm
parents: 73724
diff changeset
   169
  variables are used without quoting in shell scripts, and thus may contain
941915a3b811 discontinued obsolete "isabelle latex";
wenzelm
parents: 73724
diff changeset
   170
  additional options.
941915a3b811 discontinued obsolete "isabelle latex";
wenzelm
parents: 73724
diff changeset
   171
74873
0ab2ed1489eb more documentation about document build options;
wenzelm
parents: 73826
diff changeset
   172
  The system option @{system_option_def "document_build"} specifies an
0ab2ed1489eb more documentation about document build options;
wenzelm
parents: 73826
diff changeset
   173
  alternative build engine, e.g. within the session \<^verbatim>\<open>ROOT\<close> file as
0ab2ed1489eb more documentation about document build options;
wenzelm
parents: 73826
diff changeset
   174
  ``\<^verbatim>\<open>options [document_build = pdflatex]\<close>''. The following standard engines
0ab2ed1489eb more documentation about document build options;
wenzelm
parents: 73826
diff changeset
   175
  are available:
0ab2ed1489eb more documentation about document build options;
wenzelm
parents: 73826
diff changeset
   176
0ab2ed1489eb more documentation about document build options;
wenzelm
parents: 73826
diff changeset
   177
    \<^item> \<^verbatim>\<open>lualatex\<close> (default) uses the shell command \<^verbatim>\<open>$ISABELLE_LUALATEX\<close> on
0ab2ed1489eb more documentation about document build options;
wenzelm
parents: 73826
diff changeset
   178
    the main \<^verbatim>\<open>root.tex\<close> file, with further runs of \<^verbatim>\<open>$ISABELLE_BIBTEX\<close> and
0ab2ed1489eb more documentation about document build options;
wenzelm
parents: 73826
diff changeset
   179
    \<^verbatim>\<open>$ISABELLE_MAKEINDEX\<close> as required.
0ab2ed1489eb more documentation about document build options;
wenzelm
parents: 73826
diff changeset
   180
0ab2ed1489eb more documentation about document build options;
wenzelm
parents: 73826
diff changeset
   181
    \<^item> \<^verbatim>\<open>pdflatex\<close> uses \<^verbatim>\<open>$ISABELLE_PDFLATEX\<close> instead of \<^verbatim>\<open>$ISABELLE_LUALATEX\<close>,
0ab2ed1489eb more documentation about document build options;
wenzelm
parents: 73826
diff changeset
   182
    and the other tools as above.
0ab2ed1489eb more documentation about document build options;
wenzelm
parents: 73826
diff changeset
   183
0ab2ed1489eb more documentation about document build options;
wenzelm
parents: 73826
diff changeset
   184
    \<^item> \<^verbatim>\<open>build\<close> invokes an executable script of the same name in a private
0ab2ed1489eb more documentation about document build options;
wenzelm
parents: 73826
diff changeset
   185
    directory containing all \isakeyword{document\_files} and other generated
0ab2ed1489eb more documentation about document build options;
wenzelm
parents: 73826
diff changeset
   186
    document sources. The script is invoked as ``\<^verbatim>\<open>./build pdf\<close>~\<open>name\<close>'' for
0ab2ed1489eb more documentation about document build options;
wenzelm
parents: 73826
diff changeset
   187
    the document variant name; it needs to produce a corresponding
0ab2ed1489eb more documentation about document build options;
wenzelm
parents: 73826
diff changeset
   188
    \<open>name\<close>\<^verbatim>\<open>.pdf\<close> file by arbitrary means on its own.
0ab2ed1489eb more documentation about document build options;
wenzelm
parents: 73826
diff changeset
   189
0ab2ed1489eb more documentation about document build options;
wenzelm
parents: 73826
diff changeset
   190
  Further engines can be defined by add-on components in Isabelle/Scala
0ab2ed1489eb more documentation about document build options;
wenzelm
parents: 73826
diff changeset
   191
  (\secref{sec:scala-build}), providing a service class derived from
75700
953953504590 update documentation, following 21c1f82e7f5d;
wenzelm
parents: 75161
diff changeset
   192
  \<^scala_type>\<open>isabelle.Document_Build.Engine\<close>.
73741
941915a3b811 discontinued obsolete "isabelle latex";
wenzelm
parents: 73724
diff changeset
   193
\<close>
941915a3b811 discontinued obsolete "isabelle latex";
wenzelm
parents: 73724
diff changeset
   194
28221
ca9fdab0f971 converted present.tex;
wenzelm
parents:
diff changeset
   195
72574
d892f6d66402 build documents in Isabelle/Scala, based on generated tex files as session exports;
wenzelm
parents: 72309
diff changeset
   196
subsubsection \<open>Examples\<close>
28221
ca9fdab0f971 converted present.tex;
wenzelm
parents:
diff changeset
   197
72574
d892f6d66402 build documents in Isabelle/Scala, based on generated tex files as session exports;
wenzelm
parents: 72309
diff changeset
   198
text \<open>
d892f6d66402 build documents in Isabelle/Scala, based on generated tex files as session exports;
wenzelm
parents: 72309
diff changeset
   199
  Produce the document from session \<^verbatim>\<open>FOL\<close> with full verbosity, and a copy in
d892f6d66402 build documents in Isabelle/Scala, based on generated tex files as session exports;
wenzelm
parents: 72309
diff changeset
   200
  the current directory (subdirectory \<^verbatim>\<open>document\<close> and file \<^verbatim>\<open>document.pdf)\<close>:
48814
d488a5f25bf6 some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents: 48722
diff changeset
   201
72574
d892f6d66402 build documents in Isabelle/Scala, based on generated tex files as session exports;
wenzelm
parents: 72309
diff changeset
   202
  @{verbatim [display] \<open>isabelle document -v -V -O. FOL\<close>}
58618
782f0b662cae more cartouches;
wenzelm
parents: 58553
diff changeset
   203
\<close>
28221
ca9fdab0f971 converted present.tex;
wenzelm
parents:
diff changeset
   204
82033
17436dc0d3d4 tuned whitespace;
Fabian Huch <huch@in.tum.de>
parents: 82032
diff changeset
   205
82032
9bc4f982aef4 documentation about Find_Facts;
Fabian Huch <huch@in.tum.de>
parents: 77554
diff changeset
   206
section \<open>Full-text search for formal theory content\<close>
9bc4f982aef4 documentation about Find_Facts;
Fabian Huch <huch@in.tum.de>
parents: 77554
diff changeset
   207
9bc4f982aef4 documentation about Find_Facts;
Fabian Huch <huch@in.tum.de>
parents: 77554
diff changeset
   208
text \<open>
9bc4f982aef4 documentation about Find_Facts;
Fabian Huch <huch@in.tum.de>
parents: 77554
diff changeset
   209
  The session information of a regular @{tool_ref build} can also be used to
9bc4f982aef4 documentation about Find_Facts;
Fabian Huch <huch@in.tum.de>
parents: 77554
diff changeset
   210
  generate a search index for full-text search over formal theory content. To
82051
1be62b17bed9 tuned documentation;
wenzelm
parents: 82033
diff changeset
   211
  that end, the \<^verbatim>\<open>Find_Facts\<close> module integrates Apache Solr\<^footnote>\<open>\<^url>\<open>https://solr.apache.org\<close>\<close>,
82032
9bc4f982aef4 documentation about Find_Facts;
Fabian Huch <huch@in.tum.de>
parents: 77554
diff changeset
   212
  a full-text search engine, that can run embedded in a JVM process. Solr is
9bc4f982aef4 documentation about Find_Facts;
Fabian Huch <huch@in.tum.de>
parents: 77554
diff changeset
   213
  bundled as a separate Isabelle component, and its run-time dependencies 
9bc4f982aef4 documentation about Find_Facts;
Fabian Huch <huch@in.tum.de>
parents: 77554
diff changeset
   214
  (as specified in  @{setting SOLR_JARS}) need to be added separately to the
9bc4f982aef4 documentation about Find_Facts;
Fabian Huch <huch@in.tum.de>
parents: 77554
diff changeset
   215
  classpath of a regular Isabelle/Scala process.
9bc4f982aef4 documentation about Find_Facts;
Fabian Huch <huch@in.tum.de>
parents: 77554
diff changeset
   216
9bc4f982aef4 documentation about Find_Facts;
Fabian Huch <huch@in.tum.de>
parents: 77554
diff changeset
   217
  \<^medskip>
9bc4f982aef4 documentation about Find_Facts;
Fabian Huch <huch@in.tum.de>
parents: 77554
diff changeset
   218
  A search index can be created using the @{tool_def find_facts_index} tool,
9bc4f982aef4 documentation about Find_Facts;
Fabian Huch <huch@in.tum.de>
parents: 77554
diff changeset
   219
  which has options similar to the regular @{tool_ref build}. User data such
9bc4f982aef4 documentation about Find_Facts;
Fabian Huch <huch@in.tum.de>
parents: 77554
diff changeset
   220
  as search indexes is stored in @{setting FIND_FACTS_HOME_USER}. The name of
9bc4f982aef4 documentation about Find_Facts;
Fabian Huch <huch@in.tum.de>
parents: 77554
diff changeset
   221
  the search index can be specified via system option 
9bc4f982aef4 documentation about Find_Facts;
Fabian Huch <huch@in.tum.de>
parents: 77554
diff changeset
   222
  @{system_option find_facts_database_name}. A finished search index can be
9bc4f982aef4 documentation about Find_Facts;
Fabian Huch <huch@in.tum.de>
parents: 77554
diff changeset
   223
  packed for later use as a regular Isabelle component using the 
9bc4f982aef4 documentation about Find_Facts;
Fabian Huch <huch@in.tum.de>
parents: 77554
diff changeset
   224
  @{tool_def find_facts_index_build} tool: Initializing such a component
9bc4f982aef4 documentation about Find_Facts;
Fabian Huch <huch@in.tum.de>
parents: 77554
diff changeset
   225
  causes it to be added to the list of managed components in
9bc4f982aef4 documentation about Find_Facts;
Fabian Huch <huch@in.tum.de>
parents: 77554
diff changeset
   226
  @{setting FIND_FACTS_INDEXES}.
9bc4f982aef4 documentation about Find_Facts;
Fabian Huch <huch@in.tum.de>
parents: 77554
diff changeset
   227
9bc4f982aef4 documentation about Find_Facts;
Fabian Huch <huch@in.tum.de>
parents: 77554
diff changeset
   228
  \<^medskip>
9bc4f982aef4 documentation about Find_Facts;
Fabian Huch <huch@in.tum.de>
parents: 77554
diff changeset
   229
  The user interface of the search is available as web application that 
9bc4f982aef4 documentation about Find_Facts;
Fabian Huch <huch@in.tum.de>
parents: 77554
diff changeset
   230
  can be started with the @{tool_def find_facts_server} tool. Its usage is:
9bc4f982aef4 documentation about Find_Facts;
Fabian Huch <huch@in.tum.de>
parents: 77554
diff changeset
   231
  @{verbatim [display]
9bc4f982aef4 documentation about Find_Facts;
Fabian Huch <huch@in.tum.de>
parents: 77554
diff changeset
   232
\<open>Usage: isabelle find_facts_server [OPTIONS]
9bc4f982aef4 documentation about Find_Facts;
Fabian Huch <huch@in.tum.de>
parents: 77554
diff changeset
   233
9bc4f982aef4 documentation about Find_Facts;
Fabian Huch <huch@in.tum.de>
parents: 77554
diff changeset
   234
  Options are:
9bc4f982aef4 documentation about Find_Facts;
Fabian Huch <huch@in.tum.de>
parents: 77554
diff changeset
   235
    -d           devel mode
9bc4f982aef4 documentation about Find_Facts;
Fabian Huch <huch@in.tum.de>
parents: 77554
diff changeset
   236
    -o OPTION    override Isabelle system OPTION (via NAME=VAL or NAME)
9bc4f982aef4 documentation about Find_Facts;
Fabian Huch <huch@in.tum.de>
parents: 77554
diff changeset
   237
    -p PORT      explicit web server port
9bc4f982aef4 documentation about Find_Facts;
Fabian Huch <huch@in.tum.de>
parents: 77554
diff changeset
   238
    -v           verbose server
9bc4f982aef4 documentation about Find_Facts;
Fabian Huch <huch@in.tum.de>
parents: 77554
diff changeset
   239
9bc4f982aef4 documentation about Find_Facts;
Fabian Huch <huch@in.tum.de>
parents: 77554
diff changeset
   240
  Run server for Find_Facts.
9bc4f982aef4 documentation about Find_Facts;
Fabian Huch <huch@in.tum.de>
parents: 77554
diff changeset
   241
\<close>}
9bc4f982aef4 documentation about Find_Facts;
Fabian Huch <huch@in.tum.de>
parents: 77554
diff changeset
   242
9bc4f982aef4 documentation about Find_Facts;
Fabian Huch <huch@in.tum.de>
parents: 77554
diff changeset
   243
  This Isabelle/Scala HTTP server provides the both the front-end
82051
1be62b17bed9 tuned documentation;
wenzelm
parents: 82033
diff changeset
   244
  (implemented in the Elm\<^footnote>\<open>\<^url>\<open>https://elm-lang.org\<close>\<close> language) and REST
82032
9bc4f982aef4 documentation about Find_Facts;
Fabian Huch <huch@in.tum.de>
parents: 77554
diff changeset
   245
  endpoints for search queries with JSON data.
9bc4f982aef4 documentation about Find_Facts;
Fabian Huch <huch@in.tum.de>
parents: 77554
diff changeset
   246
82051
1be62b17bed9 tuned documentation;
wenzelm
parents: 82033
diff changeset
   247
  Options \<^verbatim>\<open>-o\<close> and \<^verbatim>\<open>-v\<close> have the same meaning as in @{tool build}.
82032
9bc4f982aef4 documentation about Find_Facts;
Fabian Huch <huch@in.tum.de>
parents: 77554
diff changeset
   248
9bc4f982aef4 documentation about Find_Facts;
Fabian Huch <huch@in.tum.de>
parents: 77554
diff changeset
   249
  Option \<^verbatim>\<open>-d\<close> re-compiles the front-end in \<^path>\<open>$FIND_FACTS_HOME_USER/web\<close>
9bc4f982aef4 documentation about Find_Facts;
Fabian Huch <huch@in.tum.de>
parents: 77554
diff changeset
   250
  on page reload (when sources are changed).
9bc4f982aef4 documentation about Find_Facts;
Fabian Huch <huch@in.tum.de>
parents: 77554
diff changeset
   251
82051
1be62b17bed9 tuned documentation;
wenzelm
parents: 82033
diff changeset
   252
  Option \<^verbatim>\<open>-p\<close> specifies an explicit TCP port for the server socket (assigned
1be62b17bed9 tuned documentation;
wenzelm
parents: 82033
diff changeset
   253
  by the operating system per default). For public-facing servers, a common
1be62b17bed9 tuned documentation;
wenzelm
parents: 82033
diff changeset
   254
  scheme is \<^verbatim>\<open>-p 8080\<close> that is access-restricted via firewall rules, with a
1be62b17bed9 tuned documentation;
wenzelm
parents: 82033
diff changeset
   255
  reverse proxy\<^footnote>\<open>E.g. via Caddy \<^url>\<open>https://caddyserver.com/docs\<close>\<close> in system
1be62b17bed9 tuned documentation;
wenzelm
parents: 82033
diff changeset
   256
  space (that also handles SSL) on ports 80 and 443.
82032
9bc4f982aef4 documentation about Find_Facts;
Fabian Huch <huch@in.tum.de>
parents: 77554
diff changeset
   257
\<close>
9bc4f982aef4 documentation about Find_Facts;
Fabian Huch <huch@in.tum.de>
parents: 77554
diff changeset
   258
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 67351
diff changeset
   259
end