equal
deleted
inserted
replaced
25 "++" :: "[type, type] => type" ("(_ \<oplus>/ _)" [21, 20] 20) |
25 "++" :: "[type, type] => type" ("(_ \<oplus>/ _)" [21, 20] 20) |
26 |
26 |
27 |
27 |
28 subsection {* Definitions of constructors *} |
28 subsection {* Definitions of constructors *} |
29 |
29 |
30 constdefs |
30 definition |
31 sinl :: "'a \<rightarrow> ('a ++ 'b)" |
31 sinl :: "'a \<rightarrow> ('a ++ 'b)" where |
32 "sinl \<equiv> \<Lambda> a. Abs_Ssum <a, \<bottom>>" |
32 "sinl = (\<Lambda> a. Abs_Ssum <a, \<bottom>>)" |
33 |
33 |
34 sinr :: "'b \<rightarrow> ('a ++ 'b)" |
34 definition |
35 "sinr \<equiv> \<Lambda> b. Abs_Ssum <\<bottom>, b>" |
35 sinr :: "'b \<rightarrow> ('a ++ 'b)" where |
|
36 "sinr = (\<Lambda> b. Abs_Ssum <\<bottom>, b>)" |
36 |
37 |
37 subsection {* Properties of @{term sinl} and @{term sinr} *} |
38 subsection {* Properties of @{term sinl} and @{term sinr} *} |
38 |
39 |
39 lemma sinl_Abs_Ssum: "sinl\<cdot>a = Abs_Ssum <a, \<bottom>>" |
40 lemma sinl_Abs_Ssum: "sinl\<cdot>a = Abs_Ssum <a, \<bottom>>" |
40 by (unfold sinl_def, simp add: cont_Abs_Ssum Ssum_def) |
41 by (unfold sinl_def, simp add: cont_Abs_Ssum Ssum_def) |
167 apply (simp add: Rep_Ssum_sinr) |
168 apply (simp add: Rep_Ssum_sinr) |
168 done |
169 done |
169 |
170 |
170 subsection {* Definitions of constants *} |
171 subsection {* Definitions of constants *} |
171 |
172 |
172 constdefs |
173 definition |
173 Iwhen :: "['a \<rightarrow> 'c, 'b \<rightarrow> 'c, 'a ++ 'b] \<Rightarrow> 'c" |
174 Iwhen :: "['a \<rightarrow> 'c, 'b \<rightarrow> 'c, 'a ++ 'b] \<Rightarrow> 'c" where |
174 "Iwhen \<equiv> \<lambda>f g s. |
175 "Iwhen = (\<lambda>f g s. |
175 if cfst\<cdot>(Rep_Ssum s) \<noteq> \<bottom> then f\<cdot>(cfst\<cdot>(Rep_Ssum s)) else |
176 if cfst\<cdot>(Rep_Ssum s) \<noteq> \<bottom> then f\<cdot>(cfst\<cdot>(Rep_Ssum s)) else |
176 if csnd\<cdot>(Rep_Ssum s) \<noteq> \<bottom> then g\<cdot>(csnd\<cdot>(Rep_Ssum s)) else \<bottom>" |
177 if csnd\<cdot>(Rep_Ssum s) \<noteq> \<bottom> then g\<cdot>(csnd\<cdot>(Rep_Ssum s)) else \<bottom>)" |
177 |
178 |
178 text {* rewrites for @{term Iwhen} *} |
179 text {* rewrites for @{term Iwhen} *} |
179 |
180 |
180 lemma Iwhen1 [simp]: "Iwhen f g \<bottom> = \<bottom>" |
181 lemma Iwhen1 [simp]: "Iwhen f g \<bottom> = \<bottom>" |
181 by (simp add: Iwhen_def Rep_Ssum_strict) |
182 by (simp add: Iwhen_def Rep_Ssum_strict) |
211 apply (simp add: Iwhen5 cont_cfun_arg) |
212 apply (simp add: Iwhen5 cont_cfun_arg) |
212 done |
213 done |
213 |
214 |
214 subsection {* Continuous versions of constants *} |
215 subsection {* Continuous versions of constants *} |
215 |
216 |
216 constdefs |
217 definition |
217 sscase :: "('a \<rightarrow> 'c) \<rightarrow> ('b \<rightarrow> 'c) \<rightarrow> ('a ++ 'b) \<rightarrow> 'c" |
218 sscase :: "('a \<rightarrow> 'c) \<rightarrow> ('b \<rightarrow> 'c) \<rightarrow> ('a ++ 'b) \<rightarrow> 'c" where |
218 "sscase \<equiv> \<Lambda> f g s. Iwhen f g s" |
219 "sscase = (\<Lambda> f g s. Iwhen f g s)" |
219 |
220 |
220 translations |
221 translations |
221 "case s of sinl\<cdot>x \<Rightarrow> t1 | sinr\<cdot>y \<Rightarrow> t2" == "sscase\<cdot>(\<Lambda> x. t1)\<cdot>(\<Lambda> y. t2)\<cdot>s" |
222 "case s of CONST sinl\<cdot>x \<Rightarrow> t1 | CONST sinr\<cdot>y \<Rightarrow> t2" == "CONST sscase\<cdot>(\<Lambda> x. t1)\<cdot>(\<Lambda> y. t2)\<cdot>s" |
222 |
223 |
223 translations |
224 translations |
224 "\<Lambda>(sinl\<cdot>x). t" == "sscase\<cdot>(\<Lambda> x. t)\<cdot>\<bottom>" |
225 "\<Lambda>(CONST sinl\<cdot>x). t" == "CONST sscase\<cdot>(\<Lambda> x. t)\<cdot>\<bottom>" |
225 "\<Lambda>(sinr\<cdot>y). t" == "sscase\<cdot>\<bottom>\<cdot>(\<Lambda> y. t)" |
226 "\<Lambda>(CONST sinr\<cdot>y). t" == "CONST sscase\<cdot>\<bottom>\<cdot>(\<Lambda> y. t)" |
226 |
227 |
227 text {* continuous versions of lemmas for @{term sscase} *} |
228 text {* continuous versions of lemmas for @{term sscase} *} |
228 |
229 |
229 lemma beta_sscase: "sscase\<cdot>f\<cdot>g\<cdot>s = Iwhen f g s" |
230 lemma beta_sscase: "sscase\<cdot>f\<cdot>g\<cdot>s = Iwhen f g s" |
230 by (simp add: sscase_def cont_Iwhen1 cont_Iwhen2 cont_Iwhen3) |
231 by (simp add: sscase_def cont_Iwhen1 cont_Iwhen2 cont_Iwhen3) |