doc-src/TutorialI/Types/Overloading.thy
changeset 10328 bf33cbd76c05
parent 10305 adff80268127
child 11196 bb4ede27fcb7
equal deleted inserted replaced
10327:19214ac381cf 10328:bf33cbd76c05
     1 (*<*)theory Overloading = Overloading1:(*>*)
     1 (*<*)theory Overloading = Overloading1:(*>*)
     2 instance list :: ("term")ordrel
     2 instance list :: ("term")ordrel
     3 by intro_classes
     3 by intro_classes
     4 
     4 
     5 text{*\noindent
     5 text{*\noindent
     6 This means. Of course we should also define the meaning of @{text <<=} and
     6 This \isacommand{instance} declaration can be read like the declaration of
     7 @{text <<} on lists.
     7 a function on types: the constructor @{text list} maps types of class @{text
       
     8 term}, i.e.\ all HOL types, to types of class @{text ordrel}, i.e.\
       
     9 if @{text"ty :: term"} then @{text"ty list :: ordrel"}.
       
    10 Of course we should also define the meaning of @{text <<=} and
       
    11 @{text <<} on lists:
     8 *}
    12 *}
     9 
    13 
    10 defs (overloaded)
    14 defs (overloaded)
    11 prefix_def:
    15 prefix_def:
    12   "xs <<= (ys::'a::ordrel list)  \<equiv>  \<exists>zs. ys = xs@zs"
    16   "xs <<= (ys::'a::ordrel list)  \<equiv>  \<exists>zs. ys = xs@zs"