doc-src/IsarRef/Thy/document/Inner_Syntax.tex
author wenzelm
Wed, 15 Aug 2012 13:07:24 +0200
changeset 48816 754b09cd616f
parent 48792 4aa5b965f70e
permissions -rw-r--r--
tuned;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
     1
%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
     2
\begin{isabellebody}%
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
     3
\def\isabellecontext{Inner{\isaliteral{5F}{\isacharunderscore}}Syntax}%
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
     4
%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
     5
\isadelimtheory
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
     6
%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
     7
\endisadelimtheory
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
     8
%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
     9
\isatagtheory
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
    10
\isacommand{theory}\isamarkupfalse%
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
    11
\ Inner{\isaliteral{5F}{\isacharunderscore}}Syntax\isanewline
42651
e3fdb7c96be5 formal Base theory;
wenzelm
parents: 42596
diff changeset
    12
\isakeyword{imports}\ Base\ Main\isanewline
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
    13
\isakeyword{begin}%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
    14
\endisatagtheory
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
    15
{\isafoldtheory}%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
    16
%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
    17
\isadelimtheory
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
    18
%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
    19
\endisadelimtheory
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
    20
%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
    21
\isamarkupchapter{Inner syntax --- the term language \label{ch:inner-syntax}%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
    22
}
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
    23
\isamarkuptrue%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
    24
%
46282
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
    25
\begin{isamarkuptext}%
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
    26
The inner syntax of Isabelle provides concrete notation for
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
    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
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
    28
  extend existing syntactic categories by additional notation, or
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
    29
  define new sub-languages that are linked to the standard term
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
    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
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
    31
  user-defined nonterminal \isa{{\isaliteral{22}{\isachardoublequote}}foo{\isaliteral{22}{\isachardoublequote}}} --- within the bounds of the
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
    32
  given lexical syntax of Isabelle/Pure.
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
    33
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
    34
  The most basic way to specify concrete syntax for logical entities
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
    35
  works via mixfix annotations (\secref{sec:mixfix}), which may be
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
    36
  usually given as part of the original declaration or via explicit
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
    37
  notation commands later on (\secref{sec:notation}).  This already
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
    38
  covers many needs of concrete syntax without having to understand
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
    39
  the full complexity of inner syntax layers.
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
    40
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
    41
  Further details of the syntax engine involves the classical
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
    42
  distinction of lexical language versus context-free grammar (see
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
    43
  \secref{sec:pure-syntax}), and various mechanisms for \emph{syntax
48113
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
    44
  transformations} (see \secref{sec:syntax-transformations}).%
46282
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
    45
\end{isamarkuptext}%
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
    46
\isamarkuptrue%
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
    47
%
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
    48
\isamarkupsection{Printing logical entities%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
    49
}
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
    50
\isamarkuptrue%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
    51
%
46284
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
    52
\isamarkupsubsection{Diagnostic commands \label{sec:print-diag}%
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
    53
}
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
    54
\isamarkuptrue%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
    55
%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
    56
\begin{isamarkuptext}%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
    57
\begin{matharray}{rcl}
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
    58
    \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}}} \\
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
    59
    \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}}} \\
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
    60
    \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}}} \\
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
    61
    \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}}} \\
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
    62
    \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}}} \\
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
    63
    \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}}} \\
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
    64
    \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}}} \\
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
    65
  \end{matharray}
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
    66
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
    67
  These diagnostic commands assist interactive development by printing
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
    68
  internal logical entities in a human-readable fashion.
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
    69
42596
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
    70
  \begin{railoutput}
42662
2080fe35abea updated generated files;
wenzelm
parents: 42655
diff changeset
    71
\rail@begin{2}{}
42596
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
    72
\rail@term{\hyperlink{command.typ}{\mbox{\isa{\isacommand{typ}}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
    73
\rail@bar
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
    74
\rail@nextbar{1}
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
    75
\rail@nont{\hyperlink{syntax.modes}{\mbox{\isa{modes}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
    76
\rail@endbar
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
    77
\rail@nont{\hyperlink{syntax.type}{\mbox{\isa{type}}}}[]
48792
4aa5b965f70e support for 'typ' with explicit sort constraint;
wenzelm
parents: 48119
diff changeset
    78
\rail@bar
4aa5b965f70e support for 'typ' with explicit sort constraint;
wenzelm
parents: 48119
diff changeset
    79
\rail@nextbar{1}
4aa5b965f70e support for 'typ' with explicit sort constraint;
wenzelm
parents: 48119
diff changeset
    80
\rail@term{\isa{{\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}}}[]
4aa5b965f70e support for 'typ' with explicit sort constraint;
wenzelm
parents: 48119
diff changeset
    81
\rail@nont{\hyperlink{syntax.sort}{\mbox{\isa{sort}}}}[]
4aa5b965f70e support for 'typ' with explicit sort constraint;
wenzelm
parents: 48119
diff changeset
    82
\rail@endbar
42596
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
    83
\rail@end
42662
2080fe35abea updated generated files;
wenzelm
parents: 42655
diff changeset
    84
\rail@begin{2}{}
42596
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
    85
\rail@term{\hyperlink{command.term}{\mbox{\isa{\isacommand{term}}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
    86
\rail@bar
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
    87
\rail@nextbar{1}
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
    88
\rail@nont{\hyperlink{syntax.modes}{\mbox{\isa{modes}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
    89
\rail@endbar
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
    90
\rail@nont{\hyperlink{syntax.term}{\mbox{\isa{term}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
    91
\rail@end
42662
2080fe35abea updated generated files;
wenzelm
parents: 42655
diff changeset
    92
\rail@begin{2}{}
42596
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
    93
\rail@term{\hyperlink{command.prop}{\mbox{\isa{\isacommand{prop}}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
    94
\rail@bar
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
    95
\rail@nextbar{1}
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
    96
\rail@nont{\hyperlink{syntax.modes}{\mbox{\isa{modes}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
    97
\rail@endbar
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
    98
\rail@nont{\hyperlink{syntax.prop}{\mbox{\isa{prop}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
    99
\rail@end
42662
2080fe35abea updated generated files;
wenzelm
parents: 42655
diff changeset
   100
\rail@begin{2}{}
42596
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   101
\rail@term{\hyperlink{command.thm}{\mbox{\isa{\isacommand{thm}}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   102
\rail@bar
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   103
\rail@nextbar{1}
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   104
\rail@nont{\hyperlink{syntax.modes}{\mbox{\isa{modes}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   105
\rail@endbar
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   106
\rail@nont{\hyperlink{syntax.thmrefs}{\mbox{\isa{thmrefs}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   107
\rail@end
42662
2080fe35abea updated generated files;
wenzelm
parents: 42655
diff changeset
   108
\rail@begin{2}{}
42596
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   109
\rail@bar
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   110
\rail@term{\hyperlink{command.prf}{\mbox{\isa{\isacommand{prf}}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   111
\rail@nextbar{1}
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   112
\rail@term{\hyperlink{command.full-prf}{\mbox{\isa{\isacommand{full{\isaliteral{5F}{\isacharunderscore}}prf}}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   113
\rail@endbar
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   114
\rail@bar
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   115
\rail@nextbar{1}
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   116
\rail@nont{\hyperlink{syntax.modes}{\mbox{\isa{modes}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   117
\rail@endbar
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   118
\rail@bar
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   119
\rail@nextbar{1}
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   120
\rail@nont{\hyperlink{syntax.thmrefs}{\mbox{\isa{thmrefs}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   121
\rail@endbar
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   122
\rail@end
42662
2080fe35abea updated generated files;
wenzelm
parents: 42655
diff changeset
   123
\rail@begin{2}{}
42596
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   124
\rail@term{\hyperlink{command.pr}{\mbox{\isa{\isacommand{pr}}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   125
\rail@bar
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   126
\rail@nextbar{1}
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   127
\rail@nont{\hyperlink{syntax.modes}{\mbox{\isa{modes}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   128
\rail@endbar
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   129
\rail@bar
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   130
\rail@nextbar{1}
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   131
\rail@nont{\hyperlink{syntax.nat}{\mbox{\isa{nat}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   132
\rail@endbar
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   133
\rail@end
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   134
\rail@begin{2}{\indexdef{}{syntax}{modes}\hypertarget{syntax.modes}{\hyperlink{syntax.modes}{\mbox{\isa{modes}}}}}
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   135
\rail@term{\isa{{\isaliteral{28}{\isacharparenleft}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   136
\rail@plus
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   137
\rail@nont{\hyperlink{syntax.name}{\mbox{\isa{name}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   138
\rail@nextplus{1}
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   139
\rail@endplus
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   140
\rail@term{\isa{{\isaliteral{29}{\isacharparenright}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   141
\rail@end
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   142
\end{railoutput}
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   143
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   144
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   145
  \begin{description}
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   146
48792
4aa5b965f70e support for 'typ' with explicit sort constraint;
wenzelm
parents: 48119
diff changeset
   147
  \item \hyperlink{command.typ}{\mbox{\isa{\isacommand{typ}}}}~\isa{{\isaliteral{5C3C7461753E}{\isasymtau}}} reads and prints a type expression
4aa5b965f70e support for 'typ' with explicit sort constraint;
wenzelm
parents: 48119
diff changeset
   148
  according to the current context.
4aa5b965f70e support for 'typ' with explicit sort constraint;
wenzelm
parents: 48119
diff changeset
   149
4aa5b965f70e support for 'typ' with explicit sort constraint;
wenzelm
parents: 48119
diff changeset
   150
  \item \hyperlink{command.typ}{\mbox{\isa{\isacommand{typ}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C7461753E}{\isasymtau}}\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ s{\isaliteral{22}{\isachardoublequote}}} uses type-inference to
4aa5b965f70e support for 'typ' with explicit sort constraint;
wenzelm
parents: 48119
diff changeset
   151
  determine the most general way to make \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C7461753E}{\isasymtau}}{\isaliteral{22}{\isachardoublequote}}} conform to sort
4aa5b965f70e support for 'typ' with explicit sort constraint;
wenzelm
parents: 48119
diff changeset
   152
  \isa{{\isaliteral{22}{\isachardoublequote}}s{\isaliteral{22}{\isachardoublequote}}}.  For concrete \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C7461753E}{\isasymtau}}{\isaliteral{22}{\isachardoublequote}}} this checks if the type
4aa5b965f70e support for 'typ' with explicit sort constraint;
wenzelm
parents: 48119
diff changeset
   153
  belongs to that sort.  Dummy type parameters ``\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5F}{\isacharunderscore}}{\isaliteral{22}{\isachardoublequote}}}''
4aa5b965f70e support for 'typ' with explicit sort constraint;
wenzelm
parents: 48119
diff changeset
   154
  (underscore) are assigned to fresh type variables with most general
4aa5b965f70e support for 'typ' with explicit sort constraint;
wenzelm
parents: 48119
diff changeset
   155
  sorts, according the the principles of type-inference.
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   156
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   157
  \item \hyperlink{command.term}{\mbox{\isa{\isacommand{term}}}}~\isa{t} and \hyperlink{command.prop}{\mbox{\isa{\isacommand{prop}}}}~\isa{{\isaliteral{5C3C7068693E}{\isasymphi}}}
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   158
  read, type-check and print terms or propositions according to the
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   159
  current theory or proof context; the inferred type of \isa{t} is
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   160
  output as well.  Note that these commands are also useful in
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   161
  inspecting the current environment of term abbreviations.
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   162
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   163
  \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
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   164
  theorems from the current theory or proof context.  Note that any
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   165
  attributes included in the theorem specifications are applied to a
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   166
  temporary context derived from the current theory or proof; the
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   167
  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.
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   168
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   169
  \item \hyperlink{command.prf}{\mbox{\isa{\isacommand{prf}}}} displays the (compact) proof term of the
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   170
  current proof state (if present), or of the given theorems. Note
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   171
  that this requires proof terms to be switched on for the current
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   172
  object logic (see the ``Proof terms'' section of the Isabelle
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   173
  reference manual for information on how to do this).
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   174
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   175
  \item \hyperlink{command.full-prf}{\mbox{\isa{\isacommand{full{\isaliteral{5F}{\isacharunderscore}}prf}}}} is like \hyperlink{command.prf}{\mbox{\isa{\isacommand{prf}}}}, but displays
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   176
  the full proof term, i.e.\ also displays information omitted in the
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   177
  compact proof term, which is denoted by ``\isa{{\isaliteral{5F}{\isacharunderscore}}}'' placeholders
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   178
  there.
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   179
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   180
  \item \hyperlink{command.pr}{\mbox{\isa{\isacommand{pr}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}goals{\isaliteral{22}{\isachardoublequote}}} prints the current proof state
39165
e790a5560834 discontinued obsolete ProofContext.prems_limit;
wenzelm
parents: 39137
diff changeset
   181
  (if present), including current facts and goals.  The optional limit
e790a5560834 discontinued obsolete ProofContext.prems_limit;
wenzelm
parents: 39137
diff changeset
   182
  arguments affect the number of goals to be displayed, which is
e790a5560834 discontinued obsolete ProofContext.prems_limit;
wenzelm
parents: 39137
diff changeset
   183
  initially 10.  Omitting limit value leaves the current setting
e790a5560834 discontinued obsolete ProofContext.prems_limit;
wenzelm
parents: 39137
diff changeset
   184
  unchanged.
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   185
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   186
  \end{description}
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   187
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   188
  All of the diagnostic commands above admit a list of \isa{modes}
42926
a8b655d089ac tuned secref (still dangling);
wenzelm
parents: 42705
diff changeset
   189
  to be specified, which is appended to the current print mode; see
46284
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   190
  also \secref{sec:print-modes}.  Thus the output behavior may be
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   191
  modified according particular print mode features.  For example,
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   192
  \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
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   193
  proof state with mathematical symbols and special characters
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   194
  represented in {\LaTeX} source, according to the Isabelle style
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   195
  \cite{isabelle-sys}.
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   196
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   197
  Note that antiquotations (cf.\ \secref{sec:antiq}) provide a more
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   198
  systematic way to include formal items into the printed text
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   199
  document.%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   200
\end{isamarkuptext}%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   201
\isamarkuptrue%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   202
%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   203
\isamarkupsubsection{Details of printed content%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   204
}
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   205
\isamarkuptrue%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   206
%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   207
\begin{isamarkuptext}%
42655
eb95e2f3b218 updated configuration options -- no ML here;
wenzelm
parents: 42651
diff changeset
   208
\begin{tabular}{rcll}
eb95e2f3b218 updated configuration options -- no ML here;
wenzelm
parents: 42651
diff changeset
   209
    \indexdef{}{attribute}{show\_types}\hypertarget{attribute.show-types}{\hyperlink{attribute.show-types}{\mbox{\isa{show{\isaliteral{5F}{\isacharunderscore}}types}}}} & : & \isa{attribute} & default \isa{false} \\
eb95e2f3b218 updated configuration options -- no ML here;
wenzelm
parents: 42651
diff changeset
   210
    \indexdef{}{attribute}{show\_sorts}\hypertarget{attribute.show-sorts}{\hyperlink{attribute.show-sorts}{\mbox{\isa{show{\isaliteral{5F}{\isacharunderscore}}sorts}}}} & : & \isa{attribute} & default \isa{false} \\
eb95e2f3b218 updated configuration options -- no ML here;
wenzelm
parents: 42651
diff changeset
   211
    \indexdef{}{attribute}{show\_consts}\hypertarget{attribute.show-consts}{\hyperlink{attribute.show-consts}{\mbox{\isa{show{\isaliteral{5F}{\isacharunderscore}}consts}}}} & : & \isa{attribute} & default \isa{false} \\
eb95e2f3b218 updated configuration options -- no ML here;
wenzelm
parents: 42651
diff changeset
   212
    \indexdef{}{attribute}{show\_abbrevs}\hypertarget{attribute.show-abbrevs}{\hyperlink{attribute.show-abbrevs}{\mbox{\isa{show{\isaliteral{5F}{\isacharunderscore}}abbrevs}}}} & : & \isa{attribute} & default \isa{true} \\
eb95e2f3b218 updated configuration options -- no ML here;
wenzelm
parents: 42651
diff changeset
   213
    \indexdef{}{attribute}{show\_brackets}\hypertarget{attribute.show-brackets}{\hyperlink{attribute.show-brackets}{\mbox{\isa{show{\isaliteral{5F}{\isacharunderscore}}brackets}}}} & : & \isa{attribute} & default \isa{false} \\
42669
04dfffda5671 more conventional naming scheme: names_long, names_short, names_unique;
wenzelm
parents: 42662
diff changeset
   214
    \indexdef{}{attribute}{names\_long}\hypertarget{attribute.names-long}{\hyperlink{attribute.names-long}{\mbox{\isa{names{\isaliteral{5F}{\isacharunderscore}}long}}}} & : & \isa{attribute} & default \isa{false} \\
04dfffda5671 more conventional naming scheme: names_long, names_short, names_unique;
wenzelm
parents: 42662
diff changeset
   215
    \indexdef{}{attribute}{names\_short}\hypertarget{attribute.names-short}{\hyperlink{attribute.names-short}{\mbox{\isa{names{\isaliteral{5F}{\isacharunderscore}}short}}}} & : & \isa{attribute} & default \isa{false} \\
04dfffda5671 more conventional naming scheme: names_long, names_short, names_unique;
wenzelm
parents: 42662
diff changeset
   216
    \indexdef{}{attribute}{names\_unique}\hypertarget{attribute.names-unique}{\hyperlink{attribute.names-unique}{\mbox{\isa{names{\isaliteral{5F}{\isacharunderscore}}unique}}}} & : & \isa{attribute} & default \isa{true} \\
42655
eb95e2f3b218 updated configuration options -- no ML here;
wenzelm
parents: 42651
diff changeset
   217
    \indexdef{}{attribute}{eta\_contract}\hypertarget{attribute.eta-contract}{\hyperlink{attribute.eta-contract}{\mbox{\isa{eta{\isaliteral{5F}{\isacharunderscore}}contract}}}} & : & \isa{attribute} & default \isa{true} \\
eb95e2f3b218 updated configuration options -- no ML here;
wenzelm
parents: 42651
diff changeset
   218
    \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}}} \\
eb95e2f3b218 updated configuration options -- no ML here;
wenzelm
parents: 42651
diff changeset
   219
    \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} \\
eb95e2f3b218 updated configuration options -- no ML here;
wenzelm
parents: 42651
diff changeset
   220
    \indexdef{}{attribute}{show\_hyps}\hypertarget{attribute.show-hyps}{\hyperlink{attribute.show-hyps}{\mbox{\isa{show{\isaliteral{5F}{\isacharunderscore}}hyps}}}} & : & \isa{attribute} & default \isa{false} \\
eb95e2f3b218 updated configuration options -- no ML here;
wenzelm
parents: 42651
diff changeset
   221
    \indexdef{}{attribute}{show\_tags}\hypertarget{attribute.show-tags}{\hyperlink{attribute.show-tags}{\mbox{\isa{show{\isaliteral{5F}{\isacharunderscore}}tags}}}} & : & \isa{attribute} & default \isa{false} \\
eb95e2f3b218 updated configuration options -- no ML here;
wenzelm
parents: 42651
diff changeset
   222
    \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} \\
eb95e2f3b218 updated configuration options -- no ML here;
wenzelm
parents: 42651
diff changeset
   223
  \end{tabular}
eb95e2f3b218 updated configuration options -- no ML here;
wenzelm
parents: 42651
diff changeset
   224
  \medskip
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   225
42655
eb95e2f3b218 updated configuration options -- no ML here;
wenzelm
parents: 42651
diff changeset
   226
  These configuration options control the detail of information that
eb95e2f3b218 updated configuration options -- no ML here;
wenzelm
parents: 42651
diff changeset
   227
  is displayed for types, terms, theorems, goals etc.  See also
eb95e2f3b218 updated configuration options -- no ML here;
wenzelm
parents: 42651
diff changeset
   228
  \secref{sec:config}.
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   229
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   230
  \begin{description}
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   231
42655
eb95e2f3b218 updated configuration options -- no ML here;
wenzelm
parents: 42651
diff changeset
   232
  \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
eb95e2f3b218 updated configuration options -- no ML here;
wenzelm
parents: 42651
diff changeset
   233
  printing of type constraints for term variables, and sort
eb95e2f3b218 updated configuration options -- no ML here;
wenzelm
parents: 42651
diff changeset
   234
  constraints for type variables.  By default, neither of these are
eb95e2f3b218 updated configuration options -- no ML here;
wenzelm
parents: 42651
diff changeset
   235
  shown in output.  If \hyperlink{attribute.show-sorts}{\mbox{\isa{show{\isaliteral{5F}{\isacharunderscore}}sorts}}} is enabled, types are
eb95e2f3b218 updated configuration options -- no ML here;
wenzelm
parents: 42651
diff changeset
   236
  always shown as well.
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   237
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   238
  Note that displaying types and sorts may explain why a polymorphic
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   239
  inference rule fails to resolve with some goal, or why a rewrite
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   240
  rule does not apply as expected.
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   241
42655
eb95e2f3b218 updated configuration options -- no ML here;
wenzelm
parents: 42651
diff changeset
   242
  \item \hyperlink{attribute.show-consts}{\mbox{\isa{show{\isaliteral{5F}{\isacharunderscore}}consts}}} controls printing of types of
eb95e2f3b218 updated configuration options -- no ML here;
wenzelm
parents: 42651
diff changeset
   243
  constants when displaying a goal state.
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   244
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   245
  Note that the output can be enormous, because polymorphic constants
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   246
  often occur at several different type instances.
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   247
42655
eb95e2f3b218 updated configuration options -- no ML here;
wenzelm
parents: 42651
diff changeset
   248
  \item \hyperlink{attribute.show-abbrevs}{\mbox{\isa{show{\isaliteral{5F}{\isacharunderscore}}abbrevs}}} controls folding of constant
eb95e2f3b218 updated configuration options -- no ML here;
wenzelm
parents: 42651
diff changeset
   249
  abbreviations.
40879
ca132ef44944 configuration option "show_abbrevs" supersedes print mode "no_abbrevs", with inverted meaning;
wenzelm
parents: 40406
diff changeset
   250
42655
eb95e2f3b218 updated configuration options -- no ML here;
wenzelm
parents: 42651
diff changeset
   251
  \item \hyperlink{attribute.show-brackets}{\mbox{\isa{show{\isaliteral{5F}{\isacharunderscore}}brackets}}} controls bracketing in pretty
eb95e2f3b218 updated configuration options -- no ML here;
wenzelm
parents: 42651
diff changeset
   252
  printed output.  If enabled, all sub-expressions of the pretty
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   253
  printing tree will be parenthesized, even if this produces malformed
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   254
  term syntax!  This crude way of showing the internal structure of
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   255
  pretty printed entities may occasionally help to diagnose problems
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   256
  with operator priorities, for example.
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   257
42669
04dfffda5671 more conventional naming scheme: names_long, names_short, names_unique;
wenzelm
parents: 42662
diff changeset
   258
  \item \hyperlink{attribute.names-long}{\mbox{\isa{names{\isaliteral{5F}{\isacharunderscore}}long}}}, \hyperlink{attribute.names-short}{\mbox{\isa{names{\isaliteral{5F}{\isacharunderscore}}short}}}, and
04dfffda5671 more conventional naming scheme: names_long, names_short, names_unique;
wenzelm
parents: 42662
diff changeset
   259
  \hyperlink{attribute.names-unique}{\mbox{\isa{names{\isaliteral{5F}{\isacharunderscore}}unique}}} control the way of printing fully
42358
b47d41d9f4b5 Name_Space: proper configuration options long_names, short_names, unique_names instead of former unsynchronized references;
wenzelm
parents: 42279
diff changeset
   260
  qualified internal names in external form.  See also
b47d41d9f4b5 Name_Space: proper configuration options long_names, short_names, unique_names instead of former unsynchronized references;
wenzelm
parents: 42279
diff changeset
   261
  \secref{sec:antiq} for the document antiquotation options of the
b47d41d9f4b5 Name_Space: proper configuration options long_names, short_names, unique_names instead of former unsynchronized references;
wenzelm
parents: 42279
diff changeset
   262
  same names.
b47d41d9f4b5 Name_Space: proper configuration options long_names, short_names, unique_names instead of former unsynchronized references;
wenzelm
parents: 42279
diff changeset
   263
42655
eb95e2f3b218 updated configuration options -- no ML here;
wenzelm
parents: 42651
diff changeset
   264
  \item \hyperlink{attribute.eta-contract}{\mbox{\isa{eta{\isaliteral{5F}{\isacharunderscore}}contract}}} controls \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6574613E}{\isasymeta}}{\isaliteral{22}{\isachardoublequote}}}-contracted
eb95e2f3b218 updated configuration options -- no ML here;
wenzelm
parents: 42651
diff changeset
   265
  printing of terms.
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   266
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   267
  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}}},
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   268
  provided \isa{x} is not free in \isa{f}.  It asserts
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   269
  \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
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   270
  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}}}.
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   271
42655
eb95e2f3b218 updated configuration options -- no ML here;
wenzelm
parents: 42651
diff changeset
   272
  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}}}
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   273
  appears simply as \isa{F}.
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   274
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   275
  Note that the distinction between a term and its \isa{{\isaliteral{5C3C6574613E}{\isasymeta}}}-expanded
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   276
  form occasionally matters.  While higher-order resolution and
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   277
  rewriting operate modulo \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C616C7068613E}{\isasymalpha}}{\isaliteral{5C3C626574613E}{\isasymbeta}}{\isaliteral{5C3C6574613E}{\isasymeta}}{\isaliteral{22}{\isachardoublequote}}}-conversion, some other tools
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   278
  might look at terms more discretely.
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   279
42655
eb95e2f3b218 updated configuration options -- no ML here;
wenzelm
parents: 42651
diff changeset
   280
  \item \hyperlink{attribute.goals-limit}{\mbox{\isa{goals{\isaliteral{5F}{\isacharunderscore}}limit}}} controls the maximum number of
39130
12dac4b58df8 updated configuration options;
wenzelm
parents: 39050
diff changeset
   281
  subgoals to be shown in goal output.
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   282
42655
eb95e2f3b218 updated configuration options -- no ML here;
wenzelm
parents: 42651
diff changeset
   283
  \item \hyperlink{attribute.show-main-goal}{\mbox{\isa{show{\isaliteral{5F}{\isacharunderscore}}main{\isaliteral{5F}{\isacharunderscore}}goal}}} controls whether the main result
eb95e2f3b218 updated configuration options -- no ML here;
wenzelm
parents: 42651
diff changeset
   284
  to be proven should be displayed.  This information might be
39130
12dac4b58df8 updated configuration options;
wenzelm
parents: 39050
diff changeset
   285
  relevant for schematic goals, to inspect the current claim that has
12dac4b58df8 updated configuration options;
wenzelm
parents: 39050
diff changeset
   286
  been synthesized so far.
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   287
42655
eb95e2f3b218 updated configuration options -- no ML here;
wenzelm
parents: 42651
diff changeset
   288
  \item \hyperlink{attribute.show-hyps}{\mbox{\isa{show{\isaliteral{5F}{\isacharunderscore}}hyps}}} controls printing of implicit
eb95e2f3b218 updated configuration options -- no ML here;
wenzelm
parents: 42651
diff changeset
   289
  hypotheses of local facts.  Normally, only those hypotheses are
eb95e2f3b218 updated configuration options -- no ML here;
wenzelm
parents: 42651
diff changeset
   290
  displayed that are \emph{not} covered by the assumptions of the
eb95e2f3b218 updated configuration options -- no ML here;
wenzelm
parents: 42651
diff changeset
   291
  current context: this situation indicates a fault in some tool being
eb95e2f3b218 updated configuration options -- no ML here;
wenzelm
parents: 42651
diff changeset
   292
  used.
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   293
42655
eb95e2f3b218 updated configuration options -- no ML here;
wenzelm
parents: 42651
diff changeset
   294
  By enabling \hyperlink{attribute.show-hyps}{\mbox{\isa{show{\isaliteral{5F}{\isacharunderscore}}hyps}}}, output of \emph{all} hypotheses
eb95e2f3b218 updated configuration options -- no ML here;
wenzelm
parents: 42651
diff changeset
   295
  can be enforced, which is occasionally useful for diagnostic
eb95e2f3b218 updated configuration options -- no ML here;
wenzelm
parents: 42651
diff changeset
   296
  purposes.
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   297
42655
eb95e2f3b218 updated configuration options -- no ML here;
wenzelm
parents: 42651
diff changeset
   298
  \item \hyperlink{attribute.show-tags}{\mbox{\isa{show{\isaliteral{5F}{\isacharunderscore}}tags}}} controls printing of extra annotations
eb95e2f3b218 updated configuration options -- no ML here;
wenzelm
parents: 42651
diff changeset
   299
  within theorems, such as internal position information, or the case
eb95e2f3b218 updated configuration options -- no ML here;
wenzelm
parents: 42651
diff changeset
   300
  names being attached by the attribute \hyperlink{attribute.case-names}{\mbox{\isa{case{\isaliteral{5F}{\isacharunderscore}}names}}}.
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   301
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   302
  Note that the \hyperlink{attribute.tagged}{\mbox{\isa{tagged}}} and \hyperlink{attribute.untagged}{\mbox{\isa{untagged}}}
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   303
  attributes provide low-level access to the collection of tags
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   304
  associated with a theorem.
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   305
42655
eb95e2f3b218 updated configuration options -- no ML here;
wenzelm
parents: 42651
diff changeset
   306
  \item \hyperlink{attribute.show-question-marks}{\mbox{\isa{show{\isaliteral{5F}{\isacharunderscore}}question{\isaliteral{5F}{\isacharunderscore}}marks}}} controls printing of question
eb95e2f3b218 updated configuration options -- no ML here;
wenzelm
parents: 42651
diff changeset
   307
  marks for schematic variables, such as \isa{{\isaliteral{3F}{\isacharquery}}x}.  Only the leading
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   308
  question mark is affected, the remaining text is unchanged
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   309
  (including proper markup for schematic variables that might be
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   310
  relevant for user interfaces).
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   311
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   312
  \end{description}%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   313
\end{isamarkuptext}%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   314
\isamarkuptrue%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   315
%
46284
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   316
\isamarkupsubsection{Alternative print modes \label{sec:print-modes}%
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   317
}
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   318
\isamarkuptrue%
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   319
%
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   320
\begin{isamarkuptext}%
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   321
\begin{mldecls}
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   322
    \indexdef{}{ML}{print\_mode\_value}\verb|print_mode_value: unit -> string list| \\
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   323
    \indexdef{}{ML}{Print\_Mode.with\_modes}\verb|Print_Mode.with_modes: string list -> ('a -> 'b) -> 'a -> 'b| \\
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   324
  \end{mldecls}
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   325
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   326
  The \emph{print mode} facility allows to modify various operations
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   327
  for printing.  Commands like \hyperlink{command.typ}{\mbox{\isa{\isacommand{typ}}}}, \hyperlink{command.term}{\mbox{\isa{\isacommand{term}}}},
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   328
  \hyperlink{command.thm}{\mbox{\isa{\isacommand{thm}}}} (see \secref{sec:print-diag}) take additional print
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   329
  modes as optional argument.  The underlying ML operations are as
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   330
  follows.
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   331
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   332
  \begin{description}
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   333
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   334
  \item \verb|print_mode_value ()| yields the list of currently
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   335
  active print mode names.  This should be understood as symbolic
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   336
  representation of certain individual features for printing (with
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   337
  precedence from left to right).
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   338
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   339
  \item \verb|Print_Mode.with_modes|~\isa{{\isaliteral{22}{\isachardoublequote}}modes\ f\ x{\isaliteral{22}{\isachardoublequote}}} evaluates
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   340
  \isa{{\isaliteral{22}{\isachardoublequote}}f\ x{\isaliteral{22}{\isachardoublequote}}} in an execution context where the print mode is
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   341
  prepended by the given \isa{{\isaliteral{22}{\isachardoublequote}}modes{\isaliteral{22}{\isachardoublequote}}}.  This provides a thread-safe
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   342
  way to augment print modes.  It is also monotonic in the set of mode
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   343
  names: it retains the default print mode that certain
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   344
  user-interfaces might have installed for their proper functioning!
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   345
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   346
  \end{description}
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   347
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   348
  \begin{warn}
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   349
  The old global reference \verb|print_mode| should never be used
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   350
  directly in applications.  Its main reason for being publicly
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   351
  accessible is to support historic versions of Proof~General.
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   352
  \end{warn}
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   353
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   354
  \medskip The pretty printer for inner syntax maintains alternative
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   355
  mixfix productions for any print mode name invented by the user, say
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   356
  in commands like \hyperlink{command.notation}{\mbox{\isa{\isacommand{notation}}}} or \hyperlink{command.abbreviation}{\mbox{\isa{\isacommand{abbreviation}}}}.
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   357
  Mode names can be arbitrary, but the following ones have a specific
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   358
  meaning by convention:
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   359
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   360
  \begin{itemize}
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   361
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   362
  \item \verb|""| (the empty string): default mode;
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   363
  implicitly active as last element in the list of modes.
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   364
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   365
  \item \verb|input|: dummy print mode that is never active; may
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   366
  be used to specify notation that is only available for input.
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   367
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   368
  \item \verb|internal| dummy print mode that is never active;
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   369
  used internally in Isabelle/Pure.
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   370
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   371
  \item \verb|xsymbols|: enable proper mathematical symbols
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   372
  instead of ASCII art.\footnote{This traditional mode name stems from
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   373
  the ``X-Symbol'' package for old versions Proof~General with XEmacs,
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   374
  although that package has been superseded by Unicode in recent
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   375
  years.}
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   376
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   377
  \item \verb|HTML|: additional mode that is active in HTML
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   378
  presentation of Isabelle theory sources; allows to provide
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   379
  alternative output notation.
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   380
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   381
  \item \verb|latex|: additional mode that is active in {\LaTeX}
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   382
  document preparation of Isabelle theory sources; allows to provide
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   383
  alternative output notation.
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   384
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   385
  \end{itemize}%
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   386
\end{isamarkuptext}%
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   387
\isamarkuptrue%
6233d0b74d71 updated section on print modes;
wenzelm
parents: 46282
diff changeset
   388
%
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   389
\isamarkupsubsection{Printing limits%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   390
}
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   391
\isamarkuptrue%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   392
%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   393
\begin{isamarkuptext}%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   394
\begin{mldecls}
36745
403585a89772 unified/simplified Pretty.margin_default;
wenzelm
parents: 36508
diff changeset
   395
    \indexdef{}{ML}{Pretty.margin\_default}\verb|Pretty.margin_default: int Unsynchronized.ref| \\
30121
5c7bcb296600 updated generated files;
wenzelm
parents: 29746
diff changeset
   396
    \indexdef{}{ML}{print\_depth}\verb|print_depth: int -> unit| \\
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   397
  \end{mldecls}
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   398
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   399
  These ML functions set limits for pretty printed text.
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   400
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   401
  \begin{description}
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   402
36745
403585a89772 unified/simplified Pretty.margin_default;
wenzelm
parents: 36508
diff changeset
   403
  \item \verb|Pretty.margin_default| indicates the global default for
403585a89772 unified/simplified Pretty.margin_default;
wenzelm
parents: 36508
diff changeset
   404
  the right margin of the built-in pretty printer, with initial value
403585a89772 unified/simplified Pretty.margin_default;
wenzelm
parents: 36508
diff changeset
   405
  76.  Note that user-interfaces typically control margins
403585a89772 unified/simplified Pretty.margin_default;
wenzelm
parents: 36508
diff changeset
   406
  automatically when resizing windows, or even bypass the formatting
403585a89772 unified/simplified Pretty.margin_default;
wenzelm
parents: 36508
diff changeset
   407
  engine of Isabelle/ML altogether and do it within the front end via
403585a89772 unified/simplified Pretty.margin_default;
wenzelm
parents: 36508
diff changeset
   408
  Isabelle/Scala.
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   409
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   410
  \item \verb|print_depth|~\isa{n} limits the printing depth of the
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   411
  ML toplevel pretty printer; the precise effect depends on the ML
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   412
  compiler and run-time system.  Typically \isa{n} should be less
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   413
  than 10.  Bigger values such as 100--1000 are useful for debugging.
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   414
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   415
  \end{description}%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   416
\end{isamarkuptext}%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   417
\isamarkuptrue%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   418
%
46282
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   419
\isamarkupsection{Mixfix annotations \label{sec:mixfix}%
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   420
}
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   421
\isamarkuptrue%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   422
%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   423
\begin{isamarkuptext}%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   424
Mixfix annotations specify concrete \emph{inner syntax} of
35351
7425aece4ee3 allow general mixfix syntax for type constructors;
wenzelm
parents: 32836
diff changeset
   425
  Isabelle types and terms.  Locally fixed parameters in toplevel
46290
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   426
  theorem statements, locale and class specifications also admit
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   427
  mixfix annotations in a fairly uniform manner.  A mixfix annotation
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   428
  describes describes the concrete syntax, the translation to abstract
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   429
  syntax, and the pretty printing.  Special case annotations provide a
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   430
  simple means of specifying infix operators and binders.
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   431
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   432
  Isabelle mixfix syntax is inspired by {\OBJ} \cite{OBJ}.  It allows
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   433
  to specify any context-free priority grammar, which is more general
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   434
  than the fixity declarations of ML and Prolog.
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   435
42596
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   436
  \begin{railoutput}
46289
wenzelm
parents: 46288
diff changeset
   437
\rail@begin{1}{\indexdef{}{syntax}{mixfix}\hypertarget{syntax.mixfix}{\hyperlink{syntax.mixfix}{\mbox{\isa{mixfix}}}}}
wenzelm
parents: 46288
diff changeset
   438
\rail@term{\isa{{\isaliteral{28}{\isacharparenleft}}}}[]
wenzelm
parents: 46288
diff changeset
   439
\rail@nont{\isa{mfix}}[]
wenzelm
parents: 46288
diff changeset
   440
\rail@term{\isa{{\isaliteral{29}{\isacharparenright}}}}[]
wenzelm
parents: 46288
diff changeset
   441
\rail@end
wenzelm
parents: 46288
diff changeset
   442
\rail@begin{2}{\indexdef{}{syntax}{struct\_mixfix}\hypertarget{syntax.struct-mixfix}{\hyperlink{syntax.struct-mixfix}{\mbox{\isa{struct{\isaliteral{5F}{\isacharunderscore}}mixfix}}}}}
42596
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   443
\rail@term{\isa{{\isaliteral{28}{\isacharparenleft}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   444
\rail@bar
46289
wenzelm
parents: 46288
diff changeset
   445
\rail@nont{\isa{mfix}}[]
wenzelm
parents: 46288
diff changeset
   446
\rail@nextbar{1}
wenzelm
parents: 46288
diff changeset
   447
\rail@term{\isa{\isakeyword{structure}}}[]
wenzelm
parents: 46288
diff changeset
   448
\rail@endbar
wenzelm
parents: 46288
diff changeset
   449
\rail@term{\isa{{\isaliteral{29}{\isacharparenright}}}}[]
wenzelm
parents: 46288
diff changeset
   450
\rail@end
wenzelm
parents: 46288
diff changeset
   451
\rail@begin{7}{\isa{mfix}}
wenzelm
parents: 46288
diff changeset
   452
\rail@bar
46290
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   453
\rail@nont{\hyperlink{syntax.template}{\mbox{\isa{template}}}}[]
46285
30953ef09bcd simplified mixfix (NB: infix is no longer required separately);
wenzelm
parents: 46284
diff changeset
   454
\rail@bar
30953ef09bcd simplified mixfix (NB: infix is no longer required separately);
wenzelm
parents: 46284
diff changeset
   455
\rail@nextbar{1}
30953ef09bcd simplified mixfix (NB: infix is no longer required separately);
wenzelm
parents: 46284
diff changeset
   456
\rail@nont{\isa{prios}}[]
30953ef09bcd simplified mixfix (NB: infix is no longer required separately);
wenzelm
parents: 46284
diff changeset
   457
\rail@endbar
30953ef09bcd simplified mixfix (NB: infix is no longer required separately);
wenzelm
parents: 46284
diff changeset
   458
\rail@bar
30953ef09bcd simplified mixfix (NB: infix is no longer required separately);
wenzelm
parents: 46284
diff changeset
   459
\rail@nextbar{1}
30953ef09bcd simplified mixfix (NB: infix is no longer required separately);
wenzelm
parents: 46284
diff changeset
   460
\rail@nont{\hyperlink{syntax.nat}{\mbox{\isa{nat}}}}[]
30953ef09bcd simplified mixfix (NB: infix is no longer required separately);
wenzelm
parents: 46284
diff changeset
   461
\rail@endbar
30953ef09bcd simplified mixfix (NB: infix is no longer required separately);
wenzelm
parents: 46284
diff changeset
   462
\rail@nextbar{2}
30953ef09bcd simplified mixfix (NB: infix is no longer required separately);
wenzelm
parents: 46284
diff changeset
   463
\rail@bar
42596
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   464
\rail@term{\isa{\isakeyword{infix}}}[]
46285
30953ef09bcd simplified mixfix (NB: infix is no longer required separately);
wenzelm
parents: 46284
diff changeset
   465
\rail@nextbar{3}
42596
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   466
\rail@term{\isa{\isakeyword{infixl}}}[]
46285
30953ef09bcd simplified mixfix (NB: infix is no longer required separately);
wenzelm
parents: 46284
diff changeset
   467
\rail@nextbar{4}
42596
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   468
\rail@term{\isa{\isakeyword{infixr}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   469
\rail@endbar
46290
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   470
\rail@nont{\hyperlink{syntax.template}{\mbox{\isa{template}}}}[]
42596
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   471
\rail@nont{\hyperlink{syntax.nat}{\mbox{\isa{nat}}}}[]
46285
30953ef09bcd simplified mixfix (NB: infix is no longer required separately);
wenzelm
parents: 46284
diff changeset
   472
\rail@nextbar{5}
30953ef09bcd simplified mixfix (NB: infix is no longer required separately);
wenzelm
parents: 46284
diff changeset
   473
\rail@term{\isa{\isakeyword{binder}}}[]
46290
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   474
\rail@nont{\hyperlink{syntax.template}{\mbox{\isa{template}}}}[]
42596
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   475
\rail@bar
46285
30953ef09bcd simplified mixfix (NB: infix is no longer required separately);
wenzelm
parents: 46284
diff changeset
   476
\rail@nextbar{6}
42596
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   477
\rail@nont{\isa{prios}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   478
\rail@endbar
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   479
\rail@nont{\hyperlink{syntax.nat}{\mbox{\isa{nat}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   480
\rail@endbar
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   481
\rail@end
46290
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   482
\rail@begin{1}{\isa{template}}
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   483
\rail@nont{\isa{string}}[]
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   484
\rail@end
42596
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   485
\rail@begin{2}{\isa{prios}}
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   486
\rail@term{\isa{{\isaliteral{5B}{\isacharbrackleft}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   487
\rail@plus
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   488
\rail@nont{\hyperlink{syntax.nat}{\mbox{\isa{nat}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   489
\rail@nextplus{1}
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   490
\rail@cterm{\isa{{\isaliteral{2C}{\isacharcomma}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   491
\rail@endplus
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   492
\rail@term{\isa{{\isaliteral{5D}{\isacharbrackright}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   493
\rail@end
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   494
\end{railoutput}
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   495
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   496
46290
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   497
  The string given as \isa{template} may include literal text,
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   498
  spacing, blocks, and arguments (denoted by ``\isa{{\isaliteral{5F}{\isacharunderscore}}}''); the
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   499
  special symbol ``\verb|\<index>|'' (printed as ``\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C696E6465783E}{\isasymindex}}{\isaliteral{22}{\isachardoublequote}}}'')
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   500
  represents an index argument that specifies an implicit structure
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   501
  reference (see also \secref{sec:locale}).  Infix and binder
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   502
  declarations provide common abbreviations for particular mixfix
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   503
  declarations.  So in practice, mixfix templates mostly degenerate to
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   504
  literal text for concrete syntax, such as ``\verb|++|'' for
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   505
  an infix symbol.%
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   506
\end{isamarkuptext}%
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   507
\isamarkuptrue%
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   508
%
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   509
\isamarkupsubsection{The general mixfix form%
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   510
}
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   511
\isamarkuptrue%
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   512
%
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   513
\begin{isamarkuptext}%
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   514
In full generality, mixfix declarations work as follows.
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   515
  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
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   516
  \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
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   517
  \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
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   518
  argument positions as indicated by underscores.
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   519
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   520
  Altogether this determines a production for a context-free priority
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   521
  grammar, where for each argument \isa{{\isaliteral{22}{\isachardoublequote}}i{\isaliteral{22}{\isachardoublequote}}} the syntactic category
46292
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
   522
  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
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
   523
  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
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
   524
  arguments and 1000 for the result.\footnote{Omitting priorities is
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
   525
  prone to syntactic ambiguities unless the delimiter tokens determine
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
   526
  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}}}.}
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   527
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   528
  Since \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C7461753E}{\isasymtau}}{\isaliteral{22}{\isachardoublequote}}} may be again a function type, the constant
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   529
  type scheme may have more argument positions than the mixfix
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   530
  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
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   531
  \isa{{\isaliteral{22}{\isachardoublequote}}m\ {\isaliteral{3E}{\isachargreater}}\ n{\isaliteral{22}{\isachardoublequote}}} works by attaching concrete notation only to the
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   532
  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}}}
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   533
  instead.  If a term has fewer arguments than specified in the mixfix
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   534
  template, the concrete syntax is ignored.
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   535
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   536
  \medskip A mixfix template may also contain additional directives
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   537
  for pretty printing, notably spaces, blocks, and breaks.  The
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   538
  general template format is a sequence over any of the following
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   539
  entities.
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   540
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   541
  \begin{description}
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   542
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   543
  \item \isa{{\isaliteral{22}{\isachardoublequote}}d{\isaliteral{22}{\isachardoublequote}}} is a delimiter, namely a non-empty sequence of
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   544
  characters other than the following special characters:
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   545
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   546
  \smallskip
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   547
  \begin{tabular}{ll}
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   548
    \verb|'| & single quote \\
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   549
    \verb|_| & underscore \\
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   550
    \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C696E6465783E}{\isasymindex}}{\isaliteral{22}{\isachardoublequote}}} & index symbol \\
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   551
    \verb|(| & open parenthesis \\
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   552
    \verb|)| & close parenthesis \\
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   553
    \verb|/| & slash \\
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   554
  \end{tabular}
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   555
  \medskip
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   556
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   557
  \item \verb|'| escapes the special meaning of these
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   558
  meta-characters, producing a literal version of the following
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   559
  character, unless that is a blank.
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   560
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   561
  A single quote followed by a blank separates delimiters, without
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   562
  affecting printing, but input tokens may have additional white space
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   563
  here.
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   564
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   565
  \item \verb|_| is an argument position, which stands for a
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   566
  certain syntactic category in the underlying grammar.
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   567
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   568
  \item \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C696E6465783E}{\isasymindex}}{\isaliteral{22}{\isachardoublequote}}} is an indexed argument position; this is the place
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   569
  where implicit structure arguments can be attached.
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   570
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   571
  \item \isa{{\isaliteral{22}{\isachardoublequote}}s{\isaliteral{22}{\isachardoublequote}}} is a non-empty sequence of spaces for printing.
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   572
  This and the following specifications do not affect parsing at all.
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   573
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   574
  \item \verb|(|\isa{n} opens a pretty printing block.  The
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   575
  optional number specifies how much indentation to add when a line
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   576
  break occurs within the block.  If the parenthesis is not followed
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   577
  by digits, the indentation defaults to 0.  A block specified via
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   578
  \verb|(00| is unbreakable.
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   579
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   580
  \item \verb|)| closes a pretty printing block.
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   581
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   582
  \item \verb|//| forces a line break.
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   583
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   584
  \item \verb|/|\isa{s} allows a line break.  Here \isa{s}
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   585
  stands for the string of spaces (zero or more) right after the
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   586
  slash.  These spaces are printed if the break is \emph{not} taken.
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   587
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   588
  \end{description}
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   589
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   590
  The general idea of pretty printing with blocks and breaks is also
46286
7233d0521c43 more refs;
wenzelm
parents: 46285
diff changeset
   591
  described in \cite{paulson-ml2}; it goes back to \cite{Oppen:1980}.%
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   592
\end{isamarkuptext}%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   593
\isamarkuptrue%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   594
%
46290
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   595
\isamarkupsubsection{Infixes%
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   596
}
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   597
\isamarkuptrue%
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   598
%
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   599
\begin{isamarkuptext}%
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   600
Infix operators are specified by convenient short forms that
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   601
  abbreviate general mixfix annotations as follows:
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   602
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   603
  \begin{center}
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   604
  \begin{tabular}{lll}
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   605
46292
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
   606
  \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|)|
46290
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   607
  & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6D617073746F3E}{\isasymmapsto}}{\isaliteral{22}{\isachardoublequote}}} &
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   608
  \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|)| \\
46292
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
   609
  \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|)|
46290
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   610
  & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6D617073746F3E}{\isasymmapsto}}{\isaliteral{22}{\isachardoublequote}}} &
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   611
  \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|)| \\
46292
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
   612
  \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|)|
46290
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   613
  & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6D617073746F3E}{\isasymmapsto}}{\isaliteral{22}{\isachardoublequote}}} &
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   614
  \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|)| \\
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   615
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   616
  \end{tabular}
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   617
  \end{center}
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   618
46292
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
   619
  The mixfix template \verb|"(_ |\isa{sy}\verb|/ _)"|
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
   620
  specifies two argument positions; the delimiter is preceded by a
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
   621
  space and followed by a space or line break; the entire phrase is a
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
   622
  pretty printing block.
46290
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   623
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   624
  The alternative notation \verb|op|~\isa{sy} is introduced
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   625
  in addition.  Thus any infix operator may be written in prefix form
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   626
  (as in ML), independently of the number of arguments in the term.%
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   627
\end{isamarkuptext}%
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   628
\isamarkuptrue%
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   629
%
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   630
\isamarkupsubsection{Binders%
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   631
}
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   632
\isamarkuptrue%
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   633
%
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   634
\begin{isamarkuptext}%
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   635
A \emph{binder} is a variable-binding construct such as a
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   636
  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
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   637
  to \cite{church40}.  Isabelle declarations of certain higher-order
46292
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
   638
  operators may be annotated with \indexdef{}{keyword}{binder}\hypertarget{keyword.binder}{\hyperlink{keyword.binder}{\mbox{\isa{\isakeyword{binder}}}}} annotations
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
   639
  as follows:
46290
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   640
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   641
  \begin{center}
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   642
  \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|)|
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   643
  \end{center}
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   644
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   645
  This introduces concrete binder syntax \isa{{\isaliteral{22}{\isachardoublequote}}sy\ x{\isaliteral{2E}{\isachardot}}\ b{\isaliteral{22}{\isachardoublequote}}}, where
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   646
  \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}}}.
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   647
  The optional integer \isa{p} specifies the syntactic priority of
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   648
  the body; the default is \isa{{\isaliteral{22}{\isachardoublequote}}q{\isaliteral{22}{\isachardoublequote}}}, which is also the priority of
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   649
  the whole construct.
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   650
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   651
  Internally, the binder syntax is expanded to something like this:
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   652
  \begin{center}
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   653
  \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|)|
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   654
  \end{center}
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   655
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   656
  Here \hyperlink{syntax.inner.idts}{\mbox{\isa{idts}}} is the nonterminal symbol for a list of
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   657
  identifiers with optional type constraints (see also
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   658
  \secref{sec:pure-grammar}).  The mixfix template \verb|"(3|\isa{sy}\verb|_./ _)"| defines argument positions
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   659
  for the bound identifiers and the body, separated by a dot with
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   660
  optional line break; the entire phrase is a pretty printing block of
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   661
  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
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   662
  syntax ends with a token that may be continued by an identifier
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   663
  token at the start of \hyperlink{syntax.inner.idts}{\mbox{\isa{idts}}}.
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   664
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   665
  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}}}.
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   666
  This works in both directions, for parsing and printing.%
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   667
\end{isamarkuptext}%
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   668
\isamarkuptrue%
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   669
%
46282
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   670
\isamarkupsection{Explicit notation \label{sec:notation}%
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   671
}
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   672
\isamarkuptrue%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   673
%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   674
\begin{isamarkuptext}%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   675
\begin{matharray}{rcll}
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   676
    \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}}} \\
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   677
    \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}}} \\
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   678
    \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}}} \\
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   679
    \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}}} \\
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   680
    \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}}} \\
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   681
  \end{matharray}
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   682
46288
8a2c5dc0b00e more on explicit notation;
wenzelm
parents: 46287
diff changeset
   683
  Commands that introduce new logical entities (terms or types)
8a2c5dc0b00e more on explicit notation;
wenzelm
parents: 46287
diff changeset
   684
  usually allow to provide mixfix annotations on the spot, which is
8a2c5dc0b00e more on explicit notation;
wenzelm
parents: 46287
diff changeset
   685
  convenient for default notation.  Nonetheless, the syntax may be
8a2c5dc0b00e more on explicit notation;
wenzelm
parents: 46287
diff changeset
   686
  modified later on by declarations for explicit notation.  This
8a2c5dc0b00e more on explicit notation;
wenzelm
parents: 46287
diff changeset
   687
  allows to add or delete mixfix annotations for of existing logical
8a2c5dc0b00e more on explicit notation;
wenzelm
parents: 46287
diff changeset
   688
  entities within the current context.
8a2c5dc0b00e more on explicit notation;
wenzelm
parents: 46287
diff changeset
   689
42596
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   690
  \begin{railoutput}
42662
2080fe35abea updated generated files;
wenzelm
parents: 42655
diff changeset
   691
\rail@begin{5}{}
42596
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   692
\rail@bar
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   693
\rail@term{\hyperlink{command.type-notation}{\mbox{\isa{\isacommand{type{\isaliteral{5F}{\isacharunderscore}}notation}}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   694
\rail@nextbar{1}
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   695
\rail@term{\hyperlink{command.no-type-notation}{\mbox{\isa{\isacommand{no{\isaliteral{5F}{\isacharunderscore}}type{\isaliteral{5F}{\isacharunderscore}}notation}}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   696
\rail@endbar
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   697
\rail@bar
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   698
\rail@nextbar{1}
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   699
\rail@nont{\hyperlink{syntax.target}{\mbox{\isa{target}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   700
\rail@endbar
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   701
\rail@bar
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   702
\rail@nextbar{1}
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   703
\rail@nont{\hyperlink{syntax.mode}{\mbox{\isa{mode}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   704
\rail@endbar
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   705
\rail@cr{3}
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   706
\rail@plus
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   707
\rail@nont{\hyperlink{syntax.nameref}{\mbox{\isa{nameref}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   708
\rail@nont{\hyperlink{syntax.mixfix}{\mbox{\isa{mixfix}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   709
\rail@nextplus{4}
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   710
\rail@cterm{\isa{\isakeyword{and}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   711
\rail@endplus
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   712
\rail@end
42662
2080fe35abea updated generated files;
wenzelm
parents: 42655
diff changeset
   713
\rail@begin{5}{}
42596
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   714
\rail@bar
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   715
\rail@term{\hyperlink{command.notation}{\mbox{\isa{\isacommand{notation}}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   716
\rail@nextbar{1}
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   717
\rail@term{\hyperlink{command.no-notation}{\mbox{\isa{\isacommand{no{\isaliteral{5F}{\isacharunderscore}}notation}}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   718
\rail@endbar
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   719
\rail@bar
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   720
\rail@nextbar{1}
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   721
\rail@nont{\hyperlink{syntax.target}{\mbox{\isa{target}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   722
\rail@endbar
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   723
\rail@bar
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   724
\rail@nextbar{1}
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   725
\rail@nont{\hyperlink{syntax.mode}{\mbox{\isa{mode}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   726
\rail@endbar
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   727
\rail@cr{3}
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   728
\rail@plus
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   729
\rail@nont{\hyperlink{syntax.nameref}{\mbox{\isa{nameref}}}}[]
42705
528a2ba8fa74 tuned some syntax names;
wenzelm
parents: 42669
diff changeset
   730
\rail@nont{\hyperlink{syntax.struct-mixfix}{\mbox{\isa{struct{\isaliteral{5F}{\isacharunderscore}}mixfix}}}}[]
42596
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   731
\rail@nextplus{4}
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   732
\rail@cterm{\isa{\isakeyword{and}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   733
\rail@endplus
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   734
\rail@end
42662
2080fe35abea updated generated files;
wenzelm
parents: 42655
diff changeset
   735
\rail@begin{2}{}
42596
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   736
\rail@term{\hyperlink{command.write}{\mbox{\isa{\isacommand{write}}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   737
\rail@bar
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   738
\rail@nextbar{1}
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   739
\rail@nont{\hyperlink{syntax.mode}{\mbox{\isa{mode}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   740
\rail@endbar
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   741
\rail@plus
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   742
\rail@nont{\hyperlink{syntax.nameref}{\mbox{\isa{nameref}}}}[]
42705
528a2ba8fa74 tuned some syntax names;
wenzelm
parents: 42669
diff changeset
   743
\rail@nont{\hyperlink{syntax.struct-mixfix}{\mbox{\isa{struct{\isaliteral{5F}{\isacharunderscore}}mixfix}}}}[]
42596
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   744
\rail@nextplus{1}
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   745
\rail@cterm{\isa{\isakeyword{and}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   746
\rail@endplus
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   747
\rail@end
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   748
\end{railoutput}
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
   749
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   750
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   751
  \begin{description}
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   752
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   753
  \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
35414
cc8e4276d093 updated generated files;
wenzelm
parents: 35351
diff changeset
   754
  syntax with an existing type constructor.  The arity of the
cc8e4276d093 updated generated files;
wenzelm
parents: 35351
diff changeset
   755
  constructor is retrieved from the context.
46282
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   756
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   757
  \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
35414
cc8e4276d093 updated generated files;
wenzelm
parents: 35351
diff changeset
   758
  the present context.
cc8e4276d093 updated generated files;
wenzelm
parents: 35351
diff changeset
   759
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   760
  \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
35414
cc8e4276d093 updated generated files;
wenzelm
parents: 35351
diff changeset
   761
  syntax with an existing constant or fixed variable.  The type
cc8e4276d093 updated generated files;
wenzelm
parents: 35351
diff changeset
   762
  declaration of the given entity is retrieved from the context.
46282
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   763
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   764
  \item \hyperlink{command.no-notation}{\mbox{\isa{\isacommand{no{\isaliteral{5F}{\isacharunderscore}}notation}}}} is similar to \hyperlink{command.notation}{\mbox{\isa{\isacommand{notation}}}},
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   765
  but removes the specified syntax annotation from the present
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   766
  context.
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   767
36508
03d2a2d0ee4a allow concrete syntax for local entities within a proof body, either via regular mixfix annotations to 'fix' etc. or the separate 'write' command;
wenzelm
parents: 35414
diff changeset
   768
  \item \hyperlink{command.write}{\mbox{\isa{\isacommand{write}}}} is similar to \hyperlink{command.notation}{\mbox{\isa{\isacommand{notation}}}}, but
03d2a2d0ee4a allow concrete syntax for local entities within a proof body, either via regular mixfix annotations to 'fix' etc. or the separate 'write' command;
wenzelm
parents: 35414
diff changeset
   769
  works within an Isar proof body.
03d2a2d0ee4a allow concrete syntax for local entities within a proof body, either via regular mixfix annotations to 'fix' etc. or the separate 'write' command;
wenzelm
parents: 35414
diff changeset
   770
46289
wenzelm
parents: 46288
diff changeset
   771
  \end{description}%
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   772
\end{isamarkuptext}%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   773
\isamarkuptrue%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   774
%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   775
\isamarkupsection{The Pure syntax \label{sec:pure-syntax}%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   776
}
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   777
\isamarkuptrue%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   778
%
46282
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   779
\isamarkupsubsection{Lexical matters \label{sec:inner-lex}%
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   780
}
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   781
\isamarkuptrue%
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   782
%
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   783
\begin{isamarkuptext}%
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   784
The inner lexical syntax vaguely resembles the outer one
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   785
  (\secref{sec:outer-lex}), but some details are different.  There are
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   786
  two main categories of inner syntax tokens:
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   787
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   788
  \begin{enumerate}
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   789
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   790
  \item \emph{delimiters} --- the literal tokens occurring in
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   791
  productions of the given priority grammar (cf.\
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   792
  \secref{sec:priority-grammar});
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   793
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   794
  \item \emph{named tokens} --- various categories of identifiers etc.
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   795
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   796
  \end{enumerate}
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   797
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   798
  Delimiters override named tokens and may thus render certain
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   799
  identifiers inaccessible.  Sometimes the logical context admits
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   800
  alternative ways to refer to the same entity, potentially via
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   801
  qualified names.
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   802
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   803
  \medskip The categories for named tokens are defined once and for
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   804
  all as follows, reusing some categories of the outer token syntax
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   805
  (\secref{sec:outer-lex}).
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   806
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   807
  \begin{center}
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   808
  \begin{supertabular}{rcl}
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   809
    \indexdef{inner}{syntax}{id}\hypertarget{syntax.inner.id}{\hyperlink{syntax.inner.id}{\mbox{\isa{id}}}} & = & \indexref{}{syntax}{ident}\hyperlink{syntax.ident}{\mbox{\isa{ident}}} \\
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   810
    \indexdef{inner}{syntax}{longid}\hypertarget{syntax.inner.longid}{\hyperlink{syntax.inner.longid}{\mbox{\isa{longid}}}} & = & \indexref{}{syntax}{longident}\hyperlink{syntax.longident}{\mbox{\isa{longident}}} \\
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   811
    \indexdef{inner}{syntax}{var}\hypertarget{syntax.inner.var}{\hyperlink{syntax.inner.var}{\mbox{\isa{var}}}} & = & \indexref{}{syntax}{var}\hyperlink{syntax.var}{\mbox{\isa{var}}} \\
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   812
    \indexdef{inner}{syntax}{tid}\hypertarget{syntax.inner.tid}{\hyperlink{syntax.inner.tid}{\mbox{\isa{tid}}}} & = & \indexref{}{syntax}{typefree}\hyperlink{syntax.typefree}{\mbox{\isa{typefree}}} \\
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   813
    \indexdef{inner}{syntax}{tvar}\hypertarget{syntax.inner.tvar}{\hyperlink{syntax.inner.tvar}{\mbox{\isa{tvar}}}} & = & \indexref{}{syntax}{typevar}\hyperlink{syntax.typevar}{\mbox{\isa{typevar}}} \\
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   814
    \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}}} \\
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   815
    \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}}} \\
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   816
    \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}}} \\
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   817
46483
10a9c31a22b4 renamed "xstr" to "str_token";
wenzelm
parents: 46294
diff changeset
   818
    \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|''| \\
46282
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   819
  \end{supertabular}
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   820
  \end{center}
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   821
46483
10a9c31a22b4 renamed "xstr" to "str_token";
wenzelm
parents: 46294
diff changeset
   822
  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
46282
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   823
  and string constants by adding appropriate syntax declarations,
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   824
  together with some translation functions (e.g.\ see Isabelle/HOL).
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   825
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   826
  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
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   827
  robust access to the respective tokens: the syntax tree holds a
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   828
  syntactic constant instead of a free variable.%
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   829
\end{isamarkuptext}%
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   830
\isamarkuptrue%
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
   831
%
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   832
\isamarkupsubsection{Priority grammars \label{sec:priority-grammar}%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   833
}
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   834
\isamarkuptrue%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   835
%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   836
\begin{isamarkuptext}%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   837
A context-free grammar consists of a set of \emph{terminal
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   838
  symbols}, a set of \emph{nonterminal symbols} and a set of
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   839
  \emph{productions}.  Productions have the form \isa{{\isaliteral{22}{\isachardoublequote}}A\ {\isaliteral{3D}{\isacharequal}}\ {\isaliteral{5C3C67616D6D613E}{\isasymgamma}}{\isaliteral{22}{\isachardoublequote}}},
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   840
  where \isa{A} is a nonterminal and \isa{{\isaliteral{5C3C67616D6D613E}{\isasymgamma}}} is a string of
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   841
  terminals and nonterminals.  One designated nonterminal is called
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   842
  the \emph{root symbol}.  The language defined by the grammar
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   843
  consists of all strings of terminals that can be derived from the
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   844
  root symbol by applying productions as rewrite rules.
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   845
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   846
  The standard Isabelle parser for inner syntax uses a \emph{priority
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   847
  grammar}.  Each nonterminal is decorated by an integer priority:
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   848
  \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
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   849
  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
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   850
  priority grammar can be translated into a normal context-free
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   851
  grammar by introducing new nonterminals and productions.
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   852
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   853
  \medskip Formally, a set of context free productions \isa{G}
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   854
  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.
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   855
  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}
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   856
  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}}}.
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   857
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   858
  \medskip The following grammar for arithmetic expressions
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   859
  demonstrates how binding power and associativity of operators can be
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   860
  enforced by priorities.
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   861
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   862
  \begin{center}
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   863
  \begin{tabular}{rclr}
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   864
  \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|)| \\
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   865
  \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| \\
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   866
  \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}}} \\
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   867
  \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}}} \\
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   868
  \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}}} \\
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   869
  \end{tabular}
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   870
  \end{center}
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   871
  The choice of priorities determines that \verb|-| binds
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   872
  tighter than \verb|*|, which binds tighter than \verb|+|.  Furthermore \verb|+| associates to the left and
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   873
  \verb|*| to the right.
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   874
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   875
  \medskip For clarity, grammars obey these conventions:
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   876
  \begin{itemize}
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   877
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   878
  \item All priorities must lie between 0 and 1000.
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   879
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   880
  \item Priority 0 on the right-hand side and priority 1000 on the
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   881
  left-hand side may be omitted.
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   882
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   883
  \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
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   884
  a column on the far right.
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   885
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   886
  \item Alternatives are separated by \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}}.
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   887
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   888
  \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
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   889
  but obvious way.
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   890
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   891
  \end{itemize}
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   892
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   893
  Using these conventions, the example grammar specification above
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   894
  takes the form:
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   895
  \begin{center}
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   896
  \begin{tabular}{rclc}
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   897
    \isa{A} & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{3D}{\isacharequal}}{\isaliteral{22}{\isachardoublequote}}} & \verb|(| \isa{A} \verb|)| \\
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   898
              & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \verb|0| & \qquad\qquad \\
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   899
              & \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}}} \\
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   900
              & \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}}} \\
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   901
              & \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}}} \\
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   902
  \end{tabular}
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   903
  \end{center}%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   904
\end{isamarkuptext}%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   905
\isamarkuptrue%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   906
%
46290
465851ba524e updated/unified section on mixfix annotations;
wenzelm
parents: 46289
diff changeset
   907
\isamarkupsubsection{The Pure grammar \label{sec:pure-grammar}%
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   908
}
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   909
\isamarkuptrue%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   910
%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   911
\begin{isamarkuptext}%
46287
0bb3d8ee5d25 more accurate Pure grammar;
wenzelm
parents: 46286
diff changeset
   912
The priority grammar of the \isa{{\isaliteral{22}{\isachardoublequote}}Pure{\isaliteral{22}{\isachardoublequote}}} theory is defined
0bb3d8ee5d25 more accurate Pure grammar;
wenzelm
parents: 46286
diff changeset
   913
  approximately like this:
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   914
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   915
  \begin{center}
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   916
  \begin{supertabular}{rclr}
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   917
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   918
  \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}}} \\\\
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   919
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   920
  \indexdef{inner}{syntax}{prop}\hypertarget{syntax.inner.prop}{\hyperlink{syntax.inner.prop}{\mbox{\isa{prop}}}} & = & \verb|(| \isa{prop} \verb|)| \\
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   921
    & \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}}} \\
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   922
    & \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}}} \\
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   923
    & \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}}} \\
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   924
    & \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}}} \\
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   925
    & \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}}} \\
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   926
    & \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}}} \\
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   927
    & \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}}} \\
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   928
    & \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}}} \\
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   929
    & \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}}} \\
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   930
    & \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}}} \\
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   931
    & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \verb|OFCLASS| \verb|(| \isa{type} \verb|,| \isa{logic} \verb|)| \\
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   932
    & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \verb|SORT_CONSTRAINT| \verb|(| \isa{type} \verb|)| \\
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   933
    & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \verb|TERM| \isa{logic} \\
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   934
    & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \verb|PROP| \isa{aprop} \\\\
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   935
28857
87d638a4ee67 updated generated files;
wenzelm
parents: 28762
diff changeset
   936
  \indexdef{inner}{syntax}{aprop}\hypertarget{syntax.inner.aprop}{\hyperlink{syntax.inner.aprop}{\mbox{\isa{aprop}}}} & = & \verb|(| \isa{aprop} \verb|)| \\
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   937
    & \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|...| \\
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   938
    & \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}}} \\
46287
0bb3d8ee5d25 more accurate Pure grammar;
wenzelm
parents: 46286
diff changeset
   939
    & \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}}} \\
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   940
    & \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}}} \\\\
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   941
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   942
  \indexdef{inner}{syntax}{logic}\hypertarget{syntax.inner.logic}{\hyperlink{syntax.inner.logic}{\mbox{\isa{logic}}}} & = & \verb|(| \isa{logic} \verb|)| \\
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   943
    & \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}}} \\
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   944
    & \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|...| \\
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   945
    & \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}}} \\
46287
0bb3d8ee5d25 more accurate Pure grammar;
wenzelm
parents: 46286
diff changeset
   946
    & \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}}} \\
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   947
    & \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}}} \\
46287
0bb3d8ee5d25 more accurate Pure grammar;
wenzelm
parents: 46286
diff changeset
   948
    & \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}}} \\
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   949
    & \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}}} \\
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   950
    & \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}}} \\
46287
0bb3d8ee5d25 more accurate Pure grammar;
wenzelm
parents: 46286
diff changeset
   951
    & \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|&&&| \\
0bb3d8ee5d25 more accurate Pure grammar;
wenzelm
parents: 46286
diff changeset
   952
    & \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}}} \\
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   953
    & \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{7C}{\isacharbar}}{\isaliteral{22}{\isachardoublequote}}} & \verb|TYPE| \verb|(| \isa{type} \verb|)| \\\\
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   954
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   955
  \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|_| \\
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   956
    & \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}}} \\
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   957
    & \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}}} \\\\
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   958
46287
0bb3d8ee5d25 more accurate Pure grammar;
wenzelm
parents: 46286
diff changeset
   959
  \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}}} \\\\
0bb3d8ee5d25 more accurate Pure grammar;
wenzelm
parents: 46286
diff changeset
   960
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   961
  \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}}} \\\\
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   962
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   963
  \indexdef{inner}{syntax}{pttrn}\hypertarget{syntax.inner.pttrn}{\hyperlink{syntax.inner.pttrn}{\mbox{\isa{pttrn}}}} & = & \isa{idt} \\\\
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   964
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   965
  \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}}} \\\\
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   966
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   967
  \indexdef{inner}{syntax}{type}\hypertarget{syntax.inner.type}{\hyperlink{syntax.inner.type}{\mbox{\isa{type}}}} & = & \verb|(| \isa{type} \verb|)| \\
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   968
    & \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|_| \\
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   969
    & \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}}} \\
46287
0bb3d8ee5d25 more accurate Pure grammar;
wenzelm
parents: 46286
diff changeset
   970
    & \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}}} \\
0bb3d8ee5d25 more accurate Pure grammar;
wenzelm
parents: 46286
diff changeset
   971
    & \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} \\
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   972
    & \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}}} \\
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   973
    & \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}}} \\
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   974
    & \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}}} \\
46287
0bb3d8ee5d25 more accurate Pure grammar;
wenzelm
parents: 46286
diff changeset
   975
    & \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}}} \\
0bb3d8ee5d25 more accurate Pure grammar;
wenzelm
parents: 46286
diff changeset
   976
  \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}}} \\\\
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   977
46287
0bb3d8ee5d25 more accurate Pure grammar;
wenzelm
parents: 46286
diff changeset
   978
  \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|{}| \\
0bb3d8ee5d25 more accurate Pure grammar;
wenzelm
parents: 46286
diff changeset
   979
    & \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|}| \\
0bb3d8ee5d25 more accurate Pure grammar;
wenzelm
parents: 46286
diff changeset
   980
  \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}}} \\
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   981
  \end{supertabular}
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   982
  \end{center}
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   983
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   984
  \medskip Here literal terminals are printed \verb|verbatim|;
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   985
  see also \secref{sec:inner-lex} for further token categories of the
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   986
  inner syntax.  The meaning of the nonterminals defined by the above
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   987
  grammar is as follows:
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   988
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   989
  \begin{description}
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   990
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   991
  \item \indexref{inner}{syntax}{any}\hyperlink{syntax.inner.any}{\mbox{\isa{any}}} denotes any term.
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   992
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   993
  \item \indexref{inner}{syntax}{prop}\hyperlink{syntax.inner.prop}{\mbox{\isa{prop}}} denotes meta-level propositions,
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   994
  which are terms of type \isa{prop}.  The syntax of such formulae of
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   995
  the meta-logic is carefully distinguished from usual conventions for
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
   996
  object-logics.  In particular, plain \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6C616D6264613E}{\isasymlambda}}{\isaliteral{22}{\isachardoublequote}}}-term notation is
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   997
  \emph{not} recognized as \hyperlink{syntax.inner.prop}{\mbox{\isa{prop}}}.
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   998
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
   999
  \item \indexref{inner}{syntax}{aprop}\hyperlink{syntax.inner.aprop}{\mbox{\isa{aprop}}} denotes atomic propositions, which
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1000
  are embedded into regular \hyperlink{syntax.inner.prop}{\mbox{\isa{prop}}} by means of an
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1001
  explicit \verb|PROP| token.
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1002
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1003
  Terms of type \isa{prop} with non-constant head, e.g.\ a plain
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1004
  variable, are printed in this form.  Constants that yield type \isa{prop} are expected to provide their own concrete syntax; otherwise
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1005
  the printed version will appear like \hyperlink{syntax.inner.logic}{\mbox{\isa{logic}}} and
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1006
  cannot be parsed again as \hyperlink{syntax.inner.prop}{\mbox{\isa{prop}}}.
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1007
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1008
  \item \indexref{inner}{syntax}{logic}\hyperlink{syntax.inner.logic}{\mbox{\isa{logic}}} denotes arbitrary terms of a
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1009
  logical type, excluding type \isa{prop}.  This is the main
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
  1010
  syntactic category of object-logic entities, covering plain \isa{{\isaliteral{5C3C6C616D6264613E}{\isasymlambda}}}-term notation (variables, abstraction, application), plus
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1011
  anything defined by the user.
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1012
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1013
  When specifying notation for logical entities, all logical types
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1014
  (excluding \isa{prop}) are \emph{collapsed} to this single category
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1015
  of \hyperlink{syntax.inner.logic}{\mbox{\isa{logic}}}.
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1016
46287
0bb3d8ee5d25 more accurate Pure grammar;
wenzelm
parents: 46286
diff changeset
  1017
  \item \indexref{inner}{syntax}{index}\hyperlink{syntax.inner.index}{\mbox{\isa{index}}} denotes an optional index term for
0bb3d8ee5d25 more accurate Pure grammar;
wenzelm
parents: 46286
diff changeset
  1018
  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
0bb3d8ee5d25 more accurate Pure grammar;
wenzelm
parents: 46286
diff changeset
  1019
  introduce indexed notation.
0bb3d8ee5d25 more accurate Pure grammar;
wenzelm
parents: 46286
diff changeset
  1020
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1021
  \item \indexref{inner}{syntax}{idt}\hyperlink{syntax.inner.idt}{\mbox{\isa{idt}}} denotes identifiers, possibly
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1022
  constrained by types.
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1023
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1024
  \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
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
  1025
  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}}}.
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1026
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1027
  \item \indexref{inner}{syntax}{pttrn}\hyperlink{syntax.inner.pttrn}{\mbox{\isa{pttrn}}} and \indexref{inner}{syntax}{pttrns}\hyperlink{syntax.inner.pttrns}{\mbox{\isa{pttrns}}}
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1028
  denote patterns for abstraction, cases bindings etc.  In Pure, these
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1029
  categories start as a merely copy of \hyperlink{syntax.inner.idt}{\mbox{\isa{idt}}} and
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1030
  \hyperlink{syntax.inner.idts}{\mbox{\isa{idts}}}, respectively.  Object-logics may add
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1031
  additional productions for binding forms.
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1032
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1033
  \item \indexref{inner}{syntax}{type}\hyperlink{syntax.inner.type}{\mbox{\isa{type}}} denotes types of the meta-logic.
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1034
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1035
  \item \indexref{inner}{syntax}{sort}\hyperlink{syntax.inner.sort}{\mbox{\isa{sort}}} denotes meta-level sorts.
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1036
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1037
  \end{description}
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1038
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1039
  Here are some further explanations of certain syntax features.
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1040
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1041
  \begin{itemize}
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1042
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
  1043
  \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
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
  1044
  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
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1045
  constructor applied to \isa{nat}.  To avoid this interpretation,
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
  1046
  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.
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1047
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
  1048
  \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
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1049
  sequence of identifiers.
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1050
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1051
  \item Type constraints for terms bind very weakly.  For example,
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
  1052
  \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
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
  1053
  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}}}.
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1054
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1055
  \item Constraints may be either written with two literal colons
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1056
  ``\verb|::|'' or the double-colon symbol \verb|\<Colon>|,
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1057
  which actually looks exactly the same in some {\LaTeX} styles.
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1058
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1059
  \item Dummy variables (written as underscore) may occur in different
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1060
  roles.
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1061
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1062
  \begin{description}
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1063
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
  1064
  \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
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1065
  anonymous inference parameter, which is filled-in according to the
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1066
  most general type produced by the type-checking phase.
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1067
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
  1068
  \item A bound ``\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5F}{\isacharunderscore}}{\isaliteral{22}{\isachardoublequote}}}'' refers to a vacuous abstraction, where
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1069
  the body does not refer to the binding introduced here.  As in the
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
  1070
  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}}}.
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1071
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
  1072
  \item A free ``\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5F}{\isacharunderscore}}{\isaliteral{22}{\isachardoublequote}}}'' refers to an implicit outer binding.
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
  1073
  Higher definitional packages usually allow forms like \isa{{\isaliteral{22}{\isachardoublequote}}f\ x\ {\isaliteral{5F}{\isacharunderscore}}\ {\isaliteral{3D}{\isacharequal}}\ x{\isaliteral{22}{\isachardoublequote}}}.
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1074
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
  1075
  \item A schematic ``\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5F}{\isacharunderscore}}{\isaliteral{22}{\isachardoublequote}}}'' (within a term pattern, see
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1076
  \secref{sec:term-decls}) refers to an anonymous variable that is
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1077
  implicitly abstracted over its context of locally bound variables.
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
  1078
  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
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1079
  using both bound and schematic dummies.
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1080
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1081
  \end{description}
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1082
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1083
  \item The three literal dots ``\verb|...|'' may be also
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1084
  written as ellipsis symbol \verb|\<dots>|.  In both cases this
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1085
  refers to a special schematic variable, which is bound in the
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1086
  context.  This special term abbreviation works nicely with
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1087
  calculational reasoning (\secref{sec:calculation}).
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1088
46287
0bb3d8ee5d25 more accurate Pure grammar;
wenzelm
parents: 46286
diff changeset
  1089
  \item \verb|CONST| ensures that the given identifier is treated
0bb3d8ee5d25 more accurate Pure grammar;
wenzelm
parents: 46286
diff changeset
  1090
  as constant term, and passed through the parse tree in fully
0bb3d8ee5d25 more accurate Pure grammar;
wenzelm
parents: 46286
diff changeset
  1091
  internalized form.  This is particularly relevant for translation
0bb3d8ee5d25 more accurate Pure grammar;
wenzelm
parents: 46286
diff changeset
  1092
  rules (\secref{sec:syn-trans}), notably on the RHS.
0bb3d8ee5d25 more accurate Pure grammar;
wenzelm
parents: 46286
diff changeset
  1093
0bb3d8ee5d25 more accurate Pure grammar;
wenzelm
parents: 46286
diff changeset
  1094
  \item \verb|XCONST| is similar to \verb|CONST|, but
0bb3d8ee5d25 more accurate Pure grammar;
wenzelm
parents: 46286
diff changeset
  1095
  retains the constant name as given.  This is only relevant to
0bb3d8ee5d25 more accurate Pure grammar;
wenzelm
parents: 46286
diff changeset
  1096
  translation rules (\secref{sec:syn-trans}), notably on the LHS.
0bb3d8ee5d25 more accurate Pure grammar;
wenzelm
parents: 46286
diff changeset
  1097
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1098
  \end{itemize}%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1099
\end{isamarkuptext}%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1100
\isamarkuptrue%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1101
%
46282
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
  1102
\isamarkupsubsection{Inspecting the syntax%
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1103
}
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1104
\isamarkuptrue%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1105
%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1106
\begin{isamarkuptext}%
46282
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
  1107
\begin{matharray}{rcl}
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
  1108
    \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}}} \\
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
  1109
  \end{matharray}
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1110
46282
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
  1111
  \begin{description}
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1112
46282
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
  1113
  \item \hyperlink{command.print-syntax}{\mbox{\isa{\isacommand{print{\isaliteral{5F}{\isacharunderscore}}syntax}}}} prints the inner syntax of the
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
  1114
  current context.  The output can be quite large; the most important
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
  1115
  sections are explained below.
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1116
46282
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
  1117
  \begin{description}
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1118
46282
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
  1119
  \item \isa{{\isaliteral{22}{\isachardoublequote}}lexicon{\isaliteral{22}{\isachardoublequote}}} lists the delimiters of the inner token
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
  1120
  language; see \secref{sec:inner-lex}.
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1121
46282
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
  1122
  \item \isa{{\isaliteral{22}{\isachardoublequote}}prods{\isaliteral{22}{\isachardoublequote}}} lists the productions of the underlying
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
  1123
  priority grammar; see \secref{sec:priority-grammar}.
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1124
46282
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
  1125
  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
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
  1126
  \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
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
  1127
  trees; they also guide the pretty printer.
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1128
46282
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
  1129
  Productions without such parse tree names are called \emph{copy
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
  1130
  productions}.  Their right-hand side must have exactly one
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
  1131
  nonterminal symbol (or named token).  The parser does not create a
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
  1132
  new parse tree node for copy productions, but simply returns the
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
  1133
  parse tree of the right-hand symbol.
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
  1134
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
  1135
  If the right-hand side of a copy production consists of a single
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
  1136
  nonterminal without any delimiters, then it is called a \emph{chain
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
  1137
  production}.  Chain productions act as abbreviations: conceptually,
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
  1138
  they are removed from the grammar by adding new productions.
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
  1139
  Priority information attached to chain productions is ignored; only
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
  1140
  the dummy value \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{2D}{\isacharminus}}{\isadigit{1}}{\isaliteral{22}{\isachardoublequote}}} is displayed.
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1141
46282
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
  1142
  \item \isa{{\isaliteral{22}{\isachardoublequote}}print\ modes{\isaliteral{22}{\isachardoublequote}}} lists the alternative print modes
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
  1143
  provided by this grammar; see \secref{sec:print-modes}.
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
  1144
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
  1145
  \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
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
  1146
  syntax translations (macros); see \secref{sec:syn-trans}.
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1147
46282
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
  1148
  \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
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
  1149
  translation functions for abstract syntax trees, which are only
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
  1150
  required in very special situations; see \secref{sec:tr-funs}.
29158
f9b3e508c27f updated generated file;
wenzelm
parents: 28857
diff changeset
  1151
46282
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
  1152
  \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}}}
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
  1153
  list the sets of constants that invoke regular translation
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
  1154
  functions; see \secref{sec:tr-funs}.
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
  1155
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
  1156
  \end{description}
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
  1157
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
  1158
  \end{description}%
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1159
\end{isamarkuptext}%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1160
\isamarkuptrue%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1161
%
46291
a1827b8b45ae updated section about syntax ambiguity;
wenzelm
parents: 46290
diff changeset
  1162
\isamarkupsubsection{Ambiguity of parsed expressions%
a1827b8b45ae updated section about syntax ambiguity;
wenzelm
parents: 46290
diff changeset
  1163
}
a1827b8b45ae updated section about syntax ambiguity;
wenzelm
parents: 46290
diff changeset
  1164
\isamarkuptrue%
a1827b8b45ae updated section about syntax ambiguity;
wenzelm
parents: 46290
diff changeset
  1165
%
a1827b8b45ae updated section about syntax ambiguity;
wenzelm
parents: 46290
diff changeset
  1166
\begin{isamarkuptext}%
a1827b8b45ae updated section about syntax ambiguity;
wenzelm
parents: 46290
diff changeset
  1167
\begin{tabular}{rcll}
46512
4f9f61f9b535 simplified configuration options for syntax ambiguity;
wenzelm
parents: 46506
diff changeset
  1168
    \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} \\
46506
c7faa011bfa7 simplified configuration options for syntax ambiguity;
wenzelm
parents: 46494
diff changeset
  1169
    \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}}} \\
46291
a1827b8b45ae updated section about syntax ambiguity;
wenzelm
parents: 46290
diff changeset
  1170
  \end{tabular}
a1827b8b45ae updated section about syntax ambiguity;
wenzelm
parents: 46290
diff changeset
  1171
a1827b8b45ae updated section about syntax ambiguity;
wenzelm
parents: 46290
diff changeset
  1172
  Depending on the grammar and the given input, parsing may be
a1827b8b45ae updated section about syntax ambiguity;
wenzelm
parents: 46290
diff changeset
  1173
  ambiguous.  Isabelle lets the Earley parser enumerate all possible
a1827b8b45ae updated section about syntax ambiguity;
wenzelm
parents: 46290
diff changeset
  1174
  parse trees, and then tries to make the best out of the situation.
a1827b8b45ae updated section about syntax ambiguity;
wenzelm
parents: 46290
diff changeset
  1175
  Terms that cannot be type-checked are filtered out, which often
a1827b8b45ae updated section about syntax ambiguity;
wenzelm
parents: 46290
diff changeset
  1176
  leads to a unique result in the end.  Unlike regular type
a1827b8b45ae updated section about syntax ambiguity;
wenzelm
parents: 46290
diff changeset
  1177
  reconstruction, which is applied to the whole collection of input
a1827b8b45ae updated section about syntax ambiguity;
wenzelm
parents: 46290
diff changeset
  1178
  terms simultaneously, the filtering stage only treats each given
a1827b8b45ae updated section about syntax ambiguity;
wenzelm
parents: 46290
diff changeset
  1179
  term in isolation.  Filtering is also not attempted for individual
a1827b8b45ae updated section about syntax ambiguity;
wenzelm
parents: 46290
diff changeset
  1180
  types or raw ASTs (as required for \hyperlink{command.translations}{\mbox{\isa{\isacommand{translations}}}}).
a1827b8b45ae updated section about syntax ambiguity;
wenzelm
parents: 46290
diff changeset
  1181
a1827b8b45ae updated section about syntax ambiguity;
wenzelm
parents: 46290
diff changeset
  1182
  Certain warning or error messages are printed, depending on the
a1827b8b45ae updated section about syntax ambiguity;
wenzelm
parents: 46290
diff changeset
  1183
  situation and the given configuration options.  Parsing ultimately
a1827b8b45ae updated section about syntax ambiguity;
wenzelm
parents: 46290
diff changeset
  1184
  fails, if multiple results remain after the filtering phase.
a1827b8b45ae updated section about syntax ambiguity;
wenzelm
parents: 46290
diff changeset
  1185
a1827b8b45ae updated section about syntax ambiguity;
wenzelm
parents: 46290
diff changeset
  1186
  \begin{description}
a1827b8b45ae updated section about syntax ambiguity;
wenzelm
parents: 46290
diff changeset
  1187
46512
4f9f61f9b535 simplified configuration options for syntax ambiguity;
wenzelm
parents: 46506
diff changeset
  1188
  \item \hyperlink{attribute.syntax-ambiguity-warning}{\mbox{\isa{syntax{\isaliteral{5F}{\isacharunderscore}}ambiguity{\isaliteral{5F}{\isacharunderscore}}warning}}} controls output of
4f9f61f9b535 simplified configuration options for syntax ambiguity;
wenzelm
parents: 46506
diff changeset
  1189
  explicit warning messages about syntax ambiguity.
46291
a1827b8b45ae updated section about syntax ambiguity;
wenzelm
parents: 46290
diff changeset
  1190
46506
c7faa011bfa7 simplified configuration options for syntax ambiguity;
wenzelm
parents: 46494
diff changeset
  1191
  \item \hyperlink{attribute.syntax-ambiguity-limit}{\mbox{\isa{syntax{\isaliteral{5F}{\isacharunderscore}}ambiguity{\isaliteral{5F}{\isacharunderscore}}limit}}} determines the number of
46291
a1827b8b45ae updated section about syntax ambiguity;
wenzelm
parents: 46290
diff changeset
  1192
  resulting parse trees that are shown as part of the printed message
a1827b8b45ae updated section about syntax ambiguity;
wenzelm
parents: 46290
diff changeset
  1193
  in case of an ambiguity.
a1827b8b45ae updated section about syntax ambiguity;
wenzelm
parents: 46290
diff changeset
  1194
a1827b8b45ae updated section about syntax ambiguity;
wenzelm
parents: 46290
diff changeset
  1195
  \end{description}%
a1827b8b45ae updated section about syntax ambiguity;
wenzelm
parents: 46290
diff changeset
  1196
\end{isamarkuptext}%
a1827b8b45ae updated section about syntax ambiguity;
wenzelm
parents: 46290
diff changeset
  1197
\isamarkuptrue%
a1827b8b45ae updated section about syntax ambiguity;
wenzelm
parents: 46290
diff changeset
  1198
%
48113
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1199
\isamarkupsection{Syntax transformations \label{sec:syntax-transformations}%
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1200
}
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1201
\isamarkuptrue%
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1202
%
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1203
\begin{isamarkuptext}%
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1204
The inner syntax engine of Isabelle provides separate
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1205
  mechanisms to transform parse trees either as rewrite systems on
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1206
  first-order ASTs (\secref{sec:syn-trans}), or ML functions on ASTs
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1207
  or syntactic \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6C616D6264613E}{\isasymlambda}}{\isaliteral{22}{\isachardoublequote}}}-terms (\secref{sec:tr-funs}).  This works
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1208
  both for parsing and printing, as outlined in
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1209
  \figref{fig:parse-print}.
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1210
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1211
  \begin{figure}[htbp]
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1212
  \begin{center}
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1213
  \begin{tabular}{cl}
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1214
  string          & \\
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1215
  \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C646F776E3E}{\isasymdown}}{\isaliteral{22}{\isachardoublequote}}}     & lexer + parser \\
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1216
  parse tree      & \\
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1217
  \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C646F776E3E}{\isasymdown}}{\isaliteral{22}{\isachardoublequote}}}     & parse AST translation \\
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1218
  AST             & \\
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1219
  \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C646F776E3E}{\isasymdown}}{\isaliteral{22}{\isachardoublequote}}}     & AST rewriting (macros) \\
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1220
  AST             & \\
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1221
  \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C646F776E3E}{\isasymdown}}{\isaliteral{22}{\isachardoublequote}}}     & parse translation \\
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1222
  --- pre-term ---    & \\
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1223
  \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C646F776E3E}{\isasymdown}}{\isaliteral{22}{\isachardoublequote}}}     & print translation \\
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1224
  AST             & \\
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1225
  \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C646F776E3E}{\isasymdown}}{\isaliteral{22}{\isachardoublequote}}}     & AST rewriting (macros) \\
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1226
  AST             & \\
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1227
  \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C646F776E3E}{\isasymdown}}{\isaliteral{22}{\isachardoublequote}}}     & print AST translation \\
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1228
  string          &
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1229
  \end{tabular}
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1230
  \end{center}
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1231
  \caption{Parsing and printing with translations}\label{fig:parse-print}
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1232
  \end{figure}
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1233
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1234
  These intermediate syntax tree formats eventually lead to a pre-term
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1235
  with all names and binding scopes resolved, but most type
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1236
  information still missing.  Explicit type constraints might be given by
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1237
  the user, or implicit position information by the system --- both
48816
wenzelm
parents: 48792
diff changeset
  1238
  need to be passed-through carefully by syntax transformations.
48113
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1239
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1240
  Pre-terms are further processed by the so-called \emph{check} and
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1241
  \emph{unckeck} phases that are intertwined with type-inference (see
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1242
  also \cite{isabelle-implementation}).  The latter allows to operate
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1243
  on higher-order abstract syntax with proper binding and type
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1244
  information already available.
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1245
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1246
  As a rule of thumb, anything that manipulates bindings of variables
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1247
  or constants needs to be implemented as syntax transformation (see
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1248
  below).  Anything else is better done via check/uncheck: a prominent
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1249
  example application is the \hyperlink{command.abbreviation}{\mbox{\isa{\isacommand{abbreviation}}}} concept of
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1250
  Isabelle/Pure.%
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1251
\end{isamarkuptext}%
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1252
\isamarkuptrue%
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1253
%
48115
d868e4f7905b more on syntax translations;
wenzelm
parents: 48114
diff changeset
  1254
\isamarkupsubsection{Abstract syntax trees \label{sec:ast}%
48113
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1255
}
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1256
\isamarkuptrue%
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1257
%
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1258
\begin{isamarkuptext}%
48114
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1259
The ML datatype \verb|Ast.ast| explicitly represents the
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1260
  intermediate AST format that is used for syntax rewriting
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1261
  (\secref{sec:syn-trans}).  It is defined in ML as follows:
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1262
  \begin{ttbox}
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1263
  datatype ast =
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1264
    Constant of string |
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1265
    Variable of string |
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1266
    Appl of ast list
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1267
  \end{ttbox}
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1268
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1269
  An AST is either an atom (constant or variable) or a list of (at
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1270
  least two) subtrees.  Occasional diagnostic output of ASTs uses
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1271
  notation that resembles S-expression of LISP.  Constant atoms are
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1272
  shown as quoted strings, variable atoms as non-quoted strings and
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1273
  applications as a parenthesized list of subtrees.  For example, the
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1274
  AST
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1275
  \begin{verbatim}
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1276
Ast.Appl
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1277
  [Ast.Constant "_abs", Ast.Variable "x", Ast.Variable "t"]
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1278
\end{verbatim}
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1279
  is pretty-printed as \verb|("_abs" x t)|.  Note that
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1280
  \verb|()| and \verb|(x)| are excluded as ASTs, because
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1281
  they have too few subtrees.
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1282
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1283
  \medskip AST application is merely a pro-forma mechanism to indicate
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1284
  certain syntactic structures.  Thus \verb|(c a b)| could mean
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1285
  either term application or type application, depending on the
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1286
  syntactic context.
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1287
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1288
  Nested application like \verb|(("_abs" x t) u)| is also
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1289
  possible, but ASTs are definitely first-order: the syntax constant
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1290
  \verb|"_abs"| does not bind the \verb|x| in any way.
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1291
  Proper bindings are introduced in later stages of the term syntax,
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1292
  where \verb|("_abs" x t)| becomes an \verb|Abs| node and
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1293
  occurrences of \verb|x| in \verb|t| are replaced by bound
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1294
  variables (represented as de-Bruijn indices).%
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1295
\end{isamarkuptext}%
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1296
\isamarkuptrue%
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1297
%
48115
d868e4f7905b more on syntax translations;
wenzelm
parents: 48114
diff changeset
  1298
\isamarkupsubsubsection{AST constants versus variables%
48114
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1299
}
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1300
\isamarkuptrue%
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1301
%
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1302
\begin{isamarkuptext}%
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1303
Depending on the situation --- input syntax, output syntax,
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1304
  translation patterns --- the distinction of atomic asts as \verb|Ast.Constant| versus \verb|Ast.Variable| serves slightly different
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1305
  purposes.
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1306
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1307
  Input syntax of a term such as \isa{{\isaliteral{22}{\isachardoublequote}}f\ a\ b\ {\isaliteral{3D}{\isacharequal}}\ c{\isaliteral{22}{\isachardoublequote}}} does not yet
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1308
  indicate the scopes of atomic entities \isa{{\isaliteral{22}{\isachardoublequote}}f{\isaliteral{2C}{\isacharcomma}}\ a{\isaliteral{2C}{\isacharcomma}}\ b{\isaliteral{2C}{\isacharcomma}}\ c{\isaliteral{22}{\isachardoublequote}}}: they
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1309
  could be global constants or local variables, even bound ones
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1310
  depending on the context of the term.  \verb|Ast.Variable| leaves
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1311
  this choice still open: later syntax layers (or translation
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1312
  functions) may capture such a variable to determine its role
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1313
  specifically, to make it a constant, bound variable, free variable
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1314
  etc.  In contrast, syntax translations that introduce already known
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1315
  constants would rather do it via \verb|Ast.Constant| to prevent
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1316
  accidental re-interpretation later on.
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1317
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1318
  Output syntax turns term constants into \verb|Ast.Constant| and
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1319
  variables (free or schematic) into \verb|Ast.Variable|.  This
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1320
  information is precise when printing fully formal \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6C616D6264613E}{\isasymlambda}}{\isaliteral{22}{\isachardoublequote}}}-terms.
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1321
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1322
  In AST translation patterns (\secref{sec:syn-trans}) the system
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1323
  guesses from the current theory context which atoms should be
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1324
  treated as constant versus variable for the matching process.
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1325
  Sometimes this needs to be indicated more explicitly using \isa{{\isaliteral{22}{\isachardoublequote}}CONST\ c{\isaliteral{22}{\isachardoublequote}}} inside the term language.  It is also possible to use
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1326
  \hyperlink{command.syntax}{\mbox{\isa{\isacommand{syntax}}}} declarations (without mixfix annotation) to
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1327
  enforce that certain unqualified names are always treated as
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1328
  constant within the syntax machinery.
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1329
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1330
  \medskip For ASTs that represent the language of types or sorts, the
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1331
  situation is much simpler, since the concrete syntax already
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1332
  distinguishes type variables from type constants (constructors).  So
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1333
  \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}{\isaliteral{27}{\isacharprime}}a{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{27}{\isacharprime}}b{\isaliteral{29}{\isacharparenright}}\ foo{\isaliteral{22}{\isachardoublequote}}} corresponds to an AST application of some
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1334
  constant for \isa{foo} and variable arguments for \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{27}{\isacharprime}}a{\isaliteral{22}{\isachardoublequote}}} and
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1335
  \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{27}{\isacharprime}}b{\isaliteral{22}{\isachardoublequote}}}.  Note that the postfix application is merely a feature
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1336
  of the concrete syntax, while in the AST the constructor occurs in
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1337
  head position.%
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1338
\end{isamarkuptext}%
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1339
\isamarkuptrue%
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1340
%
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1341
\isamarkupsubsubsection{Authentic syntax names%
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1342
}
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1343
\isamarkuptrue%
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1344
%
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1345
\begin{isamarkuptext}%
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1346
Naming constant entities within ASTs is another delicate
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1347
  issue.  Unqualified names are looked up in the name space tables in
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1348
  the last stage of parsing, after all translations have been applied.
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1349
  Since syntax transformations do not know about this later name
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1350
  resolution yet, there can be surprises in boundary cases.
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1351
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1352
  \emph{Authentic syntax names} for \verb|Ast.Constant| avoid this
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1353
  problem: the fully-qualified constant name with a special prefix for
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1354
  its formal category (\isa{{\isaliteral{22}{\isachardoublequote}}class{\isaliteral{22}{\isachardoublequote}}}, \isa{{\isaliteral{22}{\isachardoublequote}}type{\isaliteral{22}{\isachardoublequote}}}, \isa{{\isaliteral{22}{\isachardoublequote}}const{\isaliteral{22}{\isachardoublequote}}}, \isa{{\isaliteral{22}{\isachardoublequote}}fixed{\isaliteral{22}{\isachardoublequote}}}) represents the information faithfully
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1355
  within the untyped AST format.  Accidental overlap with free or
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1356
  bound variables is excluded as well.  Authentic syntax names work
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1357
  implicitly in the following situations:
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1358
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1359
  \begin{itemize}
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1360
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1361
  \item Input of term constants (or fixed variables) that are
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1362
  introduced by concrete syntax via \hyperlink{command.notation}{\mbox{\isa{\isacommand{notation}}}}: the
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1363
  correspondence of a particular grammar production to some known term
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1364
  entity is preserved.
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1365
48816
wenzelm
parents: 48792
diff changeset
  1366
  \item Input of type constants (constructors) and type classes ---
48114
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1367
  thanks to explicit syntactic distinction independently on the
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1368
  context.
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1369
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1370
  \item Output of term constants, type constants, type classes ---
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1371
  this information is already available from the internal term to be
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1372
  printed.
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1373
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1374
  \end{itemize}
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1375
428e55887f24 more on "Abstract syntax trees";
wenzelm
parents: 48113
diff changeset
  1376
  In other words, syntax transformations that operate on input terms
48816
wenzelm
parents: 48792
diff changeset
  1377
  written as prefix applications are difficult to make robust.
wenzelm
parents: 48792
diff changeset
  1378
  Luckily, this case rarely occurs in practice, because syntax forms
wenzelm
parents: 48792
diff changeset
  1379
  to be translated usually correspond to some bits of concrete
wenzelm
parents: 48792
diff changeset
  1380
  notation.%
48113
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1381
\end{isamarkuptext}%
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1382
\isamarkuptrue%
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1383
%
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1384
\isamarkupsubsection{Raw syntax and translations \label{sec:syn-trans}%
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1385
}
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1386
\isamarkuptrue%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1387
%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1388
\begin{isamarkuptext}%
48117
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1389
\begin{tabular}{rcll}
41229
d797baa3d57c replaced command 'nonterminals' by slightly modernized version 'nonterminal';
wenzelm
parents: 40879
diff changeset
  1390
    \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}}} \\
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
  1391
    \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}}} \\
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
  1392
    \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}}} \\
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
  1393
    \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}}} \\
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
  1394
    \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}}} \\
48117
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1395
    \indexdef{}{attribute}{syntax\_ast\_trace}\hypertarget{attribute.syntax-ast-trace}{\hyperlink{attribute.syntax-ast-trace}{\mbox{\isa{syntax{\isaliteral{5F}{\isacharunderscore}}ast{\isaliteral{5F}{\isacharunderscore}}trace}}}} & : & \isa{attribute} & default \isa{false} \\
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1396
    \indexdef{}{attribute}{syntax\_ast\_stats}\hypertarget{attribute.syntax-ast-stats}{\hyperlink{attribute.syntax-ast-stats}{\mbox{\isa{syntax{\isaliteral{5F}{\isacharunderscore}}ast{\isaliteral{5F}{\isacharunderscore}}stats}}}} & : & \isa{attribute} & default \isa{false} \\
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1397
  \end{tabular}
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1398
46292
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
  1399
  Unlike mixfix notation for existing formal entities
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
  1400
  (\secref{sec:notation}), raw syntax declarations provide full access
48115
d868e4f7905b more on syntax translations;
wenzelm
parents: 48114
diff changeset
  1401
  to the priority grammar of the inner syntax, without any sanity
d868e4f7905b more on syntax translations;
wenzelm
parents: 48114
diff changeset
  1402
  checks.  This includes additional syntactic categories (via
d868e4f7905b more on syntax translations;
wenzelm
parents: 48114
diff changeset
  1403
  \hyperlink{command.nonterminal}{\mbox{\isa{\isacommand{nonterminal}}}}) and free-form grammar productions (via
d868e4f7905b more on syntax translations;
wenzelm
parents: 48114
diff changeset
  1404
  \hyperlink{command.syntax}{\mbox{\isa{\isacommand{syntax}}}}).  Additional syntax translations (or macros, via
d868e4f7905b more on syntax translations;
wenzelm
parents: 48114
diff changeset
  1405
  \hyperlink{command.translations}{\mbox{\isa{\isacommand{translations}}}}) are required to turn resulting parse trees
d868e4f7905b more on syntax translations;
wenzelm
parents: 48114
diff changeset
  1406
  into proper representations of formal entities again.
46292
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
  1407
42596
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1408
  \begin{railoutput}
42662
2080fe35abea updated generated files;
wenzelm
parents: 42655
diff changeset
  1409
\rail@begin{2}{}
42596
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1410
\rail@term{\hyperlink{command.nonterminal}{\mbox{\isa{\isacommand{nonterminal}}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1411
\rail@plus
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1412
\rail@nont{\hyperlink{syntax.name}{\mbox{\isa{name}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1413
\rail@nextplus{1}
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1414
\rail@cterm{\isa{\isakeyword{and}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1415
\rail@endplus
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1416
\rail@end
42662
2080fe35abea updated generated files;
wenzelm
parents: 42655
diff changeset
  1417
\rail@begin{2}{}
42596
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1418
\rail@bar
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1419
\rail@term{\hyperlink{command.syntax}{\mbox{\isa{\isacommand{syntax}}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1420
\rail@nextbar{1}
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1421
\rail@term{\hyperlink{command.no-syntax}{\mbox{\isa{\isacommand{no{\isaliteral{5F}{\isacharunderscore}}syntax}}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1422
\rail@endbar
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1423
\rail@bar
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1424
\rail@nextbar{1}
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1425
\rail@nont{\hyperlink{syntax.mode}{\mbox{\isa{mode}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1426
\rail@endbar
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1427
\rail@plus
46494
ea2ae63336f3 clarified outer syntax "constdecl", which is only local to some rail diagrams;
wenzelm
parents: 46483
diff changeset
  1428
\rail@nont{\isa{constdecl}}[]
42596
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1429
\rail@nextplus{1}
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1430
\rail@endplus
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1431
\rail@end
42662
2080fe35abea updated generated files;
wenzelm
parents: 42655
diff changeset
  1432
\rail@begin{7}{}
42596
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1433
\rail@bar
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1434
\rail@term{\hyperlink{command.translations}{\mbox{\isa{\isacommand{translations}}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1435
\rail@nextbar{1}
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1436
\rail@term{\hyperlink{command.no-translations}{\mbox{\isa{\isacommand{no{\isaliteral{5F}{\isacharunderscore}}translations}}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1437
\rail@endbar
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1438
\rail@plus
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1439
\rail@nont{\isa{transpat}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1440
\rail@bar
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1441
\rail@term{\isa{{\isaliteral{3D}{\isacharequal}}{\isaliteral{3D}{\isacharequal}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1442
\rail@nextbar{1}
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1443
\rail@term{\isa{{\isaliteral{3D}{\isacharequal}}{\isaliteral{3E}{\isachargreater}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1444
\rail@nextbar{2}
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1445
\rail@term{\isa{{\isaliteral{3C}{\isacharless}}{\isaliteral{3D}{\isacharequal}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1446
\rail@nextbar{3}
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1447
\rail@term{\isa{{\isaliteral{5C3C72696768746C656674686172706F6F6E733E}{\isasymrightleftharpoons}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1448
\rail@nextbar{4}
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1449
\rail@term{\isa{{\isaliteral{5C3C7269676874686172706F6F6E75703E}{\isasymrightharpoonup}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1450
\rail@nextbar{5}
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1451
\rail@term{\isa{{\isaliteral{5C3C6C656674686172706F6F6E646F776E3E}{\isasymleftharpoondown}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1452
\rail@endbar
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1453
\rail@nont{\isa{transpat}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1454
\rail@nextplus{6}
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1455
\rail@endplus
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1456
\rail@end
46494
ea2ae63336f3 clarified outer syntax "constdecl", which is only local to some rail diagrams;
wenzelm
parents: 46483
diff changeset
  1457
\rail@begin{2}{\isa{constdecl}}
ea2ae63336f3 clarified outer syntax "constdecl", which is only local to some rail diagrams;
wenzelm
parents: 46483
diff changeset
  1458
\rail@nont{\hyperlink{syntax.name}{\mbox{\isa{name}}}}[]
ea2ae63336f3 clarified outer syntax "constdecl", which is only local to some rail diagrams;
wenzelm
parents: 46483
diff changeset
  1459
\rail@term{\isa{{\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}}}[]
ea2ae63336f3 clarified outer syntax "constdecl", which is only local to some rail diagrams;
wenzelm
parents: 46483
diff changeset
  1460
\rail@nont{\hyperlink{syntax.type}{\mbox{\isa{type}}}}[]
ea2ae63336f3 clarified outer syntax "constdecl", which is only local to some rail diagrams;
wenzelm
parents: 46483
diff changeset
  1461
\rail@bar
ea2ae63336f3 clarified outer syntax "constdecl", which is only local to some rail diagrams;
wenzelm
parents: 46483
diff changeset
  1462
\rail@nextbar{1}
ea2ae63336f3 clarified outer syntax "constdecl", which is only local to some rail diagrams;
wenzelm
parents: 46483
diff changeset
  1463
\rail@nont{\hyperlink{syntax.mixfix}{\mbox{\isa{mixfix}}}}[]
ea2ae63336f3 clarified outer syntax "constdecl", which is only local to some rail diagrams;
wenzelm
parents: 46483
diff changeset
  1464
\rail@endbar
ea2ae63336f3 clarified outer syntax "constdecl", which is only local to some rail diagrams;
wenzelm
parents: 46483
diff changeset
  1465
\rail@end
42596
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1466
\rail@begin{3}{\isa{mode}}
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1467
\rail@term{\isa{{\isaliteral{28}{\isacharparenleft}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1468
\rail@bar
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1469
\rail@nont{\hyperlink{syntax.name}{\mbox{\isa{name}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1470
\rail@nextbar{1}
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1471
\rail@term{\isa{\isakeyword{output}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1472
\rail@nextbar{2}
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1473
\rail@nont{\hyperlink{syntax.name}{\mbox{\isa{name}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1474
\rail@term{\isa{\isakeyword{output}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1475
\rail@endbar
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1476
\rail@term{\isa{{\isaliteral{29}{\isacharparenright}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1477
\rail@end
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1478
\rail@begin{2}{\isa{transpat}}
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1479
\rail@bar
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1480
\rail@nextbar{1}
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1481
\rail@term{\isa{{\isaliteral{28}{\isacharparenleft}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1482
\rail@nont{\hyperlink{syntax.nameref}{\mbox{\isa{nameref}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1483
\rail@term{\isa{{\isaliteral{29}{\isacharparenright}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1484
\rail@endbar
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1485
\rail@nont{\hyperlink{syntax.string}{\mbox{\isa{string}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1486
\rail@end
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1487
\end{railoutput}
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1488
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1489
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1490
  \begin{description}
46282
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
  1491
41229
d797baa3d57c replaced command 'nonterminals' by slightly modernized version 'nonterminal';
wenzelm
parents: 40879
diff changeset
  1492
  \item \hyperlink{command.nonterminal}{\mbox{\isa{\isacommand{nonterminal}}}}~\isa{c} declares a type
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1493
  constructor \isa{c} (without arguments) to act as purely syntactic
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1494
  type: a nonterminal symbol of the inner syntax.
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1495
46292
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
  1496
  \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
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
  1497
  priority grammar and the pretty printer table for the given print
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
  1498
  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.
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
  1499
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
  1500
  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
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
  1501
  specify a grammar production.  The \isa{template} contains
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
  1502
  delimiter tokens that surround \isa{{\isaliteral{22}{\isachardoublequote}}n{\isaliteral{22}{\isachardoublequote}}} argument positions
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
  1503
  (\verb|_|).  The latter correspond to nonterminal symbols
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
  1504
  \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
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
  1505
  follows:
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
  1506
  \begin{itemize}
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
  1507
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
  1508
  \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}}}
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
  1509
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
  1510
  \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
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
  1511
  constructor \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6B617070613E}{\isasymkappa}}\ {\isaliteral{5C3C6E6F7465713E}{\isasymnoteq}}\ prop{\isaliteral{22}{\isachardoublequote}}}
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
  1512
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
  1513
  \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
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
  1514
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
  1515
  \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}}}
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
  1516
  (syntactic type constructor)
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
  1517
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
  1518
  \end{itemize}
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
  1519
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
  1520
  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
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
  1521
  given list \isa{{\isaliteral{22}{\isachardoublequote}}ps{\isaliteral{22}{\isachardoublequote}}}; misssing priorities default to 0.
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
  1522
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
  1523
  The resulting nonterminal of the production is determined similarly
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
  1524
  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.
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
  1525
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
  1526
  \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
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
  1527
  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.
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
  1528
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
  1529
  Such syntactic constants are invented on the spot, without formal
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
  1530
  check wrt.\ existing declarations.  It is conventional to use plain
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
  1531
  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
48816
wenzelm
parents: 48792
diff changeset
  1532
  with other syntax declarations.
46292
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
  1533
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
  1534
  \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
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
  1535
  resulting parse tree \isa{{\isaliteral{22}{\isachardoublequote}}t{\isaliteral{22}{\isachardoublequote}}} is copied directly, without any
4eb48958b50f updated section on raw syntax;
wenzelm
parents: 46291
diff changeset
  1536
  further decoration.
46282
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
  1537
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
  1538
  \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
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1539
  declarations (and translations) resulting from \isa{decls}, which
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1540
  are interpreted in the same manner as for \hyperlink{command.syntax}{\mbox{\isa{\isacommand{syntax}}}} above.
46282
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
  1541
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1542
  \item \hyperlink{command.translations}{\mbox{\isa{\isacommand{translations}}}}~\isa{rules} specifies syntactic
48115
d868e4f7905b more on syntax translations;
wenzelm
parents: 48114
diff changeset
  1543
  translation rules (i.e.\ macros) as first-order rewrite rules on
48816
wenzelm
parents: 48792
diff changeset
  1544
  ASTs (\secref{sec:ast}).  The theory context maintains two
48115
d868e4f7905b more on syntax translations;
wenzelm
parents: 48114
diff changeset
  1545
  independent lists translation rules: parse rules (\verb|=>|
d868e4f7905b more on syntax translations;
wenzelm
parents: 48114
diff changeset
  1546
  or \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C7269676874686172706F6F6E75703E}{\isasymrightharpoonup}}{\isaliteral{22}{\isachardoublequote}}}) and print rules (\verb|<=| or \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6C656674686172706F6F6E646F776E3E}{\isasymleftharpoondown}}{\isaliteral{22}{\isachardoublequote}}}).
d868e4f7905b more on syntax translations;
wenzelm
parents: 48114
diff changeset
  1547
  For convenience, both can be specified simultaneously as parse~/
d868e4f7905b more on syntax translations;
wenzelm
parents: 48114
diff changeset
  1548
  print rules (\verb|==| or \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C72696768746C656674686172706F6F6E733E}{\isasymrightleftharpoons}}{\isaliteral{22}{\isachardoublequote}}}).
d868e4f7905b more on syntax translations;
wenzelm
parents: 48114
diff changeset
  1549
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1550
  Translation patterns may be prefixed by the syntactic category to be
48115
d868e4f7905b more on syntax translations;
wenzelm
parents: 48114
diff changeset
  1551
  used for parsing; the default is \isa{logic} which means that
d868e4f7905b more on syntax translations;
wenzelm
parents: 48114
diff changeset
  1552
  regular term syntax is used.  Both sides of the syntax translation
d868e4f7905b more on syntax translations;
wenzelm
parents: 48114
diff changeset
  1553
  rule undergo parsing and parse AST translations
d868e4f7905b more on syntax translations;
wenzelm
parents: 48114
diff changeset
  1554
  \secref{sec:tr-funs}, in order to perform some fundamental
d868e4f7905b more on syntax translations;
wenzelm
parents: 48114
diff changeset
  1555
  normalization like \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6C616D6264613E}{\isasymlambda}}x\ y{\isaliteral{2E}{\isachardot}}\ b\ {\isaliteral{5C3C6C65616473746F3E}{\isasymleadsto}}\ {\isaliteral{5C3C6C616D6264613E}{\isasymlambda}}x{\isaliteral{2E}{\isachardot}}\ {\isaliteral{5C3C6C616D6264613E}{\isasymlambda}}y{\isaliteral{2E}{\isachardot}}\ b{\isaliteral{22}{\isachardoublequote}}}, but other AST
d868e4f7905b more on syntax translations;
wenzelm
parents: 48114
diff changeset
  1556
  translation rules are \emph{not} applied recursively here.
d868e4f7905b more on syntax translations;
wenzelm
parents: 48114
diff changeset
  1557
d868e4f7905b more on syntax translations;
wenzelm
parents: 48114
diff changeset
  1558
  When processing AST patterns, the inner syntax lexer runs in a
d868e4f7905b more on syntax translations;
wenzelm
parents: 48114
diff changeset
  1559
  different mode that allows identifiers to start with underscore.
d868e4f7905b more on syntax translations;
wenzelm
parents: 48114
diff changeset
  1560
  This accommodates the usual naming convention for auxiliary syntax
d868e4f7905b more on syntax translations;
wenzelm
parents: 48114
diff changeset
  1561
  constants --- those that do not have a logical counter part --- by
d868e4f7905b more on syntax translations;
wenzelm
parents: 48114
diff changeset
  1562
  allowing to specify arbitrary AST applications within the term
d868e4f7905b more on syntax translations;
wenzelm
parents: 48114
diff changeset
  1563
  syntax, independently of the corresponding concrete syntax.
d868e4f7905b more on syntax translations;
wenzelm
parents: 48114
diff changeset
  1564
d868e4f7905b more on syntax translations;
wenzelm
parents: 48114
diff changeset
  1565
  Atomic ASTs are distinguished as \verb|Ast.Constant| versus \verb|Ast.Variable| as follows: a qualified name or syntax constant
d868e4f7905b more on syntax translations;
wenzelm
parents: 48114
diff changeset
  1566
  declared via \hyperlink{command.syntax}{\mbox{\isa{\isacommand{syntax}}}}, or parse tree head of concrete
d868e4f7905b more on syntax translations;
wenzelm
parents: 48114
diff changeset
  1567
  notation becomes \verb|Ast.Constant|, anything else \verb|Ast.Variable|.  Note that \isa{CONST} and \isa{XCONST} within
d868e4f7905b more on syntax translations;
wenzelm
parents: 48114
diff changeset
  1568
  the term language (\secref{sec:pure-grammar}) allow to enforce
d868e4f7905b more on syntax translations;
wenzelm
parents: 48114
diff changeset
  1569
  treatment as constants.
d868e4f7905b more on syntax translations;
wenzelm
parents: 48114
diff changeset
  1570
d868e4f7905b more on syntax translations;
wenzelm
parents: 48114
diff changeset
  1571
  AST rewrite rules \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}lhs{\isaliteral{2C}{\isacharcomma}}\ rhs{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} need to obey the following
d868e4f7905b more on syntax translations;
wenzelm
parents: 48114
diff changeset
  1572
  side-conditions:
d868e4f7905b more on syntax translations;
wenzelm
parents: 48114
diff changeset
  1573
d868e4f7905b more on syntax translations;
wenzelm
parents: 48114
diff changeset
  1574
  \begin{itemize}
d868e4f7905b more on syntax translations;
wenzelm
parents: 48114
diff changeset
  1575
d868e4f7905b more on syntax translations;
wenzelm
parents: 48114
diff changeset
  1576
  \item Rules must be left linear: \isa{{\isaliteral{22}{\isachardoublequote}}lhs{\isaliteral{22}{\isachardoublequote}}} must not contain
d868e4f7905b more on syntax translations;
wenzelm
parents: 48114
diff changeset
  1577
  repeated variables.\footnote{The deeper reason for this is that AST
d868e4f7905b more on syntax translations;
wenzelm
parents: 48114
diff changeset
  1578
  equality is not well-defined: different occurrences of the ``same''
d868e4f7905b more on syntax translations;
wenzelm
parents: 48114
diff changeset
  1579
  AST could be decorated differently by accidental type-constraints or
d868e4f7905b more on syntax translations;
wenzelm
parents: 48114
diff changeset
  1580
  source position information, for example.}
d868e4f7905b more on syntax translations;
wenzelm
parents: 48114
diff changeset
  1581
d868e4f7905b more on syntax translations;
wenzelm
parents: 48114
diff changeset
  1582
  \item Every variable in \isa{{\isaliteral{22}{\isachardoublequote}}rhs{\isaliteral{22}{\isachardoublequote}}} must also occur in \isa{{\isaliteral{22}{\isachardoublequote}}lhs{\isaliteral{22}{\isachardoublequote}}}.
d868e4f7905b more on syntax translations;
wenzelm
parents: 48114
diff changeset
  1583
d868e4f7905b more on syntax translations;
wenzelm
parents: 48114
diff changeset
  1584
  \end{itemize}
46282
83864b045a72 clarified syntax section structure;
wenzelm
parents: 45703
diff changeset
  1585
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
  1586
  \item \hyperlink{command.no-translations}{\mbox{\isa{\isacommand{no{\isaliteral{5F}{\isacharunderscore}}translations}}}}~\isa{rules} removes syntactic
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1587
  translation rules, which are interpreted in the same manner as for
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1588
  \hyperlink{command.translations}{\mbox{\isa{\isacommand{translations}}}} above.
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1589
48117
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1590
  \item \hyperlink{attribute.syntax-ast-trace}{\mbox{\isa{syntax{\isaliteral{5F}{\isacharunderscore}}ast{\isaliteral{5F}{\isacharunderscore}}trace}}} and \hyperlink{attribute.syntax-ast-stats}{\mbox{\isa{syntax{\isaliteral{5F}{\isacharunderscore}}ast{\isaliteral{5F}{\isacharunderscore}}stats}}} control diagnostic output in the AST normalization
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1591
  process, when translation rules are applied to concrete input or
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1592
  output.
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1593
46293
f248b5f2783a updated examples for syntax translations;
wenzelm
parents: 46292
diff changeset
  1594
  \end{description}
f248b5f2783a updated examples for syntax translations;
wenzelm
parents: 46292
diff changeset
  1595
f248b5f2783a updated examples for syntax translations;
wenzelm
parents: 46292
diff changeset
  1596
  Raw syntax and translations provides a slightly more low-level
f248b5f2783a updated examples for syntax translations;
wenzelm
parents: 46292
diff changeset
  1597
  access to the grammar and the form of resulting parse trees.  It is
f248b5f2783a updated examples for syntax translations;
wenzelm
parents: 46292
diff changeset
  1598
  often possible to avoid this untyped macro mechanism, and use
f248b5f2783a updated examples for syntax translations;
wenzelm
parents: 46292
diff changeset
  1599
  type-safe \hyperlink{command.abbreviation}{\mbox{\isa{\isacommand{abbreviation}}}} or \hyperlink{command.notation}{\mbox{\isa{\isacommand{notation}}}} instead.
f248b5f2783a updated examples for syntax translations;
wenzelm
parents: 46292
diff changeset
  1600
  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:
f248b5f2783a updated examples for syntax translations;
wenzelm
parents: 46292
diff changeset
  1601
f248b5f2783a updated examples for syntax translations;
wenzelm
parents: 46292
diff changeset
  1602
  \begin{itemize}
f248b5f2783a updated examples for syntax translations;
wenzelm
parents: 46292
diff changeset
  1603
f248b5f2783a updated examples for syntax translations;
wenzelm
parents: 46292
diff changeset
  1604
  \item Iterated replacement via recursive \hyperlink{command.translations}{\mbox{\isa{\isacommand{translations}}}}.
f248b5f2783a updated examples for syntax translations;
wenzelm
parents: 46292
diff changeset
  1605
  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
46525
af3df09590f9 updated generated documents
haftmann
parents: 46512
diff changeset
  1606
  defined in theory \isa{List} in Isabelle/HOL.
46293
f248b5f2783a updated examples for syntax translations;
wenzelm
parents: 46292
diff changeset
  1607
f248b5f2783a updated examples for syntax translations;
wenzelm
parents: 46292
diff changeset
  1608
  \item Change of binding status of variables: anything beyond the
f248b5f2783a updated examples for syntax translations;
wenzelm
parents: 46292
diff changeset
  1609
  built-in \hyperlink{keyword.binder}{\mbox{\isa{\isakeyword{binder}}}} mixfix annotation requires explicit
f248b5f2783a updated examples for syntax translations;
wenzelm
parents: 46292
diff changeset
  1610
  syntax translations.  For example, consider list filter
46525
af3df09590f9 updated generated documents
haftmann
parents: 46512
diff changeset
  1611
  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 \isa{List} in Isabelle/HOL.
46293
f248b5f2783a updated examples for syntax translations;
wenzelm
parents: 46292
diff changeset
  1612
f248b5f2783a updated examples for syntax translations;
wenzelm
parents: 46292
diff changeset
  1613
  \end{itemize}%
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1614
\end{isamarkuptext}%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1615
\isamarkuptrue%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1616
%
48117
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1617
\isamarkupsubsubsection{Applying translation rules%
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1618
}
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1619
\isamarkuptrue%
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1620
%
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1621
\begin{isamarkuptext}%
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1622
As a term is being parsed or printed, an AST is generated as
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1623
  an intermediate form according to \figref{fig:parse-print}.  The AST
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1624
  is normalized by applying translation rules in the manner of a
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1625
  first-order term rewriting system.  We first examine how a single
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1626
  rule is applied.
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1627
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1628
  Let \isa{{\isaliteral{22}{\isachardoublequote}}t{\isaliteral{22}{\isachardoublequote}}} be the abstract syntax tree to be normalized and
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1629
  \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}lhs{\isaliteral{2C}{\isacharcomma}}\ rhs{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} some translation rule.  A subtree \isa{{\isaliteral{22}{\isachardoublequote}}u{\isaliteral{22}{\isachardoublequote}}}
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1630
  of \isa{{\isaliteral{22}{\isachardoublequote}}t{\isaliteral{22}{\isachardoublequote}}} is called \emph{redex} if it is an instance of \isa{{\isaliteral{22}{\isachardoublequote}}lhs{\isaliteral{22}{\isachardoublequote}}}; in this case the pattern \isa{{\isaliteral{22}{\isachardoublequote}}lhs{\isaliteral{22}{\isachardoublequote}}} is said to match the
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1631
  object \isa{{\isaliteral{22}{\isachardoublequote}}u{\isaliteral{22}{\isachardoublequote}}}.  A redex matched by \isa{{\isaliteral{22}{\isachardoublequote}}lhs{\isaliteral{22}{\isachardoublequote}}} may be
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1632
  replaced by the corresponding instance of \isa{{\isaliteral{22}{\isachardoublequote}}rhs{\isaliteral{22}{\isachardoublequote}}}, thus
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1633
  \emph{rewriting} the AST \isa{{\isaliteral{22}{\isachardoublequote}}t{\isaliteral{22}{\isachardoublequote}}}.  Matching requires some notion
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1634
  of \emph{place-holders} in rule patterns: \verb|Ast.Variable| serves
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1635
  this purpose.
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1636
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1637
  More precisely, the matching of the object \isa{{\isaliteral{22}{\isachardoublequote}}u{\isaliteral{22}{\isachardoublequote}}} against the
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1638
  pattern \isa{{\isaliteral{22}{\isachardoublequote}}lhs{\isaliteral{22}{\isachardoublequote}}} is performed as follows:
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1639
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1640
  \begin{itemize}
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1641
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1642
  \item Objects of the form \verb|Ast.Variable|~\isa{{\isaliteral{22}{\isachardoublequote}}x{\isaliteral{22}{\isachardoublequote}}} or \verb|Ast.Constant|~\isa{{\isaliteral{22}{\isachardoublequote}}x{\isaliteral{22}{\isachardoublequote}}} are matched by pattern \verb|Ast.Constant|~\isa{{\isaliteral{22}{\isachardoublequote}}x{\isaliteral{22}{\isachardoublequote}}}.  Thus all atomic ASTs in the object are
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1643
  treated as (potential) constants, and a successful match makes them
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1644
  actual constants even before name space resolution (see also
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1645
  \secref{sec:ast}).
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1646
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1647
  \item Object \isa{{\isaliteral{22}{\isachardoublequote}}u{\isaliteral{22}{\isachardoublequote}}} is matched by pattern \verb|Ast.Variable|~\isa{{\isaliteral{22}{\isachardoublequote}}x{\isaliteral{22}{\isachardoublequote}}}, binding \isa{{\isaliteral{22}{\isachardoublequote}}x{\isaliteral{22}{\isachardoublequote}}} to \isa{{\isaliteral{22}{\isachardoublequote}}u{\isaliteral{22}{\isachardoublequote}}}.
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1648
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1649
  \item Object \verb|Ast.Appl|~\isa{{\isaliteral{22}{\isachardoublequote}}us{\isaliteral{22}{\isachardoublequote}}} is matched by \verb|Ast.Appl|~\isa{{\isaliteral{22}{\isachardoublequote}}ts{\isaliteral{22}{\isachardoublequote}}} if \isa{{\isaliteral{22}{\isachardoublequote}}us{\isaliteral{22}{\isachardoublequote}}} and \isa{{\isaliteral{22}{\isachardoublequote}}ts{\isaliteral{22}{\isachardoublequote}}} have the
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1650
  same length and each corresponding subtree matches.
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1651
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1652
  \item In every other case, matching fails.
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1653
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1654
  \end{itemize}
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1655
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1656
  A successful match yields a substitution that is applied to \isa{{\isaliteral{22}{\isachardoublequote}}rhs{\isaliteral{22}{\isachardoublequote}}}, generating the instance that replaces \isa{{\isaliteral{22}{\isachardoublequote}}u{\isaliteral{22}{\isachardoublequote}}}.
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1657
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1658
  Normalizing an AST involves repeatedly applying translation rules
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1659
  until none are applicable.  This works yoyo-like: top-down,
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1660
  bottom-up, top-down, etc.  At each subtree position, rules are
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1661
  chosen in order of appearance in the theory definitions.
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1662
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1663
  The configuration options \hyperlink{attribute.syntax-ast-trace}{\mbox{\isa{syntax{\isaliteral{5F}{\isacharunderscore}}ast{\isaliteral{5F}{\isacharunderscore}}trace}}} and
48816
wenzelm
parents: 48792
diff changeset
  1664
  \hyperlink{attribute.syntax-ast-stats}{\mbox{\isa{syntax{\isaliteral{5F}{\isacharunderscore}}ast{\isaliteral{5F}{\isacharunderscore}}stats}}} might help to understand this process
48117
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1665
  and diagnose problems.
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1666
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1667
  \begin{warn}
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1668
  If syntax translation rules work incorrectly, the output of
48118
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1669
  \indexref{}{command}{print\_syntax}\hyperlink{command.print-syntax}{\mbox{\isa{\isacommand{print{\isaliteral{5F}{\isacharunderscore}}syntax}}}} with its \emph{rules} sections reveals the
48117
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1670
  actual internal forms of AST pattern, without potentially confusing
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1671
  concrete syntax.  Recall that AST constants appear as quoted strings
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1672
  and variables without quotes.
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1673
  \end{warn}
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1674
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1675
  \begin{warn}
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1676
  If \indexref{}{attribute}{eta\_contract}\hyperlink{attribute.eta-contract}{\mbox{\isa{eta{\isaliteral{5F}{\isacharunderscore}}contract}}} is set to \isa{{\isaliteral{22}{\isachardoublequote}}true{\isaliteral{22}{\isachardoublequote}}}, terms
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1677
  will be \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6574613E}{\isasymeta}}{\isaliteral{22}{\isachardoublequote}}}-contracted \emph{before} the AST rewriter sees
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1678
  them.  Thus some abstraction nodes needed for print rules to match
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1679
  may vanish.  For example, \isa{{\isaliteral{22}{\isachardoublequote}}Ball\ A\ {\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C6C616D6264613E}{\isasymlambda}}x{\isaliteral{2E}{\isachardot}}\ P\ x{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} would contract
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1680
  to \isa{{\isaliteral{22}{\isachardoublequote}}Ball\ A\ P{\isaliteral{22}{\isachardoublequote}}} and the standard print rule would fail to
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1681
  apply.  This problem can be avoided by hand-written ML translation
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1682
  functions (see also \secref{sec:tr-funs}), which is in fact the same
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1683
  mechanism used in built-in \hyperlink{keyword.binder}{\mbox{\isa{\isakeyword{binder}}}} declarations.
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1684
  \end{warn}%
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1685
\end{isamarkuptext}%
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1686
\isamarkuptrue%
e21f4d5b9636 more on "Applying translation rules";
wenzelm
parents: 48115
diff changeset
  1687
%
48113
1c4500446ba4 more explicit section "Syntax transformations";
wenzelm
parents: 46525
diff changeset
  1688
\isamarkupsubsection{Syntax translation functions \label{sec:tr-funs}%
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1689
}
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1690
\isamarkuptrue%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1691
%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1692
\begin{isamarkuptext}%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1693
\begin{matharray}{rcl}
40406
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
  1694
    \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}}} \\
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
  1695
    \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}}} \\
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
  1696
    \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}}} \\
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
  1697
    \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}}} \\
313a24b66a8d updated generated files;
wenzelm
parents: 40255
diff changeset
  1698
    \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}}} \\
48119
55c305e29f4b cover @{class_syntax}, @{type_syntax}, @{const_syntax}, @{syntax_const} in isar-ref, in contrast to other ML antiquotations in implementation manual;
wenzelm
parents: 48118
diff changeset
  1699
    \indexdef{}{ML antiquotation}{class\_syntax}\hypertarget{ML antiquotation.class-syntax}{\hyperlink{ML antiquotation.class-syntax}{\mbox{\isa{class{\isaliteral{5F}{\isacharunderscore}}syntax}}}} & : & \isa{ML{\isaliteral{5F}{\isacharunderscore}}antiquotation} \\
55c305e29f4b cover @{class_syntax}, @{type_syntax}, @{const_syntax}, @{syntax_const} in isar-ref, in contrast to other ML antiquotations in implementation manual;
wenzelm
parents: 48118
diff changeset
  1700
    \indexdef{}{ML antiquotation}{type\_syntax}\hypertarget{ML antiquotation.type-syntax}{\hyperlink{ML antiquotation.type-syntax}{\mbox{\isa{type{\isaliteral{5F}{\isacharunderscore}}syntax}}}} & : & \isa{ML{\isaliteral{5F}{\isacharunderscore}}antiquotation} \\
55c305e29f4b cover @{class_syntax}, @{type_syntax}, @{const_syntax}, @{syntax_const} in isar-ref, in contrast to other ML antiquotations in implementation manual;
wenzelm
parents: 48118
diff changeset
  1701
    \indexdef{}{ML antiquotation}{const\_syntax}\hypertarget{ML antiquotation.const-syntax}{\hyperlink{ML antiquotation.const-syntax}{\mbox{\isa{const{\isaliteral{5F}{\isacharunderscore}}syntax}}}} & : & \isa{ML{\isaliteral{5F}{\isacharunderscore}}antiquotation} \\
55c305e29f4b cover @{class_syntax}, @{type_syntax}, @{const_syntax}, @{syntax_const} in isar-ref, in contrast to other ML antiquotations in implementation manual;
wenzelm
parents: 48118
diff changeset
  1702
    \indexdef{}{ML antiquotation}{syntax\_const}\hypertarget{ML antiquotation.syntax-const}{\hyperlink{ML antiquotation.syntax-const}{\mbox{\isa{syntax{\isaliteral{5F}{\isacharunderscore}}const}}}} & : & \isa{ML{\isaliteral{5F}{\isacharunderscore}}antiquotation} \\
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1703
  \end{matharray}
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1704
48118
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1705
  Syntax translation functions written in ML admit almost arbitrary
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1706
  manipulations of inner syntax, at the expense of some complexity and
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1707
  obscurity in the implementation.
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1708
42596
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1709
  \begin{railoutput}
42662
2080fe35abea updated generated files;
wenzelm
parents: 42655
diff changeset
  1710
\rail@begin{5}{}
42596
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1711
\rail@bar
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1712
\rail@term{\hyperlink{command.parse-ast-translation}{\mbox{\isa{\isacommand{parse{\isaliteral{5F}{\isacharunderscore}}ast{\isaliteral{5F}{\isacharunderscore}}translation}}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1713
\rail@nextbar{1}
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1714
\rail@term{\hyperlink{command.parse-translation}{\mbox{\isa{\isacommand{parse{\isaliteral{5F}{\isacharunderscore}}translation}}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1715
\rail@nextbar{2}
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1716
\rail@term{\hyperlink{command.print-translation}{\mbox{\isa{\isacommand{print{\isaliteral{5F}{\isacharunderscore}}translation}}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1717
\rail@nextbar{3}
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1718
\rail@term{\hyperlink{command.typed-print-translation}{\mbox{\isa{\isacommand{typed{\isaliteral{5F}{\isacharunderscore}}print{\isaliteral{5F}{\isacharunderscore}}translation}}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1719
\rail@nextbar{4}
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1720
\rail@term{\hyperlink{command.print-ast-translation}{\mbox{\isa{\isacommand{print{\isaliteral{5F}{\isacharunderscore}}ast{\isaliteral{5F}{\isacharunderscore}}translation}}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1721
\rail@endbar
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1722
\rail@bar
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1723
\rail@nextbar{1}
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1724
\rail@term{\isa{{\isaliteral{28}{\isacharparenleft}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1725
\rail@term{\isa{\isakeyword{advanced}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1726
\rail@term{\isa{{\isaliteral{29}{\isacharparenright}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1727
\rail@endbar
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1728
\rail@nont{\hyperlink{syntax.text}{\mbox{\isa{text}}}}[]
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1729
\rail@end
48119
55c305e29f4b cover @{class_syntax}, @{type_syntax}, @{const_syntax}, @{syntax_const} in isar-ref, in contrast to other ML antiquotations in implementation manual;
wenzelm
parents: 48118
diff changeset
  1730
\rail@begin{4}{}
55c305e29f4b cover @{class_syntax}, @{type_syntax}, @{const_syntax}, @{syntax_const} in isar-ref, in contrast to other ML antiquotations in implementation manual;
wenzelm
parents: 48118
diff changeset
  1731
\rail@bar
55c305e29f4b cover @{class_syntax}, @{type_syntax}, @{const_syntax}, @{syntax_const} in isar-ref, in contrast to other ML antiquotations in implementation manual;
wenzelm
parents: 48118
diff changeset
  1732
\rail@term{\hyperlink{ML antiquotation.class-syntax}{\mbox{\isa{class{\isaliteral{5F}{\isacharunderscore}}syntax}}}}[]
55c305e29f4b cover @{class_syntax}, @{type_syntax}, @{const_syntax}, @{syntax_const} in isar-ref, in contrast to other ML antiquotations in implementation manual;
wenzelm
parents: 48118
diff changeset
  1733
\rail@nextbar{1}
55c305e29f4b cover @{class_syntax}, @{type_syntax}, @{const_syntax}, @{syntax_const} in isar-ref, in contrast to other ML antiquotations in implementation manual;
wenzelm
parents: 48118
diff changeset
  1734
\rail@term{\hyperlink{ML antiquotation.type-syntax}{\mbox{\isa{type{\isaliteral{5F}{\isacharunderscore}}syntax}}}}[]
55c305e29f4b cover @{class_syntax}, @{type_syntax}, @{const_syntax}, @{syntax_const} in isar-ref, in contrast to other ML antiquotations in implementation manual;
wenzelm
parents: 48118
diff changeset
  1735
\rail@nextbar{2}
55c305e29f4b cover @{class_syntax}, @{type_syntax}, @{const_syntax}, @{syntax_const} in isar-ref, in contrast to other ML antiquotations in implementation manual;
wenzelm
parents: 48118
diff changeset
  1736
\rail@term{\hyperlink{ML antiquotation.const-syntax}{\mbox{\isa{const{\isaliteral{5F}{\isacharunderscore}}syntax}}}}[]
55c305e29f4b cover @{class_syntax}, @{type_syntax}, @{const_syntax}, @{syntax_const} in isar-ref, in contrast to other ML antiquotations in implementation manual;
wenzelm
parents: 48118
diff changeset
  1737
\rail@nextbar{3}
55c305e29f4b cover @{class_syntax}, @{type_syntax}, @{const_syntax}, @{syntax_const} in isar-ref, in contrast to other ML antiquotations in implementation manual;
wenzelm
parents: 48118
diff changeset
  1738
\rail@term{\hyperlink{ML antiquotation.syntax-const}{\mbox{\isa{syntax{\isaliteral{5F}{\isacharunderscore}}const}}}}[]
55c305e29f4b cover @{class_syntax}, @{type_syntax}, @{const_syntax}, @{syntax_const} in isar-ref, in contrast to other ML antiquotations in implementation manual;
wenzelm
parents: 48118
diff changeset
  1739
\rail@endbar
55c305e29f4b cover @{class_syntax}, @{type_syntax}, @{const_syntax}, @{syntax_const} in isar-ref, in contrast to other ML antiquotations in implementation manual;
wenzelm
parents: 48118
diff changeset
  1740
\rail@nont{\isa{name}}[]
55c305e29f4b cover @{class_syntax}, @{type_syntax}, @{const_syntax}, @{syntax_const} in isar-ref, in contrast to other ML antiquotations in implementation manual;
wenzelm
parents: 48118
diff changeset
  1741
\rail@end
42596
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1742
\end{railoutput}
6c621a9d612a modernized rail diagrams using @{rail} antiquotation;
wenzelm
parents: 42358
diff changeset
  1743
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1744
48119
55c305e29f4b cover @{class_syntax}, @{type_syntax}, @{const_syntax}, @{syntax_const} in isar-ref, in contrast to other ML antiquotations in implementation manual;
wenzelm
parents: 48118
diff changeset
  1745
  \begin{description}
55c305e29f4b cover @{class_syntax}, @{type_syntax}, @{const_syntax}, @{syntax_const} in isar-ref, in contrast to other ML antiquotations in implementation manual;
wenzelm
parents: 48118
diff changeset
  1746
55c305e29f4b cover @{class_syntax}, @{type_syntax}, @{const_syntax}, @{syntax_const} in isar-ref, in contrast to other ML antiquotations in implementation manual;
wenzelm
parents: 48118
diff changeset
  1747
  \item \hyperlink{command.parse-translation}{\mbox{\isa{\isacommand{parse{\isaliteral{5F}{\isacharunderscore}}translation}}}} etc. declare syntax translation
55c305e29f4b cover @{class_syntax}, @{type_syntax}, @{const_syntax}, @{syntax_const} in isar-ref, in contrast to other ML antiquotations in implementation manual;
wenzelm
parents: 48118
diff changeset
  1748
  functions to the theory.  Any of these commands have a single
55c305e29f4b cover @{class_syntax}, @{type_syntax}, @{const_syntax}, @{syntax_const} in isar-ref, in contrast to other ML antiquotations in implementation manual;
wenzelm
parents: 48118
diff changeset
  1749
  \hyperlink{syntax.text}{\mbox{\isa{text}}} argument that refers to an ML expression of
55c305e29f4b cover @{class_syntax}, @{type_syntax}, @{const_syntax}, @{syntax_const} in isar-ref, in contrast to other ML antiquotations in implementation manual;
wenzelm
parents: 48118
diff changeset
  1750
  appropriate type, which are as follows by default:
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1751
48118
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1752
  \medskip
48119
55c305e29f4b cover @{class_syntax}, @{type_syntax}, @{const_syntax}, @{syntax_const} in isar-ref, in contrast to other ML antiquotations in implementation manual;
wenzelm
parents: 48118
diff changeset
  1753
  {\footnotesize
48118
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1754
  \begin{tabular}{ll}
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1755
  \hyperlink{command.parse-ast-translation}{\mbox{\isa{\isacommand{parse{\isaliteral{5F}{\isacharunderscore}}ast{\isaliteral{5F}{\isacharunderscore}}translation}}}} & : \verb|(string * (Ast.ast list -> Ast.ast)) list| \\
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1756
  \hyperlink{command.parse-translation}{\mbox{\isa{\isacommand{parse{\isaliteral{5F}{\isacharunderscore}}translation}}}} & : \verb|(string * (term list -> term)) list| \\
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1757
  \hyperlink{command.print-translation}{\mbox{\isa{\isacommand{print{\isaliteral{5F}{\isacharunderscore}}translation}}}} & : \verb|(string * (term list -> term)) list| \\
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1758
  \hyperlink{command.typed-print-translation}{\mbox{\isa{\isacommand{typed{\isaliteral{5F}{\isacharunderscore}}print{\isaliteral{5F}{\isacharunderscore}}translation}}}} & : \verb|(string * (typ -> term list -> term)) list| \\
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1759
  \hyperlink{command.print-ast-translation}{\mbox{\isa{\isacommand{print{\isaliteral{5F}{\isacharunderscore}}ast{\isaliteral{5F}{\isacharunderscore}}translation}}}} & : \verb|(string * (Ast.ast list -> Ast.ast)) list| \\
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1760
  \end{tabular}}
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1761
  \medskip
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1762
48816
wenzelm
parents: 48792
diff changeset
  1763
  The argument list consists of \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}c{\isaliteral{2C}{\isacharcomma}}\ tr{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} pairs, where \isa{{\isaliteral{22}{\isachardoublequote}}c{\isaliteral{22}{\isachardoublequote}}} is the syntax name of the formal entity involved, and \isa{{\isaliteral{22}{\isachardoublequote}}tr{\isaliteral{22}{\isachardoublequote}}} a function that translates a syntax form \isa{{\isaliteral{22}{\isachardoublequote}}c\ args{\isaliteral{22}{\isachardoublequote}}} into
wenzelm
parents: 48792
diff changeset
  1764
  \isa{{\isaliteral{22}{\isachardoublequote}}tr\ args{\isaliteral{22}{\isachardoublequote}}}.  The ML naming convention for parse translations
wenzelm
parents: 48792
diff changeset
  1765
  is \isa{{\isaliteral{22}{\isachardoublequote}}c{\isaliteral{5F}{\isacharunderscore}}tr{\isaliteral{22}{\isachardoublequote}}} and for print translations \isa{{\isaliteral{22}{\isachardoublequote}}c{\isaliteral{5F}{\isacharunderscore}}tr{\isaliteral{27}{\isacharprime}}{\isaliteral{22}{\isachardoublequote}}}.
48118
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1766
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1767
  The \indexref{}{command}{print\_syntax}\hyperlink{command.print-syntax}{\mbox{\isa{\isacommand{print{\isaliteral{5F}{\isacharunderscore}}syntax}}}} command displays the sets of names
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1768
  associated with the translation functions of a theory under \isa{{\isaliteral{22}{\isachardoublequote}}parse{\isaliteral{5F}{\isacharunderscore}}ast{\isaliteral{5F}{\isacharunderscore}}translation{\isaliteral{22}{\isachardoublequote}}} etc.
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1769
48118
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1770
  If the \verb|(|\hyperlink{keyword.advanced}{\mbox{\isa{\isakeyword{advanced}}}}\verb|)| option is
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1771
  given, the corresponding translation functions depend on the current
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1772
  theory or proof context as additional argument.  This allows to
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1773
  implement advanced syntax mechanisms, as translations functions may
48119
55c305e29f4b cover @{class_syntax}, @{type_syntax}, @{const_syntax}, @{syntax_const} in isar-ref, in contrast to other ML antiquotations in implementation manual;
wenzelm
parents: 48118
diff changeset
  1774
  refer to specific theory declarations or auxiliary proof data.
55c305e29f4b cover @{class_syntax}, @{type_syntax}, @{const_syntax}, @{syntax_const} in isar-ref, in contrast to other ML antiquotations in implementation manual;
wenzelm
parents: 48118
diff changeset
  1775
55c305e29f4b cover @{class_syntax}, @{type_syntax}, @{const_syntax}, @{syntax_const} in isar-ref, in contrast to other ML antiquotations in implementation manual;
wenzelm
parents: 48118
diff changeset
  1776
  \item \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{40}{\isacharat}}{\isaliteral{7B}{\isacharbraceleft}}class{\isaliteral{5F}{\isacharunderscore}}syntax\ c{\isaliteral{7D}{\isacharbraceright}}{\isaliteral{22}{\isachardoublequote}}}, \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{40}{\isacharat}}{\isaliteral{7B}{\isacharbraceleft}}type{\isaliteral{5F}{\isacharunderscore}}syntax\ c{\isaliteral{7D}{\isacharbraceright}}{\isaliteral{22}{\isachardoublequote}}},
55c305e29f4b cover @{class_syntax}, @{type_syntax}, @{const_syntax}, @{syntax_const} in isar-ref, in contrast to other ML antiquotations in implementation manual;
wenzelm
parents: 48118
diff changeset
  1777
  \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{40}{\isacharat}}{\isaliteral{7B}{\isacharbraceleft}}const{\isaliteral{5F}{\isacharunderscore}}syntax\ c{\isaliteral{7D}{\isacharbraceright}}{\isaliteral{22}{\isachardoublequote}}} inline the authentic syntax name of the
55c305e29f4b cover @{class_syntax}, @{type_syntax}, @{const_syntax}, @{syntax_const} in isar-ref, in contrast to other ML antiquotations in implementation manual;
wenzelm
parents: 48118
diff changeset
  1778
  given formal entities into the ML source.  This is the
55c305e29f4b cover @{class_syntax}, @{type_syntax}, @{const_syntax}, @{syntax_const} in isar-ref, in contrast to other ML antiquotations in implementation manual;
wenzelm
parents: 48118
diff changeset
  1779
  fully-qualified logical name prefixed by a special marker to
55c305e29f4b cover @{class_syntax}, @{type_syntax}, @{const_syntax}, @{syntax_const} in isar-ref, in contrast to other ML antiquotations in implementation manual;
wenzelm
parents: 48118
diff changeset
  1780
  indicate its kind: thus different logical name spaces are properly
55c305e29f4b cover @{class_syntax}, @{type_syntax}, @{const_syntax}, @{syntax_const} in isar-ref, in contrast to other ML antiquotations in implementation manual;
wenzelm
parents: 48118
diff changeset
  1781
  distinguished within parse trees.
55c305e29f4b cover @{class_syntax}, @{type_syntax}, @{const_syntax}, @{syntax_const} in isar-ref, in contrast to other ML antiquotations in implementation manual;
wenzelm
parents: 48118
diff changeset
  1782
55c305e29f4b cover @{class_syntax}, @{type_syntax}, @{const_syntax}, @{syntax_const} in isar-ref, in contrast to other ML antiquotations in implementation manual;
wenzelm
parents: 48118
diff changeset
  1783
  \item \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{40}{\isacharat}}{\isaliteral{7B}{\isacharbraceleft}}const{\isaliteral{5F}{\isacharunderscore}}syntax\ c{\isaliteral{7D}{\isacharbraceright}}{\isaliteral{22}{\isachardoublequote}}} inlines the name \isa{{\isaliteral{22}{\isachardoublequote}}c{\isaliteral{22}{\isachardoublequote}}} of
55c305e29f4b cover @{class_syntax}, @{type_syntax}, @{const_syntax}, @{syntax_const} in isar-ref, in contrast to other ML antiquotations in implementation manual;
wenzelm
parents: 48118
diff changeset
  1784
  the given syntax constant, having checked that it has been declared
55c305e29f4b cover @{class_syntax}, @{type_syntax}, @{const_syntax}, @{syntax_const} in isar-ref, in contrast to other ML antiquotations in implementation manual;
wenzelm
parents: 48118
diff changeset
  1785
  via some \hyperlink{command.syntax}{\mbox{\isa{\isacommand{syntax}}}} commands within the theory context.  Note
55c305e29f4b cover @{class_syntax}, @{type_syntax}, @{const_syntax}, @{syntax_const} in isar-ref, in contrast to other ML antiquotations in implementation manual;
wenzelm
parents: 48118
diff changeset
  1786
  that the usual naming convention makes syntax constants start with
55c305e29f4b cover @{class_syntax}, @{type_syntax}, @{const_syntax}, @{syntax_const} in isar-ref, in contrast to other ML antiquotations in implementation manual;
wenzelm
parents: 48118
diff changeset
  1787
  underscore, to reduce the chance of accidental clashes with other
55c305e29f4b cover @{class_syntax}, @{type_syntax}, @{const_syntax}, @{syntax_const} in isar-ref, in contrast to other ML antiquotations in implementation manual;
wenzelm
parents: 48118
diff changeset
  1788
  names occurring in parse trees (unqualified constants etc.).
55c305e29f4b cover @{class_syntax}, @{type_syntax}, @{const_syntax}, @{syntax_const} in isar-ref, in contrast to other ML antiquotations in implementation manual;
wenzelm
parents: 48118
diff changeset
  1789
55c305e29f4b cover @{class_syntax}, @{type_syntax}, @{const_syntax}, @{syntax_const} in isar-ref, in contrast to other ML antiquotations in implementation manual;
wenzelm
parents: 48118
diff changeset
  1790
  \end{description}%
48118
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1791
\end{isamarkuptext}%
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1792
\isamarkuptrue%
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1793
%
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1794
\isamarkupsubsubsection{The translation strategy%
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1795
}
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1796
\isamarkuptrue%
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1797
%
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1798
\begin{isamarkuptext}%
48816
wenzelm
parents: 48792
diff changeset
  1799
The different kinds of translation functions are invoked during
48118
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1800
  the transformations between parse trees, ASTs and syntactic terms
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1801
  (cf.\ \figref{fig:parse-print}).  Whenever a combination of the form
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1802
  \isa{{\isaliteral{22}{\isachardoublequote}}c\ x\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}\ x\isaliteral{5C3C5E7375623E}{}\isactrlsub n{\isaliteral{22}{\isachardoublequote}}} is encountered, and a translation function
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1803
  \isa{{\isaliteral{22}{\isachardoublequote}}f{\isaliteral{22}{\isachardoublequote}}} of appropriate kind is declared for \isa{{\isaliteral{22}{\isachardoublequote}}c{\isaliteral{22}{\isachardoublequote}}}, the
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1804
  result is produced by evaluation of \isa{{\isaliteral{22}{\isachardoublequote}}f\ {\isaliteral{5B}{\isacharbrackleft}}x\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{2C}{\isacharcomma}}\ x\isaliteral{5C3C5E7375623E}{}\isactrlsub n{\isaliteral{5D}{\isacharbrackright}}{\isaliteral{22}{\isachardoublequote}}} in ML.
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1805
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1806
  For AST translations, the arguments \isa{{\isaliteral{22}{\isachardoublequote}}x\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{2C}{\isacharcomma}}\ x\isaliteral{5C3C5E7375623E}{}\isactrlsub n{\isaliteral{22}{\isachardoublequote}}} are ASTs.  A
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1807
  combination has the form \verb|Ast.Constant|~\isa{{\isaliteral{22}{\isachardoublequote}}c{\isaliteral{22}{\isachardoublequote}}} or \verb|Ast.Appl|~\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{22}{\isachardoublequote}}}\verb|Ast.Constant|~\isa{{\isaliteral{22}{\isachardoublequote}}c{\isaliteral{2C}{\isacharcomma}}\ x\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}{\isaliteral{2C}{\isacharcomma}}\ x\isaliteral{5C3C5E7375623E}{}\isactrlsub n{\isaliteral{5D}{\isacharbrackright}}{\isaliteral{22}{\isachardoublequote}}}.
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1808
  For term translations, the arguments are terms and a combination has
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1809
  the form \verb|Const|~\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}c{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{5C3C7461753E}{\isasymtau}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} or \verb|Const|~\isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{28}{\isacharparenleft}}c{\isaliteral{2C}{\isacharcomma}}\ {\isaliteral{5C3C7461753E}{\isasymtau}}{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{24}{\isachardollar}}\ x\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}\ {\isaliteral{24}{\isachardollar}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}\ {\isaliteral{24}{\isachardollar}}\ x\isaliteral{5C3C5E7375623E}{}\isactrlsub n{\isaliteral{22}{\isachardoublequote}}}.  Terms allow more sophisticated transformations
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1810
  than ASTs do, typically involving abstractions and bound
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1811
  variables. \emph{Typed} print translations may even peek at the type
48816
wenzelm
parents: 48792
diff changeset
  1812
  \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C7461753E}{\isasymtau}}{\isaliteral{22}{\isachardoublequote}}} of the constant they are invoked on, although that information
wenzelm
parents: 48792
diff changeset
  1813
  may be inaccurate.
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1814
48118
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1815
  Regardless of whether they act on ASTs or terms, translation
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1816
  functions called during the parsing process differ from those for
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1817
  printing in their overall behaviour:
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1818
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1819
  \begin{description}
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1820
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1821
  \item [Parse translations] are applied bottom-up.  The arguments are
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1822
  already in translated form.  The translations must not fail;
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1823
  exceptions trigger an error message.  There may be at most one
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1824
  function associated with any syntactic name.
46294
wenzelm
parents: 46293
diff changeset
  1825
48118
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1826
  \item [Print translations] are applied top-down.  They are supplied
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1827
  with arguments that are partly still in internal form.  The result
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1828
  again undergoes translation; therefore a print translation should
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1829
  not introduce as head the very constant that invoked it.  The
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1830
  function may raise exception \verb|Match| to indicate failure; in
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1831
  this event it has no effect.  Multiple functions associated with
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1832
  some syntactic name are tried in the order of declaration in the
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1833
  theory.
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1834
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1835
  \end{description}
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1836
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1837
  Only constant atoms --- constructor \verb|Ast.Constant| for ASTs and
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1838
  \verb|Const| for terms --- can invoke translation functions.  This
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1839
  means that parse translations can only be associated with parse tree
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1840
  heads of concrete syntax, or syntactic constants introduced via
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1841
  other translations.  For plain identifiers within the term language,
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1842
  the status of constant versus variable is not yet know during
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1843
  parsing.  This is in contrast to print translations, where constants
8537313dd261 more on "Syntax translation functions";
wenzelm
parents: 48117
diff changeset
  1844
  are explicitly known from the given term in its fully internal form.%
28762
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1845
\end{isamarkuptext}%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1846
\isamarkuptrue%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1847
%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1848
\isadelimtheory
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1849
%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1850
\endisadelimtheory
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1851
%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1852
\isatagtheory
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1853
\isacommand{end}\isamarkupfalse%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1854
%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1855
\endisatagtheory
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1856
{\isafoldtheory}%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1857
%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1858
\isadelimtheory
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1859
%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1860
\endisadelimtheory
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1861
\isanewline
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1862
\end{isabellebody}%
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1863
%%% Local Variables:
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1864
%%% mode: latex
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1865
%%% TeX-master: "root"
f5d79aeffd81 separate chapter "Inner syntax --- the term language";
wenzelm
parents:
diff changeset
  1866
%%% End: