doc-src/LaTeXsugar/Sugar/document/Sugar.tex
author haftmann
Fri, 27 Aug 2010 13:55:23 +0200
changeset 38810 361119ea62ee
parent 36138 1faa0fc34174
child 38798 89f273ab1d42
permissions -rw-r--r--
re-added accidental omission
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15893
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
     1
%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
     2
\begin{isabellebody}%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
     3
\def\isabellecontext{Sugar}%
17125
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
     4
%
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
     5
\isadelimtheory
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
     6
%
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
     7
\endisadelimtheory
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
     8
%
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
     9
\isatagtheory
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
    10
%
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
    11
\endisatagtheory
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
    12
{\isafoldtheory}%
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
    13
%
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
    14
\isadelimtheory
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
    15
%
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
    16
\endisadelimtheory
15893
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    17
%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    18
\isamarkupsection{Introduction%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    19
}
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    20
\isamarkuptrue%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    21
%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    22
\begin{isamarkuptext}%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    23
This document is for those Isabelle users who have mastered
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    24
the art of mixing \LaTeX\ text and Isabelle theories and never want to
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    25
typeset a theorem by hand anymore because they have experienced the
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    26
bliss of writing \verb!@!\verb!{thm[display]setsum_cartesian_product[no_vars]}!
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    27
and seeing Isabelle typeset it for them:
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    28
\begin{isabelle}%
17214
af174eeafba1 updated;
wenzelm
parents: 17175
diff changeset
    29
{\isacharparenleft}{\isasymSum}x{\isasymin}A{\isachardot}\ {\isasymSum}y{\isasymin}B{\isachardot}\ f\ x\ y{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}{\isasymSum}{\isacharparenleft}x{\isacharcomma}\ y{\isacharparenright}{\isasymin}A\ {\isasymtimes}\ B{\isachardot}\ f\ x\ y{\isacharparenright}%
15893
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    30
\end{isabelle}
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    31
No typos, no omissions, no sweat.
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    32
If you have not experienced that joy, read Chapter 4, \emph{Presenting
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    33
Theories}, \cite{LNCS2283} first.
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    34
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    35
If you have mastered the art of Isabelle's \emph{antiquotations},
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    36
i.e.\ things like the above \verb!@!\verb!{thm...}!, beware: in your vanity
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    37
you may be tempted to think that all readers of the stunning ps or pdf
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    38
documents you can now produce at the drop of a hat will be struck with
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    39
awe at the beauty unfolding in front of their eyes. Until one day you
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    40
come across that very critical of readers known as the ``common referee''.
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    41
He has the nasty habit of refusing to understand unfamiliar notation
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    42
like Isabelle's infamous \isa{{\isasymlbrakk}\ {\isasymrbrakk}\ {\isasymLongrightarrow}} no matter how many times you
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    43
explain it in your paper. Even worse, he thinks that using \isa{{\isasymlbrakk}\ {\isasymrbrakk}} for anything other than denotational semantics is a cardinal sin
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    44
that must be punished by instant rejection.
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    45
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    46
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    47
This document shows you how to make Isabelle and \LaTeX\ cooperate to
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    48
produce ordinary looking mathematics that hides the fact that it was
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    49
typeset by a machine. You merely need to load the right files:
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    50
\begin{itemize}
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    51
\item Import theory \texttt{LaTeXsugar} in the header of your own
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    52
theory.  You may also want bits of \texttt{OptionalSugar}, which you can
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    53
copy selectively into your own theory or import as a whole.  Both
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    54
theories live in \texttt{HOL/Library} and are found automatically.
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    55
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    56
\item Should you need additional \LaTeX\ packages (the text will tell
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    57
you so), you include them at the beginning of your \LaTeX\ document,
16154
9bf4b6bf4372 \nexists
nipkow
parents: 16076
diff changeset
    58
typically in \texttt{root.tex}. For a start, you should
9bf4b6bf4372 \nexists
nipkow
parents: 16076
diff changeset
    59
\verb!\usepackage{amssymb}! --- otherwise typesetting
9bf4b6bf4372 \nexists
nipkow
parents: 16076
diff changeset
    60
\isa{{\isachardoublequote}{\isasymnot}{\isacharparenleft}{\isasymexists}x{\isachardot}\ P\ x{\isacharparenright}{\isachardoublequote}} will fail because the AMS symbol
9bf4b6bf4372 \nexists
nipkow
parents: 16076
diff changeset
    61
\isa{{\isasymnexists}} is missing.
15893
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    62
\end{itemize}%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    63
\end{isamarkuptext}%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    64
\isamarkuptrue%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    65
%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    66
\isamarkupsection{HOL syntax%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    67
}
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    68
\isamarkuptrue%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    69
%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    70
\isamarkupsubsection{Logic%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    71
}
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    72
\isamarkuptrue%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    73
%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    74
\begin{isamarkuptext}%
16154
9bf4b6bf4372 \nexists
nipkow
parents: 16076
diff changeset
    75
The formula \isa{{\isachardoublequote}{\isasymnot}{\isacharparenleft}{\isasymexists}x{\isachardot}\ P\ x{\isacharparenright}{\isachardoublequote}} is typeset as \isa{{\isasymnexists}x{\isachardot}\ P\ x}.
9bf4b6bf4372 \nexists
nipkow
parents: 16076
diff changeset
    76
15893
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    77
The predefined constructs \isa{if}, \isa{let} and
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    78
\isa{case} are set in sans serif font to distinguish them from
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    79
other functions. This improves readability:
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    80
\begin{itemize}
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    81
\item \isa{\textsf{if}\ b\ \textsf{then}\ e\isactrlisub {\isadigit{1}}\ \textsf{else}\ e\isactrlisub {\isadigit{2}}} instead of \isa{if\ b\ then\ e\isactrlisub {\isadigit{1}}\ else\ e\isactrlisub {\isadigit{2}}}.
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    82
\item \isa{\textsf{let}\ x\ {\isacharequal}\ e\isactrlisub {\isadigit{1}}\ \textsf{in}\ e\isactrlisub {\isadigit{2}}} instead of \isa{let\ x\ {\isacharequal}\ e\isactrlisub {\isadigit{1}}\ in\ e\isactrlisub {\isadigit{2}}}.
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    83
\item \isa{\textsf{case}\ x\ \textsf{of}\ True\ {\isasymRightarrow}\ e\isactrlisub {\isadigit{1}}\ {\isacharbar}\ False\ {\isasymRightarrow}\ e\isactrlisub {\isadigit{2}}} instead of\\
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    84
      \isa{case\ x\ of\ True\ {\isasymRightarrow}\ e\isactrlisub {\isadigit{1}}\ {\isacharbar}\ False\ {\isasymRightarrow}\ e\isactrlisub {\isadigit{2}}}.
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    85
\end{itemize}%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    86
\end{isamarkuptext}%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    87
\isamarkuptrue%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    88
%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    89
\isamarkupsubsection{Sets%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    90
}
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    91
\isamarkuptrue%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    92
%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    93
\begin{isamarkuptext}%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    94
Although set syntax in HOL is already close to
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    95
standard, we provide a few further improvements:
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    96
\begin{itemize}
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
    97
\item \isa{{\isacharbraceleft}x\ {\isacharbar}\ P{\isacharbraceright}} instead of \isa{{\isacharbraceleft}x{\isachardot}\ P{\isacharbraceright}}.
27688
397de75836a1 *** empty log message ***
nipkow
parents: 27094
diff changeset
    98
\item \isa{{\isasymemptyset}} instead of \isa{{\isacharbraceleft}{\isacharbraceright}}, where
397de75836a1 *** empty log message ***
nipkow
parents: 27094
diff changeset
    99
 \isa{{\isasymemptyset}} is also input syntax.
15893
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   100
\item \isa{{\isacharbraceleft}a{\isacharcomma}\ b{\isacharcomma}\ c{\isacharbraceright}\ {\isasymunion}\ M} instead of \isa{insert\ a\ {\isacharparenleft}insert\ b\ {\isacharparenleft}insert\ c\ M{\isacharparenright}{\isacharparenright}}.
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   101
\end{itemize}%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   102
\end{isamarkuptext}%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   103
\isamarkuptrue%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   104
%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   105
\isamarkupsubsection{Lists%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   106
}
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   107
\isamarkuptrue%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   108
%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   109
\begin{isamarkuptext}%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   110
If lists are used heavily, the following notations increase readability:
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   111
\begin{itemize}
27688
397de75836a1 *** empty log message ***
nipkow
parents: 27094
diff changeset
   112
\item \isa{x{\isasymcdot}xs} instead of \isa{x\ {\isacharhash}\ xs},
397de75836a1 *** empty log message ***
nipkow
parents: 27094
diff changeset
   113
      where \isa{x{\isasymcdot}xs} is also input syntax.
15893
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   114
If you prefer more space around the $\cdot$ you have to redefine
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   115
\verb!\isasymcdot! in \LaTeX:
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   116
\verb!\renewcommand{\isasymcdot}{\isamath{\,\cdot\,}}!
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   117
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   118
\item \isa{{\isacharbar}xs{\isacharbar}} instead of \isa{length\ xs}.
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   119
\item \isa{xs\ensuremath{_{[\mathit{n}]}}} instead of \isa{nth\ xs\ n},
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   120
      the $n$th element of \isa{xs}.
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   121
22834
bf67f798f063 added test about "set" supression
nipkow
parents: 22387
diff changeset
   122
\item Human readers are good at converting automatically from lists to
30502
b80d2621caee hiding numeric coercions in LaTeX
nipkow
parents: 30405
diff changeset
   123
sets. Hence \texttt{OptionalSugar} contains syntax for suppressing the
22834
bf67f798f063 added test about "set" supression
nipkow
parents: 22387
diff changeset
   124
conversion function \isa{set}: for example, \isa{{\isachardoublequote}x\ {\isasymin}\ set\ xs{\isachardoublequote}}
bf67f798f063 added test about "set" supression
nipkow
parents: 22387
diff changeset
   125
becomes \isa{x\ {\isasymin}\ xs}.
bf67f798f063 added test about "set" supression
nipkow
parents: 22387
diff changeset
   126
15893
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   127
\item The \isa{{\isacharat}} operation associates implicitly to the right,
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   128
which leads to unpleasant line breaks if the term is too long for one
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   129
line. To avoid this, \texttt{OptionalSugar} contains syntax to group
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   130
\isa{{\isacharat}}-terms to the left before printing, which leads to better
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   131
line breaking behaviour:
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   132
\begin{isabelle}%
34878
d7786f56f081 recovered subscript (cf. ded5b770ec1c);
wenzelm
parents: 34877
diff changeset
   133
term\isactrlisub {\isadigit{0}}\ \isacharat\ term\isactrlisub {\isadigit{1}}\ \isacharat\ term\isactrlisub {\isadigit{2}}\ \isacharat\ term\isactrlisub {\isadigit{3}}\ \isacharat\ term\isactrlisub {\isadigit{4}}\ \isacharat\ term\isactrlisub {\isadigit{5}}\ \isacharat\ term\isactrlisub {\isadigit{6}}\ \isacharat\ term\isactrlisub {\isadigit{7}}\ \isacharat\ term\isactrlisub {\isadigit{8}}\ \isacharat\ term\isactrlisub {\isadigit{9}}\ \isacharat\ term\isactrlisub {\isadigit{1}}\isactrlisub {\isadigit{0}}%
15893
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   134
\end{isabelle}
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   135
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   136
\end{itemize}%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   137
\end{isamarkuptext}%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   138
\isamarkuptrue%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   139
%
30502
b80d2621caee hiding numeric coercions in LaTeX
nipkow
parents: 30405
diff changeset
   140
\isamarkupsubsection{Numbers%
b80d2621caee hiding numeric coercions in LaTeX
nipkow
parents: 30405
diff changeset
   141
}
b80d2621caee hiding numeric coercions in LaTeX
nipkow
parents: 30405
diff changeset
   142
\isamarkuptrue%
b80d2621caee hiding numeric coercions in LaTeX
nipkow
parents: 30405
diff changeset
   143
%
b80d2621caee hiding numeric coercions in LaTeX
nipkow
parents: 30405
diff changeset
   144
\begin{isamarkuptext}%
b80d2621caee hiding numeric coercions in LaTeX
nipkow
parents: 30405
diff changeset
   145
Coercions between numeric types are alien to mathematicians who
b80d2621caee hiding numeric coercions in LaTeX
nipkow
parents: 30405
diff changeset
   146
consider, for example, \isa{nat} as a subset of \isa{int}.
b80d2621caee hiding numeric coercions in LaTeX
nipkow
parents: 30405
diff changeset
   147
\texttt{OptionalSugar} contains syntax for suppressing numeric coercions such
b80d2621caee hiding numeric coercions in LaTeX
nipkow
parents: 30405
diff changeset
   148
as \isa{int} \isa{{\isacharcolon}{\isacharcolon}} \isa{nat\ {\isasymRightarrow}\ int}. For example,
b80d2621caee hiding numeric coercions in LaTeX
nipkow
parents: 30405
diff changeset
   149
\isa{{\isachardoublequote}int\ {\isadigit{5}}{\isachardoublequote}} is printed as \isa{{\isadigit{5}}}. Embeddings of types
b80d2621caee hiding numeric coercions in LaTeX
nipkow
parents: 30405
diff changeset
   150
\isa{nat}, \isa{int}, \isa{real} are covered; non-injective coercions such
b80d2621caee hiding numeric coercions in LaTeX
nipkow
parents: 30405
diff changeset
   151
as \isa{nat} \isa{{\isacharcolon}{\isacharcolon}} \isa{int\ {\isasymRightarrow}\ nat} are not and should not be
b80d2621caee hiding numeric coercions in LaTeX
nipkow
parents: 30405
diff changeset
   152
hidden.%
b80d2621caee hiding numeric coercions in LaTeX
nipkow
parents: 30405
diff changeset
   153
\end{isamarkuptext}%
b80d2621caee hiding numeric coercions in LaTeX
nipkow
parents: 30405
diff changeset
   154
\isamarkuptrue%
b80d2621caee hiding numeric coercions in LaTeX
nipkow
parents: 30405
diff changeset
   155
%
15893
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   156
\isamarkupsection{Printing theorems%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   157
}
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   158
\isamarkuptrue%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   159
%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   160
\isamarkupsubsection{Question marks%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   161
}
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   162
\isamarkuptrue%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   163
%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   164
\begin{isamarkuptext}%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   165
If you print anything, especially theorems, containing
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   166
schematic variables they are prefixed with a question mark:
29297
62e0f892e525 updated generated files;
wenzelm
parents: 27688
diff changeset
   167
\verb!@!\verb!{thm conjI}! results in \isa{{\isasymlbrakk}P{\isacharsemicolon}\ Q{\isasymrbrakk}\ {\isasymLongrightarrow}\ P\ {\isasymand}\ Q}. Most of the time
15893
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   168
you would rather not see the question marks. There is an attribute
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   169
\verb!no_vars! that you can attach to the theorem that turns its
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   170
schematic into ordinary free variables: \verb!@!\verb!{thm conjI[no_vars]}!
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   171
results in \isa{{\isasymlbrakk}P{\isacharsemicolon}\ Q{\isasymrbrakk}\ {\isasymLongrightarrow}\ P\ {\isasymand}\ Q}.
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   172
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   173
This \verb!no_vars! business can become a bit tedious.
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   174
If you would rather never see question marks, simply put
34877
ded5b770ec1c formal antiquotations for ML snippets; no "open" unsynchronized references
haftmann
parents: 33323
diff changeset
   175
\begin{quote}
ded5b770ec1c formal antiquotations for ML snippets; no "open" unsynchronized references
haftmann
parents: 33323
diff changeset
   176
\verb|Unsynchronized.reset show_question_marks|\verb!;!
ded5b770ec1c formal antiquotations for ML snippets; no "open" unsynchronized references
haftmann
parents: 33323
diff changeset
   177
\end{quote}
15893
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   178
at the beginning of your file \texttt{ROOT.ML}.
33323
1932908057c7 small fixes
nipkow
parents: 32898
diff changeset
   179
The rest of this document is produced with this flag set to \texttt{false}.
16075
8852058ecf8d added ? explanations
nipkow
parents: 16040
diff changeset
   180
33323
1932908057c7 small fixes
nipkow
parents: 32898
diff changeset
   181
Hint: Setting \verb!show_question_marks! to \texttt{false} only
1932908057c7 small fixes
nipkow
parents: 32898
diff changeset
   182
suppresses question marks; variables that end in digits,
1932908057c7 small fixes
nipkow
parents: 32898
diff changeset
   183
e.g. \isa{x{\isadigit{1}}}, are still printed with a trailing \isa{{\isachardot}{\isadigit{0}}},
1932908057c7 small fixes
nipkow
parents: 32898
diff changeset
   184
e.g. \isa{x{\isadigit{1}}{\isachardot}{\isadigit{0}}}, their internal index. This can be avoided by
1932908057c7 small fixes
nipkow
parents: 32898
diff changeset
   185
turning the last digit into a subscript: write \verb!x\<^isub>1! and
1932908057c7 small fixes
nipkow
parents: 32898
diff changeset
   186
obtain the much nicer \isa{x\isactrlisub {\isadigit{1}}}.%
15893
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   187
\end{isamarkuptext}%
17175
1eced27ee0e1 updated;
wenzelm
parents: 17134
diff changeset
   188
\isamarkuptrue%
17125
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
   189
%
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
   190
\isadelimML
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
   191
%
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
   192
\endisadelimML
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
   193
%
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
   194
\isatagML
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
   195
%
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
   196
\endisatagML
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
   197
{\isafoldML}%
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
   198
%
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
   199
\isadelimML
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
   200
%
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
   201
\endisadelimML
15893
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   202
%
24496
65f3b37f80b7 added short_names explanation
nipkow
parents: 23105
diff changeset
   203
\isamarkupsubsection{Qualified names%
65f3b37f80b7 added short_names explanation
nipkow
parents: 23105
diff changeset
   204
}
65f3b37f80b7 added short_names explanation
nipkow
parents: 23105
diff changeset
   205
\isamarkuptrue%
65f3b37f80b7 added short_names explanation
nipkow
parents: 23105
diff changeset
   206
%
65f3b37f80b7 added short_names explanation
nipkow
parents: 23105
diff changeset
   207
\begin{isamarkuptext}%
65f3b37f80b7 added short_names explanation
nipkow
parents: 23105
diff changeset
   208
If there are multiple declarations of the same name, Isabelle prints
65f3b37f80b7 added short_names explanation
nipkow
parents: 23105
diff changeset
   209
the qualified name, for example \isa{T{\isachardot}length}, where \isa{T} is the
65f3b37f80b7 added short_names explanation
nipkow
parents: 23105
diff changeset
   210
theory it is defined in, to distinguish it from the predefined \isa{{\isachardoublequote}List{\isachardot}length{\isachardoublequote}}. In case there is no danger of confusion, you can insist on
65f3b37f80b7 added short_names explanation
nipkow
parents: 23105
diff changeset
   211
short names (no qualifiers) by setting \verb!short_names!, typically
65f3b37f80b7 added short_names explanation
nipkow
parents: 23105
diff changeset
   212
in \texttt{ROOT.ML}:
34877
ded5b770ec1c formal antiquotations for ML snippets; no "open" unsynchronized references
haftmann
parents: 33323
diff changeset
   213
\begin{quote}
ded5b770ec1c formal antiquotations for ML snippets; no "open" unsynchronized references
haftmann
parents: 33323
diff changeset
   214
\verb|Unsynchronized.set short_names|\verb!;!
ded5b770ec1c formal antiquotations for ML snippets; no "open" unsynchronized references
haftmann
parents: 33323
diff changeset
   215
\end{quote}%
24496
65f3b37f80b7 added short_names explanation
nipkow
parents: 23105
diff changeset
   216
\end{isamarkuptext}%
65f3b37f80b7 added short_names explanation
nipkow
parents: 23105
diff changeset
   217
\isamarkuptrue%
65f3b37f80b7 added short_names explanation
nipkow
parents: 23105
diff changeset
   218
%
17134
ae56354155e4 updated;
wenzelm
parents: 17125
diff changeset
   219
\isamarkupsubsection{Variable names\label{sec:varnames}%
16396
d9d2a0cadd5e *** empty log message ***
nipkow
parents: 16176
diff changeset
   220
}
d9d2a0cadd5e *** empty log message ***
nipkow
parents: 16176
diff changeset
   221
\isamarkuptrue%
d9d2a0cadd5e *** empty log message ***
nipkow
parents: 16176
diff changeset
   222
%
d9d2a0cadd5e *** empty log message ***
nipkow
parents: 16176
diff changeset
   223
\begin{isamarkuptext}%
d9d2a0cadd5e *** empty log message ***
nipkow
parents: 16176
diff changeset
   224
It sometimes happens that you want to change the name of a
d9d2a0cadd5e *** empty log message ***
nipkow
parents: 16176
diff changeset
   225
variable in a theorem before printing it. This can easily be achieved
d9d2a0cadd5e *** empty log message ***
nipkow
parents: 16176
diff changeset
   226
with the help of Isabelle's instantiation attribute \texttt{where}:
d9d2a0cadd5e *** empty log message ***
nipkow
parents: 16176
diff changeset
   227
\isa{{\isasymlbrakk}{\isasymphi}{\isacharsemicolon}\ {\isasympsi}{\isasymrbrakk}\ {\isasymLongrightarrow}\ {\isasymphi}\ {\isasymand}\ {\isasympsi}} is the result of
d9d2a0cadd5e *** empty log message ***
nipkow
parents: 16176
diff changeset
   228
\begin{quote}
d9d2a0cadd5e *** empty log message ***
nipkow
parents: 16176
diff changeset
   229
\verb!@!\verb!{thm conjI[where P = \<phi> and Q = \<psi>]}!
d9d2a0cadd5e *** empty log message ***
nipkow
parents: 16176
diff changeset
   230
\end{quote}
d9d2a0cadd5e *** empty log message ***
nipkow
parents: 16176
diff changeset
   231
To support the ``\_''-notation for irrelevant variables
d9d2a0cadd5e *** empty log message ***
nipkow
parents: 16176
diff changeset
   232
the constant \texttt{DUMMY} has been introduced:
d9d2a0cadd5e *** empty log message ***
nipkow
parents: 16176
diff changeset
   233
\isa{fst\ {\isacharparenleft}a{\isacharcomma}\ \_{\isacharparenright}\ {\isacharequal}\ a} is produced by
d9d2a0cadd5e *** empty log message ***
nipkow
parents: 16176
diff changeset
   234
\begin{quote}
d9d2a0cadd5e *** empty log message ***
nipkow
parents: 16176
diff changeset
   235
\verb!@!\verb!{thm fst_conv[where b = DUMMY]}!
36138
1faa0fc34174 advertise [rename_abs] attribute in LaTeXsugar -- wish I had known about this earier.
krauss
parents: 34878
diff changeset
   236
\end{quote}
1faa0fc34174 advertise [rename_abs] attribute in LaTeXsugar -- wish I had known about this earier.
krauss
parents: 34878
diff changeset
   237
Variables that are bound by quantifiers or lambdas cannot be renamed
1faa0fc34174 advertise [rename_abs] attribute in LaTeXsugar -- wish I had known about this earier.
krauss
parents: 34878
diff changeset
   238
like this. Instead, the attribute \texttt{rename\_abs} does the
1faa0fc34174 advertise [rename_abs] attribute in LaTeXsugar -- wish I had known about this earier.
krauss
parents: 34878
diff changeset
   239
job. It expects a list of names or underscores, similar to the
1faa0fc34174 advertise [rename_abs] attribute in LaTeXsugar -- wish I had known about this earier.
krauss
parents: 34878
diff changeset
   240
\texttt{of} attribute:
1faa0fc34174 advertise [rename_abs] attribute in LaTeXsugar -- wish I had known about this earier.
krauss
parents: 34878
diff changeset
   241
\begin{quote}
1faa0fc34174 advertise [rename_abs] attribute in LaTeXsugar -- wish I had known about this earier.
krauss
parents: 34878
diff changeset
   242
\verb!@!\verb!{thm split_paired_All[rename_abs _ l r]}!
1faa0fc34174 advertise [rename_abs] attribute in LaTeXsugar -- wish I had known about this earier.
krauss
parents: 34878
diff changeset
   243
\end{quote}
1faa0fc34174 advertise [rename_abs] attribute in LaTeXsugar -- wish I had known about this earier.
krauss
parents: 34878
diff changeset
   244
produces \isa{{\isacharparenleft}{\isasymforall}x{\isachardot}\ P\ x{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}{\isasymforall}l\ r{\isachardot}\ P\ {\isacharparenleft}l{\isacharcomma}\ r{\isacharparenright}{\isacharparenright}}.%
16396
d9d2a0cadd5e *** empty log message ***
nipkow
parents: 16176
diff changeset
   245
\end{isamarkuptext}%
d9d2a0cadd5e *** empty log message ***
nipkow
parents: 16176
diff changeset
   246
\isamarkuptrue%
d9d2a0cadd5e *** empty log message ***
nipkow
parents: 16176
diff changeset
   247
%
15893
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   248
\isamarkupsubsection{Inference rules%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   249
}
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   250
\isamarkuptrue%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   251
%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   252
\begin{isamarkuptext}%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   253
To print theorems as inference rules you need to include Didier
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   254
R\'emy's \texttt{mathpartir} package~\cite{mathpartir}
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   255
for typesetting inference rules in your \LaTeX\ file.
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   256
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   257
Writing \verb!@!\verb!{thm[mode=Rule] conjI}! produces
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   258
\isa{\mbox{}\inferrule{\mbox{P}\\\ \mbox{Q}}{\mbox{P\ {\isasymand}\ Q}}}, even in the middle of a sentence.
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   259
If you prefer your inference rule on a separate line, maybe with a name,
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   260
\begin{center}
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   261
\isa{\mbox{}\inferrule{\mbox{P}\\\ \mbox{Q}}{\mbox{P\ {\isasymand}\ Q}}} {\sc conjI}
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   262
\end{center}
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   263
is produced by
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   264
\begin{quote}
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   265
\verb!\begin{center}!\\
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   266
\verb!@!\verb!{thm[mode=Rule] conjI} {\sc conjI}!\\
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   267
\verb!\end{center}!
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   268
\end{quote}
24497
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   269
It is not recommended to use the standard \texttt{display} option
15893
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   270
together with \texttt{Rule} because centering does not work and because
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   271
the line breaking mechanisms of \texttt{display} and \texttt{mathpartir} can
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   272
clash.
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   273
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   274
Of course you can display multiple rules in this fashion:
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   275
\begin{quote}
24497
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   276
\verb!\begin{center}!\\
15893
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   277
\verb!@!\verb!{thm[mode=Rule] conjI} {\sc conjI} \\[1ex]!\\
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   278
\verb!@!\verb!{thm[mode=Rule] conjE} {\sc disjI$_1$} \qquad!\\
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   279
\verb!@!\verb!{thm[mode=Rule] disjE} {\sc disjI$_2$}!\\
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   280
\verb!\end{center}!
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   281
\end{quote}
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   282
yields
24497
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   283
\begin{center}\small
15893
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   284
\isa{\mbox{}\inferrule{\mbox{P}\\\ \mbox{Q}}{\mbox{P\ {\isasymand}\ Q}}} {\sc conjI} \\[1ex]
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   285
\isa{\mbox{}\inferrule{\mbox{P}}{\mbox{P\ {\isasymor}\ Q}}} {\sc disjI$_1$} \qquad
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   286
\isa{\mbox{}\inferrule{\mbox{Q}}{\mbox{P\ {\isasymor}\ Q}}} {\sc disjI$_2$}
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   287
\end{center}
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   288
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   289
The \texttt{mathpartir} package copes well if there are too many
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   290
premises for one line:
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   291
\begin{center}
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   292
\isa{\mbox{}\inferrule{\mbox{A\ {\isasymlongrightarrow}\ B}\\\ \mbox{B\ {\isasymlongrightarrow}\ C}\\\ \mbox{C\ {\isasymlongrightarrow}\ D}\\\ \mbox{D\ {\isasymlongrightarrow}\ E}\\\ \mbox{E\ {\isasymlongrightarrow}\ F}\\\ \mbox{F\ {\isasymlongrightarrow}\ G}\\\ \mbox{G\ {\isasymlongrightarrow}\ H}\\\ \mbox{H\ {\isasymlongrightarrow}\ I}\\\ \mbox{I\ {\isasymlongrightarrow}\ J}\\\ \mbox{J\ {\isasymlongrightarrow}\ K}}{\mbox{A\ {\isasymlongrightarrow}\ K}}}
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   293
\end{center}
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   294
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   295
Limitations: 1. Premises and conclusion must each not be longer than
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   296
the line.  2. Premises that are \isa{{\isasymLongrightarrow}}-implications are again
22387
17827a3c02d0 adjusted to latest changes
haftmann
parents: 21558
diff changeset
   297
displayed with a horizontal line, which looks at least unusual.
17827a3c02d0 adjusted to latest changes
haftmann
parents: 21558
diff changeset
   298
17827a3c02d0 adjusted to latest changes
haftmann
parents: 21558
diff changeset
   299
17827a3c02d0 adjusted to latest changes
haftmann
parents: 21558
diff changeset
   300
In case you print theorems without premises no rule will be printed by the
17827a3c02d0 adjusted to latest changes
haftmann
parents: 21558
diff changeset
   301
\texttt{Rule} print mode. However, you can use \texttt{Axiom} instead:
17827a3c02d0 adjusted to latest changes
haftmann
parents: 21558
diff changeset
   302
\begin{quote}
24497
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   303
\verb!\begin{center}!\\
22387
17827a3c02d0 adjusted to latest changes
haftmann
parents: 21558
diff changeset
   304
\verb!@!\verb!{thm[mode=Axiom] refl} {\sc refl}! \\
17827a3c02d0 adjusted to latest changes
haftmann
parents: 21558
diff changeset
   305
\verb!\end{center}!
17827a3c02d0 adjusted to latest changes
haftmann
parents: 21558
diff changeset
   306
\end{quote}
17827a3c02d0 adjusted to latest changes
haftmann
parents: 21558
diff changeset
   307
yields
24497
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   308
\begin{center}
22387
17827a3c02d0 adjusted to latest changes
haftmann
parents: 21558
diff changeset
   309
\isa{\mbox{}\inferrule{\mbox{}}{\mbox{t\ {\isacharequal}\ t}}} {\sc refl} 
17827a3c02d0 adjusted to latest changes
haftmann
parents: 21558
diff changeset
   310
\end{center}%
15893
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   311
\end{isamarkuptext}%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   312
\isamarkuptrue%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   313
%
24497
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   314
\isamarkupsubsection{Displays and font sizes%
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   315
}
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   316
\isamarkuptrue%
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   317
%
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   318
\begin{isamarkuptext}%
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   319
When displaying theorems with the \texttt{display} option, e.g.
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   320
\verb!@!\verb!{thm[display] refl}! \begin{isabelle}%
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   321
t\ {\isacharequal}\ t%
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   322
\end{isabelle} the theorem is
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   323
set in small font. It uses the \LaTeX-macro \verb!\isastyle!,
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   324
which is also the style that regular theory text is set in, e.g.%
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   325
\end{isamarkuptext}%
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   326
\isamarkuptrue%
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   327
\isacommand{lemma}\isamarkupfalse%
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   328
\ {\isachardoublequoteopen}t\ {\isacharequal}\ t{\isachardoublequoteclose}%
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   329
\isadelimproof
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   330
%
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   331
\endisadelimproof
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   332
%
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   333
\isatagproof
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   334
%
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   335
\endisatagproof
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   336
{\isafoldproof}%
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   337
%
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   338
\isadelimproof
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   339
%
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   340
\endisadelimproof
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   341
%
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   342
\begin{isamarkuptext}%
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   343
\noindent Otherwise \verb!\isastyleminor! is used,
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   344
which does not modify the font size (assuming you stick to the default
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   345
\verb!\isabellestyle{it}! in \texttt{root.tex}). If you prefer
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   346
normal font size throughout your text, include
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   347
\begin{quote}
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   348
\verb!\renewcommand{\isastyle}{\isastyleminor}!
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   349
\end{quote}
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   350
in \texttt{root.tex}. On the other hand, if you like the small font,
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   351
just put \verb!\isastyle! in front of the text in question,
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   352
e.g.\ at the start of one of the center-environments above.
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   353
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   354
The advantage of the display option is that you can display a whole
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   355
list of theorems in one go. For example,
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   356
\verb!@!\verb!{thm[display] foldl.simps}!
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   357
generates \begin{isabelle}%
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   358
foldl\ f\ a\ {\isacharbrackleft}{\isacharbrackright}\ {\isacharequal}\ a\isasep\isanewline%
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   359
foldl\ f\ a\ {\isacharparenleft}x{\isasymcdot}xs{\isacharparenright}\ {\isacharequal}\ foldl\ f\ {\isacharparenleft}f\ a\ x{\isacharparenright}\ xs%
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   360
\end{isabelle}%
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   361
\end{isamarkuptext}%
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   362
\isamarkuptrue%
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   363
%
15893
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   364
\isamarkupsubsection{If-then%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   365
}
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   366
\isamarkuptrue%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   367
%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   368
\begin{isamarkuptext}%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   369
If you prefer a fake ``natural language'' style you can produce
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   370
the body of
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   371
\newtheorem{theorem}{Theorem}
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   372
\begin{theorem}
25731
b3e415b0cf5c updated;
wenzelm
parents: 24497
diff changeset
   373
\isa{{\normalsize{}If\,}\ \mbox{i\ {\isasymle}\ j}\ {\normalsize \,and\,}\ \mbox{j\ {\isasymle}\ k}\ {\normalsize \,then\,}\ i\ {\isasymle}\ k{\isachardot}}
15893
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   374
\end{theorem}
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   375
by typing
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   376
\begin{quote}
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   377
\verb!@!\verb!{thm[mode=IfThen] le_trans}!
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   378
\end{quote}
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   379
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   380
In order to prevent odd line breaks, the premises are put into boxes.
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   381
At times this is too drastic:
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   382
\begin{theorem}
25731
b3e415b0cf5c updated;
wenzelm
parents: 24497
diff changeset
   383
\isa{{\normalsize{}If\,}\ \mbox{longpremise}\ {\normalsize \,and\,}\ \mbox{longerpremise}\ {\normalsize \,and\,}\ \mbox{P\ {\isacharparenleft}f\ {\isacharparenleft}f\ {\isacharparenleft}f\ {\isacharparenleft}f\ {\isacharparenleft}f\ {\isacharparenleft}f\ {\isacharparenleft}f\ {\isacharparenleft}f\ {\isacharparenleft}f\ x{\isacharparenright}{\isacharparenright}{\isacharparenright}{\isacharparenright}{\isacharparenright}{\isacharparenright}{\isacharparenright}{\isacharparenright}{\isacharparenright}}\ {\normalsize \,and\,}\ \mbox{longestpremise}\ {\normalsize \,then\,}\ conclusion{\isachardot}}
15893
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   384
\end{theorem}
16154
9bf4b6bf4372 \nexists
nipkow
parents: 16076
diff changeset
   385
In which case you should use \texttt{IfThenNoBox} instead of
9bf4b6bf4372 \nexists
nipkow
parents: 16076
diff changeset
   386
\texttt{IfThen}:
15893
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   387
\begin{theorem}
25731
b3e415b0cf5c updated;
wenzelm
parents: 24497
diff changeset
   388
\isa{{\normalsize{}If\,}\ longpremise\ {\normalsize \,and\,}\ longerpremise\ {\normalsize \,and\,}\ P\ {\isacharparenleft}f\ {\isacharparenleft}f\ {\isacharparenleft}f\ {\isacharparenleft}f\ {\isacharparenleft}f\ {\isacharparenleft}f\ {\isacharparenleft}f\ {\isacharparenleft}f\ {\isacharparenleft}f\ x{\isacharparenright}{\isacharparenright}{\isacharparenright}{\isacharparenright}{\isacharparenright}{\isacharparenright}{\isacharparenright}{\isacharparenright}{\isacharparenright}\ {\normalsize \,and\,}\ longestpremise\ {\normalsize \,then\,}\ conclusion{\isachardot}}
15893
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   389
\end{theorem}%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   390
\end{isamarkuptext}%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   391
\isamarkuptrue%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   392
%
16166
346bb10d4bbb some refinements
haftmann
parents: 16155
diff changeset
   393
\isamarkupsubsection{Doing it yourself\label{sec:yourself}%
16154
9bf4b6bf4372 \nexists
nipkow
parents: 16076
diff changeset
   394
}
9bf4b6bf4372 \nexists
nipkow
parents: 16076
diff changeset
   395
\isamarkuptrue%
9bf4b6bf4372 \nexists
nipkow
parents: 16076
diff changeset
   396
%
9bf4b6bf4372 \nexists
nipkow
parents: 16076
diff changeset
   397
\begin{isamarkuptext}%
9bf4b6bf4372 \nexists
nipkow
parents: 16076
diff changeset
   398
If for some reason you want or need to present theorems your
9bf4b6bf4372 \nexists
nipkow
parents: 16076
diff changeset
   399
own way, you can extract the premises and the conclusion explicitly
9bf4b6bf4372 \nexists
nipkow
parents: 16076
diff changeset
   400
and combine them as you like:
9bf4b6bf4372 \nexists
nipkow
parents: 16076
diff changeset
   401
\begin{itemize}
32893
dbef0e6438ec updated generated documentation
haftmann
parents: 30502
diff changeset
   402
\item \verb!@!\verb!{thm (prem 1)! $thm$\verb!}!
dbef0e6438ec updated generated documentation
haftmann
parents: 30502
diff changeset
   403
prints premise 1 of $thm$.
dbef0e6438ec updated generated documentation
haftmann
parents: 30502
diff changeset
   404
\item \verb!@!\verb!{thm (concl)! $thm$\verb!}!
16154
9bf4b6bf4372 \nexists
nipkow
parents: 16076
diff changeset
   405
prints the conclusion of $thm$.
9bf4b6bf4372 \nexists
nipkow
parents: 16076
diff changeset
   406
\end{itemize}
9bf4b6bf4372 \nexists
nipkow
parents: 16076
diff changeset
   407
For example, ``from \isa{Q} and
9bf4b6bf4372 \nexists
nipkow
parents: 16076
diff changeset
   408
\isa{P} we conclude \isa{P\ {\isasymand}\ Q}''
9bf4b6bf4372 \nexists
nipkow
parents: 16076
diff changeset
   409
is produced by
9bf4b6bf4372 \nexists
nipkow
parents: 16076
diff changeset
   410
\begin{quote}
32893
dbef0e6438ec updated generated documentation
haftmann
parents: 30502
diff changeset
   411
\verb!from !\verb!@!\verb!{thm (prem 2) conjI}! \verb!and !\verb!@!\verb!{thm (prem 1) conjI}!\\
dbef0e6438ec updated generated documentation
haftmann
parents: 30502
diff changeset
   412
\verb!we conclude !\verb!@!\verb!{thm (concl) conjI}!
16154
9bf4b6bf4372 \nexists
nipkow
parents: 16076
diff changeset
   413
\end{quote}
9bf4b6bf4372 \nexists
nipkow
parents: 16076
diff changeset
   414
Thus you can rearrange or hide premises and typeset the theorem as you like.
32898
e871d897969c term styles also cover antiquotations term_type and typeof
haftmann
parents: 32893
diff changeset
   415
Styles like \verb!(prem 1)! are a general mechanism explained
16154
9bf4b6bf4372 \nexists
nipkow
parents: 16076
diff changeset
   416
in \S\ref{sec:styles}.%
9bf4b6bf4372 \nexists
nipkow
parents: 16076
diff changeset
   417
\end{isamarkuptext}%
9bf4b6bf4372 \nexists
nipkow
parents: 16076
diff changeset
   418
\isamarkuptrue%
9bf4b6bf4372 \nexists
nipkow
parents: 16076
diff changeset
   419
%
15893
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   420
\isamarkupsubsection{Patterns%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   421
}
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   422
\isamarkuptrue%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   423
%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   424
\begin{isamarkuptext}%
17134
ae56354155e4 updated;
wenzelm
parents: 17125
diff changeset
   425
In \S\ref{sec:varnames} we shows how to create patterns containing
ae56354155e4 updated;
wenzelm
parents: 17125
diff changeset
   426
  ``\isa{\_}''.
15893
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   427
  You can drive this game even further and extend the syntax of let
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   428
  bindings such that certain functions like \isa{fst}, \isa{hd}, 
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   429
  etc.\ are printed as patterns. \texttt{OptionalSugar} provides the
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   430
  following:
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   431
  
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   432
  \begin{center}
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   433
  \begin{tabular}{l@ {~~produced by~~}l}
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   434
  \isa{\textsf{let}\ {\isacharparenleft}x{\isacharcomma}\ \_{\isacharparenright}\ {\isacharequal}\ p\ \textsf{in}\ t} & \verb!@!\verb!{term "let x = fst p in t"}!\\
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   435
  \isa{\textsf{let}\ {\isacharparenleft}\_{\isacharcomma}\ x{\isacharparenright}\ {\isacharequal}\ p\ \textsf{in}\ t} & \verb!@!\verb!{term "let x = snd p in t"}!\\
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   436
  \isa{\textsf{let}\ x{\isasymcdot}\_\ {\isacharequal}\ xs\ \textsf{in}\ t} & \verb!@!\verb!{term "let x = hd xs in t"}!\\
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   437
  \isa{\textsf{let}\ \_{\isasymcdot}x\ {\isacharequal}\ xs\ \textsf{in}\ t} & \verb!@!\verb!{term "let x = tl xs in t"}!\\
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   438
  \isa{\textsf{let}\ Some\ x\ {\isacharequal}\ y\ \textsf{in}\ t} & \verb!@!\verb!{term "let x = the y in t"}!\\
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   439
  \end{tabular}
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   440
  \end{center}%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   441
\end{isamarkuptext}%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   442
\isamarkuptrue%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   443
%
16155
a6403c6c5339 fixed sectioning
nipkow
parents: 16154
diff changeset
   444
\isamarkupsection{Proofs%
15893
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   445
}
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   446
\isamarkuptrue%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   447
%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   448
\begin{isamarkuptext}%
24497
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   449
Full proofs, even if written in beautiful Isar style, are
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   450
likely to be too long and detailed to be included in conference
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   451
papers, but some key lemmas might be of interest.
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   452
It is usually easiest to put them in figures like the one in Fig.\
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   453
\ref{fig:proof}. This was achieved with the \isakeyword{text\_raw} command:%
15893
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   454
\end{isamarkuptext}%
17175
1eced27ee0e1 updated;
wenzelm
parents: 17134
diff changeset
   455
\isamarkuptrue%
15893
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   456
%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   457
\begin{figure}
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   458
  \begin{center}\begin{minipage}{0.6\textwidth}  
24497
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   459
  \isastyleminor\isamarkuptrue
17175
1eced27ee0e1 updated;
wenzelm
parents: 17134
diff changeset
   460
\isacommand{lemma}\isamarkupfalse%
1eced27ee0e1 updated;
wenzelm
parents: 17134
diff changeset
   461
\ True\isanewline
17125
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
   462
%
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
   463
\isadelimproof
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
   464
%
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
   465
\endisadelimproof
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
   466
%
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
   467
\isatagproof
17175
1eced27ee0e1 updated;
wenzelm
parents: 17134
diff changeset
   468
\isacommand{proof}\isamarkupfalse%
1eced27ee0e1 updated;
wenzelm
parents: 17134
diff changeset
   469
\ {\isacharminus}\isanewline
15893
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   470
\ \ %
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   471
\isamarkupcmt{pretty trivial%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   472
}
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   473
\isanewline
17175
1eced27ee0e1 updated;
wenzelm
parents: 17134
diff changeset
   474
\ \ \isacommand{show}\isamarkupfalse%
1eced27ee0e1 updated;
wenzelm
parents: 17134
diff changeset
   475
\ True\ \isacommand{by}\isamarkupfalse%
1eced27ee0e1 updated;
wenzelm
parents: 17134
diff changeset
   476
\ force\isanewline
1eced27ee0e1 updated;
wenzelm
parents: 17134
diff changeset
   477
\isacommand{qed}\isamarkupfalse%
1eced27ee0e1 updated;
wenzelm
parents: 17134
diff changeset
   478
%
17125
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
   479
\endisatagproof
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
   480
{\isafoldproof}%
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
   481
%
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
   482
\isadelimproof
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
   483
%
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
   484
\endisadelimproof
15893
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   485
%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   486
\end{minipage}\end{center}
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   487
  \caption{Example proof in a figure.}\label{fig:proof}
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   488
  \end{figure}
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   489
%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   490
\begin{isamarkuptext}%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   491
\begin{quote}
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   492
\small
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   493
\verb!text_raw {!\verb!*!\\
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   494
\verb!  \begin{figure}!\\
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   495
\verb!  \begin{center}\begin{minipage}{0.6\textwidth}!\\
24497
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   496
\verb!  \isastyleminor\isamarkuptrue!\\
15893
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   497
\verb!*!\verb!}!\\
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   498
\verb!lemma True!\\
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   499
\verb!proof -!\\
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   500
\verb!  -- "pretty trivial"!\\
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   501
\verb!  show True by force!\\
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   502
\verb!qed!\\
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   503
\verb!text_raw {!\verb!*!\\
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   504
\verb!  \end{minipage}\end{center}!\\
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   505
\verb!  \caption{Example proof in a figure.}\label{fig:proof}!\\
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   506
\verb!  \end{figure}!\\
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   507
\verb!*!\verb!}!
24497
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   508
\end{quote}
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   509
7840f760a744 explained \isatstyle(minor)
nipkow
parents: 24496
diff changeset
   510
Other theory text, e.g.\ definitions, can be put in figures, too.%
15893
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   511
\end{isamarkuptext}%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   512
\isamarkuptrue%
15953
902b556e4bc0 fixed a few things and added Haftmann as author
nipkow
parents: 15893
diff changeset
   513
%
16155
a6403c6c5339 fixed sectioning
nipkow
parents: 16154
diff changeset
   514
\isamarkupsection{Styles\label{sec:styles}%
15953
902b556e4bc0 fixed a few things and added Haftmann as author
nipkow
parents: 15893
diff changeset
   515
}
902b556e4bc0 fixed a few things and added Haftmann as author
nipkow
parents: 15893
diff changeset
   516
\isamarkuptrue%
902b556e4bc0 fixed a few things and added Haftmann as author
nipkow
parents: 15893
diff changeset
   517
%
902b556e4bc0 fixed a few things and added Haftmann as author
nipkow
parents: 15893
diff changeset
   518
\begin{isamarkuptext}%
902b556e4bc0 fixed a few things and added Haftmann as author
nipkow
parents: 15893
diff changeset
   519
The \verb!thm! antiquotation works nicely for single theorems, but
902b556e4bc0 fixed a few things and added Haftmann as author
nipkow
parents: 15893
diff changeset
   520
  sets of equations as used in definitions are more difficult to
16040
6e7616eba0b8 some adaptions
haftmann
parents: 16001
diff changeset
   521
  typeset nicely: people tend to prefer aligned \isa{{\isacharequal}} signs.
15953
902b556e4bc0 fixed a few things and added Haftmann as author
nipkow
parents: 15893
diff changeset
   522
902b556e4bc0 fixed a few things and added Haftmann as author
nipkow
parents: 15893
diff changeset
   523
  To deal with such cases where it is desirable to dive into the structure
16040
6e7616eba0b8 some adaptions
haftmann
parents: 16001
diff changeset
   524
  of terms and theorems, Isabelle offers antiquotations featuring
15953
902b556e4bc0 fixed a few things and added Haftmann as author
nipkow
parents: 15893
diff changeset
   525
  ``styles'':
902b556e4bc0 fixed a few things and added Haftmann as author
nipkow
parents: 15893
diff changeset
   526
902b556e4bc0 fixed a few things and added Haftmann as author
nipkow
parents: 15893
diff changeset
   527
    \begin{quote}
32893
dbef0e6438ec updated generated documentation
haftmann
parents: 30502
diff changeset
   528
    \verb!@!\verb!{thm (style) thm}!\\
dbef0e6438ec updated generated documentation
haftmann
parents: 30502
diff changeset
   529
    \verb!@!\verb!{prop (style) thm}!\\
32898
e871d897969c term styles also cover antiquotations term_type and typeof
haftmann
parents: 32893
diff changeset
   530
    \verb!@!\verb!{term (style) term}!\\
e871d897969c term styles also cover antiquotations term_type and typeof
haftmann
parents: 32893
diff changeset
   531
    \verb!@!\verb!{term_type (style) term}!\\
e871d897969c term styles also cover antiquotations term_type and typeof
haftmann
parents: 32893
diff changeset
   532
    \verb!@!\verb!{typeof (style) term}!\\
15953
902b556e4bc0 fixed a few things and added Haftmann as author
nipkow
parents: 15893
diff changeset
   533
    \end{quote}
902b556e4bc0 fixed a few things and added Haftmann as author
nipkow
parents: 15893
diff changeset
   534
32898
e871d897969c term styles also cover antiquotations term_type and typeof
haftmann
parents: 32893
diff changeset
   535
  A ``style'' is a transformation of a term. There are predefined
32893
dbef0e6438ec updated generated documentation
haftmann
parents: 30502
diff changeset
   536
  styles, namely \verb!lhs! and \verb!rhs!, \verb!prem! with one argument, and \verb!concl!.
16166
346bb10d4bbb some refinements
haftmann
parents: 16155
diff changeset
   537
  For example, 
16076
03e8a88c0b54 tuned thm_style section
kleing
parents: 16075
diff changeset
   538
  the output
15953
902b556e4bc0 fixed a few things and added Haftmann as author
nipkow
parents: 15893
diff changeset
   539
  \begin{center}
902b556e4bc0 fixed a few things and added Haftmann as author
nipkow
parents: 15893
diff changeset
   540
  \begin{tabular}{l@ {~~\isa{{\isacharequal}}~~}l}
902b556e4bc0 fixed a few things and added Haftmann as author
nipkow
parents: 15893
diff changeset
   541
  \isa{foldl\ f\ a\ {\isacharbrackleft}{\isacharbrackright}} & \isa{a}\\
902b556e4bc0 fixed a few things and added Haftmann as author
nipkow
parents: 15893
diff changeset
   542
  \isa{foldl\ f\ a\ {\isacharparenleft}x{\isasymcdot}xs{\isacharparenright}} & \isa{foldl\ f\ {\isacharparenleft}f\ a\ x{\isacharparenright}\ xs}
902b556e4bc0 fixed a few things and added Haftmann as author
nipkow
parents: 15893
diff changeset
   543
  \end{tabular}
902b556e4bc0 fixed a few things and added Haftmann as author
nipkow
parents: 15893
diff changeset
   544
  \end{center}
902b556e4bc0 fixed a few things and added Haftmann as author
nipkow
parents: 15893
diff changeset
   545
  is produced by the following code:
902b556e4bc0 fixed a few things and added Haftmann as author
nipkow
parents: 15893
diff changeset
   546
  \begin{quote}
902b556e4bc0 fixed a few things and added Haftmann as author
nipkow
parents: 15893
diff changeset
   547
    \verb!\begin{center}!\\
902b556e4bc0 fixed a few things and added Haftmann as author
nipkow
parents: 15893
diff changeset
   548
    \verb!\begin{tabular}{l@ {~~!\verb!@!\verb!{text "="}~~}l}!\\
33323
1932908057c7 small fixes
nipkow
parents: 32898
diff changeset
   549
    \verb!@!\verb!{thm (lhs) foldl_Nil} & @!\verb!{thm (rhs) foldl_Nil}\\!\\
32893
dbef0e6438ec updated generated documentation
haftmann
parents: 30502
diff changeset
   550
    \verb!@!\verb!{thm (lhs) foldl_Cons} & @!\verb!{thm (rhs) foldl_Cons}!\\
15953
902b556e4bc0 fixed a few things and added Haftmann as author
nipkow
parents: 15893
diff changeset
   551
    \verb!\end{tabular}!\\
902b556e4bc0 fixed a few things and added Haftmann as author
nipkow
parents: 15893
diff changeset
   552
    \verb!\end{center}!
902b556e4bc0 fixed a few things and added Haftmann as author
nipkow
parents: 15893
diff changeset
   553
  \end{quote}
902b556e4bc0 fixed a few things and added Haftmann as author
nipkow
parents: 15893
diff changeset
   554
  Note the space between \verb!@! and \verb!{! in the tabular argument.
902b556e4bc0 fixed a few things and added Haftmann as author
nipkow
parents: 15893
diff changeset
   555
  It prevents Isabelle from interpreting \verb!@ {~~...~~}! 
16076
03e8a88c0b54 tuned thm_style section
kleing
parents: 16075
diff changeset
   556
  as an antiquotation. The styles \verb!lhs! and \verb!rhs!
27094
2cf13a72e170 updated generated file;
wenzelm
parents: 25731
diff changeset
   557
  extract the left hand side (or right hand side respectively) from the
16076
03e8a88c0b54 tuned thm_style section
kleing
parents: 16075
diff changeset
   558
  conclusion of propositions consisting of a binary operator
16040
6e7616eba0b8 some adaptions
haftmann
parents: 16001
diff changeset
   559
  (e.~g.~\isa{{\isacharequal}}, \isa{{\isasymequiv}}, \isa{{\isacharless}}).
15953
902b556e4bc0 fixed a few things and added Haftmann as author
nipkow
parents: 15893
diff changeset
   560
16166
346bb10d4bbb some refinements
haftmann
parents: 16155
diff changeset
   561
  Likewise, \verb!concl! may be used as a style to show just the
16076
03e8a88c0b54 tuned thm_style section
kleing
parents: 16075
diff changeset
   562
  conclusion of a proposition. For example, take \verb!hd_Cons_tl!:
16040
6e7616eba0b8 some adaptions
haftmann
parents: 16001
diff changeset
   563
  \begin{center}
33323
1932908057c7 small fixes
nipkow
parents: 32898
diff changeset
   564
    \isa{xs\ {\isasymnoteq}\ {\isacharbrackleft}{\isacharbrackright}\ {\isasymLongrightarrow}\ hd\ xs{\isasymcdot}tl\ xs\ {\isacharequal}\ xs}
16040
6e7616eba0b8 some adaptions
haftmann
parents: 16001
diff changeset
   565
  \end{center}
6e7616eba0b8 some adaptions
haftmann
parents: 16001
diff changeset
   566
  To print just the conclusion,
15953
902b556e4bc0 fixed a few things and added Haftmann as author
nipkow
parents: 15893
diff changeset
   567
  \begin{center}
33323
1932908057c7 small fixes
nipkow
parents: 32898
diff changeset
   568
    \isa{hd\ xs{\isasymcdot}tl\ xs\ {\isacharequal}\ xs}
15953
902b556e4bc0 fixed a few things and added Haftmann as author
nipkow
parents: 15893
diff changeset
   569
  \end{center}
16040
6e7616eba0b8 some adaptions
haftmann
parents: 16001
diff changeset
   570
  type
15953
902b556e4bc0 fixed a few things and added Haftmann as author
nipkow
parents: 15893
diff changeset
   571
  \begin{quote}
902b556e4bc0 fixed a few things and added Haftmann as author
nipkow
parents: 15893
diff changeset
   572
    \verb!\begin{center}!\\
33323
1932908057c7 small fixes
nipkow
parents: 32898
diff changeset
   573
    \verb!@!\verb!{thm (concl) hd_Cons_tl}!\\
15953
902b556e4bc0 fixed a few things and added Haftmann as author
nipkow
parents: 15893
diff changeset
   574
    \verb!\end{center}!
902b556e4bc0 fixed a few things and added Haftmann as author
nipkow
parents: 15893
diff changeset
   575
  \end{quote}
17134
ae56354155e4 updated;
wenzelm
parents: 17125
diff changeset
   576
  Beware that any options must be placed \emph{before}
32898
e871d897969c term styles also cover antiquotations term_type and typeof
haftmann
parents: 32893
diff changeset
   577
  the style, as in this example.
17125
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
   578
16166
346bb10d4bbb some refinements
haftmann
parents: 16155
diff changeset
   579
  Further use cases can be found in \S\ref{sec:yourself}.
15953
902b556e4bc0 fixed a few things and added Haftmann as author
nipkow
parents: 15893
diff changeset
   580
  If you are not afraid of ML, you may also define your own styles.
32893
dbef0e6438ec updated generated documentation
haftmann
parents: 30502
diff changeset
   581
  Have a look at module \verb|Term_Style|.%
15953
902b556e4bc0 fixed a few things and added Haftmann as author
nipkow
parents: 15893
diff changeset
   582
\end{isamarkuptext}%
17175
1eced27ee0e1 updated;
wenzelm
parents: 17134
diff changeset
   583
\isamarkuptrue%
17125
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
   584
%
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
   585
\isadelimtheory
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
   586
%
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
   587
\endisadelimtheory
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
   588
%
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
   589
\isatagtheory
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
   590
%
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
   591
\endisatagtheory
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
   592
{\isafoldtheory}%
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
   593
%
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
   594
\isadelimtheory
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
   595
%
e6a82d1a1829 updated;
wenzelm
parents: 16396
diff changeset
   596
\endisadelimtheory
15893
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   597
\end{isabellebody}%
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   598
%%% Local Variables:
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   599
%%% mode: latex
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   600
%%% TeX-master: "root"
c0cd613a49eb move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff changeset
   601
%%% End: