doc-src/IsarRef/Thy/document/syntax.tex
author wenzelm
Thu, 08 May 2008 22:20:33 +0200
changeset 26854 9b4aec46ad78
parent 26842 81308d44fe0a
child 26902 8db1e960d636
permissions -rw-r--r--
improved treatment of "_" thanks to underscore.sty;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
     1
%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
     2
\begin{isabellebody}%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
     3
\def\isabellecontext{syntax}%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
     4
%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
     5
\isadelimtheory
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
     6
\isanewline
26767
cc127cc0951b converted pure.tex to Thy/pure.thy;
wenzelm
parents: 26760
diff changeset
     7
\isanewline
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
     8
%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
     9
\endisadelimtheory
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    10
%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    11
\isatagtheory
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    12
\isacommand{theory}\isamarkupfalse%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    13
\ {\isachardoublequoteopen}syntax{\isachardoublequoteclose}\isanewline
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    14
\isakeyword{imports}\ CPure\isanewline
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    15
\isakeyword{begin}%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    16
\endisatagtheory
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    17
{\isafoldtheory}%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    18
%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    19
\isadelimtheory
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    20
%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    21
\endisadelimtheory
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    22
%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    23
\isamarkupchapter{Syntax primitives%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    24
}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    25
\isamarkuptrue%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    26
%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    27
\begin{isamarkuptext}%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    28
The rather generic framework of Isabelle/Isar syntax emerges from
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    29
  three main syntactic categories: \emph{commands} of the top-level
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    30
  Isar engine (covering theory and proof elements), \emph{methods} for
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    31
  general goal refinements (analogous to traditional ``tactics''), and
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    32
  \emph{attributes} for operations on facts (within a certain
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    33
  context).  Subsequently we give a reference of basic syntactic
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    34
  entities underlying Isabelle/Isar syntax in a bottom-up manner.
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    35
  Concrete theory and proof language elements will be introduced later
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    36
  on.
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    37
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    38
  \medskip In order to get started with writing well-formed
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    39
  Isabelle/Isar documents, the most important aspect to be noted is
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    40
  the difference of \emph{inner} versus \emph{outer} syntax.  Inner
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    41
  syntax is that of Isabelle types and terms of the logic, while outer
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    42
  syntax is that of Isabelle/Isar theory sources (specifications and
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    43
  proofs).  As a general rule, inner syntax entities may occur only as
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    44
  \emph{atomic entities} within outer syntax.  For example, the string
26760
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
    45
  \verb|"x + y"| and identifier \verb|z| are legal term
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
    46
  specifications within a theory, while \verb|x + y| without
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
    47
  quotes is not.
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    48
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    49
  Printed theory documents usually omit quotes to gain readability
26760
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
    50
  (this is a matter of {\LaTeX} macro setup, say via \verb|\isabellestyle|, see also \cite{isabelle-sys}).  Experienced
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    51
  users of Isabelle/Isar may easily reconstruct the lost technical
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    52
  information, while mere readers need not care about quotes at all.
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    53
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    54
  \medskip Isabelle/Isar input may contain any number of input
26760
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
    55
  termination characters ``\verb|;|'' (semicolon) to separate
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    56
  commands explicitly.  This is particularly useful in interactive
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    57
  shell sessions to make clear where the current command is intended
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    58
  to end.  Otherwise, the interpreter loop will continue to issue a
26760
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
    59
  secondary prompt ``\verb|#|'' until an end-of-command is
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
    60
  clearly recognized from the input syntax, e.g.\ encounter of the
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
    61
  next command keyword.
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    62
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    63
  More advanced interfaces such as Proof~General \cite{proofgeneral}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    64
  do not require explicit semicolons, the amount of input text is
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    65
  determined automatically by inspecting the present content of the
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    66
  Emacs text buffer.  In the printed presentation of Isabelle/Isar
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    67
  documents semicolons are omitted altogether for readability.
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    68
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    69
  \begin{warn}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    70
    Proof~General requires certain syntax classification tables in
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    71
    order to achieve properly synchronized interaction with the
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    72
    Isabelle/Isar process.  These tables need to be consistent with
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    73
    the Isabelle version and particular logic image to be used in a
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    74
    running session (common object-logics may well change the outer
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    75
    syntax).  The standard setup should work correctly with any of the
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    76
    ``official'' logic images derived from Isabelle/HOL (including
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    77
    HOLCF etc.).  Users of alternative logics may need to tell
26760
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
    78
    Proof~General explicitly, e.g.\ by giving an option \verb|-k ZF|
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
    79
    (in conjunction with \verb|-l ZF|, to specify the default
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
    80
    logic image).  Note that option \verb|-L| does both
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
    81
    of this at the same time.
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    82
  \end{warn}%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    83
\end{isamarkuptext}%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    84
\isamarkuptrue%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    85
%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    86
\isamarkupsection{Lexical matters \label{sec:lex-syntax}%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    87
}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    88
\isamarkuptrue%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    89
%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    90
\begin{isamarkuptext}%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    91
The Isabelle/Isar outer syntax provides token classes as presented
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    92
  below; most of these coincide with the inner lexical syntax as
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    93
  presented in \cite{isabelle-ref}.
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    94
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
    95
  \begin{matharray}{rcl}
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
    96
    \indexdef{}{syntax}{ident}\mbox{\isa{ident}} & = & letter\,quasiletter^* \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
    97
    \indexdef{}{syntax}{longident}\mbox{\isa{longident}} & = & ident (\verb,.,ident)^+ \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
    98
    \indexdef{}{syntax}{symident}\mbox{\isa{symident}} & = & sym^+ ~|~ \verb,\,\verb,<,ident\verb,>, \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
    99
    \indexdef{}{syntax}{nat}\mbox{\isa{nat}} & = & digit^+ \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   100
    \indexdef{}{syntax}{var}\mbox{\isa{var}} & = & ident ~|~ \verb,?,ident ~|~ \verb,?,ident\verb,.,nat \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   101
    \indexdef{}{syntax}{typefree}\mbox{\isa{typefree}} & = & \verb,',ident \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   102
    \indexdef{}{syntax}{typevar}\mbox{\isa{typevar}} & = & typefree ~|~ \verb,?,typefree ~|~ \verb,?,typefree\verb,.,nat \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   103
    \indexdef{}{syntax}{string}\mbox{\isa{string}} & = & \verb,", ~\dots~ \verb,", \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   104
    \indexdef{}{syntax}{altstring}\mbox{\isa{altstring}} & = & \backquote ~\dots~ \backquote \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   105
    \indexdef{}{syntax}{verbatim}\mbox{\isa{verbatim}} & = & \verb,{*, ~\dots~ \verb,*,\verb,}, \\[1ex]
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   106
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   107
    letter & = & latin ~|~ \verb,\,\verb,<,latin\verb,>, ~|~ \verb,\,\verb,<,latin\,latin\verb,>, ~|~ greek ~|~ \\
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   108
           &   & \verb,\<^isub>, ~|~ \verb,\<^isup>, \\
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   109
    quasiletter & = & letter ~|~ digit ~|~ \verb,_, ~|~ \verb,', \\
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   110
    latin & = & \verb,a, ~|~ \dots ~|~ \verb,z, ~|~ \verb,A, ~|~ \dots ~|~ \verb,Z, \\
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   111
    digit & = & \verb,0, ~|~ \dots ~|~ \verb,9, \\
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   112
    sym & = & \verb,!, ~|~ \verb,#, ~|~ \verb,$, ~|~ \verb,%, ~|~ \verb,&, ~|~
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   113
     \verb,*, ~|~ \verb,+, ~|~ \verb,-, ~|~ \verb,/, ~|~ \\
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   114
    & & \verb,<, ~|~ \verb,=, ~|~ \verb,>, ~|~ \verb,?, ~|~ \texttt{\at} ~|~
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   115
    \verb,^, ~|~ \verb,_, ~|~ \verb,|, ~|~ \verb,~, \\
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   116
    greek & = & \verb,\<alpha>, ~|~ \verb,\<beta>, ~|~ \verb,\<gamma>, ~|~ \verb,\<delta>, ~| \\
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   117
          &   & \verb,\<epsilon>, ~|~ \verb,\<zeta>, ~|~ \verb,\<eta>, ~|~ \verb,\<theta>, ~| \\
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   118
          &   & \verb,\<iota>, ~|~ \verb,\<kappa>, ~|~ \verb,\<mu>, ~|~ \verb,\<nu>, ~| \\
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   119
          &   & \verb,\<xi>, ~|~ \verb,\<pi>, ~|~ \verb,\<rho>, ~|~ \verb,\<sigma>, ~|~ \verb,\<tau>, ~| \\
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   120
          &   & \verb,\<upsilon>, ~|~ \verb,\<phi>, ~|~ \verb,\<chi>, ~|~ \verb,\<psi>, ~| \\
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   121
          &   & \verb,\<omega>, ~|~ \verb,\<Gamma>, ~|~ \verb,\<Delta>, ~|~ \verb,\<Theta>, ~| \\
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   122
          &   & \verb,\<Lambda>, ~|~ \verb,\<Xi>, ~|~ \verb,\<Pi>, ~|~ \verb,\<Sigma>, ~| \\
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   123
          &   & \verb,\<Upsilon>, ~|~ \verb,\<Phi>, ~|~ \verb,\<Psi>, ~|~ \verb,\<Omega>, \\
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   124
  \end{matharray}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   125
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   126
  The syntax of \mbox{\isa{string}} admits any characters, including
26760
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   127
  newlines; ``\verb|"|'' (double-quote) and ``\verb|\|'' (backslash) need to be escaped by a backslash; arbitrary
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   128
  character codes may be specified as ``\verb|\|\isa{ddd}'',
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   129
  with three decimal digits.  Alternative strings according to
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   130
  \mbox{\isa{altstring}} are analogous, using single back-quotes instead.
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   131
  The body of \mbox{\isa{verbatim}} may consist of any text not
26760
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   132
  containing ``\verb|*|\verb|}|''; this allows
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   133
  convenient inclusion of quotes without further escapes.  The greek
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   134
  letters do \emph{not} include \verb|\<lambda>|, which is already used
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   135
  differently in the meta-logic.
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   136
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   137
  Common mathematical symbols such as \isa{{\isasymforall}} are represented in
26760
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   138
  Isabelle as \verb|\<forall>|.  There are infinitely many Isabelle
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   139
  symbols like this, although proper presentation is left to front-end
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   140
  tools such as {\LaTeX} or Proof~General with the X-Symbol package.
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   141
  A list of standard Isabelle symbols that work well with these tools
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   142
  is given in \cite[appendix~A]{isabelle-sys}.
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   143
  
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   144
  Source comments take the form \verb|(*|~\isa{{\isachardoublequote}{\isasymdots}{\isachardoublequote}}~\verb|*)| and may be nested, although user-interface
26760
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   145
  tools might prevent this.  Note that this form indicates source
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   146
  comments only, which are stripped after lexical analysis of the
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   147
  input.  The Isar document syntax also provides formal comments that
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   148
  are considered as part of the text (see \secref{sec:comments}).%
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   149
\end{isamarkuptext}%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   150
\isamarkuptrue%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   151
%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   152
\isamarkupsection{Common syntax entities%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   153
}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   154
\isamarkuptrue%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   155
%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   156
\begin{isamarkuptext}%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   157
We now introduce several basic syntactic entities, such as names,
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   158
  terms, and theorem specifications, which are factored out of the
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   159
  actual Isar language elements to be described later.%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   160
\end{isamarkuptext}%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   161
\isamarkuptrue%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   162
%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   163
\isamarkupsubsection{Names%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   164
}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   165
\isamarkuptrue%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   166
%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   167
\begin{isamarkuptext}%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   168
Entity \railqtok{name} usually refers to any name of types,
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   169
  constants, theorems etc.\ that are to be \emph{declared} or
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   170
  \emph{defined} (so qualified identifiers are excluded here).  Quoted
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   171
  strings provide an escape for non-identifier names or those ruled
26760
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   172
  out by outer syntax keywords (e.g.\ quoted \verb|"let"|).
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   173
  Already existing objects are usually referenced by
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   174
  \railqtok{nameref}.
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   175
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   176
  \indexoutertoken{name}\indexoutertoken{parname}\indexoutertoken{nameref}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   177
  \indexoutertoken{int}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   178
  \begin{rail}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   179
    name: ident | symident | string | nat
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   180
    ;
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   181
    parname: '(' name ')'
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   182
    ;
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   183
    nameref: name | longident
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   184
    ;
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   185
    int: nat | '-' nat
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   186
    ;
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   187
  \end{rail}%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   188
\end{isamarkuptext}%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   189
\isamarkuptrue%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   190
%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   191
\isamarkupsubsection{Comments \label{sec:comments}%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   192
}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   193
\isamarkuptrue%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   194
%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   195
\begin{isamarkuptext}%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   196
Large chunks of plain \railqtok{text} are usually given
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   197
  \railtok{verbatim}, i.e.\ enclosed in \verb|{|\verb|*|~\isa{{\isachardoublequote}{\isasymdots}{\isachardoublequote}}~\verb|*|\verb|}|.  For convenience,
26760
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   198
  any of the smaller text units conforming to \railqtok{nameref} are
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   199
  admitted as well.  A marginal \railnonterm{comment} is of the form
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   200
  \verb|--| \railqtok{text}.  Any number of these may occur
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   201
  within Isabelle/Isar commands.
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   202
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   203
  \indexoutertoken{text}\indexouternonterm{comment}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   204
  \begin{rail}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   205
    text: verbatim | nameref
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   206
    ;
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   207
    comment: '--' text
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   208
    ;
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   209
  \end{rail}%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   210
\end{isamarkuptext}%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   211
\isamarkuptrue%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   212
%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   213
\isamarkupsubsection{Type classes, sorts and arities%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   214
}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   215
\isamarkuptrue%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   216
%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   217
\begin{isamarkuptext}%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   218
Classes are specified by plain names.  Sorts have a very simple
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   219
  inner syntax, which is either a single class name \isa{c} or a
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   220
  list \isa{{\isachardoublequote}{\isacharbraceleft}c\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ c\isactrlsub n{\isacharbraceright}{\isachardoublequote}} referring to the
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   221
  intersection of these classes.  The syntax of type arities is given
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   222
  directly at the outer level.
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   223
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   224
  \indexouternonterm{sort}\indexouternonterm{arity}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   225
  \indexouternonterm{classdecl}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   226
  \begin{rail}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   227
    classdecl: name (('<' | subseteq) (nameref + ','))?
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   228
    ;
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   229
    sort: nameref
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   230
    ;
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   231
    arity: ('(' (sort + ',') ')')? sort
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   232
    ;
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   233
  \end{rail}%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   234
\end{isamarkuptext}%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   235
\isamarkuptrue%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   236
%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   237
\isamarkupsubsection{Types and terms \label{sec:types-terms}%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   238
}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   239
\isamarkuptrue%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   240
%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   241
\begin{isamarkuptext}%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   242
The actual inner Isabelle syntax, that of types and terms of the
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   243
  logic, is far too sophisticated in order to be modelled explicitly
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   244
  at the outer theory level.  Basically, any such entity has to be
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   245
  quoted to turn it into a single token (the parsing and type-checking
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   246
  is performed internally later).  For convenience, a slightly more
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   247
  liberal convention is adopted: quotes may be omitted for any type or
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   248
  term that is already atomic at the outer level.  For example, one
26760
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   249
  may just write \verb|x| instead of quoted \verb|"x"|.
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   250
  Note that symbolic identifiers (e.g.\ \verb|++| or \isa{{\isachardoublequote}{\isasymforall}{\isachardoublequote}} are available as well, provided these have not been superseded
26760
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   251
  by commands or other keywords already (such as \verb|=| or
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   252
  \verb|+|).
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   253
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   254
  \indexoutertoken{type}\indexoutertoken{term}\indexoutertoken{prop}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   255
  \begin{rail}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   256
    type: nameref | typefree | typevar
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   257
    ;
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   258
    term: nameref | var
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   259
    ;
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   260
    prop: term
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   261
    ;
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   262
  \end{rail}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   263
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   264
  Positional instantiations are indicated by giving a sequence of
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   265
  terms, or the placeholder ``\isa{{\isacharunderscore}}'' (underscore), which means to
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   266
  skip a position.
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   267
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   268
  \indexoutertoken{inst}\indexoutertoken{insts}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   269
  \begin{rail}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   270
    inst: underscore | term
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   271
    ;
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   272
    insts: (inst *)
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   273
    ;
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   274
  \end{rail}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   275
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   276
  Type declarations and definitions usually refer to
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   277
  \railnonterm{typespec} on the left-hand side.  This models basic
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   278
  type constructor application at the outer syntax level.  Note that
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   279
  only plain postfix notation is available here, but no infixes.
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   280
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   281
  \indexouternonterm{typespec}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   282
  \begin{rail}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   283
    typespec: (() | typefree | '(' ( typefree + ',' ) ')') name
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   284
    ;
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   285
  \end{rail}%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   286
\end{isamarkuptext}%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   287
\isamarkuptrue%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   288
%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   289
\isamarkupsubsection{Mixfix annotations%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   290
}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   291
\isamarkuptrue%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   292
%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   293
\begin{isamarkuptext}%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   294
Mixfix annotations specify concrete \emph{inner} syntax of Isabelle
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   295
  types and terms.  Some commands such as \mbox{\isa{\isacommand{types}}} (see
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   296
  \secref{sec:types-pure}) admit infixes only, while \mbox{\isa{\isacommand{consts}}} (see \secref{sec:consts}) and \mbox{\isa{\isacommand{syntax}}} (see
26760
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   297
  \secref{sec:syn-trans}) support the full range of general mixfixes
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   298
  and binders.
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   299
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   300
  \indexouternonterm{infix}\indexouternonterm{mixfix}\indexouternonterm{structmixfix}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   301
  \begin{rail}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   302
    infix: '(' ('infix' | 'infixl' | 'infixr') string? nat ')'
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   303
    ;
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   304
    mixfix: infix | '(' string prios? nat? ')' | '(' 'binder' string prios? nat ')'
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   305
    ;
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   306
    structmixfix: mixfix | '(' 'structure' ')'
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   307
    ;
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   308
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   309
    prios: '[' (nat + ',') ']'
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   310
    ;
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   311
  \end{rail}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   312
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   313
  Here the \railtok{string} specifications refer to the actual mixfix
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   314
  template (see also \cite{isabelle-ref}), which may include literal
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   315
  text, spacing, blocks, and arguments (denoted by ``\isa{{\isacharunderscore}}''); the
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   316
  special symbol ``\verb|\<index>|'' (printed as ``\isa{{\isachardoublequote}{\isasymindex}{\isachardoublequote}}'')
26760
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   317
  represents an index argument that specifies an implicit structure
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   318
  reference (see also \secref{sec:locale}).  Infix and binder
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   319
  declarations provide common abbreviations for particular mixfix
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   320
  declarations.  So in practice, mixfix templates mostly degenerate to
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   321
  literal text for concrete syntax, such as ``\verb|++|'' for
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   322
  an infix symbol, or ``\verb|++|\isa{{\isachardoublequote}{\isasymindex}{\isachardoublequote}}'' for an infix of
26760
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   323
  an implicit structure.%
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   324
\end{isamarkuptext}%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   325
\isamarkuptrue%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   326
%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   327
\isamarkupsubsection{Proof methods \label{sec:syn-meth}%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   328
}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   329
\isamarkuptrue%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   330
%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   331
\begin{isamarkuptext}%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   332
Proof methods are either basic ones, or expressions composed of
26760
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   333
  methods via ``\verb|,|'' (sequential composition),
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   334
  ``\verb||\verb,|,\verb||'' (alternative choices), ``\verb|?|'' 
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   335
  (try), ``\verb|+|'' (repeat at least once), ``\verb|[|\isa{n}\verb|]|'' (restriction to first \isa{n}
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   336
  sub-goals, with default \isa{{\isachardoublequote}n\ {\isacharequal}\ {\isadigit{1}}{\isachardoublequote}}).  In practice, proof
26760
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   337
  methods are usually just a comma separated list of
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   338
  \railqtok{nameref}~\railnonterm{args} specifications.  Note that
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   339
  parentheses may be dropped for single method specifications (with no
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   340
  arguments).
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   341
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   342
  \indexouternonterm{method}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   343
  \begin{rail}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   344
    method: (nameref | '(' methods ')') (() | '?' | '+' | '[' nat? ']')
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   345
    ;
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   346
    methods: (nameref args | method) + (',' | '|')
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   347
    ;
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   348
  \end{rail}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   349
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   350
  Proper Isar proof methods do \emph{not} admit arbitrary goal
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   351
  addressing, but refer either to the first sub-goal or all sub-goals
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   352
  uniformly.  The goal restriction operator ``\isa{{\isachardoublequote}{\isacharbrackleft}n{\isacharbrackright}{\isachardoublequote}}''
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   353
  evaluates a method expression within a sandbox consisting of the
26760
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   354
  first \isa{n} sub-goals (which need to exist).  For example, the
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   355
  method ``\isa{{\isachardoublequote}simp{\isacharunderscore}all{\isacharbrackleft}{\isadigit{3}}{\isacharbrackright}{\isachardoublequote}}'' simplifies the first three
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   356
  sub-goals, while ``\isa{{\isachardoublequote}{\isacharparenleft}rule\ foo{\isacharcomma}\ simp{\isacharunderscore}all{\isacharparenright}{\isacharbrackleft}{\isacharbrackright}{\isachardoublequote}}'' simplifies all
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   357
  new goals that emerge from applying rule \isa{{\isachardoublequote}foo{\isachardoublequote}} to the
26760
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   358
  originally first one.
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   359
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   360
  Improper methods, notably tactic emulations, offer a separate
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   361
  low-level goal addressing scheme as explicit argument to the
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   362
  individual tactic being involved.  Here ``\isa{{\isachardoublequote}{\isacharbrackleft}{\isacharbang}{\isacharbrackright}{\isachardoublequote}}'' refers to
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   363
  all goals, and ``\isa{{\isachardoublequote}{\isacharbrackleft}n{\isacharminus}{\isacharbrackright}{\isachardoublequote}}'' to all goals starting from \isa{{\isachardoublequote}n{\isachardoublequote}}.
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   364
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   365
  \indexouternonterm{goalspec}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   366
  \begin{rail}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   367
    goalspec: '[' (nat '-' nat | nat '-' | nat | '!' ) ']'
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   368
    ;
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   369
  \end{rail}%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   370
\end{isamarkuptext}%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   371
\isamarkuptrue%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   372
%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   373
\isamarkupsubsection{Attributes and theorems \label{sec:syn-att}%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   374
}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   375
\isamarkuptrue%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   376
%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   377
\begin{isamarkuptext}%
26760
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   378
Attributes (and proof methods, see \secref{sec:syn-meth}) have their
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   379
  own ``semi-inner'' syntax, in the sense that input conforming to
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   380
  \railnonterm{args} below is parsed by the attribute a second time.
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   381
  The attribute argument specifications may be any sequence of atomic
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   382
  entities (identifiers, strings etc.), or properly bracketed argument
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   383
  lists.  Below \railqtok{atom} refers to any atomic entity, including
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   384
  any \railtok{keyword} conforming to \railtok{symident}.
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   385
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   386
  \indexoutertoken{atom}\indexouternonterm{args}\indexouternonterm{attributes}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   387
  \begin{rail}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   388
    atom: nameref | typefree | typevar | var | nat | keyword
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   389
    ;
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   390
    arg: atom | '(' args ')' | '[' args ']'
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   391
    ;
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   392
    args: arg *
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   393
    ;
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   394
    attributes: '[' (nameref args * ',') ']'
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   395
    ;
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   396
  \end{rail}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   397
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   398
  Theorem specifications come in several flavors:
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   399
  \railnonterm{axmdecl} and \railnonterm{thmdecl} usually refer to
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   400
  axioms, assumptions or results of goal statements, while
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   401
  \railnonterm{thmdef} collects lists of existing theorems.  Existing
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   402
  theorems are given by \railnonterm{thmref} and
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   403
  \railnonterm{thmrefs}, the former requires an actual singleton
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   404
  result.
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   405
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   406
  There are three forms of theorem references:
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   407
  \begin{enumerate}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   408
  
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   409
  \item named facts \isa{{\isachardoublequote}a{\isachardoublequote}},
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   410
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   411
  \item selections from named facts \isa{{\isachardoublequote}a{\isacharparenleft}i{\isacharparenright}{\isachardoublequote}} or \isa{{\isachardoublequote}a{\isacharparenleft}j\ {\isacharminus}\ k{\isacharparenright}{\isachardoublequote}},
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   412
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   413
  \item literal fact propositions using \indexref{}{syntax}{altstring}\mbox{\isa{altstring}} syntax
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   414
  \verb|`|\isa{{\isachardoublequote}{\isasymphi}{\isachardoublequote}}\verb|`| (see also method
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   415
  \indexref{}{method}{fact}\mbox{\isa{fact}} in \secref{sec:pure-meth-att}).
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   416
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   417
  \end{enumerate}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   418
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   419
  Any kind of theorem specification may include lists of attributes
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   420
  both on the left and right hand sides; attributes are applied to any
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   421
  immediately preceding fact.  If names are omitted, the theorems are
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   422
  not stored within the theorem database of the theory or proof
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   423
  context, but any given attributes are applied nonetheless.
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   424
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   425
  An extra pair of brackets around attributes (like ``\isa{{\isachardoublequote}{\isacharbrackleft}{\isacharbrackleft}simproc\ a{\isacharbrackright}{\isacharbrackright}{\isachardoublequote}}'') abbreviates a theorem reference involving an
26760
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   426
  internal dummy fact, which will be ignored later on.  So only the
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   427
  effect of the attribute on the background context will persist.
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   428
  This form of in-place declarations is particularly useful with
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   429
  commands like \mbox{\isa{\isacommand{declare}}} and \mbox{\isa{\isacommand{using}}}.
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   430
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   431
  \indexouternonterm{axmdecl}\indexouternonterm{thmdecl}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   432
  \indexouternonterm{thmdef}\indexouternonterm{thmref}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   433
  \indexouternonterm{thmrefs}\indexouternonterm{selection}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   434
  \begin{rail}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   435
    axmdecl: name attributes? ':'
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   436
    ;
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   437
    thmdecl: thmbind ':'
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   438
    ;
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   439
    thmdef: thmbind '='
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   440
    ;
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   441
    thmref: (nameref selection? | altstring) attributes? | '[' attributes ']'
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   442
    ;
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   443
    thmrefs: thmref +
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   444
    ;
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   445
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   446
    thmbind: name attributes | name | attributes
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   447
    ;
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   448
    selection: '(' ((nat | nat '-' nat?) + ',') ')'
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   449
    ;
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   450
  \end{rail}%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   451
\end{isamarkuptext}%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   452
\isamarkuptrue%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   453
%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   454
\isamarkupsubsection{Term patterns and declarations \label{sec:term-decls}%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   455
}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   456
\isamarkuptrue%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   457
%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   458
\begin{isamarkuptext}%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   459
Wherever explicit propositions (or term fragments) occur in a proof
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   460
  text, casual binding of schematic term variables may be given
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   461
  specified via patterns of the form ``\isa{{\isachardoublequote}{\isacharparenleft}{\isasymIS}\ p\isactrlsub {\isadigit{1}}\ {\isasymdots}\ p\isactrlsub n{\isacharparenright}{\isachardoublequote}}''.  This works both for \railqtok{term} and \railqtok{prop}.
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   462
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   463
  \indexouternonterm{termpat}\indexouternonterm{proppat}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   464
  \begin{rail}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   465
    termpat: '(' ('is' term +) ')'
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   466
    ;
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   467
    proppat: '(' ('is' prop +) ')'
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   468
    ;
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   469
  \end{rail}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   470
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   471
  \medskip Declarations of local variables \isa{{\isachardoublequote}x\ {\isacharcolon}{\isacharcolon}\ {\isasymtau}{\isachardoublequote}} and
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   472
  logical propositions \isa{{\isachardoublequote}a\ {\isacharcolon}\ {\isasymphi}{\isachardoublequote}} represent different views on
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   473
  the same principle of introducing a local scope.  In practice, one
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   474
  may usually omit the typing of \railnonterm{vars} (due to
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   475
  type-inference), and the naming of propositions (due to implicit
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   476
  references of current facts).  In any case, Isar proof elements
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   477
  usually admit to introduce multiple such items simultaneously.
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   478
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   479
  \indexouternonterm{vars}\indexouternonterm{props}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   480
  \begin{rail}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   481
    vars: (name+) ('::' type)?
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   482
    ;
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   483
    props: thmdecl? (prop proppat? +)
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   484
    ;
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   485
  \end{rail}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   486
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   487
  The treatment of multiple declarations corresponds to the
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   488
  complementary focus of \railnonterm{vars} versus
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   489
  \railnonterm{props}.  In ``\isa{{\isachardoublequote}x\isactrlsub {\isadigit{1}}\ {\isasymdots}\ x\isactrlsub n\ {\isacharcolon}{\isacharcolon}\ {\isasymtau}{\isachardoublequote}}''
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   490
  the typing refers to all variables, while in \isa{{\isachardoublequote}a{\isacharcolon}\ {\isasymphi}\isactrlsub {\isadigit{1}}\ {\isasymdots}\ {\isasymphi}\isactrlsub n{\isachardoublequote}} the naming refers to all propositions collectively.
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   491
  Isar language elements that refer to \railnonterm{vars} or
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   492
  \railnonterm{props} typically admit separate typings or namings via
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   493
  another level of iteration, with explicit \indexref{}{keyword}{and}\mbox{\isa{\isakeyword{and}}}
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   494
  separators; e.g.\ see \mbox{\isa{\isacommand{fix}}} and \mbox{\isa{\isacommand{assume}}} in
26760
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   495
  \secref{sec:proof-context}.%
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   496
\end{isamarkuptext}%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   497
\isamarkuptrue%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   498
%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   499
\isamarkupsubsection{Antiquotations \label{sec:antiq}%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   500
}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   501
\isamarkuptrue%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   502
%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   503
\begin{isamarkuptext}%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   504
\begin{matharray}{rcl}
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   505
    \indexdef{}{antiquotation}{theory}\mbox{\isa{theory}} & : & \isarantiq \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   506
    \indexdef{}{antiquotation}{thm}\mbox{\isa{thm}} & : & \isarantiq \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   507
    \indexdef{}{antiquotation}{prop}\mbox{\isa{prop}} & : & \isarantiq \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   508
    \indexdef{}{antiquotation}{term}\mbox{\isa{term}} & : & \isarantiq \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   509
    \indexdef{}{antiquotation}{const}\mbox{\isa{const}} & : & \isarantiq \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   510
    \indexdef{}{antiquotation}{abbrev}\mbox{\isa{abbrev}} & : & \isarantiq \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   511
    \indexdef{}{antiquotation}{typeof}\mbox{\isa{typeof}} & : & \isarantiq \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   512
    \indexdef{}{antiquotation}{typ}\mbox{\isa{typ}} & : & \isarantiq \\
26854
9b4aec46ad78 improved treatment of "_" thanks to underscore.sty;
wenzelm
parents: 26842
diff changeset
   513
    \indexdef{}{antiquotation}{thm\_style}\mbox{\isa{thm{\isacharunderscore}style}} & : & \isarantiq \\
9b4aec46ad78 improved treatment of "_" thanks to underscore.sty;
wenzelm
parents: 26842
diff changeset
   514
    \indexdef{}{antiquotation}{term\_style}\mbox{\isa{term{\isacharunderscore}style}} & : & \isarantiq \\
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   515
    \indexdef{}{antiquotation}{text}\mbox{\isa{text}} & : & \isarantiq \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   516
    \indexdef{}{antiquotation}{goals}\mbox{\isa{goals}} & : & \isarantiq \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   517
    \indexdef{}{antiquotation}{subgoals}\mbox{\isa{subgoals}} & : & \isarantiq \\
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   518
    \indexdef{}{antiquotation}{prf}\mbox{\isa{prf}} & : & \isarantiq \\
26854
9b4aec46ad78 improved treatment of "_" thanks to underscore.sty;
wenzelm
parents: 26842
diff changeset
   519
    \indexdef{}{antiquotation}{full\_prf}\mbox{\isa{full{\isacharunderscore}prf}} & : & \isarantiq \\
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   520
    \indexdef{}{antiquotation}{ML}\mbox{\isa{ML}} & : & \isarantiq \\
26854
9b4aec46ad78 improved treatment of "_" thanks to underscore.sty;
wenzelm
parents: 26842
diff changeset
   521
    \indexdef{}{antiquotation}{ML\_type}\mbox{\isa{ML{\isacharunderscore}type}} & : & \isarantiq \\
9b4aec46ad78 improved treatment of "_" thanks to underscore.sty;
wenzelm
parents: 26842
diff changeset
   522
    \indexdef{}{antiquotation}{ML\_struct}\mbox{\isa{ML{\isacharunderscore}struct}} & : & \isarantiq \\
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   523
  \end{matharray}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   524
26760
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   525
  The text body of formal comments (see also \secref{sec:comments})
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   526
  may contain antiquotations of logical entities, such as theorems,
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   527
  terms and types, which are to be presented in the final output
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   528
  produced by the Isabelle document preparation system (see also
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   529
  \secref{sec:document-prep}).
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   530
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   531
  Thus embedding of ``\isa{{\isachardoublequote}{\isacharat}{\isacharbraceleft}term\ {\isacharbrackleft}show{\isacharunderscore}types{\isacharbrackright}\ {\isachardoublequote}f\ x\ {\isacharequal}\ a\ {\isacharplus}\ x{\isachardoublequote}{\isacharbraceright}{\isachardoublequote}}''
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   532
  within a text block would cause
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   533
  \isa{{\isacharparenleft}f{\isasymColon}{\isacharprime}a\ {\isasymRightarrow}\ {\isacharprime}a{\isacharparenright}\ {\isacharparenleft}x{\isasymColon}{\isacharprime}a{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}a{\isasymColon}{\isacharprime}a{\isacharparenright}\ {\isacharplus}\ x} to appear in the final {\LaTeX} document.  Also note that theorem
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   534
  antiquotations may involve attributes as well.  For example,
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   535
  \isa{{\isachardoublequote}{\isacharat}{\isacharbraceleft}thm\ sym\ {\isacharbrackleft}no{\isacharunderscore}vars{\isacharbrackright}{\isacharbraceright}{\isachardoublequote}} would print the theorem's
26760
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   536
  statement where all schematic variables have been replaced by fixed
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   537
  ones, which are easier to read.
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   538
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   539
  \begin{rail}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   540
    atsign lbrace antiquotation rbrace
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   541
    ;
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   542
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   543
    antiquotation:
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   544
      'theory' options name |
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   545
      'thm' options thmrefs |
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   546
      'prop' options prop |
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   547
      'term' options term |
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   548
      'const' options term |
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   549
      'abbrev' options term |
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   550
      'typeof' options term |
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   551
      'typ' options type |
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   552
      'thm\_style' options name thmref |
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   553
      'term\_style' options name term |
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   554
      'text' options name |
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   555
      'goals' options |
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   556
      'subgoals' options |
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   557
      'prf' options thmrefs |
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   558
      'full\_prf' options thmrefs |
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   559
      'ML' options name |
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   560
      'ML\_type' options name |
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   561
      'ML\_struct' options name
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   562
    ;
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   563
    options: '[' (option * ',') ']'
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   564
    ;
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   565
    option: name | name '=' name
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   566
    ;
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   567
  \end{rail}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   568
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   569
  Note that the syntax of antiquotations may \emph{not} include source
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   570
  comments \verb|(*|~\isa{{\isachardoublequote}{\isasymdots}{\isachardoublequote}}~\verb|*)| or verbatim
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   571
  text \verb|{|\verb|*|~\isa{{\isachardoublequote}{\isasymdots}{\isachardoublequote}}~\verb|*|\verb|}|.
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   572
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   573
  \begin{descr}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   574
  
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   575
  \item [\isa{{\isachardoublequote}{\isacharat}{\isacharbraceleft}theory\ A{\isacharbraceright}{\isachardoublequote}}] prints the name \isa{{\isachardoublequote}A{\isachardoublequote}}, which is
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   576
  guaranteed to refer to a valid ancestor theory in the current
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   577
  context.
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   578
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   579
  \item [\isa{{\isachardoublequote}{\isacharat}{\isacharbraceleft}thm\ a\isactrlsub {\isadigit{1}}\ {\isasymdots}\ a\isactrlsub n{\isacharbraceright}{\isachardoublequote}}] prints theorems
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   580
  \isa{{\isachardoublequote}a\isactrlsub {\isadigit{1}}\ {\isasymdots}\ a\isactrlsub n{\isachardoublequote}}.  Note that attribute specifications
26760
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   581
  may be included as well (see also \secref{sec:syn-att}); the
26854
9b4aec46ad78 improved treatment of "_" thanks to underscore.sty;
wenzelm
parents: 26842
diff changeset
   582
  \indexref{}{attribute}{no\_vars}\mbox{\isa{no{\isacharunderscore}vars}} rule (see \secref{sec:misc-meth-att}) would
26760
2de4ba348f06 replaced various macros by antiquotations;
wenzelm
parents: 26756
diff changeset
   583
  be particularly useful to suppress printing of schematic variables.
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   584
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   585
  \item [\isa{{\isachardoublequote}{\isacharat}{\isacharbraceleft}prop\ {\isasymphi}{\isacharbraceright}{\isachardoublequote}}] prints a well-typed proposition \isa{{\isachardoublequote}{\isasymphi}{\isachardoublequote}}.
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   586
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   587
  \item [\isa{{\isachardoublequote}{\isacharat}{\isacharbraceleft}term\ t{\isacharbraceright}{\isachardoublequote}}] prints a well-typed term \isa{{\isachardoublequote}t{\isachardoublequote}}.
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   588
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   589
  \item [\isa{{\isachardoublequote}{\isacharat}{\isacharbraceleft}const\ c{\isacharbraceright}{\isachardoublequote}}] prints a logical or syntactic constant
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   590
  \isa{{\isachardoublequote}c{\isachardoublequote}}.
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   591
  
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   592
  \item [\isa{{\isachardoublequote}{\isacharat}{\isacharbraceleft}abbrev\ c\ x\isactrlsub {\isadigit{1}}\ {\isasymdots}\ x\isactrlsub n{\isacharbraceright}{\isachardoublequote}}] prints a constant
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   593
  abbreviation \isa{{\isachardoublequote}c\ x\isactrlsub {\isadigit{1}}\ {\isasymdots}\ x\isactrlsub n\ {\isasymequiv}\ rhs{\isachardoublequote}} as defined in
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   594
  the current context.
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   595
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   596
  \item [\isa{{\isachardoublequote}{\isacharat}{\isacharbraceleft}typeof\ t{\isacharbraceright}{\isachardoublequote}}] prints the type of a well-typed term
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   597
  \isa{{\isachardoublequote}t{\isachardoublequote}}.
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   598
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   599
  \item [\isa{{\isachardoublequote}{\isacharat}{\isacharbraceleft}typ\ {\isasymtau}{\isacharbraceright}{\isachardoublequote}}] prints a well-formed type \isa{{\isachardoublequote}{\isasymtau}{\isachardoublequote}}.
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   600
  
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   601
  \item [\isa{{\isachardoublequote}{\isacharat}{\isacharbraceleft}thm{\isacharunderscore}style\ s\ a{\isacharbraceright}{\isachardoublequote}}] prints theorem \isa{a},
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   602
  previously applying a style \isa{s} to it (see below).
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   603
  
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   604
  \item [\isa{{\isachardoublequote}{\isacharat}{\isacharbraceleft}term{\isacharunderscore}style\ s\ t{\isacharbraceright}{\isachardoublequote}}] prints a well-typed term \isa{t} after applying a style \isa{s} to it (see below).
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   605
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   606
  \item [\isa{{\isachardoublequote}{\isacharat}{\isacharbraceleft}text\ s{\isacharbraceright}{\isachardoublequote}}] prints uninterpreted source text \isa{s}.  This is particularly useful to print portions of text according
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   607
  to the Isabelle {\LaTeX} output style, without demanding
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   608
  well-formedness (e.g.\ small pieces of terms that should not be
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   609
  parsed or type-checked yet).
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   610
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   611
  \item [\isa{{\isachardoublequote}{\isacharat}{\isacharbraceleft}goals{\isacharbraceright}{\isachardoublequote}}] prints the current \emph{dynamic} goal
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   612
  state.  This is mainly for support of tactic-emulation scripts
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   613
  within Isar --- presentation of goal states does not conform to
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   614
  actual human-readable proof documents.
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   615
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   616
  Please do not include goal states into document output unless you
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   617
  really know what you are doing!
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   618
  
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   619
  \item [\isa{{\isachardoublequote}{\isacharat}{\isacharbraceleft}subgoals{\isacharbraceright}{\isachardoublequote}}] is similar to \isa{{\isachardoublequote}{\isacharat}{\isacharbraceleft}goals{\isacharbraceright}{\isachardoublequote}}, but
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   620
  does not print the main goal.
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   621
  
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   622
  \item [\isa{{\isachardoublequote}{\isacharat}{\isacharbraceleft}prf\ a\isactrlsub {\isadigit{1}}\ {\isasymdots}\ a\isactrlsub n{\isacharbraceright}{\isachardoublequote}}] prints the (compact)
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   623
  proof terms corresponding to the theorems \isa{{\isachardoublequote}a\isactrlsub {\isadigit{1}}\ {\isasymdots}\ a\isactrlsub n{\isachardoublequote}}. Note that this requires proof terms to be switched on
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   624
  for the current object logic (see the ``Proof terms'' section of the
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   625
  Isabelle reference manual for information on how to do this).
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   626
  
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   627
  \item [\isa{{\isachardoublequote}{\isacharat}{\isacharbraceleft}full{\isacharunderscore}prf\ a\isactrlsub {\isadigit{1}}\ {\isasymdots}\ a\isactrlsub n{\isacharbraceright}{\isachardoublequote}}] is like \isa{{\isachardoublequote}{\isacharat}{\isacharbraceleft}prf\ a\isactrlsub {\isadigit{1}}\ {\isasymdots}\ a\isactrlsub n{\isacharbraceright}{\isachardoublequote}}, but displays the full proof terms,
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   628
  i.e.\ also displays information omitted in the compact proof term,
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   629
  which is denoted by ``\isa{{\isacharunderscore}}'' placeholders there.
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   630
  
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   631
  \item [\isa{{\isachardoublequote}{\isacharat}{\isacharbraceleft}ML\ s{\isacharbraceright}{\isachardoublequote}}, \isa{{\isachardoublequote}{\isacharat}{\isacharbraceleft}ML{\isacharunderscore}type\ s{\isacharbraceright}{\isachardoublequote}}, and \isa{{\isachardoublequote}{\isacharat}{\isacharbraceleft}ML{\isacharunderscore}struct\ s{\isacharbraceright}{\isachardoublequote}}] check text \isa{s} as ML value, type, and
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   632
  structure, respectively.  The source is displayed verbatim.
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   633
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   634
  \end{descr}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   635
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   636
  \medskip The following standard styles for use with \isa{thm{\isacharunderscore}style} and \isa{term{\isacharunderscore}style} are available:
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   637
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   638
  \begin{descr}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   639
  
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   640
  \item [\isa{lhs}] extracts the first argument of any application
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   641
  form with at least two arguments -- typically meta-level or
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   642
  object-level equality, or any other binary relation.
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   643
  
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   644
  \item [\isa{rhs}] is like \isa{lhs}, but extracts the second
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   645
  argument.
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   646
  
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   647
  \item [\isa{{\isachardoublequote}concl{\isachardoublequote}}] extracts the conclusion \isa{C} from a rule
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   648
  in Horn-clause normal form \isa{{\isachardoublequote}A\isactrlsub {\isadigit{1}}\ {\isasymLongrightarrow}\ {\isasymdots}\ A\isactrlsub n\ {\isasymLongrightarrow}\ C{\isachardoublequote}}.
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   649
  
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   650
  \item [\isa{{\isachardoublequote}prem{\isadigit{1}}{\isachardoublequote}}, \dots, \isa{{\isachardoublequote}prem{\isadigit{9}}{\isachardoublequote}}] extract premise
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   651
  number \isa{{\isachardoublequote}{\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ {\isadigit{9}}{\isachardoublequote}}, respectively, from from a rule in
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   652
  Horn-clause normal form \isa{{\isachardoublequote}A\isactrlsub {\isadigit{1}}\ {\isasymLongrightarrow}\ {\isasymdots}\ A\isactrlsub n\ {\isasymLongrightarrow}\ C{\isachardoublequote}}
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   653
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   654
  \end{descr}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   655
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   656
  \medskip
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   657
  The following options are available to tune the output.  Note that most of
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   658
  these coincide with ML flags of the same names (see also \cite{isabelle-ref}).
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   659
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   660
  \begin{descr}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   661
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   662
  \item[\isa{{\isachardoublequote}show{\isacharunderscore}types\ {\isacharequal}\ bool{\isachardoublequote}} and \isa{{\isachardoublequote}show{\isacharunderscore}sorts\ {\isacharequal}\ bool{\isachardoublequote}}]
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   663
  control printing of explicit type and sort constraints.
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   664
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   665
  \item[\isa{{\isachardoublequote}show{\isacharunderscore}structs\ {\isacharequal}\ bool{\isachardoublequote}}] controls printing of implicit
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   666
  structures.
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   667
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   668
  \item[\isa{{\isachardoublequote}long{\isacharunderscore}names\ {\isacharequal}\ bool{\isachardoublequote}}] forces names of types and
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   669
  constants etc.\ to be printed in their fully qualified internal
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   670
  form.
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   671
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   672
  \item[\isa{{\isachardoublequote}short{\isacharunderscore}names\ {\isacharequal}\ bool{\isachardoublequote}}] forces names of types and
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   673
  constants etc.\ to be printed unqualified.  Note that internalizing
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   674
  the output again in the current context may well yield a different
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   675
  result.
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   676
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   677
  \item[\isa{{\isachardoublequote}unique{\isacharunderscore}names\ {\isacharequal}\ bool{\isachardoublequote}}] determines whether the printed
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   678
  version of qualified names should be made sufficiently long to avoid
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   679
  overlap with names declared further back.  Set to \isa{false} for
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   680
  more concise output.
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   681
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   682
  \item[\isa{{\isachardoublequote}eta{\isacharunderscore}contract\ {\isacharequal}\ bool{\isachardoublequote}}] prints terms in \isa{{\isasymeta}}-contracted form.
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   683
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   684
  \item[\isa{{\isachardoublequote}display\ {\isacharequal}\ bool{\isachardoublequote}}] indicates if the text is to be
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   685
  output as multi-line ``display material'', rather than a small piece
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   686
  of text without line breaks (which is the default).
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   687
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   688
  \item[\isa{{\isachardoublequote}break\ {\isacharequal}\ bool{\isachardoublequote}}] controls line breaks in non-display
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   689
  material.
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   690
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   691
  \item[\isa{{\isachardoublequote}quotes\ {\isacharequal}\ bool{\isachardoublequote}}] indicates if the output should be
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   692
  enclosed in double quotes.
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   693
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   694
  \item[\isa{{\isachardoublequote}mode\ {\isacharequal}\ name{\isachardoublequote}}] adds \isa{name} to the print mode to
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   695
  be used for presentation (see also \cite{isabelle-ref}).  Note that
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   696
  the standard setup for {\LaTeX} output is already present by
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   697
  default, including the modes \isa{latex} and \isa{xsymbols}.
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   698
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   699
  \item[\isa{{\isachardoublequote}margin\ {\isacharequal}\ nat{\isachardoublequote}} and \isa{{\isachardoublequote}indent\ {\isacharequal}\ nat{\isachardoublequote}}] change the
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   700
  margin or indentation for pretty printing of display material.
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   701
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   702
  \item[\isa{{\isachardoublequote}source\ {\isacharequal}\ bool{\isachardoublequote}}] prints the source text of the
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   703
  antiquotation arguments, rather than the actual value.  Note that
26776
030db8c8b79d updated generated file;
wenzelm
parents: 26767
diff changeset
   704
  this does not affect well-formedness checks of \mbox{\isa{thm}}, \mbox{\isa{term}}, etc. (only the \mbox{\isa{text}} antiquotation admits arbitrary output).
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   705
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   706
  \item[\isa{{\isachardoublequote}goals{\isacharunderscore}limit\ {\isacharequal}\ nat{\isachardoublequote}}] determines the maximum number of
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   707
  goals to be printed.
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   708
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   709
  \item[\isa{{\isachardoublequote}locale\ {\isacharequal}\ name{\isachardoublequote}}] specifies an alternative locale
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   710
  context used for evaluating and printing the subsequent argument.
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   711
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   712
  \end{descr}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   713
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   714
  For boolean flags, ``\isa{{\isachardoublequote}name\ {\isacharequal}\ true{\isachardoublequote}}'' may be abbreviated as
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   715
  ``\isa{name}''.  All of the above flags are disabled by default,
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   716
  unless changed from ML.
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   717
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   718
  \medskip Note that antiquotations do not only spare the author from
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   719
  tedious typing of logical entities, but also achieve some degree of
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   720
  consistency-checking of informal explanations with formal
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   721
  developments: well-formedness of terms and types with respect to the
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   722
  current theory or proof context is ensured here.%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   723
\end{isamarkuptext}%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   724
\isamarkuptrue%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   725
%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   726
\isamarkupsubsection{Tagged commands \label{sec:tags}%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   727
}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   728
\isamarkuptrue%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   729
%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   730
\begin{isamarkuptext}%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   731
Each Isabelle/Isar command may be decorated by presentation tags:
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   732
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   733
  \indexouternonterm{tags}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   734
  \begin{rail}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   735
    tags: ( tag * )
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   736
    ;
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   737
    tag: '\%' (ident | string)
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   738
  \end{rail}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   739
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   740
  The tags \isa{{\isachardoublequote}theory{\isachardoublequote}}, \isa{{\isachardoublequote}proof{\isachardoublequote}}, \isa{{\isachardoublequote}ML{\isachardoublequote}} are already
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   741
  pre-declared for certain classes of commands:
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   742
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   743
 \medskip
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   744
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   745
  \begin{tabular}{ll}
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   746
    \isa{{\isachardoublequote}theory{\isachardoublequote}} & theory begin/end \\
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   747
    \isa{{\isachardoublequote}proof{\isachardoublequote}} & all proof commands \\
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   748
    \isa{{\isachardoublequote}ML{\isachardoublequote}} & all commands involving ML code \\
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   749
  \end{tabular}
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   750
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   751
  \medskip The Isabelle document preparation system (see also
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   752
  \cite{isabelle-sys}) allows tagged command regions to be presented
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   753
  specifically, e.g.\ to fold proof texts, or drop parts of the text
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   754
  completely.
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   755
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   756
  For example ``\mbox{\isa{\isacommand{by}}}~\isa{{\isachardoublequote}{\isacharpercent}invisible\ auto{\isachardoublequote}}'' would
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   757
  cause that piece of proof to be treated as \isa{invisible} instead
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   758
  of \isa{{\isachardoublequote}proof{\isachardoublequote}} (the default), which may be either show or hidden
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   759
  depending on the document setup.  In contrast, ``\mbox{\isa{\isacommand{by}}}~\isa{{\isachardoublequote}{\isacharpercent}visible\ auto{\isachardoublequote}}'' would force this text to be shown
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   760
  invariably.
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   761
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   762
  Explicit tag specifications within a proof apply to all subsequent
26842
81308d44fe0a updated generated file;
wenzelm
parents: 26788
diff changeset
   763
  commands of the same level of nesting.  For example, ``\mbox{\isa{\isacommand{proof}}}~\isa{{\isachardoublequote}{\isacharpercent}visible\ {\isasymdots}{\isachardoublequote}}~\mbox{\isa{\isacommand{qed}}}'' would force the
26754
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   764
  whole sub-proof to be typeset as \isa{visible} (unless some of its
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   765
  parts are tagged differently).%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   766
\end{isamarkuptext}%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   767
\isamarkuptrue%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   768
%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   769
\isadelimtheory
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   770
%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   771
\endisadelimtheory
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   772
%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   773
\isatagtheory
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   774
\isacommand{end}\isamarkupfalse%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   775
%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   776
\endisatagtheory
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   777
{\isafoldtheory}%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   778
%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   779
\isadelimtheory
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   780
%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   781
\endisadelimtheory
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   782
\isanewline
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   783
\end{isabellebody}%
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   784
%%% Local Variables:
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   785
%%% mode: latex
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   786
%%% TeX-master: "root"
c0424e4de33d converted syntax.tex to Thy/syntax.thy;
wenzelm
parents:
diff changeset
   787
%%% End: