src/HOLCF/Cprod.thy
changeset 25910 25533eb2b914
parent 25908 d8ce142f7e6e
child 25913 e1b6521c1f94
equal deleted inserted replaced
25909:6b96b9392873 25910:25533eb2b914
     6 *)
     6 *)
     7 
     7 
     8 header {* The cpo of cartesian products *}
     8 header {* The cpo of cartesian products *}
     9 
     9 
    10 theory Cprod
    10 theory Cprod
    11 imports Cfun
    11 imports Bifinite
    12 begin
    12 begin
    13 
    13 
    14 defaultsort cpo
    14 defaultsort cpo
    15 
    15 
    16 subsection {* Type @{typ unit} is a pcpo *}
    16 subsection {* Type @{typ unit} is a pcpo *}
   228 subsection {* Convert all lemmas to the continuous versions *}
   228 subsection {* Convert all lemmas to the continuous versions *}
   229 
   229 
   230 lemma cpair_eq_pair: "<x, y> = (x, y)"
   230 lemma cpair_eq_pair: "<x, y> = (x, y)"
   231 by (simp add: cpair_def cont_pair1 cont_pair2)
   231 by (simp add: cpair_def cont_pair1 cont_pair2)
   232 
   232 
       
   233 lemma pair_eq_cpair: "(x, y) = <x, y>"
       
   234 by (simp add: cpair_def cont_pair1 cont_pair2)
       
   235 
   233 lemma inject_cpair: "<a,b> = <aa,ba> \<Longrightarrow> a = aa \<and> b = ba"
   236 lemma inject_cpair: "<a,b> = <aa,ba> \<Longrightarrow> a = aa \<and> b = ba"
   234 by (simp add: cpair_eq_pair)
   237 by (simp add: cpair_eq_pair)
   235 
   238 
   236 lemma cpair_eq [iff]: "(<a, b> = <a', b'>) = (a = a' \<and> b = b')"
   239 lemma cpair_eq [iff]: "(<a, b> = <a', b'>) = (a = a' \<and> b = b')"
   237 by (simp add: cpair_eq_pair)
   240 by (simp add: cpair_eq_pair)
   268 by (simp add: inst_cprod_pcpo2)
   271 by (simp add: inst_cprod_pcpo2)
   269 
   272 
   270 lemma csnd_strict [simp]: "csnd\<cdot>\<bottom> = \<bottom>"
   273 lemma csnd_strict [simp]: "csnd\<cdot>\<bottom> = \<bottom>"
   271 by (simp add: inst_cprod_pcpo2)
   274 by (simp add: inst_cprod_pcpo2)
   272 
   275 
   273 lemma surjective_pairing_Cprod2: "<cfst\<cdot>p, csnd\<cdot>p> = p"
   276 lemma cpair_cfst_csnd: "\<langle>cfst\<cdot>p, csnd\<cdot>p\<rangle> = p"
   274 apply (unfold cfst_def csnd_def)
   277 by (cases p rule: cprodE, simp)
   275 apply (simp add: cont_fst cont_snd cpair_eq_pair)
   278 
   276 done
   279 lemmas surjective_pairing_Cprod2 = cpair_cfst_csnd
   277 
   280 
   278 lemma less_cprod: "x \<sqsubseteq> y = (cfst\<cdot>x \<sqsubseteq> cfst\<cdot>y \<and> csnd\<cdot>x \<sqsubseteq> csnd\<cdot>y)"
   281 lemma less_cprod: "x \<sqsubseteq> y = (cfst\<cdot>x \<sqsubseteq> cfst\<cdot>y \<and> csnd\<cdot>x \<sqsubseteq> csnd\<cdot>y)"
   279 by (simp add: less_cprod_def cfst_def csnd_def cont_fst cont_snd)
   282 by (simp add: less_cprod_def cfst_def csnd_def cont_fst cont_snd)
   280 
   283 
   281 lemma eq_cprod: "(x = y) = (cfst\<cdot>x = cfst\<cdot>y \<and> csnd\<cdot>x = csnd\<cdot>y)"
   284 lemma eq_cprod: "(x = y) = (cfst\<cdot>x = cfst\<cdot>y \<and> csnd\<cdot>x = csnd\<cdot>y)"
   323 
   326 
   324 lemma csplit2 [simp]: "csplit\<cdot>f\<cdot><x,y> = f\<cdot>x\<cdot>y"
   327 lemma csplit2 [simp]: "csplit\<cdot>f\<cdot><x,y> = f\<cdot>x\<cdot>y"
   325 by (simp add: csplit_def)
   328 by (simp add: csplit_def)
   326 
   329 
   327 lemma csplit3 [simp]: "csplit\<cdot>cpair\<cdot>z = z"
   330 lemma csplit3 [simp]: "csplit\<cdot>cpair\<cdot>z = z"
   328 by (simp add: csplit_def surjective_pairing_Cprod2)
   331 by (simp add: csplit_def cpair_cfst_csnd)
   329 
   332 
   330 lemmas Cprod_rews = cfst_cpair csnd_cpair csplit2
   333 lemmas Cprod_rews = cfst_cpair csnd_cpair csplit2
   331 
   334 
       
   335 subsection {* Product type is a bifinite domain *}
       
   336 
       
   337 instance "*" :: (bifinite_cpo, bifinite_cpo) approx ..
       
   338 
       
   339 defs (overloaded)
       
   340   approx_cprod_def:
       
   341     "approx \<equiv> \<lambda>n. \<Lambda>\<langle>x, y\<rangle>. \<langle>approx n\<cdot>x, approx n\<cdot>y\<rangle>"
       
   342 
       
   343 instance "*" :: (bifinite_cpo, bifinite_cpo) bifinite_cpo
       
   344 proof
       
   345   fix i :: nat and x :: "'a \<times> 'b"
       
   346   show "chain (\<lambda>i. approx i\<cdot>x)"
       
   347     unfolding approx_cprod_def by simp
       
   348   show "(\<Squnion>i. approx i\<cdot>x) = x"
       
   349     unfolding approx_cprod_def
       
   350     by (simp add: lub_distribs eta_cfun)
       
   351   show "approx i\<cdot>(approx i\<cdot>x) = approx i\<cdot>x"
       
   352     unfolding approx_cprod_def csplit_def by simp
       
   353   have "{x::'a \<times> 'b. approx i\<cdot>x = x} \<subseteq>
       
   354         {x::'a. approx i\<cdot>x = x} \<times> {x::'b. approx i\<cdot>x = x}"
       
   355     unfolding approx_cprod_def
       
   356     by (clarsimp simp add: pair_eq_cpair)
       
   357   thus "finite {x::'a \<times> 'b. approx i\<cdot>x = x}"
       
   358     by (rule finite_subset,
       
   359         intro finite_cartesian_product finite_fixes_approx)
       
   360 qed
       
   361 
       
   362 instance "*" :: (bifinite, bifinite) bifinite ..
       
   363 
       
   364 lemma approx_cpair [simp]:
       
   365   "approx i\<cdot>\<langle>x, y\<rangle> = \<langle>approx i\<cdot>x, approx i\<cdot>y\<rangle>"
       
   366 unfolding approx_cprod_def by simp
       
   367 
       
   368 lemma cfst_approx: "cfst\<cdot>(approx i\<cdot>p) = approx i\<cdot>(cfst\<cdot>p)"
       
   369 by (cases p rule: cprodE, simp)
       
   370 
       
   371 lemma csnd_approx: "csnd\<cdot>(approx i\<cdot>p) = approx i\<cdot>(csnd\<cdot>p)"
       
   372 by (cases p rule: cprodE, simp)
       
   373 
   332 end
   374 end