10305
|
1 |
(*<*)theory Overloading = Overloading1:(*>*)
|
|
2 |
instance list :: ("term")ordrel
|
|
3 |
by intro_classes
|
|
4 |
|
|
5 |
text{*\noindent
|
|
6 |
This means. Of course we should also define the meaning of @{text <<=} and
|
|
7 |
@{text <<} on lists.
|
|
8 |
*}
|
|
9 |
|
|
10 |
defs (overloaded)
|
|
11 |
prefix_def:
|
|
12 |
"xs <<= (ys::'a::ordrel list) \<equiv> \<exists>zs. ys = xs@zs"
|
|
13 |
strict_prefix_def:
|
|
14 |
"xs << (ys::'a::ordrel list) \<equiv> xs <<= ys \<and> xs \<noteq> ys"
|
|
15 |
|
|
16 |
text{*
|
|
17 |
We could also have made the second definition non-overloaded once and for
|
|
18 |
all: @{prop"x << y \<equiv> x <<= y \<and> x \<noteq> y"}. This would have saved us writing
|
|
19 |
many similar definitions at different types, but it would also have fixed
|
|
20 |
that @{text <<} is defined in terms of @{text <<=} and never the other way
|
|
21 |
around. Below you will see why we want to avoid this asymmetry.
|
|
22 |
*}
|
|
23 |
(*<*)end(*>*)
|