author | krauss |
Sun, 01 Apr 2012 22:03:45 +0200 | |
changeset 47259 | 2d4ea84278da |
parent 46950 | d0181abdbdac |
child 48891 | c0eafbd55de3 |
permissions | -rw-r--r-- |
42151 | 1 |
(* Title: HOL/HOLCF/Cpodef.thy |
16697 | 2 |
Author: Brian Huffman |
3 |
*) |
|
4 |
||
5 |
header {* Subtypes of pcpos *} |
|
6 |
||
40772 | 7 |
theory Cpodef |
16697 | 8 |
imports Adm |
46950
d0181abdbdac
declare command keywords via theory header, including strict checking outside Pure;
wenzelm
parents:
45606
diff
changeset
|
9 |
keywords "pcpodef" "cpodef" :: thy_goal |
40772 | 10 |
uses ("Tools/cpodef.ML") |
16697 | 11 |
begin |
12 |
||
13 |
subsection {* Proving a subtype is a partial order *} |
|
14 |
||
15 |
text {* |
|
16 |
A subtype of a partial order is itself a partial order, |
|
17 |
if the ordering is defined in the standard way. |
|
18 |
*} |
|
19 |
||
31076
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents:
29138
diff
changeset
|
20 |
setup {* Sign.add_const_constraint (@{const_name Porder.below}, NONE) *} |
28073 | 21 |
|
16697 | 22 |
theorem typedef_po: |
28073 | 23 |
fixes Abs :: "'a::po \<Rightarrow> 'b::type" |
16697 | 24 |
assumes type: "type_definition Rep Abs A" |
31076
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents:
29138
diff
changeset
|
25 |
and below: "op \<sqsubseteq> \<equiv> \<lambda>x y. Rep x \<sqsubseteq> Rep y" |
16697 | 26 |
shows "OFCLASS('b, po_class)" |
31076
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents:
29138
diff
changeset
|
27 |
apply (intro_classes, unfold below) |
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents:
29138
diff
changeset
|
28 |
apply (rule below_refl) |
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents:
29138
diff
changeset
|
29 |
apply (erule (1) below_trans) |
26420
57a626f64875
make preorder locale into a superclass of class po
huffman
parents:
26027
diff
changeset
|
30 |
apply (rule type_definition.Rep_inject [OF type, THEN iffD1]) |
31076
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents:
29138
diff
changeset
|
31 |
apply (erule (1) below_antisym) |
16697 | 32 |
done |
33 |
||
31076
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents:
29138
diff
changeset
|
34 |
setup {* Sign.add_const_constraint (@{const_name Porder.below}, |
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents:
29138
diff
changeset
|
35 |
SOME @{typ "'a::below \<Rightarrow> 'a::below \<Rightarrow> bool"}) *} |
28073 | 36 |
|
25827
c2adeb1bae5c
new instance proofs for classes finite_po, chfin, flat
huffman
parents:
23152
diff
changeset
|
37 |
subsection {* Proving a subtype is finite *} |
c2adeb1bae5c
new instance proofs for classes finite_po, chfin, flat
huffman
parents:
23152
diff
changeset
|
38 |
|
27296
eec7a1889ca5
moved Abs_image to Typedef.thy; prove finite_UNIV outside the locale
huffman
parents:
26420
diff
changeset
|
39 |
lemma typedef_finite_UNIV: |
eec7a1889ca5
moved Abs_image to Typedef.thy; prove finite_UNIV outside the locale
huffman
parents:
26420
diff
changeset
|
40 |
fixes Abs :: "'a::type \<Rightarrow> 'b::type" |
eec7a1889ca5
moved Abs_image to Typedef.thy; prove finite_UNIV outside the locale
huffman
parents:
26420
diff
changeset
|
41 |
assumes type: "type_definition Rep Abs A" |
eec7a1889ca5
moved Abs_image to Typedef.thy; prove finite_UNIV outside the locale
huffman
parents:
26420
diff
changeset
|
42 |
shows "finite A \<Longrightarrow> finite (UNIV :: 'b set)" |
25827
c2adeb1bae5c
new instance proofs for classes finite_po, chfin, flat
huffman
parents:
23152
diff
changeset
|
43 |
proof - |
c2adeb1bae5c
new instance proofs for classes finite_po, chfin, flat
huffman
parents:
23152
diff
changeset
|
44 |
assume "finite A" |
c2adeb1bae5c
new instance proofs for classes finite_po, chfin, flat
huffman
parents:
23152
diff
changeset
|
45 |
hence "finite (Abs ` A)" by (rule finite_imageI) |
27296
eec7a1889ca5
moved Abs_image to Typedef.thy; prove finite_UNIV outside the locale
huffman
parents:
26420
diff
changeset
|
46 |
thus "finite (UNIV :: 'b set)" |
eec7a1889ca5
moved Abs_image to Typedef.thy; prove finite_UNIV outside the locale
huffman
parents:
26420
diff
changeset
|
47 |
by (simp only: type_definition.Abs_image [OF type]) |
25827
c2adeb1bae5c
new instance proofs for classes finite_po, chfin, flat
huffman
parents:
23152
diff
changeset
|
48 |
qed |
c2adeb1bae5c
new instance proofs for classes finite_po, chfin, flat
huffman
parents:
23152
diff
changeset
|
49 |
|
17812 | 50 |
subsection {* Proving a subtype is chain-finite *} |
51 |
||
40035 | 52 |
lemma ch2ch_Rep: |
31076
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents:
29138
diff
changeset
|
53 |
assumes below: "op \<sqsubseteq> \<equiv> \<lambda>x y. Rep x \<sqsubseteq> Rep y" |
40035 | 54 |
shows "chain S \<Longrightarrow> chain (\<lambda>i. Rep (S i))" |
55 |
unfolding chain_def below . |
|
17812 | 56 |
|
57 |
theorem typedef_chfin: |
|
58 |
fixes Abs :: "'a::chfin \<Rightarrow> 'b::po" |
|
59 |
assumes type: "type_definition Rep Abs A" |
|
31076
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents:
29138
diff
changeset
|
60 |
and below: "op \<sqsubseteq> \<equiv> \<lambda>x y. Rep x \<sqsubseteq> Rep y" |
17812 | 61 |
shows "OFCLASS('b, chfin_class)" |
25921 | 62 |
apply intro_classes |
31076
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents:
29138
diff
changeset
|
63 |
apply (drule ch2ch_Rep [OF below]) |
25921 | 64 |
apply (drule chfin) |
17812 | 65 |
apply (unfold max_in_chain_def) |
66 |
apply (simp add: type_definition.Rep_inject [OF type]) |
|
67 |
done |
|
68 |
||
16697 | 69 |
subsection {* Proving a subtype is complete *} |
70 |
||
71 |
text {* |
|
72 |
A subtype of a cpo is itself a cpo if the ordering is |
|
73 |
defined in the standard way, and the defining subset |
|
74 |
is closed with respect to limits of chains. A set is |
|
75 |
closed if and only if membership in the set is an |
|
76 |
admissible predicate. |
|
77 |
*} |
|
78 |
||
40035 | 79 |
lemma typedef_is_lubI: |
80 |
assumes below: "op \<sqsubseteq> \<equiv> \<lambda>x y. Rep x \<sqsubseteq> Rep y" |
|
81 |
shows "range (\<lambda>i. Rep (S i)) <<| Rep x \<Longrightarrow> range S <<| x" |
|
82 |
unfolding is_lub_def is_ub_def below by simp |
|
83 |
||
16918 | 84 |
lemma Abs_inverse_lub_Rep: |
16697 | 85 |
fixes Abs :: "'a::cpo \<Rightarrow> 'b::po" |
86 |
assumes type: "type_definition Rep Abs A" |
|
31076
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents:
29138
diff
changeset
|
87 |
and below: "op \<sqsubseteq> \<equiv> \<lambda>x y. Rep x \<sqsubseteq> Rep y" |
16697 | 88 |
and adm: "adm (\<lambda>x. x \<in> A)" |
16918 | 89 |
shows "chain S \<Longrightarrow> Rep (Abs (\<Squnion>i. Rep (S i))) = (\<Squnion>i. Rep (S i))" |
90 |
apply (rule type_definition.Abs_inverse [OF type]) |
|
31076
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents:
29138
diff
changeset
|
91 |
apply (erule admD [OF adm ch2ch_Rep [OF below]]) |
16697 | 92 |
apply (rule type_definition.Rep [OF type]) |
93 |
done |
|
94 |
||
40770
6023808b38d4
rename cpodef theorems: lub_foo -> is_lub_foo, thelub_foo -> lub_foo
huffman
parents:
40325
diff
changeset
|
95 |
theorem typedef_is_lub: |
16697 | 96 |
fixes Abs :: "'a::cpo \<Rightarrow> 'b::po" |
97 |
assumes type: "type_definition Rep Abs A" |
|
31076
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents:
29138
diff
changeset
|
98 |
and below: "op \<sqsubseteq> \<equiv> \<lambda>x y. Rep x \<sqsubseteq> Rep y" |
16697 | 99 |
and adm: "adm (\<lambda>x. x \<in> A)" |
16918 | 100 |
shows "chain S \<Longrightarrow> range S <<| Abs (\<Squnion>i. Rep (S i))" |
40035 | 101 |
proof - |
102 |
assume S: "chain S" |
|
103 |
hence "chain (\<lambda>i. Rep (S i))" by (rule ch2ch_Rep [OF below]) |
|
104 |
hence "range (\<lambda>i. Rep (S i)) <<| (\<Squnion>i. Rep (S i))" by (rule cpo_lubI) |
|
105 |
hence "range (\<lambda>i. Rep (S i)) <<| Rep (Abs (\<Squnion>i. Rep (S i)))" |
|
106 |
by (simp only: Abs_inverse_lub_Rep [OF type below adm S]) |
|
107 |
thus "range S <<| Abs (\<Squnion>i. Rep (S i))" |
|
108 |
by (rule typedef_is_lubI [OF below]) |
|
109 |
qed |
|
16697 | 110 |
|
45606 | 111 |
lemmas typedef_lub = typedef_is_lub [THEN lub_eqI] |
16918 | 112 |
|
16697 | 113 |
theorem typedef_cpo: |
114 |
fixes Abs :: "'a::cpo \<Rightarrow> 'b::po" |
|
115 |
assumes type: "type_definition Rep Abs A" |
|
31076
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents:
29138
diff
changeset
|
116 |
and below: "op \<sqsubseteq> \<equiv> \<lambda>x y. Rep x \<sqsubseteq> Rep y" |
16697 | 117 |
and adm: "adm (\<lambda>x. x \<in> A)" |
118 |
shows "OFCLASS('b, cpo_class)" |
|
16918 | 119 |
proof |
120 |
fix S::"nat \<Rightarrow> 'b" assume "chain S" |
|
121 |
hence "range S <<| Abs (\<Squnion>i. Rep (S i))" |
|
40770
6023808b38d4
rename cpodef theorems: lub_foo -> is_lub_foo, thelub_foo -> lub_foo
huffman
parents:
40325
diff
changeset
|
122 |
by (rule typedef_is_lub [OF type below adm]) |
16918 | 123 |
thus "\<exists>x. range S <<| x" .. |
124 |
qed |
|
16697 | 125 |
|
35900
aa5dfb03eb1e
remove LaTeX hyperref warnings by avoiding antiquotations within section headings
huffman
parents:
31738
diff
changeset
|
126 |
subsubsection {* Continuity of \emph{Rep} and \emph{Abs} *} |
16697 | 127 |
|
128 |
text {* For any sub-cpo, the @{term Rep} function is continuous. *} |
|
129 |
||
130 |
theorem typedef_cont_Rep: |
|
131 |
fixes Abs :: "'a::cpo \<Rightarrow> 'b::cpo" |
|
132 |
assumes type: "type_definition Rep Abs A" |
|
31076
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents:
29138
diff
changeset
|
133 |
and below: "op \<sqsubseteq> \<equiv> \<lambda>x y. Rep x \<sqsubseteq> Rep y" |
16697 | 134 |
and adm: "adm (\<lambda>x. x \<in> A)" |
40834
a1249aeff5b6
change cpodef-generated cont_Rep rules to cont2cont format
huffman
parents:
40774
diff
changeset
|
135 |
shows "cont (\<lambda>x. f x) \<Longrightarrow> cont (\<lambda>x. Rep (f x))" |
a1249aeff5b6
change cpodef-generated cont_Rep rules to cont2cont format
huffman
parents:
40774
diff
changeset
|
136 |
apply (erule cont_apply [OF _ _ cont_const]) |
16697 | 137 |
apply (rule contI) |
40770
6023808b38d4
rename cpodef theorems: lub_foo -> is_lub_foo, thelub_foo -> lub_foo
huffman
parents:
40325
diff
changeset
|
138 |
apply (simp only: typedef_lub [OF type below adm]) |
31076
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents:
29138
diff
changeset
|
139 |
apply (simp only: Abs_inverse_lub_Rep [OF type below adm]) |
26027 | 140 |
apply (rule cpo_lubI) |
31076
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents:
29138
diff
changeset
|
141 |
apply (erule ch2ch_Rep [OF below]) |
16697 | 142 |
done |
143 |
||
144 |
text {* |
|
145 |
For a sub-cpo, we can make the @{term Abs} function continuous |
|
146 |
only if we restrict its domain to the defining subset by |
|
147 |
composing it with another continuous function. |
|
148 |
*} |
|
149 |
||
150 |
theorem typedef_cont_Abs: |
|
151 |
fixes Abs :: "'a::cpo \<Rightarrow> 'b::cpo" |
|
152 |
fixes f :: "'c::cpo \<Rightarrow> 'a::cpo" |
|
153 |
assumes type: "type_definition Rep Abs A" |
|
31076
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents:
29138
diff
changeset
|
154 |
and below: "op \<sqsubseteq> \<equiv> \<lambda>x y. Rep x \<sqsubseteq> Rep y" |
16918 | 155 |
and adm: "adm (\<lambda>x. x \<in> A)" (* not used *) |
16697 | 156 |
and f_in_A: "\<And>x. f x \<in> A" |
40325 | 157 |
shows "cont f \<Longrightarrow> cont (\<lambda>x. Abs (f x))" |
158 |
unfolding cont_def is_lub_def is_ub_def ball_simps below |
|
159 |
by (simp add: type_definition.Abs_inverse [OF type f_in_A]) |
|
16697 | 160 |
|
17833 | 161 |
subsection {* Proving subtype elements are compact *} |
162 |
||
163 |
theorem typedef_compact: |
|
164 |
fixes Abs :: "'a::cpo \<Rightarrow> 'b::cpo" |
|
165 |
assumes type: "type_definition Rep Abs A" |
|
31076
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents:
29138
diff
changeset
|
166 |
and below: "op \<sqsubseteq> \<equiv> \<lambda>x y. Rep x \<sqsubseteq> Rep y" |
17833 | 167 |
and adm: "adm (\<lambda>x. x \<in> A)" |
168 |
shows "compact (Rep k) \<Longrightarrow> compact k" |
|
169 |
proof (unfold compact_def) |
|
170 |
have cont_Rep: "cont Rep" |
|
40834
a1249aeff5b6
change cpodef-generated cont_Rep rules to cont2cont format
huffman
parents:
40774
diff
changeset
|
171 |
by (rule typedef_cont_Rep [OF type below adm cont_id]) |
41182 | 172 |
assume "adm (\<lambda>x. Rep k \<notsqsubseteq> x)" |
173 |
with cont_Rep have "adm (\<lambda>x. Rep k \<notsqsubseteq> Rep x)" by (rule adm_subst) |
|
174 |
thus "adm (\<lambda>x. k \<notsqsubseteq> x)" by (unfold below) |
|
17833 | 175 |
qed |
176 |
||
16697 | 177 |
subsection {* Proving a subtype is pointed *} |
178 |
||
179 |
text {* |
|
180 |
A subtype of a cpo has a least element if and only if |
|
181 |
the defining subset has a least element. |
|
182 |
*} |
|
183 |
||
16918 | 184 |
theorem typedef_pcpo_generic: |
16697 | 185 |
fixes Abs :: "'a::cpo \<Rightarrow> 'b::cpo" |
186 |
assumes type: "type_definition Rep Abs A" |
|
31076
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents:
29138
diff
changeset
|
187 |
and below: "op \<sqsubseteq> \<equiv> \<lambda>x y. Rep x \<sqsubseteq> Rep y" |
16697 | 188 |
and z_in_A: "z \<in> A" |
189 |
and z_least: "\<And>x. x \<in> A \<Longrightarrow> z \<sqsubseteq> x" |
|
190 |
shows "OFCLASS('b, pcpo_class)" |
|
191 |
apply (intro_classes) |
|
192 |
apply (rule_tac x="Abs z" in exI, rule allI) |
|
31076
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents:
29138
diff
changeset
|
193 |
apply (unfold below) |
16697 | 194 |
apply (subst type_definition.Abs_inverse [OF type z_in_A]) |
195 |
apply (rule z_least [OF type_definition.Rep [OF type]]) |
|
196 |
done |
|
197 |
||
198 |
text {* |
|
199 |
As a special case, a subtype of a pcpo has a least element |
|
200 |
if the defining subset contains @{term \<bottom>}. |
|
201 |
*} |
|
202 |
||
16918 | 203 |
theorem typedef_pcpo: |
16697 | 204 |
fixes Abs :: "'a::pcpo \<Rightarrow> 'b::cpo" |
205 |
assumes type: "type_definition Rep Abs A" |
|
31076
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents:
29138
diff
changeset
|
206 |
and below: "op \<sqsubseteq> \<equiv> \<lambda>x y. Rep x \<sqsubseteq> Rep y" |
41430
1aa23e9f2c87
change some lemma names containing 'UU' to 'bottom'
huffman
parents:
41182
diff
changeset
|
207 |
and bottom_in_A: "\<bottom> \<in> A" |
16697 | 208 |
shows "OFCLASS('b, pcpo_class)" |
41430
1aa23e9f2c87
change some lemma names containing 'UU' to 'bottom'
huffman
parents:
41182
diff
changeset
|
209 |
by (rule typedef_pcpo_generic [OF type below bottom_in_A], rule minimal) |
16697 | 210 |
|
35900
aa5dfb03eb1e
remove LaTeX hyperref warnings by avoiding antiquotations within section headings
huffman
parents:
31738
diff
changeset
|
211 |
subsubsection {* Strictness of \emph{Rep} and \emph{Abs} *} |
16697 | 212 |
|
213 |
text {* |
|
214 |
For a sub-pcpo where @{term \<bottom>} is a member of the defining |
|
215 |
subset, @{term Rep} and @{term Abs} are both strict. |
|
216 |
*} |
|
217 |
||
218 |
theorem typedef_Abs_strict: |
|
219 |
assumes type: "type_definition Rep Abs A" |
|
31076
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents:
29138
diff
changeset
|
220 |
and below: "op \<sqsubseteq> \<equiv> \<lambda>x y. Rep x \<sqsubseteq> Rep y" |
41430
1aa23e9f2c87
change some lemma names containing 'UU' to 'bottom'
huffman
parents:
41182
diff
changeset
|
221 |
and bottom_in_A: "\<bottom> \<in> A" |
16697 | 222 |
shows "Abs \<bottom> = \<bottom>" |
41430
1aa23e9f2c87
change some lemma names containing 'UU' to 'bottom'
huffman
parents:
41182
diff
changeset
|
223 |
apply (rule bottomI, unfold below) |
1aa23e9f2c87
change some lemma names containing 'UU' to 'bottom'
huffman
parents:
41182
diff
changeset
|
224 |
apply (simp add: type_definition.Abs_inverse [OF type bottom_in_A]) |
16697 | 225 |
done |
226 |
||
227 |
theorem typedef_Rep_strict: |
|
228 |
assumes type: "type_definition Rep Abs A" |
|
31076
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents:
29138
diff
changeset
|
229 |
and below: "op \<sqsubseteq> \<equiv> \<lambda>x y. Rep x \<sqsubseteq> Rep y" |
41430
1aa23e9f2c87
change some lemma names containing 'UU' to 'bottom'
huffman
parents:
41182
diff
changeset
|
230 |
and bottom_in_A: "\<bottom> \<in> A" |
16697 | 231 |
shows "Rep \<bottom> = \<bottom>" |
41430
1aa23e9f2c87
change some lemma names containing 'UU' to 'bottom'
huffman
parents:
41182
diff
changeset
|
232 |
apply (rule typedef_Abs_strict [OF type below bottom_in_A, THEN subst]) |
1aa23e9f2c87
change some lemma names containing 'UU' to 'bottom'
huffman
parents:
41182
diff
changeset
|
233 |
apply (rule type_definition.Abs_inverse [OF type bottom_in_A]) |
16697 | 234 |
done |
235 |
||
40321
d065b195ec89
rename lemmas *_defined_iff and *_strict_iff to *_bottom_iff
huffman
parents:
40089
diff
changeset
|
236 |
theorem typedef_Abs_bottom_iff: |
25926 | 237 |
assumes type: "type_definition Rep Abs A" |
31076
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents:
29138
diff
changeset
|
238 |
and below: "op \<sqsubseteq> \<equiv> \<lambda>x y. Rep x \<sqsubseteq> Rep y" |
41430
1aa23e9f2c87
change some lemma names containing 'UU' to 'bottom'
huffman
parents:
41182
diff
changeset
|
239 |
and bottom_in_A: "\<bottom> \<in> A" |
25926 | 240 |
shows "x \<in> A \<Longrightarrow> (Abs x = \<bottom>) = (x = \<bottom>)" |
41430
1aa23e9f2c87
change some lemma names containing 'UU' to 'bottom'
huffman
parents:
41182
diff
changeset
|
241 |
apply (rule typedef_Abs_strict [OF type below bottom_in_A, THEN subst]) |
1aa23e9f2c87
change some lemma names containing 'UU' to 'bottom'
huffman
parents:
41182
diff
changeset
|
242 |
apply (simp add: type_definition.Abs_inject [OF type] bottom_in_A) |
25926 | 243 |
done |
244 |
||
40321
d065b195ec89
rename lemmas *_defined_iff and *_strict_iff to *_bottom_iff
huffman
parents:
40089
diff
changeset
|
245 |
theorem typedef_Rep_bottom_iff: |
25926 | 246 |
assumes type: "type_definition Rep Abs A" |
31076
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents:
29138
diff
changeset
|
247 |
and below: "op \<sqsubseteq> \<equiv> \<lambda>x y. Rep x \<sqsubseteq> Rep y" |
41430
1aa23e9f2c87
change some lemma names containing 'UU' to 'bottom'
huffman
parents:
41182
diff
changeset
|
248 |
and bottom_in_A: "\<bottom> \<in> A" |
25926 | 249 |
shows "(Rep x = \<bottom>) = (x = \<bottom>)" |
41430
1aa23e9f2c87
change some lemma names containing 'UU' to 'bottom'
huffman
parents:
41182
diff
changeset
|
250 |
apply (rule typedef_Rep_strict [OF type below bottom_in_A, THEN subst]) |
25926 | 251 |
apply (simp add: type_definition.Rep_inject [OF type]) |
252 |
done |
|
253 |
||
19519 | 254 |
subsection {* Proving a subtype is flat *} |
255 |
||
256 |
theorem typedef_flat: |
|
257 |
fixes Abs :: "'a::flat \<Rightarrow> 'b::pcpo" |
|
258 |
assumes type: "type_definition Rep Abs A" |
|
31076
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents:
29138
diff
changeset
|
259 |
and below: "op \<sqsubseteq> \<equiv> \<lambda>x y. Rep x \<sqsubseteq> Rep y" |
41430
1aa23e9f2c87
change some lemma names containing 'UU' to 'bottom'
huffman
parents:
41182
diff
changeset
|
260 |
and bottom_in_A: "\<bottom> \<in> A" |
19519 | 261 |
shows "OFCLASS('b, flat_class)" |
262 |
apply (intro_classes) |
|
31076
99fe356cbbc2
rename constant sq_le to below; rename class sq_ord to below; less->below in many lemma names
huffman
parents:
29138
diff
changeset
|
263 |
apply (unfold below) |
19519 | 264 |
apply (simp add: type_definition.Rep_inject [OF type, symmetric]) |
41430
1aa23e9f2c87
change some lemma names containing 'UU' to 'bottom'
huffman
parents:
41182
diff
changeset
|
265 |
apply (simp add: typedef_Rep_strict [OF type below bottom_in_A]) |
19519 | 266 |
apply (simp add: ax_flat) |
267 |
done |
|
268 |
||
16697 | 269 |
subsection {* HOLCF type definition package *} |
270 |
||
40772 | 271 |
use "Tools/cpodef.ML" |
16697 | 272 |
|
273 |
end |