| author | wenzelm | 
| Wed, 22 Jun 2011 16:32:36 +0200 | |
| changeset 43506 | bf7400573617 | 
| parent 42936 | 48a0a9db3453 | 
| child 43613 | 7afbaf5a406b | 
| permissions | -rw-r--r-- | 
| 27043 | 1 | theory Document_Preparation | 
| 42651 | 2 | imports Base Main | 
| 27043 | 3 | begin | 
| 4 | ||
| 5 | chapter {* Document preparation \label{ch:document-prep} *}
 | |
| 6 | ||
| 28746 | 7 | text {* Isabelle/Isar provides a simple document preparation system
 | 
| 8 |   based on regular {PDF-\LaTeX} technology, with full support for
 | |
| 9 | hyper-links and bookmarks. Thus the results are well suited for WWW | |
| 10 | browsing and as printed copies. | |
| 27043 | 11 | |
| 28746 | 12 |   \medskip Isabelle generates {\LaTeX} output while running a
 | 
| 27043 | 13 |   \emph{logic session} (see also \cite{isabelle-sys}).  Getting
 | 
| 14 | started with a working configuration for common situations is quite | |
| 15 |   easy by using the Isabelle @{verbatim mkdir} and @{verbatim make}
 | |
| 16 | tools. First invoke | |
| 17 | \begin{ttbox}
 | |
| 28504 
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
 wenzelm parents: 
27881diff
changeset | 18 | isabelle mkdir Foo | 
| 27043 | 19 | \end{ttbox}
 | 
| 28746 | 20 |   to initialize a separate directory for session @{verbatim Foo} (it
 | 
| 21 |   is safe to experiment, since @{verbatim "isabelle mkdir"} never
 | |
| 22 |   overwrites existing files).  Ensure that @{verbatim "Foo/ROOT.ML"}
 | |
| 27043 | 23 | holds ML commands to load all theories required for this session; | 
| 24 |   furthermore @{verbatim "Foo/document/root.tex"} should include any
 | |
| 25 |   special {\LaTeX} macro packages required for your document (the
 | |
| 26 | default is usually sufficient as a start). | |
| 27 | ||
| 28 |   The session is controlled by a separate @{verbatim IsaMakefile}
 | |
| 29 | (with crude source dependencies by default). This file is located | |
| 30 |   one level up from the @{verbatim Foo} directory location.  Now
 | |
| 31 | invoke | |
| 32 | \begin{ttbox}
 | |
| 28504 
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
 wenzelm parents: 
27881diff
changeset | 33 | isabelle make Foo | 
| 27043 | 34 | \end{ttbox}
 | 
| 35 |   to run the @{verbatim Foo} session, with browser information and
 | |
| 36 | document preparation enabled. Unless any errors are reported by | |
| 37 |   Isabelle or {\LaTeX}, the output will appear inside the directory
 | |
| 28746 | 38 |   defined by the @{verbatim ISABELLE_BROWSER_INFO} setting (as
 | 
| 39 | reported by the batch job in verbose mode). | |
| 27043 | 40 | |
| 41 |   \medskip You may also consider to tune the @{verbatim usedir}
 | |
| 28746 | 42 |   options in @{verbatim IsaMakefile}, for example to switch the output
 | 
| 43 |   format between @{verbatim pdf} and @{verbatim dvi}, or activate the
 | |
| 27043 | 44 |   @{verbatim "-D"} option to retain a second copy of the generated
 | 
| 28746 | 45 |   {\LaTeX} sources (for manual inspection or separate runs of
 | 
| 46 |   @{executable latex}).
 | |
| 27043 | 47 | |
| 48 |   \medskip See \emph{The Isabelle System Manual} \cite{isabelle-sys}
 | |
| 49 | for further details on Isabelle logic sessions and theory | |
| 50 |   presentation.  The Isabelle/HOL tutorial \cite{isabelle-hol-book}
 | |
| 28746 | 51 | also covers theory presentation to some extent. | 
| 27043 | 52 | *} | 
| 53 | ||
| 54 | ||
| 55 | section {* Markup commands \label{sec:markup} *}
 | |
| 56 | ||
| 57 | text {*
 | |
| 58 |   \begin{matharray}{rcl}
 | |
| 28761 
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
 wenzelm parents: 
28760diff
changeset | 59 |     @{command_def "header"} & : & @{text "toplevel \<rightarrow> toplevel"} \\[0.5ex]
 | 
| 
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
 wenzelm parents: 
28760diff
changeset | 60 |     @{command_def "chapter"} & : & @{text "local_theory \<rightarrow> local_theory"} \\
 | 
| 
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
 wenzelm parents: 
28760diff
changeset | 61 |     @{command_def "section"} & : & @{text "local_theory \<rightarrow> local_theory"} \\
 | 
| 
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
 wenzelm parents: 
28760diff
changeset | 62 |     @{command_def "subsection"} & : & @{text "local_theory \<rightarrow> local_theory"} \\
 | 
| 
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
 wenzelm parents: 
28760diff
changeset | 63 |     @{command_def "subsubsection"} & : & @{text "local_theory \<rightarrow> local_theory"} \\
 | 
| 
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
 wenzelm parents: 
28760diff
changeset | 64 |     @{command_def "text"} & : & @{text "local_theory \<rightarrow> local_theory"} \\
 | 
| 
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
 wenzelm parents: 
28760diff
changeset | 65 |     @{command_def "text_raw"} & : & @{text "local_theory \<rightarrow> local_theory"} \\[0.5ex]
 | 
| 
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
 wenzelm parents: 
28760diff
changeset | 66 |     @{command_def "sect"} & : & @{text "proof \<rightarrow> proof"} \\
 | 
| 
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
 wenzelm parents: 
28760diff
changeset | 67 |     @{command_def "subsect"} & : & @{text "proof \<rightarrow> proof"} \\
 | 
| 
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
 wenzelm parents: 
28760diff
changeset | 68 |     @{command_def "subsubsect"} & : & @{text "proof \<rightarrow> proof"} \\
 | 
| 
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
 wenzelm parents: 
28760diff
changeset | 69 |     @{command_def "txt"} & : & @{text "proof \<rightarrow> proof"} \\
 | 
| 
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
 wenzelm parents: 
28760diff
changeset | 70 |     @{command_def "txt_raw"} & : & @{text "proof \<rightarrow> proof"} \\
 | 
| 27043 | 71 |   \end{matharray}
 | 
| 72 | ||
| 28747 | 73 | Markup commands provide a structured way to insert text into the | 
| 74 | document generated from a theory. Each markup command takes a | |
| 75 |   single @{syntax text} argument, which is passed as argument to a
 | |
| 76 |   corresponding {\LaTeX} macro.  The default macros provided by
 | |
| 40800 
330eb65c9469
Parse.liberal_name for document antiquotations and attributes;
 wenzelm parents: 
40255diff
changeset | 77 |   @{file "~~/lib/texinputs/isabelle.sty"} can be redefined according
 | 
| 28747 | 78 |   to the needs of the underlying document and {\LaTeX} styles.
 | 
| 79 | ||
| 80 |   Note that formal comments (\secref{sec:comments}) are similar to
 | |
| 81 | markup commands, but have a different status within Isabelle/Isar | |
| 82 | syntax. | |
| 27043 | 83 | |
| 42596 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 wenzelm parents: 
40879diff
changeset | 84 |   @{rail "
 | 
| 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 wenzelm parents: 
40879diff
changeset | 85 |     (@@{command chapter} | @@{command section} | @@{command subsection} |
 | 
| 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 wenzelm parents: 
40879diff
changeset | 86 |       @@{command subsubsection} | @@{command text}) @{syntax target}? @{syntax text}
 | 
| 27043 | 87 | ; | 
| 42596 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 wenzelm parents: 
40879diff
changeset | 88 |     (@@{command header} | @@{command text_raw} | @@{command sect} | @@{command subsect} |
 | 
| 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 wenzelm parents: 
40879diff
changeset | 89 |       @@{command subsubsect} | @@{command txt} | @@{command txt_raw}) @{syntax text}
 | 
| 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 wenzelm parents: 
40879diff
changeset | 90 | "} | 
| 27043 | 91 | |
| 28760 
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
 wenzelm parents: 
28750diff
changeset | 92 |   \begin{description}
 | 
| 27043 | 93 | |
| 28760 
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
 wenzelm parents: 
28750diff
changeset | 94 |   \item @{command header} provides plain text markup just preceding
 | 
| 28747 | 95 |   the formal beginning of a theory.  The corresponding {\LaTeX} macro
 | 
| 96 |   is @{verbatim "\\isamarkupheader"}, which acts like @{command
 | |
| 97 | section} by default. | |
| 27049 | 98 | |
| 28760 
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
 wenzelm parents: 
28750diff
changeset | 99 |   \item @{command chapter}, @{command section}, @{command subsection},
 | 
| 
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
 wenzelm parents: 
28750diff
changeset | 100 |   and @{command subsubsection} mark chapter and section headings
 | 
| 
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
 wenzelm parents: 
28750diff
changeset | 101 | within the main theory body or local theory targets. The | 
| 28747 | 102 |   corresponding {\LaTeX} macros are @{verbatim "\\isamarkupchapter"},
 | 
| 28749 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 103 |   @{verbatim "\\isamarkupsection"}, @{verbatim
 | 
| 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 104 | "\\isamarkupsubsection"} etc. | 
| 28747 | 105 | |
| 28760 
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
 wenzelm parents: 
28750diff
changeset | 106 |   \item @{command sect}, @{command subsect}, and @{command subsubsect}
 | 
| 
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
 wenzelm parents: 
28750diff
changeset | 107 |   mark section headings within proofs.  The corresponding {\LaTeX}
 | 
| 
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
 wenzelm parents: 
28750diff
changeset | 108 |   macros are @{verbatim "\\isamarkupsect"}, @{verbatim
 | 
| 28749 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 109 | "\\isamarkupsubsect"} etc. | 
| 27043 | 110 | |
| 28760 
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
 wenzelm parents: 
28750diff
changeset | 111 |   \item @{command text} and @{command txt} specify paragraphs of plain
 | 
| 
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
 wenzelm parents: 
28750diff
changeset | 112 |   text.  This corresponds to a {\LaTeX} environment @{verbatim
 | 
| 28747 | 113 |   "\\begin{isamarkuptext}"} @{text "\<dots>"} @{verbatim
 | 
| 114 |   "\\end{isamarkuptext}"} etc.
 | |
| 27043 | 115 | |
| 28760 
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
 wenzelm parents: 
28750diff
changeset | 116 |   \item @{command text_raw} and @{command txt_raw} insert {\LaTeX}
 | 
| 28747 | 117 | source into the output, without additional markup. Thus the full | 
| 118 | range of document manipulations becomes available, at the risk of | |
| 119 | messing up document output. | |
| 27043 | 120 | |
| 28760 
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
 wenzelm parents: 
28750diff
changeset | 121 |   \end{description}
 | 
| 27043 | 122 | |
| 28747 | 123 |   Except for @{command "text_raw"} and @{command "txt_raw"}, the text
 | 
| 124 | passed to any of the above markup commands may refer to formal | |
| 28749 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 125 |   entities via \emph{document antiquotations}, see also
 | 
| 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 126 |   \secref{sec:antiq}.  These are interpreted in the present theory or
 | 
| 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 127 |   proof context, or the named @{text "target"}.
 | 
| 27043 | 128 | |
| 129 | \medskip The proof markup commands closely resemble those for theory | |
| 130 | specifications, but have a different formal status and produce | |
| 28749 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 131 |   different {\LaTeX} macros.  The default definitions coincide for
 | 
| 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 132 |   analogous commands such as @{command section} and @{command sect}.
 | 
| 27043 | 133 | *} | 
| 134 | ||
| 135 | ||
| 28749 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 136 | section {* Document Antiquotations \label{sec:antiq} *}
 | 
| 27043 | 137 | |
| 138 | text {*
 | |
| 139 |   \begin{matharray}{rcl}
 | |
| 28761 
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
 wenzelm parents: 
28760diff
changeset | 140 |     @{antiquotation_def "theory"} & : & @{text antiquotation} \\
 | 
| 
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
 wenzelm parents: 
28760diff
changeset | 141 |     @{antiquotation_def "thm"} & : & @{text antiquotation} \\
 | 
| 
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
 wenzelm parents: 
28760diff
changeset | 142 |     @{antiquotation_def "lemma"} & : & @{text antiquotation} \\
 | 
| 
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
 wenzelm parents: 
28760diff
changeset | 143 |     @{antiquotation_def "prop"} & : & @{text antiquotation} \\
 | 
| 
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
 wenzelm parents: 
28760diff
changeset | 144 |     @{antiquotation_def "term"} & : & @{text antiquotation} \\
 | 
| 32898 
e871d897969c
term styles also cover antiquotations term_type and typeof
 haftmann parents: 
32892diff
changeset | 145 |     @{antiquotation_def term_type} & : & @{text antiquotation} \\
 | 
| 
e871d897969c
term styles also cover antiquotations term_type and typeof
 haftmann parents: 
32892diff
changeset | 146 |     @{antiquotation_def typeof} & : & @{text antiquotation} \\
 | 
| 28761 
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
 wenzelm parents: 
28760diff
changeset | 147 |     @{antiquotation_def const} & : & @{text antiquotation} \\
 | 
| 
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
 wenzelm parents: 
28760diff
changeset | 148 |     @{antiquotation_def abbrev} & : & @{text antiquotation} \\
 | 
| 
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
 wenzelm parents: 
28760diff
changeset | 149 |     @{antiquotation_def typ} & : & @{text antiquotation} \\
 | 
| 39305 
d4fa19eb0822
'class' and 'type' are now antiquoations by default
 haftmann parents: 
32898diff
changeset | 150 |     @{antiquotation_def type} & : & @{text antiquotation} \\
 | 
| 
d4fa19eb0822
'class' and 'type' are now antiquoations by default
 haftmann parents: 
32898diff
changeset | 151 |     @{antiquotation_def class} & : & @{text antiquotation} \\
 | 
| 28761 
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
 wenzelm parents: 
28760diff
changeset | 152 |     @{antiquotation_def "text"} & : & @{text antiquotation} \\
 | 
| 
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
 wenzelm parents: 
28760diff
changeset | 153 |     @{antiquotation_def goals} & : & @{text antiquotation} \\
 | 
| 
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
 wenzelm parents: 
28760diff
changeset | 154 |     @{antiquotation_def subgoals} & : & @{text antiquotation} \\
 | 
| 
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
 wenzelm parents: 
28760diff
changeset | 155 |     @{antiquotation_def prf} & : & @{text antiquotation} \\
 | 
| 
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
 wenzelm parents: 
28760diff
changeset | 156 |     @{antiquotation_def full_prf} & : & @{text antiquotation} \\
 | 
| 
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
 wenzelm parents: 
28760diff
changeset | 157 |     @{antiquotation_def ML} & : & @{text antiquotation} \\
 | 
| 
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
 wenzelm parents: 
28760diff
changeset | 158 |     @{antiquotation_def ML_type} & : & @{text antiquotation} \\
 | 
| 
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
 wenzelm parents: 
28760diff
changeset | 159 |     @{antiquotation_def ML_struct} & : & @{text antiquotation} \\
 | 
| 40801 | 160 |     @{antiquotation_def "file"} & : & @{text antiquotation} \\
 | 
| 27043 | 161 |   \end{matharray}
 | 
| 162 | ||
| 28749 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 163 | The overall content of an Isabelle/Isar theory may alternate between | 
| 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 164 | formal and informal text. The main body consists of formal | 
| 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 165 | specification and proof commands, interspersed with markup commands | 
| 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 166 |   (\secref{sec:markup}) or document comments (\secref{sec:comments}).
 | 
| 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 167 | The argument of markup commands quotes informal text to be printed | 
| 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 168 | in the resulting document, but may again refer to formal entities | 
| 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 169 |   via \emph{document antiquotations}.
 | 
| 27043 | 170 | |
| 28749 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 171 |   For example, embedding of ``@{text [source=false] "@{term [show_types] \"f x = a + x\"}"}''
 | 
| 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 172 | within a text block makes | 
| 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 173 |   \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: 
28747diff
changeset | 174 | |
| 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 175 | Antiquotations usually spare the author tedious typing of logical | 
| 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 176 | entities in full detail. Even more importantly, some degree of | 
| 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 177 | consistency-checking between the main body of formal text and its | 
| 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 178 | informal explanation is achieved, since terms and types appearing in | 
| 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 179 | antiquotations are checked within the current theory or proof | 
| 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 180 | context. | 
| 27043 | 181 | |
| 42596 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 wenzelm parents: 
40879diff
changeset | 182 |   @{rail "
 | 
| 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 wenzelm parents: 
40879diff
changeset | 183 |     '@{' antiquotation '}'
 | 
| 27043 | 184 | ; | 
| 42596 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 wenzelm parents: 
40879diff
changeset | 185 |     @{syntax_def antiquotation}:
 | 
| 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 wenzelm parents: 
40879diff
changeset | 186 |       @@{antiquotation theory} options @{syntax name} |
 | 
| 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 wenzelm parents: 
40879diff
changeset | 187 |       @@{antiquotation thm} options styles @{syntax thmrefs} |
 | 
| 42617 | 188 |       @@{antiquotation lemma} options @{syntax prop} @'by' @{syntax method} @{syntax method}? |
 | 
| 42596 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 wenzelm parents: 
40879diff
changeset | 189 |       @@{antiquotation prop} options styles @{syntax prop} |
 | 
| 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 wenzelm parents: 
40879diff
changeset | 190 |       @@{antiquotation term} options styles @{syntax term} |
 | 
| 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 wenzelm parents: 
40879diff
changeset | 191 |       @@{antiquotation term_type} options styles @{syntax term} |
 | 
| 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 wenzelm parents: 
40879diff
changeset | 192 |       @@{antiquotation typeof} options styles @{syntax term} |
 | 
| 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 wenzelm parents: 
40879diff
changeset | 193 |       @@{antiquotation const} options @{syntax term} |
 | 
| 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 wenzelm parents: 
40879diff
changeset | 194 |       @@{antiquotation abbrev} options @{syntax term} |
 | 
| 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 wenzelm parents: 
40879diff
changeset | 195 |       @@{antiquotation typ} options @{syntax type} |
 | 
| 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 wenzelm parents: 
40879diff
changeset | 196 |       @@{antiquotation type} options @{syntax name} |
 | 
| 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 wenzelm parents: 
40879diff
changeset | 197 |       @@{antiquotation class} options @{syntax name} |
 | 
| 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 wenzelm parents: 
40879diff
changeset | 198 |       @@{antiquotation text} options @{syntax name} |
 | 
| 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 wenzelm parents: 
40879diff
changeset | 199 |       @@{antiquotation goals} options |
 | 
| 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 wenzelm parents: 
40879diff
changeset | 200 |       @@{antiquotation subgoals} options |
 | 
| 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 wenzelm parents: 
40879diff
changeset | 201 |       @@{antiquotation prf} options @{syntax thmrefs} |
 | 
| 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 wenzelm parents: 
40879diff
changeset | 202 |       @@{antiquotation full_prf} options @{syntax thmrefs} |
 | 
| 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 wenzelm parents: 
40879diff
changeset | 203 |       @@{antiquotation ML} options @{syntax name} |
 | 
| 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 wenzelm parents: 
40879diff
changeset | 204 |       @@{antiquotation ML_type} options @{syntax name} |
 | 
| 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 wenzelm parents: 
40879diff
changeset | 205 |       @@{antiquotation ML_struct} options @{syntax name} |
 | 
| 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 wenzelm parents: 
40879diff
changeset | 206 |       @@{antiquotation \"file\"} options @{syntax name}
 | 
| 27043 | 207 | ; | 
| 208 | options: '[' (option * ',') ']' | |
| 209 | ; | |
| 42596 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 wenzelm parents: 
40879diff
changeset | 210 |     option: @{syntax name} | @{syntax name} '=' @{syntax name}
 | 
| 27043 | 211 | ; | 
| 32892 | 212 |     styles: '(' (style + ',') ')'
 | 
| 32891 | 213 | ; | 
| 42596 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 wenzelm parents: 
40879diff
changeset | 214 |     style: (@{syntax name} +)
 | 
| 42617 | 215 | "} | 
| 27043 | 216 | |
| 217 |   Note that the syntax of antiquotations may \emph{not} include source
 | |
| 28749 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 218 |   comments @{verbatim "(*"}~@{text "\<dots>"}~@{verbatim "*)"} nor verbatim
 | 
| 27043 | 219 |   text @{verbatim "{"}@{verbatim "*"}~@{text "\<dots>"}~@{verbatim
 | 
| 220 |   "*"}@{verbatim "}"}.
 | |
| 221 | ||
| 28760 
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
 wenzelm parents: 
28750diff
changeset | 222 |   \begin{description}
 | 
| 27043 | 223 | |
| 28760 
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
 wenzelm parents: 
28750diff
changeset | 224 |   \item @{text "@{theory A}"} prints the name @{text "A"}, which is
 | 
| 27043 | 225 | guaranteed to refer to a valid ancestor theory in the current | 
| 226 | context. | |
| 227 | ||
| 28760 
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
 wenzelm parents: 
28750diff
changeset | 228 |   \item @{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: 
28747diff
changeset | 229 | Full fact expressions are allowed here, including attributes | 
| 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 230 |   (\secref{sec:syn-att}).
 | 
| 27043 | 231 | |
| 28760 
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
 wenzelm parents: 
28750diff
changeset | 232 |   \item @{text "@{prop \<phi>}"} prints a well-typed proposition @{text
 | 
| 27043 | 233 | "\<phi>"}. | 
| 234 | ||
| 28760 
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
 wenzelm parents: 
28750diff
changeset | 235 |   \item @{text "@{lemma \<phi> by m}"} proves a well-typed proposition
 | 
| 28749 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 236 |   @{text "\<phi>"} by method @{text m} and prints the original @{text "\<phi>"}.
 | 
| 27453 | 237 | |
| 28760 
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
 wenzelm parents: 
28750diff
changeset | 238 |   \item @{text "@{term t}"} prints a well-typed term @{text "t"}.
 | 
| 27043 | 239 | |
| 32898 
e871d897969c
term styles also cover antiquotations term_type and typeof
 haftmann parents: 
32892diff
changeset | 240 |   \item @{text "@{term_type t}"} prints a well-typed term @{text "t"}
 | 
| 
e871d897969c
term styles also cover antiquotations term_type and typeof
 haftmann parents: 
32892diff
changeset | 241 | annotated with its type. | 
| 
e871d897969c
term styles also cover antiquotations term_type and typeof
 haftmann parents: 
32892diff
changeset | 242 | |
| 
e871d897969c
term styles also cover antiquotations term_type and typeof
 haftmann parents: 
32892diff
changeset | 243 |   \item @{text "@{typeof t}"} prints the type of a well-typed term
 | 
| 
e871d897969c
term styles also cover antiquotations term_type and typeof
 haftmann parents: 
32892diff
changeset | 244 |   @{text "t"}.
 | 
| 
e871d897969c
term styles also cover antiquotations term_type and typeof
 haftmann parents: 
32892diff
changeset | 245 | |
| 28760 
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
 wenzelm parents: 
28750diff
changeset | 246 |   \item @{text "@{const c}"} prints a logical or syntactic constant
 | 
| 27043 | 247 |   @{text "c"}.
 | 
| 248 | ||
| 28760 
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
 wenzelm parents: 
28750diff
changeset | 249 |   \item @{text "@{abbrev c x\<^sub>1 \<dots> x\<^sub>n}"} prints a constant abbreviation
 | 
| 
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
 wenzelm parents: 
28750diff
changeset | 250 |   @{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: 
32898diff
changeset | 251 | |
| 28760 
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
 wenzelm parents: 
28750diff
changeset | 252 |   \item @{text "@{typ \<tau>}"} prints a well-formed type @{text "\<tau>"}.
 | 
| 39305 
d4fa19eb0822
'class' and 'type' are now antiquoations by default
 haftmann parents: 
32898diff
changeset | 253 | |
| 39689 
78b185bf7660
clarified @{type} antiquotation: abbreviations and nonterminals count as "syntactic", disallow TFrees;
 wenzelm parents: 
39305diff
changeset | 254 |   \item @{text "@{type \<kappa>}"} prints a (logical or syntactic) type
 | 
| 
78b185bf7660
clarified @{type} antiquotation: abbreviations and nonterminals count as "syntactic", disallow TFrees;
 wenzelm parents: 
39305diff
changeset | 255 |     constructor @{text "\<kappa>"}.
 | 
| 39305 
d4fa19eb0822
'class' and 'type' are now antiquoations by default
 haftmann parents: 
32898diff
changeset | 256 | |
| 
d4fa19eb0822
'class' and 'type' are now antiquoations by default
 haftmann parents: 
32898diff
changeset | 257 |   \item @{text "@{class c}"} prints a class @{text c}.
 | 
| 
d4fa19eb0822
'class' and 'type' are now antiquoations by default
 haftmann parents: 
32898diff
changeset | 258 | |
| 28760 
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
 wenzelm parents: 
28750diff
changeset | 259 |   \item @{text "@{text s}"} prints uninterpreted source text @{text
 | 
| 27043 | 260 | s}. This is particularly useful to print portions of text according | 
| 28749 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 261 | to the Isabelle document style, without demanding well-formedness, | 
| 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 262 | e.g.\ small pieces of terms that should not be parsed or | 
| 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 263 | type-checked yet. | 
| 27043 | 264 | |
| 28760 
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
 wenzelm parents: 
28750diff
changeset | 265 |   \item @{text "@{goals}"} prints the current \emph{dynamic} goal
 | 
| 27043 | 266 | state. This is mainly for support of tactic-emulation scripts | 
| 28749 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 267 | within Isar. Presentation of goal states does not conform to the | 
| 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 268 | idea of human-readable proof documents! | 
| 27043 | 269 | |
| 28749 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 270 | When explaining proofs in detail it is usually better to spell out | 
| 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 271 | the reasoning via proper Isar proof commands, instead of peeking at | 
| 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 272 | the internal machine configuration. | 
| 27043 | 273 | |
| 28760 
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
 wenzelm parents: 
28750diff
changeset | 274 |   \item @{text "@{subgoals}"} is similar to @{text "@{goals}"}, but
 | 
| 27043 | 275 | does not print the main goal. | 
| 276 | ||
| 28760 
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
 wenzelm parents: 
28750diff
changeset | 277 |   \item @{text "@{prf a\<^sub>1 \<dots> a\<^sub>n}"} prints the (compact) proof terms
 | 
| 28749 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 278 |   corresponding to the theorems @{text "a\<^sub>1 \<dots> a\<^sub>n"}. Note that this
 | 
| 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 279 | requires proof terms to be switched on for the current logic | 
| 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 280 | session. | 
| 27043 | 281 | |
| 28760 
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
 wenzelm parents: 
28750diff
changeset | 282 |   \item @{text "@{full_prf a\<^sub>1 \<dots> a\<^sub>n}"} is like @{text "@{prf a\<^sub>1 \<dots>
 | 
| 
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
 wenzelm parents: 
28750diff
changeset | 283 | a\<^sub>n}"}, but prints the full proof terms, i.e.\ also displays | 
| 
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
 wenzelm parents: 
28750diff
changeset | 284 | information omitted in the compact proof term, which is denoted by | 
| 
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
 wenzelm parents: 
28750diff
changeset | 285 |   ``@{text _}'' placeholders there.
 | 
| 27043 | 286 | |
| 28760 
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
 wenzelm parents: 
28750diff
changeset | 287 |   \item @{text "@{ML s}"}, @{text "@{ML_type s}"}, and @{text
 | 
| 
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
 wenzelm parents: 
28750diff
changeset | 288 |   "@{ML_struct s}"} check text @{text s} as ML value, type, and
 | 
| 28749 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 289 | structure, respectively. The source is printed verbatim. | 
| 27043 | 290 | |
| 40801 | 291 |   \item @{text "@{file path}"} checks that @{text "path"} refers to a
 | 
| 292 | file (or directory) and prints it verbatim. | |
| 293 | ||
| 28760 
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
 wenzelm parents: 
28750diff
changeset | 294 |   \end{description}
 | 
| 28749 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 295 | *} | 
| 27043 | 296 | |
| 28749 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 297 | |
| 42936 | 298 | subsection {* Styled antiquotations *}
 | 
| 28749 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 299 | |
| 32891 | 300 | text {* The antiquotations @{text thm}, @{text prop} and @{text
 | 
| 301 |   term} admit an extra \emph{style} specification to modify the
 | |
| 302 | printed result. A style is specified by a name with a possibly | |
| 303 | empty number of arguments; multiple styles can be sequenced with | |
| 304 | commas. The following standard styles are available: | |
| 27043 | 305 | |
| 28760 
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
 wenzelm parents: 
28750diff
changeset | 306 |   \begin{description}
 | 
| 27043 | 307 | |
| 28760 
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
 wenzelm parents: 
28750diff
changeset | 308 |   \item @{text lhs} extracts the first argument of any application
 | 
| 28749 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 309 | form with at least two arguments --- typically meta-level or | 
| 27043 | 310 | object-level equality, or any other binary relation. | 
| 311 | ||
| 28760 
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
 wenzelm parents: 
28750diff
changeset | 312 |   \item @{text rhs} is like @{text lhs}, but extracts the second
 | 
| 27043 | 313 | argument. | 
| 314 | ||
| 28760 
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
 wenzelm parents: 
28750diff
changeset | 315 |   \item @{text "concl"} extracts the conclusion @{text C} from a rule
 | 
| 27043 | 316 |   in Horn-clause normal form @{text "A\<^sub>1 \<Longrightarrow> \<dots> A\<^sub>n \<Longrightarrow> C"}.
 | 
| 317 | ||
| 32891 | 318 |   \item @{text "prem"} @{text n} extract premise number
 | 
| 319 |   @{text "n"} from from a rule in Horn-clause
 | |
| 28760 
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
 wenzelm parents: 
28750diff
changeset | 320 |   normal form @{text "A\<^sub>1 \<Longrightarrow> \<dots> A\<^sub>n \<Longrightarrow> C"}
 | 
| 27043 | 321 | |
| 28760 
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
 wenzelm parents: 
28750diff
changeset | 322 |   \end{description}
 | 
| 28749 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 323 | *} | 
| 27043 | 324 | |
| 28749 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 325 | |
| 42936 | 326 | subsection {* General options *}
 | 
| 28749 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 327 | |
| 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 328 | text {* The following options are available to tune the printed output
 | 
| 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 329 | of antiquotations. Note that many of these coincide with global ML | 
| 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 330 | flags of the same names. | 
| 27043 | 331 | |
| 28760 
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
 wenzelm parents: 
28750diff
changeset | 332 |   \begin{description}
 | 
| 27043 | 333 | |
| 30397 | 334 |   \item @{antiquotation_option_def show_types}~@{text "= bool"} and
 | 
| 335 |   @{antiquotation_option_def show_sorts}~@{text "= bool"} control
 | |
| 336 | printing of explicit type and sort constraints. | |
| 27043 | 337 | |
| 30397 | 338 |   \item @{antiquotation_option_def show_structs}~@{text "= bool"}
 | 
| 339 | controls printing of implicit structures. | |
| 27043 | 340 | |
| 40879 
ca132ef44944
configuration option "show_abbrevs" supersedes print mode "no_abbrevs", with inverted meaning;
 wenzelm parents: 
40801diff
changeset | 341 |   \item @{antiquotation_option_def show_abbrevs}~@{text "= bool"}
 | 
| 
ca132ef44944
configuration option "show_abbrevs" supersedes print mode "no_abbrevs", with inverted meaning;
 wenzelm parents: 
40801diff
changeset | 342 | controls folding of abbreviations. | 
| 
ca132ef44944
configuration option "show_abbrevs" supersedes print mode "no_abbrevs", with inverted meaning;
 wenzelm parents: 
40801diff
changeset | 343 | |
| 42669 
04dfffda5671
more conventional naming scheme: names_long, names_short, names_unique;
 wenzelm parents: 
42658diff
changeset | 344 |   \item @{antiquotation_option_def names_long}~@{text "= bool"} forces
 | 
| 30397 | 345 | names of types and constants etc.\ to be printed in their fully | 
| 346 | qualified internal form. | |
| 27043 | 347 | |
| 42669 
04dfffda5671
more conventional naming scheme: names_long, names_short, names_unique;
 wenzelm parents: 
42658diff
changeset | 348 |   \item @{antiquotation_option_def names_short}~@{text "= bool"}
 | 
| 30397 | 349 | forces names of types and constants etc.\ to be printed unqualified. | 
| 350 | Note that internalizing the output again in the current context may | |
| 351 | well yield a different result. | |
| 27043 | 352 | |
| 42669 
04dfffda5671
more conventional naming scheme: names_long, names_short, names_unique;
 wenzelm parents: 
42658diff
changeset | 353 |   \item @{antiquotation_option_def names_unique}~@{text "= bool"}
 | 
| 30397 | 354 | determines whether the printed version of qualified names should be | 
| 355 | made sufficiently long to avoid overlap with names declared further | |
| 356 |   back.  Set to @{text false} for more concise output.
 | |
| 27043 | 357 | |
| 30397 | 358 |   \item @{antiquotation_option_def eta_contract}~@{text "= bool"}
 | 
| 359 |   prints terms in @{text \<eta>}-contracted form.
 | |
| 27043 | 360 | |
| 30397 | 361 |   \item @{antiquotation_option_def display}~@{text "= bool"} indicates
 | 
| 362 | if the text is to be output as multi-line ``display material'', | |
| 363 | rather than a small piece of text without line breaks (which is the | |
| 364 | default). | |
| 27043 | 365 | |
| 28749 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 366 | In this mode the embedded entities are printed in the same style as | 
| 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 367 | the main theory text. | 
| 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 368 | |
| 30397 | 369 |   \item @{antiquotation_option_def break}~@{text "= bool"} controls
 | 
| 370 | line breaks in non-display material. | |
| 27043 | 371 | |
| 30397 | 372 |   \item @{antiquotation_option_def quotes}~@{text "= bool"} indicates
 | 
| 373 | if the output should be enclosed in double quotes. | |
| 27043 | 374 | |
| 30397 | 375 |   \item @{antiquotation_option_def mode}~@{text "= name"} adds @{text
 | 
| 376 | name} to the print mode to be used for presentation. Note that the | |
| 377 |   standard setup for {\LaTeX} output is already present by default,
 | |
| 378 |   including the modes @{text latex} and @{text xsymbols}.
 | |
| 27043 | 379 | |
| 30397 | 380 |   \item @{antiquotation_option_def margin}~@{text "= nat"} and
 | 
| 381 |   @{antiquotation_option_def indent}~@{text "= nat"} change the margin
 | |
| 382 | or indentation for pretty printing of display material. | |
| 27043 | 383 | |
| 30397 | 384 |   \item @{antiquotation_option_def goals_limit}~@{text "= nat"}
 | 
| 385 | determines the maximum number of goals to be printed (for goal-based | |
| 386 | antiquotation). | |
| 27043 | 387 | |
| 30397 | 388 |   \item @{antiquotation_option_def source}~@{text "= bool"} prints the
 | 
| 389 | original source text of the antiquotation arguments, rather than its | |
| 390 | internal representation. Note that formal checking of | |
| 391 |   @{antiquotation "thm"}, @{antiquotation "term"}, etc. is still
 | |
| 392 |   enabled; use the @{antiquotation "text"} antiquotation for unchecked
 | |
| 393 | output. | |
| 28749 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 394 | |
| 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 395 |   Regular @{text "term"} and @{text "typ"} antiquotations with @{text
 | 
| 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 396 | "source = false"} involve a full round-trip from the original source | 
| 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 397 | to an internalized logical entity back to a source form, according | 
| 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 398 | to the syntax of the current context. Thus the printed output is | 
| 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 399 | not under direct control of the author, it may even fluctuate a bit | 
| 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 400 | as the underlying theory is changed later on. | 
| 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 401 | |
| 42626 | 402 |   In contrast, @{antiquotation_option source}~@{text "= true"}
 | 
| 30397 | 403 | admits direct printing of the given source text, with the desirable | 
| 404 | well-formedness check in the background, but without modification of | |
| 405 | the printed text. | |
| 28749 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 406 | |
| 28760 
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
 wenzelm parents: 
28750diff
changeset | 407 |   \end{description}
 | 
| 27043 | 408 | |
| 409 |   For boolean flags, ``@{text "name = true"}'' may be abbreviated as
 | |
| 410 |   ``@{text name}''.  All of the above flags are disabled by default,
 | |
| 28749 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 411 |   unless changed from ML, say in the @{verbatim "ROOT.ML"} of the
 | 
| 
99f6da3bbbf7
renamed "formal comments" to "document comments";
 wenzelm parents: 
28747diff
changeset | 412 | logic session. | 
| 27043 | 413 | *} | 
| 414 | ||
| 415 | ||
| 28750 | 416 | section {* Markup via command tags \label{sec:tags} *}
 | 
| 27043 | 417 | |
| 28750 | 418 | text {* Each Isabelle/Isar command may be decorated by additional
 | 
| 419 | presentation tags, to indicate some modification in the way it is | |
| 420 | printed in the document. | |
| 27043 | 421 | |
| 42596 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 wenzelm parents: 
40879diff
changeset | 422 |   @{rail "
 | 
| 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 wenzelm parents: 
40879diff
changeset | 423 |     @{syntax_def tags}: ( tag * )
 | 
| 27043 | 424 | ; | 
| 42596 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 wenzelm parents: 
40879diff
changeset | 425 |     tag: '%' (@{syntax ident} | @{syntax string})
 | 
| 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 wenzelm parents: 
40879diff
changeset | 426 | "} | 
| 27043 | 427 | |
| 28750 | 428 | Some tags are pre-declared for certain classes of commands, serving | 
| 429 | as default markup if no tags are given in the text: | |
| 27043 | 430 | |
| 28750 | 431 | \medskip | 
| 27043 | 432 |   \begin{tabular}{ll}
 | 
| 433 |     @{text "theory"} & theory begin/end \\
 | |
| 434 |     @{text "proof"} & all proof commands \\
 | |
| 435 |     @{text "ML"} & all commands involving ML code \\
 | |
| 436 |   \end{tabular}
 | |
| 437 | ||
| 28750 | 438 | \medskip The Isabelle document preparation system | 
| 439 |   \cite{isabelle-sys} allows tagged command regions to be presented
 | |
| 27043 | 440 | specifically, e.g.\ to fold proof texts, or drop parts of the text | 
| 441 | completely. | |
| 442 | ||
| 28750 | 443 |   For example ``@{command "by"}~@{text "%invisible auto"}'' causes
 | 
| 444 |   that piece of proof to be treated as @{text invisible} instead of
 | |
| 445 |   @{text "proof"} (the default), which may be shown or hidden
 | |
| 27043 | 446 |   depending on the document setup.  In contrast, ``@{command
 | 
| 28750 | 447 |   "by"}~@{text "%visible auto"}'' forces this text to be shown
 | 
| 27043 | 448 | invariably. | 
| 449 | ||
| 450 | Explicit tag specifications within a proof apply to all subsequent | |
| 451 |   commands of the same level of nesting.  For example, ``@{command
 | |
| 28750 | 452 |   "proof"}~@{text "%visible \<dots>"}~@{command "qed"}'' forces the whole
 | 
| 453 |   sub-proof to be typeset as @{text visible} (unless some of its parts
 | |
| 454 | are tagged differently). | |
| 455 | ||
| 456 | \medskip Command tags merely produce certain markup environments for | |
| 457 |   type-setting.  The meaning of these is determined by {\LaTeX}
 | |
| 40800 
330eb65c9469
Parse.liberal_name for document antiquotations and attributes;
 wenzelm parents: 
40255diff
changeset | 458 |   macros, as defined in @{file "~~/lib/texinputs/isabelle.sty"} or
 | 
| 28750 | 459 | by the document author. The Isabelle document preparation tools | 
| 460 | also provide some high-level options to specify the meaning of | |
| 461 | arbitrary tags to ``keep'', ``drop'', or ``fold'' the corresponding | |
| 462 | parts of the text. Logic sessions may also specify ``document | |
| 463 | versions'', where given tags are interpreted in some particular way. | |
| 464 |   Again see \cite{isabelle-sys} for further details.
 | |
| 27043 | 465 | *} | 
| 466 | ||
| 467 | ||
| 42658 | 468 | section {* Railroad diagrams *}
 | 
| 469 | ||
| 470 | text {*
 | |
| 471 |   \begin{matharray}{rcl}
 | |
| 472 |     @{antiquotation_def "rail"} & : & @{text antiquotation} \\
 | |
| 473 |   \end{matharray}
 | |
| 474 | ||
| 475 |   @{rail "'rail' string"}
 | |
| 476 | ||
| 477 |   The @{antiquotation rail} antiquotation allows to include syntax
 | |
| 478 |   diagrams into Isabelle documents.  {\LaTeX} requires the style file
 | |
| 479 |   @{"file" "~~/lib/texinputs/pdfsetup.sty"}, which can be used via
 | |
| 480 |   @{verbatim "\\usepackage{pdfsetup}"} in @{verbatim "root.tex"}, for
 | |
| 481 | example. | |
| 482 | ||
| 483 |   The rail specification language is quoted here as Isabelle @{syntax
 | |
| 484 | string}; it has its own grammar given below. | |
| 485 | ||
| 486 |   @{rail "
 | |
| 487 | rule? + ';' | |
| 488 | ; | |
| 489 |   rule: ((identifier | @{syntax antiquotation}) ':')? body
 | |
| 490 | ; | |
| 491 | body: concatenation + '|' | |
| 492 | ; | |
| 493 |   concatenation: ((atom '?'?) +) (('*' | '+') atom?)?
 | |
| 494 | ; | |
| 495 |   atom: '(' body? ')' | identifier |
 | |
| 496 |     '@'? (string | @{syntax antiquotation}) |
 | |
| 497 | '\\\\\\\\' | |
| 498 | "} | |
| 499 | ||
| 500 |   The lexical syntax of @{text "identifier"} coincides with that of
 | |
| 501 |   @{syntax ident} in regular Isabelle syntax, but @{text string} uses
 | |
| 502 |   single quotes instead of double quotes of the standard @{syntax
 | |
| 503 | string} category, to avoid extra escapes. | |
| 504 | ||
| 505 |   Each @{text rule} defines a formal language (with optional name),
 | |
| 506 | using a notation that is similar to EBNF or regular expressions with | |
| 507 | recursion. The meaning and visual appearance of these rail language | |
| 508 | elements is illustrated by the following representative examples. | |
| 509 | ||
| 510 |   \begin{itemize}
 | |
| 511 | ||
| 512 |   \item Empty @{verbatim "()"}
 | |
| 513 | ||
| 514 |   @{rail "()"}
 | |
| 515 | ||
| 516 |   \item Nonterminal @{verbatim "A"}
 | |
| 517 | ||
| 518 |   @{rail "A"}
 | |
| 519 | ||
| 520 | \item Nonterminal via Isabelle antiquotation | |
| 521 |   @{verbatim "@{syntax method}"}
 | |
| 522 | ||
| 523 |   @{rail "@{syntax method}"}
 | |
| 524 | ||
| 525 |   \item Terminal @{verbatim "'xyz'"}
 | |
| 526 | ||
| 527 |   @{rail "'xyz'"}
 | |
| 528 | ||
| 529 |   \item Terminal in keyword style @{verbatim "@'xyz'"}
 | |
| 530 | ||
| 531 |   @{rail "@'xyz'"}
 | |
| 532 | ||
| 533 | \item Terminal via Isabelle antiquotation | |
| 534 |   @{verbatim "@@{method rule}"}
 | |
| 535 | ||
| 536 |   @{rail "@@{method rule}"}
 | |
| 537 | ||
| 538 |   \item Concatenation @{verbatim "A B C"}
 | |
| 539 | ||
| 540 |   @{rail "A B C"}
 | |
| 541 | ||
| 542 |   \item Linebreak @{verbatim "\\\\"} inside
 | |
| 543 |   concatenation\footnote{Strictly speaking, this is only a single
 | |
| 544 |   backslash, but the enclosing @{syntax string} syntax requires a
 | |
| 545 |   second one for escaping.} @{verbatim "A B C \\\\ D E F"}
 | |
| 546 | ||
| 547 |   @{rail "A B C \\ D E F"}
 | |
| 548 | ||
| 549 |   \item Variants @{verbatim "A | B | C"}
 | |
| 550 | ||
| 551 |   @{rail "A | B | C"}
 | |
| 552 | ||
| 553 |   \item Option @{verbatim "A ?"}
 | |
| 554 | ||
| 555 |   @{rail "A ?"}
 | |
| 556 | ||
| 557 |   \item Repetition @{verbatim "A *"}
 | |
| 558 | ||
| 559 |   @{rail "A *"}
 | |
| 560 | ||
| 561 |   \item Repetition with separator @{verbatim "A * sep"}
 | |
| 562 | ||
| 563 |   @{rail "A * sep"}
 | |
| 564 | ||
| 565 |   \item Strict repetition @{verbatim "A +"}
 | |
| 566 | ||
| 567 |   @{rail "A +"}
 | |
| 568 | ||
| 569 |   \item Strict repetition with separator @{verbatim "A + sep"}
 | |
| 570 | ||
| 571 |   @{rail "A + sep"}
 | |
| 572 | ||
| 573 |   \end{itemize}
 | |
| 574 | *} | |
| 575 | ||
| 576 | ||
| 27043 | 577 | section {* Draft presentation *}
 | 
| 578 | ||
| 579 | text {*
 | |
| 580 |   \begin{matharray}{rcl}
 | |
| 28761 
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
 wenzelm parents: 
28760diff
changeset | 581 |     @{command_def "display_drafts"}@{text "\<^sup>*"} & : & @{text "any \<rightarrow>"} \\
 | 
| 
9ec4482c9201
updated/refined types of Isar language elements, removed special LaTeX macros;
 wenzelm parents: 
28760diff
changeset | 582 |     @{command_def "print_drafts"}@{text "\<^sup>*"} & : & @{text "any \<rightarrow>"} \\
 | 
| 27043 | 583 |   \end{matharray}
 | 
| 584 | ||
| 42596 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 wenzelm parents: 
40879diff
changeset | 585 |   @{rail "
 | 
| 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 wenzelm parents: 
40879diff
changeset | 586 |     (@@{command display_drafts} | @@{command print_drafts}) (@{syntax name} +)
 | 
| 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 wenzelm parents: 
40879diff
changeset | 587 | |
| 
6c621a9d612a
modernized rail diagrams using @{rail} antiquotation;
 wenzelm parents: 
40879diff
changeset | 588 | "} | 
| 27043 | 589 | |
| 28760 
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
 wenzelm parents: 
28750diff
changeset | 590 |   \begin{description}
 | 
| 27043 | 591 | |
| 28760 
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
 wenzelm parents: 
28750diff
changeset | 592 |   \item @{command "display_drafts"}~@{text paths} and @{command
 | 
| 
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
 wenzelm parents: 
28750diff
changeset | 593 |   "print_drafts"}~@{text paths} perform simple output of a given list
 | 
| 27043 | 594 | of raw source files. Only those symbols that do not require | 
| 595 |   additional {\LaTeX} packages are displayed properly, everything else
 | |
| 596 | is left verbatim. | |
| 597 | ||
| 28760 
cbc435f7b16b
unified use of declaration environment with IsarImplementation;
 wenzelm parents: 
28750diff
changeset | 598 |   \end{description}
 | 
| 27043 | 599 | *} | 
| 600 | ||
| 601 | end |