| author | blanchet | 
| Fri, 23 Apr 2010 12:24:30 +0200 | |
| changeset 36294 | 59a55dfa76d5 | 
| parent 35900 | aa5dfb03eb1e | 
| child 36452 | d37c6eed8117 | 
| permissions | -rw-r--r-- | 
| 15600 | 1  | 
(* Title: HOLCF/Ssum.thy  | 
| 
16060
 
833be7f71ecd
Simplified version of strict sum theory, using TypedefPcpo
 
huffman 
parents: 
15606 
diff
changeset
 | 
2  | 
Author: Franz Regensburger and Brian Huffman  | 
| 
15576
 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 
huffman 
parents:  
diff
changeset
 | 
3  | 
*)  | 
| 
 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 
huffman 
parents:  
diff
changeset
 | 
4  | 
|
| 
 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 
huffman 
parents:  
diff
changeset
 | 
5  | 
header {* The type of strict sums *}
 | 
| 
 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 
huffman 
parents:  
diff
changeset
 | 
6  | 
|
| 15577 | 7  | 
theory Ssum  | 
| 31115 | 8  | 
imports Tr  | 
| 15577 | 9  | 
begin  | 
| 
15576
 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 
huffman 
parents:  
diff
changeset
 | 
10  | 
|
| 
16083
 
fca38c55c8fa
added defaultsort declaration, moved cpair_less to Cprod.thy
 
huffman 
parents: 
16070 
diff
changeset
 | 
11  | 
defaultsort pcpo  | 
| 
 
fca38c55c8fa
added defaultsort declaration, moved cpair_less to Cprod.thy
 
huffman 
parents: 
16070 
diff
changeset
 | 
12  | 
|
| 
15593
 
24d770bbc44a
reordered and arranged for document generation, cleaned up some proofs
 
huffman 
parents: 
15577 
diff
changeset
 | 
13  | 
subsection {* Definition of strict sum type *}
 | 
| 
 
24d770bbc44a
reordered and arranged for document generation, cleaned up some proofs
 
huffman 
parents: 
15577 
diff
changeset
 | 
14  | 
|
| 35525 | 15  | 
pcpodef (Ssum)  ('a, 'b) ssum (infixr "++" 10) = 
 | 
| 
25740
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
16  | 
  "{p :: tr \<times> ('a \<times> 'b).
 | 
| 31115 | 17  | 
(fst p \<sqsubseteq> TT \<longleftrightarrow> snd (snd p) = \<bottom>) \<and>  | 
18  | 
(fst p \<sqsubseteq> FF \<longleftrightarrow> fst (snd p) = \<bottom>)}"  | 
|
| 
29063
 
7619f0561cd7
pcpodef package: state two goals, instead of encoded conjunction;
 
wenzelm 
parents: 
27310 
diff
changeset
 | 
19  | 
by simp_all  | 
| 
15576
 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 
huffman 
parents:  
diff
changeset
 | 
20  | 
|
| 35525 | 21  | 
instance ssum :: ("{finite_po,pcpo}", "{finite_po,pcpo}") finite_po
 | 
| 
25827
 
c2adeb1bae5c
new instance proofs for classes finite_po, chfin, flat
 
huffman 
parents: 
25756 
diff
changeset
 | 
22  | 
by (rule typedef_finite_po [OF type_definition_Ssum])  | 
| 
 
c2adeb1bae5c
new instance proofs for classes finite_po, chfin, flat
 
huffman 
parents: 
25756 
diff
changeset
 | 
23  | 
|
| 35525 | 24  | 
instance ssum :: ("{chfin,pcpo}", "{chfin,pcpo}") chfin
 | 
| 
31076
 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 
huffman 
parents: 
29530 
diff
changeset
 | 
25  | 
by (rule typedef_chfin [OF type_definition_Ssum below_Ssum_def])  | 
| 
25827
 
c2adeb1bae5c
new instance proofs for classes finite_po, chfin, flat
 
huffman 
parents: 
25756 
diff
changeset
 | 
26  | 
|
| 35427 | 27  | 
type_notation (xsymbols)  | 
| 35547 | 28  | 
  ssum  ("(_ \<oplus>/ _)" [21, 20] 20)
 | 
| 35427 | 29  | 
type_notation (HTML output)  | 
| 35547 | 30  | 
  ssum  ("(_ \<oplus>/ _)" [21, 20] 20)
 | 
31  | 
||
| 
15576
 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 
huffman 
parents:  
diff
changeset
 | 
32  | 
|
| 
16060
 
833be7f71ecd
Simplified version of strict sum theory, using TypedefPcpo
 
huffman 
parents: 
15606 
diff
changeset
 | 
33  | 
subsection {* Definitions of constructors *}
 | 
| 
15576
 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 
huffman 
parents:  
diff
changeset
 | 
34  | 
|
| 
25131
 
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
 
wenzelm 
parents: 
19440 
diff
changeset
 | 
35  | 
definition  | 
| 
 
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
 
wenzelm 
parents: 
19440 
diff
changeset
 | 
36  | 
  sinl :: "'a \<rightarrow> ('a ++ 'b)" where
 | 
| 31115 | 37  | 
"sinl = (\<Lambda> a. Abs_Ssum (strictify\<cdot>(\<Lambda> _. TT)\<cdot>a, a, \<bottom>))"  | 
| 
16060
 
833be7f71ecd
Simplified version of strict sum theory, using TypedefPcpo
 
huffman 
parents: 
15606 
diff
changeset
 | 
38  | 
|
| 
25131
 
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
 
wenzelm 
parents: 
19440 
diff
changeset
 | 
39  | 
definition  | 
| 
 
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
 
wenzelm 
parents: 
19440 
diff
changeset
 | 
40  | 
  sinr :: "'b \<rightarrow> ('a ++ 'b)" where
 | 
| 31115 | 41  | 
"sinr = (\<Lambda> b. Abs_Ssum (strictify\<cdot>(\<Lambda> _. FF)\<cdot>b, \<bottom>, b))"  | 
| 
25740
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
42  | 
|
| 31115 | 43  | 
lemma sinl_Ssum: "(strictify\<cdot>(\<Lambda> _. TT)\<cdot>a, a, \<bottom>) \<in> Ssum"  | 
| 
25740
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
44  | 
by (simp add: Ssum_def strictify_conv_if)  | 
| 
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
45  | 
|
| 31115 | 46  | 
lemma sinr_Ssum: "(strictify\<cdot>(\<Lambda> _. FF)\<cdot>b, \<bottom>, b) \<in> Ssum"  | 
| 
25740
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
47  | 
by (simp add: Ssum_def strictify_conv_if)  | 
| 
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
48  | 
|
| 31115 | 49  | 
lemma sinl_Abs_Ssum: "sinl\<cdot>a = Abs_Ssum (strictify\<cdot>(\<Lambda> _. TT)\<cdot>a, a, \<bottom>)"  | 
| 
25740
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
50  | 
by (unfold sinl_def, simp add: cont_Abs_Ssum sinl_Ssum)  | 
| 
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
51  | 
|
| 31115 | 52  | 
lemma sinr_Abs_Ssum: "sinr\<cdot>b = Abs_Ssum (strictify\<cdot>(\<Lambda> _. FF)\<cdot>b, \<bottom>, b)"  | 
| 
25740
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
53  | 
by (unfold sinr_def, simp add: cont_Abs_Ssum sinr_Ssum)  | 
| 
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
54  | 
|
| 31115 | 55  | 
lemma Rep_Ssum_sinl: "Rep_Ssum (sinl\<cdot>a) = (strictify\<cdot>(\<Lambda> _. TT)\<cdot>a, a, \<bottom>)"  | 
| 
25740
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
56  | 
by (simp add: sinl_Abs_Ssum Abs_Ssum_inverse sinl_Ssum)  | 
| 
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
57  | 
|
| 31115 | 58  | 
lemma Rep_Ssum_sinr: "Rep_Ssum (sinr\<cdot>b) = (strictify\<cdot>(\<Lambda> _. FF)\<cdot>b, \<bottom>, b)"  | 
| 
25740
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
59  | 
by (simp add: sinr_Abs_Ssum Abs_Ssum_inverse sinr_Ssum)  | 
| 
16060
 
833be7f71ecd
Simplified version of strict sum theory, using TypedefPcpo
 
huffman 
parents: 
15606 
diff
changeset
 | 
60  | 
|
| 
35900
 
aa5dfb03eb1e
remove LaTeX hyperref warnings by avoiding antiquotations within section headings
 
huffman 
parents: 
35783 
diff
changeset
 | 
61  | 
subsection {* Properties of \emph{sinl} and \emph{sinr} *}
 | 
| 
16060
 
833be7f71ecd
Simplified version of strict sum theory, using TypedefPcpo
 
huffman 
parents: 
15606 
diff
changeset
 | 
62  | 
|
| 
25740
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
63  | 
text {* Ordering *}
 | 
| 
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
64  | 
|
| 
31076
 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 
huffman 
parents: 
29530 
diff
changeset
 | 
65  | 
lemma sinl_below [simp]: "(sinl\<cdot>x \<sqsubseteq> sinl\<cdot>y) = (x \<sqsubseteq> y)"  | 
| 
 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 
huffman 
parents: 
29530 
diff
changeset
 | 
66  | 
by (simp add: below_Ssum_def Rep_Ssum_sinl strictify_conv_if)  | 
| 
25740
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
67  | 
|
| 
31076
 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 
huffman 
parents: 
29530 
diff
changeset
 | 
68  | 
lemma sinr_below [simp]: "(sinr\<cdot>x \<sqsubseteq> sinr\<cdot>y) = (x \<sqsubseteq> y)"  | 
| 
 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 
huffman 
parents: 
29530 
diff
changeset
 | 
69  | 
by (simp add: below_Ssum_def Rep_Ssum_sinr strictify_conv_if)  | 
| 
25740
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
70  | 
|
| 
31076
 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 
huffman 
parents: 
29530 
diff
changeset
 | 
71  | 
lemma sinl_below_sinr [simp]: "(sinl\<cdot>x \<sqsubseteq> sinr\<cdot>y) = (x = \<bottom>)"  | 
| 
 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 
huffman 
parents: 
29530 
diff
changeset
 | 
72  | 
by (simp add: below_Ssum_def Rep_Ssum_sinl Rep_Ssum_sinr strictify_conv_if)  | 
| 
25740
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
73  | 
|
| 
31076
 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 
huffman 
parents: 
29530 
diff
changeset
 | 
74  | 
lemma sinr_below_sinl [simp]: "(sinr\<cdot>x \<sqsubseteq> sinl\<cdot>y) = (x = \<bottom>)"  | 
| 
 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 
huffman 
parents: 
29530 
diff
changeset
 | 
75  | 
by (simp add: below_Ssum_def Rep_Ssum_sinl Rep_Ssum_sinr strictify_conv_if)  | 
| 
25740
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
76  | 
|
| 
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
77  | 
text {* Equality *}
 | 
| 
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
78  | 
|
| 
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
79  | 
lemma sinl_eq [simp]: "(sinl\<cdot>x = sinl\<cdot>y) = (x = y)"  | 
| 
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
80  | 
by (simp add: po_eq_conv)  | 
| 
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
81  | 
|
| 
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
82  | 
lemma sinr_eq [simp]: "(sinr\<cdot>x = sinr\<cdot>y) = (x = y)"  | 
| 
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
83  | 
by (simp add: po_eq_conv)  | 
| 
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
84  | 
|
| 
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
85  | 
lemma sinl_eq_sinr [simp]: "(sinl\<cdot>x = sinr\<cdot>y) = (x = \<bottom> \<and> y = \<bottom>)"  | 
| 
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
86  | 
by (subst po_eq_conv, simp)  | 
| 
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
87  | 
|
| 
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
88  | 
lemma sinr_eq_sinl [simp]: "(sinr\<cdot>x = sinl\<cdot>y) = (x = \<bottom> \<and> y = \<bottom>)"  | 
| 
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
89  | 
by (subst po_eq_conv, simp)  | 
| 
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
90  | 
|
| 
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
91  | 
lemma sinl_inject: "sinl\<cdot>x = sinl\<cdot>y \<Longrightarrow> x = y"  | 
| 
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
92  | 
by (rule sinl_eq [THEN iffD1])  | 
| 
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
93  | 
|
| 
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
94  | 
lemma sinr_inject: "sinr\<cdot>x = sinr\<cdot>y \<Longrightarrow> x = y"  | 
| 
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
95  | 
by (rule sinr_eq [THEN iffD1])  | 
| 
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
96  | 
|
| 
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
97  | 
text {* Strictness *}
 | 
| 17837 | 98  | 
|
| 
16211
 
faa9691da2bc
changed to use new contI; renamed strict, defined, and inject lemmas
 
huffman 
parents: 
16083 
diff
changeset
 | 
99  | 
lemma sinl_strict [simp]: "sinl\<cdot>\<bottom> = \<bottom>"  | 
| 25915 | 100  | 
by (simp add: sinl_Abs_Ssum Abs_Ssum_strict)  | 
| 
15576
 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 
huffman 
parents:  
diff
changeset
 | 
101  | 
|
| 
16211
 
faa9691da2bc
changed to use new contI; renamed strict, defined, and inject lemmas
 
huffman 
parents: 
16083 
diff
changeset
 | 
102  | 
lemma sinr_strict [simp]: "sinr\<cdot>\<bottom> = \<bottom>"  | 
| 25915 | 103  | 
by (simp add: sinr_Abs_Ssum Abs_Ssum_strict)  | 
| 
16060
 
833be7f71ecd
Simplified version of strict sum theory, using TypedefPcpo
 
huffman 
parents: 
15606 
diff
changeset
 | 
104  | 
|
| 
16752
 
270ec60cc9e8
added lemmas sinl_defined_iff sinr_defined_iff, sinl_eq_sinr, sinr_eq_sinl; added more simp rules; cleaned up
 
huffman 
parents: 
16742 
diff
changeset
 | 
105  | 
lemma sinl_defined_iff [simp]: "(sinl\<cdot>x = \<bottom>) = (x = \<bottom>)"  | 
| 17837 | 106  | 
by (cut_tac sinl_eq [of "x" "\<bottom>"], simp)  | 
| 
15576
 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 
huffman 
parents:  
diff
changeset
 | 
107  | 
|
| 
16752
 
270ec60cc9e8
added lemmas sinl_defined_iff sinr_defined_iff, sinl_eq_sinr, sinr_eq_sinl; added more simp rules; cleaned up
 
huffman 
parents: 
16742 
diff
changeset
 | 
108  | 
lemma sinr_defined_iff [simp]: "(sinr\<cdot>x = \<bottom>) = (x = \<bottom>)"  | 
| 17837 | 109  | 
by (cut_tac sinr_eq [of "x" "\<bottom>"], simp)  | 
| 
15576
 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 
huffman 
parents:  
diff
changeset
 | 
110  | 
|
| 
16752
 
270ec60cc9e8
added lemmas sinl_defined_iff sinr_defined_iff, sinl_eq_sinr, sinr_eq_sinl; added more simp rules; cleaned up
 
huffman 
parents: 
16742 
diff
changeset
 | 
111  | 
lemma sinl_defined [intro!]: "x \<noteq> \<bottom> \<Longrightarrow> sinl\<cdot>x \<noteq> \<bottom>"  | 
| 
 
270ec60cc9e8
added lemmas sinl_defined_iff sinr_defined_iff, sinl_eq_sinr, sinr_eq_sinl; added more simp rules; cleaned up
 
huffman 
parents: 
16742 
diff
changeset
 | 
112  | 
by simp  | 
| 
 
270ec60cc9e8
added lemmas sinl_defined_iff sinr_defined_iff, sinl_eq_sinr, sinr_eq_sinl; added more simp rules; cleaned up
 
huffman 
parents: 
16742 
diff
changeset
 | 
113  | 
|
| 
 
270ec60cc9e8
added lemmas sinl_defined_iff sinr_defined_iff, sinl_eq_sinr, sinr_eq_sinl; added more simp rules; cleaned up
 
huffman 
parents: 
16742 
diff
changeset
 | 
114  | 
lemma sinr_defined [intro!]: "x \<noteq> \<bottom> \<Longrightarrow> sinr\<cdot>x \<noteq> \<bottom>"  | 
| 
 
270ec60cc9e8
added lemmas sinl_defined_iff sinr_defined_iff, sinl_eq_sinr, sinr_eq_sinl; added more simp rules; cleaned up
 
huffman 
parents: 
16742 
diff
changeset
 | 
115  | 
by simp  | 
| 
 
270ec60cc9e8
added lemmas sinl_defined_iff sinr_defined_iff, sinl_eq_sinr, sinr_eq_sinl; added more simp rules; cleaned up
 
huffman 
parents: 
16742 
diff
changeset
 | 
116  | 
|
| 
25882
 
c58e380d9f7d
new compactness lemmas; removed duplicated flat_less_iff
 
huffman 
parents: 
25827 
diff
changeset
 | 
117  | 
text {* Compactness *}
 | 
| 
 
c58e380d9f7d
new compactness lemmas; removed duplicated flat_less_iff
 
huffman 
parents: 
25827 
diff
changeset
 | 
118  | 
|
| 
 
c58e380d9f7d
new compactness lemmas; removed duplicated flat_less_iff
 
huffman 
parents: 
25827 
diff
changeset
 | 
119  | 
lemma compact_sinl: "compact x \<Longrightarrow> compact (sinl\<cdot>x)"  | 
| 
 
c58e380d9f7d
new compactness lemmas; removed duplicated flat_less_iff
 
huffman 
parents: 
25827 
diff
changeset
 | 
120  | 
by (rule compact_Ssum, simp add: Rep_Ssum_sinl strictify_conv_if)  | 
| 
 
c58e380d9f7d
new compactness lemmas; removed duplicated flat_less_iff
 
huffman 
parents: 
25827 
diff
changeset
 | 
121  | 
|
| 
 
c58e380d9f7d
new compactness lemmas; removed duplicated flat_less_iff
 
huffman 
parents: 
25827 
diff
changeset
 | 
122  | 
lemma compact_sinr: "compact x \<Longrightarrow> compact (sinr\<cdot>x)"  | 
| 
 
c58e380d9f7d
new compactness lemmas; removed duplicated flat_less_iff
 
huffman 
parents: 
25827 
diff
changeset
 | 
123  | 
by (rule compact_Ssum, simp add: Rep_Ssum_sinr strictify_conv_if)  | 
| 
 
c58e380d9f7d
new compactness lemmas; removed duplicated flat_less_iff
 
huffman 
parents: 
25827 
diff
changeset
 | 
124  | 
|
| 
 
c58e380d9f7d
new compactness lemmas; removed duplicated flat_less_iff
 
huffman 
parents: 
25827 
diff
changeset
 | 
125  | 
lemma compact_sinlD: "compact (sinl\<cdot>x) \<Longrightarrow> compact x"  | 
| 
 
c58e380d9f7d
new compactness lemmas; removed duplicated flat_less_iff
 
huffman 
parents: 
25827 
diff
changeset
 | 
126  | 
unfolding compact_def  | 
| 
 
c58e380d9f7d
new compactness lemmas; removed duplicated flat_less_iff
 
huffman 
parents: 
25827 
diff
changeset
 | 
127  | 
by (drule adm_subst [OF cont_Rep_CFun2 [where f=sinl]], simp)  | 
| 
 
c58e380d9f7d
new compactness lemmas; removed duplicated flat_less_iff
 
huffman 
parents: 
25827 
diff
changeset
 | 
128  | 
|
| 
 
c58e380d9f7d
new compactness lemmas; removed duplicated flat_less_iff
 
huffman 
parents: 
25827 
diff
changeset
 | 
129  | 
lemma compact_sinrD: "compact (sinr\<cdot>x) \<Longrightarrow> compact x"  | 
| 
 
c58e380d9f7d
new compactness lemmas; removed duplicated flat_less_iff
 
huffman 
parents: 
25827 
diff
changeset
 | 
130  | 
unfolding compact_def  | 
| 
 
c58e380d9f7d
new compactness lemmas; removed duplicated flat_less_iff
 
huffman 
parents: 
25827 
diff
changeset
 | 
131  | 
by (drule adm_subst [OF cont_Rep_CFun2 [where f=sinr]], simp)  | 
| 
 
c58e380d9f7d
new compactness lemmas; removed duplicated flat_less_iff
 
huffman 
parents: 
25827 
diff
changeset
 | 
132  | 
|
| 
 
c58e380d9f7d
new compactness lemmas; removed duplicated flat_less_iff
 
huffman 
parents: 
25827 
diff
changeset
 | 
133  | 
lemma compact_sinl_iff [simp]: "compact (sinl\<cdot>x) = compact x"  | 
| 
 
c58e380d9f7d
new compactness lemmas; removed duplicated flat_less_iff
 
huffman 
parents: 
25827 
diff
changeset
 | 
134  | 
by (safe elim!: compact_sinl compact_sinlD)  | 
| 
 
c58e380d9f7d
new compactness lemmas; removed duplicated flat_less_iff
 
huffman 
parents: 
25827 
diff
changeset
 | 
135  | 
|
| 
 
c58e380d9f7d
new compactness lemmas; removed duplicated flat_less_iff
 
huffman 
parents: 
25827 
diff
changeset
 | 
136  | 
lemma compact_sinr_iff [simp]: "compact (sinr\<cdot>x) = compact x"  | 
| 
 
c58e380d9f7d
new compactness lemmas; removed duplicated flat_less_iff
 
huffman 
parents: 
25827 
diff
changeset
 | 
137  | 
by (safe elim!: compact_sinr compact_sinrD)  | 
| 
 
c58e380d9f7d
new compactness lemmas; removed duplicated flat_less_iff
 
huffman 
parents: 
25827 
diff
changeset
 | 
138  | 
|
| 
16060
 
833be7f71ecd
Simplified version of strict sum theory, using TypedefPcpo
 
huffman 
parents: 
15606 
diff
changeset
 | 
139  | 
subsection {* Case analysis *}
 | 
| 
 
833be7f71ecd
Simplified version of strict sum theory, using TypedefPcpo
 
huffman 
parents: 
15606 
diff
changeset
 | 
140  | 
|
| 16921 | 141  | 
lemma Exh_Ssum:  | 
| 
16060
 
833be7f71ecd
Simplified version of strict sum theory, using TypedefPcpo
 
huffman 
parents: 
15606 
diff
changeset
 | 
142  | 
"z = \<bottom> \<or> (\<exists>a. z = sinl\<cdot>a \<and> a \<noteq> \<bottom>) \<or> (\<exists>b. z = sinr\<cdot>b \<and> b \<noteq> \<bottom>)"  | 
| 31115 | 143  | 
apply (induct z rule: Abs_Ssum_induct)  | 
144  | 
apply (case_tac y, rename_tac t a b)  | 
|
145  | 
apply (case_tac t rule: trE)  | 
|
| 
25740
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
146  | 
apply (rule disjI1)  | 
| 31115 | 147  | 
apply (simp add: Ssum_def Abs_Ssum_strict)  | 
| 
25740
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
148  | 
apply (rule disjI2, rule disjI1, rule_tac x=a in exI)  | 
| 
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
149  | 
apply (simp add: sinl_Abs_Ssum Ssum_def)  | 
| 
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
150  | 
apply (rule disjI2, rule disjI2, rule_tac x=b in exI)  | 
| 
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
151  | 
apply (simp add: sinr_Abs_Ssum Ssum_def)  | 
| 
15576
 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 
huffman 
parents:  
diff
changeset
 | 
152  | 
done  | 
| 
 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 
huffman 
parents:  
diff
changeset
 | 
153  | 
|
| 35783 | 154  | 
lemma ssumE [case_names bottom sinl sinr, cases type: ssum]:  | 
| 
16060
 
833be7f71ecd
Simplified version of strict sum theory, using TypedefPcpo
 
huffman 
parents: 
15606 
diff
changeset
 | 
155  | 
"\<lbrakk>p = \<bottom> \<Longrightarrow> Q;  | 
| 
 
833be7f71ecd
Simplified version of strict sum theory, using TypedefPcpo
 
huffman 
parents: 
15606 
diff
changeset
 | 
156  | 
\<And>x. \<lbrakk>p = sinl\<cdot>x; x \<noteq> \<bottom>\<rbrakk> \<Longrightarrow> Q;  | 
| 
 
833be7f71ecd
Simplified version of strict sum theory, using TypedefPcpo
 
huffman 
parents: 
15606 
diff
changeset
 | 
157  | 
\<And>y. \<lbrakk>p = sinr\<cdot>y; y \<noteq> \<bottom>\<rbrakk> \<Longrightarrow> Q\<rbrakk> \<Longrightarrow> Q"  | 
| 35783 | 158  | 
using Exh_Ssum [of p] by auto  | 
| 
15576
 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 
huffman 
parents:  
diff
changeset
 | 
159  | 
|
| 35783 | 160  | 
lemma ssum_induct [case_names bottom sinl sinr, induct type: ssum]:  | 
| 25756 | 161  | 
"\<lbrakk>P \<bottom>;  | 
162  | 
\<And>x. x \<noteq> \<bottom> \<Longrightarrow> P (sinl\<cdot>x);  | 
|
163  | 
\<And>y. y \<noteq> \<bottom> \<Longrightarrow> P (sinr\<cdot>y)\<rbrakk> \<Longrightarrow> P x"  | 
|
164  | 
by (cases x, simp_all)  | 
|
165  | 
||
| 35783 | 166  | 
lemma ssumE2 [case_names sinl sinr]:  | 
| 
16060
 
833be7f71ecd
Simplified version of strict sum theory, using TypedefPcpo
 
huffman 
parents: 
15606 
diff
changeset
 | 
167  | 
"\<lbrakk>\<And>x. p = sinl\<cdot>x \<Longrightarrow> Q; \<And>y. p = sinr\<cdot>y \<Longrightarrow> Q\<rbrakk> \<Longrightarrow> Q"  | 
| 
25740
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
168  | 
by (cases p, simp only: sinl_strict [symmetric], simp, simp)  | 
| 
16060
 
833be7f71ecd
Simplified version of strict sum theory, using TypedefPcpo
 
huffman 
parents: 
15606 
diff
changeset
 | 
169  | 
|
| 
31076
 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 
huffman 
parents: 
29530 
diff
changeset
 | 
170  | 
lemma below_sinlD: "p \<sqsubseteq> sinl\<cdot>x \<Longrightarrow> \<exists>y. p = sinl\<cdot>y \<and> y \<sqsubseteq> x"  | 
| 
25740
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
171  | 
by (cases p, rule_tac x="\<bottom>" in exI, simp_all)  | 
| 
15576
 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 
huffman 
parents:  
diff
changeset
 | 
172  | 
|
| 
31076
 
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
 
huffman 
parents: 
29530 
diff
changeset
 | 
173  | 
lemma below_sinrD: "p \<sqsubseteq> sinr\<cdot>x \<Longrightarrow> \<exists>y. p = sinr\<cdot>y \<and> y \<sqsubseteq> x"  | 
| 
25740
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
174  | 
by (cases p, rule_tac x="\<bottom>" in exI, simp_all)  | 
| 
16060
 
833be7f71ecd
Simplified version of strict sum theory, using TypedefPcpo
 
huffman 
parents: 
15606 
diff
changeset
 | 
175  | 
|
| 
25740
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
176  | 
subsection {* Case analysis combinator *}
 | 
| 
16060
 
833be7f71ecd
Simplified version of strict sum theory, using TypedefPcpo
 
huffman 
parents: 
15606 
diff
changeset
 | 
177  | 
|
| 
25131
 
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
 
wenzelm 
parents: 
19440 
diff
changeset
 | 
178  | 
definition  | 
| 
 
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
 
wenzelm 
parents: 
19440 
diff
changeset
 | 
179  | 
  sscase :: "('a \<rightarrow> 'c) \<rightarrow> ('b \<rightarrow> 'c) \<rightarrow> ('a ++ 'b) \<rightarrow> 'c" where
 | 
| 31115 | 180  | 
"sscase = (\<Lambda> f g s. (\<lambda>(t, x, y). If t then f\<cdot>x else g\<cdot>y fi) (Rep_Ssum s))"  | 
| 
16060
 
833be7f71ecd
Simplified version of strict sum theory, using TypedefPcpo
 
huffman 
parents: 
15606 
diff
changeset
 | 
181  | 
|
| 
 
833be7f71ecd
Simplified version of strict sum theory, using TypedefPcpo
 
huffman 
parents: 
15606 
diff
changeset
 | 
182  | 
translations  | 
| 26046 | 183  | 
"case s of XCONST sinl\<cdot>x \<Rightarrow> t1 | XCONST sinr\<cdot>y \<Rightarrow> t2" == "CONST sscase\<cdot>(\<Lambda> x. t1)\<cdot>(\<Lambda> y. t2)\<cdot>s"  | 
| 
18078
 
20e5a6440790
change syntax for LAM to use expressions as patterns; define LAM pattern syntax for cpair, spair, sinl, sinr, up
 
huffman 
parents: 
17837 
diff
changeset
 | 
184  | 
|
| 
 
20e5a6440790
change syntax for LAM to use expressions as patterns; define LAM pattern syntax for cpair, spair, sinl, sinr, up
 
huffman 
parents: 
17837 
diff
changeset
 | 
185  | 
translations  | 
| 26046 | 186  | 
"\<Lambda>(XCONST sinl\<cdot>x). t" == "CONST sscase\<cdot>(\<Lambda> x. t)\<cdot>\<bottom>"  | 
187  | 
"\<Lambda>(XCONST sinr\<cdot>y). t" == "CONST sscase\<cdot>\<bottom>\<cdot>(\<Lambda> y. t)"  | 
|
| 
16060
 
833be7f71ecd
Simplified version of strict sum theory, using TypedefPcpo
 
huffman 
parents: 
15606 
diff
changeset
 | 
188  | 
|
| 
25740
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
189  | 
lemma beta_sscase:  | 
| 31115 | 190  | 
"sscase\<cdot>f\<cdot>g\<cdot>s = (\<lambda>(t, x, y). If t then f\<cdot>x else g\<cdot>y fi) (Rep_Ssum s)"  | 
191  | 
unfolding sscase_def by (simp add: cont_Rep_Ssum [THEN cont_compose])  | 
|
| 
16060
 
833be7f71ecd
Simplified version of strict sum theory, using TypedefPcpo
 
huffman 
parents: 
15606 
diff
changeset
 | 
192  | 
|
| 
 
833be7f71ecd
Simplified version of strict sum theory, using TypedefPcpo
 
huffman 
parents: 
15606 
diff
changeset
 | 
193  | 
lemma sscase1 [simp]: "sscase\<cdot>f\<cdot>g\<cdot>\<bottom> = \<bottom>"  | 
| 
25740
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
194  | 
unfolding beta_sscase by (simp add: Rep_Ssum_strict)  | 
| 
15576
 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 
huffman 
parents:  
diff
changeset
 | 
195  | 
|
| 
16060
 
833be7f71ecd
Simplified version of strict sum theory, using TypedefPcpo
 
huffman 
parents: 
15606 
diff
changeset
 | 
196  | 
lemma sscase2 [simp]: "x \<noteq> \<bottom> \<Longrightarrow> sscase\<cdot>f\<cdot>g\<cdot>(sinl\<cdot>x) = f\<cdot>x"  | 
| 
25740
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
197  | 
unfolding beta_sscase by (simp add: Rep_Ssum_sinl)  | 
| 
15576
 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 
huffman 
parents:  
diff
changeset
 | 
198  | 
|
| 
16060
 
833be7f71ecd
Simplified version of strict sum theory, using TypedefPcpo
 
huffman 
parents: 
15606 
diff
changeset
 | 
199  | 
lemma sscase3 [simp]: "y \<noteq> \<bottom> \<Longrightarrow> sscase\<cdot>f\<cdot>g\<cdot>(sinr\<cdot>y) = g\<cdot>y"  | 
| 
25740
 
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
 
huffman 
parents: 
25131 
diff
changeset
 | 
200  | 
unfolding beta_sscase by (simp add: Rep_Ssum_sinr)  | 
| 
15593
 
24d770bbc44a
reordered and arranged for document generation, cleaned up some proofs
 
huffman 
parents: 
15577 
diff
changeset
 | 
201  | 
|
| 
16060
 
833be7f71ecd
Simplified version of strict sum theory, using TypedefPcpo
 
huffman 
parents: 
15606 
diff
changeset
 | 
202  | 
lemma sscase4 [simp]: "sscase\<cdot>sinl\<cdot>sinr\<cdot>z = z"  | 
| 25756 | 203  | 
by (cases z, simp_all)  | 
| 
15593
 
24d770bbc44a
reordered and arranged for document generation, cleaned up some proofs
 
huffman 
parents: 
15577 
diff
changeset
 | 
204  | 
|
| 
25827
 
c2adeb1bae5c
new instance proofs for classes finite_po, chfin, flat
 
huffman 
parents: 
25756 
diff
changeset
 | 
205  | 
subsection {* Strict sum preserves flatness *}
 | 
| 
 
c2adeb1bae5c
new instance proofs for classes finite_po, chfin, flat
 
huffman 
parents: 
25756 
diff
changeset
 | 
206  | 
|
| 35525 | 207  | 
instance ssum :: (flat, flat) flat  | 
| 
25827
 
c2adeb1bae5c
new instance proofs for classes finite_po, chfin, flat
 
huffman 
parents: 
25756 
diff
changeset
 | 
208  | 
apply (intro_classes, clarify)  | 
| 31115 | 209  | 
apply (case_tac x, simp)  | 
210  | 
apply (case_tac y, simp_all add: flat_below_iff)  | 
|
211  | 
apply (case_tac y, simp_all add: flat_below_iff)  | 
|
| 
25827
 
c2adeb1bae5c
new instance proofs for classes finite_po, chfin, flat
 
huffman 
parents: 
25756 
diff
changeset
 | 
212  | 
done  | 
| 
 
c2adeb1bae5c
new instance proofs for classes finite_po, chfin, flat
 
huffman 
parents: 
25756 
diff
changeset
 | 
213  | 
|
| 
33504
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
214  | 
subsection {* Map function for strict sums *}
 | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
215  | 
|
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
216  | 
definition  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
217  | 
  ssum_map :: "('a \<rightarrow> 'b) \<rightarrow> ('c \<rightarrow> 'd) \<rightarrow> 'a \<oplus> 'c \<rightarrow> 'b \<oplus> 'd"
 | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
218  | 
where  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
219  | 
"ssum_map = (\<Lambda> f g. sscase\<cdot>(sinl oo f)\<cdot>(sinr oo g))"  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
220  | 
|
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
221  | 
lemma ssum_map_strict [simp]: "ssum_map\<cdot>f\<cdot>g\<cdot>\<bottom> = \<bottom>"  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
222  | 
unfolding ssum_map_def by simp  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
223  | 
|
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
224  | 
lemma ssum_map_sinl [simp]: "x \<noteq> \<bottom> \<Longrightarrow> ssum_map\<cdot>f\<cdot>g\<cdot>(sinl\<cdot>x) = sinl\<cdot>(f\<cdot>x)"  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
225  | 
unfolding ssum_map_def by simp  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
226  | 
|
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
227  | 
lemma ssum_map_sinr [simp]: "x \<noteq> \<bottom> \<Longrightarrow> ssum_map\<cdot>f\<cdot>g\<cdot>(sinr\<cdot>x) = sinr\<cdot>(g\<cdot>x)"  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
228  | 
unfolding ssum_map_def by simp  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
229  | 
|
| 35491 | 230  | 
lemma ssum_map_sinl': "f\<cdot>\<bottom> = \<bottom> \<Longrightarrow> ssum_map\<cdot>f\<cdot>g\<cdot>(sinl\<cdot>x) = sinl\<cdot>(f\<cdot>x)"  | 
231  | 
by (cases "x = \<bottom>") simp_all  | 
|
232  | 
||
233  | 
lemma ssum_map_sinr': "g\<cdot>\<bottom> = \<bottom> \<Longrightarrow> ssum_map\<cdot>f\<cdot>g\<cdot>(sinr\<cdot>x) = sinr\<cdot>(g\<cdot>x)"  | 
|
234  | 
by (cases "x = \<bottom>") simp_all  | 
|
235  | 
||
| 33808 | 236  | 
lemma ssum_map_ID: "ssum_map\<cdot>ID\<cdot>ID = ID"  | 
237  | 
unfolding ssum_map_def by (simp add: expand_cfun_eq eta_cfun)  | 
|
238  | 
||
| 33587 | 239  | 
lemma ssum_map_map:  | 
240  | 
"\<lbrakk>f1\<cdot>\<bottom> = \<bottom>; g1\<cdot>\<bottom> = \<bottom>\<rbrakk> \<Longrightarrow>  | 
|
241  | 
ssum_map\<cdot>f1\<cdot>g1\<cdot>(ssum_map\<cdot>f2\<cdot>g2\<cdot>p) =  | 
|
242  | 
ssum_map\<cdot>(\<Lambda> x. f1\<cdot>(f2\<cdot>x))\<cdot>(\<Lambda> x. g1\<cdot>(g2\<cdot>x))\<cdot>p"  | 
|
243  | 
apply (induct p, simp)  | 
|
244  | 
apply (case_tac "f2\<cdot>x = \<bottom>", simp, simp)  | 
|
245  | 
apply (case_tac "g2\<cdot>y = \<bottom>", simp, simp)  | 
|
246  | 
done  | 
|
247  | 
||
| 
33504
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
248  | 
lemma ep_pair_ssum_map:  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
249  | 
assumes "ep_pair e1 p1" and "ep_pair e2 p2"  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
250  | 
shows "ep_pair (ssum_map\<cdot>e1\<cdot>e2) (ssum_map\<cdot>p1\<cdot>p2)"  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
251  | 
proof  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
252  | 
interpret e1p1: pcpo_ep_pair e1 p1 unfolding pcpo_ep_pair_def by fact  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
253  | 
interpret e2p2: pcpo_ep_pair e2 p2 unfolding pcpo_ep_pair_def by fact  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
254  | 
fix x show "ssum_map\<cdot>p1\<cdot>p2\<cdot>(ssum_map\<cdot>e1\<cdot>e2\<cdot>x) = x"  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
255  | 
by (induct x) simp_all  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
256  | 
fix y show "ssum_map\<cdot>e1\<cdot>e2\<cdot>(ssum_map\<cdot>p1\<cdot>p2\<cdot>y) \<sqsubseteq> y"  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
257  | 
apply (induct y, simp)  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
258  | 
apply (case_tac "p1\<cdot>x = \<bottom>", simp, simp add: e1p1.e_p_below)  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
259  | 
apply (case_tac "p2\<cdot>y = \<bottom>", simp, simp add: e2p2.e_p_below)  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
260  | 
done  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
261  | 
qed  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
262  | 
|
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
263  | 
lemma deflation_ssum_map:  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
264  | 
assumes "deflation d1" and "deflation d2"  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
265  | 
shows "deflation (ssum_map\<cdot>d1\<cdot>d2)"  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
266  | 
proof  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
267  | 
interpret d1: deflation d1 by fact  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
268  | 
interpret d2: deflation d2 by fact  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
269  | 
fix x  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
270  | 
show "ssum_map\<cdot>d1\<cdot>d2\<cdot>(ssum_map\<cdot>d1\<cdot>d2\<cdot>x) = ssum_map\<cdot>d1\<cdot>d2\<cdot>x"  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
271  | 
apply (induct x, simp)  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
272  | 
apply (case_tac "d1\<cdot>x = \<bottom>", simp, simp add: d1.idem)  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
273  | 
apply (case_tac "d2\<cdot>y = \<bottom>", simp, simp add: d2.idem)  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
274  | 
done  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
275  | 
show "ssum_map\<cdot>d1\<cdot>d2\<cdot>x \<sqsubseteq> x"  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
276  | 
apply (induct x, simp)  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
277  | 
apply (case_tac "d1\<cdot>x = \<bottom>", simp, simp add: d1.below)  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
278  | 
apply (case_tac "d2\<cdot>y = \<bottom>", simp, simp add: d2.below)  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
279  | 
done  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
280  | 
qed  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
281  | 
|
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
282  | 
lemma finite_deflation_ssum_map:  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
283  | 
assumes "finite_deflation d1" and "finite_deflation d2"  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
284  | 
shows "finite_deflation (ssum_map\<cdot>d1\<cdot>d2)"  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
285  | 
proof (intro finite_deflation.intro finite_deflation_axioms.intro)  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
286  | 
interpret d1: finite_deflation d1 by fact  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
287  | 
interpret d2: finite_deflation d2 by fact  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
288  | 
have "deflation d1" and "deflation d2" by fact+  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
289  | 
thus "deflation (ssum_map\<cdot>d1\<cdot>d2)" by (rule deflation_ssum_map)  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
290  | 
  have "{x. ssum_map\<cdot>d1\<cdot>d2\<cdot>x = x} \<subseteq>
 | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
291  | 
        (\<lambda>x. sinl\<cdot>x) ` {x. d1\<cdot>x = x} \<union>
 | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
292  | 
        (\<lambda>x. sinr\<cdot>x) ` {x. d2\<cdot>x = x} \<union> {\<bottom>}"
 | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
293  | 
by (rule subsetI, case_tac x, simp_all)  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
294  | 
  thus "finite {x. ssum_map\<cdot>d1\<cdot>d2\<cdot>x = x}"
 | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
295  | 
by (rule finite_subset, simp add: d1.finite_fixes d2.finite_fixes)  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
296  | 
qed  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
297  | 
|
| 25915 | 298  | 
subsection {* Strict sum is a bifinite domain *}
 | 
299  | 
||
| 35525 | 300  | 
instantiation ssum :: (bifinite, bifinite) bifinite  | 
| 
26962
 
c8b20f615d6c
use new class package for classes profinite, bifinite; remove approx class
 
huffman 
parents: 
26046 
diff
changeset
 | 
301  | 
begin  | 
| 25915 | 302  | 
|
| 
26962
 
c8b20f615d6c
use new class package for classes profinite, bifinite; remove approx class
 
huffman 
parents: 
26046 
diff
changeset
 | 
303  | 
definition  | 
| 25915 | 304  | 
approx_ssum_def:  | 
| 
33504
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
305  | 
"approx = (\<lambda>n. ssum_map\<cdot>(approx n)\<cdot>(approx n))"  | 
| 25915 | 306  | 
|
307  | 
lemma approx_sinl [simp]: "approx i\<cdot>(sinl\<cdot>x) = sinl\<cdot>(approx i\<cdot>x)"  | 
|
308  | 
unfolding approx_ssum_def by (cases "x = \<bottom>") simp_all  | 
|
309  | 
||
310  | 
lemma approx_sinr [simp]: "approx i\<cdot>(sinr\<cdot>x) = sinr\<cdot>(approx i\<cdot>x)"  | 
|
311  | 
unfolding approx_ssum_def by (cases "x = \<bottom>") simp_all  | 
|
312  | 
||
| 
26962
 
c8b20f615d6c
use new class package for classes profinite, bifinite; remove approx class
 
huffman 
parents: 
26046 
diff
changeset
 | 
313  | 
instance proof  | 
| 25915 | 314  | 
fix i :: nat and x :: "'a \<oplus> 'b"  | 
| 27310 | 315  | 
show "chain (approx :: nat \<Rightarrow> 'a \<oplus> 'b \<rightarrow> 'a \<oplus> 'b)"  | 
| 25915 | 316  | 
unfolding approx_ssum_def by simp  | 
317  | 
show "(\<Squnion>i. approx i\<cdot>x) = x"  | 
|
318  | 
unfolding approx_ssum_def  | 
|
| 
33504
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
319  | 
by (cases x, simp_all add: lub_distribs)  | 
| 25915 | 320  | 
show "approx i\<cdot>(approx i\<cdot>x) = approx i\<cdot>x"  | 
321  | 
by (cases x, simp add: approx_ssum_def, simp, simp)  | 
|
| 
33504
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
322  | 
  show "finite {x::'a \<oplus> 'b. approx i\<cdot>x = x}"
 | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
323  | 
unfolding approx_ssum_def  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
324  | 
by (intro finite_deflation.finite_fixes  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
325  | 
finite_deflation_ssum_map  | 
| 
 
b4210cc3ac97
map functions for various types, with ep_pair/deflation/finite_deflation lemmas
 
huffman 
parents: 
32960 
diff
changeset
 | 
326  | 
finite_deflation_approx)  | 
| 25915 | 327  | 
qed  | 
328  | 
||
| 
15576
 
efb95d0d01f7
converted to new-style theories, and combined numbered files
 
huffman 
parents:  
diff
changeset
 | 
329  | 
end  | 
| 
26962
 
c8b20f615d6c
use new class package for classes profinite, bifinite; remove approx class
 
huffman 
parents: 
26046 
diff
changeset
 | 
330  | 
|
| 
 
c8b20f615d6c
use new class package for classes profinite, bifinite; remove approx class
 
huffman 
parents: 
26046 
diff
changeset
 | 
331  | 
end  |