author | wenzelm |
Fri, 02 Oct 2009 22:15:08 +0200 | |
changeset 32861 | 105f40051387 |
parent 31115 | 7d6416f0d1e0 |
child 32960 | 69916a850301 |
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 |
|
17817 | 15 |
pcpodef (Ssum) ('a, 'b) "++" (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 |
|
25827
c2adeb1bae5c
new instance proofs for classes finite_po, chfin, flat
huffman
parents:
25756
diff
changeset
|
21 |
instance "++" :: ("{finite_po,pcpo}", "{finite_po,pcpo}") finite_po |
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 |
|
c2adeb1bae5c
new instance proofs for classes finite_po, chfin, flat
huffman
parents:
25756
diff
changeset
|
24 |
instance "++" :: ("{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 |
|
15576
efb95d0d01f7
converted to new-style theories, and combined numbered files
huffman
parents:
diff
changeset
|
27 |
syntax (xsymbols) |
efb95d0d01f7
converted to new-style theories, and combined numbered files
huffman
parents:
diff
changeset
|
28 |
"++" :: "[type, type] => type" ("(_ \<oplus>/ _)" [21, 20] 20) |
efb95d0d01f7
converted to new-style theories, and combined numbered files
huffman
parents:
diff
changeset
|
29 |
syntax (HTML output) |
efb95d0d01f7
converted to new-style theories, and combined numbered files
huffman
parents:
diff
changeset
|
30 |
"++" :: "[type, type] => type" ("(_ \<oplus>/ _)" [21, 20] 20) |
efb95d0d01f7
converted to new-style theories, and combined numbered files
huffman
parents:
diff
changeset
|
31 |
|
16060
833be7f71ecd
Simplified version of strict sum theory, using TypedefPcpo
huffman
parents:
15606
diff
changeset
|
32 |
subsection {* Definitions of constructors *} |
15576
efb95d0d01f7
converted to new-style theories, and combined numbered files
huffman
parents:
diff
changeset
|
33 |
|
25131
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
19440
diff
changeset
|
34 |
definition |
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
19440
diff
changeset
|
35 |
sinl :: "'a \<rightarrow> ('a ++ 'b)" where |
31115 | 36 |
"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
|
37 |
|
25131
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
19440
diff
changeset
|
38 |
definition |
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
19440
diff
changeset
|
39 |
sinr :: "'b \<rightarrow> ('a ++ 'b)" where |
31115 | 40 |
"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
|
41 |
|
31115 | 42 |
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
|
43 |
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
|
44 |
|
31115 | 45 |
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
|
46 |
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
|
47 |
|
31115 | 48 |
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
|
49 |
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
|
50 |
|
31115 | 51 |
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
|
52 |
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
|
53 |
|
31115 | 54 |
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
|
55 |
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
|
56 |
|
31115 | 57 |
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
|
58 |
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
|
59 |
|
833be7f71ecd
Simplified version of strict sum theory, using TypedefPcpo
huffman
parents:
15606
diff
changeset
|
60 |
subsection {* Properties of @{term sinl} and @{term sinr} *} |
833be7f71ecd
Simplified version of strict sum theory, using TypedefPcpo
huffman
parents:
15606
diff
changeset
|
61 |
|
25740
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents:
25131
diff
changeset
|
62 |
text {* Ordering *} |
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents:
25131
diff
changeset
|
63 |
|
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
|
64 |
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
|
65 |
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
|
66 |
|
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
|
67 |
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
|
68 |
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
|
69 |
|
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
|
70 |
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
|
71 |
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
|
72 |
|
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
|
73 |
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
|
74 |
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
|
75 |
|
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents:
25131
diff
changeset
|
76 |
text {* Equality *} |
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents:
25131
diff
changeset
|
77 |
|
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents:
25131
diff
changeset
|
78 |
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
|
79 |
by (simp add: po_eq_conv) |
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents:
25131
diff
changeset
|
80 |
|
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents:
25131
diff
changeset
|
81 |
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
|
82 |
by (simp add: po_eq_conv) |
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents:
25131
diff
changeset
|
83 |
|
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents:
25131
diff
changeset
|
84 |
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
|
85 |
by (subst po_eq_conv, simp) |
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents:
25131
diff
changeset
|
86 |
|
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents:
25131
diff
changeset
|
87 |
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
|
88 |
by (subst po_eq_conv, simp) |
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents:
25131
diff
changeset
|
89 |
|
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents:
25131
diff
changeset
|
90 |
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
|
91 |
by (rule sinl_eq [THEN iffD1]) |
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents:
25131
diff
changeset
|
92 |
|
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents:
25131
diff
changeset
|
93 |
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
|
94 |
by (rule sinr_eq [THEN iffD1]) |
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents:
25131
diff
changeset
|
95 |
|
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents:
25131
diff
changeset
|
96 |
text {* Strictness *} |
17837 | 97 |
|
16211
faa9691da2bc
changed to use new contI; renamed strict, defined, and inject lemmas
huffman
parents:
16083
diff
changeset
|
98 |
lemma sinl_strict [simp]: "sinl\<cdot>\<bottom> = \<bottom>" |
25915 | 99 |
by (simp add: sinl_Abs_Ssum Abs_Ssum_strict) |
15576
efb95d0d01f7
converted to new-style theories, and combined numbered files
huffman
parents:
diff
changeset
|
100 |
|
16211
faa9691da2bc
changed to use new contI; renamed strict, defined, and inject lemmas
huffman
parents:
16083
diff
changeset
|
101 |
lemma sinr_strict [simp]: "sinr\<cdot>\<bottom> = \<bottom>" |
25915 | 102 |
by (simp add: sinr_Abs_Ssum Abs_Ssum_strict) |
16060
833be7f71ecd
Simplified version of strict sum theory, using TypedefPcpo
huffman
parents:
15606
diff
changeset
|
103 |
|
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
|
104 |
lemma sinl_defined_iff [simp]: "(sinl\<cdot>x = \<bottom>) = (x = \<bottom>)" |
17837 | 105 |
by (cut_tac sinl_eq [of "x" "\<bottom>"], simp) |
15576
efb95d0d01f7
converted to new-style theories, and combined numbered files
huffman
parents:
diff
changeset
|
106 |
|
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
|
107 |
lemma sinr_defined_iff [simp]: "(sinr\<cdot>x = \<bottom>) = (x = \<bottom>)" |
17837 | 108 |
by (cut_tac sinr_eq [of "x" "\<bottom>"], simp) |
15576
efb95d0d01f7
converted to new-style theories, and combined numbered files
huffman
parents:
diff
changeset
|
109 |
|
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
|
110 |
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
|
111 |
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
|
112 |
|
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 |
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
|
114 |
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
|
115 |
|
25882
c58e380d9f7d
new compactness lemmas; removed duplicated flat_less_iff
huffman
parents:
25827
diff
changeset
|
116 |
text {* Compactness *} |
c58e380d9f7d
new compactness lemmas; removed duplicated flat_less_iff
huffman
parents:
25827
diff
changeset
|
117 |
|
c58e380d9f7d
new compactness lemmas; removed duplicated flat_less_iff
huffman
parents:
25827
diff
changeset
|
118 |
lemma compact_sinl: "compact x \<Longrightarrow> compact (sinl\<cdot>x)" |
c58e380d9f7d
new compactness lemmas; removed duplicated flat_less_iff
huffman
parents:
25827
diff
changeset
|
119 |
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
|
120 |
|
c58e380d9f7d
new compactness lemmas; removed duplicated flat_less_iff
huffman
parents:
25827
diff
changeset
|
121 |
lemma compact_sinr: "compact x \<Longrightarrow> compact (sinr\<cdot>x)" |
c58e380d9f7d
new compactness lemmas; removed duplicated flat_less_iff
huffman
parents:
25827
diff
changeset
|
122 |
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
|
123 |
|
c58e380d9f7d
new compactness lemmas; removed duplicated flat_less_iff
huffman
parents:
25827
diff
changeset
|
124 |
lemma compact_sinlD: "compact (sinl\<cdot>x) \<Longrightarrow> compact x" |
c58e380d9f7d
new compactness lemmas; removed duplicated flat_less_iff
huffman
parents:
25827
diff
changeset
|
125 |
unfolding compact_def |
c58e380d9f7d
new compactness lemmas; removed duplicated flat_less_iff
huffman
parents:
25827
diff
changeset
|
126 |
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
|
127 |
|
c58e380d9f7d
new compactness lemmas; removed duplicated flat_less_iff
huffman
parents:
25827
diff
changeset
|
128 |
lemma compact_sinrD: "compact (sinr\<cdot>x) \<Longrightarrow> compact x" |
c58e380d9f7d
new compactness lemmas; removed duplicated flat_less_iff
huffman
parents:
25827
diff
changeset
|
129 |
unfolding compact_def |
c58e380d9f7d
new compactness lemmas; removed duplicated flat_less_iff
huffman
parents:
25827
diff
changeset
|
130 |
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
|
131 |
|
c58e380d9f7d
new compactness lemmas; removed duplicated flat_less_iff
huffman
parents:
25827
diff
changeset
|
132 |
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
|
133 |
by (safe elim!: compact_sinl compact_sinlD) |
c58e380d9f7d
new compactness lemmas; removed duplicated flat_less_iff
huffman
parents:
25827
diff
changeset
|
134 |
|
c58e380d9f7d
new compactness lemmas; removed duplicated flat_less_iff
huffman
parents:
25827
diff
changeset
|
135 |
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
|
136 |
by (safe elim!: compact_sinr compact_sinrD) |
c58e380d9f7d
new compactness lemmas; removed duplicated flat_less_iff
huffman
parents:
25827
diff
changeset
|
137 |
|
16060
833be7f71ecd
Simplified version of strict sum theory, using TypedefPcpo
huffman
parents:
15606
diff
changeset
|
138 |
subsection {* Case analysis *} |
833be7f71ecd
Simplified version of strict sum theory, using TypedefPcpo
huffman
parents:
15606
diff
changeset
|
139 |
|
16921 | 140 |
lemma Exh_Ssum: |
16060
833be7f71ecd
Simplified version of strict sum theory, using TypedefPcpo
huffman
parents:
15606
diff
changeset
|
141 |
"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 | 142 |
apply (induct z rule: Abs_Ssum_induct) |
143 |
apply (case_tac y, rename_tac t a b) |
|
144 |
apply (case_tac t rule: trE) |
|
25740
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents:
25131
diff
changeset
|
145 |
apply (rule disjI1) |
31115 | 146 |
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
|
147 |
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
|
148 |
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
|
149 |
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
|
150 |
apply (simp add: sinr_Abs_Ssum Ssum_def) |
15576
efb95d0d01f7
converted to new-style theories, and combined numbered files
huffman
parents:
diff
changeset
|
151 |
done |
efb95d0d01f7
converted to new-style theories, and combined numbered files
huffman
parents:
diff
changeset
|
152 |
|
25740
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents:
25131
diff
changeset
|
153 |
lemma ssumE [cases type: ++]: |
16060
833be7f71ecd
Simplified version of strict sum theory, using TypedefPcpo
huffman
parents:
15606
diff
changeset
|
154 |
"\<lbrakk>p = \<bottom> \<Longrightarrow> Q; |
833be7f71ecd
Simplified version of strict sum theory, using TypedefPcpo
huffman
parents:
15606
diff
changeset
|
155 |
\<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
|
156 |
\<And>y. \<lbrakk>p = sinr\<cdot>y; y \<noteq> \<bottom>\<rbrakk> \<Longrightarrow> Q\<rbrakk> \<Longrightarrow> Q" |
16921 | 157 |
by (cut_tac z=p in Exh_Ssum, auto) |
15576
efb95d0d01f7
converted to new-style theories, and combined numbered files
huffman
parents:
diff
changeset
|
158 |
|
25756 | 159 |
lemma ssum_induct [induct type: ++]: |
160 |
"\<lbrakk>P \<bottom>; |
|
161 |
\<And>x. x \<noteq> \<bottom> \<Longrightarrow> P (sinl\<cdot>x); |
|
162 |
\<And>y. y \<noteq> \<bottom> \<Longrightarrow> P (sinr\<cdot>y)\<rbrakk> \<Longrightarrow> P x" |
|
163 |
by (cases x, simp_all) |
|
164 |
||
15576
efb95d0d01f7
converted to new-style theories, and combined numbered files
huffman
parents:
diff
changeset
|
165 |
lemma ssumE2: |
16060
833be7f71ecd
Simplified version of strict sum theory, using TypedefPcpo
huffman
parents:
15606
diff
changeset
|
166 |
"\<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
|
167 |
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
|
168 |
|
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
|
169 |
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
|
170 |
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
|
171 |
|
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
|
172 |
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
|
173 |
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
|
174 |
|
25740
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents:
25131
diff
changeset
|
175 |
subsection {* Case analysis combinator *} |
16060
833be7f71ecd
Simplified version of strict sum theory, using TypedefPcpo
huffman
parents:
15606
diff
changeset
|
176 |
|
25131
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
19440
diff
changeset
|
177 |
definition |
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
19440
diff
changeset
|
178 |
sscase :: "('a \<rightarrow> 'c) \<rightarrow> ('b \<rightarrow> 'c) \<rightarrow> ('a ++ 'b) \<rightarrow> 'c" where |
31115 | 179 |
"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
|
180 |
|
833be7f71ecd
Simplified version of strict sum theory, using TypedefPcpo
huffman
parents:
15606
diff
changeset
|
181 |
translations |
26046 | 182 |
"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
|
183 |
|
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 |
translations |
26046 | 185 |
"\<Lambda>(XCONST sinl\<cdot>x). t" == "CONST sscase\<cdot>(\<Lambda> x. t)\<cdot>\<bottom>" |
186 |
"\<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
|
187 |
|
25740
de65baf89106
changed type definition to make Iwhen and reasoning about chains unnecessary;
huffman
parents:
25131
diff
changeset
|
188 |
lemma beta_sscase: |
31115 | 189 |
"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)" |
190 |
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
|
191 |
|
833be7f71ecd
Simplified version of strict sum theory, using TypedefPcpo
huffman
parents:
15606
diff
changeset
|
192 |
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
|
193 |
unfolding beta_sscase by (simp add: Rep_Ssum_strict) |
15576
efb95d0d01f7
converted to new-style theories, and combined numbered files
huffman
parents:
diff
changeset
|
194 |
|
16060
833be7f71ecd
Simplified version of strict sum theory, using TypedefPcpo
huffman
parents:
15606
diff
changeset
|
195 |
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
|
196 |
unfolding beta_sscase by (simp add: Rep_Ssum_sinl) |
15576
efb95d0d01f7
converted to new-style theories, and combined numbered files
huffman
parents:
diff
changeset
|
197 |
|
16060
833be7f71ecd
Simplified version of strict sum theory, using TypedefPcpo
huffman
parents:
15606
diff
changeset
|
198 |
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
|
199 |
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
|
200 |
|
16060
833be7f71ecd
Simplified version of strict sum theory, using TypedefPcpo
huffman
parents:
15606
diff
changeset
|
201 |
lemma sscase4 [simp]: "sscase\<cdot>sinl\<cdot>sinr\<cdot>z = z" |
25756 | 202 |
by (cases z, simp_all) |
15593
24d770bbc44a
reordered and arranged for document generation, cleaned up some proofs
huffman
parents:
15577
diff
changeset
|
203 |
|
25827
c2adeb1bae5c
new instance proofs for classes finite_po, chfin, flat
huffman
parents:
25756
diff
changeset
|
204 |
subsection {* Strict sum preserves flatness *} |
c2adeb1bae5c
new instance proofs for classes finite_po, chfin, flat
huffman
parents:
25756
diff
changeset
|
205 |
|
c2adeb1bae5c
new instance proofs for classes finite_po, chfin, flat
huffman
parents:
25756
diff
changeset
|
206 |
instance "++" :: (flat, flat) flat |
c2adeb1bae5c
new instance proofs for classes finite_po, chfin, flat
huffman
parents:
25756
diff
changeset
|
207 |
apply (intro_classes, clarify) |
31115 | 208 |
apply (case_tac x, simp) |
209 |
apply (case_tac y, simp_all add: flat_below_iff) |
|
210 |
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
|
211 |
done |
c2adeb1bae5c
new instance proofs for classes finite_po, chfin, flat
huffman
parents:
25756
diff
changeset
|
212 |
|
25915 | 213 |
subsection {* Strict sum is a bifinite domain *} |
214 |
||
26962
c8b20f615d6c
use new class package for classes profinite, bifinite; remove approx class
huffman
parents:
26046
diff
changeset
|
215 |
instantiation "++" :: (bifinite, bifinite) bifinite |
c8b20f615d6c
use new class package for classes profinite, bifinite; remove approx class
huffman
parents:
26046
diff
changeset
|
216 |
begin |
25915 | 217 |
|
26962
c8b20f615d6c
use new class package for classes profinite, bifinite; remove approx class
huffman
parents:
26046
diff
changeset
|
218 |
definition |
25915 | 219 |
approx_ssum_def: |
26962
c8b20f615d6c
use new class package for classes profinite, bifinite; remove approx class
huffman
parents:
26046
diff
changeset
|
220 |
"approx = (\<lambda>n. sscase\<cdot>(\<Lambda> x. sinl\<cdot>(approx n\<cdot>x))\<cdot>(\<Lambda> y. sinr\<cdot>(approx n\<cdot>y)))" |
25915 | 221 |
|
222 |
lemma approx_sinl [simp]: "approx i\<cdot>(sinl\<cdot>x) = sinl\<cdot>(approx i\<cdot>x)" |
|
223 |
unfolding approx_ssum_def by (cases "x = \<bottom>") simp_all |
|
224 |
||
225 |
lemma approx_sinr [simp]: "approx i\<cdot>(sinr\<cdot>x) = sinr\<cdot>(approx i\<cdot>x)" |
|
226 |
unfolding approx_ssum_def by (cases "x = \<bottom>") simp_all |
|
227 |
||
26962
c8b20f615d6c
use new class package for classes profinite, bifinite; remove approx class
huffman
parents:
26046
diff
changeset
|
228 |
instance proof |
25915 | 229 |
fix i :: nat and x :: "'a \<oplus> 'b" |
27310 | 230 |
show "chain (approx :: nat \<Rightarrow> 'a \<oplus> 'b \<rightarrow> 'a \<oplus> 'b)" |
25915 | 231 |
unfolding approx_ssum_def by simp |
232 |
show "(\<Squnion>i. approx i\<cdot>x) = x" |
|
233 |
unfolding approx_ssum_def |
|
234 |
by (simp add: lub_distribs eta_cfun) |
|
235 |
show "approx i\<cdot>(approx i\<cdot>x) = approx i\<cdot>x" |
|
236 |
by (cases x, simp add: approx_ssum_def, simp, simp) |
|
237 |
have "{x::'a \<oplus> 'b. approx i\<cdot>x = x} \<subseteq> |
|
238 |
(\<lambda>x. sinl\<cdot>x) ` {x. approx i\<cdot>x = x} \<union> |
|
239 |
(\<lambda>x. sinr\<cdot>x) ` {x. approx i\<cdot>x = x}" |
|
27310 | 240 |
by (rule subsetI, case_tac x rule: ssumE2, simp, simp) |
25915 | 241 |
thus "finite {x::'a \<oplus> 'b. approx i\<cdot>x = x}" |
242 |
by (rule finite_subset, |
|
243 |
intro finite_UnI finite_imageI finite_fixes_approx) |
|
244 |
qed |
|
245 |
||
15576
efb95d0d01f7
converted to new-style theories, and combined numbered files
huffman
parents:
diff
changeset
|
246 |
end |
26962
c8b20f615d6c
use new class package for classes profinite, bifinite; remove approx class
huffman
parents:
26046
diff
changeset
|
247 |
|
c8b20f615d6c
use new class package for classes profinite, bifinite; remove approx class
huffman
parents:
26046
diff
changeset
|
248 |
end |