src/HOLCF/Sprod.thy
changeset 31114 2e9cc546e5b0
parent 31076 99fe356cbbc2
child 32960 69916a850301
equal deleted inserted replaced
31113:15cf300a742f 31114:2e9cc546e5b0
     3 *)
     3 *)
     4 
     4 
     5 header {* The type of strict products *}
     5 header {* The type of strict products *}
     6 
     6 
     7 theory Sprod
     7 theory Sprod
     8 imports Cprod
     8 imports Bifinite
     9 begin
     9 begin
    10 
    10 
    11 defaultsort pcpo
    11 defaultsort pcpo
    12 
    12 
    13 subsection {* Definition of strict product type *}
    13 subsection {* Definition of strict product type *}
    14 
    14 
    15 pcpodef (Sprod)  ('a, 'b) "**" (infixr "**" 20) =
    15 pcpodef (Sprod)  ('a, 'b) "**" (infixr "**" 20) =
    16         "{p::'a \<times> 'b. p = \<bottom> \<or> (cfst\<cdot>p \<noteq> \<bottom> \<and> csnd\<cdot>p \<noteq> \<bottom>)}"
    16         "{p::'a \<times> 'b. p = \<bottom> \<or> (fst p \<noteq> \<bottom> \<and> snd p \<noteq> \<bottom>)}"
    17 by simp_all
    17 by simp_all
    18 
    18 
    19 instance "**" :: ("{finite_po,pcpo}", "{finite_po,pcpo}") finite_po
    19 instance "**" :: ("{finite_po,pcpo}", "{finite_po,pcpo}") finite_po
    20 by (rule typedef_finite_po [OF type_definition_Sprod])
    20 by (rule typedef_finite_po [OF type_definition_Sprod])
    21 
    21 
    26   "**"		:: "[type, type] => type"	 ("(_ \<otimes>/ _)" [21,20] 20)
    26   "**"		:: "[type, type] => type"	 ("(_ \<otimes>/ _)" [21,20] 20)
    27 syntax (HTML output)
    27 syntax (HTML output)
    28   "**"		:: "[type, type] => type"	 ("(_ \<otimes>/ _)" [21,20] 20)
    28   "**"		:: "[type, type] => type"	 ("(_ \<otimes>/ _)" [21,20] 20)
    29 
    29 
    30 lemma spair_lemma:
    30 lemma spair_lemma:
    31   "<strictify\<cdot>(\<Lambda> b. a)\<cdot>b, strictify\<cdot>(\<Lambda> a. b)\<cdot>a> \<in> Sprod"
    31   "(strictify\<cdot>(\<Lambda> b. a)\<cdot>b, strictify\<cdot>(\<Lambda> a. b)\<cdot>a) \<in> Sprod"
    32 by (simp add: Sprod_def strictify_conv_if)
    32 by (simp add: Sprod_def strictify_conv_if)
    33 
    33 
    34 subsection {* Definitions of constants *}
    34 subsection {* Definitions of constants *}
    35 
    35 
    36 definition
    36 definition
    37   sfst :: "('a ** 'b) \<rightarrow> 'a" where
    37   sfst :: "('a ** 'b) \<rightarrow> 'a" where
    38   "sfst = (\<Lambda> p. cfst\<cdot>(Rep_Sprod p))"
    38   "sfst = (\<Lambda> p. fst (Rep_Sprod p))"
    39 
    39 
    40 definition
    40 definition
    41   ssnd :: "('a ** 'b) \<rightarrow> 'b" where
    41   ssnd :: "('a ** 'b) \<rightarrow> 'b" where
    42   "ssnd = (\<Lambda> p. csnd\<cdot>(Rep_Sprod p))"
    42   "ssnd = (\<Lambda> p. snd (Rep_Sprod p))"
    43 
    43 
    44 definition
    44 definition
    45   spair :: "'a \<rightarrow> 'b \<rightarrow> ('a ** 'b)" where
    45   spair :: "'a \<rightarrow> 'b \<rightarrow> ('a ** 'b)" where
    46   "spair = (\<Lambda> a b. Abs_Sprod
    46   "spair = (\<Lambda> a b. Abs_Sprod
    47              <strictify\<cdot>(\<Lambda> b. a)\<cdot>b, strictify\<cdot>(\<Lambda> a. b)\<cdot>a>)"
    47              (strictify\<cdot>(\<Lambda> b. a)\<cdot>b, strictify\<cdot>(\<Lambda> a. b)\<cdot>a))"
    48 
    48 
    49 definition
    49 definition
    50   ssplit :: "('a \<rightarrow> 'b \<rightarrow> 'c) \<rightarrow> ('a ** 'b) \<rightarrow> 'c" where
    50   ssplit :: "('a \<rightarrow> 'b \<rightarrow> 'c) \<rightarrow> ('a ** 'b) \<rightarrow> 'c" where
    51   "ssplit = (\<Lambda> f. strictify\<cdot>(\<Lambda> p. f\<cdot>(sfst\<cdot>p)\<cdot>(ssnd\<cdot>p)))"
    51   "ssplit = (\<Lambda> f. strictify\<cdot>(\<Lambda> p. f\<cdot>(sfst\<cdot>p)\<cdot>(ssnd\<cdot>p)))"
    52 
    52 
    60   "\<Lambda>(CONST spair\<cdot>x\<cdot>y). t" == "CONST ssplit\<cdot>(\<Lambda> x y. t)"
    60   "\<Lambda>(CONST spair\<cdot>x\<cdot>y). t" == "CONST ssplit\<cdot>(\<Lambda> x y. t)"
    61 
    61 
    62 subsection {* Case analysis *}
    62 subsection {* Case analysis *}
    63 
    63 
    64 lemma Rep_Sprod_spair:
    64 lemma Rep_Sprod_spair:
    65   "Rep_Sprod (:a, b:) = <strictify\<cdot>(\<Lambda> b. a)\<cdot>b, strictify\<cdot>(\<Lambda> a. b)\<cdot>a>"
    65   "Rep_Sprod (:a, b:) = (strictify\<cdot>(\<Lambda> b. a)\<cdot>b, strictify\<cdot>(\<Lambda> a. b)\<cdot>a)"
    66 unfolding spair_def
    66 unfolding spair_def
    67 by (simp add: cont_Abs_Sprod Abs_Sprod_inverse spair_lemma)
    67 by (simp add: cont_Abs_Sprod Abs_Sprod_inverse spair_lemma)
    68 
    68 
    69 lemmas Rep_Sprod_simps =
    69 lemmas Rep_Sprod_simps =
    70   Rep_Sprod_inject [symmetric] below_Sprod_def
    70   Rep_Sprod_inject [symmetric] below_Sprod_def
    71   Rep_Sprod_strict Rep_Sprod_spair
    71   Rep_Sprod_strict Rep_Sprod_spair
    72 
    72 
    73 lemma Exh_Sprod:
    73 lemma Exh_Sprod:
    74   "z = \<bottom> \<or> (\<exists>a b. z = (:a, b:) \<and> a \<noteq> \<bottom> \<and> b \<noteq> \<bottom>)"
    74   "z = \<bottom> \<or> (\<exists>a b. z = (:a, b:) \<and> a \<noteq> \<bottom> \<and> b \<noteq> \<bottom>)"
    75 apply (insert Rep_Sprod [of z])
    75 apply (insert Rep_Sprod [of z])
    76 apply (simp add: Rep_Sprod_simps eq_cprod)
    76 apply (simp add: Rep_Sprod_simps Pair_fst_snd_eq)
    77 apply (simp add: Sprod_def)
    77 apply (simp add: Sprod_def)
    78 apply (erule disjE, simp)
    78 apply (erule disjE, simp)
    79 apply (simp add: strictify_conv_if)
    79 apply (simp add: strictify_conv_if)
    80 apply fast
    80 apply fast
    81 done
    81 done
   160 lemma surjective_pairing_Sprod2: "(:sfst\<cdot>p, ssnd\<cdot>p:) = p"
   160 lemma surjective_pairing_Sprod2: "(:sfst\<cdot>p, ssnd\<cdot>p:) = p"
   161 by (cases p, simp_all)
   161 by (cases p, simp_all)
   162 
   162 
   163 lemma below_sprod: "x \<sqsubseteq> y = (sfst\<cdot>x \<sqsubseteq> sfst\<cdot>y \<and> ssnd\<cdot>x \<sqsubseteq> ssnd\<cdot>y)"
   163 lemma below_sprod: "x \<sqsubseteq> y = (sfst\<cdot>x \<sqsubseteq> sfst\<cdot>y \<and> ssnd\<cdot>x \<sqsubseteq> ssnd\<cdot>y)"
   164 apply (simp add: below_Sprod_def sfst_def ssnd_def cont_Rep_Sprod)
   164 apply (simp add: below_Sprod_def sfst_def ssnd_def cont_Rep_Sprod)
   165 apply (rule below_cprod)
   165 apply (simp only: below_prod_def)
   166 done
   166 done
   167 
   167 
   168 lemma eq_sprod: "(x = y) = (sfst\<cdot>x = sfst\<cdot>y \<and> ssnd\<cdot>x = ssnd\<cdot>y)"
   168 lemma eq_sprod: "(x = y) = (sfst\<cdot>x = sfst\<cdot>y \<and> ssnd\<cdot>x = ssnd\<cdot>y)"
   169 by (auto simp add: po_eq_conv below_sprod)
   169 by (auto simp add: po_eq_conv below_sprod)
   170 
   170