src/HOLCF/Sprod.thy
author huffman
Wed Oct 12 01:43:37 2005 +0200 (2005-10-12)
changeset 17837 2922be3544f8
parent 17817 405fb812e738
child 18078 20e5a6440790
permissions -rw-r--r--
added compactness lemmas; cleaned up
     1 (*  Title:      HOLCF/Sprod.thy
     2     ID:         $Id$
     3     Author:     Franz Regensburger and Brian Huffman
     4 
     5 Strict product with typedef.
     6 *)
     7 
     8 header {* The type of strict products *}
     9 
    10 theory Sprod
    11 imports Cprod
    12 begin
    13 
    14 defaultsort pcpo
    15 
    16 subsection {* Definition of strict product type *}
    17 
    18 pcpodef (Sprod)  ('a, 'b) "**" (infixr "**" 20) =
    19         "{p::'a \<times> 'b. p = \<bottom> \<or> (cfst\<cdot>p \<noteq> \<bottom> \<and> csnd\<cdot>p \<noteq> \<bottom>)}"
    20 by simp
    21 
    22 syntax (xsymbols)
    23   "**"		:: "[type, type] => type"	 ("(_ \<otimes>/ _)" [21,20] 20)
    24 syntax (HTML output)
    25   "**"		:: "[type, type] => type"	 ("(_ \<otimes>/ _)" [21,20] 20)
    26 
    27 lemma spair_lemma:
    28   "<strictify\<cdot>(\<Lambda> b. a)\<cdot>b, strictify\<cdot>(\<Lambda> a. b)\<cdot>a> \<in> Sprod"
    29 by (simp add: Sprod_def strictify_conv_if cpair_strict)
    30 
    31 subsection {* Definitions of constants *}
    32 
    33 consts
    34   sfst :: "('a ** 'b) \<rightarrow> 'a"
    35   ssnd :: "('a ** 'b) \<rightarrow> 'b"
    36   spair :: "'a \<rightarrow> 'b \<rightarrow> ('a ** 'b)"
    37   ssplit :: "('a \<rightarrow> 'b \<rightarrow> 'c) \<rightarrow> ('a ** 'b) \<rightarrow> 'c"
    38 
    39 defs
    40   sfst_def: "sfst \<equiv> \<Lambda> p. cfst\<cdot>(Rep_Sprod p)"
    41   ssnd_def: "ssnd \<equiv> \<Lambda> p. csnd\<cdot>(Rep_Sprod p)"
    42   spair_def: "spair \<equiv> \<Lambda> a b. Abs_Sprod
    43                 <strictify\<cdot>(\<Lambda> b. a)\<cdot>b, strictify\<cdot>(\<Lambda> a. b)\<cdot>a>"
    44   ssplit_def: "ssplit \<equiv> \<Lambda> f. strictify\<cdot>(\<Lambda> p. f\<cdot>(sfst\<cdot>p)\<cdot>(ssnd\<cdot>p))"
    45 
    46 syntax  
    47   "@stuple"	:: "['a, args] => 'a ** 'b"	("(1'(:_,/ _:'))")
    48 
    49 translations
    50         "(:x, y, z:)"   == "(:x, (:y, z:):)"
    51         "(:x, y:)"      == "spair$x$y"
    52 
    53 subsection {* Case analysis *}
    54 
    55 lemma spair_Abs_Sprod:
    56   "(:a, b:) = Abs_Sprod <strictify\<cdot>(\<Lambda> b. a)\<cdot>b, strictify\<cdot>(\<Lambda> a. b)\<cdot>a>"
    57 apply (unfold spair_def)
    58 apply (simp add: cont_Abs_Sprod spair_lemma)
    59 done
    60 
    61 lemma Exh_Sprod2:
    62   "z = \<bottom> \<or> (\<exists>a b. z = (:a, b:) \<and> a \<noteq> \<bottom> \<and> b \<noteq> \<bottom>)"
    63 apply (rule_tac x=z in Abs_Sprod_cases)
    64 apply (simp add: Sprod_def)
    65 apply (erule disjE)
    66 apply (simp add: Abs_Sprod_strict)
    67 apply (rule disjI2)
    68 apply (rule_tac x="cfst\<cdot>y" in exI)
    69 apply (rule_tac x="csnd\<cdot>y" in exI)
    70 apply (simp add: spair_Abs_Sprod Abs_Sprod_inject spair_lemma)
    71 apply (simp add: surjective_pairing_Cprod2)
    72 done
    73 
    74 lemma sprodE:
    75   "\<lbrakk>p = \<bottom> \<Longrightarrow> Q; \<And>x y. \<lbrakk>p = (:x, y:); x \<noteq> \<bottom>; y \<noteq> \<bottom>\<rbrakk> \<Longrightarrow> Q\<rbrakk> \<Longrightarrow> Q"
    76 by (cut_tac z=p in Exh_Sprod2, auto)
    77 
    78 subsection {* Properties of @{term spair} *}
    79 
    80 lemma spair_strict1 [simp]: "(:\<bottom>, y:) = \<bottom>"
    81 by (simp add: spair_Abs_Sprod strictify_conv_if cpair_strict Abs_Sprod_strict)
    82 
    83 lemma spair_strict2 [simp]: "(:x, \<bottom>:) = \<bottom>"
    84 by (simp add: spair_Abs_Sprod strictify_conv_if cpair_strict Abs_Sprod_strict)
    85 
    86 lemma spair_strict: "x = \<bottom> \<or> y = \<bottom> \<Longrightarrow> (:x, y:) = \<bottom>"
    87 by auto
    88 
    89 lemma spair_strict_rev: "(:x, y:) \<noteq> \<bottom> \<Longrightarrow> x \<noteq> \<bottom> \<and> y \<noteq> \<bottom>"
    90 by (erule contrapos_np, auto)
    91 
    92 lemma spair_defined [simp]: 
    93   "\<lbrakk>x \<noteq> \<bottom>; y \<noteq> \<bottom>\<rbrakk> \<Longrightarrow> (:x, y:) \<noteq> \<bottom>"
    94 by (simp add: spair_Abs_Sprod Abs_Sprod_defined cpair_defined_iff Sprod_def)
    95 
    96 lemma spair_defined_rev: "(:x, y:) = \<bottom> \<Longrightarrow> x = \<bottom> \<or> y = \<bottom>"
    97 by (erule contrapos_pp, simp)
    98 
    99 lemma spair_eq:
   100   "\<lbrakk>x \<noteq> \<bottom>; y \<noteq> \<bottom>\<rbrakk> \<Longrightarrow> ((:x, y:) = (:a, b:)) = (x = a \<and> y = b)"
   101 apply (simp add: spair_Abs_Sprod)
   102 apply (simp add: Abs_Sprod_inject [OF _ spair_lemma] Sprod_def)
   103 apply (simp add: strictify_conv_if)
   104 done
   105 
   106 lemma spair_inject:
   107   "\<lbrakk>x \<noteq> \<bottom>; y \<noteq> \<bottom>; (:x, y:) = (:a, b:)\<rbrakk> \<Longrightarrow> x = a \<and> y = b"
   108 by (rule spair_eq [THEN iffD1])
   109 
   110 lemma inst_sprod_pcpo2: "UU = (:UU,UU:)"
   111 by simp
   112 
   113 lemma Rep_Sprod_spair:
   114   "Rep_Sprod (:a, b:) = <strictify\<cdot>(\<Lambda> b. a)\<cdot>b, strictify\<cdot>(\<Lambda> a. b)\<cdot>a>"
   115 apply (unfold spair_def)
   116 apply (simp add: cont_Abs_Sprod Abs_Sprod_inverse spair_lemma)
   117 done
   118 
   119 lemma compact_spair: "\<lbrakk>compact x; compact y\<rbrakk> \<Longrightarrow> compact (:x, y:)"
   120 by (rule compact_Sprod, simp add: Rep_Sprod_spair strictify_conv_if)
   121 
   122 subsection {* Properties of @{term sfst} and @{term ssnd} *}
   123 
   124 lemma sfst_strict [simp]: "sfst\<cdot>\<bottom> = \<bottom>"
   125 by (simp add: sfst_def cont_Rep_Sprod Rep_Sprod_strict)
   126 
   127 lemma ssnd_strict [simp]: "ssnd\<cdot>\<bottom> = \<bottom>"
   128 by (simp add: ssnd_def cont_Rep_Sprod Rep_Sprod_strict)
   129 
   130 lemma sfst_spair [simp]: "y \<noteq> \<bottom> \<Longrightarrow> sfst\<cdot>(:x, y:) = x"
   131 by (simp add: sfst_def cont_Rep_Sprod Rep_Sprod_spair)
   132 
   133 lemma ssnd_spair [simp]: "x \<noteq> \<bottom> \<Longrightarrow> ssnd\<cdot>(:x, y:) = y"
   134 by (simp add: ssnd_def cont_Rep_Sprod Rep_Sprod_spair)
   135 
   136 lemma sfst_defined_iff [simp]: "(sfst\<cdot>p = \<bottom>) = (p = \<bottom>)"
   137 by (rule_tac p=p in sprodE, simp_all)
   138 
   139 lemma ssnd_defined_iff [simp]: "(ssnd\<cdot>p = \<bottom>) = (p = \<bottom>)"
   140 by (rule_tac p=p in sprodE, simp_all)
   141 
   142 lemma sfst_defined: "p \<noteq> \<bottom> \<Longrightarrow> sfst\<cdot>p \<noteq> \<bottom>"
   143 by simp
   144 
   145 lemma ssnd_defined: "p \<noteq> \<bottom> \<Longrightarrow> ssnd\<cdot>p \<noteq> \<bottom>"
   146 by simp
   147 
   148 lemma surjective_pairing_Sprod2: "(:sfst\<cdot>p, ssnd\<cdot>p:) = p"
   149 by (rule_tac p=p in sprodE, simp_all)
   150 
   151 lemma less_sprod: "x \<sqsubseteq> y = (sfst\<cdot>x \<sqsubseteq> sfst\<cdot>y \<and> ssnd\<cdot>x \<sqsubseteq> ssnd\<cdot>y)"
   152 apply (simp add: less_Sprod_def sfst_def ssnd_def cont_Rep_Sprod)
   153 apply (rule less_cprod)
   154 done
   155 
   156 lemma eq_sprod: "(x = y) = (sfst\<cdot>x = sfst\<cdot>y \<and> ssnd\<cdot>x = ssnd\<cdot>y)"
   157 by (auto simp add: po_eq_conv less_sprod)
   158 
   159 lemma spair_less:
   160   "\<lbrakk>x \<noteq> \<bottom>; y \<noteq> \<bottom>\<rbrakk> \<Longrightarrow> (:x, y:) \<sqsubseteq> (:a, b:) = (x \<sqsubseteq> a \<and> y \<sqsubseteq> b)"
   161 apply (case_tac "a = \<bottom>")
   162 apply (simp add: eq_UU_iff [symmetric])
   163 apply (case_tac "b = \<bottom>")
   164 apply (simp add: eq_UU_iff [symmetric])
   165 apply (simp add: less_sprod)
   166 done
   167 
   168 
   169 subsection {* Properties of @{term ssplit} *}
   170 
   171 lemma ssplit1 [simp]: "ssplit\<cdot>f\<cdot>\<bottom> = \<bottom>"
   172 by (simp add: ssplit_def)
   173 
   174 lemma ssplit2 [simp]: "\<lbrakk>x \<noteq> \<bottom>; y \<noteq> \<bottom>\<rbrakk> \<Longrightarrow> ssplit\<cdot>f\<cdot>(:x, y:) = f\<cdot>x\<cdot>y"
   175 by (simp add: ssplit_def)
   176 
   177 lemma ssplit3 [simp]: "ssplit\<cdot>spair\<cdot>z = z"
   178 by (rule_tac p=z in sprodE, simp_all)
   179 
   180 end