src/HOLCF/Lift.thy
changeset 26963 290d23780204
parent 26452 ed657432b8b9
child 27104 791607529f6d
equal deleted inserted replaced
26962:c8b20f615d6c 26963:290d23780204
     4 *)
     4 *)
     5 
     5 
     6 header {* Lifting types of class type to flat pcpo's *}
     6 header {* Lifting types of class type to flat pcpo's *}
     7 
     7 
     8 theory Lift
     8 theory Lift
     9 imports Discrete Up Cprod
     9 imports Discrete Up Cprod Countable
    10 begin
    10 begin
    11 
    11 
    12 defaultsort type
    12 defaultsort type
    13 
    13 
    14 pcpodef 'a lift = "UNIV :: 'a discr u set"
    14 pcpodef 'a lift = "UNIV :: 'a discr u set"
   202   simp_tac ss i THEN
   202   simp_tac ss i THEN
   203   REPEAT (cont_tac i)
   203   REPEAT (cont_tac i)
   204 end;
   204 end;
   205 *}
   205 *}
   206 
   206 
       
   207 subsection {* Lifted countable types are bifinite *}
       
   208 
       
   209 instantiation lift :: (countable) bifinite
       
   210 begin
       
   211 
       
   212 definition
       
   213   approx_lift_def:
       
   214     "approx = (\<lambda>n. FLIFT x. if to_nat x < n then Def x else \<bottom>)"
       
   215 
       
   216 instance proof
       
   217   fix x :: "'a lift"
       
   218   show "chain (\<lambda>i. approx i\<cdot>x)"
       
   219     unfolding approx_lift_def
       
   220     by (rule chainI, cases x, simp_all)
       
   221 next
       
   222   fix x :: "'a lift"
       
   223   show "(\<Squnion>i. approx i\<cdot>x) = x"
       
   224     unfolding approx_lift_def
       
   225     apply (cases x, simp)
       
   226     apply (rule thelubI)
       
   227     apply (rule is_lubI)
       
   228      apply (rule ub_rangeI, simp)
       
   229     apply (drule ub_rangeD)
       
   230     apply (erule rev_trans_less)
       
   231     apply simp
       
   232     apply (rule lessI)
       
   233     done
       
   234 next
       
   235   fix i :: nat and x :: "'a lift"
       
   236   show "approx i\<cdot>(approx i\<cdot>x) = approx i\<cdot>x"
       
   237     unfolding approx_lift_def
       
   238     by (cases x, simp, simp)
       
   239 next
       
   240   fix i :: nat
       
   241   show "finite {x::'a lift. approx i\<cdot>x = x}"
       
   242   proof (rule finite_subset)
       
   243     let ?S = "insert (\<bottom>::'a lift) (Def ` to_nat -` {..<i})"
       
   244     show "{x::'a lift. approx i\<cdot>x = x} \<subseteq> ?S"
       
   245       unfolding approx_lift_def
       
   246       by (rule subsetI, case_tac x, simp, simp split: split_if_asm)
       
   247     show "finite ?S"
       
   248       by (simp add: finite_vimageI)
       
   249   qed
       
   250 qed
       
   251 
   207 end
   252 end
       
   253 
       
   254 end