src/HOLCF/Map_Functions.thy
changeset 40592 f432973ce0f6
parent 40502 8e92772bc0e8
equal deleted inserted replaced
40591:1c0b5bfa52a1 40592:f432973ce0f6
   378     by (rule subsetI, case_tac x, simp_all)
   378     by (rule subsetI, case_tac x, simp_all)
   379   thus "finite {x. ssum_map\<cdot>d1\<cdot>d2\<cdot>x = x}"
   379   thus "finite {x. ssum_map\<cdot>d1\<cdot>d2\<cdot>x = x}"
   380     by (rule finite_subset, simp add: d1.finite_fixes d2.finite_fixes)
   380     by (rule finite_subset, simp add: d1.finite_fixes d2.finite_fixes)
   381 qed
   381 qed
   382 
   382 
       
   383 subsection {* Map operator for strict function space *}
       
   384 
       
   385 definition
       
   386   sfun_map :: "('b \<rightarrow> 'a) \<rightarrow> ('c \<rightarrow> 'd) \<rightarrow> ('a \<rightarrow>! 'c) \<rightarrow> ('b \<rightarrow>! 'd)"
       
   387 where
       
   388   "sfun_map = (\<Lambda> a b. sfun_abs oo cfun_map\<cdot>a\<cdot>b oo sfun_rep)"
       
   389 
       
   390 lemma sfun_map_ID: "sfun_map\<cdot>ID\<cdot>ID = ID"
       
   391   unfolding sfun_map_def
       
   392   by (simp add: cfun_map_ID cfun_eq_iff)
       
   393 
       
   394 lemma sfun_map_map:
       
   395   assumes "f2\<cdot>\<bottom> = \<bottom>" and "g2\<cdot>\<bottom> = \<bottom>" shows
       
   396   "sfun_map\<cdot>f1\<cdot>g1\<cdot>(sfun_map\<cdot>f2\<cdot>g2\<cdot>p) =
       
   397     sfun_map\<cdot>(\<Lambda> x. f2\<cdot>(f1\<cdot>x))\<cdot>(\<Lambda> x. g1\<cdot>(g2\<cdot>x))\<cdot>p"
       
   398 unfolding sfun_map_def
       
   399 by (simp add: cfun_eq_iff strictify_cancel assms cfun_map_map)
       
   400 
       
   401 lemma ep_pair_sfun_map:
       
   402   assumes 1: "ep_pair e1 p1"
       
   403   assumes 2: "ep_pair e2 p2"
       
   404   shows "ep_pair (sfun_map\<cdot>p1\<cdot>e2) (sfun_map\<cdot>e1\<cdot>p2)"
       
   405 proof
       
   406   interpret e1p1: pcpo_ep_pair e1 p1
       
   407     unfolding pcpo_ep_pair_def by fact
       
   408   interpret e2p2: pcpo_ep_pair e2 p2
       
   409     unfolding pcpo_ep_pair_def by fact
       
   410   fix f show "sfun_map\<cdot>e1\<cdot>p2\<cdot>(sfun_map\<cdot>p1\<cdot>e2\<cdot>f) = f"
       
   411     unfolding sfun_map_def
       
   412     apply (simp add: sfun_eq_iff strictify_cancel)
       
   413     apply (rule ep_pair.e_inverse)
       
   414     apply (rule ep_pair_cfun_map [OF 1 2])
       
   415     done
       
   416   fix g show "sfun_map\<cdot>p1\<cdot>e2\<cdot>(sfun_map\<cdot>e1\<cdot>p2\<cdot>g) \<sqsubseteq> g"
       
   417     unfolding sfun_map_def
       
   418     apply (simp add: sfun_below_iff strictify_cancel)
       
   419     apply (rule ep_pair.e_p_below)
       
   420     apply (rule ep_pair_cfun_map [OF 1 2])
       
   421     done
       
   422 qed
       
   423 
       
   424 lemma deflation_sfun_map:
       
   425   assumes 1: "deflation d1"
       
   426   assumes 2: "deflation d2"
       
   427   shows "deflation (sfun_map\<cdot>d1\<cdot>d2)"
       
   428 apply (simp add: sfun_map_def)
       
   429 apply (rule deflation.intro)
       
   430 apply simp
       
   431 apply (subst strictify_cancel)
       
   432 apply (simp add: cfun_map_def deflation_strict 1 2)
       
   433 apply (simp add: cfun_map_def deflation.idem 1 2)
       
   434 apply (simp add: sfun_below_iff)
       
   435 apply (subst strictify_cancel)
       
   436 apply (simp add: cfun_map_def deflation_strict 1 2)
       
   437 apply (rule deflation.below)
       
   438 apply (rule deflation_cfun_map [OF 1 2])
       
   439 done
       
   440 
       
   441 lemma finite_deflation_sfun_map:
       
   442   assumes 1: "finite_deflation d1"
       
   443   assumes 2: "finite_deflation d2"
       
   444   shows "finite_deflation (sfun_map\<cdot>d1\<cdot>d2)"
       
   445 proof (intro finite_deflation_intro)
       
   446   interpret d1: finite_deflation d1 by fact
       
   447   interpret d2: finite_deflation d2 by fact
       
   448   have "deflation d1" and "deflation d2" by fact+
       
   449   thus "deflation (sfun_map\<cdot>d1\<cdot>d2)" by (rule deflation_sfun_map)
       
   450   from 1 2 have "finite_deflation (cfun_map\<cdot>d1\<cdot>d2)"
       
   451     by (rule finite_deflation_cfun_map)
       
   452   then have "finite {f. cfun_map\<cdot>d1\<cdot>d2\<cdot>f = f}"
       
   453     by (rule finite_deflation.finite_fixes)
       
   454   moreover have "inj (\<lambda>f. sfun_rep\<cdot>f)"
       
   455     by (rule inj_onI, simp add: sfun_eq_iff)
       
   456   ultimately have "finite ((\<lambda>f. sfun_rep\<cdot>f) -` {f. cfun_map\<cdot>d1\<cdot>d2\<cdot>f = f})"
       
   457     by (rule finite_vimageI)
       
   458   then show "finite {f. sfun_map\<cdot>d1\<cdot>d2\<cdot>f = f}"
       
   459     unfolding sfun_map_def sfun_eq_iff
       
   460     by (simp add: strictify_cancel
       
   461          deflation_strict `deflation d1` `deflation d2`)
       
   462 qed
       
   463 
   383 end
   464 end