10305
|
1 |
%
|
|
2 |
\begin{isabellebody}%
|
|
3 |
\def\isabellecontext{Overloading{\isadigit{2}}}%
|
|
4 |
%
|
|
5 |
\begin{isamarkuptext}%
|
|
6 |
Of course this is not the only possible definition of the two relations.
|
10328
|
7 |
Componentwise comparison of lists of equal length also makes sense. This time
|
|
8 |
the elements of the list must also be of class \isa{ordrel} to permit their
|
|
9 |
comparison:%
|
10305
|
10 |
\end{isamarkuptext}%
|
|
11 |
\isacommand{instance}\ list\ {\isacharcolon}{\isacharcolon}\ {\isacharparenleft}ordrel{\isacharparenright}ordrel\isanewline
|
|
12 |
\isacommand{by}\ intro{\isacharunderscore}classes\isanewline
|
|
13 |
\isanewline
|
|
14 |
\isacommand{defs}\ {\isacharparenleft}\isakeyword{overloaded}{\isacharparenright}\isanewline
|
|
15 |
le{\isacharunderscore}list{\isacharunderscore}def{\isacharcolon}\ {\isachardoublequote}xs\ {\isacharless}{\isacharless}{\isacharequal}\ {\isacharparenleft}ys{\isacharcolon}{\isacharcolon}{\isacharprime}a{\isacharcolon}{\isacharcolon}ordrel\ list{\isacharparenright}\ {\isasymequiv}\isanewline
|
|
16 |
\ \ \ \ \ \ \ \ \ \ \ \ \ \ size\ xs\ {\isacharequal}\ size\ ys\ {\isasymand}\ {\isacharparenleft}{\isasymforall}i{\isacharless}size\ xs{\isachardot}\ xs{\isacharbang}i\ {\isacharless}{\isacharless}{\isacharequal}\ ys{\isacharbang}i{\isacharparenright}{\isachardoublequote}%
|
|
17 |
\begin{isamarkuptext}%
|
10328
|
18 |
\noindent
|
11494
|
19 |
The infix function \isa{{\isacharbang}} yields the nth element of a list.
|
|
20 |
|
|
21 |
\begin{warn}
|
|
22 |
A type constructor can be instantiated in only one way to
|
|
23 |
a given type class. For example, our two instantiations of \isa{list} must
|
|
24 |
reside in separate theories with disjoint scopes.\REMARK{Tobias, please check}
|
|
25 |
\end{warn}%
|
10396
|
26 |
\end{isamarkuptext}%
|
|
27 |
%
|
10878
|
28 |
\isamarkupsubsubsection{Predefined Overloading%
|
10397
|
29 |
}
|
10396
|
30 |
%
|
|
31 |
\begin{isamarkuptext}%
|
|
32 |
HOL comes with a number of overloaded constants and corresponding classes.
|
10978
|
33 |
The most important ones are listed in Table~\ref{tab:overloading} in the appendix. They are
|
10971
|
34 |
defined on all numeric types and sometimes on other types as well, for example
|
11494
|
35 |
$-$ and \isa{{\isasymle}} on sets.
|
10396
|
36 |
|
10696
|
37 |
In addition there is a special input syntax for bounded quantifiers:
|
|
38 |
\begin{center}
|
|
39 |
\begin{tabular}{lcl}
|
11196
|
40 |
\isa{{\isasymforall}x\ {\isasymle}\ y{\isachardot}\ P\ x} & \isa{{\isasymrightharpoonup}} & \isa{{\isasymforall}x{\isachardot}\ x\ {\isasymle}\ y\ {\isasymlongrightarrow}\ P\ x} \\
|
|
41 |
\isa{{\isasymexists}x\ {\isasymle}\ y{\isachardot}\ P\ x} & \isa{{\isasymrightharpoonup}} & \isa{{\isasymexists}x{\isachardot}\ x\ {\isasymle}\ y\ {\isasymand}\ P\ x}
|
10696
|
42 |
\end{tabular}
|
|
43 |
\end{center}
|
|
44 |
And analogously for \isa{{\isacharless}} instead of \isa{{\isasymle}}.
|
11277
|
45 |
The form on the left is translated into the one on the right upon input.
|
|
46 |
For technical reasons, it is not translated back upon output.%
|
10305
|
47 |
\end{isamarkuptext}%
|
|
48 |
\end{isabellebody}%
|
|
49 |
%%% Local Variables:
|
|
50 |
%%% mode: latex
|
|
51 |
%%% TeX-master: "root"
|
|
52 |
%%% End:
|