doc-src/TutorialI/Types/document/Overloading2.tex
author nipkow
Wed, 07 Mar 2001 15:54:11 +0100
changeset 11196 bb4ede27fcb7
parent 10978 5eebea8f359f
child 11277 a2bff98d6e5d
permissions -rw-r--r--
*** empty log message ***
nipkow@10305
     1
%
nipkow@10305
     2
\begin{isabellebody}%
nipkow@10305
     3
\def\isabellecontext{Overloading{\isadigit{2}}}%
nipkow@10305
     4
%
nipkow@10305
     5
\begin{isamarkuptext}%
nipkow@10305
     6
Of course this is not the only possible definition of the two relations.
nipkow@10328
     7
Componentwise comparison of lists of equal length also makes sense. This time
nipkow@10328
     8
the elements of the list must also be of class \isa{ordrel} to permit their
nipkow@10328
     9
comparison:%
nipkow@10305
    10
\end{isamarkuptext}%
nipkow@10305
    11
\isacommand{instance}\ list\ {\isacharcolon}{\isacharcolon}\ {\isacharparenleft}ordrel{\isacharparenright}ordrel\isanewline
nipkow@10305
    12
\isacommand{by}\ intro{\isacharunderscore}classes\isanewline
nipkow@10305
    13
\isanewline
nipkow@10305
    14
\isacommand{defs}\ {\isacharparenleft}\isakeyword{overloaded}{\isacharparenright}\isanewline
nipkow@10305
    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
nipkow@10305
    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}%
nipkow@10305
    17
\begin{isamarkuptext}%
nipkow@10328
    18
\noindent
nipkow@10396
    19
The infix function \isa{{\isacharbang}} yields the nth element of a list.%
nipkow@10396
    20
\end{isamarkuptext}%
nipkow@10396
    21
%
paulson@10878
    22
\isamarkupsubsubsection{Predefined Overloading%
paulson@10397
    23
}
nipkow@10396
    24
%
nipkow@10396
    25
\begin{isamarkuptext}%
nipkow@10396
    26
HOL comes with a number of overloaded constants and corresponding classes.
nipkow@10978
    27
The most important ones are listed in Table~\ref{tab:overloading} in the appendix. They are
nipkow@10971
    28
defined on all numeric types and sometimes on other types as well, for example
nipkow@10396
    29
\isa{{\isacharminus}}, \isa{{\isasymle}} and \isa{{\isacharless}} on sets.
nipkow@10396
    30
nipkow@10696
    31
In addition there is a special input syntax for bounded quantifiers:
nipkow@10696
    32
\begin{center}
nipkow@10696
    33
\begin{tabular}{lcl}
nipkow@11196
    34
\isa{{\isasymforall}x\ {\isasymle}\ y{\isachardot}\ P\ x} & \isa{{\isasymrightharpoonup}} & \isa{{\isasymforall}x{\isachardot}\ x\ {\isasymle}\ y\ {\isasymlongrightarrow}\ P\ x} \\
nipkow@11196
    35
\isa{{\isasymexists}x\ {\isasymle}\ y{\isachardot}\ P\ x} & \isa{{\isasymrightharpoonup}} & \isa{{\isasymexists}x{\isachardot}\ x\ {\isasymle}\ y\ {\isasymand}\ P\ x}
nipkow@10696
    36
\end{tabular}
nipkow@10696
    37
\end{center}
nipkow@10696
    38
And analogously for \isa{{\isacharless}} instead of \isa{{\isasymle}}.
nipkow@10696
    39
The form on the left is translated into the one on the right upon input but it is not
nipkow@10696
    40
translated back upon output.%
nipkow@10305
    41
\end{isamarkuptext}%
nipkow@10305
    42
\end{isabellebody}%
nipkow@10305
    43
%%% Local Variables:
nipkow@10305
    44
%%% mode: latex
nipkow@10305
    45
%%% TeX-master: "root"
nipkow@10305
    46
%%% End: