33 Isinl :: "'a => ('a ++ 'b)" |
27 Isinl :: "'a => ('a ++ 'b)" |
34 Isinr :: "'b => ('a ++ 'b)" |
28 Isinr :: "'b => ('a ++ 'b)" |
35 Iwhen :: "('a->'c)=>('b->'c)=>('a ++ 'b)=> 'c" |
29 Iwhen :: "('a->'c)=>('b->'c)=>('a ++ 'b)=> 'c" |
36 |
30 |
37 defs -- {*defining the abstract constants*} |
31 defs -- {*defining the abstract constants*} |
38 Isinl_def: "Isinl(a) == Abs_Ssum(Sinl_Rep(a))" |
32 Isinl_def: "Isinl(a) == Abs_Ssum(a,UU)" |
39 Isinr_def: "Isinr(b) == Abs_Ssum(Sinr_Rep(b))" |
33 Isinr_def: "Isinr(b) == Abs_Ssum(UU,b)" |
40 |
34 |
41 Iwhen_def: "Iwhen(f)(g)(s) == @z. |
35 Iwhen_def: "Iwhen(f)(g)(s) == case Rep_Ssum s of (a,b) => |
42 (s=Isinl(UU) --> z=UU) |
36 if a ~= UU then f$a else |
43 &(!a. a~=UU & s=Isinl(a) --> z=f$a) |
37 if b ~= UU then g$b else UU" |
44 &(!b. b~=UU & s=Isinr(b) --> z=g$b)" |
|
45 |
|
46 text {* A non-emptiness result for Ssum *} |
|
47 |
|
48 lemma SsumIl: "Sinl_Rep(a):Ssum" |
|
49 by (unfold Ssum_def) blast |
|
50 |
|
51 lemma SsumIr: "Sinr_Rep(a):Ssum" |
|
52 by (unfold Ssum_def) blast |
|
53 |
38 |
54 lemma inj_on_Abs_Ssum: "inj_on Abs_Ssum Ssum" |
39 lemma inj_on_Abs_Ssum: "inj_on Abs_Ssum Ssum" |
55 apply (rule inj_on_inverseI) |
40 apply (rule inj_on_inverseI) |
56 apply (erule Abs_Ssum_inverse) |
41 apply (erule Abs_Ssum_inverse) |
57 done |
42 done |
58 |
43 |
59 text {* Strictness of @{term Sinr_Rep}, @{term Sinl_Rep} and @{term Isinl}, @{term Isinr} *} |
44 text {* Strictness of @{term Isinl}, @{term Isinr} *} |
60 |
|
61 lemma strict_SinlSinr_Rep: |
|
62 "Sinl_Rep(UU) = Sinr_Rep(UU)" |
|
63 apply (unfold Sinr_Rep_def Sinl_Rep_def) |
|
64 apply (rule ext)+ |
|
65 apply fast |
|
66 done |
|
67 |
45 |
68 lemma strict_IsinlIsinr: "Isinl(UU) = Isinr(UU)" |
46 lemma strict_IsinlIsinr: "Isinl(UU) = Isinr(UU)" |
69 apply (unfold Isinl_def Isinr_def) |
47 by (simp add: Isinl_def Isinr_def) |
70 apply (rule strict_SinlSinr_Rep [THEN arg_cong]) |
48 |
71 done |
49 text {* distinctness of @{term Isinl}, @{term Isinr} *} |
72 |
|
73 text {* distinctness of @{term Sinl_Rep}, @{term Sinr_Rep} and @{term Isinl}, @{term Isinr} *} |
|
74 |
|
75 lemma noteq_SinlSinr_Rep: |
|
76 "(Sinl_Rep(a) = Sinr_Rep(b)) ==> a=UU & b=UU" |
|
77 apply (unfold Sinl_Rep_def Sinr_Rep_def) |
|
78 apply (blast dest!: fun_cong) |
|
79 done |
|
80 |
50 |
81 lemma noteq_IsinlIsinr: |
51 lemma noteq_IsinlIsinr: |
82 "Isinl(a)=Isinr(b) ==> a=UU & b=UU" |
52 "Isinl(a)=Isinr(b) ==> a=UU & b=UU" |
83 apply (unfold Isinl_def Isinr_def) |
53 apply (unfold Isinl_def Isinr_def) |
84 apply (rule noteq_SinlSinr_Rep) |
54 apply (simp add: Abs_Ssum_inject Ssum_def) |
85 apply (erule inj_on_Abs_Ssum [THEN inj_onD]) |
55 done |
86 apply (rule SsumIl) |
56 |
87 apply (rule SsumIr) |
57 text {* injectivity of @{term Isinl}, @{term Isinr} *} |
88 done |
|
89 |
|
90 text {* injectivity of @{term Sinl_Rep}, @{term Sinr_Rep} and @{term Isinl}, @{term Isinr} *} |
|
91 |
|
92 lemma inject_Sinl_Rep1: "(Sinl_Rep(a) = Sinl_Rep(UU)) ==> a=UU" |
|
93 apply (unfold Sinl_Rep_def) |
|
94 apply (blast dest!: fun_cong) |
|
95 done |
|
96 |
|
97 lemma inject_Sinr_Rep1: "(Sinr_Rep(b) = Sinr_Rep(UU)) ==> b=UU" |
|
98 apply (unfold Sinr_Rep_def) |
|
99 apply (blast dest!: fun_cong) |
|
100 done |
|
101 |
|
102 lemma inject_Sinl_Rep2: |
|
103 "[| a1~=UU ; a2~=UU ; Sinl_Rep(a1)=Sinl_Rep(a2) |] ==> a1=a2" |
|
104 apply (unfold Sinl_Rep_def) |
|
105 apply (blast dest!: fun_cong) |
|
106 done |
|
107 |
|
108 lemma inject_Sinr_Rep2: |
|
109 "[|b1~=UU ; b2~=UU ; Sinr_Rep(b1)=Sinr_Rep(b2) |] ==> b1=b2" |
|
110 apply (unfold Sinr_Rep_def) |
|
111 apply (blast dest!: fun_cong) |
|
112 done |
|
113 |
|
114 lemma inject_Sinl_Rep: "Sinl_Rep(a1)=Sinl_Rep(a2) ==> a1=a2" |
|
115 apply (case_tac "a1=UU") |
|
116 apply simp |
|
117 apply (rule inject_Sinl_Rep1 [symmetric]) |
|
118 apply (erule sym) |
|
119 apply (case_tac "a2=UU") |
|
120 apply simp |
|
121 apply (drule inject_Sinl_Rep1) |
|
122 apply simp |
|
123 apply (erule inject_Sinl_Rep2) |
|
124 apply assumption |
|
125 apply assumption |
|
126 done |
|
127 |
|
128 lemma inject_Sinr_Rep: "Sinr_Rep(b1)=Sinr_Rep(b2) ==> b1=b2" |
|
129 apply (case_tac "b1=UU") |
|
130 apply simp |
|
131 apply (rule inject_Sinr_Rep1 [symmetric]) |
|
132 apply (erule sym) |
|
133 apply (case_tac "b2=UU") |
|
134 apply simp |
|
135 apply (drule inject_Sinr_Rep1) |
|
136 apply simp |
|
137 apply (erule inject_Sinr_Rep2) |
|
138 apply assumption |
|
139 apply assumption |
|
140 done |
|
141 |
58 |
142 lemma inject_Isinl: "Isinl(a1)=Isinl(a2)==> a1=a2" |
59 lemma inject_Isinl: "Isinl(a1)=Isinl(a2)==> a1=a2" |
143 apply (unfold Isinl_def) |
60 by (simp add: Isinl_def Abs_Ssum_inject Ssum_def) |
144 apply (rule inject_Sinl_Rep) |
|
145 apply (erule inj_on_Abs_Ssum [THEN inj_onD]) |
|
146 apply (rule SsumIl) |
|
147 apply (rule SsumIl) |
|
148 done |
|
149 |
61 |
150 lemma inject_Isinr: "Isinr(b1)=Isinr(b2) ==> b1=b2" |
62 lemma inject_Isinr: "Isinr(b1)=Isinr(b2) ==> b1=b2" |
151 apply (unfold Isinr_def) |
63 by (simp add: Isinr_def Abs_Ssum_inject Ssum_def) |
152 apply (rule inject_Sinr_Rep) |
|
153 apply (erule inj_on_Abs_Ssum [THEN inj_onD]) |
|
154 apply (rule SsumIr) |
|
155 apply (rule SsumIr) |
|
156 done |
|
157 |
64 |
158 declare inject_Isinl [dest!] inject_Isinr [dest!] |
65 declare inject_Isinl [dest!] inject_Isinr [dest!] |
159 declare noteq_IsinlIsinr [dest!] |
66 declare noteq_IsinlIsinr [dest!] |
160 declare noteq_IsinlIsinr [OF sym, dest!] |
67 declare noteq_IsinlIsinr [OF sym, dest!] |
161 |
68 |
169 text {* choice of the bottom representation is arbitrary *} |
76 text {* choice of the bottom representation is arbitrary *} |
170 |
77 |
171 lemma Exh_Ssum: |
78 lemma Exh_Ssum: |
172 "z=Isinl(UU) | (? a. z=Isinl(a) & a~=UU) | (? b. z=Isinr(b) & b~=UU)" |
79 "z=Isinl(UU) | (? a. z=Isinl(a) & a~=UU) | (? b. z=Isinr(b) & b~=UU)" |
173 apply (unfold Isinl_def Isinr_def) |
80 apply (unfold Isinl_def Isinr_def) |
174 apply (rule Rep_Ssum[unfolded Ssum_def, THEN CollectE]) |
81 apply (rule_tac x=z in Abs_Ssum_cases) |
175 apply (erule disjE) |
82 apply (auto simp add: Ssum_def) |
176 apply (erule exE) |
|
177 apply (case_tac "z= Abs_Ssum (Sinl_Rep (UU))") |
|
178 apply (erule disjI1) |
|
179 apply (rule disjI2) |
|
180 apply (rule disjI1) |
|
181 apply (rule exI) |
|
182 apply (rule conjI) |
|
183 apply (rule Rep_Ssum_inverse [symmetric, THEN trans]) |
|
184 apply (erule arg_cong) |
|
185 apply (rule_tac Q = "Sinl_Rep (a) =Sinl_Rep (UU) " in contrapos_nn) |
|
186 apply (erule_tac [2] arg_cong) |
|
187 apply (erule contrapos_nn) |
|
188 apply (rule Rep_Ssum_inverse [symmetric, THEN trans]) |
|
189 apply (rule trans) |
|
190 apply (erule arg_cong) |
|
191 apply (erule arg_cong) |
|
192 apply (erule exE) |
|
193 apply (case_tac "z= Abs_Ssum (Sinl_Rep (UU))") |
|
194 apply (erule disjI1) |
|
195 apply (rule disjI2) |
|
196 apply (rule disjI2) |
|
197 apply (rule exI) |
|
198 apply (rule conjI) |
|
199 apply (rule Rep_Ssum_inverse [symmetric, THEN trans]) |
|
200 apply (erule arg_cong) |
|
201 apply (rule_tac Q = "Sinr_Rep (b) =Sinl_Rep (UU) " in contrapos_nn) |
|
202 prefer 2 apply simp |
|
203 apply (rule strict_SinlSinr_Rep [symmetric]) |
|
204 apply (erule contrapos_nn) |
|
205 apply (rule Rep_Ssum_inverse [symmetric, THEN trans]) |
|
206 apply (rule trans) |
|
207 apply (erule arg_cong) |
|
208 apply (erule arg_cong) |
|
209 done |
83 done |
210 |
84 |
211 text {* elimination rules for the strict sum @{typ "'a ++ 'b"} *} |
85 text {* elimination rules for the strict sum @{typ "'a ++ 'b"} *} |
212 |
86 |
213 lemma IssumE: |
87 lemma IssumE: |
214 "[|p=Isinl(UU) ==> Q ; |
88 "[|p=Isinl(UU) ==> Q ; |
215 !!x.[|p=Isinl(x); x~=UU |] ==> Q; |
89 !!x.[|p=Isinl(x); x~=UU |] ==> Q; |
216 !!y.[|p=Isinr(y); y~=UU |] ==> Q|] ==> Q" |
90 !!y.[|p=Isinr(y); y~=UU |] ==> Q|] ==> Q" |
217 apply (rule Exh_Ssum [THEN disjE]) |
91 by (rule Exh_Ssum [THEN disjE]) auto |
218 apply auto |
|
219 done |
|
220 |
92 |
221 lemma IssumE2: |
93 lemma IssumE2: |
222 "[| !!x. [| p = Isinl(x) |] ==> Q; !!y. [| p = Isinr(y) |] ==> Q |] ==>Q" |
94 "[| !!x. [| p = Isinl(x) |] ==> Q; !!y. [| p = Isinr(y) |] ==> Q |] ==>Q" |
223 apply (rule IssumE) |
95 by (rule_tac p=p in IssumE) auto |
224 apply auto |
|
225 done |
|
226 |
96 |
227 text {* rewrites for @{term Iwhen} *} |
97 text {* rewrites for @{term Iwhen} *} |
228 |
98 |
229 lemma Iwhen1: |
99 lemma Iwhen1: "Iwhen f g (Isinl UU) = UU" |
230 "Iwhen f g (Isinl UU) = UU" |
100 apply (unfold Iwhen_def Isinl_def) |
231 apply (unfold Iwhen_def) |
101 apply (simp add: Abs_Ssum_inverse Ssum_def) |
232 apply (rule some_equality) |
102 done |
233 apply (rule conjI) |
103 |
234 apply fast |
104 lemma Iwhen2: "x~=UU ==> Iwhen f g (Isinl x) = f$x" |
235 apply (rule conjI) |
105 apply (unfold Iwhen_def Isinl_def) |
236 apply (intro strip) |
106 apply (simp add: Abs_Ssum_inverse Ssum_def) |
237 apply (rule_tac P = "a=UU" in notE) |
107 done |
238 apply fast |
108 |
239 apply (rule inject_Isinl) |
109 lemma Iwhen3: "y~=UU ==> Iwhen f g (Isinr y) = g$y" |
240 apply (rule sym) |
110 apply (unfold Iwhen_def Isinr_def) |
241 apply fast |
111 apply (simp add: Abs_Ssum_inverse Ssum_def) |
242 apply (intro strip) |
|
243 apply (rule_tac P = "b=UU" in notE) |
|
244 apply fast |
|
245 apply (rule inject_Isinr) |
|
246 apply (rule sym) |
|
247 apply (rule strict_IsinlIsinr [THEN subst]) |
|
248 apply fast |
|
249 apply fast |
|
250 done |
|
251 |
|
252 |
|
253 lemma Iwhen2: |
|
254 "x~=UU ==> Iwhen f g (Isinl x) = f$x" |
|
255 apply (unfold Iwhen_def) |
|
256 apply (rule some_equality) |
|
257 prefer 2 apply fast |
|
258 apply (rule conjI) |
|
259 apply (intro strip) |
|
260 apply (rule_tac P = "x=UU" in notE) |
|
261 apply assumption |
|
262 apply (rule inject_Isinl) |
|
263 apply assumption |
|
264 apply (rule conjI) |
|
265 apply (intro strip) |
|
266 apply (rule cfun_arg_cong) |
|
267 apply (rule inject_Isinl) |
|
268 apply fast |
|
269 apply (intro strip) |
|
270 apply (rule_tac P = "Isinl (x) = Isinr (b) " in notE) |
|
271 prefer 2 apply fast |
|
272 apply (rule contrapos_nn) |
|
273 apply (erule_tac [2] noteq_IsinlIsinr) |
|
274 apply fast |
|
275 done |
|
276 |
|
277 lemma Iwhen3: |
|
278 "y~=UU ==> Iwhen f g (Isinr y) = g$y" |
|
279 apply (unfold Iwhen_def) |
|
280 apply (rule some_equality) |
|
281 prefer 2 apply fast |
|
282 apply (rule conjI) |
|
283 apply (intro strip) |
|
284 apply (rule_tac P = "y=UU" in notE) |
|
285 apply assumption |
|
286 apply (rule inject_Isinr) |
|
287 apply (rule strict_IsinlIsinr [THEN subst]) |
|
288 apply assumption |
|
289 apply (rule conjI) |
|
290 apply (intro strip) |
|
291 apply (rule_tac P = "Isinr (y) = Isinl (a) " in notE) |
|
292 prefer 2 apply fast |
|
293 apply (rule contrapos_nn) |
|
294 apply (erule_tac [2] sym [THEN noteq_IsinlIsinr]) |
|
295 apply fast |
|
296 apply (intro strip) |
|
297 apply (rule cfun_arg_cong) |
|
298 apply (rule inject_Isinr) |
|
299 apply fast |
|
300 done |
112 done |
301 |
113 |
302 text {* instantiate the simplifier *} |
114 text {* instantiate the simplifier *} |
303 |
115 |
304 lemmas Ssum0_ss = strict_IsinlIsinr[symmetric] Iwhen1 Iwhen2 Iwhen3 |
116 lemmas Ssum0_ss = strict_IsinlIsinr[symmetric] Iwhen1 Iwhen2 Iwhen3 |
308 subsection {* Ordering for type @{typ "'a ++ 'b"} *} |
120 subsection {* Ordering for type @{typ "'a ++ 'b"} *} |
309 |
121 |
310 instance "++"::(pcpo, pcpo) sq_ord .. |
122 instance "++"::(pcpo, pcpo) sq_ord .. |
311 |
123 |
312 defs (overloaded) |
124 defs (overloaded) |
313 less_ssum_def: "(op <<) == (%s1 s2.@z. |
125 less_ssum_def: "(op <<) == (%s1 s2. Rep_Ssum s1 << Rep_Ssum s2)" |
314 (! u x. s1=Isinl u & s2=Isinl x --> z = u << x) |
|
315 &(! v y. s1=Isinr v & s2=Isinr y --> z = v << y) |
|
316 &(! u y. s1=Isinl u & s2=Isinr y --> z = (u = UU)) |
|
317 &(! v x. s1=Isinr v & s2=Isinl x --> z = (v = UU)))" |
|
318 |
126 |
319 lemma less_ssum1a: |
127 lemma less_ssum1a: |
320 "[|s1=Isinl(x::'a); s2=Isinl(y::'a)|] ==> s1 << s2 = (x << y)" |
128 "[|s1=Isinl(x::'a); s2=Isinl(y::'a)|] ==> s1 << s2 = (x << y)" |
321 apply (unfold less_ssum_def) |
129 by (simp add: Isinl_def less_ssum_def Abs_Ssum_inverse Ssum_def inst_cprod_po) |
322 apply (rule some_equality) |
|
323 prefer 2 apply simp |
|
324 apply (safe elim!: UU_I) |
|
325 done |
|
326 |
130 |
327 lemma less_ssum1b: |
131 lemma less_ssum1b: |
328 "[|s1=Isinr(x::'b); s2=Isinr(y::'b)|] ==> s1 << s2 = (x << y)" |
132 "[|s1=Isinr(x::'b); s2=Isinr(y::'b)|] ==> s1 << s2 = (x << y)" |
329 apply (unfold less_ssum_def) |
133 by (simp add: Isinr_def less_ssum_def Abs_Ssum_inverse Ssum_def inst_cprod_po) |
330 apply (rule some_equality) |
|
331 prefer 2 apply simp |
|
332 apply (safe elim!: UU_I) |
|
333 done |
|
334 |
134 |
335 lemma less_ssum1c: |
135 lemma less_ssum1c: |
336 "[|s1=Isinl(x::'a); s2=Isinr(y::'b)|] ==> s1 << s2 = ((x::'a) = UU)" |
136 "[|s1=Isinl(x::'a); s2=Isinr(y::'b)|] ==> s1 << s2 = ((x::'a) = UU)" |
337 apply (unfold less_ssum_def) |
137 by (simp add: Isinr_def Isinl_def less_ssum_def Abs_Ssum_inverse Ssum_def inst_cprod_po eq_UU_iff) |
338 apply (rule some_equality) |
|
339 prefer 2 |
|
340 apply (drule conjunct2) |
|
341 apply (drule conjunct2) |
|
342 apply (drule conjunct1) |
|
343 apply (drule spec) |
|
344 apply (drule spec) |
|
345 apply (erule mp) |
|
346 apply fast |
|
347 apply (safe elim!: UU_I) |
|
348 done |
|
349 |
138 |
350 lemma less_ssum1d: |
139 lemma less_ssum1d: |
351 "[|s1=Isinr(x); s2=Isinl(y)|] ==> s1 << s2 = (x = UU)" |
140 "[|s1=Isinr(x); s2=Isinl(y)|] ==> s1 << s2 = (x = UU)" |
|
141 by (simp add: Isinr_def Isinl_def less_ssum_def Abs_Ssum_inverse Ssum_def inst_cprod_po eq_UU_iff) |
|
142 |
|
143 text {* optimize lemmas about @{term less_ssum} *} |
|
144 |
|
145 lemma less_ssum2a: "(Isinl x) << (Isinl y) = (x << y)" |
|
146 by (simp only: less_ssum1a) |
|
147 |
|
148 lemma less_ssum2b: "(Isinr x) << (Isinr y) = (x << y)" |
|
149 by (simp only: less_ssum1b) |
|
150 |
|
151 lemma less_ssum2c: "(Isinl x) << (Isinr y) = (x = UU)" |
|
152 by (simp only: less_ssum1c) |
|
153 |
|
154 lemma less_ssum2d: "(Isinr x) << (Isinl y) = (x = UU)" |
|
155 by (simp only: less_ssum1d) |
|
156 |
|
157 subsection {* Type @{typ "'a ++ 'b"} is a partial order *} |
|
158 |
|
159 lemma refl_less_ssum: "(p::'a++'b) << p" |
|
160 by (unfold less_ssum_def, rule refl_less) |
|
161 |
|
162 lemma antisym_less_ssum: "[|(p1::'a++'b) << p2; p2 << p1|] ==> p1=p2" |
352 apply (unfold less_ssum_def) |
163 apply (unfold less_ssum_def) |
353 apply (rule some_equality) |
164 apply (subst Rep_Ssum_inject [symmetric]) |
354 prefer 2 |
165 by (rule antisym_less) |
355 apply (drule conjunct2) |
|
356 apply (drule conjunct2) |
|
357 apply (drule conjunct2) |
|
358 apply (drule spec) |
|
359 apply (drule spec) |
|
360 apply (erule mp) |
|
361 apply fast |
|
362 apply (safe elim!: UU_I) |
|
363 done |
|
364 |
|
365 text {* optimize lemmas about @{term less_ssum} *} |
|
366 |
|
367 lemma less_ssum2a: "(Isinl x) << (Isinl y) = (x << y)" |
|
368 apply (rule less_ssum1a) |
|
369 apply (rule refl) |
|
370 apply (rule refl) |
|
371 done |
|
372 |
|
373 lemma less_ssum2b: "(Isinr x) << (Isinr y) = (x << y)" |
|
374 apply (rule less_ssum1b) |
|
375 apply (rule refl) |
|
376 apply (rule refl) |
|
377 done |
|
378 |
|
379 lemma less_ssum2c: "(Isinl x) << (Isinr y) = (x = UU)" |
|
380 apply (rule less_ssum1c) |
|
381 apply (rule refl) |
|
382 apply (rule refl) |
|
383 done |
|
384 |
|
385 lemma less_ssum2d: "(Isinr x) << (Isinl y) = (x = UU)" |
|
386 apply (rule less_ssum1d) |
|
387 apply (rule refl) |
|
388 apply (rule refl) |
|
389 done |
|
390 |
|
391 subsection {* Type @{typ "'a ++ 'b"} is a partial order *} |
|
392 |
|
393 lemma refl_less_ssum: "(p::'a++'b) << p" |
|
394 apply (rule_tac p = "p" in IssumE2) |
|
395 apply (simp add: less_ssum2a) |
|
396 apply (simp add: less_ssum2b) |
|
397 done |
|
398 |
|
399 lemma antisym_less_ssum: "[|(p1::'a++'b) << p2; p2 << p1|] ==> p1=p2" |
|
400 apply (rule_tac p = "p1" in IssumE2) |
|
401 apply simp |
|
402 apply (rule_tac p = "p2" in IssumE2) |
|
403 apply simp |
|
404 apply (rule_tac f = "Isinl" in arg_cong) |
|
405 apply (rule antisym_less) |
|
406 apply (erule less_ssum2a [THEN iffD1]) |
|
407 apply (erule less_ssum2a [THEN iffD1]) |
|
408 apply simp |
|
409 apply (erule less_ssum2d [THEN iffD1, THEN ssubst]) |
|
410 apply (erule less_ssum2c [THEN iffD1, THEN ssubst]) |
|
411 apply (rule strict_IsinlIsinr) |
|
412 apply simp |
|
413 apply (rule_tac p = "p2" in IssumE2) |
|
414 apply simp |
|
415 apply (erule less_ssum2c [THEN iffD1, THEN ssubst]) |
|
416 apply (erule less_ssum2d [THEN iffD1, THEN ssubst]) |
|
417 apply (rule strict_IsinlIsinr [symmetric]) |
|
418 apply simp |
|
419 apply (rule_tac f = "Isinr" in arg_cong) |
|
420 apply (rule antisym_less) |
|
421 apply (erule less_ssum2b [THEN iffD1]) |
|
422 apply (erule less_ssum2b [THEN iffD1]) |
|
423 done |
|
424 |
166 |
425 lemma trans_less_ssum: "[|(p1::'a++'b) << p2; p2 << p3|] ==> p1 << p3" |
167 lemma trans_less_ssum: "[|(p1::'a++'b) << p2; p2 << p3|] ==> p1 << p3" |
426 apply (rule_tac p = "p1" in IssumE2) |
168 by (unfold less_ssum_def, rule trans_less) |
427 apply simp |
|
428 apply (rule_tac p = "p3" in IssumE2) |
|
429 apply simp |
|
430 apply (rule less_ssum2a [THEN iffD2]) |
|
431 apply (rule_tac p = "p2" in IssumE2) |
|
432 apply simp |
|
433 apply (rule trans_less) |
|
434 apply (erule less_ssum2a [THEN iffD1]) |
|
435 apply (erule less_ssum2a [THEN iffD1]) |
|
436 apply simp |
|
437 apply (erule less_ssum2c [THEN iffD1, THEN ssubst]) |
|
438 apply (rule minimal) |
|
439 apply simp |
|
440 apply (rule less_ssum2c [THEN iffD2]) |
|
441 apply (rule_tac p = "p2" in IssumE2) |
|
442 apply simp |
|
443 apply (rule UU_I) |
|
444 apply (rule trans_less) |
|
445 apply (erule less_ssum2a [THEN iffD1]) |
|
446 apply (rule antisym_less_inverse [THEN conjunct1]) |
|
447 apply (erule less_ssum2c [THEN iffD1]) |
|
448 apply simp |
|
449 apply (erule less_ssum2c [THEN iffD1]) |
|
450 apply simp |
|
451 apply (rule_tac p = "p3" in IssumE2) |
|
452 apply simp |
|
453 apply (rule less_ssum2d [THEN iffD2]) |
|
454 apply (rule_tac p = "p2" in IssumE2) |
|
455 apply simp |
|
456 apply (erule less_ssum2d [THEN iffD1]) |
|
457 apply simp |
|
458 apply (rule UU_I) |
|
459 apply (rule trans_less) |
|
460 apply (erule less_ssum2b [THEN iffD1]) |
|
461 apply (rule antisym_less_inverse [THEN conjunct1]) |
|
462 apply (erule less_ssum2d [THEN iffD1]) |
|
463 apply simp |
|
464 apply (rule less_ssum2b [THEN iffD2]) |
|
465 apply (rule_tac p = "p2" in IssumE2) |
|
466 apply simp |
|
467 apply (erule less_ssum2d [THEN iffD1, THEN ssubst]) |
|
468 apply (rule minimal) |
|
469 apply simp |
|
470 apply (rule trans_less) |
|
471 apply (erule less_ssum2b [THEN iffD1]) |
|
472 apply (erule less_ssum2b [THEN iffD1]) |
|
473 done |
|
474 |
169 |
475 instance "++" :: (pcpo, pcpo) po |
170 instance "++" :: (pcpo, pcpo) po |
476 by intro_classes |
171 by intro_classes |
477 (assumption | rule refl_less_ssum antisym_less_ssum trans_less_ssum)+ |
172 (assumption | rule refl_less_ssum antisym_less_ssum trans_less_ssum)+ |
478 |
173 |
479 text {* for compatibility with old HOLCF-Version *} |
174 text {* for compatibility with old HOLCF-Version *} |
480 lemma inst_ssum_po: "(op <<)=(%s1 s2.@z. |
175 lemmas inst_ssum_po = less_ssum_def [THEN meta_eq_to_obj_eq] |
481 (! u x. s1=Isinl u & s2=Isinl x --> z = u << x) |
|
482 &(! v y. s1=Isinr v & s2=Isinr y --> z = v << y) |
|
483 &(! u y. s1=Isinl u & s2=Isinr y --> z = (u = UU)) |
|
484 &(! v x. s1=Isinr v & s2=Isinl x --> z = (v = UU)))" |
|
485 apply (fold less_ssum_def) |
|
486 apply (rule refl) |
|
487 done |
|
488 |
176 |
489 subsection {* Type @{typ "'a ++ 'b"} is pointed *} |
177 subsection {* Type @{typ "'a ++ 'b"} is pointed *} |
490 |
178 |
491 lemma minimal_ssum: "Isinl UU << s" |
179 lemma minimal_ssum: "Isinl UU << s" |
492 apply (rule_tac p = "s" in IssumE2) |
180 apply (simp add: less_ssum_def Isinl_def Abs_Ssum_inverse Ssum_def) |
493 apply simp |
181 apply (simp add: inst_cprod_pcpo [symmetric]) |
494 apply (rule less_ssum2a [THEN iffD2]) |
|
495 apply (rule minimal) |
|
496 apply simp |
|
497 apply (subst strict_IsinlIsinr) |
|
498 apply (rule less_ssum2b [THEN iffD2]) |
|
499 apply (rule minimal) |
|
500 done |
182 done |
501 |
183 |
502 lemmas UU_ssum_def = minimal_ssum [THEN minimal2UU, symmetric, standard] |
184 lemmas UU_ssum_def = minimal_ssum [THEN minimal2UU, symmetric, standard] |
503 |
185 |
504 lemma least_ssum: "? x::'a++'b.!y. x<<y" |
186 lemma least_ssum: "? x::'a++'b.!y. x<<y" |