src/HOLCF/Cprod.thy
changeset 17834 28414668b43d
parent 17816 9942c5ed866a
child 17837 2922be3544f8
equal deleted inserted replaced
17833:8631dfe017a8 17834:28414668b43d
   180 apply (rule contlub_snd)
   180 apply (rule contlub_snd)
   181 done
   181 done
   182 
   182 
   183 subsection {* Continuous versions of constants *}
   183 subsection {* Continuous versions of constants *}
   184 
   184 
   185 consts
   185 constdefs
   186   cpair  :: "'a \<rightarrow> 'b \<rightarrow> ('a * 'b)" (* continuous pairing *)
   186   cpair :: "'a \<rightarrow> 'b \<rightarrow> ('a * 'b)" (* continuous pairing *)
   187   cfst   :: "('a * 'b) \<rightarrow> 'a"
   187   "cpair \<equiv> (\<Lambda> x y. (x, y))"
   188   csnd   :: "('a * 'b) \<rightarrow> 'b"
   188 
       
   189   cfst :: "('a * 'b) \<rightarrow> 'a"
       
   190   "cfst \<equiv> (\<Lambda> p. fst p)"
       
   191 
       
   192   csnd :: "('a * 'b) \<rightarrow> 'b"
       
   193   "csnd \<equiv> (\<Lambda> p. snd p)"      
       
   194 
   189   csplit :: "('a \<rightarrow> 'b \<rightarrow> 'c) \<rightarrow> ('a * 'b) \<rightarrow> 'c"
   195   csplit :: "('a \<rightarrow> 'b \<rightarrow> 'c) \<rightarrow> ('a * 'b) \<rightarrow> 'c"
       
   196   "csplit \<equiv> (\<Lambda> f p. f\<cdot>(cfst\<cdot>p)\<cdot>(csnd\<cdot>p))"
   190 
   197 
   191 syntax
   198 syntax
   192   "@ctuple" :: "['a, args] \<Rightarrow> 'a * 'b"  ("(1<_,/ _>)")
   199   "_ctuple" :: "['a, args] \<Rightarrow> 'a * 'b"  ("(1<_,/ _>)")
       
   200 
       
   201 syntax (xsymbols)
       
   202   "_ctuple" :: "['a, args] \<Rightarrow> 'a * 'b"  ("(1\<langle>_,/ _\<rangle>)")
   193 
   203 
   194 translations
   204 translations
   195   "<x, y, z>" == "<x, <y, z>>"
   205   "<x, y, z>" == "<x, <y, z>>"
   196   "<x, y>"    == "cpair$x$y"
   206   "<x, y>"    == "cpair$x$y"
   197 
   207 
       
   208 text {* syntax for @{text "LAM <x,y,z>.e"} *}
       
   209 
   198 syntax
   210 syntax
   199   "_ctuple_pttrn" :: "[pttrn, patterns] => pttrn"  ("<_,/ _>")
   211   "_ctuple_pttrn" :: "[pttrn, patterns] => pttrn"  ("<_,/ _>")
       
   212 
       
   213 syntax (xsymbols)
       
   214   "_ctuple_pttrn" :: "[pttrn, patterns] => pttrn"  ("\<langle>_,/ _\<rangle>")
   200 
   215 
   201 translations
   216 translations
   202   "LAM <x,y,zs>. t"       == "csplit$(LAM x <y,zs>. t)"
   217   "LAM <x,y,zs>. t"       == "csplit$(LAM x <y,zs>. t)"
   203   "LAM <x,y>. t"          == "csplit$(LAM x y. t)"
   218   "LAM <x,y>. t"          == "csplit$(LAM x y. t)"
   204 
   219 
   205 defs
       
   206   cpair_def:  "cpair  \<equiv> (\<Lambda> x y. (x, y))"
       
   207   cfst_def:   "cfst   \<equiv> (\<Lambda> p. fst p)"
       
   208   csnd_def:   "csnd   \<equiv> (\<Lambda> p. snd p)"      
       
   209   csplit_def: "csplit \<equiv> (\<Lambda> f p. f\<cdot>(cfst\<cdot>p)\<cdot>(csnd\<cdot>p))"
       
   210 
   220 
   211 subsection {* Convert all lemmas to the continuous versions *}
   221 subsection {* Convert all lemmas to the continuous versions *}
   212 
   222 
   213 lemma cpair_eq_pair: "<x, y> = (x, y)"
   223 lemma cpair_eq_pair: "<x, y> = (x, y)"
   214 by (simp add: cpair_def cont_pair1 cont_pair2)
   224 by (simp add: cpair_def cont_pair1 cont_pair2)