src/HOL/UNITY/ListOrder.thy
changeset 23767 7272a839ccd9
parent 16417 9bc16273c2d4
child 27682 25aceefd4786
equal deleted inserted replaced
23766:77e796fe89eb 23767:7272a839ccd9
    15 
    15 
    16 header {*The Prefix Ordering on Lists*}
    16 header {*The Prefix Ordering on Lists*}
    17 
    17 
    18 theory ListOrder imports Main begin
    18 theory ListOrder imports Main begin
    19 
    19 
    20 consts
    20 inductive_set
    21   genPrefix :: "('a * 'a)set => ('a list * 'a list)set"
    21   genPrefix :: "('a * 'a)set => ('a list * 'a list)set"
    22 
    22   for r :: "('a * 'a)set"
    23 inductive "genPrefix(r)"
    23  where
    24  intros
       
    25    Nil:     "([],[]) : genPrefix(r)"
    24    Nil:     "([],[]) : genPrefix(r)"
    26 
    25 
    27    prepend: "[| (xs,ys) : genPrefix(r);  (x,y) : r |] ==>
    26  | prepend: "[| (xs,ys) : genPrefix(r);  (x,y) : r |] ==>
    28 	     (x#xs, y#ys) : genPrefix(r)"
    27 	     (x#xs, y#ys) : genPrefix(r)"
    29 
    28 
    30    append:  "(xs,ys) : genPrefix(r) ==> (xs, ys@zs) : genPrefix(r)"
    29  | append:  "(xs,ys) : genPrefix(r) ==> (xs, ys@zs) : genPrefix(r)"
    31 
    30 
    32 instance list :: (type)ord ..
    31 instance list :: (type)ord ..
    33 
    32 
    34 defs
    33 defs
    35   prefix_def:        "xs <= zs  ==  (xs,zs) : genPrefix Id"
    34   prefix_def:        "xs <= zs  ==  (xs,zs) : genPrefix Id"
    43     "Le == {(x,y). x <= y}"
    42     "Le == {(x,y). x <= y}"
    44 
    43 
    45   Ge :: "(nat*nat) set"
    44   Ge :: "(nat*nat) set"
    46     "Ge == {(x,y). y <= x}"
    45     "Ge == {(x,y). y <= x}"
    47 
    46 
    48 syntax
    47 abbreviation
    49   pfixLe :: "[nat list, nat list] => bool"          (infixl "pfixLe" 50)
    48   pfixLe :: "[nat list, nat list] => bool"  (infixl "pfixLe" 50)  where
    50   pfixGe :: "[nat list, nat list] => bool"          (infixl "pfixGe" 50)
    49   "xs pfixLe ys == (xs,ys) : genPrefix Le"
    51 
    50 
    52 translations
    51 abbreviation
    53   "xs pfixLe ys" == "(xs,ys) : genPrefix Le"
    52   pfixGe :: "[nat list, nat list] => bool"  (infixl "pfixGe" 50)  where
    54 
    53   "xs pfixGe ys == (xs,ys) : genPrefix Ge"
    55   "xs pfixGe ys" == "(xs,ys) : genPrefix Ge"
       
    56 
    54 
    57 
    55 
    58 subsection{*preliminary lemmas*}
    56 subsection{*preliminary lemmas*}
    59 
    57 
    60 lemma Nil_genPrefix [iff]: "([], xs) : genPrefix r"
    58 lemma Nil_genPrefix [iff]: "([], xs) : genPrefix r"