| author | wenzelm | 
| Sat, 17 Oct 2015 21:15:10 +0200 | |
| changeset 61463 | 8e46cea6a45a | 
| parent 61458 | 987533262fc2 | 
| child 61472 | 6458760261ca | 
| permissions | -rw-r--r-- | 
| 27043 | 1  | 
theory Document_Preparation  | 
| 42651 | 2  | 
imports Base Main  | 
| 27043 | 3  | 
begin  | 
4  | 
||
| 58618 | 5  | 
chapter \<open>Document preparation \label{ch:document-prep}\<close>
 | 
| 27043 | 6  | 
|
| 58618 | 7  | 
text \<open>Isabelle/Isar provides a simple document preparation system  | 
| 54346 | 8  | 
  based on {PDF-\LaTeX}, with support for hyperlinks and bookmarks
 | 
9  | 
within that format. This allows to produce papers, books, theses  | 
|
10  | 
etc.\ from Isabelle theory sources.  | 
|
| 27043 | 11  | 
|
| 51057 | 12  | 
  {\LaTeX} output is generated while processing a \emph{session} in
 | 
13  | 
  batch mode, as explained in the \emph{The Isabelle System Manual}
 | 
|
| 60270 | 14  | 
  @{cite "isabelle-system"}.  The main Isabelle tools to get started with
 | 
| 54346 | 15  | 
  document preparation are @{tool_ref mkroot} and @{tool_ref build}.
 | 
| 27043 | 16  | 
|
| 58552 | 17  | 
  The classic Isabelle/HOL tutorial @{cite "isabelle-hol-book"} also
 | 
| 58618 | 18  | 
explains some aspects of theory presentation.\<close>  | 
| 27043 | 19  | 
|
20  | 
||
| 58618 | 21  | 
section \<open>Markup commands \label{sec:markup}\<close>
 | 
| 27043 | 22  | 
|
| 58618 | 23  | 
text \<open>  | 
| 27043 | 24  | 
  \begin{matharray}{rcl}
 | 
| 
58868
 
c5e1cce7ace3
uniform heading commands work in any context, even in theory header;
 
wenzelm 
parents: 
58725 
diff
changeset
 | 
25  | 
    @{command_def "chapter"} & : & @{text "any \<rightarrow> any"} \\
 | 
| 
 
c5e1cce7ace3
uniform heading commands work in any context, even in theory header;
 
wenzelm 
parents: 
58725 
diff
changeset
 | 
26  | 
    @{command_def "section"} & : & @{text "any \<rightarrow> any"} \\
 | 
| 
 
c5e1cce7ace3
uniform heading commands work in any context, even in theory header;
 
wenzelm 
parents: 
58725 
diff
changeset
 | 
27  | 
    @{command_def "subsection"} & : & @{text "any \<rightarrow> any"} \\
 | 
| 
 
c5e1cce7ace3
uniform heading commands work in any context, even in theory header;
 
wenzelm 
parents: 
58725 
diff
changeset
 | 
28  | 
    @{command_def "subsubsection"} & : & @{text "any \<rightarrow> any"} \\
 | 
| 61463 | 29  | 
    @{command_def "paragraph"} & : & @{text "any \<rightarrow> any"} \\
 | 
30  | 
    @{command_def "subparagraph"} & : & @{text "any \<rightarrow> any"} \\
 | 
|
| 
58999
 
ed09ae4ea2d8
uniform treatment of all document markup commands: 'text' and 'txt' merely differ in LaTeX style;
 
wenzelm 
parents: 
58868 
diff
changeset
 | 
31  | 
    @{command_def "text"} & : & @{text "any \<rightarrow> any"} \\
 | 
| 
 
ed09ae4ea2d8
uniform treatment of all document markup commands: 'text' and 'txt' merely differ in LaTeX style;
 
wenzelm 
parents: 
58868 
diff
changeset
 | 
32  | 
    @{command_def "txt"} & : & @{text "any \<rightarrow> any"} \\
 | 
| 
 
ed09ae4ea2d8
uniform treatment of all document markup commands: 'text' and 'txt' merely differ in LaTeX style;
 
wenzelm 
parents: 
58868 
diff
changeset
 | 
33  | 
    @{command_def "text_raw"} & : & @{text "any \<rightarrow> any"} \\
 | 
| 27043 | 34  | 
  \end{matharray}
 | 
35  | 
||
| 28747 | 36  | 
Markup commands provide a structured way to insert text into the  | 
37  | 
document generated from a theory. Each markup command takes a  | 
|
38  | 
  single @{syntax text} argument, which is passed as argument to a
 | 
|
39  | 
  corresponding {\LaTeX} macro.  The default macros provided by
 | 
|
| 
40800
 
330eb65c9469
Parse.liberal_name for document antiquotations and attributes;
 
wenzelm 
parents: 
40255 
diff
changeset
 | 
40  | 
  @{file "~~/lib/texinputs/isabelle.sty"} can be redefined according
 | 
| 28747 | 41  | 
  to the needs of the underlying document and {\LaTeX} styles.
 | 
42  | 
||
43  | 
  Note that formal comments (\secref{sec:comments}) are similar to
 | 
|
44  | 
markup commands, but have a different status within Isabelle/Isar  | 
|
45  | 
syntax.  | 
|
| 27043 | 46  | 
|
| 
55112
 
b1a5d603fd12
prefer rail cartouche -- avoid back-slashed quotes;
 
wenzelm 
parents: 
55029 
diff
changeset
 | 
47  | 
  @{rail \<open>
 | 
| 
42596
 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 
wenzelm 
parents: 
40879 
diff
changeset
 | 
48  | 
    (@@{command chapter} | @@{command section} | @@{command subsection} |
 | 
| 61463 | 49  | 
      @@{command subsubsection} | @@{command paragraph} | @@{command subparagraph} |
 | 
50  | 
      @@{command text} | @@{command txt} | @@{command text_raw}) @{syntax text}
 | 
|
| 
55112
 
b1a5d603fd12
prefer rail cartouche -- avoid back-slashed quotes;
 
wenzelm 
parents: 
55029 
diff
changeset
 | 
51  | 
\<close>}  | 
| 27043 | 52  | 
|
| 61463 | 53  | 
  \<^descr> @{command chapter}, @{command section}, @{command subsection} etc.\ mark
 | 
54  | 
section headings within the theory source. This works in any context, even  | 
|
55  | 
  before the initial @{command theory} command. The corresponding {\LaTeX}
 | 
|
56  | 
  macros are @{verbatim \<open>\isamarkupchapter\<close>}, @{verbatim
 | 
|
57  | 
  \<open>\isamarkupsection\<close>}, @{verbatim \<open>\isamarkupsubsection\<close>} etc.\
 | 
|
| 27043 | 58  | 
|
| 61439 | 59  | 
  \<^descr> @{command text} and @{command txt} specify paragraphs of plain text.
 | 
| 
58999
 
ed09ae4ea2d8
uniform treatment of all document markup commands: 'text' and 'txt' merely differ in LaTeX style;
 
wenzelm 
parents: 
58868 
diff
changeset
 | 
60  | 
  This corresponds to a {\LaTeX} environment @{verbatim
 | 
| 
 
ed09ae4ea2d8
uniform treatment of all document markup commands: 'text' and 'txt' merely differ in LaTeX style;
 
wenzelm 
parents: 
58868 
diff
changeset
 | 
61  | 
  \<open>\begin{isamarkuptext}\<close>} @{text "\<dots>"} @{verbatim \<open>\end{isamarkuptext}\<close>}
 | 
| 
 
ed09ae4ea2d8
uniform treatment of all document markup commands: 'text' and 'txt' merely differ in LaTeX style;
 
wenzelm 
parents: 
58868 
diff
changeset
 | 
62  | 
etc.  | 
| 27043 | 63  | 
|
| 61463 | 64  | 
  \<^descr> @{command text_raw} is similar to @{command text}, but without
 | 
65  | 
any surrounding markup environment. This allows to inject arbitrary  | 
|
66  | 
  {\LaTeX} source into the generated document.
 | 
|
| 27043 | 67  | 
|
68  | 
||
| 61463 | 69  | 
All text passed to any of the above markup commands may refer to formal  | 
70  | 
  entities via \emph{document antiquotations}, see also \secref{sec:antiq}.
 | 
|
71  | 
These are interpreted in the present theory or proof context.  | 
|
| 27043 | 72  | 
|
| 61421 | 73  | 
\<^medskip>  | 
74  | 
The proof markup commands closely resemble those for theory  | 
|
| 27043 | 75  | 
specifications, but have a different formal status and produce  | 
| 
58868
 
c5e1cce7ace3
uniform heading commands work in any context, even in theory header;
 
wenzelm 
parents: 
58725 
diff
changeset
 | 
76  | 
  different {\LaTeX} macros.
 | 
| 58618 | 77  | 
\<close>  | 
| 27043 | 78  | 
|
79  | 
||
| 60286 | 80  | 
section \<open>Document antiquotations \label{sec:antiq}\<close>
 | 
| 27043 | 81  | 
|
| 58618 | 82  | 
text \<open>  | 
| 27043 | 83  | 
  \begin{matharray}{rcl}
 | 
| 
59917
 
9830c944670f
more uniform "verbose" option to print name space;
 
wenzelm 
parents: 
59783 
diff
changeset
 | 
84  | 
    @{command_def "print_antiquotations"}@{text "\<^sup>*"} & : & @{text "context \<rightarrow> "} \\
 | 
| 
28761
 
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
 
wenzelm 
parents: 
28760 
diff
changeset
 | 
85  | 
    @{antiquotation_def "theory"} & : & @{text antiquotation} \\
 | 
| 
 
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
 
wenzelm 
parents: 
28760 
diff
changeset
 | 
86  | 
    @{antiquotation_def "thm"} & : & @{text antiquotation} \\
 | 
| 
 
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
 
wenzelm 
parents: 
28760 
diff
changeset
 | 
87  | 
    @{antiquotation_def "lemma"} & : & @{text antiquotation} \\
 | 
| 
 
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
 
wenzelm 
parents: 
28760 
diff
changeset
 | 
88  | 
    @{antiquotation_def "prop"} & : & @{text antiquotation} \\
 | 
| 
 
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
 
wenzelm 
parents: 
28760 
diff
changeset
 | 
89  | 
    @{antiquotation_def "term"} & : & @{text antiquotation} \\
 | 
| 
32898
 
e871d897969c
term styles also cover antiquotations term_type and typeof
 
haftmann 
parents: 
32892 
diff
changeset
 | 
90  | 
    @{antiquotation_def term_type} & : & @{text antiquotation} \\
 | 
| 
 
e871d897969c
term styles also cover antiquotations term_type and typeof
 
haftmann 
parents: 
32892 
diff
changeset
 | 
91  | 
    @{antiquotation_def typeof} & : & @{text antiquotation} \\
 | 
| 
28761
 
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
 
wenzelm 
parents: 
28760 
diff
changeset
 | 
92  | 
    @{antiquotation_def const} & : & @{text antiquotation} \\
 | 
| 
 
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
 
wenzelm 
parents: 
28760 
diff
changeset
 | 
93  | 
    @{antiquotation_def abbrev} & : & @{text antiquotation} \\
 | 
| 
 
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
 
wenzelm 
parents: 
28760 
diff
changeset
 | 
94  | 
    @{antiquotation_def typ} & : & @{text antiquotation} \\
 | 
| 
39305
 
d4fa19eb0822
'class' and 'type' are now antiquoations by default
 
haftmann 
parents: 
32898 
diff
changeset
 | 
95  | 
    @{antiquotation_def type} & : & @{text antiquotation} \\
 | 
| 
 
d4fa19eb0822
'class' and 'type' are now antiquoations by default
 
haftmann 
parents: 
32898 
diff
changeset
 | 
96  | 
    @{antiquotation_def class} & : & @{text antiquotation} \\
 | 
| 
28761
 
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
 
wenzelm 
parents: 
28760 
diff
changeset
 | 
97  | 
    @{antiquotation_def "text"} & : & @{text antiquotation} \\
 | 
| 
 
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
 
wenzelm 
parents: 
28760 
diff
changeset
 | 
98  | 
    @{antiquotation_def goals} & : & @{text antiquotation} \\
 | 
| 
 
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
 
wenzelm 
parents: 
28760 
diff
changeset
 | 
99  | 
    @{antiquotation_def subgoals} & : & @{text antiquotation} \\
 | 
| 
 
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
 
wenzelm 
parents: 
28760 
diff
changeset
 | 
100  | 
    @{antiquotation_def prf} & : & @{text antiquotation} \\
 | 
| 
 
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
 
wenzelm 
parents: 
28760 
diff
changeset
 | 
101  | 
    @{antiquotation_def full_prf} & : & @{text antiquotation} \\
 | 
| 
 
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
 
wenzelm 
parents: 
28760 
diff
changeset
 | 
102  | 
    @{antiquotation_def ML} & : & @{text antiquotation} \\
 | 
| 46261 | 103  | 
    @{antiquotation_def ML_op} & : & @{text antiquotation} \\
 | 
| 
28761
 
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
 
wenzelm 
parents: 
28760 
diff
changeset
 | 
104  | 
    @{antiquotation_def ML_type} & : & @{text antiquotation} \\
 | 
| 55837 | 105  | 
    @{antiquotation_def ML_structure} & : & @{text antiquotation} \\
 | 
106  | 
    @{antiquotation_def ML_functor} & : & @{text antiquotation} \\
 | 
|
| 
58716
 
23a380cc45f4
official support for "tt" style variants, avoid fragile \verb in LaTeX;
 
wenzelm 
parents: 
58618 
diff
changeset
 | 
107  | 
    @{antiquotation_def verbatim} & : & @{text antiquotation} \\
 | 
| 40801 | 108  | 
    @{antiquotation_def "file"} & : & @{text antiquotation} \\
 | 
| 
54702
 
3daeba5130f0
added document antiquotation @{url}, which produces formal markup for LaTeX and PIDE;
 
wenzelm 
parents: 
54346 
diff
changeset
 | 
109  | 
    @{antiquotation_def "url"} & : & @{text antiquotation} \\
 | 
| 58593 | 110  | 
    @{antiquotation_def "cite"} & : & @{text antiquotation} \\
 | 
| 27043 | 111  | 
  \end{matharray}
 | 
112  | 
||
| 
28749
 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 
wenzelm 
parents: 
28747 
diff
changeset
 | 
113  | 
The overall content of an Isabelle/Isar theory may alternate between  | 
| 
 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 
wenzelm 
parents: 
28747 
diff
changeset
 | 
114  | 
formal and informal text. The main body consists of formal  | 
| 
 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 
wenzelm 
parents: 
28747 
diff
changeset
 | 
115  | 
specification and proof commands, interspersed with markup commands  | 
| 
 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 
wenzelm 
parents: 
28747 
diff
changeset
 | 
116  | 
  (\secref{sec:markup}) or document comments (\secref{sec:comments}).
 | 
| 
 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 
wenzelm 
parents: 
28747 
diff
changeset
 | 
117  | 
The argument of markup commands quotes informal text to be printed  | 
| 
 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 
wenzelm 
parents: 
28747 
diff
changeset
 | 
118  | 
in the resulting document, but may again refer to formal entities  | 
| 
 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 
wenzelm 
parents: 
28747 
diff
changeset
 | 
119  | 
  via \emph{document antiquotations}.
 | 
| 27043 | 120  | 
|
| 58724 | 121  | 
  For example, embedding @{verbatim \<open>@{term [show_types] "f x = a + x"}\<close>}
 | 
| 
28749
 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 
wenzelm 
parents: 
28747 
diff
changeset
 | 
122  | 
within a text block makes  | 
| 
 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 
wenzelm 
parents: 
28747 
diff
changeset
 | 
123  | 
  \isa{{\isacharparenleft}f{\isasymColon}{\isacharprime}a\ {\isasymRightarrow}\ {\isacharprime}a{\isacharparenright}\ {\isacharparenleft}x{\isasymColon}{\isacharprime}a{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}a{\isasymColon}{\isacharprime}a{\isacharparenright}\ {\isacharplus}\ x} appear in the final {\LaTeX} document.
 | 
| 
 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 
wenzelm 
parents: 
28747 
diff
changeset
 | 
124  | 
|
| 
 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 
wenzelm 
parents: 
28747 
diff
changeset
 | 
125  | 
Antiquotations usually spare the author tedious typing of logical  | 
| 
 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 
wenzelm 
parents: 
28747 
diff
changeset
 | 
126  | 
entities in full detail. Even more importantly, some degree of  | 
| 
 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 
wenzelm 
parents: 
28747 
diff
changeset
 | 
127  | 
consistency-checking between the main body of formal text and its  | 
| 
 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 
wenzelm 
parents: 
28747 
diff
changeset
 | 
128  | 
informal explanation is achieved, since terms and types appearing in  | 
| 
 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 
wenzelm 
parents: 
28747 
diff
changeset
 | 
129  | 
antiquotations are checked within the current theory or proof  | 
| 
 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 
wenzelm 
parents: 
28747 
diff
changeset
 | 
130  | 
context.  | 
| 27043 | 131  | 
|
| 
59917
 
9830c944670f
more uniform "verbose" option to print name space;
 
wenzelm 
parents: 
59783 
diff
changeset
 | 
132  | 
  @{rail \<open>
 | 
| 
 
9830c944670f
more uniform "verbose" option to print name space;
 
wenzelm 
parents: 
59783 
diff
changeset
 | 
133  | 
    @@{command print_antiquotations} ('!'?)
 | 
| 
 
9830c944670f
more uniform "verbose" option to print name space;
 
wenzelm 
parents: 
59783 
diff
changeset
 | 
134  | 
\<close>}  | 
| 
 
9830c944670f
more uniform "verbose" option to print name space;
 
wenzelm 
parents: 
59783 
diff
changeset
 | 
135  | 
|
| 43618 | 136  | 
%% FIXME less monolithic presentation, move to individual sections!?  | 
| 
55112
 
b1a5d603fd12
prefer rail cartouche -- avoid back-slashed quotes;
 
wenzelm 
parents: 
55029 
diff
changeset
 | 
137  | 
  @{rail \<open>
 | 
| 
42596
 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 
wenzelm 
parents: 
40879 
diff
changeset
 | 
138  | 
    '@{' antiquotation '}'
 | 
| 27043 | 139  | 
;  | 
| 
42596
 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 
wenzelm 
parents: 
40879 
diff
changeset
 | 
140  | 
    @{syntax_def antiquotation}:
 | 
| 
 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 
wenzelm 
parents: 
40879 
diff
changeset
 | 
141  | 
      @@{antiquotation theory} options @{syntax name} |
 | 
| 
 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 
wenzelm 
parents: 
40879 
diff
changeset
 | 
142  | 
      @@{antiquotation thm} options styles @{syntax thmrefs} |
 | 
| 42617 | 143  | 
      @@{antiquotation lemma} options @{syntax prop} @'by' @{syntax method} @{syntax method}? |
 | 
| 
42596
 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 
wenzelm 
parents: 
40879 
diff
changeset
 | 
144  | 
      @@{antiquotation prop} options styles @{syntax prop} |
 | 
| 
 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 
wenzelm 
parents: 
40879 
diff
changeset
 | 
145  | 
      @@{antiquotation term} options styles @{syntax term} |
 | 
| 43618 | 146  | 
      @@{antiquotation (HOL) value} options styles @{syntax term} |
 | 
| 
42596
 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 
wenzelm 
parents: 
40879 
diff
changeset
 | 
147  | 
      @@{antiquotation term_type} options styles @{syntax term} |
 | 
| 
 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 
wenzelm 
parents: 
40879 
diff
changeset
 | 
148  | 
      @@{antiquotation typeof} options styles @{syntax term} |
 | 
| 
 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 
wenzelm 
parents: 
40879 
diff
changeset
 | 
149  | 
      @@{antiquotation const} options @{syntax term} |
 | 
| 
 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 
wenzelm 
parents: 
40879 
diff
changeset
 | 
150  | 
      @@{antiquotation abbrev} options @{syntax term} |
 | 
| 
 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 
wenzelm 
parents: 
40879 
diff
changeset
 | 
151  | 
      @@{antiquotation typ} options @{syntax type} |
 | 
| 
 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 
wenzelm 
parents: 
40879 
diff
changeset
 | 
152  | 
      @@{antiquotation type} options @{syntax name} |
 | 
| 
 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 
wenzelm 
parents: 
40879 
diff
changeset
 | 
153  | 
      @@{antiquotation class} options @{syntax name} |
 | 
| 
58069
 
0255436b3d85
more liberal embedded "text", which includes cartouches;
 
wenzelm 
parents: 
56594 
diff
changeset
 | 
154  | 
      @@{antiquotation text} options @{syntax text}
 | 
| 46261 | 155  | 
;  | 
156  | 
    @{syntax antiquotation}:
 | 
|
| 
42596
 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 
wenzelm 
parents: 
40879 
diff
changeset
 | 
157  | 
      @@{antiquotation goals} options |
 | 
| 
 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 
wenzelm 
parents: 
40879 
diff
changeset
 | 
158  | 
      @@{antiquotation subgoals} options |
 | 
| 
 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 
wenzelm 
parents: 
40879 
diff
changeset
 | 
159  | 
      @@{antiquotation prf} options @{syntax thmrefs} |
 | 
| 
 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 
wenzelm 
parents: 
40879 
diff
changeset
 | 
160  | 
      @@{antiquotation full_prf} options @{syntax thmrefs} |
 | 
| 
58069
 
0255436b3d85
more liberal embedded "text", which includes cartouches;
 
wenzelm 
parents: 
56594 
diff
changeset
 | 
161  | 
      @@{antiquotation ML} options @{syntax text} |
 | 
| 
 
0255436b3d85
more liberal embedded "text", which includes cartouches;
 
wenzelm 
parents: 
56594 
diff
changeset
 | 
162  | 
      @@{antiquotation ML_op} options @{syntax text} |
 | 
| 
 
0255436b3d85
more liberal embedded "text", which includes cartouches;
 
wenzelm 
parents: 
56594 
diff
changeset
 | 
163  | 
      @@{antiquotation ML_type} options @{syntax text} |
 | 
| 
 
0255436b3d85
more liberal embedded "text", which includes cartouches;
 
wenzelm 
parents: 
56594 
diff
changeset
 | 
164  | 
      @@{antiquotation ML_structure} options @{syntax text} |
 | 
| 
 
0255436b3d85
more liberal embedded "text", which includes cartouches;
 
wenzelm 
parents: 
56594 
diff
changeset
 | 
165  | 
      @@{antiquotation ML_functor} options @{syntax text} |
 | 
| 
58716
 
23a380cc45f4
official support for "tt" style variants, avoid fragile \verb in LaTeX;
 
wenzelm 
parents: 
58618 
diff
changeset
 | 
166  | 
      @@{antiquotation verbatim} options @{syntax text} |
 | 
| 
55112
 
b1a5d603fd12
prefer rail cartouche -- avoid back-slashed quotes;
 
wenzelm 
parents: 
55029 
diff
changeset
 | 
167  | 
      @@{antiquotation "file"} options @{syntax name} |
 | 
| 54705 | 168  | 
      @@{antiquotation file_unchecked} options @{syntax name} |
 | 
| 58593 | 169  | 
      @@{antiquotation url} options @{syntax name} |
 | 
170  | 
      @@{antiquotation cite} options @{syntax cartouche}? (@{syntax name} + @'and')
 | 
|
| 27043 | 171  | 
;  | 
172  | 
options: '[' (option * ',') ']'  | 
|
173  | 
;  | 
|
| 
42596
 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 
wenzelm 
parents: 
40879 
diff
changeset
 | 
174  | 
    option: @{syntax name} | @{syntax name} '=' @{syntax name}
 | 
| 27043 | 175  | 
;  | 
| 32892 | 176  | 
    styles: '(' (style + ',') ')'
 | 
| 32891 | 177  | 
;  | 
| 
42596
 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 
wenzelm 
parents: 
40879 
diff
changeset
 | 
178  | 
    style: (@{syntax name} +)
 | 
| 
55112
 
b1a5d603fd12
prefer rail cartouche -- avoid back-slashed quotes;
 
wenzelm 
parents: 
55029 
diff
changeset
 | 
179  | 
\<close>}  | 
| 27043 | 180  | 
|
181  | 
  Note that the syntax of antiquotations may \emph{not} include source
 | 
|
| 
28749
 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 
wenzelm 
parents: 
28747 
diff
changeset
 | 
182  | 
  comments @{verbatim "(*"}~@{text "\<dots>"}~@{verbatim "*)"} nor verbatim
 | 
| 58725 | 183  | 
  text @{verbatim "{*"}~@{text "\<dots>"}~@{verbatim "*}"}.
 | 
| 27043 | 184  | 
|
| 61439 | 185  | 
  \<^descr> @{command "print_antiquotations"} prints all document antiquotations
 | 
| 
59917
 
9830c944670f
more uniform "verbose" option to print name space;
 
wenzelm 
parents: 
59783 
diff
changeset
 | 
186  | 
  that are defined in the current context; the ``@{text "!"}'' option
 | 
| 
 
9830c944670f
more uniform "verbose" option to print name space;
 
wenzelm 
parents: 
59783 
diff
changeset
 | 
187  | 
indicates extra verbosity.  | 
| 
 
9830c944670f
more uniform "verbose" option to print name space;
 
wenzelm 
parents: 
59783 
diff
changeset
 | 
188  | 
|
| 61439 | 189  | 
  \<^descr> @{text "@{theory A}"} prints the name @{text "A"}, which is
 | 
| 27043 | 190  | 
guaranteed to refer to a valid ancestor theory in the current  | 
191  | 
context.  | 
|
192  | 
||
| 61439 | 193  | 
  \<^descr> @{text "@{thm a\<^sub>1 \<dots> a\<^sub>n}"} prints theorems @{text "a\<^sub>1 \<dots> a\<^sub>n"}.
 | 
| 
28749
 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 
wenzelm 
parents: 
28747 
diff
changeset
 | 
194  | 
Full fact expressions are allowed here, including attributes  | 
| 
 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 
wenzelm 
parents: 
28747 
diff
changeset
 | 
195  | 
  (\secref{sec:syn-att}).
 | 
| 27043 | 196  | 
|
| 61439 | 197  | 
  \<^descr> @{text "@{prop \<phi>}"} prints a well-typed proposition @{text
 | 
| 27043 | 198  | 
"\<phi>"}.  | 
199  | 
||
| 61439 | 200  | 
  \<^descr> @{text "@{lemma \<phi> by m}"} proves a well-typed proposition
 | 
| 
28749
 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 
wenzelm 
parents: 
28747 
diff
changeset
 | 
201  | 
  @{text "\<phi>"} by method @{text m} and prints the original @{text "\<phi>"}.
 | 
| 27453 | 202  | 
|
| 61439 | 203  | 
  \<^descr> @{text "@{term t}"} prints a well-typed term @{text "t"}.
 | 
| 
43613
 
7afbaf5a406b
adding a minimalistic documentation of the value antiquotation in the Isar reference manual
 
bulwahn 
parents: 
42936 
diff
changeset
 | 
204  | 
|
| 61439 | 205  | 
  \<^descr> @{text "@{value t}"} evaluates a term @{text "t"} and prints
 | 
| 43618 | 206  | 
  its result, see also @{command_ref (HOL) value}.
 | 
| 27043 | 207  | 
|
| 61439 | 208  | 
  \<^descr> @{text "@{term_type t}"} prints a well-typed term @{text "t"}
 | 
| 
32898
 
e871d897969c
term styles also cover antiquotations term_type and typeof
 
haftmann 
parents: 
32892 
diff
changeset
 | 
209  | 
annotated with its type.  | 
| 
 
e871d897969c
term styles also cover antiquotations term_type and typeof
 
haftmann 
parents: 
32892 
diff
changeset
 | 
210  | 
|
| 61439 | 211  | 
  \<^descr> @{text "@{typeof t}"} prints the type of a well-typed term
 | 
| 
32898
 
e871d897969c
term styles also cover antiquotations term_type and typeof
 
haftmann 
parents: 
32892 
diff
changeset
 | 
212  | 
  @{text "t"}.
 | 
| 
 
e871d897969c
term styles also cover antiquotations term_type and typeof
 
haftmann 
parents: 
32892 
diff
changeset
 | 
213  | 
|
| 61439 | 214  | 
  \<^descr> @{text "@{const c}"} prints a logical or syntactic constant
 | 
| 27043 | 215  | 
  @{text "c"}.
 | 
216  | 
||
| 61439 | 217  | 
  \<^descr> @{text "@{abbrev c x\<^sub>1 \<dots> x\<^sub>n}"} prints a constant abbreviation
 | 
| 
28760
 
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
 
wenzelm 
parents: 
28750 
diff
changeset
 | 
218  | 
  @{text "c x\<^sub>1 \<dots> x\<^sub>n \<equiv> rhs"} as defined in the current context.
 | 
| 
39305
 
d4fa19eb0822
'class' and 'type' are now antiquoations by default
 
haftmann 
parents: 
32898 
diff
changeset
 | 
219  | 
|
| 61439 | 220  | 
  \<^descr> @{text "@{typ \<tau>}"} prints a well-formed type @{text "\<tau>"}.
 | 
| 
39305
 
d4fa19eb0822
'class' and 'type' are now antiquoations by default
 
haftmann 
parents: 
32898 
diff
changeset
 | 
221  | 
|
| 61439 | 222  | 
  \<^descr> @{text "@{type \<kappa>}"} prints a (logical or syntactic) type
 | 
| 
39689
 
78b185bf7660
clarified @{type} antiquotation: abbreviations and nonterminals count as "syntactic", disallow TFrees;
 
wenzelm 
parents: 
39305 
diff
changeset
 | 
223  | 
    constructor @{text "\<kappa>"}.
 | 
| 
39305
 
d4fa19eb0822
'class' and 'type' are now antiquoations by default
 
haftmann 
parents: 
32898 
diff
changeset
 | 
224  | 
|
| 61439 | 225  | 
  \<^descr> @{text "@{class c}"} prints a class @{text c}.
 | 
| 
39305
 
d4fa19eb0822
'class' and 'type' are now antiquoations by default
 
haftmann 
parents: 
32898 
diff
changeset
 | 
226  | 
|
| 61439 | 227  | 
  \<^descr> @{text "@{text s}"} prints uninterpreted source text @{text
 | 
| 27043 | 228  | 
s}. This is particularly useful to print portions of text according  | 
| 
28749
 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 
wenzelm 
parents: 
28747 
diff
changeset
 | 
229  | 
to the Isabelle document style, without demanding well-formedness,  | 
| 
 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 
wenzelm 
parents: 
28747 
diff
changeset
 | 
230  | 
e.g.\ small pieces of terms that should not be parsed or  | 
| 
 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 
wenzelm 
parents: 
28747 
diff
changeset
 | 
231  | 
type-checked yet.  | 
| 27043 | 232  | 
|
| 61439 | 233  | 
  \<^descr> @{text "@{goals}"} prints the current \emph{dynamic} goal
 | 
| 27043 | 234  | 
state. This is mainly for support of tactic-emulation scripts  | 
| 
28749
 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 
wenzelm 
parents: 
28747 
diff
changeset
 | 
235  | 
within Isar. Presentation of goal states does not conform to the  | 
| 
 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 
wenzelm 
parents: 
28747 
diff
changeset
 | 
236  | 
idea of human-readable proof documents!  | 
| 27043 | 237  | 
|
| 
28749
 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 
wenzelm 
parents: 
28747 
diff
changeset
 | 
238  | 
When explaining proofs in detail it is usually better to spell out  | 
| 
 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 
wenzelm 
parents: 
28747 
diff
changeset
 | 
239  | 
the reasoning via proper Isar proof commands, instead of peeking at  | 
| 
 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 
wenzelm 
parents: 
28747 
diff
changeset
 | 
240  | 
the internal machine configuration.  | 
| 27043 | 241  | 
|
| 61439 | 242  | 
  \<^descr> @{text "@{subgoals}"} is similar to @{text "@{goals}"}, but
 | 
| 27043 | 243  | 
does not print the main goal.  | 
244  | 
||
| 61439 | 245  | 
  \<^descr> @{text "@{prf a\<^sub>1 \<dots> a\<^sub>n}"} prints the (compact) proof terms
 | 
| 
28749
 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 
wenzelm 
parents: 
28747 
diff
changeset
 | 
246  | 
  corresponding to the theorems @{text "a\<^sub>1 \<dots> a\<^sub>n"}. Note that this
 | 
| 
 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 
wenzelm 
parents: 
28747 
diff
changeset
 | 
247  | 
requires proof terms to be switched on for the current logic  | 
| 
 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 
wenzelm 
parents: 
28747 
diff
changeset
 | 
248  | 
session.  | 
| 27043 | 249  | 
|
| 61439 | 250  | 
  \<^descr> @{text "@{full_prf a\<^sub>1 \<dots> a\<^sub>n}"} is like @{text "@{prf a\<^sub>1 \<dots>
 | 
| 
28760
 
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
 
wenzelm 
parents: 
28750 
diff
changeset
 | 
251  | 
a\<^sub>n}"}, but prints the full proof terms, i.e.\ also displays  | 
| 
 
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
 
wenzelm 
parents: 
28750 
diff
changeset
 | 
252  | 
information omitted in the compact proof term, which is denoted by  | 
| 
 
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
 
wenzelm 
parents: 
28750 
diff
changeset
 | 
253  | 
  ``@{text _}'' placeholders there.
 | 
| 27043 | 254  | 
|
| 61439 | 255  | 
  \<^descr> @{text "@{ML s}"}, @{text "@{ML_op s}"}, @{text "@{ML_type
 | 
| 55837 | 256  | 
  s}"}, @{text "@{ML_structure s}"}, and @{text "@{ML_functor s}"}
 | 
257  | 
  check text @{text s} as ML value, infix operator, type, structure,
 | 
|
258  | 
and functor respectively. The source is printed verbatim.  | 
|
| 27043 | 259  | 
|
| 61439 | 260  | 
  \<^descr> @{text "@{verbatim s}"} prints uninterpreted source text literally
 | 
| 
58716
 
23a380cc45f4
official support for "tt" style variants, avoid fragile \verb in LaTeX;
 
wenzelm 
parents: 
58618 
diff
changeset
 | 
261  | 
as ASCII characters, using some type-writer font style.  | 
| 
 
23a380cc45f4
official support for "tt" style variants, avoid fragile \verb in LaTeX;
 
wenzelm 
parents: 
58618 
diff
changeset
 | 
262  | 
|
| 61439 | 263  | 
  \<^descr> @{text "@{file path}"} checks that @{text "path"} refers to a
 | 
| 40801 | 264  | 
file (or directory) and prints it verbatim.  | 
265  | 
||
| 61439 | 266  | 
  \<^descr> @{text "@{file_unchecked path}"} is like @{text "@{file
 | 
| 54705 | 267  | 
  path}"}, but does not check the existence of the @{text "path"}
 | 
268  | 
within the file-system.  | 
|
269  | 
||
| 61439 | 270  | 
  \<^descr> @{text "@{url name}"} produces markup for the given URL, which
 | 
| 
54702
 
3daeba5130f0
added document antiquotation @{url}, which produces formal markup for LaTeX and PIDE;
 
wenzelm 
parents: 
54346 
diff
changeset
 | 
271  | 
results in an active hyperlink within the text.  | 
| 
 
3daeba5130f0
added document antiquotation @{url}, which produces formal markup for LaTeX and PIDE;
 
wenzelm 
parents: 
54346 
diff
changeset
 | 
272  | 
|
| 61439 | 273  | 
  \<^descr> @{text "@{cite name}"} produces a citation @{verbatim
 | 
| 58724 | 274  | 
  \<open>\cite{name}\<close>} in {\LaTeX}, where the name refers to some Bib{\TeX}
 | 
| 58593 | 275  | 
database entry.  | 
276  | 
||
277  | 
  The variant @{text "@{cite \<open>opt\<close> name}"} produces @{verbatim
 | 
|
| 58724 | 278  | 
  \<open>\cite[opt]{name}\<close>} with some free-form optional argument. Multiple names
 | 
| 58593 | 279  | 
  are output with commas, e.g. @{text "@{cite foo \<AND> bar}"} becomes
 | 
| 58724 | 280  | 
  @{verbatim \<open>\cite{foo,bar}\<close>}.
 | 
| 58593 | 281  | 
|
282  | 
  The {\LaTeX} macro name is determined by the antiquotation option
 | 
|
283  | 
  @{antiquotation_option_def cite_macro}, or the configuration option
 | 
|
284  | 
  @{attribute cite_macro} in the context. For example, @{text "@{cite
 | 
|
| 58724 | 285  | 
  [cite_macro = nocite] foobar}"} produces @{verbatim \<open>\nocite{foobar}\<close>}.
 | 
| 58618 | 286  | 
\<close>  | 
| 27043 | 287  | 
|
| 
28749
 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 
wenzelm 
parents: 
28747 
diff
changeset
 | 
288  | 
|
| 58618 | 289  | 
subsection \<open>Styled antiquotations\<close>  | 
| 
28749
 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 
wenzelm 
parents: 
28747 
diff
changeset
 | 
290  | 
|
| 58618 | 291  | 
text \<open>The antiquotations @{text thm}, @{text prop} and @{text
 | 
| 32891 | 292  | 
  term} admit an extra \emph{style} specification to modify the
 | 
293  | 
printed result. A style is specified by a name with a possibly  | 
|
294  | 
empty number of arguments; multiple styles can be sequenced with  | 
|
295  | 
commas. The following standard styles are available:  | 
|
| 27043 | 296  | 
|
| 61439 | 297  | 
  \<^descr> @{text lhs} extracts the first argument of any application
 | 
| 
28749
 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 
wenzelm 
parents: 
28747 
diff
changeset
 | 
298  | 
form with at least two arguments --- typically meta-level or  | 
| 27043 | 299  | 
object-level equality, or any other binary relation.  | 
300  | 
||
| 61439 | 301  | 
  \<^descr> @{text rhs} is like @{text lhs}, but extracts the second
 | 
| 27043 | 302  | 
argument.  | 
303  | 
||
| 61439 | 304  | 
  \<^descr> @{text "concl"} extracts the conclusion @{text C} from a rule
 | 
| 27043 | 305  | 
  in Horn-clause normal form @{text "A\<^sub>1 \<Longrightarrow> \<dots> A\<^sub>n \<Longrightarrow> C"}.
 | 
306  | 
||
| 61439 | 307  | 
  \<^descr> @{text "prem"} @{text n} extract premise number
 | 
| 32891 | 308  | 
  @{text "n"} from from a rule in Horn-clause
 | 
| 
28760
 
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
 
wenzelm 
parents: 
28750 
diff
changeset
 | 
309  | 
  normal form @{text "A\<^sub>1 \<Longrightarrow> \<dots> A\<^sub>n \<Longrightarrow> C"}
 | 
| 58618 | 310  | 
\<close>  | 
| 27043 | 311  | 
|
| 
28749
 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 
wenzelm 
parents: 
28747 
diff
changeset
 | 
312  | 
|
| 58618 | 313  | 
subsection \<open>General options\<close>  | 
| 
28749
 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 
wenzelm 
parents: 
28747 
diff
changeset
 | 
314  | 
|
| 58618 | 315  | 
text \<open>The following options are available to tune the printed output  | 
| 54346 | 316  | 
of antiquotations. Note that many of these coincide with system and  | 
317  | 
configuration options of the same names.  | 
|
| 27043 | 318  | 
|
| 61439 | 319  | 
  \<^descr> @{antiquotation_option_def show_types}~@{text "= bool"} and
 | 
| 30397 | 320  | 
  @{antiquotation_option_def show_sorts}~@{text "= bool"} control
 | 
321  | 
printing of explicit type and sort constraints.  | 
|
| 27043 | 322  | 
|
| 61439 | 323  | 
  \<^descr> @{antiquotation_option_def show_structs}~@{text "= bool"}
 | 
| 30397 | 324  | 
controls printing of implicit structures.  | 
| 27043 | 325  | 
|
| 61439 | 326  | 
  \<^descr> @{antiquotation_option_def show_abbrevs}~@{text "= bool"}
 | 
| 
40879
 
ca132ef44944
configuration option "show_abbrevs" supersedes print mode "no_abbrevs", with inverted meaning;
 
wenzelm 
parents: 
40801 
diff
changeset
 | 
327  | 
controls folding of abbreviations.  | 
| 
 
ca132ef44944
configuration option "show_abbrevs" supersedes print mode "no_abbrevs", with inverted meaning;
 
wenzelm 
parents: 
40801 
diff
changeset
 | 
328  | 
|
| 61439 | 329  | 
  \<^descr> @{antiquotation_option_def names_long}~@{text "= bool"} forces
 | 
| 30397 | 330  | 
names of types and constants etc.\ to be printed in their fully  | 
331  | 
qualified internal form.  | 
|
| 27043 | 332  | 
|
| 61439 | 333  | 
  \<^descr> @{antiquotation_option_def names_short}~@{text "= bool"}
 | 
| 30397 | 334  | 
forces names of types and constants etc.\ to be printed unqualified.  | 
335  | 
Note that internalizing the output again in the current context may  | 
|
336  | 
well yield a different result.  | 
|
| 27043 | 337  | 
|
| 61439 | 338  | 
  \<^descr> @{antiquotation_option_def names_unique}~@{text "= bool"}
 | 
| 30397 | 339  | 
determines whether the printed version of qualified names should be  | 
340  | 
made sufficiently long to avoid overlap with names declared further  | 
|
341  | 
  back.  Set to @{text false} for more concise output.
 | 
|
| 27043 | 342  | 
|
| 61439 | 343  | 
  \<^descr> @{antiquotation_option_def eta_contract}~@{text "= bool"}
 | 
| 30397 | 344  | 
  prints terms in @{text \<eta>}-contracted form.
 | 
| 27043 | 345  | 
|
| 61439 | 346  | 
  \<^descr> @{antiquotation_option_def display}~@{text "= bool"} indicates
 | 
| 30397 | 347  | 
if the text is to be output as multi-line ``display material'',  | 
348  | 
rather than a small piece of text without line breaks (which is the  | 
|
349  | 
default).  | 
|
| 27043 | 350  | 
|
| 
28749
 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 
wenzelm 
parents: 
28747 
diff
changeset
 | 
351  | 
In this mode the embedded entities are printed in the same style as  | 
| 
 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 
wenzelm 
parents: 
28747 
diff
changeset
 | 
352  | 
the main theory text.  | 
| 
 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 
wenzelm 
parents: 
28747 
diff
changeset
 | 
353  | 
|
| 61439 | 354  | 
  \<^descr> @{antiquotation_option_def break}~@{text "= bool"} controls
 | 
| 30397 | 355  | 
line breaks in non-display material.  | 
| 27043 | 356  | 
|
| 61439 | 357  | 
  \<^descr> @{antiquotation_option_def quotes}~@{text "= bool"} indicates
 | 
| 30397 | 358  | 
if the output should be enclosed in double quotes.  | 
| 27043 | 359  | 
|
| 61439 | 360  | 
  \<^descr> @{antiquotation_option_def mode}~@{text "= name"} adds @{text
 | 
| 30397 | 361  | 
name} to the print mode to be used for presentation. Note that the  | 
362  | 
  standard setup for {\LaTeX} output is already present by default,
 | 
|
363  | 
  including the modes @{text latex} and @{text xsymbols}.
 | 
|
| 27043 | 364  | 
|
| 61439 | 365  | 
  \<^descr> @{antiquotation_option_def margin}~@{text "= nat"} and
 | 
| 30397 | 366  | 
  @{antiquotation_option_def indent}~@{text "= nat"} change the margin
 | 
367  | 
or indentation for pretty printing of display material.  | 
|
| 27043 | 368  | 
|
| 61439 | 369  | 
  \<^descr> @{antiquotation_option_def goals_limit}~@{text "= nat"}
 | 
| 
51960
 
61ac1efe02c3
option "goals_limit", with more uniform description;
 
wenzelm 
parents: 
51057 
diff
changeset
 | 
370  | 
determines the maximum number of subgoals to be printed (for goal-based  | 
| 30397 | 371  | 
antiquotation).  | 
| 27043 | 372  | 
|
| 61439 | 373  | 
  \<^descr> @{antiquotation_option_def source}~@{text "= bool"} prints the
 | 
| 30397 | 374  | 
original source text of the antiquotation arguments, rather than its  | 
375  | 
internal representation. Note that formal checking of  | 
|
376  | 
  @{antiquotation "thm"}, @{antiquotation "term"}, etc. is still
 | 
|
377  | 
  enabled; use the @{antiquotation "text"} antiquotation for unchecked
 | 
|
378  | 
output.  | 
|
| 
28749
 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 
wenzelm 
parents: 
28747 
diff
changeset
 | 
379  | 
|
| 
 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 
wenzelm 
parents: 
28747 
diff
changeset
 | 
380  | 
  Regular @{text "term"} and @{text "typ"} antiquotations with @{text
 | 
| 
 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 
wenzelm 
parents: 
28747 
diff
changeset
 | 
381  | 
"source = false"} involve a full round-trip from the original source  | 
| 
 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 
wenzelm 
parents: 
28747 
diff
changeset
 | 
382  | 
to an internalized logical entity back to a source form, according  | 
| 
 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 
wenzelm 
parents: 
28747 
diff
changeset
 | 
383  | 
to the syntax of the current context. Thus the printed output is  | 
| 
 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 
wenzelm 
parents: 
28747 
diff
changeset
 | 
384  | 
not under direct control of the author, it may even fluctuate a bit  | 
| 
 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 
wenzelm 
parents: 
28747 
diff
changeset
 | 
385  | 
as the underlying theory is changed later on.  | 
| 
 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 
wenzelm 
parents: 
28747 
diff
changeset
 | 
386  | 
|
| 42626 | 387  | 
  In contrast, @{antiquotation_option source}~@{text "= true"}
 | 
| 30397 | 388  | 
admits direct printing of the given source text, with the desirable  | 
389  | 
well-formedness check in the background, but without modification of  | 
|
390  | 
the printed text.  | 
|
| 
28749
 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 
wenzelm 
parents: 
28747 
diff
changeset
 | 
391  | 
|
| 27043 | 392  | 
|
| 56594 | 393  | 
  For Boolean flags, ``@{text "name = true"}'' may be abbreviated as
 | 
| 27043 | 394  | 
  ``@{text name}''.  All of the above flags are disabled by default,
 | 
| 51057 | 395  | 
unless changed specifically for a logic session in the corresponding  | 
| 61458 | 396  | 
  @{verbatim "ROOT"} file.
 | 
397  | 
\<close>  | 
|
| 27043 | 398  | 
|
399  | 
||
| 58618 | 400  | 
section \<open>Markup via command tags \label{sec:tags}\<close>
 | 
| 27043 | 401  | 
|
| 58618 | 402  | 
text \<open>Each Isabelle/Isar command may be decorated by additional  | 
| 28750 | 403  | 
presentation tags, to indicate some modification in the way it is  | 
404  | 
printed in the document.  | 
|
| 27043 | 405  | 
|
| 
55112
 
b1a5d603fd12
prefer rail cartouche -- avoid back-slashed quotes;
 
wenzelm 
parents: 
55029 
diff
changeset
 | 
406  | 
  @{rail \<open>
 | 
| 
42596
 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 
wenzelm 
parents: 
40879 
diff
changeset
 | 
407  | 
    @{syntax_def tags}: ( tag * )
 | 
| 27043 | 408  | 
;  | 
| 
42596
 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 
wenzelm 
parents: 
40879 
diff
changeset
 | 
409  | 
    tag: '%' (@{syntax ident} | @{syntax string})
 | 
| 
55112
 
b1a5d603fd12
prefer rail cartouche -- avoid back-slashed quotes;
 
wenzelm 
parents: 
55029 
diff
changeset
 | 
410  | 
\<close>}  | 
| 27043 | 411  | 
|
| 28750 | 412  | 
Some tags are pre-declared for certain classes of commands, serving  | 
413  | 
as default markup if no tags are given in the text:  | 
|
| 27043 | 414  | 
|
| 61421 | 415  | 
\<^medskip>  | 
| 27043 | 416  | 
  \begin{tabular}{ll}
 | 
417  | 
    @{text "theory"} & theory begin/end \\
 | 
|
418  | 
    @{text "proof"} & all proof commands \\
 | 
|
419  | 
    @{text "ML"} & all commands involving ML code \\
 | 
|
420  | 
  \end{tabular}
 | 
|
| 61421 | 421  | 
\<^medskip>  | 
| 27043 | 422  | 
|
| 61421 | 423  | 
The Isabelle document preparation system  | 
| 60270 | 424  | 
  @{cite "isabelle-system"} allows tagged command regions to be presented
 | 
| 27043 | 425  | 
specifically, e.g.\ to fold proof texts, or drop parts of the text  | 
426  | 
completely.  | 
|
427  | 
||
| 28750 | 428  | 
  For example ``@{command "by"}~@{text "%invisible auto"}'' causes
 | 
429  | 
  that piece of proof to be treated as @{text invisible} instead of
 | 
|
430  | 
  @{text "proof"} (the default), which may be shown or hidden
 | 
|
| 27043 | 431  | 
  depending on the document setup.  In contrast, ``@{command
 | 
| 28750 | 432  | 
  "by"}~@{text "%visible auto"}'' forces this text to be shown
 | 
| 27043 | 433  | 
invariably.  | 
434  | 
||
435  | 
Explicit tag specifications within a proof apply to all subsequent  | 
|
436  | 
  commands of the same level of nesting.  For example, ``@{command
 | 
|
| 28750 | 437  | 
  "proof"}~@{text "%visible \<dots>"}~@{command "qed"}'' forces the whole
 | 
438  | 
  sub-proof to be typeset as @{text visible} (unless some of its parts
 | 
|
439  | 
are tagged differently).  | 
|
440  | 
||
| 61421 | 441  | 
\<^medskip>  | 
442  | 
Command tags merely produce certain markup environments for  | 
|
| 28750 | 443  | 
  type-setting.  The meaning of these is determined by {\LaTeX}
 | 
| 
40800
 
330eb65c9469
Parse.liberal_name for document antiquotations and attributes;
 
wenzelm 
parents: 
40255 
diff
changeset
 | 
444  | 
  macros, as defined in @{file "~~/lib/texinputs/isabelle.sty"} or
 | 
| 28750 | 445  | 
by the document author. The Isabelle document preparation tools  | 
446  | 
also provide some high-level options to specify the meaning of  | 
|
447  | 
arbitrary tags to ``keep'', ``drop'', or ``fold'' the corresponding  | 
|
448  | 
parts of the text. Logic sessions may also specify ``document  | 
|
449  | 
versions'', where given tags are interpreted in some particular way.  | 
|
| 60270 | 450  | 
  Again see @{cite "isabelle-system"} for further details.
 | 
| 58618 | 451  | 
\<close>  | 
| 27043 | 452  | 
|
453  | 
||
| 58618 | 454  | 
section \<open>Railroad diagrams\<close>  | 
| 42658 | 455  | 
|
| 58618 | 456  | 
text \<open>  | 
| 42658 | 457  | 
  \begin{matharray}{rcl}
 | 
458  | 
    @{antiquotation_def "rail"} & : & @{text antiquotation} \\
 | 
|
459  | 
  \end{matharray}
 | 
|
460  | 
||
| 55113 | 461  | 
  @{rail \<open>
 | 
| 59937 | 462  | 
    'rail' @{syntax text}
 | 
| 55113 | 463  | 
\<close>}  | 
| 42658 | 464  | 
|
465  | 
  The @{antiquotation rail} antiquotation allows to include syntax
 | 
|
466  | 
  diagrams into Isabelle documents.  {\LaTeX} requires the style file
 | 
|
| 59116 | 467  | 
  @{file "~~/lib/texinputs/railsetup.sty"}, which can be used via
 | 
468  | 
  @{verbatim \<open>\usepackage{railsetup}\<close>} in @{verbatim "root.tex"}, for
 | 
|
| 42658 | 469  | 
example.  | 
470  | 
||
471  | 
  The rail specification language is quoted here as Isabelle @{syntax
 | 
|
| 55120 | 472  | 
  string} or text @{syntax "cartouche"}; it has its own grammar given
 | 
473  | 
below.  | 
|
| 42658 | 474  | 
|
| 55120 | 475  | 
\begingroup  | 
476  | 
  \def\isasymnewline{\isatext{\tt\isacharbackslash<newline>}}
 | 
|
| 
55112
 
b1a5d603fd12
prefer rail cartouche -- avoid back-slashed quotes;
 
wenzelm 
parents: 
55029 
diff
changeset
 | 
477  | 
  @{rail \<open>
 | 
| 42658 | 478  | 
rule? + ';'  | 
479  | 
;  | 
|
480  | 
  rule: ((identifier | @{syntax antiquotation}) ':')? body
 | 
|
481  | 
;  | 
|
482  | 
body: concatenation + '|'  | 
|
483  | 
;  | 
|
484  | 
  concatenation: ((atom '?'?) +) (('*' | '+') atom?)?
 | 
|
485  | 
;  | 
|
486  | 
  atom: '(' body? ')' | identifier |
 | 
|
487  | 
    '@'? (string | @{syntax antiquotation}) |
 | 
|
| 
55112
 
b1a5d603fd12
prefer rail cartouche -- avoid back-slashed quotes;
 
wenzelm 
parents: 
55029 
diff
changeset
 | 
488  | 
'\<newline>'  | 
| 
 
b1a5d603fd12
prefer rail cartouche -- avoid back-slashed quotes;
 
wenzelm 
parents: 
55029 
diff
changeset
 | 
489  | 
\<close>}  | 
| 55120 | 490  | 
\endgroup  | 
| 42658 | 491  | 
|
492  | 
  The lexical syntax of @{text "identifier"} coincides with that of
 | 
|
493  | 
  @{syntax ident} in regular Isabelle syntax, but @{text string} uses
 | 
|
494  | 
  single quotes instead of double quotes of the standard @{syntax
 | 
|
| 55113 | 495  | 
string} category.  | 
| 42658 | 496  | 
|
497  | 
  Each @{text rule} defines a formal language (with optional name),
 | 
|
498  | 
using a notation that is similar to EBNF or regular expressions with  | 
|
499  | 
recursion. The meaning and visual appearance of these rail language  | 
|
500  | 
elements is illustrated by the following representative examples.  | 
|
501  | 
||
| 61421 | 502  | 
  \<^item> Empty @{verbatim "()"}
 | 
| 42658 | 503  | 
|
| 
55112
 
b1a5d603fd12
prefer rail cartouche -- avoid back-slashed quotes;
 
wenzelm 
parents: 
55029 
diff
changeset
 | 
504  | 
  @{rail \<open>()\<close>}
 | 
| 42658 | 505  | 
|
| 61421 | 506  | 
  \<^item> Nonterminal @{verbatim "A"}
 | 
| 42658 | 507  | 
|
| 
55112
 
b1a5d603fd12
prefer rail cartouche -- avoid back-slashed quotes;
 
wenzelm 
parents: 
55029 
diff
changeset
 | 
508  | 
  @{rail \<open>A\<close>}
 | 
| 42658 | 509  | 
|
| 61421 | 510  | 
\<^item> Nonterminal via Isabelle antiquotation  | 
| 42658 | 511  | 
  @{verbatim "@{syntax method}"}
 | 
512  | 
||
| 
55112
 
b1a5d603fd12
prefer rail cartouche -- avoid back-slashed quotes;
 
wenzelm 
parents: 
55029 
diff
changeset
 | 
513  | 
  @{rail \<open>@{syntax method}\<close>}
 | 
| 42658 | 514  | 
|
| 61421 | 515  | 
  \<^item> Terminal @{verbatim "'xyz'"}
 | 
| 42658 | 516  | 
|
| 
55112
 
b1a5d603fd12
prefer rail cartouche -- avoid back-slashed quotes;
 
wenzelm 
parents: 
55029 
diff
changeset
 | 
517  | 
  @{rail \<open>'xyz'\<close>}
 | 
| 42658 | 518  | 
|
| 61421 | 519  | 
  \<^item> Terminal in keyword style @{verbatim "@'xyz'"}
 | 
| 42658 | 520  | 
|
| 
55112
 
b1a5d603fd12
prefer rail cartouche -- avoid back-slashed quotes;
 
wenzelm 
parents: 
55029 
diff
changeset
 | 
521  | 
  @{rail \<open>@'xyz'\<close>}
 | 
| 42658 | 522  | 
|
| 61421 | 523  | 
\<^item> Terminal via Isabelle antiquotation  | 
| 42658 | 524  | 
  @{verbatim "@@{method rule}"}
 | 
525  | 
||
| 
55112
 
b1a5d603fd12
prefer rail cartouche -- avoid back-slashed quotes;
 
wenzelm 
parents: 
55029 
diff
changeset
 | 
526  | 
  @{rail \<open>@@{method rule}\<close>}
 | 
| 42658 | 527  | 
|
| 61421 | 528  | 
  \<^item> Concatenation @{verbatim "A B C"}
 | 
| 42658 | 529  | 
|
| 
55112
 
b1a5d603fd12
prefer rail cartouche -- avoid back-slashed quotes;
 
wenzelm 
parents: 
55029 
diff
changeset
 | 
530  | 
  @{rail \<open>A B C\<close>}
 | 
| 42658 | 531  | 
|
| 61421 | 532  | 
\<^item> Newline inside concatenation  | 
| 
55029
 
61a6bf7d4b02
clarified @{rail} syntax: prefer explicit \<newline> symbol;
 
wenzelm 
parents: 
54705 
diff
changeset
 | 
533  | 
  @{verbatim "A B C \<newline> D E F"}
 | 
| 42658 | 534  | 
|
| 
55112
 
b1a5d603fd12
prefer rail cartouche -- avoid back-slashed quotes;
 
wenzelm 
parents: 
55029 
diff
changeset
 | 
535  | 
  @{rail \<open>A B C \<newline> D E F\<close>}
 | 
| 42658 | 536  | 
|
| 61421 | 537  | 
  \<^item> Variants @{verbatim "A | B | C"}
 | 
| 42658 | 538  | 
|
| 
55112
 
b1a5d603fd12
prefer rail cartouche -- avoid back-slashed quotes;
 
wenzelm 
parents: 
55029 
diff
changeset
 | 
539  | 
  @{rail \<open>A | B | C\<close>}
 | 
| 42658 | 540  | 
|
| 61421 | 541  | 
  \<^item> Option @{verbatim "A ?"}
 | 
| 42658 | 542  | 
|
| 
55112
 
b1a5d603fd12
prefer rail cartouche -- avoid back-slashed quotes;
 
wenzelm 
parents: 
55029 
diff
changeset
 | 
543  | 
  @{rail \<open>A ?\<close>}
 | 
| 42658 | 544  | 
|
| 61421 | 545  | 
  \<^item> Repetition @{verbatim "A *"}
 | 
| 42658 | 546  | 
|
| 
55112
 
b1a5d603fd12
prefer rail cartouche -- avoid back-slashed quotes;
 
wenzelm 
parents: 
55029 
diff
changeset
 | 
547  | 
  @{rail \<open>A *\<close>}
 | 
| 42658 | 548  | 
|
| 61421 | 549  | 
  \<^item> Repetition with separator @{verbatim "A * sep"}
 | 
| 42658 | 550  | 
|
| 
55112
 
b1a5d603fd12
prefer rail cartouche -- avoid back-slashed quotes;
 
wenzelm 
parents: 
55029 
diff
changeset
 | 
551  | 
  @{rail \<open>A * sep\<close>}
 | 
| 42658 | 552  | 
|
| 61421 | 553  | 
  \<^item> Strict repetition @{verbatim "A +"}
 | 
| 42658 | 554  | 
|
| 
55112
 
b1a5d603fd12
prefer rail cartouche -- avoid back-slashed quotes;
 
wenzelm 
parents: 
55029 
diff
changeset
 | 
555  | 
  @{rail \<open>A +\<close>}
 | 
| 42658 | 556  | 
|
| 61421 | 557  | 
  \<^item> Strict repetition with separator @{verbatim "A + sep"}
 | 
| 42658 | 558  | 
|
| 
55112
 
b1a5d603fd12
prefer rail cartouche -- avoid back-slashed quotes;
 
wenzelm 
parents: 
55029 
diff
changeset
 | 
559  | 
  @{rail \<open>A + sep\<close>}
 | 
| 58618 | 560  | 
\<close>  | 
| 42658 | 561  | 
|
562  | 
||
| 58618 | 563  | 
section \<open>Draft presentation\<close>  | 
| 27043 | 564  | 
|
| 58618 | 565  | 
text \<open>  | 
| 27043 | 566  | 
  \begin{matharray}{rcl}
 | 
| 
28761
 
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
 
wenzelm 
parents: 
28760 
diff
changeset
 | 
567  | 
    @{command_def "display_drafts"}@{text "\<^sup>*"} & : & @{text "any \<rightarrow>"} \\
 | 
| 27043 | 568  | 
  \end{matharray}
 | 
569  | 
||
| 
55112
 
b1a5d603fd12
prefer rail cartouche -- avoid back-slashed quotes;
 
wenzelm 
parents: 
55029 
diff
changeset
 | 
570  | 
  @{rail \<open>
 | 
| 52549 | 571  | 
    @@{command display_drafts} (@{syntax name} +)
 | 
| 
55112
 
b1a5d603fd12
prefer rail cartouche -- avoid back-slashed quotes;
 
wenzelm 
parents: 
55029 
diff
changeset
 | 
572  | 
\<close>}  | 
| 27043 | 573  | 
|
| 61439 | 574  | 
  \<^descr> @{command "display_drafts"}~@{text paths} performs simple output of a
 | 
| 52549 | 575  | 
given list of raw source files. Only those symbols that do not require  | 
576  | 
  additional {\LaTeX} packages are displayed properly, everything else is left
 | 
|
577  | 
verbatim.  | 
|
| 58618 | 578  | 
\<close>  | 
| 27043 | 579  | 
|
580  | 
end  |