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