141 |
141 |
142 match_up :: "'a::cpo u \<rightarrow> 'a maybe" |
142 match_up :: "'a::cpo u \<rightarrow> 'a maybe" |
143 "match_up \<equiv> fup\<cdot>return" |
143 "match_up \<equiv> fup\<cdot>return" |
144 |
144 |
145 match_ONE :: "one \<rightarrow> unit maybe" |
145 match_ONE :: "one \<rightarrow> unit maybe" |
146 "match_ONE \<equiv> flift1 (\<lambda>u. return\<cdot>())" |
146 "match_ONE \<equiv> \<Lambda> ONE. return\<cdot>()" |
147 |
147 |
148 match_TT :: "tr \<rightarrow> unit maybe" |
148 match_TT :: "tr \<rightarrow> unit maybe" |
149 "match_TT \<equiv> flift1 (\<lambda>b. if b then return\<cdot>() else fail)" |
149 "match_TT \<equiv> \<Lambda> b. If b then return\<cdot>() else fail fi" |
150 |
150 |
151 match_FF :: "tr \<rightarrow> unit maybe" |
151 match_FF :: "tr \<rightarrow> unit maybe" |
152 "match_FF \<equiv> flift1 (\<lambda>b. if b then fail else return\<cdot>())" |
152 "match_FF \<equiv> \<Lambda> b. If b then fail else return\<cdot>() fi" |
153 |
153 |
154 lemma match_UU_simps [simp]: |
154 lemma match_UU_simps [simp]: |
155 "match_UU\<cdot>x = fail" |
155 "match_UU\<cdot>x = fail" |
156 by (simp add: match_UU_def) |
156 by (simp add: match_UU_def) |
157 |
157 |
182 by (simp_all add: match_up_def) |
182 by (simp_all add: match_up_def) |
183 |
183 |
184 lemma match_ONE_simps [simp]: |
184 lemma match_ONE_simps [simp]: |
185 "match_ONE\<cdot>ONE = return\<cdot>()" |
185 "match_ONE\<cdot>ONE = return\<cdot>()" |
186 "match_ONE\<cdot>\<bottom> = \<bottom>" |
186 "match_ONE\<cdot>\<bottom> = \<bottom>" |
187 by (simp_all add: ONE_def match_ONE_def) |
187 by (simp_all add: match_ONE_def) |
188 |
188 |
189 lemma match_TT_simps [simp]: |
189 lemma match_TT_simps [simp]: |
190 "match_TT\<cdot>TT = return\<cdot>()" |
190 "match_TT\<cdot>TT = return\<cdot>()" |
191 "match_TT\<cdot>FF = fail" |
191 "match_TT\<cdot>FF = fail" |
192 "match_TT\<cdot>\<bottom> = \<bottom>" |
192 "match_TT\<cdot>\<bottom> = \<bottom>" |
193 by (simp_all add: TT_def FF_def match_TT_def) |
193 by (simp_all add: match_TT_def) |
194 |
194 |
195 lemma match_FF_simps [simp]: |
195 lemma match_FF_simps [simp]: |
196 "match_FF\<cdot>FF = return\<cdot>()" |
196 "match_FF\<cdot>FF = return\<cdot>()" |
197 "match_FF\<cdot>TT = fail" |
197 "match_FF\<cdot>TT = fail" |
198 "match_FF\<cdot>\<bottom> = \<bottom>" |
198 "match_FF\<cdot>\<bottom> = \<bottom>" |
199 by (simp_all add: TT_def FF_def match_FF_def) |
199 by (simp_all add: match_FF_def) |
200 |
200 |
201 subsection {* Mutual recursion *} |
201 subsection {* Mutual recursion *} |
202 |
202 |
203 text {* |
203 text {* |
204 The following rules are used to prove unfolding theorems from |
204 The following rules are used to prove unfolding theorems from |