src/HOLCF/Lift.thy
changeset 12338 de0f4a63baa5
parent 12026 0b1d80ada4ab
child 14096 f79d139c7e46
equal deleted inserted replaced
12337:7c6a970f0808 12338:de0f4a63baa5
     2     ID:         $Id$
     2     ID:         $Id$
     3     Author:     Olaf Mueller
     3     Author:     Olaf Mueller
     4     License:    GPL (GNU GENERAL PUBLIC LICENSE)
     4     License:    GPL (GNU GENERAL PUBLIC LICENSE)
     5 *)
     5 *)
     6 
     6 
     7 header {* Lifting types of class term to flat pcpo's *}
     7 header {* Lifting types of class type to flat pcpo's *}
     8 
     8 
     9 theory Lift = Cprod3:
     9 theory Lift = Cprod3:
    10 
    10 
    11 defaultsort "term"
    11 defaultsort type
    12 
    12 
    13 
    13 
    14 typedef 'a lift = "UNIV :: 'a option set" ..
    14 typedef 'a lift = "UNIV :: 'a option set" ..
    15 
    15 
    16 constdefs
    16 constdefs
    17   Undef :: "'a lift"
    17   Undef :: "'a lift"
    18   "Undef == Abs_lift None"
    18   "Undef == Abs_lift None"
    19   Def :: "'a => 'a lift"
    19   Def :: "'a => 'a lift"
    20   "Def x == Abs_lift (Some x)"
    20   "Def x == Abs_lift (Some x)"
    21 
    21 
    22 instance lift :: ("term") sq_ord ..
    22 instance lift :: (type) sq_ord ..
    23 
    23 
    24 defs (overloaded)
    24 defs (overloaded)
    25   less_lift_def: "x << y == (x=y | x=Undef)"
    25   less_lift_def: "x << y == (x=y | x=Undef)"
    26 
    26 
    27 instance lift :: ("term") po
    27 instance lift :: (type) po
    28 proof
    28 proof
    29   fix x y z :: "'a lift"
    29   fix x y z :: "'a lift"
    30   show "x << x" by (unfold less_lift_def) blast
    30   show "x << x" by (unfold less_lift_def) blast
    31   { assume "x << y" and "y << x" thus "x = y" by (unfold less_lift_def) blast }
    31   { assume "x << y" and "y << x" thus "x = y" by (unfold less_lift_def) blast }
    32   { assume "x << y" and "y << z" thus "x << z" by (unfold less_lift_def) blast }
    32   { assume "x << y" and "y << z" thus "x << z" by (unfold less_lift_def) blast }
   109 theorem cpo_lift: "chain (Y::nat => 'a lift) ==> EX x. range Y <<| x"
   109 theorem cpo_lift: "chain (Y::nat => 'a lift) ==> EX x. range Y <<| x"
   110   apply (cut_tac flat_imp_chfin_poo)
   110   apply (cut_tac flat_imp_chfin_poo)
   111   apply (blast intro: lub_finch1)
   111   apply (blast intro: lub_finch1)
   112   done
   112   done
   113 
   113 
   114 instance lift :: ("term") pcpo
   114 instance lift :: (type) pcpo
   115   apply intro_classes
   115   apply intro_classes
   116    apply (erule cpo_lift)
   116    apply (erule cpo_lift)
   117   apply (rule least_lift)
   117   apply (rule least_lift)
   118   done
   118   done
   119 
   119 
   151 subsection {* Further operations *}
   151 subsection {* Further operations *}
   152 
   152 
   153 consts
   153 consts
   154  flift1      :: "('a => 'b::pcpo) => ('a lift -> 'b)"
   154  flift1      :: "('a => 'b::pcpo) => ('a lift -> 'b)"
   155  flift2      :: "('a => 'b)       => ('a lift -> 'b lift)"
   155  flift2      :: "('a => 'b)       => ('a lift -> 'b lift)"
   156  liftpair    ::"'a::term lift * 'b::term lift => ('a * 'b) lift"
   156  liftpair    ::"'a::type lift * 'b::type lift => ('a * 'b) lift"
   157 
   157 
   158 defs
   158 defs
   159  flift1_def:
   159  flift1_def:
   160   "flift1 f == (LAM x. (case x of
   160   "flift1 f == (LAM x. (case x of
   161                    UU => UU
   161                    UU => UU
   217   by (simp add: less_lift)
   217   by (simp add: less_lift)
   218 
   218 
   219 
   219 
   220 subsection {* Lift is flat *}
   220 subsection {* Lift is flat *}
   221 
   221 
   222 instance lift :: ("term") flat
   222 instance lift :: (type) flat
   223 proof
   223 proof
   224   show "ALL x y::'a lift. x << y --> x = UU | x = y"
   224   show "ALL x y::'a lift. x << y --> x = UU | x = y"
   225     by (simp add: less_lift)
   225     by (simp add: less_lift)
   226 qed
   226 qed
   227 
   227