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