author | wenzelm |
Wed, 19 Oct 2005 21:52:07 +0200 | |
changeset 17914 | 99ead7a7eb42 |
parent 12338 | de0f4a63baa5 |
child 27169 | 89d5f117add3 |
permissions | -rw-r--r-- |
17914 | 1 |
(*<*)theory Overloading imports Overloading1 begin(*>*) |
12338
de0f4a63baa5
renamed class "term" to "type" (actually "HOL.type");
wenzelm
parents:
11494
diff
changeset
|
2 |
instance list :: (type)ordrel |
10305 | 3 |
by intro_classes |
4 |
||
5 |
text{*\noindent |
|
10328 | 6 |
This \isacommand{instance} declaration can be read like the declaration of |
11494 | 7 |
a function on types. The constructor @{text list} maps types of class @{text |
12338
de0f4a63baa5
renamed class "term" to "type" (actually "HOL.type");
wenzelm
parents:
11494
diff
changeset
|
8 |
type} (all HOL types), to types of class @{text ordrel}; |
11494 | 9 |
in other words, |
12338
de0f4a63baa5
renamed class "term" to "type" (actually "HOL.type");
wenzelm
parents:
11494
diff
changeset
|
10 |
if @{text"ty :: type"} then @{text"ty list :: ordrel"}. |
10328 | 11 |
Of course we should also define the meaning of @{text <<=} and |
12 |
@{text <<} on lists: |
|
10305 | 13 |
*} |
14 |
||
15 |
defs (overloaded) |
|
16 |
prefix_def: |
|
17 |
"xs <<= (ys::'a::ordrel list) \<equiv> \<exists>zs. ys = xs@zs" |
|
18 |
strict_prefix_def: |
|
19 |
"xs << (ys::'a::ordrel list) \<equiv> xs <<= ys \<and> xs \<noteq> ys" |
|
20 |
(*<*)end(*>*) |