doc-src/TutorialI/Documents/document/Documents.tex
author wenzelm
Sat, 28 Apr 2012 16:06:30 +0200
changeset 47822 34b44d28fc4b
parent 45106 3498077f2012
permissions -rw-r--r--
some updates concerning current Proof General 4.x, which lacks X-Symbol mode of 3.x; removed historic note about Poly/ML vs. SML/NJ;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11648
d78a82d112e4 *** empty log message ***
wenzelm
parents:
diff changeset
     1
%
d78a82d112e4 *** empty log message ***
wenzelm
parents:
diff changeset
     2
\begin{isabellebody}%
d78a82d112e4 *** empty log message ***
wenzelm
parents:
diff changeset
     3
\def\isabellecontext{Documents}%
17056
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
     4
%
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
     5
\isadelimtheory
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
     6
%
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
     7
\endisadelimtheory
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
     8
%
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
     9
\isatagtheory
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
    10
%
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
    11
\endisatagtheory
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
    12
{\isafoldtheory}%
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
    13
%
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
    14
\isadelimtheory
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
    15
%
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
    16
\endisadelimtheory
12627
08eee994bf99 updated;
wenzelm
parents: 11866
diff changeset
    17
%
12647
001d10bbc61b updated;
wenzelm
parents: 12644
diff changeset
    18
\isamarkupsection{Concrete Syntax \label{sec:concrete-syntax}%
12627
08eee994bf99 updated;
wenzelm
parents: 11866
diff changeset
    19
}
08eee994bf99 updated;
wenzelm
parents: 11866
diff changeset
    20
\isamarkuptrue%
08eee994bf99 updated;
wenzelm
parents: 11866
diff changeset
    21
%
08eee994bf99 updated;
wenzelm
parents: 11866
diff changeset
    22
\begin{isamarkuptext}%
12767
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
    23
The core concept of Isabelle's framework for concrete syntax is that
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
    24
  of \bfindex{mixfix annotations}.  Associated with any kind of
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
    25
  constant declaration, mixfixes affect both the grammar productions
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
    26
  for the parser and output templates for the pretty printer.
12627
08eee994bf99 updated;
wenzelm
parents: 11866
diff changeset
    27
12743
wenzelm
parents: 12686
diff changeset
    28
  In full generality, parser and pretty printer configuration is a
25338
6eb185959aec updated to notation and abbreviation
nipkow
parents: 17196
diff changeset
    29
  subtle affair~\cite{isabelle-ref}.  Your syntax specifications need
12767
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
    30
  to interact properly with the existing setup of Isabelle/Pure and
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
    31
  Isabelle/HOL\@.  To avoid creating ambiguities with existing
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
    32
  elements, it is particularly important to give new syntactic
12764
b43333dc6e7d stylistic changes
paulson
parents: 12751
diff changeset
    33
  constructs the right precedence.
12627
08eee994bf99 updated;
wenzelm
parents: 11866
diff changeset
    34
25338
6eb185959aec updated to notation and abbreviation
nipkow
parents: 17196
diff changeset
    35
  Below we introduce a few simple syntax declaration
12743
wenzelm
parents: 12686
diff changeset
    36
  forms that already cover many common situations fairly well.%
12627
08eee994bf99 updated;
wenzelm
parents: 11866
diff changeset
    37
\end{isamarkuptext}%
08eee994bf99 updated;
wenzelm
parents: 11866
diff changeset
    38
\isamarkuptrue%
08eee994bf99 updated;
wenzelm
parents: 11866
diff changeset
    39
%
12647
001d10bbc61b updated;
wenzelm
parents: 12644
diff changeset
    40
\isamarkupsubsection{Infix Annotations%
12627
08eee994bf99 updated;
wenzelm
parents: 11866
diff changeset
    41
}
08eee994bf99 updated;
wenzelm
parents: 11866
diff changeset
    42
\isamarkuptrue%
08eee994bf99 updated;
wenzelm
parents: 11866
diff changeset
    43
%
08eee994bf99 updated;
wenzelm
parents: 11866
diff changeset
    44
\begin{isamarkuptext}%
12764
b43333dc6e7d stylistic changes
paulson
parents: 12751
diff changeset
    45
Syntax annotations may be included wherever constants are declared,
27015
f8537d69f514 *** empty log message ***
nipkow
parents: 25401
diff changeset
    46
  such as \isacommand{definition} and \isacommand{primrec} --- and also
12767
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
    47
  \isacommand{datatype}, which declares constructor operations.
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
    48
  Type-constructors may be annotated as well, although this is less
40406
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
    49
  frequently encountered in practice (the infix type \isa{{\isaliteral{5C3C74696D65733E}{\isasymtimes}}} comes
12767
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
    50
  to mind).
12627
08eee994bf99 updated;
wenzelm
parents: 11866
diff changeset
    51
12644
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
    52
  Infix declarations\index{infix annotations} provide a useful special
12767
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
    53
  case of mixfixes.  The following example of the exclusive-or
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
    54
  operation on boolean values illustrates typical infix declarations.%
12627
08eee994bf99 updated;
wenzelm
parents: 11866
diff changeset
    55
\end{isamarkuptext}%
17175
1eced27ee0e1 updated;
wenzelm
parents: 17056
diff changeset
    56
\isamarkuptrue%
27015
f8537d69f514 *** empty log message ***
nipkow
parents: 25401
diff changeset
    57
\isacommand{definition}\isamarkupfalse%
40406
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
    58
\ xor\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{22}{\isachardoublequoteopen}}bool\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ bool\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ bool{\isaliteral{22}{\isachardoublequoteclose}}\ \ \ \ {\isaliteral{28}{\isacharparenleft}}\isakeyword{infixl}\ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{2B}{\isacharplus}}{\isaliteral{5D}{\isacharbrackright}}{\isaliteral{22}{\isachardoublequoteclose}}\ {\isadigit{6}}{\isadigit{0}}{\isaliteral{29}{\isacharparenright}}\isanewline
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
    59
\isakeyword{where}\ {\isaliteral{22}{\isachardoublequoteopen}}A\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{2B}{\isacharplus}}{\isaliteral{5D}{\isacharbrackright}}\ B\ {\isaliteral{5C3C65717569763E}{\isasymequiv}}\ {\isaliteral{28}{\isacharparenleft}}A\ {\isaliteral{5C3C616E643E}{\isasymand}}\ {\isaliteral{5C3C6E6F743E}{\isasymnot}}\ B{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C6F723E}{\isasymor}}\ {\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C6E6F743E}{\isasymnot}}\ A\ {\isaliteral{5C3C616E643E}{\isasymand}}\ B{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequoteclose}}%
12627
08eee994bf99 updated;
wenzelm
parents: 11866
diff changeset
    60
\begin{isamarkuptext}%
40406
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
    61
\noindent Now \isa{xor\ A\ B} and \isa{A\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{2B}{\isacharplus}}{\isaliteral{5D}{\isacharbrackright}}\ B} refer to the
12652
2d136f05e164 updated;
wenzelm
parents: 12649
diff changeset
    62
  same expression internally.  Any curried function with at least two
12767
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
    63
  arguments may be given infix syntax.  For partial applications with
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
    64
  fewer than two operands, there is a notation using the prefix~\isa{op}.  For instance, \isa{xor} without arguments is represented as
40406
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
    65
  \isa{op\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{2B}{\isacharplus}}{\isaliteral{5D}{\isacharbrackright}}}; together with ordinary function application, this
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
    66
  turns \isa{xor\ A} into \isa{op\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{2B}{\isacharplus}}{\isaliteral{5D}{\isacharbrackright}}\ A}.
12627
08eee994bf99 updated;
wenzelm
parents: 11866
diff changeset
    67
25338
6eb185959aec updated to notation and abbreviation
nipkow
parents: 17196
diff changeset
    68
  The keyword \isakeyword{infixl} seen above specifies an
12747
cc59ceb0bcb4 updated;
wenzelm
parents: 12745
diff changeset
    69
  infix operator that is nested to the \emph{left}: in iterated
cc59ceb0bcb4 updated;
wenzelm
parents: 12745
diff changeset
    70
  applications the more complex expression appears on the left-hand
40406
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
    71
  side, and \isa{A\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{2B}{\isacharplus}}{\isaliteral{5D}{\isacharbrackright}}\ B\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{2B}{\isacharplus}}{\isaliteral{5D}{\isacharbrackright}}\ C} stands for \isa{{\isaliteral{28}{\isacharparenleft}}A\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{2B}{\isacharplus}}{\isaliteral{5D}{\isacharbrackright}}\ B{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{2B}{\isacharplus}}{\isaliteral{5D}{\isacharbrackright}}\ C}.  Similarly, \isakeyword{infixr} means nesting to the
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
    72
  \emph{right}, reading \isa{A\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{2B}{\isacharplus}}{\isaliteral{5D}{\isacharbrackright}}\ B\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{2B}{\isacharplus}}{\isaliteral{5D}{\isacharbrackright}}\ C} as \isa{A\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{2B}{\isacharplus}}{\isaliteral{5D}{\isacharbrackright}}\ {\isaliteral{28}{\isacharparenleft}}B\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{2B}{\isacharplus}}{\isaliteral{5D}{\isacharbrackright}}\ C{\isaliteral{29}{\isacharparenright}}}.  A \emph{non-oriented} declaration via \isakeyword{infix}
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
    73
  would render \isa{A\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{2B}{\isacharplus}}{\isaliteral{5D}{\isacharbrackright}}\ B\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{2B}{\isacharplus}}{\isaliteral{5D}{\isacharbrackright}}\ C} illegal, but demand explicit
12767
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
    74
  parentheses to indicate the intended grouping.
12743
wenzelm
parents: 12686
diff changeset
    75
40406
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
    76
  The string \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{2B}{\isacharplus}}{\isaliteral{5D}{\isacharbrackright}}{\isaliteral{22}{\isachardoublequote}}} in our annotation refers to the
12747
cc59ceb0bcb4 updated;
wenzelm
parents: 12745
diff changeset
    77
  concrete syntax to represent the operator (a literal token), while
12764
b43333dc6e7d stylistic changes
paulson
parents: 12751
diff changeset
    78
  the number \isa{{\isadigit{6}}{\isadigit{0}}} determines the precedence of the construct:
12767
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
    79
  the syntactic priorities of the arguments and result.  Isabelle/HOL
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
    80
  already uses up many popular combinations of ASCII symbols for its
40406
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
    81
  own use, including both \isa{{\isaliteral{2B}{\isacharplus}}} and \isa{{\isaliteral{2B}{\isacharplus}}{\isaliteral{2B}{\isacharplus}}}.  Longer
12767
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
    82
  character combinations are more likely to be still available for
40406
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
    83
  user extensions, such as our~\isa{{\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{2B}{\isacharplus}}{\isaliteral{5D}{\isacharbrackright}}}.
12627
08eee994bf99 updated;
wenzelm
parents: 11866
diff changeset
    84
12767
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
    85
  Operator precedences have a range of 0--1000.  Very low or high
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
    86
  priorities are reserved for the meta-logic.  HOL syntax mainly uses
40406
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
    87
  the range of 10--100: the equality infix \isa{{\isaliteral{3D}{\isacharequal}}} is centered at
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
    88
  50; logical connectives (like \isa{{\isaliteral{5C3C6F723E}{\isasymor}}} and \isa{{\isaliteral{5C3C616E643E}{\isasymand}}}) are
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
    89
  below 50; algebraic ones (like \isa{{\isaliteral{2B}{\isacharplus}}} and \isa{{\isaliteral{2A}{\isacharasterisk}}}) are
12767
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
    90
  above 50.  User syntax should strive to coexist with common HOL
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
    91
  forms, or use the mostly unused range 100--900.%
12627
08eee994bf99 updated;
wenzelm
parents: 11866
diff changeset
    92
\end{isamarkuptext}%
08eee994bf99 updated;
wenzelm
parents: 11866
diff changeset
    93
\isamarkuptrue%
12635
e2d44df29c94 more on concrete syntax;
wenzelm
parents: 12627
diff changeset
    94
%
12658
3939e7dea202 updated;
wenzelm
parents: 12652
diff changeset
    95
\isamarkupsubsection{Mathematical Symbols \label{sec:syntax-symbols}%
12635
e2d44df29c94 more on concrete syntax;
wenzelm
parents: 12627
diff changeset
    96
}
12627
08eee994bf99 updated;
wenzelm
parents: 11866
diff changeset
    97
\isamarkuptrue%
12635
e2d44df29c94 more on concrete syntax;
wenzelm
parents: 12627
diff changeset
    98
%
e2d44df29c94 more on concrete syntax;
wenzelm
parents: 12627
diff changeset
    99
\begin{isamarkuptext}%
12767
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   100
Concrete syntax based on ASCII characters has inherent limitations.
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   101
  Mathematical notation demands a larger repertoire of glyphs.
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   102
  Several standards of extended character sets have been proposed over
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   103
  decades, but none has become universally available so far.  Isabelle
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   104
  has its own notion of \bfindex{symbols} as the smallest entities of
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   105
  source text, without referring to internal encodings.  There are
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   106
  three kinds of such ``generalized characters'':
12635
e2d44df29c94 more on concrete syntax;
wenzelm
parents: 12627
diff changeset
   107
e2d44df29c94 more on concrete syntax;
wenzelm
parents: 12627
diff changeset
   108
  \begin{enumerate}
e2d44df29c94 more on concrete syntax;
wenzelm
parents: 12627
diff changeset
   109
12652
2d136f05e164 updated;
wenzelm
parents: 12649
diff changeset
   110
  \item 7-bit ASCII characters
12635
e2d44df29c94 more on concrete syntax;
wenzelm
parents: 12627
diff changeset
   111
12652
2d136f05e164 updated;
wenzelm
parents: 12649
diff changeset
   112
  \item named symbols: \verb,\,\verb,<,$ident$\verb,>,
12635
e2d44df29c94 more on concrete syntax;
wenzelm
parents: 12627
diff changeset
   113
12652
2d136f05e164 updated;
wenzelm
parents: 12649
diff changeset
   114
  \item named control symbols: \verb,\,\verb,<^,$ident$\verb,>,
12635
e2d44df29c94 more on concrete syntax;
wenzelm
parents: 12627
diff changeset
   115
e2d44df29c94 more on concrete syntax;
wenzelm
parents: 12627
diff changeset
   116
  \end{enumerate}
e2d44df29c94 more on concrete syntax;
wenzelm
parents: 12627
diff changeset
   117
14486
74c053a25513 symbols in idents
kleing
parents: 14379
diff changeset
   118
  Here $ident$ is any sequence of letters. 
74c053a25513 symbols in idents
kleing
parents: 14379
diff changeset
   119
  This results in an infinite store of symbols, whose
12767
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   120
  interpretation is left to further front-end tools.  For example, the
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   121
  user-interface of Proof~General + X-Symbol and the Isabelle document
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   122
  processor (see \S\ref{sec:document-preparation}) display the
40406
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   123
  \verb,\,\verb,<forall>, symbol as~\isa{{\isaliteral{5C3C666F72616C6C3E}{\isasymforall}}}.
12635
e2d44df29c94 more on concrete syntax;
wenzelm
parents: 12627
diff changeset
   124
e2d44df29c94 more on concrete syntax;
wenzelm
parents: 12627
diff changeset
   125
  A list of standard Isabelle symbols is given in
28838
d5db6dfcb34a moved table of standard Isabelle symbols to isar-ref manual;
wenzelm
parents: 27027
diff changeset
   126
  \cite{isabelle-isar-ref}.  You may introduce your own
12635
e2d44df29c94 more on concrete syntax;
wenzelm
parents: 12627
diff changeset
   127
  interpretation of further symbols by configuring the appropriate
12652
2d136f05e164 updated;
wenzelm
parents: 12649
diff changeset
   128
  front-end tool accordingly, e.g.\ by defining certain {\LaTeX}
2d136f05e164 updated;
wenzelm
parents: 12649
diff changeset
   129
  macros (see also \S\ref{sec:doc-prep-symbols}).  There are also a
2d136f05e164 updated;
wenzelm
parents: 12649
diff changeset
   130
  few predefined control symbols, such as \verb,\,\verb,<^sub>, and
12635
e2d44df29c94 more on concrete syntax;
wenzelm
parents: 12627
diff changeset
   131
  \verb,\,\verb,<^sup>, for sub- and superscript of the subsequent
12764
b43333dc6e7d stylistic changes
paulson
parents: 12751
diff changeset
   132
  printable symbol, respectively.  For example, \verb,A\<^sup>\<star>, is
40406
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   133
  output as \isa{A\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{5C3C737461723E}{\isasymstar}}}.
12635
e2d44df29c94 more on concrete syntax;
wenzelm
parents: 12627
diff changeset
   134
17187
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   135
  A number of symbols are considered letters by the Isabelle lexer and
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   136
  can be used as part of identifiers. These are the greek letters
40406
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   137
  \isa{{\isaliteral{5C3C616C7068613E}{\isasymalpha}}} (\verb+\+\verb+<alpha>+), \isa{{\isaliteral{5C3C626574613E}{\isasymbeta}}}
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   138
  (\verb+\+\verb+<beta>+), etc. (excluding \isa{{\isaliteral{5C3C6C616D6264613E}{\isasymlambda}}}),
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   139
  special letters like \isa{{\isaliteral{5C3C413E}{\isasymA}}} (\verb+\+\verb+<A>+) and \isa{{\isaliteral{5C3C41413E}{\isasymAA}}} (\verb+\+\verb+<AA>+), and the control symbols
17187
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   140
  \verb+\+\verb+<^isub>+ and \verb+\+\verb+<^isup>+ for single letter
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   141
  sub and super scripts. This means that the input
14486
74c053a25513 symbols in idents
kleing
parents: 14379
diff changeset
   142
74c053a25513 symbols in idents
kleing
parents: 14379
diff changeset
   143
  \medskip
17187
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   144
  {\small\noindent \verb,\,\verb,<forall>\,\verb,<alpha>\<^isub>1.,~\verb,\,\verb,<alpha>\<^isub>1 = \,\verb,<Pi>\<^isup>\<A>,}
14486
74c053a25513 symbols in idents
kleing
parents: 14379
diff changeset
   145
74c053a25513 symbols in idents
kleing
parents: 14379
diff changeset
   146
  \medskip
40406
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   147
  \noindent is recognized as the term \isa{{\isaliteral{5C3C666F72616C6C3E}{\isasymforall}}{\isaliteral{5C3C616C7068613E}{\isasymalpha}}\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{1}}{\isaliteral{2E}{\isachardot}}\ {\isaliteral{5C3C616C7068613E}{\isasymalpha}}\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{1}}\ {\isaliteral{3D}{\isacharequal}}\ {\isaliteral{5C3C50693E}{\isasymPi}}\isaliteral{5C3C5E697375703E}{}\isactrlisup {\isaliteral{5C3C413E}{\isasymA}}} 
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   148
  by Isabelle. Note that \isa{{\isaliteral{5C3C50693E}{\isasymPi}}\isaliteral{5C3C5E697375703E}{}\isactrlisup {\isaliteral{5C3C413E}{\isasymA}}} is a single
17187
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   149
  syntactic entity, not an exponentiation.
14486
74c053a25513 symbols in idents
kleing
parents: 14379
diff changeset
   150
25338
6eb185959aec updated to notation and abbreviation
nipkow
parents: 17196
diff changeset
   151
  Replacing our previous definition of \isa{xor} by the
17187
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   152
  following specifies an Isabelle symbol for the new operator:%
12635
e2d44df29c94 more on concrete syntax;
wenzelm
parents: 12627
diff changeset
   153
\end{isamarkuptext}%
17175
1eced27ee0e1 updated;
wenzelm
parents: 17056
diff changeset
   154
\isamarkuptrue%
17056
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   155
%
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   156
\isadelimML
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   157
%
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   158
\endisadelimML
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   159
%
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   160
\isatagML
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   161
%
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   162
\endisatagML
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   163
{\isafoldML}%
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   164
%
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   165
\isadelimML
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   166
%
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   167
\endisadelimML
27015
f8537d69f514 *** empty log message ***
nipkow
parents: 25401
diff changeset
   168
\isacommand{definition}\isamarkupfalse%
40406
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   169
\ xor\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{22}{\isachardoublequoteopen}}bool\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ bool\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ bool{\isaliteral{22}{\isachardoublequoteclose}}\ \ \ \ {\isaliteral{28}{\isacharparenleft}}\isakeyword{infixl}\ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{5C3C6F706C75733E}{\isasymoplus}}{\isaliteral{22}{\isachardoublequoteclose}}\ {\isadigit{6}}{\isadigit{0}}{\isaliteral{29}{\isacharparenright}}\isanewline
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   170
\isakeyword{where}\ {\isaliteral{22}{\isachardoublequoteopen}}A\ {\isaliteral{5C3C6F706C75733E}{\isasymoplus}}\ B\ {\isaliteral{5C3C65717569763E}{\isasymequiv}}\ {\isaliteral{28}{\isacharparenleft}}A\ {\isaliteral{5C3C616E643E}{\isasymand}}\ {\isaliteral{5C3C6E6F743E}{\isasymnot}}\ B{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C6F723E}{\isasymor}}\ {\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C6E6F743E}{\isasymnot}}\ A\ {\isaliteral{5C3C616E643E}{\isasymand}}\ B{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequoteclose}}%
38765
5aa8e5e770a8 eliminated old 'local' command;
wenzelm
parents: 30649
diff changeset
   171
\isadelimML
5aa8e5e770a8 eliminated old 'local' command;
wenzelm
parents: 30649
diff changeset
   172
%
5aa8e5e770a8 eliminated old 'local' command;
wenzelm
parents: 30649
diff changeset
   173
\endisadelimML
5aa8e5e770a8 eliminated old 'local' command;
wenzelm
parents: 30649
diff changeset
   174
%
5aa8e5e770a8 eliminated old 'local' command;
wenzelm
parents: 30649
diff changeset
   175
\isatagML
5aa8e5e770a8 eliminated old 'local' command;
wenzelm
parents: 30649
diff changeset
   176
%
5aa8e5e770a8 eliminated old 'local' command;
wenzelm
parents: 30649
diff changeset
   177
\endisatagML
5aa8e5e770a8 eliminated old 'local' command;
wenzelm
parents: 30649
diff changeset
   178
{\isafoldML}%
5aa8e5e770a8 eliminated old 'local' command;
wenzelm
parents: 30649
diff changeset
   179
%
5aa8e5e770a8 eliminated old 'local' command;
wenzelm
parents: 30649
diff changeset
   180
\isadelimML
5aa8e5e770a8 eliminated old 'local' command;
wenzelm
parents: 30649
diff changeset
   181
%
5aa8e5e770a8 eliminated old 'local' command;
wenzelm
parents: 30649
diff changeset
   182
\endisadelimML
5aa8e5e770a8 eliminated old 'local' command;
wenzelm
parents: 30649
diff changeset
   183
%
12635
e2d44df29c94 more on concrete syntax;
wenzelm
parents: 12627
diff changeset
   184
\begin{isamarkuptext}%
47822
34b44d28fc4b some updates concerning current Proof General 4.x, which lacks X-Symbol mode of 3.x;
wenzelm
parents: 45106
diff changeset
   185
\noindent Proof~General provides several input methods to enter
34b44d28fc4b some updates concerning current Proof General 4.x, which lacks X-Symbol mode of 3.x;
wenzelm
parents: 45106
diff changeset
   186
  \isa{{\isaliteral{5C3C6F706C75733E}{\isasymoplus}}} in the text.  If all fails one may just type a named
34b44d28fc4b some updates concerning current Proof General 4.x, which lacks X-Symbol mode of 3.x;
wenzelm
parents: 45106
diff changeset
   187
  entity \verb,\,\verb,<oplus>, by hand; the corresponding symbol will
34b44d28fc4b some updates concerning current Proof General 4.x, which lacks X-Symbol mode of 3.x;
wenzelm
parents: 45106
diff changeset
   188
  be displayed after further input.
12635
e2d44df29c94 more on concrete syntax;
wenzelm
parents: 12627
diff changeset
   189
25338
6eb185959aec updated to notation and abbreviation
nipkow
parents: 17196
diff changeset
   190
  More flexible is to provide alternative syntax forms
12767
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   191
  through the \bfindex{print mode} concept~\cite{isabelle-ref}.  By
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   192
  convention, the mode of ``$xsymbols$'' is enabled whenever
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   193
  Proof~General's X-Symbol mode or {\LaTeX} output is active.  Now
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   194
  consider the following hybrid declaration of \isa{xor}:%
12635
e2d44df29c94 more on concrete syntax;
wenzelm
parents: 12627
diff changeset
   195
\end{isamarkuptext}%
17175
1eced27ee0e1 updated;
wenzelm
parents: 17056
diff changeset
   196
\isamarkuptrue%
17056
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   197
%
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   198
\isadelimML
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   199
%
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   200
\endisadelimML
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   201
%
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   202
\isatagML
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   203
%
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   204
\endisatagML
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   205
{\isafoldML}%
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   206
%
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   207
\isadelimML
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   208
%
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   209
\endisadelimML
27015
f8537d69f514 *** empty log message ***
nipkow
parents: 25401
diff changeset
   210
\isacommand{definition}\isamarkupfalse%
40406
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   211
\ xor\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{22}{\isachardoublequoteopen}}bool\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ bool\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ bool{\isaliteral{22}{\isachardoublequoteclose}}\ \ \ \ {\isaliteral{28}{\isacharparenleft}}\isakeyword{infixl}\ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{2B}{\isacharplus}}{\isaliteral{5D}{\isacharbrackright}}{\isaliteral{5C3C69676E6F72653E}{\isasymignore}}{\isaliteral{22}{\isachardoublequoteclose}}\ {\isadigit{6}}{\isadigit{0}}{\isaliteral{29}{\isacharparenright}}\isanewline
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   212
\isakeyword{where}\ {\isaliteral{22}{\isachardoublequoteopen}}A\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{2B}{\isacharplus}}{\isaliteral{5D}{\isacharbrackright}}{\isaliteral{5C3C69676E6F72653E}{\isasymignore}}\ B\ {\isaliteral{5C3C65717569763E}{\isasymequiv}}\ {\isaliteral{28}{\isacharparenleft}}A\ {\isaliteral{5C3C616E643E}{\isasymand}}\ {\isaliteral{5C3C6E6F743E}{\isasymnot}}\ B{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C6F723E}{\isasymor}}\ {\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C6E6F743E}{\isasymnot}}\ A\ {\isaliteral{5C3C616E643E}{\isasymand}}\ B{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequoteclose}}\isanewline
17175
1eced27ee0e1 updated;
wenzelm
parents: 17056
diff changeset
   213
\isanewline
25338
6eb185959aec updated to notation and abbreviation
nipkow
parents: 17196
diff changeset
   214
\isacommand{notation}\isamarkupfalse%
40406
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   215
\ {\isaliteral{28}{\isacharparenleft}}xsymbols{\isaliteral{29}{\isacharparenright}}\ xor\ {\isaliteral{28}{\isacharparenleft}}\isakeyword{infixl}\ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{5C3C6F706C75733E}{\isasymoplus}}{\isaliteral{5C3C69676E6F72653E}{\isasymignore}}{\isaliteral{22}{\isachardoublequoteclose}}\ {\isadigit{6}}{\isadigit{0}}{\isaliteral{29}{\isacharparenright}}%
38765
5aa8e5e770a8 eliminated old 'local' command;
wenzelm
parents: 30649
diff changeset
   216
\isadelimML
5aa8e5e770a8 eliminated old 'local' command;
wenzelm
parents: 30649
diff changeset
   217
%
5aa8e5e770a8 eliminated old 'local' command;
wenzelm
parents: 30649
diff changeset
   218
\endisadelimML
5aa8e5e770a8 eliminated old 'local' command;
wenzelm
parents: 30649
diff changeset
   219
%
5aa8e5e770a8 eliminated old 'local' command;
wenzelm
parents: 30649
diff changeset
   220
\isatagML
5aa8e5e770a8 eliminated old 'local' command;
wenzelm
parents: 30649
diff changeset
   221
%
5aa8e5e770a8 eliminated old 'local' command;
wenzelm
parents: 30649
diff changeset
   222
\endisatagML
5aa8e5e770a8 eliminated old 'local' command;
wenzelm
parents: 30649
diff changeset
   223
{\isafoldML}%
5aa8e5e770a8 eliminated old 'local' command;
wenzelm
parents: 30649
diff changeset
   224
%
5aa8e5e770a8 eliminated old 'local' command;
wenzelm
parents: 30649
diff changeset
   225
\isadelimML
5aa8e5e770a8 eliminated old 'local' command;
wenzelm
parents: 30649
diff changeset
   226
%
5aa8e5e770a8 eliminated old 'local' command;
wenzelm
parents: 30649
diff changeset
   227
\endisadelimML
5aa8e5e770a8 eliminated old 'local' command;
wenzelm
parents: 30649
diff changeset
   228
%
12635
e2d44df29c94 more on concrete syntax;
wenzelm
parents: 12627
diff changeset
   229
\begin{isamarkuptext}%
27015
f8537d69f514 *** empty log message ***
nipkow
parents: 25401
diff changeset
   230
\noindent
25338
6eb185959aec updated to notation and abbreviation
nipkow
parents: 17196
diff changeset
   231
The \commdx{notation} command associates a mixfix
27015
f8537d69f514 *** empty log message ***
nipkow
parents: 25401
diff changeset
   232
annotation with a known constant.  The print mode specification,
40406
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   233
here \isa{{\isaliteral{28}{\isacharparenleft}}xsymbols{\isaliteral{29}{\isacharparenright}}}, is optional.
12635
e2d44df29c94 more on concrete syntax;
wenzelm
parents: 12627
diff changeset
   234
40406
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   235
We may now write \isa{A\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{2B}{\isacharplus}}{\isaliteral{5D}{\isacharbrackright}}\ B} or \isa{A\ {\isaliteral{5C3C6F706C75733E}{\isasymoplus}}\ B} in input, while
25338
6eb185959aec updated to notation and abbreviation
nipkow
parents: 17196
diff changeset
   236
output uses the nicer syntax of $xsymbols$ whenever that print mode is
6eb185959aec updated to notation and abbreviation
nipkow
parents: 17196
diff changeset
   237
active.  Such an arrangement is particularly useful for interactive
6eb185959aec updated to notation and abbreviation
nipkow
parents: 17196
diff changeset
   238
development, where users may type ASCII text and see mathematical
6eb185959aec updated to notation and abbreviation
nipkow
parents: 17196
diff changeset
   239
symbols displayed during proofs.%
12635
e2d44df29c94 more on concrete syntax;
wenzelm
parents: 12627
diff changeset
   240
\end{isamarkuptext}%
12627
08eee994bf99 updated;
wenzelm
parents: 11866
diff changeset
   241
\isamarkuptrue%
12635
e2d44df29c94 more on concrete syntax;
wenzelm
parents: 12627
diff changeset
   242
%
12647
001d10bbc61b updated;
wenzelm
parents: 12644
diff changeset
   243
\isamarkupsubsection{Prefix Annotations%
12635
e2d44df29c94 more on concrete syntax;
wenzelm
parents: 12627
diff changeset
   244
}
12627
08eee994bf99 updated;
wenzelm
parents: 11866
diff changeset
   245
\isamarkuptrue%
12635
e2d44df29c94 more on concrete syntax;
wenzelm
parents: 12627
diff changeset
   246
%
e2d44df29c94 more on concrete syntax;
wenzelm
parents: 12627
diff changeset
   247
\begin{isamarkuptext}%
12767
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   248
Prefix syntax annotations\index{prefix annotation} are another form
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   249
  of mixfixes \cite{isabelle-ref}, without any template arguments or
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   250
  priorities --- just some literal syntax.  The following example
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   251
  associates common symbols with the constructors of a datatype.%
12635
e2d44df29c94 more on concrete syntax;
wenzelm
parents: 12627
diff changeset
   252
\end{isamarkuptext}%
17175
1eced27ee0e1 updated;
wenzelm
parents: 17056
diff changeset
   253
\isamarkuptrue%
1eced27ee0e1 updated;
wenzelm
parents: 17056
diff changeset
   254
\isacommand{datatype}\isamarkupfalse%
40406
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   255
\ currency\ {\isaliteral{3D}{\isacharequal}}\isanewline
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   256
\ \ \ \ Euro\ nat\ \ \ \ {\isaliteral{28}{\isacharparenleft}}{\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{5C3C6575726F3E}{\isasymeuro}}{\isaliteral{22}{\isachardoublequoteclose}}{\isaliteral{29}{\isacharparenright}}\isanewline
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   257
\ \ {\isaliteral{7C}{\isacharbar}}\ Pounds\ nat\ \ {\isaliteral{28}{\isacharparenleft}}{\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{5C3C706F756E64733E}{\isasympounds}}{\isaliteral{22}{\isachardoublequoteclose}}{\isaliteral{29}{\isacharparenright}}\isanewline
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   258
\ \ {\isaliteral{7C}{\isacharbar}}\ Yen\ nat\ \ \ \ \ {\isaliteral{28}{\isacharparenleft}}{\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{5C3C79656E3E}{\isasymyen}}{\isaliteral{22}{\isachardoublequoteclose}}{\isaliteral{29}{\isacharparenright}}\isanewline
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   259
\ \ {\isaliteral{7C}{\isacharbar}}\ Dollar\ nat\ \ {\isaliteral{28}{\isacharparenleft}}{\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{24}{\isachardollar}}{\isaliteral{22}{\isachardoublequoteclose}}{\isaliteral{29}{\isacharparenright}}%
12635
e2d44df29c94 more on concrete syntax;
wenzelm
parents: 12627
diff changeset
   260
\begin{isamarkuptext}%
12652
2d136f05e164 updated;
wenzelm
parents: 12649
diff changeset
   261
\noindent Here the mixfix annotations on the rightmost column happen
2d136f05e164 updated;
wenzelm
parents: 12649
diff changeset
   262
  to consist of a single Isabelle symbol each: \verb,\,\verb,<euro>,,
2d136f05e164 updated;
wenzelm
parents: 12649
diff changeset
   263
  \verb,\,\verb,<pounds>,, \verb,\,\verb,<yen>,, and \verb,$,.  Recall
40406
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   264
  that a constructor like \isa{Euro} actually is a function \isa{nat\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ currency}.  The expression \isa{Euro\ {\isadigit{1}}{\isadigit{0}}} will be
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   265
  printed as \isa{{\isaliteral{5C3C6575726F3E}{\isasymeuro}}\ {\isadigit{1}}{\isadigit{0}}}; only the head of the application is
12743
wenzelm
parents: 12686
diff changeset
   266
  subject to our concrete syntax.  This rather simple form already
wenzelm
parents: 12686
diff changeset
   267
  achieves conformance with notational standards of the European
wenzelm
parents: 12686
diff changeset
   268
  Commission.
12635
e2d44df29c94 more on concrete syntax;
wenzelm
parents: 12627
diff changeset
   269
27015
f8537d69f514 *** empty log message ***
nipkow
parents: 25401
diff changeset
   270
  Prefix syntax works the same way for other commands that introduce new constants, e.g. \isakeyword{primrec}.%
12649
6e17f2ae9e16 updated;
wenzelm
parents: 12647
diff changeset
   271
\end{isamarkuptext}%
6e17f2ae9e16 updated;
wenzelm
parents: 12647
diff changeset
   272
\isamarkuptrue%
6e17f2ae9e16 updated;
wenzelm
parents: 12647
diff changeset
   273
%
25338
6eb185959aec updated to notation and abbreviation
nipkow
parents: 17196
diff changeset
   274
\isamarkupsubsection{Abbreviations \label{sec:abbreviations}%
12635
e2d44df29c94 more on concrete syntax;
wenzelm
parents: 12627
diff changeset
   275
}
12627
08eee994bf99 updated;
wenzelm
parents: 11866
diff changeset
   276
\isamarkuptrue%
12635
e2d44df29c94 more on concrete syntax;
wenzelm
parents: 12627
diff changeset
   277
%
e2d44df29c94 more on concrete syntax;
wenzelm
parents: 12627
diff changeset
   278
\begin{isamarkuptext}%
12767
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   279
Mixfix syntax annotations merely decorate particular constant
25338
6eb185959aec updated to notation and abbreviation
nipkow
parents: 17196
diff changeset
   280
application forms with concrete syntax, for instance replacing
40406
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   281
\isa{xor\ A\ B} by \isa{A\ {\isaliteral{5C3C6F706C75733E}{\isasymoplus}}\ B}.  Occasionally, the relationship
25338
6eb185959aec updated to notation and abbreviation
nipkow
parents: 17196
diff changeset
   282
between some piece of notation and its internal form is more
6eb185959aec updated to notation and abbreviation
nipkow
parents: 17196
diff changeset
   283
complicated.  Here we need \emph{abbreviations}.
12635
e2d44df29c94 more on concrete syntax;
wenzelm
parents: 12627
diff changeset
   284
25338
6eb185959aec updated to notation and abbreviation
nipkow
parents: 17196
diff changeset
   285
Command \commdx{abbreviation} introduces an uninterpreted notational
6eb185959aec updated to notation and abbreviation
nipkow
parents: 17196
diff changeset
   286
constant as an abbreviation for a complex term. Abbreviations are
6eb185959aec updated to notation and abbreviation
nipkow
parents: 17196
diff changeset
   287
unfolded upon parsing and re-introduced upon printing. This provides a
6eb185959aec updated to notation and abbreviation
nipkow
parents: 17196
diff changeset
   288
simple mechanism for syntactic macros.
12649
6e17f2ae9e16 updated;
wenzelm
parents: 12647
diff changeset
   289
25338
6eb185959aec updated to notation and abbreviation
nipkow
parents: 17196
diff changeset
   290
A typical use of abbreviations is to introduce relational notation for
40406
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   291
membership in a set of pairs, replacing \isa{{\isaliteral{28}{\isacharparenleft}}x{\isaliteral{2C}{\isacharcomma}}\ y{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C696E3E}{\isasymin}}\ sim} by
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   292
\isa{x\ {\isaliteral{5C3C617070726F783E}{\isasymapprox}}\ y}. We assume that a constant \isa{sim} of type
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   293
\isa{{\isaliteral{28}{\isacharparenleft}}{\isaliteral{27}{\isacharprime}}a\ {\isaliteral{5C3C74696D65733E}{\isasymtimes}}\ {\isaliteral{27}{\isacharprime}}a{\isaliteral{29}{\isacharparenright}}\ set} has been introduced at this point.%
12635
e2d44df29c94 more on concrete syntax;
wenzelm
parents: 12627
diff changeset
   294
\end{isamarkuptext}%
17175
1eced27ee0e1 updated;
wenzelm
parents: 17056
diff changeset
   295
\isamarkuptrue%
25338
6eb185959aec updated to notation and abbreviation
nipkow
parents: 17196
diff changeset
   296
\isacommand{abbreviation}\isamarkupfalse%
40406
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   297
\ sim{\isadigit{2}}\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{27}{\isacharprime}}a\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ {\isaliteral{27}{\isacharprime}}a\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ bool{\isaliteral{22}{\isachardoublequoteclose}}\ \ \ {\isaliteral{28}{\isacharparenleft}}\isakeyword{infix}\ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{5C3C617070726F783E}{\isasymapprox}}{\isaliteral{22}{\isachardoublequoteclose}}\ {\isadigit{5}}{\isadigit{0}}{\isaliteral{29}{\isacharparenright}}\isanewline
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   298
\isakeyword{where}\ {\isaliteral{22}{\isachardoublequoteopen}}x\ {\isaliteral{5C3C617070726F783E}{\isasymapprox}}\ y\ \ {\isaliteral{5C3C65717569763E}{\isasymequiv}}\ \ {\isaliteral{28}{\isacharparenleft}}x{\isaliteral{2C}{\isacharcomma}}\ y{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C696E3E}{\isasymin}}\ sim{\isaliteral{22}{\isachardoublequoteclose}}%
12635
e2d44df29c94 more on concrete syntax;
wenzelm
parents: 12627
diff changeset
   299
\begin{isamarkuptext}%
25338
6eb185959aec updated to notation and abbreviation
nipkow
parents: 17196
diff changeset
   300
\noindent The given meta-equality is used as a rewrite rule
40406
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   301
after parsing (replacing \mbox{\isa{x\ {\isaliteral{5C3C617070726F783E}{\isasymapprox}}\ y}} by \isa{{\isaliteral{28}{\isacharparenleft}}x{\isaliteral{2C}{\isacharcomma}}y{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C696E3E}{\isasymin}}\ sim}) and before printing (turning \isa{{\isaliteral{28}{\isacharparenleft}}x{\isaliteral{2C}{\isacharcomma}}y{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C696E3E}{\isasymin}}\ sim} back into
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   302
\mbox{\isa{x\ {\isaliteral{5C3C617070726F783E}{\isasymapprox}}\ y}}). The name of the dummy constant \isa{sim{\isadigit{2}}}
25338
6eb185959aec updated to notation and abbreviation
nipkow
parents: 17196
diff changeset
   303
does not matter, as long as it is unique.
12635
e2d44df29c94 more on concrete syntax;
wenzelm
parents: 12627
diff changeset
   304
25338
6eb185959aec updated to notation and abbreviation
nipkow
parents: 17196
diff changeset
   305
Another common application of abbreviations is to
6eb185959aec updated to notation and abbreviation
nipkow
parents: 17196
diff changeset
   306
provide variant versions of fundamental relational expressions, such
40406
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   307
as \isa{{\isaliteral{5C3C6E6F7465713E}{\isasymnoteq}}} for negated equalities.  The following declaration
25338
6eb185959aec updated to notation and abbreviation
nipkow
parents: 17196
diff changeset
   308
stems from Isabelle/HOL itself:%
12649
6e17f2ae9e16 updated;
wenzelm
parents: 12647
diff changeset
   309
\end{isamarkuptext}%
17175
1eced27ee0e1 updated;
wenzelm
parents: 17056
diff changeset
   310
\isamarkuptrue%
25338
6eb185959aec updated to notation and abbreviation
nipkow
parents: 17196
diff changeset
   311
\isacommand{abbreviation}\isamarkupfalse%
40406
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   312
\ not{\isaliteral{5F}{\isacharunderscore}}equal\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{27}{\isacharprime}}a\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ {\isaliteral{27}{\isacharprime}}a\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ bool{\isaliteral{22}{\isachardoublequoteclose}}\ \ \ \ {\isaliteral{28}{\isacharparenleft}}\isakeyword{infixl}\ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{7E}{\isachartilde}}{\isaliteral{3D}{\isacharequal}}{\isaliteral{5C3C69676E6F72653E}{\isasymignore}}{\isaliteral{22}{\isachardoublequoteclose}}\ {\isadigit{5}}{\isadigit{0}}{\isaliteral{29}{\isacharparenright}}\isanewline
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   313
\isakeyword{where}\ {\isaliteral{22}{\isachardoublequoteopen}}x\ {\isaliteral{7E}{\isachartilde}}{\isaliteral{3D}{\isacharequal}}{\isaliteral{5C3C69676E6F72653E}{\isasymignore}}\ y\ \ {\isaliteral{5C3C65717569763E}{\isasymequiv}}\ \ {\isaliteral{5C3C6E6F743E}{\isasymnot}}\ {\isaliteral{28}{\isacharparenleft}}x\ {\isaliteral{3D}{\isacharequal}}\ y{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequoteclose}}\isanewline
25338
6eb185959aec updated to notation and abbreviation
nipkow
parents: 17196
diff changeset
   314
\isanewline
6eb185959aec updated to notation and abbreviation
nipkow
parents: 17196
diff changeset
   315
\isacommand{notation}\isamarkupfalse%
40406
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   316
\ {\isaliteral{28}{\isacharparenleft}}xsymbols{\isaliteral{29}{\isacharparenright}}\ not{\isaliteral{5F}{\isacharunderscore}}equal\ {\isaliteral{28}{\isacharparenleft}}\isakeyword{infix}\ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{5C3C6E6F7465713E}{\isasymnoteq}}{\isaliteral{5C3C69676E6F72653E}{\isasymignore}}{\isaliteral{22}{\isachardoublequoteclose}}\ {\isadigit{5}}{\isadigit{0}}{\isaliteral{29}{\isacharparenright}}%
12649
6e17f2ae9e16 updated;
wenzelm
parents: 12647
diff changeset
   317
\begin{isamarkuptext}%
40406
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   318
\noindent The notation \isa{{\isaliteral{5C3C6E6F7465713E}{\isasymnoteq}}} is introduced separately to restrict it
25338
6eb185959aec updated to notation and abbreviation
nipkow
parents: 17196
diff changeset
   319
to the \emph{xsymbols} mode.
12649
6e17f2ae9e16 updated;
wenzelm
parents: 12647
diff changeset
   320
27015
f8537d69f514 *** empty log message ***
nipkow
parents: 25401
diff changeset
   321
Abbreviations are appropriate when the defined concept is a
25338
6eb185959aec updated to notation and abbreviation
nipkow
parents: 17196
diff changeset
   322
simple variation on an existing one.  But because of the automatic
6eb185959aec updated to notation and abbreviation
nipkow
parents: 17196
diff changeset
   323
folding and unfolding of abbreviations, they do not scale up well to
6eb185959aec updated to notation and abbreviation
nipkow
parents: 17196
diff changeset
   324
large hierarchies of concepts. Abbreviations do not replace
6eb185959aec updated to notation and abbreviation
nipkow
parents: 17196
diff changeset
   325
definitions.
6eb185959aec updated to notation and abbreviation
nipkow
parents: 17196
diff changeset
   326
6eb185959aec updated to notation and abbreviation
nipkow
parents: 17196
diff changeset
   327
Abbreviations are a simplified form of the general concept of
6eb185959aec updated to notation and abbreviation
nipkow
parents: 17196
diff changeset
   328
\emph{syntax translations}; even heavier transformations may be
6eb185959aec updated to notation and abbreviation
nipkow
parents: 17196
diff changeset
   329
written in ML \cite{isabelle-ref}.%
12635
e2d44df29c94 more on concrete syntax;
wenzelm
parents: 12627
diff changeset
   330
\end{isamarkuptext}%
12627
08eee994bf99 updated;
wenzelm
parents: 11866
diff changeset
   331
\isamarkuptrue%
12635
e2d44df29c94 more on concrete syntax;
wenzelm
parents: 12627
diff changeset
   332
%
12652
2d136f05e164 updated;
wenzelm
parents: 12649
diff changeset
   333
\isamarkupsection{Document Preparation \label{sec:document-preparation}%
12635
e2d44df29c94 more on concrete syntax;
wenzelm
parents: 12627
diff changeset
   334
}
e2d44df29c94 more on concrete syntax;
wenzelm
parents: 12627
diff changeset
   335
\isamarkuptrue%
e2d44df29c94 more on concrete syntax;
wenzelm
parents: 12627
diff changeset
   336
%
12644
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   337
\begin{isamarkuptext}%
12652
2d136f05e164 updated;
wenzelm
parents: 12649
diff changeset
   338
Isabelle/Isar is centered around the concept of \bfindex{formal
12767
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   339
  proof documents}\index{documents|bold}.  The outcome of a formal
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   340
  development effort is meant to be a human-readable record, presented
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   341
  as browsable PDF file or printed on paper.  The overall document
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   342
  structure follows traditional mathematical articles, with sections,
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   343
  intermediate explanations, definitions, theorems and proofs.
12644
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   344
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   345
  \medskip The Isabelle document preparation system essentially acts
12671
bb6db6c0d4df updated;
wenzelm
parents: 12666
diff changeset
   346
  as a front-end to {\LaTeX}.  After checking specifications and
bb6db6c0d4df updated;
wenzelm
parents: 12666
diff changeset
   347
  proofs formally, the theory sources are turned into typesetting
12767
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   348
  instructions in a schematic manner.  This lets you write authentic
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   349
  reports on theory developments with little effort: many technical
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   350
  consistency checks are handled by the system.
12745
d7b4d8c9bf86 updated;
wenzelm
parents: 12743
diff changeset
   351
d7b4d8c9bf86 updated;
wenzelm
parents: 12743
diff changeset
   352
  Here is an example to illustrate the idea of Isabelle document
12747
cc59ceb0bcb4 updated;
wenzelm
parents: 12745
diff changeset
   353
  preparation.%
cc59ceb0bcb4 updated;
wenzelm
parents: 12745
diff changeset
   354
\end{isamarkuptext}%
17175
1eced27ee0e1 updated;
wenzelm
parents: 17056
diff changeset
   355
\isamarkuptrue%
12747
cc59ceb0bcb4 updated;
wenzelm
parents: 12745
diff changeset
   356
%
cc59ceb0bcb4 updated;
wenzelm
parents: 12745
diff changeset
   357
\begin{quotation}
cc59ceb0bcb4 updated;
wenzelm
parents: 12745
diff changeset
   358
%
cc59ceb0bcb4 updated;
wenzelm
parents: 12745
diff changeset
   359
\begin{isamarkuptext}%
40406
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   360
The following datatype definition of \isa{{\isaliteral{27}{\isacharprime}}a\ bintree} models
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   361
  binary trees with nodes being decorated by elements of type \isa{{\isaliteral{27}{\isacharprime}}a}.%
12745
d7b4d8c9bf86 updated;
wenzelm
parents: 12743
diff changeset
   362
\end{isamarkuptext}%
17175
1eced27ee0e1 updated;
wenzelm
parents: 17056
diff changeset
   363
\isamarkuptrue%
1eced27ee0e1 updated;
wenzelm
parents: 17056
diff changeset
   364
\isacommand{datatype}\isamarkupfalse%
40406
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   365
\ {\isaliteral{27}{\isacharprime}}a\ bintree\ {\isaliteral{3D}{\isacharequal}}\isanewline
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   366
\ \ \ \ \ Leaf\ {\isaliteral{7C}{\isacharbar}}\ Branch\ {\isaliteral{27}{\isacharprime}}a\ \ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{27}{\isacharprime}}a\ bintree{\isaliteral{22}{\isachardoublequoteclose}}\ \ {\isaliteral{22}{\isachardoublequoteopen}}{\isaliteral{27}{\isacharprime}}a\ bintree{\isaliteral{22}{\isachardoublequoteclose}}%
12745
d7b4d8c9bf86 updated;
wenzelm
parents: 12743
diff changeset
   367
\begin{isamarkuptext}%
d7b4d8c9bf86 updated;
wenzelm
parents: 12743
diff changeset
   368
\noindent The datatype induction rule generated here is of the form
d7b4d8c9bf86 updated;
wenzelm
parents: 12743
diff changeset
   369
  \begin{isabelle}%
40406
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   370
\ {\isaliteral{5C3C6C6272616B6B3E}{\isasymlbrakk}}P\ Leaf{\isaliteral{3B}{\isacharsemicolon}}\isanewline
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   371
\isaindent{\ \ }{\isaliteral{5C3C416E643E}{\isasymAnd}}a\ bintree{\isadigit{1}}\ bintree{\isadigit{2}}{\isaliteral{2E}{\isachardot}}\isanewline
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   372
\isaindent{\ \ \ \ \ }{\isaliteral{5C3C6C6272616B6B3E}{\isasymlbrakk}}P\ bintree{\isadigit{1}}{\isaliteral{3B}{\isacharsemicolon}}\ P\ bintree{\isadigit{2}}{\isaliteral{5C3C726272616B6B3E}{\isasymrbrakk}}\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ P\ {\isaliteral{28}{\isacharparenleft}}Branch\ a\ bintree{\isadigit{1}}\ bintree{\isadigit{2}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{5C3C726272616B6B3E}{\isasymrbrakk}}\isanewline
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   373
\isaindent{\ }{\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ P\ bintree%
12747
cc59ceb0bcb4 updated;
wenzelm
parents: 12745
diff changeset
   374
\end{isabelle}%
cc59ceb0bcb4 updated;
wenzelm
parents: 12745
diff changeset
   375
\end{isamarkuptext}%
17175
1eced27ee0e1 updated;
wenzelm
parents: 17056
diff changeset
   376
\isamarkuptrue%
12747
cc59ceb0bcb4 updated;
wenzelm
parents: 12745
diff changeset
   377
%
cc59ceb0bcb4 updated;
wenzelm
parents: 12745
diff changeset
   378
\end{quotation}
cc59ceb0bcb4 updated;
wenzelm
parents: 12745
diff changeset
   379
%
cc59ceb0bcb4 updated;
wenzelm
parents: 12745
diff changeset
   380
\begin{isamarkuptext}%
12767
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   381
\noindent The above document output has been produced as follows:
12745
d7b4d8c9bf86 updated;
wenzelm
parents: 12743
diff changeset
   382
d7b4d8c9bf86 updated;
wenzelm
parents: 12743
diff changeset
   383
  \begin{ttbox}
d7b4d8c9bf86 updated;
wenzelm
parents: 12743
diff changeset
   384
  text {\ttlbrace}*
d7b4d8c9bf86 updated;
wenzelm
parents: 12743
diff changeset
   385
    The following datatype definition of {\at}{\ttlbrace}text "'a bintree"{\ttrbrace}
d7b4d8c9bf86 updated;
wenzelm
parents: 12743
diff changeset
   386
    models binary trees with nodes being decorated by elements
d7b4d8c9bf86 updated;
wenzelm
parents: 12743
diff changeset
   387
    of type {\at}{\ttlbrace}typ 'a{\ttrbrace}.
d7b4d8c9bf86 updated;
wenzelm
parents: 12743
diff changeset
   388
  *{\ttrbrace}
d7b4d8c9bf86 updated;
wenzelm
parents: 12743
diff changeset
   389
d7b4d8c9bf86 updated;
wenzelm
parents: 12743
diff changeset
   390
  datatype 'a bintree =
d7b4d8c9bf86 updated;
wenzelm
parents: 12743
diff changeset
   391
    Leaf | Branch 'a  "'a bintree"  "'a bintree"
12767
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   392
  \end{ttbox}
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   393
  \begin{ttbox}
12745
d7b4d8c9bf86 updated;
wenzelm
parents: 12743
diff changeset
   394
  text {\ttlbrace}*
d7b4d8c9bf86 updated;
wenzelm
parents: 12743
diff changeset
   395
    {\ttback}noindent The datatype induction rule generated here is
d7b4d8c9bf86 updated;
wenzelm
parents: 12743
diff changeset
   396
    of the form {\at}{\ttlbrace}thm [display] bintree.induct [no_vars]{\ttrbrace}
d7b4d8c9bf86 updated;
wenzelm
parents: 12743
diff changeset
   397
  *{\ttrbrace}
12767
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   398
  \end{ttbox}\vspace{-\medskipamount}
12745
d7b4d8c9bf86 updated;
wenzelm
parents: 12743
diff changeset
   399
12747
cc59ceb0bcb4 updated;
wenzelm
parents: 12745
diff changeset
   400
  \noindent Here we have augmented the theory by formal comments
12767
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   401
  (using \isakeyword{text} blocks), the informal parts may again refer
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   402
  to formal entities by means of ``antiquotations'' (such as
12745
d7b4d8c9bf86 updated;
wenzelm
parents: 12743
diff changeset
   403
  \texttt{\at}\verb,{text "'a bintree"}, or
12747
cc59ceb0bcb4 updated;
wenzelm
parents: 12745
diff changeset
   404
  \texttt{\at}\verb,{typ 'a},), see also \S\ref{sec:doc-prep-text}.%
12644
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   405
\end{isamarkuptext}%
12635
e2d44df29c94 more on concrete syntax;
wenzelm
parents: 12627
diff changeset
   406
\isamarkuptrue%
e2d44df29c94 more on concrete syntax;
wenzelm
parents: 12627
diff changeset
   407
%
12647
001d10bbc61b updated;
wenzelm
parents: 12644
diff changeset
   408
\isamarkupsubsection{Isabelle Sessions%
12635
e2d44df29c94 more on concrete syntax;
wenzelm
parents: 12627
diff changeset
   409
}
e2d44df29c94 more on concrete syntax;
wenzelm
parents: 12627
diff changeset
   410
\isamarkuptrue%
e2d44df29c94 more on concrete syntax;
wenzelm
parents: 12627
diff changeset
   411
%
e2d44df29c94 more on concrete syntax;
wenzelm
parents: 12627
diff changeset
   412
\begin{isamarkuptext}%
12652
2d136f05e164 updated;
wenzelm
parents: 12649
diff changeset
   413
In contrast to the highly interactive mode of Isabelle/Isar theory
2d136f05e164 updated;
wenzelm
parents: 12649
diff changeset
   414
  development, the document preparation stage essentially works in
12671
bb6db6c0d4df updated;
wenzelm
parents: 12666
diff changeset
   415
  batch-mode.  An Isabelle \bfindex{session} consists of a collection
12767
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   416
  of source files that may contribute to an output document.  Each
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   417
  session is derived from a single parent, usually an object-logic
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   418
  image like \texttt{HOL}.  This results in an overall tree structure,
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   419
  which is reflected by the output location in the file system
45106
3498077f2012 updated ISABELLE_HOME_USER;
wenzelm
parents: 40406
diff changeset
   420
  (usually rooted at \verb,~/.isabelle/IsabelleXXXX/browser_info,).
12644
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   421
12684
6095c8febf7c updated;
wenzelm
parents: 12682
diff changeset
   422
  \medskip The easiest way to manage Isabelle sessions is via
28838
d5db6dfcb34a moved table of standard Isabelle symbols to isar-ref manual;
wenzelm
parents: 27027
diff changeset
   423
  \texttt{isabelle mkdir} (generates an initial session source setup)
d5db6dfcb34a moved table of standard Isabelle symbols to isar-ref manual;
wenzelm
parents: 27027
diff changeset
   424
  and \texttt{isabelle make} (run sessions controlled by
12684
6095c8febf7c updated;
wenzelm
parents: 12682
diff changeset
   425
  \texttt{IsaMakefile}).  For example, a new session
6095c8febf7c updated;
wenzelm
parents: 12682
diff changeset
   426
  \texttt{MySession} derived from \texttt{HOL} may be produced as
6095c8febf7c updated;
wenzelm
parents: 12682
diff changeset
   427
  follows:
6095c8febf7c updated;
wenzelm
parents: 12682
diff changeset
   428
6095c8febf7c updated;
wenzelm
parents: 12682
diff changeset
   429
\begin{verbatim}
28838
d5db6dfcb34a moved table of standard Isabelle symbols to isar-ref manual;
wenzelm
parents: 27027
diff changeset
   430
  isabelle mkdir HOL MySession
d5db6dfcb34a moved table of standard Isabelle symbols to isar-ref manual;
wenzelm
parents: 27027
diff changeset
   431
  isabelle make
12684
6095c8febf7c updated;
wenzelm
parents: 12682
diff changeset
   432
\end{verbatim}
6095c8febf7c updated;
wenzelm
parents: 12682
diff changeset
   433
28838
d5db6dfcb34a moved table of standard Isabelle symbols to isar-ref manual;
wenzelm
parents: 27027
diff changeset
   434
  The \texttt{isabelle make} job also informs about the file-system
12686
2b0aa746e4b8 updated;
wenzelm
parents: 12684
diff changeset
   435
  location of the ultimate results.  The above dry run should be able
2b0aa746e4b8 updated;
wenzelm
parents: 12684
diff changeset
   436
  to produce some \texttt{document.pdf} (with dummy title, empty table
12743
wenzelm
parents: 12686
diff changeset
   437
  of contents etc.).  Any failure at this stage usually indicates
17187
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   438
  technical problems of the {\LaTeX} installation.
12684
6095c8febf7c updated;
wenzelm
parents: 12682
diff changeset
   439
6095c8febf7c updated;
wenzelm
parents: 12682
diff changeset
   440
  \medskip The detailed arrangement of the session sources is as
12747
cc59ceb0bcb4 updated;
wenzelm
parents: 12745
diff changeset
   441
  follows.
12644
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   442
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   443
  \begin{itemize}
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   444
12671
bb6db6c0d4df updated;
wenzelm
parents: 12666
diff changeset
   445
  \item Directory \texttt{MySession} holds the required theory files
bb6db6c0d4df updated;
wenzelm
parents: 12666
diff changeset
   446
  $T@1$\texttt{.thy}, \dots, $T@n$\texttt{.thy}.
12644
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   447
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   448
  \item File \texttt{MySession/ROOT.ML} holds appropriate ML commands
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   449
  for loading all wanted theories, usually just
12666
9842befead7a updated;
wenzelm
parents: 12658
diff changeset
   450
  ``\texttt{use_thy"$T@i$";}'' for any $T@i$ in leaf position of the
12671
bb6db6c0d4df updated;
wenzelm
parents: 12666
diff changeset
   451
  dependency graph.
12644
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   452
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   453
  \item Directory \texttt{MySession/document} contains everything
12652
2d136f05e164 updated;
wenzelm
parents: 12649
diff changeset
   454
  required for the {\LaTeX} stage; only \texttt{root.tex} needs to be
2d136f05e164 updated;
wenzelm
parents: 12649
diff changeset
   455
  provided initially.
12644
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   456
12652
2d136f05e164 updated;
wenzelm
parents: 12649
diff changeset
   457
  The latter file holds appropriate {\LaTeX} code to commence a
2d136f05e164 updated;
wenzelm
parents: 12649
diff changeset
   458
  document (\verb,\documentclass, etc.), and to include the generated
12743
wenzelm
parents: 12686
diff changeset
   459
  files $T@i$\texttt{.tex} for each theory.  Isabelle will generate a
wenzelm
parents: 12686
diff changeset
   460
  file \texttt{session.tex} holding {\LaTeX} commands to include all
12747
cc59ceb0bcb4 updated;
wenzelm
parents: 12745
diff changeset
   461
  generated theory output files in topologically sorted order, so
cc59ceb0bcb4 updated;
wenzelm
parents: 12745
diff changeset
   462
  \verb,\input{session}, in the body of \texttt{root.tex} does the job
cc59ceb0bcb4 updated;
wenzelm
parents: 12745
diff changeset
   463
  in most situations.
12652
2d136f05e164 updated;
wenzelm
parents: 12649
diff changeset
   464
12682
72ec0a86bb23 updated;
wenzelm
parents: 12674
diff changeset
   465
  \item \texttt{IsaMakefile} holds appropriate dependencies and
72ec0a86bb23 updated;
wenzelm
parents: 12674
diff changeset
   466
  invocations of Isabelle tools to control the batch job.  In fact,
12747
cc59ceb0bcb4 updated;
wenzelm
parents: 12745
diff changeset
   467
  several sessions may be managed by the same \texttt{IsaMakefile}.
12764
b43333dc6e7d stylistic changes
paulson
parents: 12751
diff changeset
   468
  See the \emph{Isabelle System Manual} \cite{isabelle-sys} 
b43333dc6e7d stylistic changes
paulson
parents: 12751
diff changeset
   469
  for further details, especially on
28838
d5db6dfcb34a moved table of standard Isabelle symbols to isar-ref manual;
wenzelm
parents: 27027
diff changeset
   470
  \texttt{isabelle usedir} and \texttt{isabelle make}.
12644
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   471
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   472
  \end{itemize}
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   473
12686
2b0aa746e4b8 updated;
wenzelm
parents: 12684
diff changeset
   474
  One may now start to populate the directory \texttt{MySession}, and
12767
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   475
  the file \texttt{MySession/ROOT.ML} accordingly.  The file
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   476
  \texttt{MySession/document/root.tex} should also be adapted at some
12686
2b0aa746e4b8 updated;
wenzelm
parents: 12684
diff changeset
   477
  point; the default version is mostly self-explanatory.  Note that
2b0aa746e4b8 updated;
wenzelm
parents: 12684
diff changeset
   478
  \verb,\isabellestyle, enables fine-tuning of the general appearance
2b0aa746e4b8 updated;
wenzelm
parents: 12684
diff changeset
   479
  of characters and mathematical symbols (see also
2b0aa746e4b8 updated;
wenzelm
parents: 12684
diff changeset
   480
  \S\ref{sec:doc-prep-symbols}).
12652
2d136f05e164 updated;
wenzelm
parents: 12649
diff changeset
   481
12686
2b0aa746e4b8 updated;
wenzelm
parents: 12684
diff changeset
   482
  Especially observe the included {\LaTeX} packages \texttt{isabelle}
2b0aa746e4b8 updated;
wenzelm
parents: 12684
diff changeset
   483
  (mandatory), \texttt{isabellesym} (required for mathematical
12743
wenzelm
parents: 12686
diff changeset
   484
  symbols), and the final \texttt{pdfsetup} (provides sane defaults
12764
b43333dc6e7d stylistic changes
paulson
parents: 12751
diff changeset
   485
  for \texttt{hyperref}, including URL markup).  All three are
12743
wenzelm
parents: 12686
diff changeset
   486
  distributed with Isabelle. Further packages may be required in
12764
b43333dc6e7d stylistic changes
paulson
parents: 12751
diff changeset
   487
  particular applications, say for unusual mathematical symbols.
12644
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   488
12747
cc59ceb0bcb4 updated;
wenzelm
parents: 12745
diff changeset
   489
  \medskip Any additional files for the {\LaTeX} stage go into the
cc59ceb0bcb4 updated;
wenzelm
parents: 12745
diff changeset
   490
  \texttt{MySession/document} directory as well.  In particular,
12767
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   491
  adding a file named \texttt{root.bib} causes an automatic run of
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   492
  \texttt{bibtex} to process a bibliographic database; see also
28838
d5db6dfcb34a moved table of standard Isabelle symbols to isar-ref manual;
wenzelm
parents: 27027
diff changeset
   493
  \texttt{isabelle document} \cite{isabelle-sys}.
12644
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   494
12652
2d136f05e164 updated;
wenzelm
parents: 12649
diff changeset
   495
  \medskip Any failure of the document preparation phase in an
12671
bb6db6c0d4df updated;
wenzelm
parents: 12666
diff changeset
   496
  Isabelle batch session leaves the generated sources in their target
12767
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   497
  location, identified by the accompanying error message.  This lets
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   498
  you trace {\LaTeX} problems with the generated files at hand.%
12644
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   499
\end{isamarkuptext}%
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   500
\isamarkuptrue%
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   501
%
12647
001d10bbc61b updated;
wenzelm
parents: 12644
diff changeset
   502
\isamarkupsubsection{Structure Markup%
12644
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   503
}
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   504
\isamarkuptrue%
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   505
%
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   506
\begin{isamarkuptext}%
12652
2d136f05e164 updated;
wenzelm
parents: 12649
diff changeset
   507
The large-scale structure of Isabelle documents follows existing
2d136f05e164 updated;
wenzelm
parents: 12649
diff changeset
   508
  {\LaTeX} conventions, with chapters, sections, subsubsections etc.
2d136f05e164 updated;
wenzelm
parents: 12649
diff changeset
   509
  The Isar language includes separate \bfindex{markup commands}, which
12682
72ec0a86bb23 updated;
wenzelm
parents: 12674
diff changeset
   510
  do not affect the formal meaning of a theory (or proof), but result
12666
9842befead7a updated;
wenzelm
parents: 12658
diff changeset
   511
  in corresponding {\LaTeX} elements.
12644
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   512
12666
9842befead7a updated;
wenzelm
parents: 12658
diff changeset
   513
  There are separate markup commands depending on the textual context:
9842befead7a updated;
wenzelm
parents: 12658
diff changeset
   514
  in header position (just before \isakeyword{theory}), within the
9842befead7a updated;
wenzelm
parents: 12658
diff changeset
   515
  theory body, or within a proof.  The header needs to be treated
9842befead7a updated;
wenzelm
parents: 12658
diff changeset
   516
  specially here, since ordinary theory and proof commands may only
9842befead7a updated;
wenzelm
parents: 12658
diff changeset
   517
  occur \emph{after} the initial \isakeyword{theory} specification.
12644
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   518
12666
9842befead7a updated;
wenzelm
parents: 12658
diff changeset
   519
  \medskip
12644
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   520
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   521
  \begin{tabular}{llll}
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   522
  header & theory & proof & default meaning \\\hline
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   523
    & \commdx{chapter} & & \verb,\chapter, \\
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   524
  \commdx{header} & \commdx{section} & \commdx{sect} & \verb,\section, \\
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   525
    & \commdx{subsection} & \commdx{subsect} & \verb,\subsection, \\
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   526
    & \commdx{subsubsection} & \commdx{subsubsect} & \verb,\subsubsection, \\
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   527
  \end{tabular}
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   528
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   529
  \medskip
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   530
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   531
  From the Isabelle perspective, each markup command takes a single
40406
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   532
  $text$ argument (delimited by \verb,",~\isa{{\isaliteral{5C3C646F74733E}{\isasymdots}}}~\verb,", or
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   533
  \verb,{,\verb,*,~\isa{{\isaliteral{5C3C646F74733E}{\isasymdots}}}~\verb,*,\verb,},).  After stripping any
12644
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   534
  surrounding white space, the argument is passed to a {\LaTeX} macro
12767
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   535
  \verb,\isamarkupXYZ, for command \isakeyword{XYZ}.  These macros are
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   536
  defined in \verb,isabelle.sty, according to the meaning given in the
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   537
  rightmost column above.
12644
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   538
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   539
  \medskip The following source fragment illustrates structure markup
12652
2d136f05e164 updated;
wenzelm
parents: 12649
diff changeset
   540
  of a theory.  Note that {\LaTeX} labels may be included inside of
2d136f05e164 updated;
wenzelm
parents: 12649
diff changeset
   541
  section headings as well.
12644
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   542
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   543
  \begin{ttbox}
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   544
  header {\ttlbrace}* Some properties of Foo Bar elements *{\ttrbrace}
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   545
15136
1275417e3930 Adapted text to new theory header syntax.
nipkow
parents: 14486
diff changeset
   546
  theory Foo_Bar
15141
a95c2ff210ba import -> imports
nipkow
parents: 15136
diff changeset
   547
  imports Main
15136
1275417e3930 Adapted text to new theory header syntax.
nipkow
parents: 14486
diff changeset
   548
  begin
12644
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   549
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   550
  subsection {\ttlbrace}* Basic definitions *{\ttrbrace}
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   551
27027
63f0b638355c *** empty log message ***
nipkow
parents: 27015
diff changeset
   552
  definition foo :: \dots
12647
001d10bbc61b updated;
wenzelm
parents: 12644
diff changeset
   553
27027
63f0b638355c *** empty log message ***
nipkow
parents: 27015
diff changeset
   554
  definition bar :: \dots
12647
001d10bbc61b updated;
wenzelm
parents: 12644
diff changeset
   555
12644
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   556
  subsection {\ttlbrace}* Derived rules *{\ttrbrace}
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   557
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   558
  lemma fooI: \dots
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   559
  lemma fooE: \dots
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   560
12647
001d10bbc61b updated;
wenzelm
parents: 12644
diff changeset
   561
  subsection {\ttlbrace}* Main theorem {\ttback}label{\ttlbrace}sec:main-theorem{\ttrbrace} *{\ttrbrace}
12644
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   562
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   563
  theorem main: \dots
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   564
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   565
  end
12767
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   566
  \end{ttbox}\vspace{-\medskipamount}
12644
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   567
12767
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   568
  You may occasionally want to change the meaning of markup commands,
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   569
  say via \verb,\renewcommand, in \texttt{root.tex}.  For example,
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   570
  \verb,\isamarkupheader, is a good candidate for some tuning.  We
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   571
  could move it up in the hierarchy to become \verb,\chapter,.
12644
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   572
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   573
\begin{verbatim}
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   574
  \renewcommand{\isamarkupheader}[1]{\chapter{#1}}
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   575
\end{verbatim}
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   576
12767
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   577
  \noindent Now we must change the document class given in
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   578
  \texttt{root.tex} to something that supports chapters.  A suitable
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   579
  command is \verb,\documentclass{report},.
12644
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   580
12647
001d10bbc61b updated;
wenzelm
parents: 12644
diff changeset
   581
  \medskip The {\LaTeX} macro \verb,\isabellecontext, is maintained to
001d10bbc61b updated;
wenzelm
parents: 12644
diff changeset
   582
  hold the name of the current theory context.  This is particularly
12652
2d136f05e164 updated;
wenzelm
parents: 12649
diff changeset
   583
  useful for document headings:
12644
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   584
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   585
\begin{verbatim}
12652
2d136f05e164 updated;
wenzelm
parents: 12649
diff changeset
   586
  \renewcommand{\isamarkupheader}[1]
12644
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   587
  {\chapter{#1}\markright{THEORY~\isabellecontext}}
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   588
\end{verbatim}
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   589
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   590
  \noindent Make sure to include something like
12647
001d10bbc61b updated;
wenzelm
parents: 12644
diff changeset
   591
  \verb,\pagestyle{headings}, in \texttt{root.tex}; the document
12764
b43333dc6e7d stylistic changes
paulson
parents: 12751
diff changeset
   592
  should have more than two pages to show the effect.%
12644
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   593
\end{isamarkuptext}%
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   594
\isamarkuptrue%
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   595
%
12745
d7b4d8c9bf86 updated;
wenzelm
parents: 12743
diff changeset
   596
\isamarkupsubsection{Formal Comments and Antiquotations \label{sec:doc-prep-text}%
12644
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   597
}
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   598
\isamarkuptrue%
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   599
%
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   600
\begin{isamarkuptext}%
12745
d7b4d8c9bf86 updated;
wenzelm
parents: 12743
diff changeset
   601
Isabelle \bfindex{source comments}, which are of the form
40406
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   602
  \verb,(,\verb,*,~\isa{{\isaliteral{5C3C646F74733E}{\isasymdots}}}~\verb,*,\verb,),, essentially act like
12747
cc59ceb0bcb4 updated;
wenzelm
parents: 12745
diff changeset
   603
  white space and do not really contribute to the content.  They
cc59ceb0bcb4 updated;
wenzelm
parents: 12745
diff changeset
   604
  mainly serve technical purposes to mark certain oddities in the raw
cc59ceb0bcb4 updated;
wenzelm
parents: 12745
diff changeset
   605
  input text.  In contrast, \bfindex{formal comments} are portions of
cc59ceb0bcb4 updated;
wenzelm
parents: 12745
diff changeset
   606
  text that are associated with formal Isabelle/Isar commands
12682
72ec0a86bb23 updated;
wenzelm
parents: 12674
diff changeset
   607
  (\bfindex{marginal comments}), or as standalone paragraphs within a
12666
9842befead7a updated;
wenzelm
parents: 12658
diff changeset
   608
  theory or proof context (\bfindex{text blocks}).
12658
3939e7dea202 updated;
wenzelm
parents: 12652
diff changeset
   609
3939e7dea202 updated;
wenzelm
parents: 12652
diff changeset
   610
  \medskip Marginal comments are part of each command's concrete
12671
bb6db6c0d4df updated;
wenzelm
parents: 12666
diff changeset
   611
  syntax \cite{isabelle-ref}; the common form is ``\verb,--,~$text$''
40406
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   612
  where $text$ is delimited by \verb,",\isa{{\isaliteral{5C3C646F74733E}{\isasymdots}}}\verb,", or
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   613
  \verb,{,\verb,*,~\isa{{\isaliteral{5C3C646F74733E}{\isasymdots}}}~\verb,*,\verb,}, as before.  Multiple
12671
bb6db6c0d4df updated;
wenzelm
parents: 12666
diff changeset
   614
  marginal comments may be given at the same time.  Here is a simple
bb6db6c0d4df updated;
wenzelm
parents: 12666
diff changeset
   615
  example:%
12666
9842befead7a updated;
wenzelm
parents: 12658
diff changeset
   616
\end{isamarkuptext}%
17175
1eced27ee0e1 updated;
wenzelm
parents: 17056
diff changeset
   617
\isamarkuptrue%
1eced27ee0e1 updated;
wenzelm
parents: 17056
diff changeset
   618
\isacommand{lemma}\isamarkupfalse%
40406
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   619
\ {\isaliteral{22}{\isachardoublequoteopen}}A\ {\isaliteral{2D}{\isacharminus}}{\isaliteral{2D}{\isacharminus}}{\isaliteral{3E}{\isachargreater}}\ A{\isaliteral{22}{\isachardoublequoteclose}}\isanewline
12666
9842befead7a updated;
wenzelm
parents: 12658
diff changeset
   620
\ \ %
9842befead7a updated;
wenzelm
parents: 12658
diff changeset
   621
\isamarkupcmt{a triviality of propositional logic%
9842befead7a updated;
wenzelm
parents: 12658
diff changeset
   622
}
9842befead7a updated;
wenzelm
parents: 12658
diff changeset
   623
\isanewline
9842befead7a updated;
wenzelm
parents: 12658
diff changeset
   624
\ \ %
9842befead7a updated;
wenzelm
parents: 12658
diff changeset
   625
\isamarkupcmt{(should not really bother)%
9842befead7a updated;
wenzelm
parents: 12658
diff changeset
   626
}
9842befead7a updated;
wenzelm
parents: 12658
diff changeset
   627
\isanewline
17056
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   628
%
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   629
\isadelimproof
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   630
\ \ %
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   631
\endisadelimproof
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   632
%
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   633
\isatagproof
17175
1eced27ee0e1 updated;
wenzelm
parents: 17056
diff changeset
   634
\isacommand{by}\isamarkupfalse%
40406
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   635
\ {\isaliteral{28}{\isacharparenleft}}rule\ impI{\isaliteral{29}{\isacharparenright}}\ %
16069
3f2a9f400168 *** empty log message ***
nipkow
parents: 15481
diff changeset
   636
\isamarkupcmt{implicit assumption step involved here%
3f2a9f400168 *** empty log message ***
nipkow
parents: 15481
diff changeset
   637
}
17056
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   638
%
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   639
\endisatagproof
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   640
{\isafoldproof}%
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   641
%
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   642
\isadelimproof
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   643
%
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   644
\endisadelimproof
12666
9842befead7a updated;
wenzelm
parents: 12658
diff changeset
   645
%
9842befead7a updated;
wenzelm
parents: 12658
diff changeset
   646
\begin{isamarkuptext}%
9842befead7a updated;
wenzelm
parents: 12658
diff changeset
   647
\noindent The above output has been produced as follows:
12658
3939e7dea202 updated;
wenzelm
parents: 12652
diff changeset
   648
3939e7dea202 updated;
wenzelm
parents: 12652
diff changeset
   649
\begin{verbatim}
3939e7dea202 updated;
wenzelm
parents: 12652
diff changeset
   650
  lemma "A --> A"
3939e7dea202 updated;
wenzelm
parents: 12652
diff changeset
   651
    -- "a triviality of propositional logic"
3939e7dea202 updated;
wenzelm
parents: 12652
diff changeset
   652
    -- "(should not really bother)"
3939e7dea202 updated;
wenzelm
parents: 12652
diff changeset
   653
    by (rule impI) -- "implicit assumption step involved here"
3939e7dea202 updated;
wenzelm
parents: 12652
diff changeset
   654
\end{verbatim}
3939e7dea202 updated;
wenzelm
parents: 12652
diff changeset
   655
12671
bb6db6c0d4df updated;
wenzelm
parents: 12666
diff changeset
   656
  From the {\LaTeX} viewpoint, ``\verb,--,'' acts like a markup
bb6db6c0d4df updated;
wenzelm
parents: 12666
diff changeset
   657
  command, associated with the macro \verb,\isamarkupcmt, (taking a
bb6db6c0d4df updated;
wenzelm
parents: 12666
diff changeset
   658
  single argument).
12658
3939e7dea202 updated;
wenzelm
parents: 12652
diff changeset
   659
12666
9842befead7a updated;
wenzelm
parents: 12658
diff changeset
   660
  \medskip Text blocks are introduced by the commands \bfindex{text}
9842befead7a updated;
wenzelm
parents: 12658
diff changeset
   661
  and \bfindex{txt}, for theory and proof contexts, respectively.
9842befead7a updated;
wenzelm
parents: 12658
diff changeset
   662
  Each takes again a single $text$ argument, which is interpreted as a
9842befead7a updated;
wenzelm
parents: 12658
diff changeset
   663
  free-form paragraph in {\LaTeX} (surrounded by some additional
12671
bb6db6c0d4df updated;
wenzelm
parents: 12666
diff changeset
   664
  vertical space).  This behavior may be changed by redefining the
bb6db6c0d4df updated;
wenzelm
parents: 12666
diff changeset
   665
  {\LaTeX} environments of \verb,isamarkuptext, or
bb6db6c0d4df updated;
wenzelm
parents: 12666
diff changeset
   666
  \verb,isamarkuptxt,, respectively (via \verb,\renewenvironment,) The
bb6db6c0d4df updated;
wenzelm
parents: 12666
diff changeset
   667
  text style of the body is determined by \verb,\isastyletext, and
bb6db6c0d4df updated;
wenzelm
parents: 12666
diff changeset
   668
  \verb,\isastyletxt,; the default setup uses a smaller font within
12747
cc59ceb0bcb4 updated;
wenzelm
parents: 12745
diff changeset
   669
  proofs.  This may be changed as follows:
cc59ceb0bcb4 updated;
wenzelm
parents: 12745
diff changeset
   670
cc59ceb0bcb4 updated;
wenzelm
parents: 12745
diff changeset
   671
\begin{verbatim}
cc59ceb0bcb4 updated;
wenzelm
parents: 12745
diff changeset
   672
  \renewcommand{\isastyletxt}{\isastyletext}
cc59ceb0bcb4 updated;
wenzelm
parents: 12745
diff changeset
   673
\end{verbatim}
12658
3939e7dea202 updated;
wenzelm
parents: 12652
diff changeset
   674
12767
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   675
  \medskip The $text$ part of Isabelle markup commands essentially
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   676
  inserts \emph{quoted material} into a formal text, mainly for
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   677
  instruction of the reader.  An \bfindex{antiquotation} is again a
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   678
  formal object embedded into such an informal portion.  The
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   679
  interpretation of antiquotations is limited to some well-formedness
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   680
  checks, with the result being pretty printed to the resulting
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   681
  document.  Quoted text blocks together with antiquotations provide
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   682
  an attractive means of referring to formal entities, with good
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   683
  confidence in getting the technical details right (especially syntax
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   684
  and types).
12658
3939e7dea202 updated;
wenzelm
parents: 12652
diff changeset
   685
12666
9842befead7a updated;
wenzelm
parents: 12658
diff changeset
   686
  The general syntax of antiquotations is as follows:
12658
3939e7dea202 updated;
wenzelm
parents: 12652
diff changeset
   687
  \texttt{{\at}{\ttlbrace}$name$ $arguments${\ttrbrace}}, or
3939e7dea202 updated;
wenzelm
parents: 12652
diff changeset
   688
  \texttt{{\at}{\ttlbrace}$name$ [$options$] $arguments${\ttrbrace}}
12666
9842befead7a updated;
wenzelm
parents: 12658
diff changeset
   689
  for a comma-separated list of options consisting of a $name$ or
12767
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   690
  \texttt{$name$=$value$} each.  The syntax of $arguments$ depends on
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   691
  the kind of antiquotation, it generally follows the same conventions
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   692
  for types, terms, or theorems as in the formal part of a theory.
12649
6e17f2ae9e16 updated;
wenzelm
parents: 12647
diff changeset
   693
12767
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   694
  \medskip This sentence demonstrates quotations and antiquotations:
40406
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   695
  \isa{{\isaliteral{5C3C6C616D6264613E}{\isasymlambda}}x\ y{\isaliteral{2E}{\isachardot}}\ x} is a well-typed term.
12658
3939e7dea202 updated;
wenzelm
parents: 12652
diff changeset
   696
12764
b43333dc6e7d stylistic changes
paulson
parents: 12751
diff changeset
   697
  \medskip\noindent The output above was produced as follows:
12658
3939e7dea202 updated;
wenzelm
parents: 12652
diff changeset
   698
  \begin{ttbox}
3939e7dea202 updated;
wenzelm
parents: 12652
diff changeset
   699
text {\ttlbrace}*
12764
b43333dc6e7d stylistic changes
paulson
parents: 12751
diff changeset
   700
  This sentence demonstrates quotations and antiquotations:
12658
3939e7dea202 updated;
wenzelm
parents: 12652
diff changeset
   701
  {\at}{\ttlbrace}term "%x y. x"{\ttrbrace} is a well-typed term.
3939e7dea202 updated;
wenzelm
parents: 12652
diff changeset
   702
*{\ttrbrace}
12767
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   703
  \end{ttbox}\vspace{-\medskipamount}
12658
3939e7dea202 updated;
wenzelm
parents: 12652
diff changeset
   704
12764
b43333dc6e7d stylistic changes
paulson
parents: 12751
diff changeset
   705
  The notational change from the ASCII character~\verb,%, to the
40406
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   706
  symbol~\isa{{\isaliteral{5C3C6C616D6264613E}{\isasymlambda}}} reveals that Isabelle printed this term, after
12767
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   707
  parsing and type-checking.  Document preparation enables symbolic
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   708
  output by default.
12658
3939e7dea202 updated;
wenzelm
parents: 12652
diff changeset
   709
16523
f8a734dc0fbc *** empty log message ***
nipkow
parents: 16069
diff changeset
   710
  \medskip The next example includes an option to show the type of all
f8a734dc0fbc *** empty log message ***
nipkow
parents: 16069
diff changeset
   711
  variables.  The antiquotation
12767
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   712
  \texttt{{\at}}\verb,{term [show_types] "%x y. x"}, produces the
40406
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   713
  output \isa{{\isaliteral{5C3C6C616D6264613E}{\isasymlambda}}{\isaliteral{28}{\isacharparenleft}}x{\isaliteral{5C3C436F6C6F6E3E}{\isasymColon}}{\isaliteral{27}{\isacharprime}}a{\isaliteral{29}{\isacharparenright}}\ y{\isaliteral{5C3C436F6C6F6E3E}{\isasymColon}}{\isaliteral{27}{\isacharprime}}b{\isaliteral{2E}{\isachardot}}\ x}.  Type inference has figured
12767
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   714
  out the most general typings in the present theory context.  Terms
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   715
  may acquire different typings due to constraints imposed by their
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   716
  environment; within a proof, for example, variables are given the
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   717
  same types as they have in the main goal statement.
12658
3939e7dea202 updated;
wenzelm
parents: 12652
diff changeset
   718
12764
b43333dc6e7d stylistic changes
paulson
parents: 12751
diff changeset
   719
  \medskip Several further kinds of antiquotations and options are
30649
57753e0ec1d4 1. New cancellation simprocs for common factors in inequations
nipkow
parents: 29297
diff changeset
   720
  available \cite{isabelle-isar-ref}.  Here are a few commonly used
12671
bb6db6c0d4df updated;
wenzelm
parents: 12666
diff changeset
   721
  combinations:
12658
3939e7dea202 updated;
wenzelm
parents: 12652
diff changeset
   722
3939e7dea202 updated;
wenzelm
parents: 12652
diff changeset
   723
  \medskip
3939e7dea202 updated;
wenzelm
parents: 12652
diff changeset
   724
3939e7dea202 updated;
wenzelm
parents: 12652
diff changeset
   725
  \begin{tabular}{ll}
3939e7dea202 updated;
wenzelm
parents: 12652
diff changeset
   726
  \texttt{\at}\verb,{typ,~$\tau$\verb,}, & print type $\tau$ \\
25338
6eb185959aec updated to notation and abbreviation
nipkow
parents: 17196
diff changeset
   727
  \texttt{\at}\verb,{const,~$c$\verb,}, & check existence of $c$ and print it \\
12658
3939e7dea202 updated;
wenzelm
parents: 12652
diff changeset
   728
  \texttt{\at}\verb,{term,~$t$\verb,}, & print term $t$ \\
3939e7dea202 updated;
wenzelm
parents: 12652
diff changeset
   729
  \texttt{\at}\verb,{prop,~$\phi$\verb,}, & print proposition $\phi$ \\
12666
9842befead7a updated;
wenzelm
parents: 12658
diff changeset
   730
  \texttt{\at}\verb,{prop [display],~$\phi$\verb,}, & print large proposition $\phi$ (with linebreaks) \\
12658
3939e7dea202 updated;
wenzelm
parents: 12652
diff changeset
   731
  \texttt{\at}\verb,{prop [source],~$\phi$\verb,}, & check proposition $\phi$, print its input \\
3939e7dea202 updated;
wenzelm
parents: 12652
diff changeset
   732
  \texttt{\at}\verb,{thm,~$a$\verb,}, & print fact $a$ \\
3939e7dea202 updated;
wenzelm
parents: 12652
diff changeset
   733
  \texttt{\at}\verb,{thm,~$a$~\verb,[no_vars]}, & print fact $a$, fixing schematic variables \\
12747
cc59ceb0bcb4 updated;
wenzelm
parents: 12745
diff changeset
   734
  \texttt{\at}\verb,{thm [source],~$a$\verb,}, & check availability of fact $a$, print its name \\
12658
3939e7dea202 updated;
wenzelm
parents: 12652
diff changeset
   735
  \texttt{\at}\verb,{text,~$s$\verb,}, & print uninterpreted text $s$ \\
3939e7dea202 updated;
wenzelm
parents: 12652
diff changeset
   736
  \end{tabular}
3939e7dea202 updated;
wenzelm
parents: 12652
diff changeset
   737
3939e7dea202 updated;
wenzelm
parents: 12652
diff changeset
   738
  \medskip
3939e7dea202 updated;
wenzelm
parents: 12652
diff changeset
   739
12666
9842befead7a updated;
wenzelm
parents: 12658
diff changeset
   740
  Note that \attrdx{no_vars} given above is \emph{not} an
9842befead7a updated;
wenzelm
parents: 12658
diff changeset
   741
  antiquotation option, but an attribute of the theorem argument given
9842befead7a updated;
wenzelm
parents: 12658
diff changeset
   742
  here.  This might be useful with a diagnostic command like
9842befead7a updated;
wenzelm
parents: 12658
diff changeset
   743
  \isakeyword{thm}, too.
12658
3939e7dea202 updated;
wenzelm
parents: 12652
diff changeset
   744
12666
9842befead7a updated;
wenzelm
parents: 12658
diff changeset
   745
  \medskip The \texttt{\at}\verb,{text, $s$\verb,}, antiquotation is
12658
3939e7dea202 updated;
wenzelm
parents: 12652
diff changeset
   746
  particularly interesting.  Embedding uninterpreted text within an
12666
9842befead7a updated;
wenzelm
parents: 12658
diff changeset
   747
  informal body might appear useless at first sight.  Here the key
9842befead7a updated;
wenzelm
parents: 12658
diff changeset
   748
  virtue is that the string $s$ is processed as Isabelle output,
9842befead7a updated;
wenzelm
parents: 12658
diff changeset
   749
  interpreting Isabelle symbols appropriately.
12658
3939e7dea202 updated;
wenzelm
parents: 12652
diff changeset
   750
40406
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   751
  For example, \texttt{\at}\verb,{text "\<forall>\<exists>"}, produces \isa{{\isaliteral{5C3C666F72616C6C3E}{\isasymforall}}{\isaliteral{5C3C6578697374733E}{\isasymexists}}}, according to the standard interpretation of these symbol
12666
9842befead7a updated;
wenzelm
parents: 12658
diff changeset
   752
  (cf.\ \S\ref{sec:doc-prep-symbols}).  Thus we achieve consistent
12658
3939e7dea202 updated;
wenzelm
parents: 12652
diff changeset
   753
  mathematical notation in both the formal and informal parts of the
12767
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   754
  document very easily, independently of the term language of
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   755
  Isabelle.  Manual {\LaTeX} code would leave more control over the
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   756
  typesetting, but is also slightly more tedious.%
12644
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   757
\end{isamarkuptext}%
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   758
\isamarkuptrue%
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   759
%
12674
wenzelm
parents: 12673
diff changeset
   760
\isamarkupsubsection{Interpretation of Symbols \label{sec:doc-prep-symbols}%
12644
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   761
}
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   762
\isamarkuptrue%
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   763
%
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   764
\begin{isamarkuptext}%
12666
9842befead7a updated;
wenzelm
parents: 12658
diff changeset
   765
As has been pointed out before (\S\ref{sec:syntax-symbols}),
12671
bb6db6c0d4df updated;
wenzelm
parents: 12666
diff changeset
   766
  Isabelle symbols are the smallest syntactic entities --- a
12682
72ec0a86bb23 updated;
wenzelm
parents: 12674
diff changeset
   767
  straightforward generalization of ASCII characters.  While Isabelle
12666
9842befead7a updated;
wenzelm
parents: 12658
diff changeset
   768
  does not impose any interpretation of the infinite collection of
12764
b43333dc6e7d stylistic changes
paulson
parents: 12751
diff changeset
   769
  named symbols, {\LaTeX} documents use canonical glyphs for certain
28838
d5db6dfcb34a moved table of standard Isabelle symbols to isar-ref manual;
wenzelm
parents: 27027
diff changeset
   770
  standard symbols \cite{isabelle-isar-ref}.
12658
3939e7dea202 updated;
wenzelm
parents: 12652
diff changeset
   771
12767
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   772
  The {\LaTeX} code produced from Isabelle text follows a simple
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   773
  scheme.  You can tune the final appearance by redefining certain
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   774
  macros, say in \texttt{root.tex} of the document.
12671
bb6db6c0d4df updated;
wenzelm
parents: 12666
diff changeset
   775
bb6db6c0d4df updated;
wenzelm
parents: 12666
diff changeset
   776
  \begin{enumerate}
12658
3939e7dea202 updated;
wenzelm
parents: 12652
diff changeset
   777
12671
bb6db6c0d4df updated;
wenzelm
parents: 12666
diff changeset
   778
  \item 7-bit ASCII characters: letters \texttt{A\dots Z} and
12747
cc59ceb0bcb4 updated;
wenzelm
parents: 12745
diff changeset
   779
  \texttt{a\dots z} are output directly, digits are passed as an
12671
bb6db6c0d4df updated;
wenzelm
parents: 12666
diff changeset
   780
  argument to the \verb,\isadigit, macro, other characters are
bb6db6c0d4df updated;
wenzelm
parents: 12666
diff changeset
   781
  replaced by specifically named macros of the form
12666
9842befead7a updated;
wenzelm
parents: 12658
diff changeset
   782
  \verb,\isacharXYZ,.
12658
3939e7dea202 updated;
wenzelm
parents: 12652
diff changeset
   783
12767
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   784
  \item Named symbols: \verb,\,\verb,<XYZ>, is turned into
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   785
  \verb,{\isasymXYZ},; note the additional braces.
12658
3939e7dea202 updated;
wenzelm
parents: 12652
diff changeset
   786
12767
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   787
  \item Named control symbols: \verb,\,\verb,<^XYZ>, is turned into
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   788
  \verb,\isactrlXYZ,; subsequent symbols may act as arguments if the
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   789
  control macro is defined accordingly.
12671
bb6db6c0d4df updated;
wenzelm
parents: 12666
diff changeset
   790
12666
9842befead7a updated;
wenzelm
parents: 12658
diff changeset
   791
  \end{enumerate}
9842befead7a updated;
wenzelm
parents: 12658
diff changeset
   792
12764
b43333dc6e7d stylistic changes
paulson
parents: 12751
diff changeset
   793
  You may occasionally wish to give new {\LaTeX} interpretations of
b43333dc6e7d stylistic changes
paulson
parents: 12751
diff changeset
   794
  named symbols.  This merely requires an appropriate definition of
12767
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   795
  \verb,\isasymXYZ,, for \verb,\,\verb,<XYZ>, (see
12747
cc59ceb0bcb4 updated;
wenzelm
parents: 12745
diff changeset
   796
  \texttt{isabelle.sty} for working examples).  Control symbols are
cc59ceb0bcb4 updated;
wenzelm
parents: 12745
diff changeset
   797
  slightly more difficult to get right, though.
12666
9842befead7a updated;
wenzelm
parents: 12658
diff changeset
   798
9842befead7a updated;
wenzelm
parents: 12658
diff changeset
   799
  \medskip The \verb,\isabellestyle, macro provides a high-level
9842befead7a updated;
wenzelm
parents: 12658
diff changeset
   800
  interface to tune the general appearance of individual symbols.  For
12671
bb6db6c0d4df updated;
wenzelm
parents: 12666
diff changeset
   801
  example, \verb,\isabellestyle{it}, uses the italics text style to
bb6db6c0d4df updated;
wenzelm
parents: 12666
diff changeset
   802
  mimic the general appearance of the {\LaTeX} math mode; double
12743
wenzelm
parents: 12686
diff changeset
   803
  quotes are not printed at all.  The resulting quality of typesetting
wenzelm
parents: 12686
diff changeset
   804
  is quite good, so this should be the default style for work that
wenzelm
parents: 12686
diff changeset
   805
  gets distributed to a broader audience.%
12644
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   806
\end{isamarkuptext}%
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   807
\isamarkuptrue%
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   808
%
12652
2d136f05e164 updated;
wenzelm
parents: 12649
diff changeset
   809
\isamarkupsubsection{Suppressing Output \label{sec:doc-prep-suppress}%
12644
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   810
}
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   811
\isamarkuptrue%
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   812
%
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   813
\begin{isamarkuptext}%
12749
c0ce43e809fd updated;
wenzelm
parents: 12747
diff changeset
   814
By default, Isabelle's document system generates a {\LaTeX} file for
c0ce43e809fd updated;
wenzelm
parents: 12747
diff changeset
   815
  each theory that gets loaded while running the session.  The
c0ce43e809fd updated;
wenzelm
parents: 12747
diff changeset
   816
  generated \texttt{session.tex} will include all of these in order of
c0ce43e809fd updated;
wenzelm
parents: 12747
diff changeset
   817
  appearance, which in turn gets included by the standard
12743
wenzelm
parents: 12686
diff changeset
   818
  \texttt{root.tex}.  Certainly one may change the order or suppress
12747
cc59ceb0bcb4 updated;
wenzelm
parents: 12745
diff changeset
   819
  unwanted theories by ignoring \texttt{session.tex} and load
cc59ceb0bcb4 updated;
wenzelm
parents: 12745
diff changeset
   820
  individual files directly in \texttt{root.tex}.  On the other hand,
cc59ceb0bcb4 updated;
wenzelm
parents: 12745
diff changeset
   821
  such an arrangement requires additional maintenance whenever the
cc59ceb0bcb4 updated;
wenzelm
parents: 12745
diff changeset
   822
  collection of theories changes.
12647
001d10bbc61b updated;
wenzelm
parents: 12644
diff changeset
   823
001d10bbc61b updated;
wenzelm
parents: 12644
diff changeset
   824
  Alternatively, one may tune the theory loading process in
12652
2d136f05e164 updated;
wenzelm
parents: 12649
diff changeset
   825
  \texttt{ROOT.ML} itself: traversal of the theory dependency graph
12671
bb6db6c0d4df updated;
wenzelm
parents: 12666
diff changeset
   826
  may be fine-tuned by adding \verb,use_thy, invocations, although
bb6db6c0d4df updated;
wenzelm
parents: 12666
diff changeset
   827
  topological sorting still has to be observed.  Moreover, the ML
bb6db6c0d4df updated;
wenzelm
parents: 12666
diff changeset
   828
  operator \verb,no_document, temporarily disables document generation
12767
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   829
  while executing a theory loader command.  Its usage is like this:
12647
001d10bbc61b updated;
wenzelm
parents: 12644
diff changeset
   830
001d10bbc61b updated;
wenzelm
parents: 12644
diff changeset
   831
\begin{verbatim}
12666
9842befead7a updated;
wenzelm
parents: 12658
diff changeset
   832
  no_document use_thy "T";
12647
001d10bbc61b updated;
wenzelm
parents: 12644
diff changeset
   833
\end{verbatim}
12644
a107eeffd557 updated;
wenzelm
parents: 12642
diff changeset
   834
17187
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   835
  \medskip Theory output may be suppressed more selectively, either
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   836
  via \bfindex{tagged command regions} or \bfindex{ignored material}.
12647
001d10bbc61b updated;
wenzelm
parents: 12644
diff changeset
   837
17187
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   838
  Tagged command regions works by annotating commands with named tags,
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   839
  which correspond to certain {\LaTeX} markup that tells how to treat
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   840
  particular parts of a document when doing the actual type-setting.
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   841
  By default, certain Isabelle/Isar commands are implicitly marked up
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   842
  using the predefined tags ``\emph{theory}'' (for theory begin and
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   843
  end), ``\emph{proof}'' (for proof commands), and ``\emph{ML}'' (for
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   844
  commands involving ML code).  Users may add their own tags using the
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   845
  \verb,%,\emph{tag} notation right after a command name.  In the
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   846
  subsequent example we hide a particularly irrelevant proof:%
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   847
\end{isamarkuptext}%
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   848
\isamarkuptrue%
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   849
\isacommand{lemma}\isamarkupfalse%
40406
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   850
\ {\isaliteral{22}{\isachardoublequoteopen}}x\ {\isaliteral{3D}{\isacharequal}}\ x{\isaliteral{22}{\isachardoublequoteclose}}%
17187
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   851
\isadeliminvisible
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   852
\ %
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   853
\endisadeliminvisible
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   854
%
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   855
\isataginvisible
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   856
\isacommand{by}\isamarkupfalse%
40406
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   857
\ {\isaliteral{28}{\isacharparenleft}}simp{\isaliteral{29}{\isacharparenright}}%
17187
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   858
\endisataginvisible
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   859
{\isafoldinvisible}%
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   860
%
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   861
\isadeliminvisible
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   862
%
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   863
\endisadeliminvisible
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   864
%
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   865
\begin{isamarkuptext}%
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   866
The original source has been ``\verb,lemma "x = x" by %invisible (simp),''.
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   867
  Tags observe the structure of proofs; adjacent commands with the
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   868
  same tag are joined into a single region.  The Isabelle document
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   869
  preparation system allows the user to specify how to interpret a
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   870
  tagged region, in order to keep, drop, or fold the corresponding
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   871
  parts of the document.  See the \emph{Isabelle System Manual}
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   872
  \cite{isabelle-sys} for further details, especially on
28838
d5db6dfcb34a moved table of standard Isabelle symbols to isar-ref manual;
wenzelm
parents: 27027
diff changeset
   873
  \texttt{isabelle usedir} and \texttt{isabelle document}.
12647
001d10bbc61b updated;
wenzelm
parents: 12644
diff changeset
   874
17187
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   875
  Ignored material is specified by delimiting the original formal
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   876
  source with special source comments
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   877
  \verb,(,\verb,*,\verb,<,\verb,*,\verb,), and
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   878
  \verb,(,\verb,*,\verb,>,\verb,*,\verb,),.  These parts are stripped
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   879
  before the type-setting phase, without affecting the formal checking
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   880
  of the theory, of course.  For example, we may hide parts of a proof
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   881
  that seem unfit for general public inspection.  The following
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   882
  ``fully automatic'' proof is actually a fake:%
12649
6e17f2ae9e16 updated;
wenzelm
parents: 12647
diff changeset
   883
\end{isamarkuptext}%
17175
1eced27ee0e1 updated;
wenzelm
parents: 17056
diff changeset
   884
\isamarkuptrue%
1eced27ee0e1 updated;
wenzelm
parents: 17056
diff changeset
   885
\isacommand{lemma}\isamarkupfalse%
40406
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   886
\ {\isaliteral{22}{\isachardoublequoteopen}}x\ {\isaliteral{5C3C6E6F7465713E}{\isasymnoteq}}\ {\isaliteral{28}{\isacharparenleft}}{\isadigit{0}}{\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}int{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ {\isadigit{0}}\ {\isaliteral{3C}{\isacharless}}\ x\ {\isaliteral{2A}{\isacharasterisk}}\ x{\isaliteral{22}{\isachardoublequoteclose}}\isanewline
17056
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   887
%
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   888
\isadelimproof
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   889
\ \ %
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   890
\endisadelimproof
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   891
%
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   892
\isatagproof
17175
1eced27ee0e1 updated;
wenzelm
parents: 17056
diff changeset
   893
\isacommand{by}\isamarkupfalse%
40406
313a24b66a8d updated generated files;
wenzelm
parents: 38765
diff changeset
   894
\ {\isaliteral{28}{\isacharparenleft}}auto{\isaliteral{29}{\isacharparenright}}%
17056
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   895
\endisatagproof
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   896
{\isafoldproof}%
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   897
%
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   898
\isadelimproof
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   899
%
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   900
\endisadelimproof
12649
6e17f2ae9e16 updated;
wenzelm
parents: 12647
diff changeset
   901
%
6e17f2ae9e16 updated;
wenzelm
parents: 12647
diff changeset
   902
\begin{isamarkuptext}%
17187
45bee2f6e61f updated;
wenzelm
parents: 17181
diff changeset
   903
\noindent The real source of the proof has been as follows:
12649
6e17f2ae9e16 updated;
wenzelm
parents: 12647
diff changeset
   904
6e17f2ae9e16 updated;
wenzelm
parents: 12647
diff changeset
   905
\begin{verbatim}
14353
79f9fbef9106 Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents: 13791
diff changeset
   906
  by (auto(*<*)simp add: zero_less_mult_iff(*>*))
12658
3939e7dea202 updated;
wenzelm
parents: 12652
diff changeset
   907
\end{verbatim}
3939e7dea202 updated;
wenzelm
parents: 12652
diff changeset
   908
%(*
12649
6e17f2ae9e16 updated;
wenzelm
parents: 12647
diff changeset
   909
12767
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   910
  \medskip Suppressing portions of printed text demands care.  You
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   911
  should not misrepresent the underlying theory development.  It is
072e9d582db0 updated;
wenzelm
parents: 12764
diff changeset
   912
  easy to invalidate the visible text by hiding references to
17196
wenzelm
parents: 17187
diff changeset
   913
  questionable axioms, for example.%
12635
e2d44df29c94 more on concrete syntax;
wenzelm
parents: 12627
diff changeset
   914
\end{isamarkuptext}%
17175
1eced27ee0e1 updated;
wenzelm
parents: 17056
diff changeset
   915
\isamarkuptrue%
17056
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   916
%
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   917
\isadelimtheory
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   918
%
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   919
\endisadelimtheory
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   920
%
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   921
\isatagtheory
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   922
%
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   923
\endisatagtheory
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   924
{\isafoldtheory}%
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   925
%
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   926
\isadelimtheory
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   927
%
05fc32a23b8b updated;
wenzelm
parents: 16523
diff changeset
   928
\endisadelimtheory
11648
d78a82d112e4 *** empty log message ***
wenzelm
parents:
diff changeset
   929
\end{isabellebody}%
d78a82d112e4 *** empty log message ***
wenzelm
parents:
diff changeset
   930
%%% Local Variables:
d78a82d112e4 *** empty log message ***
wenzelm
parents:
diff changeset
   931
%%% mode: latex
d78a82d112e4 *** empty log message ***
wenzelm
parents:
diff changeset
   932
%%% TeX-master: "root"
d78a82d112e4 *** empty log message ***
wenzelm
parents:
diff changeset
   933
%%% End: