doc-src/TutorialI/Types/Overloading.thy
author paulson
Thu, 29 Jan 2009 12:24:00 +0000
changeset 29685 aba49b4fe959
parent 27169 89d5f117add3
child 31707 678d294a563c
permissions -rw-r--r--
Automated merge with ssh://paulson@atbroy100.informatik.tu-muenchen.de//home/isabelle-repository/repos/isabelle

(*<*)theory Overloading imports Overloading1 begin(*>*)
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 list)  \<equiv>  \<exists>zs. ys = xs@zs"
strict_prefix_def:
  "xs << (ys::'a list)   \<equiv>  xs <<= ys \<and> xs \<noteq> ys"

(*<*)end(*>*)