10305
|
1 |
(*<*)theory Overloading2 = Overloading1:(*>*)
|
|
2 |
|
|
3 |
text{*
|
|
4 |
Of course this is not the only possible definition of the two relations.
|
10328
|
5 |
Componentwise comparison of lists of equal length also makes sense. This time
|
|
6 |
the elements of the list must also be of class @{text ordrel} to permit their
|
|
7 |
comparison:
|
10305
|
8 |
*}
|
|
9 |
|
|
10 |
instance list :: (ordrel)ordrel
|
|
11 |
by intro_classes
|
|
12 |
|
|
13 |
defs (overloaded)
|
|
14 |
le_list_def: "xs <<= (ys::'a::ordrel list) \<equiv>
|
|
15 |
size xs = size ys \<and> (\<forall>i<size xs. xs!i <<= ys!i)"
|
|
16 |
|
10328
|
17 |
text{*\noindent
|
|
18 |
The infix function @{text"!"} yields the nth element of a list.
|
10396
|
19 |
*}
|
|
20 |
|
10885
|
21 |
subsubsection{*Predefined Overloading*}
|
10396
|
22 |
|
|
23 |
text{*
|
|
24 |
HOL comes with a number of overloaded constants and corresponding classes.
|
10978
|
25 |
The most important ones are listed in Table~\ref{tab:overloading} in the appendix. They are
|
10971
|
26 |
defined on all numeric types and sometimes on other types as well, for example
|
10396
|
27 |
@{text"-"}, @{text"\<le>"} and @{text"<"} on sets.
|
|
28 |
|
10696
|
29 |
In addition there is a special input syntax for bounded quantifiers:
|
|
30 |
\begin{center}
|
|
31 |
\begin{tabular}{lcl}
|
11196
|
32 |
@{text"\<forall>x \<le> y. P x"} & @{text"\<rightharpoonup>"} & @{prop"\<forall>x. x \<le> y \<longrightarrow> P x"} \\
|
|
33 |
@{text"\<exists>x \<le> y. P x"} & @{text"\<rightharpoonup>"} & @{prop"\<exists>x. x \<le> y \<and> P x"}
|
10696
|
34 |
\end{tabular}
|
|
35 |
\end{center}
|
|
36 |
And analogously for @{text"<"} instead of @{text"\<le>"}.
|
11277
|
37 |
The form on the left is translated into the one on the right upon input.
|
|
38 |
For technical reasons, it is not translated back upon output.
|
10328
|
39 |
*}(*<*)end(*>*)
|