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