doc-src/IsarRef/Thy/document/Inner_Syntax.tex
author wenzelm
Fri Feb 17 15:42:26 2012 +0100 (2012-02-17)
changeset 46512 4f9f61f9b535
parent 46506 c7faa011bfa7
child 46525 af3df09590f9
permissions -rw-r--r--
simplified configuration options for syntax ambiguity;
wenzelm@28762
     1
%
wenzelm@28762
     2
\begin{isabellebody}%
wenzelm@40406
     3
\def\isabellecontext{Inner{\isaliteral{5F}{\isacharunderscore}}Syntax}%
wenzelm@28762
     4
%
wenzelm@28762
     5
\isadelimtheory
wenzelm@28762
     6
%
wenzelm@28762
     7
\endisadelimtheory
wenzelm@28762
     8
%
wenzelm@28762
     9
\isatagtheory
wenzelm@28762
    10
\isacommand{theory}\isamarkupfalse%
wenzelm@40406
    11
\ Inner{\isaliteral{5F}{\isacharunderscore}}Syntax\isanewline
wenzelm@42651
    12
\isakeyword{imports}\ Base\ Main\isanewline
wenzelm@28762
    13
\isakeyword{begin}%
wenzelm@28762
    14
\endisatagtheory
wenzelm@28762
    15
{\isafoldtheory}%
wenzelm@28762
    16
%
wenzelm@28762
    17
\isadelimtheory
wenzelm@28762
    18
%
wenzelm@28762
    19
\endisadelimtheory
wenzelm@28762
    20
%
wenzelm@28762
    21
\isamarkupchapter{Inner syntax --- the term language \label{ch:inner-syntax}%
wenzelm@28762
    22
}
wenzelm@28762
    23
\isamarkuptrue%
wenzelm@28762
    24
%
wenzelm@46282
    25
\begin{isamarkuptext}%
wenzelm@46282
    26
The inner syntax of Isabelle provides concrete notation for
wenzelm@46282
    27
  the main entities of the logical framework, notably \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6C616D6264613E}{\isasymlambda}}{\isaliteral{22}{\isachardoublequote}}}-terms with types and type classes.  Applications may either
wenzelm@46282
    28
  extend existing syntactic categories by additional notation, or
wenzelm@46282
    29
  define new sub-languages that are linked to the standard term
wenzelm@46282
    30
  language via some explicit markers.  For example \verb|FOO|~\isa{{\isaliteral{22}{\isachardoublequote}}foo{\isaliteral{22}{\isachardoublequote}}} could embed the syntax corresponding for some
wenzelm@46282
    31
  user-defined nonterminal \isa{{\isaliteral{22}{\isachardoublequote}}foo{\isaliteral{22}{\isachardoublequote}}} --- within the bounds of the
wenzelm@46282
    32
  given lexical syntax of Isabelle/Pure.
wenzelm@46282
    33
wenzelm@46282
    34
  The most basic way to specify concrete syntax for logical entities
wenzelm@46282
    35
  works via mixfix annotations (\secref{sec:mixfix}), which may be
wenzelm@46282
    36
  usually given as part of the original declaration or via explicit
wenzelm@46282
    37
  notation commands later on (\secref{sec:notation}).  This already
wenzelm@46282
    38
  covers many needs of concrete syntax without having to understand
wenzelm@46282
    39
  the full complexity of inner syntax layers.
wenzelm@46282
    40
wenzelm@46282
    41
  Further details of the syntax engine involves the classical
wenzelm@46282
    42
  distinction of lexical language versus context-free grammar (see
wenzelm@46282
    43
  \secref{sec:pure-syntax}), and various mechanisms for \emph{syntax
wenzelm@46282
    44
  translations} --- either as rewrite systems on first-order ASTs
wenzelm@46282
    45
  (\secref{sec:syn-trans}) or ML functions on ASTs or \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6C616D6264613E}{\isasymlambda}}{\isaliteral{22}{\isachardoublequote}}}-terms that represent parse trees (\secref{sec:tr-funs}).%
wenzelm@46282
    46
\end{isamarkuptext}%
wenzelm@46282
    47
\isamarkuptrue%
wenzelm@46282
    48
%
wenzelm@28762
    49
\isamarkupsection{Printing logical entities%
wenzelm@28762
    50
}
wenzelm@28762
    51
\isamarkuptrue%
wenzelm@28762
    52
%
wenzelm@46284
    53
\isamarkupsubsection{Diagnostic commands \label{sec:print-diag}%
wenzelm@28762
    54
}
wenzelm@28762
    55
\isamarkuptrue%
wenzelm@28762
    56
%
wenzelm@28762
    57
\begin{isamarkuptext}%
wenzelm@28762
    58
\begin{matharray}{rcl}
wenzelm@40406
    59
    \indexdef{}{command}{typ}\hypertarget{command.typ}{\hyperlink{command.typ}{\mbox{\isa{\isacommand{typ}}}}}\isa{{\isaliteral{22}{\isachardoublequote}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{2A}{\isacharasterisk}}{\isaliteral{22}{\isachardoublequote}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}context\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@40406
    60
    \indexdef{}{command}{term}\hypertarget{command.term}{\hyperlink{command.term}{\mbox{\isa{\isacommand{term}}}}}\isa{{\isaliteral{22}{\isachardoublequote}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{2A}{\isacharasterisk}}{\isaliteral{22}{\isachardoublequote}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}context\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@40406
    61
    \indexdef{}{command}{prop}\hypertarget{command.prop}{\hyperlink{command.prop}{\mbox{\isa{\isacommand{prop}}}}}\isa{{\isaliteral{22}{\isachardoublequote}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{2A}{\isacharasterisk}}{\isaliteral{22}{\isachardoublequote}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}context\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@40406
    62
    \indexdef{}{command}{thm}\hypertarget{command.thm}{\hyperlink{command.thm}{\mbox{\isa{\isacommand{thm}}}}}\isa{{\isaliteral{22}{\isachardoublequote}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{2A}{\isacharasterisk}}{\isaliteral{22}{\isachardoublequote}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}context\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@40406
    63
    \indexdef{}{command}{prf}\hypertarget{command.prf}{\hyperlink{command.prf}{\mbox{\isa{\isacommand{prf}}}}}\isa{{\isaliteral{22}{\isachardoublequote}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{2A}{\isacharasterisk}}{\isaliteral{22}{\isachardoublequote}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}context\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@40406
    64
    \indexdef{}{command}{full\_prf}\hypertarget{command.full-prf}{\hyperlink{command.full-prf}{\mbox{\isa{\isacommand{full{\isaliteral{5F}{\isacharunderscore}}prf}}}}}\isa{{\isaliteral{22}{\isachardoublequote}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{2A}{\isacharasterisk}}{\isaliteral{22}{\isachardoublequote}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}context\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@40406
    65
    \indexdef{}{command}{pr}\hypertarget{command.pr}{\hyperlink{command.pr}{\mbox{\isa{\isacommand{pr}}}}}\isa{{\isaliteral{22}{\isachardoublequote}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{2A}{\isacharasterisk}}{\isaliteral{22}{\isachardoublequote}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}any\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@28762
    66
  \end{matharray}
wenzelm@28762
    67
wenzelm@28762
    68
  These diagnostic commands assist interactive development by printing
wenzelm@28762
    69
  internal logical entities in a human-readable fashion.
wenzelm@28762
    70
wenzelm@42596
    71
  \begin{railoutput}
wenzelm@42662
    72
\rail@begin{2}{}
wenzelm@42596
    73
\rail@term{\hyperlink{command.typ}{\mbox{\isa{\isacommand{typ}}}}}[]
wenzelm@42596
    74
\rail@bar
wenzelm@42596
    75
\rail@nextbar{1}
wenzelm@42596
    76
\rail@nont{\hyperlink{syntax.modes}{\mbox{\isa{modes}}}}[]
wenzelm@42596
    77
\rail@endbar
wenzelm@42596
    78
\rail@nont{\hyperlink{syntax.type}{\mbox{\isa{type}}}}[]
wenzelm@42596
    79
\rail@end
wenzelm@42662
    80
\rail@begin{2}{}
wenzelm@42596
    81
\rail@term{\hyperlink{command.term}{\mbox{\isa{\isacommand{term}}}}}[]
wenzelm@42596
    82
\rail@bar
wenzelm@42596
    83
\rail@nextbar{1}
wenzelm@42596
    84
\rail@nont{\hyperlink{syntax.modes}{\mbox{\isa{modes}}}}[]
wenzelm@42596
    85
\rail@endbar
wenzelm@42596
    86
\rail@nont{\hyperlink{syntax.term}{\mbox{\isa{term}}}}[]
wenzelm@42596
    87
\rail@end
wenzelm@42662
    88
\rail@begin{2}{}
wenzelm@42596
    89
\rail@term{\hyperlink{command.prop}{\mbox{\isa{\isacommand{prop}}}}}[]
wenzelm@42596
    90
\rail@bar
wenzelm@42596
    91
\rail@nextbar{1}
wenzelm@42596
    92
\rail@nont{\hyperlink{syntax.modes}{\mbox{\isa{modes}}}}[]
wenzelm@42596
    93
\rail@endbar
wenzelm@42596
    94
\rail@nont{\hyperlink{syntax.prop}{\mbox{\isa{prop}}}}[]
wenzelm@42596
    95
\rail@end
wenzelm@42662
    96
\rail@begin{2}{}
wenzelm@42596
    97
\rail@term{\hyperlink{command.thm}{\mbox{\isa{\isacommand{thm}}}}}[]
wenzelm@42596
    98
\rail@bar
wenzelm@42596
    99
\rail@nextbar{1}
wenzelm@42596
   100
\rail@nont{\hyperlink{syntax.modes}{\mbox{\isa{modes}}}}[]
wenzelm@42596
   101
\rail@endbar
wenzelm@42596
   102
\rail@nont{\hyperlink{syntax.thmrefs}{\mbox{\isa{thmrefs}}}}[]
wenzelm@42596
   103
\rail@end
wenzelm@42662
   104
\rail@begin{2}{}
wenzelm@42596
   105
\rail@bar
wenzelm@42596
   106
\rail@term{\hyperlink{command.prf}{\mbox{\isa{\isacommand{prf}}}}}[]
wenzelm@42596
   107
\rail@nextbar{1}
wenzelm@42596
   108
\rail@term{\hyperlink{command.full-prf}{\mbox{\isa{\isacommand{full{\isaliteral{5F}{\isacharunderscore}}prf}}}}}[]
wenzelm@42596
   109
\rail@endbar
wenzelm@42596
   110
\rail@bar
wenzelm@42596
   111
\rail@nextbar{1}
wenzelm@42596
   112
\rail@nont{\hyperlink{syntax.modes}{\mbox{\isa{modes}}}}[]
wenzelm@42596
   113
\rail@endbar
wenzelm@42596
   114
\rail@bar
wenzelm@42596
   115
\rail@nextbar{1}
wenzelm@42596
   116
\rail@nont{\hyperlink{syntax.thmrefs}{\mbox{\isa{thmrefs}}}}[]
wenzelm@42596
   117
\rail@endbar
wenzelm@42596
   118
\rail@end
wenzelm@42662
   119
\rail@begin{2}{}
wenzelm@42596
   120
\rail@term{\hyperlink{command.pr}{\mbox{\isa{\isacommand{pr}}}}}[]
wenzelm@42596
   121
\rail@bar
wenzelm@42596
   122
\rail@nextbar{1}
wenzelm@42596
   123
\rail@nont{\hyperlink{syntax.modes}{\mbox{\isa{modes}}}}[]
wenzelm@42596
   124
\rail@endbar
wenzelm@42596
   125
\rail@bar
wenzelm@42596
   126
\rail@nextbar{1}
wenzelm@42596
   127
\rail@nont{\hyperlink{syntax.nat}{\mbox{\isa{nat}}}}[]
wenzelm@42596
   128
\rail@endbar
wenzelm@42596
   129
\rail@end
wenzelm@42596
   130
\rail@begin{2}{\indexdef{}{syntax}{modes}\hypertarget{syntax.modes}{\hyperlink{syntax.modes}{\mbox{\isa{modes}}}}}
wenzelm@42596
   131
\rail@term{\isa{{\isaliteral{28}{\isacharparenleft}}}}[]
wenzelm@42596
   132
\rail@plus
wenzelm@42596
   133
\rail@nont{\hyperlink{syntax.name}{\mbox{\isa{name}}}}[]
wenzelm@42596
   134
\rail@nextplus{1}
wenzelm@42596
   135
\rail@endplus
wenzelm@42596
   136
\rail@term{\isa{{\isaliteral{29}{\isacharparenright}}}}[]
wenzelm@42596
   137
\rail@end
wenzelm@42596
   138
\end{railoutput}
wenzelm@28762
   139
wenzelm@28762
   140
wenzelm@28762
   141
  \begin{description}
wenzelm@28762
   142
wenzelm@40406
   143
  \item \hyperlink{command.typ}{\mbox{\isa{\isacommand{typ}}}}~\isa{{\isaliteral{5C3C7461753E}{\isasymtau}}} reads and prints types of the
wenzelm@28762
   144
  meta-logic according to the current theory or proof context.
wenzelm@28762
   145
wenzelm@40406
   146
  \item \hyperlink{command.term}{\mbox{\isa{\isacommand{term}}}}~\isa{t} and \hyperlink{command.prop}{\mbox{\isa{\isacommand{prop}}}}~\isa{{\isaliteral{5C3C7068693E}{\isasymphi}}}
wenzelm@28762
   147
  read, type-check and print terms or propositions according to the
wenzelm@28762
   148
  current theory or proof context; the inferred type of \isa{t} is
wenzelm@28762
   149
  output as well.  Note that these commands are also useful in
wenzelm@28762
   150
  inspecting the current environment of term abbreviations.
wenzelm@28762
   151
wenzelm@40406
   152
  \item \hyperlink{command.thm}{\mbox{\isa{\isacommand{thm}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}a\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}\ a\isaliteral{5C3C5E7375623E}{}\isactrlsub n{\isaliteral{22}{\isachardoublequote}}} retrieves
wenzelm@28762
   153
  theorems from the current theory or proof context.  Note that any
wenzelm@28762
   154
  attributes included in the theorem specifications are applied to a
wenzelm@28762
   155
  temporary context derived from the current theory or proof; the
wenzelm@40406
   156
  result is discarded, i.e.\ attributes involved in \isa{{\isaliteral{22}{\isachardoublequote}}a\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{2C}{\isacharcomma}}\ a\isaliteral{5C3C5E7375623E}{}\isactrlsub n{\isaliteral{22}{\isachardoublequote}}} do not have any permanent effect.
wenzelm@28762
   157
wenzelm@28762
   158
  \item \hyperlink{command.prf}{\mbox{\isa{\isacommand{prf}}}} displays the (compact) proof term of the
wenzelm@28762
   159
  current proof state (if present), or of the given theorems. Note
wenzelm@28762
   160
  that this requires proof terms to be switched on for the current
wenzelm@28762
   161
  object logic (see the ``Proof terms'' section of the Isabelle
wenzelm@28762
   162
  reference manual for information on how to do this).
wenzelm@28762
   163
wenzelm@40406
   164
  \item \hyperlink{command.full-prf}{\mbox{\isa{\isacommand{full{\isaliteral{5F}{\isacharunderscore}}prf}}}} is like \hyperlink{command.prf}{\mbox{\isa{\isacommand{prf}}}}, but displays
wenzelm@28762
   165
  the full proof term, i.e.\ also displays information omitted in the
wenzelm@40406
   166
  compact proof term, which is denoted by ``\isa{{\isaliteral{5F}{\isacharunderscore}}}'' placeholders
wenzelm@28762
   167
  there.
wenzelm@28762
   168
wenzelm@40406
   169
  \item \hyperlink{command.pr}{\mbox{\isa{\isacommand{pr}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}goals{\isaliteral{22}{\isachardoublequote}}} prints the current proof state
wenzelm@39165
   170
  (if present), including current facts and goals.  The optional limit
wenzelm@39165
   171
  arguments affect the number of goals to be displayed, which is
wenzelm@39165
   172
  initially 10.  Omitting limit value leaves the current setting
wenzelm@39165
   173
  unchanged.
wenzelm@28762
   174
wenzelm@28762
   175
  \end{description}
wenzelm@28762
   176
wenzelm@28762
   177
  All of the diagnostic commands above admit a list of \isa{modes}
wenzelm@42926
   178
  to be specified, which is appended to the current print mode; see
wenzelm@46284
   179
  also \secref{sec:print-modes}.  Thus the output behavior may be
wenzelm@46284
   180
  modified according particular print mode features.  For example,
wenzelm@46284
   181
  \hyperlink{command.pr}{\mbox{\isa{\isacommand{pr}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}latex\ xsymbols{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} would print the current
wenzelm@46284
   182
  proof state with mathematical symbols and special characters
wenzelm@46284
   183
  represented in {\LaTeX} source, according to the Isabelle style
wenzelm@28762
   184
  \cite{isabelle-sys}.
wenzelm@28762
   185
wenzelm@28762
   186
  Note that antiquotations (cf.\ \secref{sec:antiq}) provide a more
wenzelm@28762
   187
  systematic way to include formal items into the printed text
wenzelm@28762
   188
  document.%
wenzelm@28762
   189
\end{isamarkuptext}%
wenzelm@28762
   190
\isamarkuptrue%
wenzelm@28762
   191
%
wenzelm@28762
   192
\isamarkupsubsection{Details of printed content%
wenzelm@28762
   193
}
wenzelm@28762
   194
\isamarkuptrue%
wenzelm@28762
   195
%
wenzelm@28762
   196
\begin{isamarkuptext}%
wenzelm@42655
   197
\begin{tabular}{rcll}
wenzelm@42655
   198
    \indexdef{}{attribute}{show\_types}\hypertarget{attribute.show-types}{\hyperlink{attribute.show-types}{\mbox{\isa{show{\isaliteral{5F}{\isacharunderscore}}types}}}} & : & \isa{attribute} & default \isa{false} \\
wenzelm@42655
   199
    \indexdef{}{attribute}{show\_sorts}\hypertarget{attribute.show-sorts}{\hyperlink{attribute.show-sorts}{\mbox{\isa{show{\isaliteral{5F}{\isacharunderscore}}sorts}}}} & : & \isa{attribute} & default \isa{false} \\
wenzelm@42655
   200
    \indexdef{}{attribute}{show\_consts}\hypertarget{attribute.show-consts}{\hyperlink{attribute.show-consts}{\mbox{\isa{show{\isaliteral{5F}{\isacharunderscore}}consts}}}} & : & \isa{attribute} & default \isa{false} \\
wenzelm@42655
   201
    \indexdef{}{attribute}{show\_abbrevs}\hypertarget{attribute.show-abbrevs}{\hyperlink{attribute.show-abbrevs}{\mbox{\isa{show{\isaliteral{5F}{\isacharunderscore}}abbrevs}}}} & : & \isa{attribute} & default \isa{true} \\
wenzelm@42655
   202
    \indexdef{}{attribute}{show\_brackets}\hypertarget{attribute.show-brackets}{\hyperlink{attribute.show-brackets}{\mbox{\isa{show{\isaliteral{5F}{\isacharunderscore}}brackets}}}} & : & \isa{attribute} & default \isa{false} \\
wenzelm@42669
   203
    \indexdef{}{attribute}{names\_long}\hypertarget{attribute.names-long}{\hyperlink{attribute.names-long}{\mbox{\isa{names{\isaliteral{5F}{\isacharunderscore}}long}}}} & : & \isa{attribute} & default \isa{false} \\
wenzelm@42669
   204
    \indexdef{}{attribute}{names\_short}\hypertarget{attribute.names-short}{\hyperlink{attribute.names-short}{\mbox{\isa{names{\isaliteral{5F}{\isacharunderscore}}short}}}} & : & \isa{attribute} & default \isa{false} \\
wenzelm@42669
   205
    \indexdef{}{attribute}{names\_unique}\hypertarget{attribute.names-unique}{\hyperlink{attribute.names-unique}{\mbox{\isa{names{\isaliteral{5F}{\isacharunderscore}}unique}}}} & : & \isa{attribute} & default \isa{true} \\
wenzelm@42655
   206
    \indexdef{}{attribute}{eta\_contract}\hypertarget{attribute.eta-contract}{\hyperlink{attribute.eta-contract}{\mbox{\isa{eta{\isaliteral{5F}{\isacharunderscore}}contract}}}} & : & \isa{attribute} & default \isa{true} \\
wenzelm@42655
   207
    \indexdef{}{attribute}{goals\_limit}\hypertarget{attribute.goals-limit}{\hyperlink{attribute.goals-limit}{\mbox{\isa{goals{\isaliteral{5F}{\isacharunderscore}}limit}}}} & : & \isa{attribute} & default \isa{{\isadigit{1}}{\isadigit{0}}} \\
wenzelm@42655
   208
    \indexdef{}{attribute}{show\_main\_goal}\hypertarget{attribute.show-main-goal}{\hyperlink{attribute.show-main-goal}{\mbox{\isa{show{\isaliteral{5F}{\isacharunderscore}}main{\isaliteral{5F}{\isacharunderscore}}goal}}}} & : & \isa{attribute} & default \isa{false} \\
wenzelm@42655
   209
    \indexdef{}{attribute}{show\_hyps}\hypertarget{attribute.show-hyps}{\hyperlink{attribute.show-hyps}{\mbox{\isa{show{\isaliteral{5F}{\isacharunderscore}}hyps}}}} & : & \isa{attribute} & default \isa{false} \\
wenzelm@42655
   210
    \indexdef{}{attribute}{show\_tags}\hypertarget{attribute.show-tags}{\hyperlink{attribute.show-tags}{\mbox{\isa{show{\isaliteral{5F}{\isacharunderscore}}tags}}}} & : & \isa{attribute} & default \isa{false} \\
wenzelm@42655
   211
    \indexdef{}{attribute}{show\_question\_marks}\hypertarget{attribute.show-question-marks}{\hyperlink{attribute.show-question-marks}{\mbox{\isa{show{\isaliteral{5F}{\isacharunderscore}}question{\isaliteral{5F}{\isacharunderscore}}marks}}}} & : & \isa{attribute} & default \isa{true} \\
wenzelm@42655
   212
  \end{tabular}
wenzelm@42655
   213
  \medskip
wenzelm@28762
   214
wenzelm@42655
   215
  These configuration options control the detail of information that
wenzelm@42655
   216
  is displayed for types, terms, theorems, goals etc.  See also
wenzelm@42655
   217
  \secref{sec:config}.
wenzelm@28762
   218
wenzelm@28762
   219
  \begin{description}
wenzelm@28762
   220
wenzelm@42655
   221
  \item \hyperlink{attribute.show-types}{\mbox{\isa{show{\isaliteral{5F}{\isacharunderscore}}types}}} and \hyperlink{attribute.show-sorts}{\mbox{\isa{show{\isaliteral{5F}{\isacharunderscore}}sorts}}} control
wenzelm@42655
   222
  printing of type constraints for term variables, and sort
wenzelm@42655
   223
  constraints for type variables.  By default, neither of these are
wenzelm@42655
   224
  shown in output.  If \hyperlink{attribute.show-sorts}{\mbox{\isa{show{\isaliteral{5F}{\isacharunderscore}}sorts}}} is enabled, types are
wenzelm@42655
   225
  always shown as well.
wenzelm@28762
   226
wenzelm@28762
   227
  Note that displaying types and sorts may explain why a polymorphic
wenzelm@28762
   228
  inference rule fails to resolve with some goal, or why a rewrite
wenzelm@28762
   229
  rule does not apply as expected.
wenzelm@28762
   230
wenzelm@42655
   231
  \item \hyperlink{attribute.show-consts}{\mbox{\isa{show{\isaliteral{5F}{\isacharunderscore}}consts}}} controls printing of types of
wenzelm@42655
   232
  constants when displaying a goal state.
wenzelm@28762
   233
wenzelm@28762
   234
  Note that the output can be enormous, because polymorphic constants
wenzelm@28762
   235
  often occur at several different type instances.
wenzelm@28762
   236
wenzelm@42655
   237
  \item \hyperlink{attribute.show-abbrevs}{\mbox{\isa{show{\isaliteral{5F}{\isacharunderscore}}abbrevs}}} controls folding of constant
wenzelm@42655
   238
  abbreviations.
wenzelm@40879
   239
wenzelm@42655
   240
  \item \hyperlink{attribute.show-brackets}{\mbox{\isa{show{\isaliteral{5F}{\isacharunderscore}}brackets}}} controls bracketing in pretty
wenzelm@42655
   241
  printed output.  If enabled, all sub-expressions of the pretty
wenzelm@28762
   242
  printing tree will be parenthesized, even if this produces malformed
wenzelm@28762
   243
  term syntax!  This crude way of showing the internal structure of
wenzelm@28762
   244
  pretty printed entities may occasionally help to diagnose problems
wenzelm@28762
   245
  with operator priorities, for example.
wenzelm@28762
   246
wenzelm@42669
   247
  \item \hyperlink{attribute.names-long}{\mbox{\isa{names{\isaliteral{5F}{\isacharunderscore}}long}}}, \hyperlink{attribute.names-short}{\mbox{\isa{names{\isaliteral{5F}{\isacharunderscore}}short}}}, and
wenzelm@42669
   248
  \hyperlink{attribute.names-unique}{\mbox{\isa{names{\isaliteral{5F}{\isacharunderscore}}unique}}} control the way of printing fully
wenzelm@42358
   249
  qualified internal names in external form.  See also
wenzelm@42358
   250
  \secref{sec:antiq} for the document antiquotation options of the
wenzelm@42358
   251
  same names.
wenzelm@42358
   252
wenzelm@42655
   253
  \item \hyperlink{attribute.eta-contract}{\mbox{\isa{eta{\isaliteral{5F}{\isacharunderscore}}contract}}} controls \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6574613E}{\isasymeta}}{\isaliteral{22}{\isachardoublequote}}}-contracted
wenzelm@42655
   254
  printing of terms.
wenzelm@28762
   255
wenzelm@40406
   256
  The \isa{{\isaliteral{5C3C6574613E}{\isasymeta}}}-contraction law asserts \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C6C616D6264613E}{\isasymlambda}}x{\isaliteral{2E}{\isachardot}}\ f\ x{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C65717569763E}{\isasymequiv}}\ f{\isaliteral{22}{\isachardoublequote}}},
wenzelm@28762
   257
  provided \isa{x} is not free in \isa{f}.  It asserts
wenzelm@40406
   258
  \emph{extensionality} of functions: \isa{{\isaliteral{22}{\isachardoublequote}}f\ {\isaliteral{5C3C65717569763E}{\isasymequiv}}\ g{\isaliteral{22}{\isachardoublequote}}} if \isa{{\isaliteral{22}{\isachardoublequote}}f\ x\ {\isaliteral{5C3C65717569763E}{\isasymequiv}}\ g\ x{\isaliteral{22}{\isachardoublequote}}} for all \isa{x}.  Higher-order unification frequently puts
wenzelm@40406
   259
  terms into a fully \isa{{\isaliteral{5C3C6574613E}{\isasymeta}}}-expanded form.  For example, if \isa{F} has type \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C7461753E}{\isasymtau}}\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ {\isaliteral{5C3C7461753E}{\isasymtau}}{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ {\isaliteral{5C3C7461753E}{\isasymtau}}{\isaliteral{22}{\isachardoublequote}}} then its expanded form is \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6C616D6264613E}{\isasymlambda}}h{\isaliteral{2E}{\isachardot}}\ F\ {\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C6C616D6264613E}{\isasymlambda}}x{\isaliteral{2E}{\isachardot}}\ h\ x{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}}.
wenzelm@28762
   260
wenzelm@42655
   261
  Enabling \hyperlink{attribute.eta-contract}{\mbox{\isa{eta{\isaliteral{5F}{\isacharunderscore}}contract}}} makes Isabelle perform \isa{{\isaliteral{5C3C6574613E}{\isasymeta}}}-contractions before printing, so that \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6C616D6264613E}{\isasymlambda}}h{\isaliteral{2E}{\isachardot}}\ F\ {\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C6C616D6264613E}{\isasymlambda}}x{\isaliteral{2E}{\isachardot}}\ h\ x{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}}
wenzelm@28762
   262
  appears simply as \isa{F}.
wenzelm@28762
   263
wenzelm@40406
   264
  Note that the distinction between a term and its \isa{{\isaliteral{5C3C6574613E}{\isasymeta}}}-expanded
wenzelm@28762
   265
  form occasionally matters.  While higher-order resolution and
wenzelm@40406
   266
  rewriting operate modulo \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C616C7068613E}{\isasymalpha}}{\isaliteral{5C3C626574613E}{\isasymbeta}}{\isaliteral{5C3C6574613E}{\isasymeta}}{\isaliteral{22}{\isachardoublequote}}}-conversion, some other tools
wenzelm@28762
   267
  might look at terms more discretely.
wenzelm@28762
   268
wenzelm@42655
   269
  \item \hyperlink{attribute.goals-limit}{\mbox{\isa{goals{\isaliteral{5F}{\isacharunderscore}}limit}}} controls the maximum number of
wenzelm@39130
   270
  subgoals to be shown in goal output.
wenzelm@28762
   271
wenzelm@42655
   272
  \item \hyperlink{attribute.show-main-goal}{\mbox{\isa{show{\isaliteral{5F}{\isacharunderscore}}main{\isaliteral{5F}{\isacharunderscore}}goal}}} controls whether the main result
wenzelm@42655
   273
  to be proven should be displayed.  This information might be
wenzelm@39130
   274
  relevant for schematic goals, to inspect the current claim that has
wenzelm@39130
   275
  been synthesized so far.
wenzelm@28762
   276
wenzelm@42655
   277
  \item \hyperlink{attribute.show-hyps}{\mbox{\isa{show{\isaliteral{5F}{\isacharunderscore}}hyps}}} controls printing of implicit
wenzelm@42655
   278
  hypotheses of local facts.  Normally, only those hypotheses are
wenzelm@42655
   279
  displayed that are \emph{not} covered by the assumptions of the
wenzelm@42655
   280
  current context: this situation indicates a fault in some tool being
wenzelm@42655
   281
  used.
wenzelm@28762
   282
wenzelm@42655
   283
  By enabling \hyperlink{attribute.show-hyps}{\mbox{\isa{show{\isaliteral{5F}{\isacharunderscore}}hyps}}}, output of \emph{all} hypotheses
wenzelm@42655
   284
  can be enforced, which is occasionally useful for diagnostic
wenzelm@42655
   285
  purposes.
wenzelm@28762
   286
wenzelm@42655
   287
  \item \hyperlink{attribute.show-tags}{\mbox{\isa{show{\isaliteral{5F}{\isacharunderscore}}tags}}} controls printing of extra annotations
wenzelm@42655
   288
  within theorems, such as internal position information, or the case
wenzelm@42655
   289
  names being attached by the attribute \hyperlink{attribute.case-names}{\mbox{\isa{case{\isaliteral{5F}{\isacharunderscore}}names}}}.
wenzelm@28762
   290
wenzelm@28762
   291
  Note that the \hyperlink{attribute.tagged}{\mbox{\isa{tagged}}} and \hyperlink{attribute.untagged}{\mbox{\isa{untagged}}}
wenzelm@28762
   292
  attributes provide low-level access to the collection of tags
wenzelm@28762
   293
  associated with a theorem.
wenzelm@28762
   294
wenzelm@42655
   295
  \item \hyperlink{attribute.show-question-marks}{\mbox{\isa{show{\isaliteral{5F}{\isacharunderscore}}question{\isaliteral{5F}{\isacharunderscore}}marks}}} controls printing of question
wenzelm@42655
   296
  marks for schematic variables, such as \isa{{\isaliteral{3F}{\isacharquery}}x}.  Only the leading
wenzelm@28762
   297
  question mark is affected, the remaining text is unchanged
wenzelm@28762
   298
  (including proper markup for schematic variables that might be
wenzelm@28762
   299
  relevant for user interfaces).
wenzelm@28762
   300
wenzelm@28762
   301
  \end{description}%
wenzelm@28762
   302
\end{isamarkuptext}%
wenzelm@28762
   303
\isamarkuptrue%
wenzelm@28762
   304
%
wenzelm@46284
   305
\isamarkupsubsection{Alternative print modes \label{sec:print-modes}%
wenzelm@46284
   306
}
wenzelm@46284
   307
\isamarkuptrue%
wenzelm@46284
   308
%
wenzelm@46284
   309
\begin{isamarkuptext}%
wenzelm@46284
   310
\begin{mldecls}
wenzelm@46284
   311
    \indexdef{}{ML}{print\_mode\_value}\verb|print_mode_value: unit -> string list| \\
wenzelm@46284
   312
    \indexdef{}{ML}{Print\_Mode.with\_modes}\verb|Print_Mode.with_modes: string list -> ('a -> 'b) -> 'a -> 'b| \\
wenzelm@46284
   313
  \end{mldecls}
wenzelm@46284
   314
wenzelm@46284
   315
  The \emph{print mode} facility allows to modify various operations
wenzelm@46284
   316
  for printing.  Commands like \hyperlink{command.typ}{\mbox{\isa{\isacommand{typ}}}}, \hyperlink{command.term}{\mbox{\isa{\isacommand{term}}}},
wenzelm@46284
   317
  \hyperlink{command.thm}{\mbox{\isa{\isacommand{thm}}}} (see \secref{sec:print-diag}) take additional print
wenzelm@46284
   318
  modes as optional argument.  The underlying ML operations are as
wenzelm@46284
   319
  follows.
wenzelm@46284
   320
wenzelm@46284
   321
  \begin{description}
wenzelm@46284
   322
wenzelm@46284
   323
  \item \verb|print_mode_value ()| yields the list of currently
wenzelm@46284
   324
  active print mode names.  This should be understood as symbolic
wenzelm@46284
   325
  representation of certain individual features for printing (with
wenzelm@46284
   326
  precedence from left to right).
wenzelm@46284
   327
wenzelm@46284
   328
  \item \verb|Print_Mode.with_modes|~\isa{{\isaliteral{22}{\isachardoublequote}}modes\ f\ x{\isaliteral{22}{\isachardoublequote}}} evaluates
wenzelm@46284
   329
  \isa{{\isaliteral{22}{\isachardoublequote}}f\ x{\isaliteral{22}{\isachardoublequote}}} in an execution context where the print mode is
wenzelm@46284
   330
  prepended by the given \isa{{\isaliteral{22}{\isachardoublequote}}modes{\isaliteral{22}{\isachardoublequote}}}.  This provides a thread-safe
wenzelm@46284
   331
  way to augment print modes.  It is also monotonic in the set of mode
wenzelm@46284
   332
  names: it retains the default print mode that certain
wenzelm@46284
   333
  user-interfaces might have installed for their proper functioning!
wenzelm@46284
   334
wenzelm@46284
   335
  \end{description}
wenzelm@46284
   336
wenzelm@46284
   337
  \begin{warn}
wenzelm@46284
   338
  The old global reference \verb|print_mode| should never be used
wenzelm@46284
   339
  directly in applications.  Its main reason for being publicly
wenzelm@46284
   340
  accessible is to support historic versions of Proof~General.
wenzelm@46284
   341
  \end{warn}
wenzelm@46284
   342
wenzelm@46284
   343
  \medskip The pretty printer for inner syntax maintains alternative
wenzelm@46284
   344
  mixfix productions for any print mode name invented by the user, say
wenzelm@46284
   345
  in commands like \hyperlink{command.notation}{\mbox{\isa{\isacommand{notation}}}} or \hyperlink{command.abbreviation}{\mbox{\isa{\isacommand{abbreviation}}}}.
wenzelm@46284
   346
  Mode names can be arbitrary, but the following ones have a specific
wenzelm@46284
   347
  meaning by convention:
wenzelm@46284
   348
wenzelm@46284
   349
  \begin{itemize}
wenzelm@46284
   350
wenzelm@46284
   351
  \item \verb|""| (the empty string): default mode;
wenzelm@46284
   352
  implicitly active as last element in the list of modes.
wenzelm@46284
   353
wenzelm@46284
   354
  \item \verb|input|: dummy print mode that is never active; may
wenzelm@46284
   355
  be used to specify notation that is only available for input.
wenzelm@46284
   356
wenzelm@46284
   357
  \item \verb|internal| dummy print mode that is never active;
wenzelm@46284
   358
  used internally in Isabelle/Pure.
wenzelm@46284
   359
wenzelm@46284
   360
  \item \verb|xsymbols|: enable proper mathematical symbols
wenzelm@46284
   361
  instead of ASCII art.\footnote{This traditional mode name stems from
wenzelm@46284
   362
  the ``X-Symbol'' package for old versions Proof~General with XEmacs,
wenzelm@46284
   363
  although that package has been superseded by Unicode in recent
wenzelm@46284
   364
  years.}
wenzelm@46284
   365
wenzelm@46284
   366
  \item \verb|HTML|: additional mode that is active in HTML
wenzelm@46284
   367
  presentation of Isabelle theory sources; allows to provide
wenzelm@46284
   368
  alternative output notation.
wenzelm@46284
   369
wenzelm@46284
   370
  \item \verb|latex|: additional mode that is active in {\LaTeX}
wenzelm@46284
   371
  document preparation of Isabelle theory sources; allows to provide
wenzelm@46284
   372
  alternative output notation.
wenzelm@46284
   373
wenzelm@46284
   374
  \end{itemize}%
wenzelm@46284
   375
\end{isamarkuptext}%
wenzelm@46284
   376
\isamarkuptrue%
wenzelm@46284
   377
%
wenzelm@28762
   378
\isamarkupsubsection{Printing limits%
wenzelm@28762
   379
}
wenzelm@28762
   380
\isamarkuptrue%
wenzelm@28762
   381
%
wenzelm@28762
   382
\begin{isamarkuptext}%
wenzelm@28762
   383
\begin{mldecls}
wenzelm@36745
   384
    \indexdef{}{ML}{Pretty.margin\_default}\verb|Pretty.margin_default: int Unsynchronized.ref| \\
wenzelm@30121
   385
    \indexdef{}{ML}{print\_depth}\verb|print_depth: int -> unit| \\
wenzelm@28762
   386
  \end{mldecls}
wenzelm@28762
   387
wenzelm@28762
   388
  These ML functions set limits for pretty printed text.
wenzelm@28762
   389
wenzelm@28762
   390
  \begin{description}
wenzelm@28762
   391
wenzelm@36745
   392
  \item \verb|Pretty.margin_default| indicates the global default for
wenzelm@36745
   393
  the right margin of the built-in pretty printer, with initial value
wenzelm@36745
   394
  76.  Note that user-interfaces typically control margins
wenzelm@36745
   395
  automatically when resizing windows, or even bypass the formatting
wenzelm@36745
   396
  engine of Isabelle/ML altogether and do it within the front end via
wenzelm@36745
   397
  Isabelle/Scala.
wenzelm@28762
   398
wenzelm@28762
   399
  \item \verb|print_depth|~\isa{n} limits the printing depth of the
wenzelm@28762
   400
  ML toplevel pretty printer; the precise effect depends on the ML
wenzelm@28762
   401
  compiler and run-time system.  Typically \isa{n} should be less
wenzelm@28762
   402
  than 10.  Bigger values such as 100--1000 are useful for debugging.
wenzelm@28762
   403
wenzelm@28762
   404
  \end{description}%
wenzelm@28762
   405
\end{isamarkuptext}%
wenzelm@28762
   406
\isamarkuptrue%
wenzelm@28762
   407
%
wenzelm@46282
   408
\isamarkupsection{Mixfix annotations \label{sec:mixfix}%
wenzelm@28762
   409
}
wenzelm@28762
   410
\isamarkuptrue%
wenzelm@28762
   411
%
wenzelm@28762
   412
\begin{isamarkuptext}%
wenzelm@28762
   413
Mixfix annotations specify concrete \emph{inner syntax} of
wenzelm@35351
   414
  Isabelle types and terms.  Locally fixed parameters in toplevel
wenzelm@46290
   415
  theorem statements, locale and class specifications also admit
wenzelm@46290
   416
  mixfix annotations in a fairly uniform manner.  A mixfix annotation
wenzelm@46290
   417
  describes describes the concrete syntax, the translation to abstract
wenzelm@46290
   418
  syntax, and the pretty printing.  Special case annotations provide a
wenzelm@46290
   419
  simple means of specifying infix operators and binders.
wenzelm@46290
   420
wenzelm@46290
   421
  Isabelle mixfix syntax is inspired by {\OBJ} \cite{OBJ}.  It allows
wenzelm@46290
   422
  to specify any context-free priority grammar, which is more general
wenzelm@46290
   423
  than the fixity declarations of ML and Prolog.
wenzelm@28762
   424
wenzelm@42596
   425
  \begin{railoutput}
wenzelm@46289
   426
\rail@begin{1}{\indexdef{}{syntax}{mixfix}\hypertarget{syntax.mixfix}{\hyperlink{syntax.mixfix}{\mbox{\isa{mixfix}}}}}
wenzelm@46289
   427
\rail@term{\isa{{\isaliteral{28}{\isacharparenleft}}}}[]
wenzelm@46289
   428
\rail@nont{\isa{mfix}}[]
wenzelm@46289
   429
\rail@term{\isa{{\isaliteral{29}{\isacharparenright}}}}[]
wenzelm@46289
   430
\rail@end
wenzelm@46289
   431
\rail@begin{2}{\indexdef{}{syntax}{struct\_mixfix}\hypertarget{syntax.struct-mixfix}{\hyperlink{syntax.struct-mixfix}{\mbox{\isa{struct{\isaliteral{5F}{\isacharunderscore}}mixfix}}}}}
wenzelm@42596
   432
\rail@term{\isa{{\isaliteral{28}{\isacharparenleft}}}}[]
wenzelm@42596
   433
\rail@bar
wenzelm@46289
   434
\rail@nont{\isa{mfix}}[]
wenzelm@46289
   435
\rail@nextbar{1}
wenzelm@46289
   436
\rail@term{\isa{\isakeyword{structure}}}[]
wenzelm@46289
   437
\rail@endbar
wenzelm@46289
   438
\rail@term{\isa{{\isaliteral{29}{\isacharparenright}}}}[]
wenzelm@46289
   439
\rail@end
wenzelm@46289
   440
\rail@begin{7}{\isa{mfix}}
wenzelm@46289
   441
\rail@bar
wenzelm@46290
   442
\rail@nont{\hyperlink{syntax.template}{\mbox{\isa{template}}}}[]
wenzelm@46285
   443
\rail@bar
wenzelm@46285
   444
\rail@nextbar{1}
wenzelm@46285
   445
\rail@nont{\isa{prios}}[]
wenzelm@46285
   446
\rail@endbar
wenzelm@46285
   447
\rail@bar
wenzelm@46285
   448
\rail@nextbar{1}
wenzelm@46285
   449
\rail@nont{\hyperlink{syntax.nat}{\mbox{\isa{nat}}}}[]
wenzelm@46285
   450
\rail@endbar
wenzelm@46285
   451
\rail@nextbar{2}
wenzelm@46285
   452
\rail@bar
wenzelm@42596
   453
\rail@term{\isa{\isakeyword{infix}}}[]
wenzelm@46285
   454
\rail@nextbar{3}
wenzelm@42596
   455
\rail@term{\isa{\isakeyword{infixl}}}[]
wenzelm@46285
   456
\rail@nextbar{4}
wenzelm@42596
   457
\rail@term{\isa{\isakeyword{infixr}}}[]
wenzelm@42596
   458
\rail@endbar
wenzelm@46290
   459
\rail@nont{\hyperlink{syntax.template}{\mbox{\isa{template}}}}[]
wenzelm@42596
   460
\rail@nont{\hyperlink{syntax.nat}{\mbox{\isa{nat}}}}[]
wenzelm@46285
   461
\rail@nextbar{5}
wenzelm@46285
   462
\rail@term{\isa{\isakeyword{binder}}}[]
wenzelm@46290
   463
\rail@nont{\hyperlink{syntax.template}{\mbox{\isa{template}}}}[]
wenzelm@42596
   464
\rail@bar
wenzelm@46285
   465
\rail@nextbar{6}
wenzelm@42596
   466
\rail@nont{\isa{prios}}[]
wenzelm@42596
   467
\rail@endbar
wenzelm@42596
   468
\rail@nont{\hyperlink{syntax.nat}{\mbox{\isa{nat}}}}[]
wenzelm@42596
   469
\rail@endbar
wenzelm@42596
   470
\rail@end
wenzelm@46290
   471
\rail@begin{1}{\isa{template}}
wenzelm@46290
   472
\rail@nont{\isa{string}}[]
wenzelm@46290
   473
\rail@end
wenzelm@42596
   474
\rail@begin{2}{\isa{prios}}
wenzelm@42596
   475
\rail@term{\isa{{\isaliteral{5B}{\isacharbrackleft}}}}[]
wenzelm@42596
   476
\rail@plus
wenzelm@42596
   477
\rail@nont{\hyperlink{syntax.nat}{\mbox{\isa{nat}}}}[]
wenzelm@42596
   478
\rail@nextplus{1}
wenzelm@42596
   479
\rail@cterm{\isa{{\isaliteral{2C}{\isacharcomma}}}}[]
wenzelm@42596
   480
\rail@endplus
wenzelm@42596
   481
\rail@term{\isa{{\isaliteral{5D}{\isacharbrackright}}}}[]
wenzelm@42596
   482
\rail@end
wenzelm@42596
   483
\end{railoutput}
wenzelm@28762
   484
wenzelm@28762
   485
wenzelm@46290
   486
  The string given as \isa{template} may include literal text,
wenzelm@46290
   487
  spacing, blocks, and arguments (denoted by ``\isa{{\isaliteral{5F}{\isacharunderscore}}}''); the
wenzelm@46290
   488
  special symbol ``\verb|\<index>|'' (printed as ``\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C696E6465783E}{\isasymindex}}{\isaliteral{22}{\isachardoublequote}}}'')
wenzelm@46290
   489
  represents an index argument that specifies an implicit structure
wenzelm@46290
   490
  reference (see also \secref{sec:locale}).  Infix and binder
wenzelm@46290
   491
  declarations provide common abbreviations for particular mixfix
wenzelm@46290
   492
  declarations.  So in practice, mixfix templates mostly degenerate to
wenzelm@46290
   493
  literal text for concrete syntax, such as ``\verb|++|'' for
wenzelm@46290
   494
  an infix symbol.%
wenzelm@46290
   495
\end{isamarkuptext}%
wenzelm@46290
   496
\isamarkuptrue%
wenzelm@46290
   497
%
wenzelm@46290
   498
\isamarkupsubsection{The general mixfix form%
wenzelm@46290
   499
}
wenzelm@46290
   500
\isamarkuptrue%
wenzelm@46290
   501
%
wenzelm@46290
   502
\begin{isamarkuptext}%
wenzelm@46290
   503
In full generality, mixfix declarations work as follows.
wenzelm@46290
   504
  Suppose a constant \isa{{\isaliteral{22}{\isachardoublequote}}c\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{5C3C7461753E}{\isasymtau}}\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}\ {\isaliteral{5C3C7461753E}{\isasymtau}}\isaliteral{5C3C5E7375623E}{}\isactrlsub n\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ {\isaliteral{5C3C7461753E}{\isasymtau}}{\isaliteral{22}{\isachardoublequote}}} is annotated by
wenzelm@46290
   505
  \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}mixfix\ {\isaliteral{5B}{\isacharbrackleft}}p\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{2C}{\isacharcomma}}\ p\isaliteral{5C3C5E7375623E}{}\isactrlsub n{\isaliteral{5D}{\isacharbrackright}}\ p{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}}, where \isa{{\isaliteral{22}{\isachardoublequote}}mixfix{\isaliteral{22}{\isachardoublequote}}} is a string
wenzelm@46290
   506
  \isa{{\isaliteral{22}{\isachardoublequote}}d\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{0}}\ {\isaliteral{5F}{\isacharunderscore}}\ d\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}\ {\isaliteral{5F}{\isacharunderscore}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}\ {\isaliteral{5F}{\isacharunderscore}}\ d\isaliteral{5C3C5E7375623E}{}\isactrlsub n{\isaliteral{22}{\isachardoublequote}}} consisting of delimiters that surround
wenzelm@46290
   507
  argument positions as indicated by underscores.
wenzelm@28762
   508
wenzelm@28762
   509
  Altogether this determines a production for a context-free priority
wenzelm@40406
   510
  grammar, where for each argument \isa{{\isaliteral{22}{\isachardoublequote}}i{\isaliteral{22}{\isachardoublequote}}} the syntactic category
wenzelm@46292
   511
  is determined by \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C7461753E}{\isasymtau}}\isaliteral{5C3C5E7375623E}{}\isactrlsub i{\isaliteral{22}{\isachardoublequote}}} (with priority \isa{{\isaliteral{22}{\isachardoublequote}}p\isaliteral{5C3C5E7375623E}{}\isactrlsub i{\isaliteral{22}{\isachardoublequote}}}), and the
wenzelm@46292
   512
  result category is determined from \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C7461753E}{\isasymtau}}{\isaliteral{22}{\isachardoublequote}}} (with priority \isa{{\isaliteral{22}{\isachardoublequote}}p{\isaliteral{22}{\isachardoublequote}}}).  Priority specifications are optional, with default 0 for
wenzelm@46292
   513
  arguments and 1000 for the result.\footnote{Omitting priorities is
wenzelm@46292
   514
  prone to syntactic ambiguities unless the delimiter tokens determine
wenzelm@46292
   515
  fully bracketed notation, as in \isa{{\isaliteral{22}{\isachardoublequote}}if\ {\isaliteral{5F}{\isacharunderscore}}\ then\ {\isaliteral{5F}{\isacharunderscore}}\ else\ {\isaliteral{5F}{\isacharunderscore}}\ fi{\isaliteral{22}{\isachardoublequote}}}.}
wenzelm@28762
   516
wenzelm@40406
   517
  Since \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C7461753E}{\isasymtau}}{\isaliteral{22}{\isachardoublequote}}} may be again a function type, the constant
wenzelm@28762
   518
  type scheme may have more argument positions than the mixfix
wenzelm@40406
   519
  pattern.  Printing a nested application \isa{{\isaliteral{22}{\isachardoublequote}}c\ t\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}\ t\isaliteral{5C3C5E7375623E}{}\isactrlsub m{\isaliteral{22}{\isachardoublequote}}} for
wenzelm@40406
   520
  \isa{{\isaliteral{22}{\isachardoublequote}}m\ {\isaliteral{3E}{\isachargreater}}\ n{\isaliteral{22}{\isachardoublequote}}} works by attaching concrete notation only to the
wenzelm@40406
   521
  innermost part, essentially by printing \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}c\ t\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}\ t\isaliteral{5C3C5E7375623E}{}\isactrlsub n{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}\ t\isaliteral{5C3C5E7375623E}{}\isactrlsub m{\isaliteral{22}{\isachardoublequote}}}
wenzelm@28762
   522
  instead.  If a term has fewer arguments than specified in the mixfix
wenzelm@28762
   523
  template, the concrete syntax is ignored.
wenzelm@28762
   524
wenzelm@28762
   525
  \medskip A mixfix template may also contain additional directives
wenzelm@28762
   526
  for pretty printing, notably spaces, blocks, and breaks.  The
wenzelm@28762
   527
  general template format is a sequence over any of the following
wenzelm@28762
   528
  entities.
wenzelm@28762
   529
wenzelm@28762
   530
  \begin{description}
wenzelm@28762
   531
wenzelm@40406
   532
  \item \isa{{\isaliteral{22}{\isachardoublequote}}d{\isaliteral{22}{\isachardoublequote}}} is a delimiter, namely a non-empty sequence of
wenzelm@28762
   533
  characters other than the following special characters:
wenzelm@28762
   534
wenzelm@28762
   535
  \smallskip
wenzelm@28762
   536
  \begin{tabular}{ll}
wenzelm@28762
   537
    \verb|'| & single quote \\
wenzelm@28762
   538
    \verb|_| & underscore \\
wenzelm@40406
   539
    \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C696E6465783E}{\isasymindex}}{\isaliteral{22}{\isachardoublequote}}} & index symbol \\
wenzelm@28762
   540
    \verb|(| & open parenthesis \\
wenzelm@28762
   541
    \verb|)| & close parenthesis \\
wenzelm@28762
   542
    \verb|/| & slash \\
wenzelm@28762
   543
  \end{tabular}
wenzelm@28762
   544
  \medskip
wenzelm@28762
   545
wenzelm@28762
   546
  \item \verb|'| escapes the special meaning of these
wenzelm@28762
   547
  meta-characters, producing a literal version of the following
wenzelm@28762
   548
  character, unless that is a blank.
wenzelm@28762
   549
wenzelm@28762
   550
  A single quote followed by a blank separates delimiters, without
wenzelm@28762
   551
  affecting printing, but input tokens may have additional white space
wenzelm@28762
   552
  here.
wenzelm@28762
   553
wenzelm@28762
   554
  \item \verb|_| is an argument position, which stands for a
wenzelm@28762
   555
  certain syntactic category in the underlying grammar.
wenzelm@28762
   556
wenzelm@40406
   557
  \item \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C696E6465783E}{\isasymindex}}{\isaliteral{22}{\isachardoublequote}}} is an indexed argument position; this is the place
wenzelm@28762
   558
  where implicit structure arguments can be attached.
wenzelm@28762
   559
wenzelm@40406
   560
  \item \isa{{\isaliteral{22}{\isachardoublequote}}s{\isaliteral{22}{\isachardoublequote}}} is a non-empty sequence of spaces for printing.
wenzelm@28762
   561
  This and the following specifications do not affect parsing at all.
wenzelm@28762
   562
wenzelm@28762
   563
  \item \verb|(|\isa{n} opens a pretty printing block.  The
wenzelm@28762
   564
  optional number specifies how much indentation to add when a line
wenzelm@28762
   565
  break occurs within the block.  If the parenthesis is not followed
wenzelm@28762
   566
  by digits, the indentation defaults to 0.  A block specified via
wenzelm@28762
   567
  \verb|(00| is unbreakable.
wenzelm@28762
   568
wenzelm@28762
   569
  \item \verb|)| closes a pretty printing block.
wenzelm@28762
   570
wenzelm@28762
   571
  \item \verb|//| forces a line break.
wenzelm@28762
   572
wenzelm@28762
   573
  \item \verb|/|\isa{s} allows a line break.  Here \isa{s}
wenzelm@28762
   574
  stands for the string of spaces (zero or more) right after the
wenzelm@28762
   575
  slash.  These spaces are printed if the break is \emph{not} taken.
wenzelm@28762
   576
wenzelm@28762
   577
  \end{description}
wenzelm@28762
   578
wenzelm@28762
   579
  The general idea of pretty printing with blocks and breaks is also
wenzelm@46286
   580
  described in \cite{paulson-ml2}; it goes back to \cite{Oppen:1980}.%
wenzelm@28762
   581
\end{isamarkuptext}%
wenzelm@28762
   582
\isamarkuptrue%
wenzelm@28762
   583
%
wenzelm@46290
   584
\isamarkupsubsection{Infixes%
wenzelm@46290
   585
}
wenzelm@46290
   586
\isamarkuptrue%
wenzelm@46290
   587
%
wenzelm@46290
   588
\begin{isamarkuptext}%
wenzelm@46290
   589
Infix operators are specified by convenient short forms that
wenzelm@46290
   590
  abbreviate general mixfix annotations as follows:
wenzelm@46290
   591
wenzelm@46290
   592
  \begin{center}
wenzelm@46290
   593
  \begin{tabular}{lll}
wenzelm@46290
   594
wenzelm@46292
   595
  \verb|(|\indexdef{}{keyword}{infix}\hypertarget{keyword.infix}{\hyperlink{keyword.infix}{\mbox{\isa{\isakeyword{infix}}}}}~\verb|"|\isa{sy}\verb|"| \isa{{\isaliteral{22}{\isachardoublequote}}p{\isaliteral{22}{\isachardoublequote}}}\verb|)|
wenzelm@46290
   596
  & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6D617073746F3E}{\isasymmapsto}}{\isaliteral{22}{\isachardoublequote}}} &
wenzelm@46290
   597
  \verb|("(_ |\isa{sy}\verb|/ _)" [|\isa{{\isaliteral{22}{\isachardoublequote}}p\ {\isaliteral{2B}{\isacharplus}}\ {\isadigit{1}}{\isaliteral{22}{\isachardoublequote}}}\verb|, |\isa{{\isaliteral{22}{\isachardoublequote}}p\ {\isaliteral{2B}{\isacharplus}}\ {\isadigit{1}}{\isaliteral{22}{\isachardoublequote}}}\verb|]|\isa{{\isaliteral{22}{\isachardoublequote}}\ p{\isaliteral{22}{\isachardoublequote}}}\verb|)| \\
wenzelm@46292
   598
  \verb|(|\indexdef{}{keyword}{infixl}\hypertarget{keyword.infixl}{\hyperlink{keyword.infixl}{\mbox{\isa{\isakeyword{infixl}}}}}~\verb|"|\isa{sy}\verb|"| \isa{{\isaliteral{22}{\isachardoublequote}}p{\isaliteral{22}{\isachardoublequote}}}\verb|)|
wenzelm@46290
   599
  & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6D617073746F3E}{\isasymmapsto}}{\isaliteral{22}{\isachardoublequote}}} &
wenzelm@46290
   600
  \verb|("(_ |\isa{sy}\verb|/ _)" [|\isa{{\isaliteral{22}{\isachardoublequote}}p{\isaliteral{22}{\isachardoublequote}}}\verb|, |\isa{{\isaliteral{22}{\isachardoublequote}}p\ {\isaliteral{2B}{\isacharplus}}\ {\isadigit{1}}{\isaliteral{22}{\isachardoublequote}}}\verb|]|\isa{{\isaliteral{22}{\isachardoublequote}}\ p{\isaliteral{22}{\isachardoublequote}}}\verb|)| \\
wenzelm@46292
   601
  \verb|(|\indexdef{}{keyword}{infixr}\hypertarget{keyword.infixr}{\hyperlink{keyword.infixr}{\mbox{\isa{\isakeyword{infixr}}}}}~\verb|"|\isa{sy}\verb|"| \isa{{\isaliteral{22}{\isachardoublequote}}p{\isaliteral{22}{\isachardoublequote}}}\verb|)|
wenzelm@46290
   602
  & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6D617073746F3E}{\isasymmapsto}}{\isaliteral{22}{\isachardoublequote}}} &
wenzelm@46290
   603
  \verb|("(_ |\isa{sy}\verb|/ _)" [|\isa{{\isaliteral{22}{\isachardoublequote}}p\ {\isaliteral{2B}{\isacharplus}}\ {\isadigit{1}}{\isaliteral{22}{\isachardoublequote}}}\verb|, |\isa{{\isaliteral{22}{\isachardoublequote}}p{\isaliteral{22}{\isachardoublequote}}}\verb|]|\isa{{\isaliteral{22}{\isachardoublequote}}\ p{\isaliteral{22}{\isachardoublequote}}}\verb|)| \\
wenzelm@46290
   604
wenzelm@46290
   605
  \end{tabular}
wenzelm@46290
   606
  \end{center}
wenzelm@46290
   607
wenzelm@46292
   608
  The mixfix template \verb|"(_ |\isa{sy}\verb|/ _)"|
wenzelm@46292
   609
  specifies two argument positions; the delimiter is preceded by a
wenzelm@46292
   610
  space and followed by a space or line break; the entire phrase is a
wenzelm@46292
   611
  pretty printing block.
wenzelm@46290
   612
wenzelm@46290
   613
  The alternative notation \verb|op|~\isa{sy} is introduced
wenzelm@46290
   614
  in addition.  Thus any infix operator may be written in prefix form
wenzelm@46290
   615
  (as in ML), independently of the number of arguments in the term.%
wenzelm@46290
   616
\end{isamarkuptext}%
wenzelm@46290
   617
\isamarkuptrue%
wenzelm@46290
   618
%
wenzelm@46290
   619
\isamarkupsubsection{Binders%
wenzelm@46290
   620
}
wenzelm@46290
   621
\isamarkuptrue%
wenzelm@46290
   622
%
wenzelm@46290
   623
\begin{isamarkuptext}%
wenzelm@46290
   624
A \emph{binder} is a variable-binding construct such as a
wenzelm@46290
   625
  quantifier.  The idea to formalize \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C666F72616C6C3E}{\isasymforall}}x{\isaliteral{2E}{\isachardot}}\ b{\isaliteral{22}{\isachardoublequote}}} as \isa{{\isaliteral{22}{\isachardoublequote}}All\ {\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C6C616D6264613E}{\isasymlambda}}x{\isaliteral{2E}{\isachardot}}\ b{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} for \isa{{\isaliteral{22}{\isachardoublequote}}All\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{28}{\isacharparenleft}}{\isaliteral{27}{\isacharprime}}a\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ bool{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ bool{\isaliteral{22}{\isachardoublequote}}} already goes back
wenzelm@46290
   626
  to \cite{church40}.  Isabelle declarations of certain higher-order
wenzelm@46292
   627
  operators may be annotated with \indexdef{}{keyword}{binder}\hypertarget{keyword.binder}{\hyperlink{keyword.binder}{\mbox{\isa{\isakeyword{binder}}}}} annotations
wenzelm@46292
   628
  as follows:
wenzelm@46290
   629
wenzelm@46290
   630
  \begin{center}
wenzelm@46290
   631
  \isa{{\isaliteral{22}{\isachardoublequote}}c\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{22}{\isachardoublequote}}}\verb|"|\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C7461753E}{\isasymtau}}\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ {\isaliteral{5C3C7461753E}{\isasymtau}}\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{2}}{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ {\isaliteral{5C3C7461753E}{\isasymtau}}\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{3}}{\isaliteral{22}{\isachardoublequote}}}\verb|"  (|\hyperlink{keyword.binder}{\mbox{\isa{\isakeyword{binder}}}}\verb| "|\isa{{\isaliteral{22}{\isachardoublequote}}sy{\isaliteral{22}{\isachardoublequote}}}\verb|" [|\isa{{\isaliteral{22}{\isachardoublequote}}p{\isaliteral{22}{\isachardoublequote}}}\verb|] |\isa{{\isaliteral{22}{\isachardoublequote}}q{\isaliteral{22}{\isachardoublequote}}}\verb|)|
wenzelm@46290
   632
  \end{center}
wenzelm@46290
   633
wenzelm@46290
   634
  This introduces concrete binder syntax \isa{{\isaliteral{22}{\isachardoublequote}}sy\ x{\isaliteral{2E}{\isachardot}}\ b{\isaliteral{22}{\isachardoublequote}}}, where
wenzelm@46290
   635
  \isa{x} is a bound variable of type \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C7461753E}{\isasymtau}}\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}{\isaliteral{22}{\isachardoublequote}}}, the body \isa{b} has type \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C7461753E}{\isasymtau}}\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{2}}{\isaliteral{22}{\isachardoublequote}}} and the whole term has type \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C7461753E}{\isasymtau}}\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{3}}{\isaliteral{22}{\isachardoublequote}}}.
wenzelm@46290
   636
  The optional integer \isa{p} specifies the syntactic priority of
wenzelm@46290
   637
  the body; the default is \isa{{\isaliteral{22}{\isachardoublequote}}q{\isaliteral{22}{\isachardoublequote}}}, which is also the priority of
wenzelm@46290
   638
  the whole construct.
wenzelm@46290
   639
wenzelm@46290
   640
  Internally, the binder syntax is expanded to something like this:
wenzelm@46290
   641
  \begin{center}
wenzelm@46290
   642
  \isa{{\isaliteral{22}{\isachardoublequote}}c{\isaliteral{5F}{\isacharunderscore}}binder\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{22}{\isachardoublequote}}}\verb|"|\isa{{\isaliteral{22}{\isachardoublequote}}idts\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ {\isaliteral{5C3C7461753E}{\isasymtau}}\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{2}}\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ {\isaliteral{5C3C7461753E}{\isasymtau}}\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{3}}{\isaliteral{22}{\isachardoublequote}}}\verb|"  ("(3|\isa{sy}\verb|_./ _)" [0, |\isa{{\isaliteral{22}{\isachardoublequote}}p{\isaliteral{22}{\isachardoublequote}}}\verb|] |\isa{{\isaliteral{22}{\isachardoublequote}}q{\isaliteral{22}{\isachardoublequote}}}\verb|)|
wenzelm@46290
   643
  \end{center}
wenzelm@46290
   644
wenzelm@46290
   645
  Here \hyperlink{syntax.inner.idts}{\mbox{\isa{idts}}} is the nonterminal symbol for a list of
wenzelm@46290
   646
  identifiers with optional type constraints (see also
wenzelm@46290
   647
  \secref{sec:pure-grammar}).  The mixfix template \verb|"(3|\isa{sy}\verb|_./ _)"| defines argument positions
wenzelm@46290
   648
  for the bound identifiers and the body, separated by a dot with
wenzelm@46290
   649
  optional line break; the entire phrase is a pretty printing block of
wenzelm@46290
   650
  indentation level 3.  Note that there is no extra space after \isa{{\isaliteral{22}{\isachardoublequote}}sy{\isaliteral{22}{\isachardoublequote}}}, so it needs to be included user specification if the binder
wenzelm@46290
   651
  syntax ends with a token that may be continued by an identifier
wenzelm@46290
   652
  token at the start of \hyperlink{syntax.inner.idts}{\mbox{\isa{idts}}}.
wenzelm@46290
   653
wenzelm@46290
   654
  Furthermore, a syntax translation to transforms \isa{{\isaliteral{22}{\isachardoublequote}}c{\isaliteral{5F}{\isacharunderscore}}binder\ x\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}\ x\isaliteral{5C3C5E7375623E}{}\isactrlsub n\ b{\isaliteral{22}{\isachardoublequote}}} into iterated application \isa{{\isaliteral{22}{\isachardoublequote}}c\ {\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C6C616D6264613E}{\isasymlambda}}x\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}{\isaliteral{2E}{\isachardot}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}\ c\ {\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C6C616D6264613E}{\isasymlambda}}x\isaliteral{5C3C5E7375623E}{}\isactrlsub n{\isaliteral{2E}{\isachardot}}\ b{\isaliteral{29}{\isacharparenright}}{\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}}.
wenzelm@46290
   655
  This works in both directions, for parsing and printing.%
wenzelm@46290
   656
\end{isamarkuptext}%
wenzelm@46290
   657
\isamarkuptrue%
wenzelm@46290
   658
%
wenzelm@46282
   659
\isamarkupsection{Explicit notation \label{sec:notation}%
wenzelm@28762
   660
}
wenzelm@28762
   661
\isamarkuptrue%
wenzelm@28762
   662
%
wenzelm@28762
   663
\begin{isamarkuptext}%
wenzelm@28762
   664
\begin{matharray}{rcll}
wenzelm@40406
   665
    \indexdef{}{command}{type\_notation}\hypertarget{command.type-notation}{\hyperlink{command.type-notation}{\mbox{\isa{\isacommand{type{\isaliteral{5F}{\isacharunderscore}}notation}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}local{\isaliteral{5F}{\isacharunderscore}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ local{\isaliteral{5F}{\isacharunderscore}}theory{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@40406
   666
    \indexdef{}{command}{no\_type\_notation}\hypertarget{command.no-type-notation}{\hyperlink{command.no-type-notation}{\mbox{\isa{\isacommand{no{\isaliteral{5F}{\isacharunderscore}}type{\isaliteral{5F}{\isacharunderscore}}notation}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}local{\isaliteral{5F}{\isacharunderscore}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ local{\isaliteral{5F}{\isacharunderscore}}theory{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@40406
   667
    \indexdef{}{command}{notation}\hypertarget{command.notation}{\hyperlink{command.notation}{\mbox{\isa{\isacommand{notation}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}local{\isaliteral{5F}{\isacharunderscore}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ local{\isaliteral{5F}{\isacharunderscore}}theory{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@40406
   668
    \indexdef{}{command}{no\_notation}\hypertarget{command.no-notation}{\hyperlink{command.no-notation}{\mbox{\isa{\isacommand{no{\isaliteral{5F}{\isacharunderscore}}notation}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}local{\isaliteral{5F}{\isacharunderscore}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ local{\isaliteral{5F}{\isacharunderscore}}theory{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@40406
   669
    \indexdef{}{command}{write}\hypertarget{command.write}{\hyperlink{command.write}{\mbox{\isa{\isacommand{write}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}proof{\isaliteral{28}{\isacharparenleft}}state{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ proof{\isaliteral{28}{\isacharparenleft}}state{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@28762
   670
  \end{matharray}
wenzelm@28762
   671
wenzelm@46288
   672
  Commands that introduce new logical entities (terms or types)
wenzelm@46288
   673
  usually allow to provide mixfix annotations on the spot, which is
wenzelm@46288
   674
  convenient for default notation.  Nonetheless, the syntax may be
wenzelm@46288
   675
  modified later on by declarations for explicit notation.  This
wenzelm@46288
   676
  allows to add or delete mixfix annotations for of existing logical
wenzelm@46288
   677
  entities within the current context.
wenzelm@46288
   678
wenzelm@42596
   679
  \begin{railoutput}
wenzelm@42662
   680
\rail@begin{5}{}
wenzelm@42596
   681
\rail@bar
wenzelm@42596
   682
\rail@term{\hyperlink{command.type-notation}{\mbox{\isa{\isacommand{type{\isaliteral{5F}{\isacharunderscore}}notation}}}}}[]
wenzelm@42596
   683
\rail@nextbar{1}
wenzelm@42596
   684
\rail@term{\hyperlink{command.no-type-notation}{\mbox{\isa{\isacommand{no{\isaliteral{5F}{\isacharunderscore}}type{\isaliteral{5F}{\isacharunderscore}}notation}}}}}[]
wenzelm@42596
   685
\rail@endbar
wenzelm@42596
   686
\rail@bar
wenzelm@42596
   687
\rail@nextbar{1}
wenzelm@42596
   688
\rail@nont{\hyperlink{syntax.target}{\mbox{\isa{target}}}}[]
wenzelm@42596
   689
\rail@endbar
wenzelm@42596
   690
\rail@bar
wenzelm@42596
   691
\rail@nextbar{1}
wenzelm@42596
   692
\rail@nont{\hyperlink{syntax.mode}{\mbox{\isa{mode}}}}[]
wenzelm@42596
   693
\rail@endbar
wenzelm@42596
   694
\rail@cr{3}
wenzelm@42596
   695
\rail@plus
wenzelm@42596
   696
\rail@nont{\hyperlink{syntax.nameref}{\mbox{\isa{nameref}}}}[]
wenzelm@42596
   697
\rail@nont{\hyperlink{syntax.mixfix}{\mbox{\isa{mixfix}}}}[]
wenzelm@42596
   698
\rail@nextplus{4}
wenzelm@42596
   699
\rail@cterm{\isa{\isakeyword{and}}}[]
wenzelm@42596
   700
\rail@endplus
wenzelm@42596
   701
\rail@end
wenzelm@42662
   702
\rail@begin{5}{}
wenzelm@42596
   703
\rail@bar
wenzelm@42596
   704
\rail@term{\hyperlink{command.notation}{\mbox{\isa{\isacommand{notation}}}}}[]
wenzelm@42596
   705
\rail@nextbar{1}
wenzelm@42596
   706
\rail@term{\hyperlink{command.no-notation}{\mbox{\isa{\isacommand{no{\isaliteral{5F}{\isacharunderscore}}notation}}}}}[]
wenzelm@42596
   707
\rail@endbar
wenzelm@42596
   708
\rail@bar
wenzelm@42596
   709
\rail@nextbar{1}
wenzelm@42596
   710
\rail@nont{\hyperlink{syntax.target}{\mbox{\isa{target}}}}[]
wenzelm@42596
   711
\rail@endbar
wenzelm@42596
   712
\rail@bar
wenzelm@42596
   713
\rail@nextbar{1}
wenzelm@42596
   714
\rail@nont{\hyperlink{syntax.mode}{\mbox{\isa{mode}}}}[]
wenzelm@42596
   715
\rail@endbar
wenzelm@42596
   716
\rail@cr{3}
wenzelm@42596
   717
\rail@plus
wenzelm@42596
   718
\rail@nont{\hyperlink{syntax.nameref}{\mbox{\isa{nameref}}}}[]
wenzelm@42705
   719
\rail@nont{\hyperlink{syntax.struct-mixfix}{\mbox{\isa{struct{\isaliteral{5F}{\isacharunderscore}}mixfix}}}}[]
wenzelm@42596
   720
\rail@nextplus{4}
wenzelm@42596
   721
\rail@cterm{\isa{\isakeyword{and}}}[]
wenzelm@42596
   722
\rail@endplus
wenzelm@42596
   723
\rail@end
wenzelm@42662
   724
\rail@begin{2}{}
wenzelm@42596
   725
\rail@term{\hyperlink{command.write}{\mbox{\isa{\isacommand{write}}}}}[]
wenzelm@42596
   726
\rail@bar
wenzelm@42596
   727
\rail@nextbar{1}
wenzelm@42596
   728
\rail@nont{\hyperlink{syntax.mode}{\mbox{\isa{mode}}}}[]
wenzelm@42596
   729
\rail@endbar
wenzelm@42596
   730
\rail@plus
wenzelm@42596
   731
\rail@nont{\hyperlink{syntax.nameref}{\mbox{\isa{nameref}}}}[]
wenzelm@42705
   732
\rail@nont{\hyperlink{syntax.struct-mixfix}{\mbox{\isa{struct{\isaliteral{5F}{\isacharunderscore}}mixfix}}}}[]
wenzelm@42596
   733
\rail@nextplus{1}
wenzelm@42596
   734
\rail@cterm{\isa{\isakeyword{and}}}[]
wenzelm@42596
   735
\rail@endplus
wenzelm@42596
   736
\rail@end
wenzelm@42596
   737
\end{railoutput}
wenzelm@42596
   738
wenzelm@28762
   739
wenzelm@28762
   740
  \begin{description}
wenzelm@28762
   741
wenzelm@40406
   742
  \item \hyperlink{command.type-notation}{\mbox{\isa{\isacommand{type{\isaliteral{5F}{\isacharunderscore}}notation}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}c\ {\isaliteral{28}{\isacharparenleft}}mx{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} associates mixfix
wenzelm@35414
   743
  syntax with an existing type constructor.  The arity of the
wenzelm@35414
   744
  constructor is retrieved from the context.
wenzelm@46282
   745
wenzelm@40406
   746
  \item \hyperlink{command.no-type-notation}{\mbox{\isa{\isacommand{no{\isaliteral{5F}{\isacharunderscore}}type{\isaliteral{5F}{\isacharunderscore}}notation}}}} is similar to \hyperlink{command.type-notation}{\mbox{\isa{\isacommand{type{\isaliteral{5F}{\isacharunderscore}}notation}}}}, but removes the specified syntax annotation from
wenzelm@35414
   747
  the present context.
wenzelm@35414
   748
wenzelm@40406
   749
  \item \hyperlink{command.notation}{\mbox{\isa{\isacommand{notation}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}c\ {\isaliteral{28}{\isacharparenleft}}mx{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} associates mixfix
wenzelm@35414
   750
  syntax with an existing constant or fixed variable.  The type
wenzelm@35414
   751
  declaration of the given entity is retrieved from the context.
wenzelm@46282
   752
wenzelm@40406
   753
  \item \hyperlink{command.no-notation}{\mbox{\isa{\isacommand{no{\isaliteral{5F}{\isacharunderscore}}notation}}}} is similar to \hyperlink{command.notation}{\mbox{\isa{\isacommand{notation}}}},
wenzelm@28762
   754
  but removes the specified syntax annotation from the present
wenzelm@28762
   755
  context.
wenzelm@28762
   756
wenzelm@36508
   757
  \item \hyperlink{command.write}{\mbox{\isa{\isacommand{write}}}} is similar to \hyperlink{command.notation}{\mbox{\isa{\isacommand{notation}}}}, but
wenzelm@36508
   758
  works within an Isar proof body.
wenzelm@36508
   759
wenzelm@46289
   760
  \end{description}%
wenzelm@28762
   761
\end{isamarkuptext}%
wenzelm@28762
   762
\isamarkuptrue%
wenzelm@28762
   763
%
wenzelm@28762
   764
\isamarkupsection{The Pure syntax \label{sec:pure-syntax}%
wenzelm@28762
   765
}
wenzelm@28762
   766
\isamarkuptrue%
wenzelm@28762
   767
%
wenzelm@46282
   768
\isamarkupsubsection{Lexical matters \label{sec:inner-lex}%
wenzelm@46282
   769
}
wenzelm@46282
   770
\isamarkuptrue%
wenzelm@46282
   771
%
wenzelm@46282
   772
\begin{isamarkuptext}%
wenzelm@46282
   773
The inner lexical syntax vaguely resembles the outer one
wenzelm@46282
   774
  (\secref{sec:outer-lex}), but some details are different.  There are
wenzelm@46282
   775
  two main categories of inner syntax tokens:
wenzelm@46282
   776
wenzelm@46282
   777
  \begin{enumerate}
wenzelm@46282
   778
wenzelm@46282
   779
  \item \emph{delimiters} --- the literal tokens occurring in
wenzelm@46282
   780
  productions of the given priority grammar (cf.\
wenzelm@46282
   781
  \secref{sec:priority-grammar});
wenzelm@46282
   782
wenzelm@46282
   783
  \item \emph{named tokens} --- various categories of identifiers etc.
wenzelm@46282
   784
wenzelm@46282
   785
  \end{enumerate}
wenzelm@46282
   786
wenzelm@46282
   787
  Delimiters override named tokens and may thus render certain
wenzelm@46282
   788
  identifiers inaccessible.  Sometimes the logical context admits
wenzelm@46282
   789
  alternative ways to refer to the same entity, potentially via
wenzelm@46282
   790
  qualified names.
wenzelm@46282
   791
wenzelm@46282
   792
  \medskip The categories for named tokens are defined once and for
wenzelm@46282
   793
  all as follows, reusing some categories of the outer token syntax
wenzelm@46282
   794
  (\secref{sec:outer-lex}).
wenzelm@46282
   795
wenzelm@46282
   796
  \begin{center}
wenzelm@46282
   797
  \begin{supertabular}{rcl}
wenzelm@46282
   798
    \indexdef{inner}{syntax}{id}\hypertarget{syntax.inner.id}{\hyperlink{syntax.inner.id}{\mbox{\isa{id}}}} & = & \indexref{}{syntax}{ident}\hyperlink{syntax.ident}{\mbox{\isa{ident}}} \\
wenzelm@46282
   799
    \indexdef{inner}{syntax}{longid}\hypertarget{syntax.inner.longid}{\hyperlink{syntax.inner.longid}{\mbox{\isa{longid}}}} & = & \indexref{}{syntax}{longident}\hyperlink{syntax.longident}{\mbox{\isa{longident}}} \\
wenzelm@46282
   800
    \indexdef{inner}{syntax}{var}\hypertarget{syntax.inner.var}{\hyperlink{syntax.inner.var}{\mbox{\isa{var}}}} & = & \indexref{}{syntax}{var}\hyperlink{syntax.var}{\mbox{\isa{var}}} \\
wenzelm@46282
   801
    \indexdef{inner}{syntax}{tid}\hypertarget{syntax.inner.tid}{\hyperlink{syntax.inner.tid}{\mbox{\isa{tid}}}} & = & \indexref{}{syntax}{typefree}\hyperlink{syntax.typefree}{\mbox{\isa{typefree}}} \\
wenzelm@46282
   802
    \indexdef{inner}{syntax}{tvar}\hypertarget{syntax.inner.tvar}{\hyperlink{syntax.inner.tvar}{\mbox{\isa{tvar}}}} & = & \indexref{}{syntax}{typevar}\hyperlink{syntax.typevar}{\mbox{\isa{typevar}}} \\
wenzelm@46282
   803
    \indexdef{inner}{syntax}{num\_token}\hypertarget{syntax.inner.num-token}{\hyperlink{syntax.inner.num-token}{\mbox{\isa{num{\isaliteral{5F}{\isacharunderscore}}token}}}} & = & \indexref{}{syntax}{nat}\hyperlink{syntax.nat}{\mbox{\isa{nat}}}\isa{{\isaliteral{22}{\isachardoublequote}}\ \ {\isaliteral{7C}{\isacharbar}}\ \ {\isaliteral{22}{\isachardoublequote}}}\verb|-|\indexref{}{syntax}{nat}\hyperlink{syntax.nat}{\mbox{\isa{nat}}} \\
wenzelm@46282
   804
    \indexdef{inner}{syntax}{float\_token}\hypertarget{syntax.inner.float-token}{\hyperlink{syntax.inner.float-token}{\mbox{\isa{float{\isaliteral{5F}{\isacharunderscore}}token}}}} & = & \indexref{}{syntax}{nat}\hyperlink{syntax.nat}{\mbox{\isa{nat}}}\verb|.|\indexref{}{syntax}{nat}\hyperlink{syntax.nat}{\mbox{\isa{nat}}}\isa{{\isaliteral{22}{\isachardoublequote}}\ \ {\isaliteral{7C}{\isacharbar}}\ \ {\isaliteral{22}{\isachardoublequote}}}\verb|-|\indexref{}{syntax}{nat}\hyperlink{syntax.nat}{\mbox{\isa{nat}}}\verb|.|\indexref{}{syntax}{nat}\hyperlink{syntax.nat}{\mbox{\isa{nat}}} \\
wenzelm@46282
   805
    \indexdef{inner}{syntax}{xnum\_token}\hypertarget{syntax.inner.xnum-token}{\hyperlink{syntax.inner.xnum-token}{\mbox{\isa{xnum{\isaliteral{5F}{\isacharunderscore}}token}}}} & = & \verb|#|\indexref{}{syntax}{nat}\hyperlink{syntax.nat}{\mbox{\isa{nat}}}\isa{{\isaliteral{22}{\isachardoublequote}}\ \ {\isaliteral{7C}{\isacharbar}}\ \ {\isaliteral{22}{\isachardoublequote}}}\verb|#-|\indexref{}{syntax}{nat}\hyperlink{syntax.nat}{\mbox{\isa{nat}}} \\
wenzelm@46282
   806
wenzelm@46483
   807
    \indexdef{inner}{syntax}{str\_token}\hypertarget{syntax.inner.str-token}{\hyperlink{syntax.inner.str-token}{\mbox{\isa{str{\isaliteral{5F}{\isacharunderscore}}token}}}} & = & \verb|''| \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{22}{\isachardoublequote}}} \verb|''| \\
wenzelm@46282
   808
  \end{supertabular}
wenzelm@46282
   809
  \end{center}
wenzelm@46282
   810
wenzelm@46483
   811
  The token categories \hyperlink{syntax.inner.num-token}{\mbox{\isa{num{\isaliteral{5F}{\isacharunderscore}}token}}}, \hyperlink{syntax.inner.float-token}{\mbox{\isa{float{\isaliteral{5F}{\isacharunderscore}}token}}}, \hyperlink{syntax.inner.xnum-token}{\mbox{\isa{xnum{\isaliteral{5F}{\isacharunderscore}}token}}}, and \hyperlink{syntax.inner.str-token}{\mbox{\isa{str{\isaliteral{5F}{\isacharunderscore}}token}}} are not used in Pure.  Object-logics may implement numerals
wenzelm@46282
   812
  and string constants by adding appropriate syntax declarations,
wenzelm@46282
   813
  together with some translation functions (e.g.\ see Isabelle/HOL).
wenzelm@46282
   814
wenzelm@46282
   815
  The derived categories \indexdef{inner}{syntax}{num\_const}\hypertarget{syntax.inner.num-const}{\hyperlink{syntax.inner.num-const}{\mbox{\isa{num{\isaliteral{5F}{\isacharunderscore}}const}}}}, \indexdef{inner}{syntax}{float\_const}\hypertarget{syntax.inner.float-const}{\hyperlink{syntax.inner.float-const}{\mbox{\isa{float{\isaliteral{5F}{\isacharunderscore}}const}}}}, and \indexdef{inner}{syntax}{num\_const}\hypertarget{syntax.inner.num-const}{\hyperlink{syntax.inner.num-const}{\mbox{\isa{num{\isaliteral{5F}{\isacharunderscore}}const}}}} provide
wenzelm@46282
   816
  robust access to the respective tokens: the syntax tree holds a
wenzelm@46282
   817
  syntactic constant instead of a free variable.%
wenzelm@46282
   818
\end{isamarkuptext}%
wenzelm@46282
   819
\isamarkuptrue%
wenzelm@46282
   820
%
wenzelm@28762
   821
\isamarkupsubsection{Priority grammars \label{sec:priority-grammar}%
wenzelm@28762
   822
}
wenzelm@28762
   823
\isamarkuptrue%
wenzelm@28762
   824
%
wenzelm@28762
   825
\begin{isamarkuptext}%
wenzelm@28762
   826
A context-free grammar consists of a set of \emph{terminal
wenzelm@28762
   827
  symbols}, a set of \emph{nonterminal symbols} and a set of
wenzelm@40406
   828
  \emph{productions}.  Productions have the form \isa{{\isaliteral{22}{\isachardoublequote}}A\ {\isaliteral{3D}{\isacharequal}}\ {\isaliteral{5C3C67616D6D613E}{\isasymgamma}}{\isaliteral{22}{\isachardoublequote}}},
wenzelm@40406
   829
  where \isa{A} is a nonterminal and \isa{{\isaliteral{5C3C67616D6D613E}{\isasymgamma}}} is a string of
wenzelm@28762
   830
  terminals and nonterminals.  One designated nonterminal is called
wenzelm@28762
   831
  the \emph{root symbol}.  The language defined by the grammar
wenzelm@28762
   832
  consists of all strings of terminals that can be derived from the
wenzelm@28762
   833
  root symbol by applying productions as rewrite rules.
wenzelm@28762
   834
wenzelm@28762
   835
  The standard Isabelle parser for inner syntax uses a \emph{priority
wenzelm@28762
   836
  grammar}.  Each nonterminal is decorated by an integer priority:
wenzelm@40406
   837
  \isa{{\isaliteral{22}{\isachardoublequote}}A\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7375703E}{}\isactrlsup p\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}}.  In a derivation, \isa{{\isaliteral{22}{\isachardoublequote}}A\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7375703E}{}\isactrlsup p\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} may be rewritten
wenzelm@40406
   838
  using a production \isa{{\isaliteral{22}{\isachardoublequote}}A\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7375703E}{}\isactrlsup q\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{29}{\isacharparenright}}\ {\isaliteral{3D}{\isacharequal}}\ {\isaliteral{5C3C67616D6D613E}{\isasymgamma}}{\isaliteral{22}{\isachardoublequote}}} only if \isa{{\isaliteral{22}{\isachardoublequote}}p\ {\isaliteral{5C3C6C653E}{\isasymle}}\ q{\isaliteral{22}{\isachardoublequote}}}.  Any
wenzelm@28762
   839
  priority grammar can be translated into a normal context-free
wenzelm@28762
   840
  grammar by introducing new nonterminals and productions.
wenzelm@28762
   841
wenzelm@28762
   842
  \medskip Formally, a set of context free productions \isa{G}
wenzelm@40406
   843
  induces a derivation relation \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6C6F6E6772696768746172726F773E}{\isasymlongrightarrow}}\isaliteral{5C3C5E7375623E}{}\isactrlsub G{\isaliteral{22}{\isachardoublequote}}} as follows.  Let \isa{{\isaliteral{5C3C616C7068613E}{\isasymalpha}}} and \isa{{\isaliteral{5C3C626574613E}{\isasymbeta}}} denote strings of terminal or nonterminal symbols.
wenzelm@40406
   844
  Then \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C616C7068613E}{\isasymalpha}}\ A\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7375703E}{}\isactrlsup p\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C626574613E}{\isasymbeta}}\ {\isaliteral{5C3C6C6F6E6772696768746172726F773E}{\isasymlongrightarrow}}\isaliteral{5C3C5E7375623E}{}\isactrlsub G\ {\isaliteral{5C3C616C7068613E}{\isasymalpha}}\ {\isaliteral{5C3C67616D6D613E}{\isasymgamma}}\ {\isaliteral{5C3C626574613E}{\isasymbeta}}{\isaliteral{22}{\isachardoublequote}}} holds if and only if \isa{G}
wenzelm@40406
   845
  contains some production \isa{{\isaliteral{22}{\isachardoublequote}}A\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7375703E}{}\isactrlsup q\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{29}{\isacharparenright}}\ {\isaliteral{3D}{\isacharequal}}\ {\isaliteral{5C3C67616D6D613E}{\isasymgamma}}{\isaliteral{22}{\isachardoublequote}}} for \isa{{\isaliteral{22}{\isachardoublequote}}p\ {\isaliteral{5C3C6C653E}{\isasymle}}\ q{\isaliteral{22}{\isachardoublequote}}}.
wenzelm@28762
   846
wenzelm@28762
   847
  \medskip The following grammar for arithmetic expressions
wenzelm@28762
   848
  demonstrates how binding power and associativity of operators can be
wenzelm@28762
   849
  enforced by priorities.
wenzelm@28762
   850
wenzelm@28762
   851
  \begin{center}
wenzelm@28762
   852
  \begin{tabular}{rclr}
wenzelm@40406
   853
  \isa{{\isaliteral{22}{\isachardoublequote}}A\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{1}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{0}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{0}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{0}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{3D}{\isacharequal}}{\isaliteral{22}{\isachardoublequote}}} & \verb|(| \isa{{\isaliteral{22}{\isachardoublequote}}A\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{0}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \verb|)| \\
wenzelm@40406
   854
  \isa{{\isaliteral{22}{\isachardoublequote}}A\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{1}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{0}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{0}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{0}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{3D}{\isacharequal}}{\isaliteral{22}{\isachardoublequote}}} & \verb|0| \\
wenzelm@40406
   855
  \isa{{\isaliteral{22}{\isachardoublequote}}A\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{0}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{3D}{\isacharequal}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}A\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{0}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \verb|+| \isa{{\isaliteral{22}{\isachardoublequote}}A\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{1}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@40406
   856
  \isa{{\isaliteral{22}{\isachardoublequote}}A\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{2}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{3D}{\isacharequal}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}A\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{3}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \verb|*| \isa{{\isaliteral{22}{\isachardoublequote}}A\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{2}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@40406
   857
  \isa{{\isaliteral{22}{\isachardoublequote}}A\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{3}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{3D}{\isacharequal}}{\isaliteral{22}{\isachardoublequote}}} & \verb|-| \isa{{\isaliteral{22}{\isachardoublequote}}A\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{3}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@28762
   858
  \end{tabular}
wenzelm@28762
   859
  \end{center}
wenzelm@28762
   860
  The choice of priorities determines that \verb|-| binds
wenzelm@28762
   861
  tighter than \verb|*|, which binds tighter than \verb|+|.  Furthermore \verb|+| associates to the left and
wenzelm@28762
   862
  \verb|*| to the right.
wenzelm@28762
   863
wenzelm@28762
   864
  \medskip For clarity, grammars obey these conventions:
wenzelm@28762
   865
  \begin{itemize}
wenzelm@28762
   866
wenzelm@28762
   867
  \item All priorities must lie between 0 and 1000.
wenzelm@28762
   868
wenzelm@28762
   869
  \item Priority 0 on the right-hand side and priority 1000 on the
wenzelm@28762
   870
  left-hand side may be omitted.
wenzelm@28762
   871
wenzelm@40406
   872
  \item The production \isa{{\isaliteral{22}{\isachardoublequote}}A\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7375703E}{}\isactrlsup p\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{29}{\isacharparenright}}\ {\isaliteral{3D}{\isacharequal}}\ {\isaliteral{5C3C616C7068613E}{\isasymalpha}}{\isaliteral{22}{\isachardoublequote}}} is written as \isa{{\isaliteral{22}{\isachardoublequote}}A\ {\isaliteral{3D}{\isacharequal}}\ {\isaliteral{5C3C616C7068613E}{\isasymalpha}}\ {\isaliteral{28}{\isacharparenleft}}p{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}}, i.e.\ the priority of the left-hand side actually appears in
wenzelm@28762
   873
  a column on the far right.
wenzelm@28762
   874
wenzelm@40406
   875
  \item Alternatives are separated by \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}}.
wenzelm@28762
   876
wenzelm@40406
   877
  \item Repetition is indicated by dots \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} in an informal
wenzelm@28762
   878
  but obvious way.
wenzelm@28762
   879
wenzelm@28762
   880
  \end{itemize}
wenzelm@28762
   881
wenzelm@28762
   882
  Using these conventions, the example grammar specification above
wenzelm@28762
   883
  takes the form:
wenzelm@28762
   884
  \begin{center}
wenzelm@28762
   885
  \begin{tabular}{rclc}
wenzelm@40406
   886
    \isa{A} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{3D}{\isacharequal}}{\isaliteral{22}{\isachardoublequote}}} & \verb|(| \isa{A} \verb|)| \\
wenzelm@40406
   887
              & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \verb|0| & \qquad\qquad \\
wenzelm@40406
   888
              & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \isa{A} \verb|+| \isa{{\isaliteral{22}{\isachardoublequote}}A\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{1}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isadigit{0}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@40406
   889
              & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}A\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{3}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \verb|*| \isa{{\isaliteral{22}{\isachardoublequote}}A\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{2}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isadigit{2}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@40406
   890
              & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \verb|-| \isa{{\isaliteral{22}{\isachardoublequote}}A\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{3}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isadigit{3}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@28762
   891
  \end{tabular}
wenzelm@28762
   892
  \end{center}%
wenzelm@28762
   893
\end{isamarkuptext}%
wenzelm@28762
   894
\isamarkuptrue%
wenzelm@28762
   895
%
wenzelm@46290
   896
\isamarkupsubsection{The Pure grammar \label{sec:pure-grammar}%
wenzelm@28762
   897
}
wenzelm@28762
   898
\isamarkuptrue%
wenzelm@28762
   899
%
wenzelm@28762
   900
\begin{isamarkuptext}%
wenzelm@46287
   901
The priority grammar of the \isa{{\isaliteral{22}{\isachardoublequote}}Pure{\isaliteral{22}{\isachardoublequote}}} theory is defined
wenzelm@46287
   902
  approximately like this:
wenzelm@28762
   903
wenzelm@28762
   904
  \begin{center}
wenzelm@28762
   905
  \begin{supertabular}{rclr}
wenzelm@28762
   906
wenzelm@40406
   907
  \indexdef{inner}{syntax}{any}\hypertarget{syntax.inner.any}{\hyperlink{syntax.inner.any}{\mbox{\isa{any}}}} & = & \isa{{\isaliteral{22}{\isachardoublequote}}prop\ \ {\isaliteral{7C}{\isacharbar}}\ \ logic{\isaliteral{22}{\isachardoublequote}}} \\\\
wenzelm@28762
   908
wenzelm@28762
   909
  \indexdef{inner}{syntax}{prop}\hypertarget{syntax.inner.prop}{\hyperlink{syntax.inner.prop}{\mbox{\isa{prop}}}} & = & \verb|(| \isa{prop} \verb|)| \\
wenzelm@40406
   910
    & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}prop\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{4}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \verb|::| \isa{type} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isadigit{3}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@40406
   911
    & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}any\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{3}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \verb|==| \isa{{\isaliteral{22}{\isachardoublequote}}any\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{2}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isadigit{2}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@40406
   912
    & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}any\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{3}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C65717569763E}{\isasymequiv}}{\isaliteral{22}{\isachardoublequote}}} \isa{{\isaliteral{22}{\isachardoublequote}}any\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{2}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isadigit{2}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@40406
   913
    & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}prop\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{3}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \verb|&&&| \isa{{\isaliteral{22}{\isachardoublequote}}prop\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{2}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isadigit{2}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@40406
   914
    & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}prop\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{2}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \verb|==>| \isa{{\isaliteral{22}{\isachardoublequote}}prop\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{1}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isadigit{1}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@40406
   915
    & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}prop\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{2}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}{\isaliteral{22}{\isachardoublequote}}} \isa{{\isaliteral{22}{\isachardoublequote}}prop\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{1}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isadigit{1}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@40406
   916
    & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \verb|[|\verb,|,\verb|| \isa{prop} \verb|;| \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{22}{\isachardoublequote}}} \verb|;| \isa{prop} \verb||\verb,|,\verb|]| \verb|==>| \isa{{\isaliteral{22}{\isachardoublequote}}prop\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{1}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isadigit{1}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@40406
   917
    & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6C6272616B6B3E}{\isasymlbrakk}}{\isaliteral{22}{\isachardoublequote}}} \isa{prop} \verb|;| \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{22}{\isachardoublequote}}} \verb|;| \isa{prop} \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C726272616B6B3E}{\isasymrbrakk}}{\isaliteral{22}{\isachardoublequote}}} \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}{\isaliteral{22}{\isachardoublequote}}} \isa{{\isaliteral{22}{\isachardoublequote}}prop\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{1}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isadigit{1}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@40406
   918
    & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \verb|!!| \isa{idts} \verb|.| \isa{prop} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isadigit{0}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@40406
   919
    & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C416E643E}{\isasymAnd}}{\isaliteral{22}{\isachardoublequote}}} \isa{idts} \verb|.| \isa{prop} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isadigit{0}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@40406
   920
    & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \verb|OFCLASS| \verb|(| \isa{type} \verb|,| \isa{logic} \verb|)| \\
wenzelm@40406
   921
    & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \verb|SORT_CONSTRAINT| \verb|(| \isa{type} \verb|)| \\
wenzelm@40406
   922
    & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \verb|TERM| \isa{logic} \\
wenzelm@40406
   923
    & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \verb|PROP| \isa{aprop} \\\\
wenzelm@28762
   924
wenzelm@28857
   925
  \indexdef{inner}{syntax}{aprop}\hypertarget{syntax.inner.aprop}{\hyperlink{syntax.inner.aprop}{\mbox{\isa{aprop}}}} & = & \verb|(| \isa{aprop} \verb|)| \\
wenzelm@40406
   926
    & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}id\ \ {\isaliteral{7C}{\isacharbar}}\ \ longid\ \ {\isaliteral{7C}{\isacharbar}}\ \ var\ \ {\isaliteral{7C}{\isacharbar}}\ \ {\isaliteral{22}{\isachardoublequote}}}\verb|_|\isa{{\isaliteral{22}{\isachardoublequote}}\ \ {\isaliteral{7C}{\isacharbar}}\ \ {\isaliteral{22}{\isachardoublequote}}}\verb|...| \\
wenzelm@40406
   927
    & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \verb|CONST| \isa{{\isaliteral{22}{\isachardoublequote}}id\ \ {\isaliteral{7C}{\isacharbar}}\ \ {\isaliteral{22}{\isachardoublequote}}}\verb|CONST| \isa{{\isaliteral{22}{\isachardoublequote}}longid{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@46287
   928
    & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \verb|XCONST| \isa{{\isaliteral{22}{\isachardoublequote}}id\ \ {\isaliteral{7C}{\isacharbar}}\ \ {\isaliteral{22}{\isachardoublequote}}}\verb|XCONST| \isa{{\isaliteral{22}{\isachardoublequote}}longid{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@40406
   929
    & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}logic\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{1}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{0}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{0}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{0}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{29}{\isacharparenright}}\ \ any\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{1}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{0}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{0}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{0}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}\ any\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{1}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{0}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{0}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{0}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isadigit{9}}{\isadigit{9}}{\isadigit{9}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\\\
wenzelm@28762
   930
wenzelm@28762
   931
  \indexdef{inner}{syntax}{logic}\hypertarget{syntax.inner.logic}{\hyperlink{syntax.inner.logic}{\mbox{\isa{logic}}}} & = & \verb|(| \isa{logic} \verb|)| \\
wenzelm@40406
   932
    & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}logic\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{4}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \verb|::| \isa{type} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isadigit{3}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@40406
   933
    & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}id\ \ {\isaliteral{7C}{\isacharbar}}\ \ longid\ \ {\isaliteral{7C}{\isacharbar}}\ \ var\ \ {\isaliteral{7C}{\isacharbar}}\ \ {\isaliteral{22}{\isachardoublequote}}}\verb|_|\isa{{\isaliteral{22}{\isachardoublequote}}\ \ {\isaliteral{7C}{\isacharbar}}\ \ {\isaliteral{22}{\isachardoublequote}}}\verb|...| \\
wenzelm@40406
   934
    & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \verb|CONST| \isa{{\isaliteral{22}{\isachardoublequote}}id\ \ {\isaliteral{7C}{\isacharbar}}\ \ {\isaliteral{22}{\isachardoublequote}}}\verb|CONST| \isa{{\isaliteral{22}{\isachardoublequote}}longid{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@46287
   935
    & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \verb|XCONST| \isa{{\isaliteral{22}{\isachardoublequote}}id\ \ {\isaliteral{7C}{\isacharbar}}\ \ {\isaliteral{22}{\isachardoublequote}}}\verb|XCONST| \isa{{\isaliteral{22}{\isachardoublequote}}longid{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@40406
   936
    & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}logic\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{1}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{0}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{0}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{0}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{29}{\isacharparenright}}\ \ any\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{1}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{0}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{0}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{0}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}\ any\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{1}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{0}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{0}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{0}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isadigit{9}}{\isadigit{9}}{\isadigit{9}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@46287
   937
    & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C7374727563743E}{\isasymstruct}}\ index\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{1}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{0}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{0}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{0}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@40406
   938
    & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \verb|%| \isa{pttrns} \verb|.| \isa{{\isaliteral{22}{\isachardoublequote}}any\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{3}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isadigit{3}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@40406
   939
    & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{5C3C6C616D6264613E}{\isasymlambda}}} \isa{pttrns} \verb|.| \isa{{\isaliteral{22}{\isachardoublequote}}any\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{3}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isadigit{3}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@46287
   940
    & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \verb|op| \verb|==|\isa{{\isaliteral{22}{\isachardoublequote}}\ \ {\isaliteral{7C}{\isacharbar}}\ \ {\isaliteral{22}{\isachardoublequote}}}\verb|op| \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C65717569763E}{\isasymequiv}}{\isaliteral{22}{\isachardoublequote}}}\isa{{\isaliteral{22}{\isachardoublequote}}\ \ {\isaliteral{7C}{\isacharbar}}\ \ {\isaliteral{22}{\isachardoublequote}}}\verb|op| \verb|&&&| \\
wenzelm@46287
   941
    & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \verb|op| \verb|==>|\isa{{\isaliteral{22}{\isachardoublequote}}\ \ {\isaliteral{7C}{\isacharbar}}\ \ {\isaliteral{22}{\isachardoublequote}}}\verb|op| \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@40406
   942
    & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \verb|TYPE| \verb|(| \isa{type} \verb|)| \\\\
wenzelm@28762
   943
wenzelm@40406
   944
  \indexdef{inner}{syntax}{idt}\hypertarget{syntax.inner.idt}{\hyperlink{syntax.inner.idt}{\mbox{\isa{idt}}}} & = & \verb|(| \isa{idt} \verb|)|\isa{{\isaliteral{22}{\isachardoublequote}}\ \ {\isaliteral{7C}{\isacharbar}}\ \ id\ \ {\isaliteral{7C}{\isacharbar}}\ \ {\isaliteral{22}{\isachardoublequote}}}\verb|_| \\
wenzelm@40406
   945
    & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \isa{id} \verb|::| \isa{type} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isadigit{0}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@40406
   946
    & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \verb|_| \verb|::| \isa{type} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isadigit{0}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\\\
wenzelm@28762
   947
wenzelm@46287
   948
  \indexdef{inner}{syntax}{index}\hypertarget{syntax.inner.index}{\hyperlink{syntax.inner.index}{\mbox{\isa{index}}}} & = & \verb|\<^bsub>| \isa{{\isaliteral{22}{\isachardoublequote}}logic\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{0}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \verb|\<^esub>|\isa{{\isaliteral{22}{\isachardoublequote}}\ \ {\isaliteral{7C}{\isacharbar}}\ \ {\isaliteral{7C}{\isacharbar}}\ \ {\isaliteral{5C3C696E6465783E}{\isasymindex}}{\isaliteral{22}{\isachardoublequote}}} \\\\
wenzelm@46287
   949
wenzelm@40406
   950
  \indexdef{inner}{syntax}{idts}\hypertarget{syntax.inner.idts}{\hyperlink{syntax.inner.idts}{\mbox{\isa{idts}}}} & = & \isa{{\isaliteral{22}{\isachardoublequote}}idt\ \ {\isaliteral{7C}{\isacharbar}}\ \ idt\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{1}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{29}{\isacharparenright}}\ idts{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isadigit{0}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\\\
wenzelm@28762
   951
wenzelm@28762
   952
  \indexdef{inner}{syntax}{pttrn}\hypertarget{syntax.inner.pttrn}{\hyperlink{syntax.inner.pttrn}{\mbox{\isa{pttrn}}}} & = & \isa{idt} \\\\
wenzelm@28762
   953
wenzelm@40406
   954
  \indexdef{inner}{syntax}{pttrns}\hypertarget{syntax.inner.pttrns}{\hyperlink{syntax.inner.pttrns}{\mbox{\isa{pttrns}}}} & = & \isa{{\isaliteral{22}{\isachardoublequote}}pttrn\ \ {\isaliteral{7C}{\isacharbar}}\ \ pttrn\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{1}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{29}{\isacharparenright}}\ pttrns{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isadigit{0}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\\\
wenzelm@28762
   955
wenzelm@28762
   956
  \indexdef{inner}{syntax}{type}\hypertarget{syntax.inner.type}{\hyperlink{syntax.inner.type}{\mbox{\isa{type}}}} & = & \verb|(| \isa{type} \verb|)| \\
wenzelm@40406
   957
    & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}tid\ \ {\isaliteral{7C}{\isacharbar}}\ \ tvar\ \ {\isaliteral{7C}{\isacharbar}}\ \ {\isaliteral{22}{\isachardoublequote}}}\verb|_| \\
wenzelm@40406
   958
    & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}tid{\isaliteral{22}{\isachardoublequote}}} \verb|::| \isa{{\isaliteral{22}{\isachardoublequote}}sort\ \ {\isaliteral{7C}{\isacharbar}}\ \ tvar\ \ {\isaliteral{22}{\isachardoublequote}}}\verb|::| \isa{{\isaliteral{22}{\isachardoublequote}}sort\ \ {\isaliteral{7C}{\isacharbar}}\ \ {\isaliteral{22}{\isachardoublequote}}}\verb|_| \verb|::| \isa{{\isaliteral{22}{\isachardoublequote}}sort{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@46287
   959
    & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}type{\isaliteral{5F}{\isacharunderscore}}name\ \ {\isaliteral{7C}{\isacharbar}}\ \ type\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{1}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{0}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{0}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{0}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{29}{\isacharparenright}}\ type{\isaliteral{5F}{\isacharunderscore}}name{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@46287
   960
    & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \verb|(| \isa{type} \verb|,| \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{22}{\isachardoublequote}}} \verb|,| \isa{type} \verb|)| \isa{type{\isaliteral{5F}{\isacharunderscore}}name} \\
wenzelm@40406
   961
    & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}type\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{1}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \verb|=>| \isa{type} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isadigit{0}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@40406
   962
    & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \isa{{\isaliteral{22}{\isachardoublequote}}type\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isadigit{1}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}{\isaliteral{22}{\isachardoublequote}}} \isa{type} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isadigit{0}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@40406
   963
    & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \verb|[| \isa{type} \verb|,| \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{22}{\isachardoublequote}}} \verb|,| \isa{type} \verb|]| \verb|=>| \isa{type} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isadigit{0}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@46287
   964
    & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \verb|[| \isa{type} \verb|,| \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{22}{\isachardoublequote}}} \verb|,| \isa{type} \verb|]| \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}{\isaliteral{22}{\isachardoublequote}}} \isa{type} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isadigit{0}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@46287
   965
  \indexdef{inner}{syntax}{type\_name}\hypertarget{syntax.inner.type-name}{\hyperlink{syntax.inner.type-name}{\mbox{\isa{type{\isaliteral{5F}{\isacharunderscore}}name}}}} & = & \isa{{\isaliteral{22}{\isachardoublequote}}id\ \ {\isaliteral{7C}{\isacharbar}}\ \ longid{\isaliteral{22}{\isachardoublequote}}} \\\\
wenzelm@28762
   966
wenzelm@46287
   967
  \indexdef{inner}{syntax}{sort}\hypertarget{syntax.inner.sort}{\hyperlink{syntax.inner.sort}{\mbox{\isa{sort}}}} & = & \hyperlink{syntax.class-name}{\mbox{\isa{class{\isaliteral{5F}{\isacharunderscore}}name}}}~\isa{{\isaliteral{22}{\isachardoublequote}}\ \ {\isaliteral{7C}{\isacharbar}}\ \ {\isaliteral{22}{\isachardoublequote}}}\verb|{}| \\
wenzelm@46287
   968
    & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \verb|{| \hyperlink{syntax.class-name}{\mbox{\isa{class{\isaliteral{5F}{\isacharunderscore}}name}}} \verb|,| \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{22}{\isachardoublequote}}} \verb|,| \hyperlink{syntax.class-name}{\mbox{\isa{class{\isaliteral{5F}{\isacharunderscore}}name}}} \verb|}| \\
wenzelm@46287
   969
  \indexdef{inner}{syntax}{class\_name}\hypertarget{syntax.inner.class-name}{\hyperlink{syntax.inner.class-name}{\mbox{\isa{class{\isaliteral{5F}{\isacharunderscore}}name}}}} & = & \isa{{\isaliteral{22}{\isachardoublequote}}id\ \ {\isaliteral{7C}{\isacharbar}}\ \ longid{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@28762
   970
  \end{supertabular}
wenzelm@28762
   971
  \end{center}
wenzelm@28762
   972
wenzelm@28762
   973
  \medskip Here literal terminals are printed \verb|verbatim|;
wenzelm@28762
   974
  see also \secref{sec:inner-lex} for further token categories of the
wenzelm@28762
   975
  inner syntax.  The meaning of the nonterminals defined by the above
wenzelm@28762
   976
  grammar is as follows:
wenzelm@28762
   977
wenzelm@28762
   978
  \begin{description}
wenzelm@28762
   979
wenzelm@28762
   980
  \item \indexref{inner}{syntax}{any}\hyperlink{syntax.inner.any}{\mbox{\isa{any}}} denotes any term.
wenzelm@28762
   981
wenzelm@28762
   982
  \item \indexref{inner}{syntax}{prop}\hyperlink{syntax.inner.prop}{\mbox{\isa{prop}}} denotes meta-level propositions,
wenzelm@28762
   983
  which are terms of type \isa{prop}.  The syntax of such formulae of
wenzelm@28762
   984
  the meta-logic is carefully distinguished from usual conventions for
wenzelm@40406
   985
  object-logics.  In particular, plain \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6C616D6264613E}{\isasymlambda}}{\isaliteral{22}{\isachardoublequote}}}-term notation is
wenzelm@28762
   986
  \emph{not} recognized as \hyperlink{syntax.inner.prop}{\mbox{\isa{prop}}}.
wenzelm@28762
   987
wenzelm@28762
   988
  \item \indexref{inner}{syntax}{aprop}\hyperlink{syntax.inner.aprop}{\mbox{\isa{aprop}}} denotes atomic propositions, which
wenzelm@28762
   989
  are embedded into regular \hyperlink{syntax.inner.prop}{\mbox{\isa{prop}}} by means of an
wenzelm@28762
   990
  explicit \verb|PROP| token.
wenzelm@28762
   991
wenzelm@28762
   992
  Terms of type \isa{prop} with non-constant head, e.g.\ a plain
wenzelm@28762
   993
  variable, are printed in this form.  Constants that yield type \isa{prop} are expected to provide their own concrete syntax; otherwise
wenzelm@28762
   994
  the printed version will appear like \hyperlink{syntax.inner.logic}{\mbox{\isa{logic}}} and
wenzelm@28762
   995
  cannot be parsed again as \hyperlink{syntax.inner.prop}{\mbox{\isa{prop}}}.
wenzelm@28762
   996
wenzelm@28762
   997
  \item \indexref{inner}{syntax}{logic}\hyperlink{syntax.inner.logic}{\mbox{\isa{logic}}} denotes arbitrary terms of a
wenzelm@28762
   998
  logical type, excluding type \isa{prop}.  This is the main
wenzelm@40406
   999
  syntactic category of object-logic entities, covering plain \isa{{\isaliteral{5C3C6C616D6264613E}{\isasymlambda}}}-term notation (variables, abstraction, application), plus
wenzelm@28762
  1000
  anything defined by the user.
wenzelm@28762
  1001
wenzelm@28762
  1002
  When specifying notation for logical entities, all logical types
wenzelm@28762
  1003
  (excluding \isa{prop}) are \emph{collapsed} to this single category
wenzelm@28762
  1004
  of \hyperlink{syntax.inner.logic}{\mbox{\isa{logic}}}.
wenzelm@28762
  1005
wenzelm@46287
  1006
  \item \indexref{inner}{syntax}{index}\hyperlink{syntax.inner.index}{\mbox{\isa{index}}} denotes an optional index term for
wenzelm@46287
  1007
  indexed syntax.  If omitted, it refers to the first \hyperlink{keyword.structure}{\mbox{\isa{\isakeyword{structure}}}} variable in the context.  The special dummy ``\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C696E6465783E}{\isasymindex}}{\isaliteral{22}{\isachardoublequote}}}'' serves as pattern variable in mixfix annotations that
wenzelm@46287
  1008
  introduce indexed notation.
wenzelm@46287
  1009
wenzelm@28762
  1010
  \item \indexref{inner}{syntax}{idt}\hyperlink{syntax.inner.idt}{\mbox{\isa{idt}}} denotes identifiers, possibly
wenzelm@28762
  1011
  constrained by types.
wenzelm@28762
  1012
wenzelm@28762
  1013
  \item \indexref{inner}{syntax}{idts}\hyperlink{syntax.inner.idts}{\mbox{\isa{idts}}} denotes a sequence of \indexref{inner}{syntax}{idt}\hyperlink{syntax.inner.idt}{\mbox{\isa{idt}}}.  This is the most basic category for variables in
wenzelm@40406
  1014
  iterated binders, such as \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6C616D6264613E}{\isasymlambda}}{\isaliteral{22}{\isachardoublequote}}} or \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C416E643E}{\isasymAnd}}{\isaliteral{22}{\isachardoublequote}}}.
wenzelm@28762
  1015
wenzelm@28762
  1016
  \item \indexref{inner}{syntax}{pttrn}\hyperlink{syntax.inner.pttrn}{\mbox{\isa{pttrn}}} and \indexref{inner}{syntax}{pttrns}\hyperlink{syntax.inner.pttrns}{\mbox{\isa{pttrns}}}
wenzelm@28762
  1017
  denote patterns for abstraction, cases bindings etc.  In Pure, these
wenzelm@28762
  1018
  categories start as a merely copy of \hyperlink{syntax.inner.idt}{\mbox{\isa{idt}}} and
wenzelm@28762
  1019
  \hyperlink{syntax.inner.idts}{\mbox{\isa{idts}}}, respectively.  Object-logics may add
wenzelm@28762
  1020
  additional productions for binding forms.
wenzelm@28762
  1021
wenzelm@28762
  1022
  \item \indexref{inner}{syntax}{type}\hyperlink{syntax.inner.type}{\mbox{\isa{type}}} denotes types of the meta-logic.
wenzelm@28762
  1023
wenzelm@28762
  1024
  \item \indexref{inner}{syntax}{sort}\hyperlink{syntax.inner.sort}{\mbox{\isa{sort}}} denotes meta-level sorts.
wenzelm@28762
  1025
wenzelm@28762
  1026
  \end{description}
wenzelm@28762
  1027
wenzelm@28762
  1028
  Here are some further explanations of certain syntax features.
wenzelm@28762
  1029
wenzelm@28762
  1030
  \begin{itemize}
wenzelm@28762
  1031
wenzelm@40406
  1032
  \item In \hyperlink{syntax.inner.idts}{\mbox{\isa{idts}}}, note that \isa{{\isaliteral{22}{\isachardoublequote}}x\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ nat\ y{\isaliteral{22}{\isachardoublequote}}} is
wenzelm@40406
  1033
  parsed as \isa{{\isaliteral{22}{\isachardoublequote}}x\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{28}{\isacharparenleft}}nat\ y{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}}, treating \isa{y} like a type
wenzelm@28762
  1034
  constructor applied to \isa{nat}.  To avoid this interpretation,
wenzelm@40406
  1035
  write \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}x\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ nat{\isaliteral{29}{\isacharparenright}}\ y{\isaliteral{22}{\isachardoublequote}}} with explicit parentheses.
wenzelm@28762
  1036
wenzelm@40406
  1037
  \item Similarly, \isa{{\isaliteral{22}{\isachardoublequote}}x\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ nat\ y\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ nat{\isaliteral{22}{\isachardoublequote}}} is parsed as \isa{{\isaliteral{22}{\isachardoublequote}}x\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{28}{\isacharparenleft}}nat\ y\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ nat{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}}.  The correct form is \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}x\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ nat{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{28}{\isacharparenleft}}y\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ nat{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}}, or \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}x\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ nat{\isaliteral{29}{\isacharparenright}}\ y\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ nat{\isaliteral{22}{\isachardoublequote}}} if \isa{y} is last in the
wenzelm@28762
  1038
  sequence of identifiers.
wenzelm@28762
  1039
wenzelm@28762
  1040
  \item Type constraints for terms bind very weakly.  For example,
wenzelm@40406
  1041
  \isa{{\isaliteral{22}{\isachardoublequote}}x\ {\isaliteral{3C}{\isacharless}}\ y\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ nat{\isaliteral{22}{\isachardoublequote}}} is normally parsed as \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}x\ {\isaliteral{3C}{\isacharless}}\ y{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ nat{\isaliteral{22}{\isachardoublequote}}}, unless \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{3C}{\isacharless}}{\isaliteral{22}{\isachardoublequote}}} has a very low priority, in which case the
wenzelm@40406
  1042
  input is likely to be ambiguous.  The correct form is \isa{{\isaliteral{22}{\isachardoublequote}}x\ {\isaliteral{3C}{\isacharless}}\ {\isaliteral{28}{\isacharparenleft}}y\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ nat{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}}.
wenzelm@28762
  1043
wenzelm@28762
  1044
  \item Constraints may be either written with two literal colons
wenzelm@28762
  1045
  ``\verb|::|'' or the double-colon symbol \verb|\<Colon>|,
wenzelm@28762
  1046
  which actually looks exactly the same in some {\LaTeX} styles.
wenzelm@28762
  1047
wenzelm@28762
  1048
  \item Dummy variables (written as underscore) may occur in different
wenzelm@28762
  1049
  roles.
wenzelm@28762
  1050
wenzelm@28762
  1051
  \begin{description}
wenzelm@28762
  1052
wenzelm@40406
  1053
  \item A type ``\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5F}{\isacharunderscore}}{\isaliteral{22}{\isachardoublequote}}}'' or ``\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5F}{\isacharunderscore}}\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ sort{\isaliteral{22}{\isachardoublequote}}}'' acts like an
wenzelm@28762
  1054
  anonymous inference parameter, which is filled-in according to the
wenzelm@28762
  1055
  most general type produced by the type-checking phase.
wenzelm@28762
  1056
wenzelm@40406
  1057
  \item A bound ``\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5F}{\isacharunderscore}}{\isaliteral{22}{\isachardoublequote}}}'' refers to a vacuous abstraction, where
wenzelm@28762
  1058
  the body does not refer to the binding introduced here.  As in the
wenzelm@40406
  1059
  term \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6C616D6264613E}{\isasymlambda}}x\ {\isaliteral{5F}{\isacharunderscore}}{\isaliteral{2E}{\isachardot}}\ x{\isaliteral{22}{\isachardoublequote}}}, which is \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C616C7068613E}{\isasymalpha}}{\isaliteral{22}{\isachardoublequote}}}-equivalent to \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6C616D6264613E}{\isasymlambda}}x\ y{\isaliteral{2E}{\isachardot}}\ x{\isaliteral{22}{\isachardoublequote}}}.
wenzelm@28762
  1060
wenzelm@40406
  1061
  \item A free ``\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5F}{\isacharunderscore}}{\isaliteral{22}{\isachardoublequote}}}'' refers to an implicit outer binding.
wenzelm@40406
  1062
  Higher definitional packages usually allow forms like \isa{{\isaliteral{22}{\isachardoublequote}}f\ x\ {\isaliteral{5F}{\isacharunderscore}}\ {\isaliteral{3D}{\isacharequal}}\ x{\isaliteral{22}{\isachardoublequote}}}.
wenzelm@28762
  1063
wenzelm@40406
  1064
  \item A schematic ``\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5F}{\isacharunderscore}}{\isaliteral{22}{\isachardoublequote}}}'' (within a term pattern, see
wenzelm@28762
  1065
  \secref{sec:term-decls}) refers to an anonymous variable that is
wenzelm@28762
  1066
  implicitly abstracted over its context of locally bound variables.
wenzelm@40406
  1067
  For example, this allows pattern matching of \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7B}{\isacharbraceleft}}x{\isaliteral{2E}{\isachardot}}\ f\ x\ {\isaliteral{3D}{\isacharequal}}\ g\ x{\isaliteral{7D}{\isacharbraceright}}{\isaliteral{22}{\isachardoublequote}}} against \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7B}{\isacharbraceleft}}x{\isaliteral{2E}{\isachardot}}\ {\isaliteral{5F}{\isacharunderscore}}\ {\isaliteral{3D}{\isacharequal}}\ {\isaliteral{5F}{\isacharunderscore}}{\isaliteral{7D}{\isacharbraceright}}{\isaliteral{22}{\isachardoublequote}}}, or even \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7B}{\isacharbraceleft}}{\isaliteral{5F}{\isacharunderscore}}{\isaliteral{2E}{\isachardot}}\ {\isaliteral{5F}{\isacharunderscore}}\ {\isaliteral{3D}{\isacharequal}}\ {\isaliteral{5F}{\isacharunderscore}}{\isaliteral{7D}{\isacharbraceright}}{\isaliteral{22}{\isachardoublequote}}} by
wenzelm@28762
  1068
  using both bound and schematic dummies.
wenzelm@28762
  1069
wenzelm@28762
  1070
  \end{description}
wenzelm@28762
  1071
wenzelm@28762
  1072
  \item The three literal dots ``\verb|...|'' may be also
wenzelm@28762
  1073
  written as ellipsis symbol \verb|\<dots>|.  In both cases this
wenzelm@28762
  1074
  refers to a special schematic variable, which is bound in the
wenzelm@28762
  1075
  context.  This special term abbreviation works nicely with
wenzelm@28762
  1076
  calculational reasoning (\secref{sec:calculation}).
wenzelm@28762
  1077
wenzelm@46287
  1078
  \item \verb|CONST| ensures that the given identifier is treated
wenzelm@46287
  1079
  as constant term, and passed through the parse tree in fully
wenzelm@46287
  1080
  internalized form.  This is particularly relevant for translation
wenzelm@46287
  1081
  rules (\secref{sec:syn-trans}), notably on the RHS.
wenzelm@46287
  1082
wenzelm@46287
  1083
  \item \verb|XCONST| is similar to \verb|CONST|, but
wenzelm@46287
  1084
  retains the constant name as given.  This is only relevant to
wenzelm@46287
  1085
  translation rules (\secref{sec:syn-trans}), notably on the LHS.
wenzelm@46287
  1086
wenzelm@28762
  1087
  \end{itemize}%
wenzelm@28762
  1088
\end{isamarkuptext}%
wenzelm@28762
  1089
\isamarkuptrue%
wenzelm@28762
  1090
%
wenzelm@46282
  1091
\isamarkupsubsection{Inspecting the syntax%
wenzelm@28762
  1092
}
wenzelm@28762
  1093
\isamarkuptrue%
wenzelm@28762
  1094
%
wenzelm@28762
  1095
\begin{isamarkuptext}%
wenzelm@46282
  1096
\begin{matharray}{rcl}
wenzelm@46282
  1097
    \indexdef{}{command}{print\_syntax}\hypertarget{command.print-syntax}{\hyperlink{command.print-syntax}{\mbox{\isa{\isacommand{print{\isaliteral{5F}{\isacharunderscore}}syntax}}}}}\isa{{\isaliteral{22}{\isachardoublequote}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{2A}{\isacharasterisk}}{\isaliteral{22}{\isachardoublequote}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}context\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@46282
  1098
  \end{matharray}
wenzelm@28762
  1099
wenzelm@46282
  1100
  \begin{description}
wenzelm@28762
  1101
wenzelm@46282
  1102
  \item \hyperlink{command.print-syntax}{\mbox{\isa{\isacommand{print{\isaliteral{5F}{\isacharunderscore}}syntax}}}} prints the inner syntax of the
wenzelm@46282
  1103
  current context.  The output can be quite large; the most important
wenzelm@46282
  1104
  sections are explained below.
wenzelm@28762
  1105
wenzelm@46282
  1106
  \begin{description}
wenzelm@28762
  1107
wenzelm@46282
  1108
  \item \isa{{\isaliteral{22}{\isachardoublequote}}lexicon{\isaliteral{22}{\isachardoublequote}}} lists the delimiters of the inner token
wenzelm@46282
  1109
  language; see \secref{sec:inner-lex}.
wenzelm@28762
  1110
wenzelm@46282
  1111
  \item \isa{{\isaliteral{22}{\isachardoublequote}}prods{\isaliteral{22}{\isachardoublequote}}} lists the productions of the underlying
wenzelm@46282
  1112
  priority grammar; see \secref{sec:priority-grammar}.
wenzelm@28762
  1113
wenzelm@46282
  1114
  The nonterminal \isa{{\isaliteral{22}{\isachardoublequote}}A\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{28}{\isacharparenleft}}\isaliteral{5C3C5E7375703E}{}\isactrlsup p\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} is rendered in plain text as \isa{{\isaliteral{22}{\isachardoublequote}}A{\isaliteral{5B}{\isacharbrackleft}}p{\isaliteral{5D}{\isacharbrackright}}{\isaliteral{22}{\isachardoublequote}}}; delimiters are quoted.  Many productions have an extra
wenzelm@46282
  1115
  \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C646F74733E}{\isasymdots}}\ {\isaliteral{3D}{\isacharequal}}{\isaliteral{3E}{\isachargreater}}\ name{\isaliteral{22}{\isachardoublequote}}}.  These names later become the heads of parse
wenzelm@46282
  1116
  trees; they also guide the pretty printer.
wenzelm@28762
  1117
wenzelm@46282
  1118
  Productions without such parse tree names are called \emph{copy
wenzelm@46282
  1119
  productions}.  Their right-hand side must have exactly one
wenzelm@46282
  1120
  nonterminal symbol (or named token).  The parser does not create a
wenzelm@46282
  1121
  new parse tree node for copy productions, but simply returns the
wenzelm@46282
  1122
  parse tree of the right-hand symbol.
wenzelm@46282
  1123
wenzelm@46282
  1124
  If the right-hand side of a copy production consists of a single
wenzelm@46282
  1125
  nonterminal without any delimiters, then it is called a \emph{chain
wenzelm@46282
  1126
  production}.  Chain productions act as abbreviations: conceptually,
wenzelm@46282
  1127
  they are removed from the grammar by adding new productions.
wenzelm@46282
  1128
  Priority information attached to chain productions is ignored; only
wenzelm@46282
  1129
  the dummy value \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{2D}{\isacharminus}}{\isadigit{1}}{\isaliteral{22}{\isachardoublequote}}} is displayed.
wenzelm@28762
  1130
wenzelm@46282
  1131
  \item \isa{{\isaliteral{22}{\isachardoublequote}}print\ modes{\isaliteral{22}{\isachardoublequote}}} lists the alternative print modes
wenzelm@46282
  1132
  provided by this grammar; see \secref{sec:print-modes}.
wenzelm@46282
  1133
wenzelm@46282
  1134
  \item \isa{{\isaliteral{22}{\isachardoublequote}}parse{\isaliteral{5F}{\isacharunderscore}}rules{\isaliteral{22}{\isachardoublequote}}} and \isa{{\isaliteral{22}{\isachardoublequote}}print{\isaliteral{5F}{\isacharunderscore}}rules{\isaliteral{22}{\isachardoublequote}}} relate to
wenzelm@46282
  1135
  syntax translations (macros); see \secref{sec:syn-trans}.
wenzelm@28762
  1136
wenzelm@46282
  1137
  \item \isa{{\isaliteral{22}{\isachardoublequote}}parse{\isaliteral{5F}{\isacharunderscore}}ast{\isaliteral{5F}{\isacharunderscore}}translation{\isaliteral{22}{\isachardoublequote}}} and \isa{{\isaliteral{22}{\isachardoublequote}}print{\isaliteral{5F}{\isacharunderscore}}ast{\isaliteral{5F}{\isacharunderscore}}translation{\isaliteral{22}{\isachardoublequote}}} list sets of constants that invoke
wenzelm@46282
  1138
  translation functions for abstract syntax trees, which are only
wenzelm@46282
  1139
  required in very special situations; see \secref{sec:tr-funs}.
wenzelm@29158
  1140
wenzelm@46282
  1141
  \item \isa{{\isaliteral{22}{\isachardoublequote}}parse{\isaliteral{5F}{\isacharunderscore}}translation{\isaliteral{22}{\isachardoublequote}}} and \isa{{\isaliteral{22}{\isachardoublequote}}print{\isaliteral{5F}{\isacharunderscore}}translation{\isaliteral{22}{\isachardoublequote}}}
wenzelm@46282
  1142
  list the sets of constants that invoke regular translation
wenzelm@46282
  1143
  functions; see \secref{sec:tr-funs}.
wenzelm@46282
  1144
wenzelm@46282
  1145
  \end{description}
wenzelm@46282
  1146
wenzelm@46282
  1147
  \end{description}%
wenzelm@28762
  1148
\end{isamarkuptext}%
wenzelm@28762
  1149
\isamarkuptrue%
wenzelm@28762
  1150
%
wenzelm@46291
  1151
\isamarkupsubsection{Ambiguity of parsed expressions%
wenzelm@46291
  1152
}
wenzelm@46291
  1153
\isamarkuptrue%
wenzelm@46291
  1154
%
wenzelm@46291
  1155
\begin{isamarkuptext}%
wenzelm@46291
  1156
\begin{tabular}{rcll}
wenzelm@46512
  1157
    \indexdef{}{attribute}{syntax\_ambiguity\_warning}\hypertarget{attribute.syntax-ambiguity-warning}{\hyperlink{attribute.syntax-ambiguity-warning}{\mbox{\isa{syntax{\isaliteral{5F}{\isacharunderscore}}ambiguity{\isaliteral{5F}{\isacharunderscore}}warning}}}} & : & \isa{attribute} & default \isa{true} \\
wenzelm@46506
  1158
    \indexdef{}{attribute}{syntax\_ambiguity\_limit}\hypertarget{attribute.syntax-ambiguity-limit}{\hyperlink{attribute.syntax-ambiguity-limit}{\mbox{\isa{syntax{\isaliteral{5F}{\isacharunderscore}}ambiguity{\isaliteral{5F}{\isacharunderscore}}limit}}}} & : & \isa{attribute} & default \isa{{\isadigit{1}}{\isadigit{0}}} \\
wenzelm@46291
  1159
  \end{tabular}
wenzelm@46291
  1160
wenzelm@46291
  1161
  Depending on the grammar and the given input, parsing may be
wenzelm@46291
  1162
  ambiguous.  Isabelle lets the Earley parser enumerate all possible
wenzelm@46291
  1163
  parse trees, and then tries to make the best out of the situation.
wenzelm@46291
  1164
  Terms that cannot be type-checked are filtered out, which often
wenzelm@46291
  1165
  leads to a unique result in the end.  Unlike regular type
wenzelm@46291
  1166
  reconstruction, which is applied to the whole collection of input
wenzelm@46291
  1167
  terms simultaneously, the filtering stage only treats each given
wenzelm@46291
  1168
  term in isolation.  Filtering is also not attempted for individual
wenzelm@46291
  1169
  types or raw ASTs (as required for \hyperlink{command.translations}{\mbox{\isa{\isacommand{translations}}}}).
wenzelm@46291
  1170
wenzelm@46291
  1171
  Certain warning or error messages are printed, depending on the
wenzelm@46291
  1172
  situation and the given configuration options.  Parsing ultimately
wenzelm@46291
  1173
  fails, if multiple results remain after the filtering phase.
wenzelm@46291
  1174
wenzelm@46291
  1175
  \begin{description}
wenzelm@46291
  1176
wenzelm@46512
  1177
  \item \hyperlink{attribute.syntax-ambiguity-warning}{\mbox{\isa{syntax{\isaliteral{5F}{\isacharunderscore}}ambiguity{\isaliteral{5F}{\isacharunderscore}}warning}}} controls output of
wenzelm@46512
  1178
  explicit warning messages about syntax ambiguity.
wenzelm@46291
  1179
wenzelm@46506
  1180
  \item \hyperlink{attribute.syntax-ambiguity-limit}{\mbox{\isa{syntax{\isaliteral{5F}{\isacharunderscore}}ambiguity{\isaliteral{5F}{\isacharunderscore}}limit}}} determines the number of
wenzelm@46291
  1181
  resulting parse trees that are shown as part of the printed message
wenzelm@46291
  1182
  in case of an ambiguity.
wenzelm@46291
  1183
wenzelm@46291
  1184
  \end{description}%
wenzelm@46291
  1185
\end{isamarkuptext}%
wenzelm@46291
  1186
\isamarkuptrue%
wenzelm@46291
  1187
%
wenzelm@46282
  1188
\isamarkupsection{Raw syntax and translations \label{sec:syn-trans}%
wenzelm@28762
  1189
}
wenzelm@28762
  1190
\isamarkuptrue%
wenzelm@28762
  1191
%
wenzelm@28762
  1192
\begin{isamarkuptext}%
wenzelm@28762
  1193
\begin{matharray}{rcl}
wenzelm@41229
  1194
    \indexdef{}{command}{nonterminal}\hypertarget{command.nonterminal}{\hyperlink{command.nonterminal}{\mbox{\isa{\isacommand{nonterminal}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ theory{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@40406
  1195
    \indexdef{}{command}{syntax}\hypertarget{command.syntax}{\hyperlink{command.syntax}{\mbox{\isa{\isacommand{syntax}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ theory{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@40406
  1196
    \indexdef{}{command}{no\_syntax}\hypertarget{command.no-syntax}{\hyperlink{command.no-syntax}{\mbox{\isa{\isacommand{no{\isaliteral{5F}{\isacharunderscore}}syntax}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ theory{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@40406
  1197
    \indexdef{}{command}{translations}\hypertarget{command.translations}{\hyperlink{command.translations}{\mbox{\isa{\isacommand{translations}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ theory{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@40406
  1198
    \indexdef{}{command}{no\_translations}\hypertarget{command.no-translations}{\hyperlink{command.no-translations}{\mbox{\isa{\isacommand{no{\isaliteral{5F}{\isacharunderscore}}translations}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ theory{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@28762
  1199
  \end{matharray}
wenzelm@28762
  1200
wenzelm@46292
  1201
  Unlike mixfix notation for existing formal entities
wenzelm@46292
  1202
  (\secref{sec:notation}), raw syntax declarations provide full access
wenzelm@46292
  1203
  to the priority grammar of the inner syntax.  This includes
wenzelm@46292
  1204
  additional syntactic categories (via \hyperlink{command.nonterminal}{\mbox{\isa{\isacommand{nonterminal}}}}) and
wenzelm@46292
  1205
  free-form grammar productions (via \hyperlink{command.syntax}{\mbox{\isa{\isacommand{syntax}}}}).  Additional
wenzelm@46292
  1206
  syntax translations (or macros, via \hyperlink{command.translations}{\mbox{\isa{\isacommand{translations}}}}) are
wenzelm@46292
  1207
  required to turn resulting parse trees into proper representations
wenzelm@46292
  1208
  of formal entities again.
wenzelm@46292
  1209
wenzelm@42596
  1210
  \begin{railoutput}
wenzelm@42662
  1211
\rail@begin{2}{}
wenzelm@42596
  1212
\rail@term{\hyperlink{command.nonterminal}{\mbox{\isa{\isacommand{nonterminal}}}}}[]
wenzelm@42596
  1213
\rail@plus
wenzelm@42596
  1214
\rail@nont{\hyperlink{syntax.name}{\mbox{\isa{name}}}}[]
wenzelm@42596
  1215
\rail@nextplus{1}
wenzelm@42596
  1216
\rail@cterm{\isa{\isakeyword{and}}}[]
wenzelm@42596
  1217
\rail@endplus
wenzelm@42596
  1218
\rail@end
wenzelm@42662
  1219
\rail@begin{2}{}
wenzelm@42596
  1220
\rail@bar
wenzelm@42596
  1221
\rail@term{\hyperlink{command.syntax}{\mbox{\isa{\isacommand{syntax}}}}}[]
wenzelm@42596
  1222
\rail@nextbar{1}
wenzelm@42596
  1223
\rail@term{\hyperlink{command.no-syntax}{\mbox{\isa{\isacommand{no{\isaliteral{5F}{\isacharunderscore}}syntax}}}}}[]
wenzelm@42596
  1224
\rail@endbar
wenzelm@42596
  1225
\rail@bar
wenzelm@42596
  1226
\rail@nextbar{1}
wenzelm@42596
  1227
\rail@nont{\hyperlink{syntax.mode}{\mbox{\isa{mode}}}}[]
wenzelm@42596
  1228
\rail@endbar
wenzelm@42596
  1229
\rail@plus
wenzelm@46494
  1230
\rail@nont{\isa{constdecl}}[]
wenzelm@42596
  1231
\rail@nextplus{1}
wenzelm@42596
  1232
\rail@endplus
wenzelm@42596
  1233
\rail@end
wenzelm@42662
  1234
\rail@begin{7}{}
wenzelm@42596
  1235
\rail@bar
wenzelm@42596
  1236
\rail@term{\hyperlink{command.translations}{\mbox{\isa{\isacommand{translations}}}}}[]
wenzelm@42596
  1237
\rail@nextbar{1}
wenzelm@42596
  1238
\rail@term{\hyperlink{command.no-translations}{\mbox{\isa{\isacommand{no{\isaliteral{5F}{\isacharunderscore}}translations}}}}}[]
wenzelm@42596
  1239
\rail@endbar
wenzelm@42596
  1240
\rail@plus
wenzelm@42596
  1241
\rail@nont{\isa{transpat}}[]
wenzelm@42596
  1242
\rail@bar
wenzelm@42596
  1243
\rail@term{\isa{{\isaliteral{3D}{\isacharequal}}{\isaliteral{3D}{\isacharequal}}}}[]
wenzelm@42596
  1244
\rail@nextbar{1}
wenzelm@42596
  1245
\rail@term{\isa{{\isaliteral{3D}{\isacharequal}}{\isaliteral{3E}{\isachargreater}}}}[]
wenzelm@42596
  1246
\rail@nextbar{2}
wenzelm@42596
  1247
\rail@term{\isa{{\isaliteral{3C}{\isacharless}}{\isaliteral{3D}{\isacharequal}}}}[]
wenzelm@42596
  1248
\rail@nextbar{3}
wenzelm@42596
  1249
\rail@term{\isa{{\isaliteral{5C3C72696768746C656674686172706F6F6E733E}{\isasymrightleftharpoons}}}}[]
wenzelm@42596
  1250
\rail@nextbar{4}
wenzelm@42596
  1251
\rail@term{\isa{{\isaliteral{5C3C7269676874686172706F6F6E75703E}{\isasymrightharpoonup}}}}[]
wenzelm@42596
  1252
\rail@nextbar{5}
wenzelm@42596
  1253
\rail@term{\isa{{\isaliteral{5C3C6C656674686172706F6F6E646F776E3E}{\isasymleftharpoondown}}}}[]
wenzelm@42596
  1254
\rail@endbar
wenzelm@42596
  1255
\rail@nont{\isa{transpat}}[]
wenzelm@42596
  1256
\rail@nextplus{6}
wenzelm@42596
  1257
\rail@endplus
wenzelm@42596
  1258
\rail@end
wenzelm@46494
  1259
\rail@begin{2}{\isa{constdecl}}
wenzelm@46494
  1260
\rail@nont{\hyperlink{syntax.name}{\mbox{\isa{name}}}}[]
wenzelm@46494
  1261
\rail@term{\isa{{\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}}}[]
wenzelm@46494
  1262
\rail@nont{\hyperlink{syntax.type}{\mbox{\isa{type}}}}[]
wenzelm@46494
  1263
\rail@bar
wenzelm@46494
  1264
\rail@nextbar{1}
wenzelm@46494
  1265
\rail@nont{\hyperlink{syntax.mixfix}{\mbox{\isa{mixfix}}}}[]
wenzelm@46494
  1266
\rail@endbar
wenzelm@46494
  1267
\rail@end
wenzelm@42596
  1268
\rail@begin{3}{\isa{mode}}
wenzelm@42596
  1269
\rail@term{\isa{{\isaliteral{28}{\isacharparenleft}}}}[]
wenzelm@42596
  1270
\rail@bar
wenzelm@42596
  1271
\rail@nont{\hyperlink{syntax.name}{\mbox{\isa{name}}}}[]
wenzelm@42596
  1272
\rail@nextbar{1}
wenzelm@42596
  1273
\rail@term{\isa{\isakeyword{output}}}[]
wenzelm@42596
  1274
\rail@nextbar{2}
wenzelm@42596
  1275
\rail@nont{\hyperlink{syntax.name}{\mbox{\isa{name}}}}[]
wenzelm@42596
  1276
\rail@term{\isa{\isakeyword{output}}}[]
wenzelm@42596
  1277
\rail@endbar
wenzelm@42596
  1278
\rail@term{\isa{{\isaliteral{29}{\isacharparenright}}}}[]
wenzelm@42596
  1279
\rail@end
wenzelm@42596
  1280
\rail@begin{2}{\isa{transpat}}
wenzelm@42596
  1281
\rail@bar
wenzelm@42596
  1282
\rail@nextbar{1}
wenzelm@42596
  1283
\rail@term{\isa{{\isaliteral{28}{\isacharparenleft}}}}[]
wenzelm@42596
  1284
\rail@nont{\hyperlink{syntax.nameref}{\mbox{\isa{nameref}}}}[]
wenzelm@42596
  1285
\rail@term{\isa{{\isaliteral{29}{\isacharparenright}}}}[]
wenzelm@42596
  1286
\rail@endbar
wenzelm@42596
  1287
\rail@nont{\hyperlink{syntax.string}{\mbox{\isa{string}}}}[]
wenzelm@42596
  1288
\rail@end
wenzelm@42596
  1289
\end{railoutput}
wenzelm@28762
  1290
wenzelm@28762
  1291
wenzelm@28762
  1292
  \begin{description}
wenzelm@46282
  1293
wenzelm@41229
  1294
  \item \hyperlink{command.nonterminal}{\mbox{\isa{\isacommand{nonterminal}}}}~\isa{c} declares a type
wenzelm@28762
  1295
  constructor \isa{c} (without arguments) to act as purely syntactic
wenzelm@28762
  1296
  type: a nonterminal symbol of the inner syntax.
wenzelm@28762
  1297
wenzelm@46292
  1298
  \item \hyperlink{command.syntax}{\mbox{\isa{\isacommand{syntax}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}mode{\isaliteral{29}{\isacharparenright}}\ c\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{5C3C7369676D613E}{\isasymsigma}}\ {\isaliteral{28}{\isacharparenleft}}mx{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} augments the
wenzelm@46292
  1299
  priority grammar and the pretty printer table for the given print
wenzelm@46292
  1300
  mode (default \verb|""|). An optional keyword \indexref{}{keyword}{output}\hyperlink{keyword.output}{\mbox{\isa{\isakeyword{output}}}} means that only the pretty printer table is affected.
wenzelm@46292
  1301
wenzelm@46292
  1302
  Following \secref{sec:mixfix}, the mixfix annotation \isa{{\isaliteral{22}{\isachardoublequote}}mx\ {\isaliteral{3D}{\isacharequal}}\ template\ ps\ q{\isaliteral{22}{\isachardoublequote}}} together with type \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C7369676D613E}{\isasymsigma}}\ {\isaliteral{3D}{\isacharequal}}\ {\isaliteral{5C3C7461753E}{\isasymtau}}\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}\ {\isaliteral{5C3C7461753E}{\isasymtau}}\isaliteral{5C3C5E7375623E}{}\isactrlsub n\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ {\isaliteral{5C3C7461753E}{\isasymtau}}{\isaliteral{22}{\isachardoublequote}}} and
wenzelm@46292
  1303
  specify a grammar production.  The \isa{template} contains
wenzelm@46292
  1304
  delimiter tokens that surround \isa{{\isaliteral{22}{\isachardoublequote}}n{\isaliteral{22}{\isachardoublequote}}} argument positions
wenzelm@46292
  1305
  (\verb|_|).  The latter correspond to nonterminal symbols
wenzelm@46292
  1306
  \isa{{\isaliteral{22}{\isachardoublequote}}A\isaliteral{5C3C5E7375623E}{}\isactrlsub i{\isaliteral{22}{\isachardoublequote}}} derived from the argument types \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C7461753E}{\isasymtau}}\isaliteral{5C3C5E7375623E}{}\isactrlsub i{\isaliteral{22}{\isachardoublequote}}} as
wenzelm@46292
  1307
  follows:
wenzelm@46292
  1308
  \begin{itemize}
wenzelm@46292
  1309
wenzelm@46292
  1310
  \item \isa{{\isaliteral{22}{\isachardoublequote}}prop{\isaliteral{22}{\isachardoublequote}}} if \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C7461753E}{\isasymtau}}\isaliteral{5C3C5E7375623E}{}\isactrlsub i\ {\isaliteral{3D}{\isacharequal}}\ prop{\isaliteral{22}{\isachardoublequote}}}
wenzelm@46292
  1311
wenzelm@46292
  1312
  \item \isa{{\isaliteral{22}{\isachardoublequote}}logic{\isaliteral{22}{\isachardoublequote}}} if \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C7461753E}{\isasymtau}}\isaliteral{5C3C5E7375623E}{}\isactrlsub i\ {\isaliteral{3D}{\isacharequal}}\ {\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{5C3C6B617070613E}{\isasymkappa}}{\isaliteral{22}{\isachardoublequote}}} for logical type
wenzelm@46292
  1313
  constructor \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6B617070613E}{\isasymkappa}}\ {\isaliteral{5C3C6E6F7465713E}{\isasymnoteq}}\ prop{\isaliteral{22}{\isachardoublequote}}}
wenzelm@46292
  1314
wenzelm@46292
  1315
  \item \isa{any} if \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C7461753E}{\isasymtau}}\isaliteral{5C3C5E7375623E}{}\isactrlsub i\ {\isaliteral{3D}{\isacharequal}}\ {\isaliteral{5C3C616C7068613E}{\isasymalpha}}{\isaliteral{22}{\isachardoublequote}}} for type variables
wenzelm@46292
  1316
wenzelm@46292
  1317
  \item \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6B617070613E}{\isasymkappa}}{\isaliteral{22}{\isachardoublequote}}} if \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C7461753E}{\isasymtau}}\isaliteral{5C3C5E7375623E}{}\isactrlsub i\ {\isaliteral{3D}{\isacharequal}}\ {\isaliteral{5C3C6B617070613E}{\isasymkappa}}{\isaliteral{22}{\isachardoublequote}}} for nonterminal \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6B617070613E}{\isasymkappa}}{\isaliteral{22}{\isachardoublequote}}}
wenzelm@46292
  1318
  (syntactic type constructor)
wenzelm@46292
  1319
wenzelm@46292
  1320
  \end{itemize}
wenzelm@46292
  1321
wenzelm@46292
  1322
  Each \isa{{\isaliteral{22}{\isachardoublequote}}A\isaliteral{5C3C5E7375623E}{}\isactrlsub i{\isaliteral{22}{\isachardoublequote}}} is decorated by priority \isa{{\isaliteral{22}{\isachardoublequote}}p\isaliteral{5C3C5E7375623E}{}\isactrlsub i{\isaliteral{22}{\isachardoublequote}}} from the
wenzelm@46292
  1323
  given list \isa{{\isaliteral{22}{\isachardoublequote}}ps{\isaliteral{22}{\isachardoublequote}}}; misssing priorities default to 0.
wenzelm@46292
  1324
wenzelm@46292
  1325
  The resulting nonterminal of the production is determined similarly
wenzelm@46292
  1326
  from type \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C7461753E}{\isasymtau}}{\isaliteral{22}{\isachardoublequote}}}, with priority \isa{{\isaliteral{22}{\isachardoublequote}}q{\isaliteral{22}{\isachardoublequote}}} and default 1000.
wenzelm@46292
  1327
wenzelm@46292
  1328
  \medskip Parsing via this production produces parse trees \isa{{\isaliteral{22}{\isachardoublequote}}t\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{2C}{\isacharcomma}}\ t\isaliteral{5C3C5E7375623E}{}\isactrlsub n{\isaliteral{22}{\isachardoublequote}}} for the argument slots.  The resulting parse tree is
wenzelm@46292
  1329
  composed as \isa{{\isaliteral{22}{\isachardoublequote}}c\ t\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}\ t\isaliteral{5C3C5E7375623E}{}\isactrlsub n{\isaliteral{22}{\isachardoublequote}}}, by using the syntax constant \isa{{\isaliteral{22}{\isachardoublequote}}c{\isaliteral{22}{\isachardoublequote}}} of the syntax declaration.
wenzelm@46292
  1330
wenzelm@46292
  1331
  Such syntactic constants are invented on the spot, without formal
wenzelm@46292
  1332
  check wrt.\ existing declarations.  It is conventional to use plain
wenzelm@46292
  1333
  identifiers prefixed by a single underscore (e.g.\ \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5F}{\isacharunderscore}}foobar{\isaliteral{22}{\isachardoublequote}}}).  Names should be chosen with care, to avoid clashes
wenzelm@46292
  1334
  with unrelated syntax declarations.
wenzelm@46292
  1335
wenzelm@46292
  1336
  \medskip The special case of copy production is specified by \isa{{\isaliteral{22}{\isachardoublequote}}c\ {\isaliteral{3D}{\isacharequal}}\ {\isaliteral{22}{\isachardoublequote}}}\verb|""| (empty string).  It means that the
wenzelm@46292
  1337
  resulting parse tree \isa{{\isaliteral{22}{\isachardoublequote}}t{\isaliteral{22}{\isachardoublequote}}} is copied directly, without any
wenzelm@46292
  1338
  further decoration.
wenzelm@46282
  1339
wenzelm@40406
  1340
  \item \hyperlink{command.no-syntax}{\mbox{\isa{\isacommand{no{\isaliteral{5F}{\isacharunderscore}}syntax}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}mode{\isaliteral{29}{\isacharparenright}}\ decls{\isaliteral{22}{\isachardoublequote}}} removes grammar
wenzelm@28762
  1341
  declarations (and translations) resulting from \isa{decls}, which
wenzelm@28762
  1342
  are interpreted in the same manner as for \hyperlink{command.syntax}{\mbox{\isa{\isacommand{syntax}}}} above.
wenzelm@46282
  1343
wenzelm@28762
  1344
  \item \hyperlink{command.translations}{\mbox{\isa{\isacommand{translations}}}}~\isa{rules} specifies syntactic
wenzelm@40406
  1345
  translation rules (i.e.\ macros): parse~/ print rules (\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C72696768746C656674686172706F6F6E733E}{\isasymrightleftharpoons}}{\isaliteral{22}{\isachardoublequote}}}),
wenzelm@40406
  1346
  parse rules (\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C7269676874686172706F6F6E75703E}{\isasymrightharpoonup}}{\isaliteral{22}{\isachardoublequote}}}), or print rules (\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6C656674686172706F6F6E646F776E3E}{\isasymleftharpoondown}}{\isaliteral{22}{\isachardoublequote}}}).
wenzelm@28762
  1347
  Translation patterns may be prefixed by the syntactic category to be
wenzelm@28762
  1348
  used for parsing; the default is \isa{logic}.
wenzelm@46282
  1349
wenzelm@40406
  1350
  \item \hyperlink{command.no-translations}{\mbox{\isa{\isacommand{no{\isaliteral{5F}{\isacharunderscore}}translations}}}}~\isa{rules} removes syntactic
wenzelm@28762
  1351
  translation rules, which are interpreted in the same manner as for
wenzelm@28762
  1352
  \hyperlink{command.translations}{\mbox{\isa{\isacommand{translations}}}} above.
wenzelm@28762
  1353
wenzelm@46293
  1354
  \end{description}
wenzelm@46293
  1355
wenzelm@46293
  1356
  Raw syntax and translations provides a slightly more low-level
wenzelm@46293
  1357
  access to the grammar and the form of resulting parse trees.  It is
wenzelm@46293
  1358
  often possible to avoid this untyped macro mechanism, and use
wenzelm@46293
  1359
  type-safe \hyperlink{command.abbreviation}{\mbox{\isa{\isacommand{abbreviation}}}} or \hyperlink{command.notation}{\mbox{\isa{\isacommand{notation}}}} instead.
wenzelm@46293
  1360
  Some important situations where \hyperlink{command.syntax}{\mbox{\isa{\isacommand{syntax}}}} and \hyperlink{command.translations}{\mbox{\isa{\isacommand{translations}}}} are really need are as follows:
wenzelm@46293
  1361
wenzelm@46293
  1362
  \begin{itemize}
wenzelm@46293
  1363
wenzelm@46293
  1364
  \item Iterated replacement via recursive \hyperlink{command.translations}{\mbox{\isa{\isacommand{translations}}}}.
wenzelm@46293
  1365
  For example, consider list enumeration \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5B}{\isacharbrackleft}}a{\isaliteral{2C}{\isacharcomma}}\ b{\isaliteral{2C}{\isacharcomma}}\ c{\isaliteral{2C}{\isacharcomma}}\ d{\isaliteral{5D}{\isacharbrackright}}{\isaliteral{22}{\isachardoublequote}}} as
wenzelm@46293
  1366
  defined in theory \hyperlink{theory.List}{\mbox{\isa{List}}} in Isabelle/HOL.
wenzelm@46293
  1367
wenzelm@46293
  1368
  \item Change of binding status of variables: anything beyond the
wenzelm@46293
  1369
  built-in \hyperlink{keyword.binder}{\mbox{\isa{\isakeyword{binder}}}} mixfix annotation requires explicit
wenzelm@46293
  1370
  syntax translations.  For example, consider list filter
wenzelm@46293
  1371
  comprehension \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5B}{\isacharbrackleft}}x\ {\isaliteral{5C3C6C6566746172726F773E}{\isasymleftarrow}}\ xs\ {\isaliteral{2E}{\isachardot}}\ P{\isaliteral{5D}{\isacharbrackright}}{\isaliteral{22}{\isachardoublequote}}} as defined in theory \hyperlink{theory.List}{\mbox{\isa{List}}} in Isabelle/HOL.
wenzelm@46293
  1372
wenzelm@46293
  1373
  \end{itemize}%
wenzelm@28762
  1374
\end{isamarkuptext}%
wenzelm@28762
  1375
\isamarkuptrue%
wenzelm@28762
  1376
%
wenzelm@28762
  1377
\isamarkupsection{Syntax translation functions \label{sec:tr-funs}%
wenzelm@28762
  1378
}
wenzelm@28762
  1379
\isamarkuptrue%
wenzelm@28762
  1380
%
wenzelm@28762
  1381
\begin{isamarkuptext}%
wenzelm@28762
  1382
\begin{matharray}{rcl}
wenzelm@40406
  1383
    \indexdef{}{command}{parse\_ast\_translation}\hypertarget{command.parse-ast-translation}{\hyperlink{command.parse-ast-translation}{\mbox{\isa{\isacommand{parse{\isaliteral{5F}{\isacharunderscore}}ast{\isaliteral{5F}{\isacharunderscore}}translation}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ theory{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@40406
  1384
    \indexdef{}{command}{parse\_translation}\hypertarget{command.parse-translation}{\hyperlink{command.parse-translation}{\mbox{\isa{\isacommand{parse{\isaliteral{5F}{\isacharunderscore}}translation}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ theory{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@40406
  1385
    \indexdef{}{command}{print\_translation}\hypertarget{command.print-translation}{\hyperlink{command.print-translation}{\mbox{\isa{\isacommand{print{\isaliteral{5F}{\isacharunderscore}}translation}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ theory{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@40406
  1386
    \indexdef{}{command}{typed\_print\_translation}\hypertarget{command.typed-print-translation}{\hyperlink{command.typed-print-translation}{\mbox{\isa{\isacommand{typed{\isaliteral{5F}{\isacharunderscore}}print{\isaliteral{5F}{\isacharunderscore}}translation}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ theory{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@40406
  1387
    \indexdef{}{command}{print\_ast\_translation}\hypertarget{command.print-ast-translation}{\hyperlink{command.print-ast-translation}{\mbox{\isa{\isacommand{print{\isaliteral{5F}{\isacharunderscore}}ast{\isaliteral{5F}{\isacharunderscore}}translation}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ theory{\isaliteral{22}{\isachardoublequote}}} \\
wenzelm@28762
  1388
  \end{matharray}
wenzelm@28762
  1389
wenzelm@42596
  1390
  \begin{railoutput}
wenzelm@42662
  1391
\rail@begin{5}{}
wenzelm@42596
  1392
\rail@bar
wenzelm@42596
  1393
\rail@term{\hyperlink{command.parse-ast-translation}{\mbox{\isa{\isacommand{parse{\isaliteral{5F}{\isacharunderscore}}ast{\isaliteral{5F}{\isacharunderscore}}translation}}}}}[]
wenzelm@42596
  1394
\rail@nextbar{1}
wenzelm@42596
  1395
\rail@term{\hyperlink{command.parse-translation}{\mbox{\isa{\isacommand{parse{\isaliteral{5F}{\isacharunderscore}}translation}}}}}[]
wenzelm@42596
  1396
\rail@nextbar{2}
wenzelm@42596
  1397
\rail@term{\hyperlink{command.print-translation}{\mbox{\isa{\isacommand{print{\isaliteral{5F}{\isacharunderscore}}translation}}}}}[]
wenzelm@42596
  1398
\rail@nextbar{3}
wenzelm@42596
  1399
\rail@term{\hyperlink{command.typed-print-translation}{\mbox{\isa{\isacommand{typed{\isaliteral{5F}{\isacharunderscore}}print{\isaliteral{5F}{\isacharunderscore}}translation}}}}}[]
wenzelm@42596
  1400
\rail@nextbar{4}
wenzelm@42596
  1401
\rail@term{\hyperlink{command.print-ast-translation}{\mbox{\isa{\isacommand{print{\isaliteral{5F}{\isacharunderscore}}ast{\isaliteral{5F}{\isacharunderscore}}translation}}}}}[]
wenzelm@42596
  1402
\rail@endbar
wenzelm@42596
  1403
\rail@bar
wenzelm@42596
  1404
\rail@nextbar{1}
wenzelm@42596
  1405
\rail@term{\isa{{\isaliteral{28}{\isacharparenleft}}}}[]
wenzelm@42596
  1406
\rail@term{\isa{\isakeyword{advanced}}}[]
wenzelm@42596
  1407
\rail@term{\isa{{\isaliteral{29}{\isacharparenright}}}}[]
wenzelm@42596
  1408
\rail@endbar
wenzelm@42596
  1409
\rail@nont{\hyperlink{syntax.text}{\mbox{\isa{text}}}}[]
wenzelm@42596
  1410
\rail@end
wenzelm@42596
  1411
\end{railoutput}
wenzelm@42596
  1412
wenzelm@28762
  1413
wenzelm@28762
  1414
  Syntax translation functions written in ML admit almost arbitrary
wenzelm@28762
  1415
  manipulations of Isabelle's inner syntax.  Any of the above commands
wenzelm@42596
  1416
  have a single \hyperlink{syntax.text}{\mbox{\isa{text}}} argument that refers to an ML
wenzelm@28762
  1417
  expression of appropriate type, which are as follows by default:
wenzelm@28762
  1418
wenzelm@28762
  1419
%FIXME proper antiquotations
wenzelm@28762
  1420
\begin{ttbox}
wenzelm@28762
  1421
val parse_ast_translation   : (string * (ast list -> ast)) list
wenzelm@28762
  1422
val parse_translation       : (string * (term list -> term)) list
wenzelm@28762
  1423
val print_translation       : (string * (term list -> term)) list
wenzelm@42247
  1424
val typed_print_translation : (string * (typ -> term list -> term)) list
wenzelm@28762
  1425
val print_ast_translation   : (string * (ast list -> ast)) list
wenzelm@28762
  1426
\end{ttbox}
wenzelm@28762
  1427
wenzelm@40406
  1428
  If the \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}advanced{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} option is given, the corresponding
wenzelm@28762
  1429
  translation functions may depend on the current theory or proof
wenzelm@28762
  1430
  context.  This allows to implement advanced syntax mechanisms, as
wenzelm@28762
  1431
  translations functions may refer to specific theory declarations or
wenzelm@28762
  1432
  auxiliary proof data.
wenzelm@28762
  1433
wenzelm@28762
  1434
%FIXME proper antiquotations
wenzelm@28762
  1435
\begin{ttbox}
wenzelm@28762
  1436
val parse_ast_translation:
wenzelm@28762
  1437
  (string * (Proof.context -> ast list -> ast)) list
wenzelm@28762
  1438
val parse_translation:
wenzelm@28762
  1439
  (string * (Proof.context -> term list -> term)) list
wenzelm@28762
  1440
val print_translation:
wenzelm@28762
  1441
  (string * (Proof.context -> term list -> term)) list
wenzelm@28762
  1442
val typed_print_translation:
wenzelm@42247
  1443
  (string * (Proof.context -> typ -> term list -> term)) list
wenzelm@28762
  1444
val print_ast_translation:
wenzelm@28762
  1445
  (string * (Proof.context -> ast list -> ast)) list
wenzelm@46294
  1446
\end{ttbox}
wenzelm@46294
  1447
wenzelm@46294
  1448
  \medskip See also the chapter on ``Syntax Transformations'' in old
wenzelm@46294
  1449
  \cite{isabelle-ref} for further details on translations on parse
wenzelm@46294
  1450
  trees.%
wenzelm@28762
  1451
\end{isamarkuptext}%
wenzelm@28762
  1452
\isamarkuptrue%
wenzelm@28762
  1453
%
wenzelm@28762
  1454
\isadelimtheory
wenzelm@28762
  1455
%
wenzelm@28762
  1456
\endisadelimtheory
wenzelm@28762
  1457
%
wenzelm@28762
  1458
\isatagtheory
wenzelm@28762
  1459
\isacommand{end}\isamarkupfalse%
wenzelm@28762
  1460
%
wenzelm@28762
  1461
\endisatagtheory
wenzelm@28762
  1462
{\isafoldtheory}%
wenzelm@28762
  1463
%
wenzelm@28762
  1464
\isadelimtheory
wenzelm@28762
  1465
%
wenzelm@28762
  1466
\endisadelimtheory
wenzelm@28762
  1467
\isanewline
wenzelm@28762
  1468
\end{isabellebody}%
wenzelm@28762
  1469
%%% Local Variables:
wenzelm@28762
  1470
%%% mode: latex
wenzelm@28762
  1471
%%% TeX-master: "root"
wenzelm@28762
  1472
%%% End: