src/HOLCF/Fixrec.thy
changeset 39807 19ddbededdd3
parent 37109 e67760c1b851
child 40046 ba2e41c8b725
equal deleted inserted replaced
39806:d59b9531d6b0 39807:19ddbededdd3
   116   match_UU :: "'a \<rightarrow> 'c match \<rightarrow> 'c match"
   116   match_UU :: "'a \<rightarrow> 'c match \<rightarrow> 'c match"
   117 where
   117 where
   118   "match_UU = strictify\<cdot>(\<Lambda> x k. fail)"
   118   "match_UU = strictify\<cdot>(\<Lambda> x k. fail)"
   119 
   119 
   120 definition
   120 definition
   121   match_cpair :: "'a::cpo \<times> 'b::cpo \<rightarrow> ('a \<rightarrow> 'b \<rightarrow> 'c match) \<rightarrow> 'c match"
   121   match_Pair :: "'a::cpo \<times> 'b::cpo \<rightarrow> ('a \<rightarrow> 'b \<rightarrow> 'c match) \<rightarrow> 'c match"
   122 where
   122 where
   123   "match_cpair = (\<Lambda> x k. csplit\<cdot>k\<cdot>x)"
   123   "match_Pair = (\<Lambda> x k. csplit\<cdot>k\<cdot>x)"
   124 
   124 
   125 definition
   125 definition
   126   match_spair :: "'a \<otimes> 'b \<rightarrow> ('a \<rightarrow> 'b \<rightarrow> 'c match) \<rightarrow> 'c match"
   126   match_spair :: "'a \<otimes> 'b \<rightarrow> ('a \<rightarrow> 'b \<rightarrow> 'c match) \<rightarrow> 'c match"
   127 where
   127 where
   128   "match_spair = (\<Lambda> x k. ssplit\<cdot>k\<cdot>x)"
   128   "match_spair = (\<Lambda> x k. ssplit\<cdot>k\<cdot>x)"
   160 lemma match_UU_simps [simp]:
   160 lemma match_UU_simps [simp]:
   161   "match_UU\<cdot>\<bottom>\<cdot>k = \<bottom>"
   161   "match_UU\<cdot>\<bottom>\<cdot>k = \<bottom>"
   162   "x \<noteq> \<bottom> \<Longrightarrow> match_UU\<cdot>x\<cdot>k = fail"
   162   "x \<noteq> \<bottom> \<Longrightarrow> match_UU\<cdot>x\<cdot>k = fail"
   163 by (simp_all add: match_UU_def)
   163 by (simp_all add: match_UU_def)
   164 
   164 
   165 lemma match_cpair_simps [simp]:
   165 lemma match_Pair_simps [simp]:
   166   "match_cpair\<cdot>(x, y)\<cdot>k = k\<cdot>x\<cdot>y"
   166   "match_Pair\<cdot>(x, y)\<cdot>k = k\<cdot>x\<cdot>y"
   167 by (simp_all add: match_cpair_def)
   167 by (simp_all add: match_Pair_def)
   168 
   168 
   169 lemma match_spair_simps [simp]:
   169 lemma match_spair_simps [simp]:
   170   "\<lbrakk>x \<noteq> \<bottom>; y \<noteq> \<bottom>\<rbrakk> \<Longrightarrow> match_spair\<cdot>(:x, y:)\<cdot>k = k\<cdot>x\<cdot>y"
   170   "\<lbrakk>x \<noteq> \<bottom>; y \<noteq> \<bottom>\<rbrakk> \<Longrightarrow> match_spair\<cdot>(:x, y:)\<cdot>k = k\<cdot>x\<cdot>y"
   171   "match_spair\<cdot>\<bottom>\<cdot>k = \<bottom>"
   171   "match_spair\<cdot>\<bottom>\<cdot>k = \<bottom>"
   172 by (simp_all add: match_spair_def)
   172 by (simp_all add: match_spair_def)
   246   Fixrec.add_matchers
   246   Fixrec.add_matchers
   247     [ (@{const_name up}, @{const_name match_up}),
   247     [ (@{const_name up}, @{const_name match_up}),
   248       (@{const_name sinl}, @{const_name match_sinl}),
   248       (@{const_name sinl}, @{const_name match_sinl}),
   249       (@{const_name sinr}, @{const_name match_sinr}),
   249       (@{const_name sinr}, @{const_name match_sinr}),
   250       (@{const_name spair}, @{const_name match_spair}),
   250       (@{const_name spair}, @{const_name match_spair}),
   251       (@{const_name Pair}, @{const_name match_cpair}),
   251       (@{const_name Pair}, @{const_name match_Pair}),
   252       (@{const_name ONE}, @{const_name match_ONE}),
   252       (@{const_name ONE}, @{const_name match_ONE}),
   253       (@{const_name TT}, @{const_name match_TT}),
   253       (@{const_name TT}, @{const_name match_TT}),
   254       (@{const_name FF}, @{const_name match_FF}),
   254       (@{const_name FF}, @{const_name match_FF}),
   255       (@{const_name UU}, @{const_name match_UU}) ]
   255       (@{const_name UU}, @{const_name match_UU}) ]
   256 *}
   256 *}