src/HOL/HOLCF/Library/Sum_Cpo.thy
changeset 41292 2b7bc8d9fd6e
parent 40830 158d18502378
child 41321 4e72b6fc9dd4
equal deleted inserted replaced
41291:752d81c2ce25 41292:2b7bc8d9fd6e
   258 apply (case_tac x, simp)
   258 apply (case_tac x, simp)
   259 apply (rename_tac a, case_tac a, simp, simp)
   259 apply (rename_tac a, case_tac a, simp, simp)
   260 apply (rename_tac b, case_tac b, simp, simp)
   260 apply (rename_tac b, case_tac b, simp, simp)
   261 done
   261 done
   262 
   262 
       
   263 lemma ep_pair_strictify_up:
       
   264   "ep_pair (strictify\<cdot>up) (fup\<cdot>ID)"
       
   265 apply (rule ep_pair.intro)
       
   266 apply (simp add: strictify_conv_if)
       
   267 apply (case_tac y, simp, simp add: strictify_conv_if)
       
   268 done
       
   269 
       
   270 definition sum_liftdefl :: "udom u defl \<rightarrow> udom u defl \<rightarrow> udom u defl"
       
   271   where "sum_liftdefl = defl_fun2 (u_map\<cdot>emb oo strictify\<cdot>up)
       
   272     (fup\<cdot>ID oo u_map\<cdot>prj) ssum_map"
       
   273 
   263 instantiation sum :: (predomain, predomain) predomain
   274 instantiation sum :: (predomain, predomain) predomain
   264 begin
   275 begin
   265 
   276 
   266 definition
   277 definition
   267   "liftemb = emb oo encode_sum_u"
   278   "liftemb = (u_map\<cdot>emb oo strictify\<cdot>up) oo
   268 
   279     (ssum_map\<cdot>liftemb\<cdot>liftemb oo encode_sum_u)"
   269 definition
   280 
   270   "liftprj = decode_sum_u oo prj"
   281 definition
   271 
   282   "liftprj = (decode_sum_u oo ssum_map\<cdot>liftprj\<cdot>liftprj) oo
   272 definition
   283     (fup\<cdot>ID oo u_map\<cdot>prj)"
   273   "liftdefl (t::('a + 'b) itself) = DEFL('a u \<oplus> 'b u)"
   284 
       
   285 definition
       
   286   "liftdefl (t::('a + 'b) itself) = sum_liftdefl\<cdot>LIFTDEFL('a)\<cdot>LIFTDEFL('b)"
   274 
   287 
   275 instance proof
   288 instance proof
   276   show "ep_pair liftemb (liftprj :: udom \<rightarrow> ('a + 'b) u)"
   289   show "ep_pair liftemb (liftprj :: udom u \<rightarrow> ('a + 'b) u)"
   277     unfolding liftemb_sum_def liftprj_sum_def
   290     unfolding liftemb_sum_def liftprj_sum_def
   278     apply (rule ep_pair_comp)
   291     by (intro ep_pair_comp ep_pair_ssum_map ep_pair_u_map ep_pair_emb_prj
   279     apply (rule ep_pair.intro, simp, simp)
   292        ep_pair_strictify_up predomain_ep, simp add: ep_pair.intro)
   280     apply (rule ep_pair_emb_prj)
   293   show "cast\<cdot>LIFTDEFL('a + 'b) = liftemb oo (liftprj :: udom u \<rightarrow> ('a + 'b) u)"
   281     done
       
   282   show "cast\<cdot>LIFTDEFL('a + 'b) = liftemb oo (liftprj :: udom \<rightarrow> ('a + 'b) u)"
       
   283     unfolding liftemb_sum_def liftprj_sum_def liftdefl_sum_def
   294     unfolding liftemb_sum_def liftprj_sum_def liftdefl_sum_def
   284     by (simp add: cast_DEFL cfcomp1)
   295     apply (subst sum_liftdefl_def, subst cast_defl_fun2)
       
   296     apply (intro ep_pair_comp ep_pair_u_map ep_pair_emb_prj
       
   297         ep_pair_strictify_up)
       
   298     apply (erule (1) finite_deflation_ssum_map)
       
   299     by (simp add: cast_liftdefl cfcomp1 ssum_map_map)
   285 qed
   300 qed
   286 
   301 
   287 end
   302 end
   288 
   303 
   289 end
   304 end