doc-src/TutorialI/Types/Overloading.thy
author wenzelm
Sat, 01 Dec 2001 18:52:32 +0100
changeset 12338 de0f4a63baa5
parent 11494 23a118849801
child 17914 99ead7a7eb42
permissions -rw-r--r--
renamed class "term" to "type" (actually "HOL.type");

(*<*)theory Overloading = Overloading1:(*>*)
instance list :: (type)ordrel
by intro_classes

text{*\noindent
This \isacommand{instance} declaration can be read like the declaration of
a function on types.  The constructor @{text list} maps types of class @{text
type} (all HOL types), to types of class @{text ordrel};
in other words,
if @{text"ty :: type"} then @{text"ty list :: ordrel"}.
Of course we should also define the meaning of @{text <<=} and
@{text <<} on lists:
*}

defs (overloaded)
prefix_def:
  "xs <<= (ys::'a::ordrel list)  \<equiv>  \<exists>zs. ys = xs@zs"
strict_prefix_def:
  "xs << (ys::'a::ordrel list)   \<equiv>  xs <<= ys \<and> xs \<noteq> ys"
(*<*)end(*>*)