author | haftmann |
Fri, 02 Mar 2007 15:43:18 +0100 | |
changeset 22387 | 17827a3c02d0 |
parent 21558 | 63278052bb72 |
child 22834 | bf67f798f063 |
permissions | -rw-r--r-- |
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 | 4 |
% |
5 |
\isadelimtheory |
|
6 |
% |
|
7 |
\endisadelimtheory |
|
8 |
% |
|
9 |
\isatagtheory |
|
10 |
% |
|
11 |
\endisatagtheory |
|
12 |
{\isafoldtheory}% |
|
13 |
% |
|
14 |
\isadelimtheory |
|
15 |
% |
|
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 | 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 | 58 |
typically in \texttt{root.tex}. For a start, you should |
59 |
\verb!\usepackage{amssymb}! --- otherwise typesetting |
|
60 |
\isa{{\isachardoublequote}{\isasymnot}{\isacharparenleft}{\isasymexists}x{\isachardot}\ P\ x{\isacharparenright}{\isachardoublequote}} will fail because the AMS symbol |
|
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 | 75 |
The formula \isa{{\isachardoublequote}{\isasymnot}{\isacharparenleft}{\isasymexists}x{\isachardot}\ P\ x{\isacharparenright}{\isachardoublequote}} is typeset as \isa{{\isasymnexists}x{\isachardot}\ P\ x}. |
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}}. |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
98 |
\item \isa{{\isasymemptyset}} instead of \isa{{\isacharbraceleft}{\isacharbraceright}}. |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
99 |
\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
|
100 |
\end{itemize}% |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
101 |
\end{isamarkuptext}% |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
102 |
\isamarkuptrue% |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
103 |
% |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
104 |
\isamarkupsubsection{Lists% |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
105 |
} |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
106 |
\isamarkuptrue% |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
107 |
% |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
108 |
\begin{isamarkuptext}% |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
109 |
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
|
110 |
\begin{itemize} |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
111 |
\item \isa{x{\isasymcdot}xs} instead of \isa{x\ {\isacharhash}\ xs}. |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
112 |
Exceptionally, \isa{x{\isasymcdot}xs} is also input syntax. |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
113 |
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
|
114 |
\verb!\isasymcdot! in \LaTeX: |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
115 |
\verb!\renewcommand{\isasymcdot}{\isamath{\,\cdot\,}}! |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
116 |
|
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
117 |
\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
|
118 |
\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
|
119 |
the $n$th element of \isa{xs}. |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
120 |
|
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
121 |
\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
|
122 |
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
|
123 |
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
|
124 |
\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
|
125 |
line breaking behaviour: |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
126 |
\begin{isabelle}% |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
127 |
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}}% |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
128 |
\end{isabelle} |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
129 |
|
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
130 |
\end{itemize}% |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
131 |
\end{isamarkuptext}% |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
132 |
\isamarkuptrue% |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
133 |
% |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
134 |
\isamarkupsection{Printing theorems% |
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 |
\isamarkuptrue% |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
137 |
% |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
138 |
\isamarkupsubsection{Question marks% |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
139 |
} |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
140 |
\isamarkuptrue% |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
141 |
% |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
142 |
\begin{isamarkuptext}% |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
143 |
If you print anything, especially theorems, containing |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
144 |
schematic variables they are prefixed with a question mark: |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
145 |
\verb!@!\verb!{thm conjI}! results in \isa{{\isasymlbrakk}{\isacharquery}P{\isacharsemicolon}\ {\isacharquery}Q{\isasymrbrakk}\ {\isasymLongrightarrow}\ {\isacharquery}P\ {\isasymand}\ {\isacharquery}Q}. Most of the time |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
146 |
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
|
147 |
\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
|
148 |
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
|
149 |
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
|
150 |
|
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
151 |
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
|
152 |
If you would rather never see question marks, simply put |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
153 |
\begin{verbatim} |
15984 | 154 |
reset show_question_marks; |
15893
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
155 |
\end{verbatim} |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
156 |
at the beginning of your file \texttt{ROOT.ML}. |
16075 | 157 |
The rest of this document is produced with this flag reset. |
158 |
||
159 |
Hint: Resetting \verb!show_question_marks! only supresses question |
|
160 |
marks; variables that end in digits, e.g. \isa{x{\isadigit{1}}}, are still |
|
161 |
printed with a trailing \isa{{\isachardot}{\isadigit{0}}}, e.g. \isa{x{\isadigit{1}}{\isachardot}{\isadigit{0}}}, their |
|
162 |
internal index. This can be avoided by turning the last digit into a |
|
163 |
subscript: write \verb!x\<^isub>1! and 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
|
164 |
\end{isamarkuptext}% |
17175 | 165 |
\isamarkuptrue% |
17125 | 166 |
% |
167 |
\isadelimML |
|
168 |
% |
|
169 |
\endisadelimML |
|
170 |
% |
|
171 |
\isatagML |
|
172 |
% |
|
173 |
\endisatagML |
|
174 |
{\isafoldML}% |
|
175 |
% |
|
176 |
\isadelimML |
|
177 |
% |
|
178 |
\endisadelimML |
|
15893
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
179 |
% |
17134 | 180 |
\isamarkupsubsection{Variable names\label{sec:varnames}% |
16396 | 181 |
} |
182 |
\isamarkuptrue% |
|
183 |
% |
|
184 |
\begin{isamarkuptext}% |
|
185 |
It sometimes happens that you want to change the name of a |
|
186 |
variable in a theorem before printing it. This can easily be achieved |
|
187 |
with the help of Isabelle's instantiation attribute \texttt{where}: |
|
188 |
\isa{{\isasymlbrakk}{\isasymphi}{\isacharsemicolon}\ {\isasympsi}{\isasymrbrakk}\ {\isasymLongrightarrow}\ {\isasymphi}\ {\isasymand}\ {\isasympsi}} is the result of |
|
189 |
\begin{quote} |
|
190 |
\verb!@!\verb!{thm conjI[where P = \<phi> and Q = \<psi>]}! |
|
191 |
\end{quote} |
|
192 |
To support the ``\_''-notation for irrelevant variables |
|
193 |
the constant \texttt{DUMMY} has been introduced: |
|
194 |
\isa{fst\ {\isacharparenleft}a{\isacharcomma}\ \_{\isacharparenright}\ {\isacharequal}\ a} is produced by |
|
195 |
\begin{quote} |
|
196 |
\verb!@!\verb!{thm fst_conv[where b = DUMMY]}! |
|
197 |
\end{quote}% |
|
198 |
\end{isamarkuptext}% |
|
199 |
\isamarkuptrue% |
|
200 |
% |
|
15893
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
201 |
\isamarkupsubsection{Inference rules% |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
202 |
} |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
203 |
\isamarkuptrue% |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
204 |
% |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
205 |
\begin{isamarkuptext}% |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
206 |
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
|
207 |
R\'emy's \texttt{mathpartir} package~\cite{mathpartir} |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
208 |
for typesetting inference rules in your \LaTeX\ file. |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
209 |
|
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
210 |
Writing \verb!@!\verb!{thm[mode=Rule] conjI}! produces |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
211 |
\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
|
212 |
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
|
213 |
\begin{center} |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
214 |
\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
|
215 |
\end{center} |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
216 |
is produced by |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
217 |
\begin{quote} |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
218 |
\verb!\begin{center}!\\ |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
219 |
\verb!@!\verb!{thm[mode=Rule] conjI} {\sc conjI}!\\ |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
220 |
\verb!\end{center}! |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
221 |
\end{quote} |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
222 |
It is not recommended to use the standard \texttt{display} attribute |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
223 |
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
|
224 |
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
|
225 |
clash. |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
226 |
|
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
227 |
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
|
228 |
\begin{quote} |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
229 |
\verb!\begin{center}\isastyle!\\ |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
230 |
\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
|
231 |
\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
|
232 |
\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
|
233 |
\verb!\end{center}! |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
234 |
\end{quote} |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
235 |
yields |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
236 |
\begin{center}\isastyle |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
237 |
\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
|
238 |
\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
|
239 |
\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
|
240 |
\end{center} |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
241 |
Note that we included \verb!\isastyle! to obtain |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
242 |
the smaller font that otherwise comes only with \texttt{display}. |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
243 |
|
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
244 |
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
|
245 |
premises for one line: |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
246 |
\begin{center} |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
247 |
\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
|
248 |
\end{center} |
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 |
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
|
251 |
the line. 2. Premises that are \isa{{\isasymLongrightarrow}}-implications are again |
22387 | 252 |
displayed with a horizontal line, which looks at least unusual. |
253 |
||
254 |
||
255 |
In case you print theorems without premises no rule will be printed by the |
|
256 |
\texttt{Rule} print mode. However, you can use \texttt{Axiom} instead: |
|
257 |
\begin{quote} |
|
258 |
\verb!\begin{center}\isastyle!\\ |
|
259 |
\verb!@!\verb!{thm[mode=Axiom] refl} {\sc refl}! \\ |
|
260 |
\verb!\end{center}! |
|
261 |
\end{quote} |
|
262 |
yields |
|
263 |
\begin{center}\isastyle |
|
264 |
\isa{\mbox{}\inferrule{\mbox{}}{\mbox{t\ {\isacharequal}\ t}}} {\sc refl} |
|
265 |
\end{center}% |
|
15893
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
266 |
\end{isamarkuptext}% |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
267 |
\isamarkuptrue% |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
268 |
% |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
269 |
\isamarkupsubsection{If-then% |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
270 |
} |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
271 |
\isamarkuptrue% |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
272 |
% |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
273 |
\begin{isamarkuptext}% |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
274 |
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
|
275 |
the body of |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
276 |
\newtheorem{theorem}{Theorem} |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
277 |
\begin{theorem} |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
278 |
\isa{{\rmfamily\upshape\normalsize{}If\,}\ \mbox{i\ {\isasymle}\ j}\ {\rmfamily\upshape\normalsize \,and\,}\ \mbox{j\ {\isasymle}\ k}\ {\rmfamily\upshape\normalsize \,then\,}\ i\ {\isasymle}\ k{\isachardot}} |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
279 |
\end{theorem} |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
280 |
by typing |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
281 |
\begin{quote} |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
282 |
\verb!@!\verb!{thm[mode=IfThen] le_trans}! |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
283 |
\end{quote} |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
284 |
|
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
285 |
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
|
286 |
At times this is too drastic: |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
287 |
\begin{theorem} |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
288 |
\isa{{\rmfamily\upshape\normalsize{}If\,}\ \mbox{longpremise}\ {\rmfamily\upshape\normalsize \,and\,}\ \mbox{longerpremise}\ {\rmfamily\upshape\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}}\ {\rmfamily\upshape\normalsize \,and\,}\ \mbox{longestpremise}\ {\rmfamily\upshape\normalsize \,then\,}\ conclusion{\isachardot}} |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
289 |
\end{theorem} |
16154 | 290 |
In which case you should use \texttt{IfThenNoBox} instead of |
291 |
\texttt{IfThen}: |
|
15893
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
292 |
\begin{theorem} |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
293 |
\isa{{\rmfamily\upshape\normalsize{}If\,}\ longpremise\ {\rmfamily\upshape\normalsize \,and\,}\ longerpremise\ {\rmfamily\upshape\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}\ {\rmfamily\upshape\normalsize \,and\,}\ longestpremise\ {\rmfamily\upshape\normalsize \,then\,}\ conclusion{\isachardot}} |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
294 |
\end{theorem}% |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
295 |
\end{isamarkuptext}% |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
296 |
\isamarkuptrue% |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
297 |
% |
16166 | 298 |
\isamarkupsubsection{Doing it yourself\label{sec:yourself}% |
16154 | 299 |
} |
300 |
\isamarkuptrue% |
|
301 |
% |
|
302 |
\begin{isamarkuptext}% |
|
303 |
If for some reason you want or need to present theorems your |
|
304 |
own way, you can extract the premises and the conclusion explicitly |
|
305 |
and combine them as you like: |
|
306 |
\begin{itemize} |
|
16171 | 307 |
\item \verb!@!\verb!{thm_style prem1! $thm$\verb!}! |
308 |
prints premise 1 of $thm$ (and similarly up to \texttt{prem9}). |
|
16166 | 309 |
\item \verb!@!\verb!{thm_style concl! $thm$\verb!}! |
16154 | 310 |
prints the conclusion of $thm$. |
311 |
\end{itemize} |
|
312 |
For example, ``from \isa{Q} and |
|
313 |
\isa{P} we conclude \isa{P\ {\isasymand}\ Q}'' |
|
314 |
is produced by |
|
315 |
\begin{quote} |
|
16176 | 316 |
\verb!from !\verb!@!\verb!{thm_style prem2 conjI}! \verb!and !\verb!@!\verb!{thm_style prem1 conjI}!\\ |
16166 | 317 |
\verb!we conclude !\verb!@!\verb!{thm_style concl conjI}! |
16154 | 318 |
\end{quote} |
319 |
Thus you can rearrange or hide premises and typeset the theorem as you like. |
|
320 |
The \verb!thm_style! antiquotation is a general mechanism explained |
|
321 |
in \S\ref{sec:styles}.% |
|
322 |
\end{isamarkuptext}% |
|
323 |
\isamarkuptrue% |
|
324 |
% |
|
15893
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
325 |
\isamarkupsubsection{Patterns% |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
326 |
} |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
327 |
\isamarkuptrue% |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
328 |
% |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
329 |
\begin{isamarkuptext}% |
17134 | 330 |
In \S\ref{sec:varnames} we shows how to create patterns containing |
331 |
``\isa{\_}''. |
|
15893
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
332 |
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
|
333 |
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
|
334 |
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
|
335 |
following: |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
336 |
|
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
337 |
\begin{center} |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
338 |
\begin{tabular}{l@ {~~produced by~~}l} |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
339 |
\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
|
340 |
\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
|
341 |
\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
|
342 |
\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
|
343 |
\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
|
344 |
\end{tabular} |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
345 |
\end{center}% |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
346 |
\end{isamarkuptext}% |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
347 |
\isamarkuptrue% |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
348 |
% |
16155 | 349 |
\isamarkupsection{Proofs% |
15893
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
350 |
} |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
351 |
\isamarkuptrue% |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
352 |
% |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
353 |
\begin{isamarkuptext}% |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
354 |
Full proofs, even if written in beautiful Isar style, are likely to |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
355 |
be too long and detailed to be included in conference papers, but |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
356 |
some key lemmas might be of interest. |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
357 |
|
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
358 |
It is usually easiest to put them in figures like the one in Fig.\ |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
359 |
\ref{fig:proof}. This was achieved with the \isakeyword{text\_raw} |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
360 |
command:% |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
361 |
\end{isamarkuptext}% |
17175 | 362 |
\isamarkuptrue% |
15893
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
363 |
% |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
364 |
\begin{figure} |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
365 |
\begin{center}\begin{minipage}{0.6\textwidth} |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
366 |
\isastyle\isamarkuptrue |
17175 | 367 |
\isacommand{lemma}\isamarkupfalse% |
368 |
\ True\isanewline |
|
17125 | 369 |
% |
370 |
\isadelimproof |
|
371 |
% |
|
372 |
\endisadelimproof |
|
373 |
% |
|
374 |
\isatagproof |
|
17175 | 375 |
\isacommand{proof}\isamarkupfalse% |
376 |
\ {\isacharminus}\isanewline |
|
15893
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
377 |
\ \ % |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
378 |
\isamarkupcmt{pretty trivial% |
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 |
\isanewline |
17175 | 381 |
\ \ \isacommand{show}\isamarkupfalse% |
382 |
\ True\ \isacommand{by}\isamarkupfalse% |
|
383 |
\ force\isanewline |
|
384 |
\isacommand{qed}\isamarkupfalse% |
|
385 |
% |
|
17125 | 386 |
\endisatagproof |
387 |
{\isafoldproof}% |
|
388 |
% |
|
389 |
\isadelimproof |
|
390 |
% |
|
391 |
\endisadelimproof |
|
15893
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
392 |
% |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
393 |
\end{minipage}\end{center} |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
394 |
\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
|
395 |
\end{figure} |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
396 |
% |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
397 |
\begin{isamarkuptext}% |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
398 |
\begin{quote} |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
399 |
\small |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
400 |
\verb!text_raw {!\verb!*!\\ |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
401 |
\verb! \begin{figure}!\\ |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
402 |
\verb! \begin{center}\begin{minipage}{0.6\textwidth}!\\ |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
403 |
\verb! \isastyle\isamarkuptrue!\\ |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
404 |
\verb!*!\verb!}!\\ |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
405 |
\verb!lemma True!\\ |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
406 |
\verb!proof -!\\ |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
407 |
\verb! -- "pretty trivial"!\\ |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
408 |
\verb! show True by force!\\ |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
409 |
\verb!qed!\\ |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
410 |
\verb!text_raw {!\verb!*!\\ |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
411 |
\verb! \end{minipage}\end{center}!\\ |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
412 |
\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
|
413 |
\verb! \end{figure}!\\ |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
414 |
\verb!*!\verb!}! |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
415 |
\end{quote}% |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
416 |
\end{isamarkuptext}% |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
417 |
\isamarkuptrue% |
15953 | 418 |
% |
16155 | 419 |
\isamarkupsection{Styles\label{sec:styles}% |
15953 | 420 |
} |
421 |
\isamarkuptrue% |
|
422 |
% |
|
423 |
\begin{isamarkuptext}% |
|
424 |
The \verb!thm! antiquotation works nicely for single theorems, but |
|
425 |
sets of equations as used in definitions are more difficult to |
|
16040 | 426 |
typeset nicely: people tend to prefer aligned \isa{{\isacharequal}} signs. |
15953 | 427 |
|
428 |
To deal with such cases where it is desirable to dive into the structure |
|
16040 | 429 |
of terms and theorems, Isabelle offers antiquotations featuring |
15953 | 430 |
``styles'': |
431 |
||
432 |
\begin{quote} |
|
433 |
\verb!@!\verb!{thm_style stylename thm}!\\ |
|
434 |
\verb!@!\verb!{term_style stylename term}! |
|
435 |
\end{quote} |
|
436 |
||
16040 | 437 |
A ``style'' is a transformation of propositions. There are predefined |
21558 | 438 |
styles, namely \verb!lhs! and \verb!rhs!, \verb!prem1! up to \verb!prem9!, and \verb!concl!. |
16166 | 439 |
For example, |
16076 | 440 |
the output |
15953 | 441 |
\begin{center} |
442 |
\begin{tabular}{l@ {~~\isa{{\isacharequal}}~~}l} |
|
443 |
\isa{foldl\ f\ a\ {\isacharbrackleft}{\isacharbrackright}} & \isa{a}\\ |
|
444 |
\isa{foldl\ f\ a\ {\isacharparenleft}x{\isasymcdot}xs{\isacharparenright}} & \isa{foldl\ f\ {\isacharparenleft}f\ a\ x{\isacharparenright}\ xs} |
|
445 |
\end{tabular} |
|
446 |
\end{center} |
|
447 |
is produced by the following code: |
|
448 |
\begin{quote} |
|
449 |
\verb!\begin{center}!\\ |
|
450 |
\verb!\begin{tabular}{l@ {~~!\verb!@!\verb!{text "="}~~}l}!\\ |
|
451 |
\verb!@!\verb!{thm_style lhs foldl_Nil} & @!\verb!{thm_style rhs foldl_Nil}!\\ |
|
452 |
\verb!@!\verb!{thm_style lhs foldl_Cons} & @!\verb!{thm_style rhs foldl_Cons}!\\ |
|
453 |
\verb!\end{tabular}!\\ |
|
454 |
\verb!\end{center}! |
|
455 |
\end{quote} |
|
456 |
Note the space between \verb!@! and \verb!{! in the tabular argument. |
|
457 |
It prevents Isabelle from interpreting \verb!@ {~~...~~}! |
|
16076 | 458 |
as an antiquotation. The styles \verb!lhs! and \verb!rhs! |
16040 | 459 |
extract the left hand side (or right hand side respectivly) from the |
16076 | 460 |
conclusion of propositions consisting of a binary operator |
16040 | 461 |
(e.~g.~\isa{{\isacharequal}}, \isa{{\isasymequiv}}, \isa{{\isacharless}}). |
15953 | 462 |
|
16166 | 463 |
Likewise, \verb!concl! may be used as a style to show just the |
16076 | 464 |
conclusion of a proposition. For example, take \verb!hd_Cons_tl!: |
16040 | 465 |
\begin{center} |
17125 | 466 |
\isa{{\isacharparenleft}xs{\isasymColon}{\isacharprime}a\ list{\isacharparenright}\ {\isasymnoteq}\ {\isacharbrackleft}{\isacharbrackright}\ {\isasymLongrightarrow}\ hd\ xs{\isasymcdot}tl\ xs\ {\isacharequal}\ xs} |
16040 | 467 |
\end{center} |
468 |
To print just the conclusion, |
|
15953 | 469 |
\begin{center} |
17125 | 470 |
\isa{hd\ {\isacharparenleft}xs{\isasymColon}{\isacharprime}a\ list{\isacharparenright}{\isasymcdot}tl\ xs\ {\isacharequal}\ xs} |
15953 | 471 |
\end{center} |
16040 | 472 |
type |
15953 | 473 |
\begin{quote} |
474 |
\verb!\begin{center}!\\ |
|
17125 | 475 |
\verb!@!\verb!{thm_style [show_types] concl hd_Cons_tl}!\\ |
15953 | 476 |
\verb!\end{center}! |
477 |
\end{quote} |
|
17134 | 478 |
Beware that any options must be placed \emph{before} |
17125 | 479 |
the name of the style, as in this example. |
480 |
||
16166 | 481 |
Further use cases can be found in \S\ref{sec:yourself}. |
482 |
||
15953 | 483 |
If you are not afraid of ML, you may also define your own styles. |
15960 | 484 |
A style is implemented by an ML function of type |
485 |
\verb!Proof.context -> term -> term!. |
|
16040 | 486 |
Have a look at the following example:% |
487 |
\end{isamarkuptext}% |
|
17175 | 488 |
\isamarkuptrue% |
17125 | 489 |
% |
490 |
\isadelimML |
|
491 |
% |
|
492 |
\endisadelimML |
|
493 |
% |
|
494 |
\isatagML |
|
495 |
% |
|
496 |
\endisatagML |
|
497 |
{\isafoldML}% |
|
498 |
% |
|
499 |
\isadelimML |
|
500 |
% |
|
501 |
\endisadelimML |
|
16040 | 502 |
% |
503 |
\begin{isamarkuptext}% |
|
504 |
\begin{quote} |
|
15953 | 505 |
\verb!setup {!\verb!*!\\ |
506 |
\verb!let!\\ |
|
16040 | 507 |
\verb! fun my_concl ctxt = Logic.strip_imp_concl!\\ |
18723 | 508 |
\verb! in TermStyle.add_style "my_concl" my_concl!\\ |
15953 | 509 |
\verb!end;!\\ |
510 |
\verb!*!\verb!}!\\ |
|
511 |
\end{quote} |
|
15960 | 512 |
|
16076 | 513 |
\noindent |
16166 | 514 |
This example shows how the \verb!concl! style is implemented |
16076 | 515 |
and may be used as as a ``copy-and-paste'' pattern to write your own styles. |
15960 | 516 |
|
16076 | 517 |
The code should go into your theory file, separate from the \LaTeX\ text. |
16040 | 518 |
The \verb!let! expression avoids polluting the |
15960 | 519 |
ML global namespace. Each style receives the current proof context |
16076 | 520 |
as first argument; this is helpful in situations where the |
521 |
style has some object-logic specific behaviour for example. |
|
15960 | 522 |
|
523 |
The mapping from identifier name to the style function |
|
17125 | 524 |
is done by the \verb|TermStyle.add_style| expression which expects the desired |
15960 | 525 |
style name and the style function as arguments. |
526 |
||
527 |
After this \verb!setup!, |
|
16040 | 528 |
there will be a new style available named \verb!my_concl!, thus allowing |
529 |
antiquoations like \verb!@!\verb!{thm_style my_concl hd_Cons_tl}! |
|
16076 | 530 |
yielding \isa{hd\ xs{\isasymcdot}tl\ xs\ {\isacharequal}\ xs}.% |
15953 | 531 |
\end{isamarkuptext}% |
17175 | 532 |
\isamarkuptrue% |
17125 | 533 |
% |
534 |
\isadelimtheory |
|
535 |
% |
|
536 |
\endisadelimtheory |
|
537 |
% |
|
538 |
\isatagtheory |
|
539 |
% |
|
540 |
\endisatagtheory |
|
541 |
{\isafoldtheory}% |
|
542 |
% |
|
543 |
\isadelimtheory |
|
544 |
% |
|
545 |
\endisadelimtheory |
|
15893
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
546 |
\end{isabellebody}% |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
547 |
%%% Local Variables: |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
548 |
%%% mode: latex |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
549 |
%%% TeX-master: "root" |
c0cd613a49eb
move generated files to document/, avoid CVS file overwrite in generated/
kleing
parents:
diff
changeset
|
550 |
%%% End: |