author | huffman |
Wed, 02 Jan 2008 18:27:07 +0100 | |
changeset 25782 | 2d8b845dc298 |
parent 25131 | 2c8caac48ade |
child 25827 | c2adeb1bae5c |
permissions | -rw-r--r-- |
2841
c2508f4ab739
Added "discrete" CPOs and modified IMP to use those rather than "lift"
nipkow
parents:
diff
changeset
|
1 |
(* Title: HOLCF/Discrete.thy |
c2508f4ab739
Added "discrete" CPOs and modified IMP to use those rather than "lift"
nipkow
parents:
diff
changeset
|
2 |
ID: $Id$ |
c2508f4ab739
Added "discrete" CPOs and modified IMP to use those rather than "lift"
nipkow
parents:
diff
changeset
|
3 |
Author: Tobias Nipkow |
c2508f4ab739
Added "discrete" CPOs and modified IMP to use those rather than "lift"
nipkow
parents:
diff
changeset
|
4 |
|
12030 | 5 |
Discrete CPOs. |
2841
c2508f4ab739
Added "discrete" CPOs and modified IMP to use those rather than "lift"
nipkow
parents:
diff
changeset
|
6 |
*) |
c2508f4ab739
Added "discrete" CPOs and modified IMP to use those rather than "lift"
nipkow
parents:
diff
changeset
|
7 |
|
15578 | 8 |
header {* Discrete cpo types *} |
9 |
||
15555 | 10 |
theory Discrete |
19105 | 11 |
imports Cont |
15555 | 12 |
begin |
13 |
||
14 |
datatype 'a discr = Discr "'a :: type" |
|
15 |
||
15590
17f4f5afcd5f
added subsection headings, cleaned up some proofs
huffman
parents:
15578
diff
changeset
|
16 |
subsection {* Type @{typ "'a discr"} is a partial order *} |
17f4f5afcd5f
added subsection headings, cleaned up some proofs
huffman
parents:
15578
diff
changeset
|
17 |
|
15555 | 18 |
instance discr :: (type) sq_ord .. |
19 |
||
20 |
defs (overloaded) |
|
21 |
less_discr_def: "((op <<)::('a::type)discr=>'a discr=>bool) == op =" |
|
22 |
||
23 |
lemma discr_less_eq [iff]: "((x::('a::type)discr) << y) = (x = y)" |
|
15639 | 24 |
by (unfold less_discr_def) (rule refl) |
15555 | 25 |
|
26 |
instance discr :: (type) po |
|
27 |
proof |
|
28 |
fix x y z :: "'a discr" |
|
29 |
show "x << x" by simp |
|
30 |
{ assume "x << y" and "y << x" thus "x = y" by simp } |
|
31 |
{ assume "x << y" and "y << z" thus "x << z" by simp } |
|
32 |
qed |
|
2841
c2508f4ab739
Added "discrete" CPOs and modified IMP to use those rather than "lift"
nipkow
parents:
diff
changeset
|
33 |
|
15590
17f4f5afcd5f
added subsection headings, cleaned up some proofs
huffman
parents:
15578
diff
changeset
|
34 |
subsection {* Type @{typ "'a discr"} is a cpo *} |
17f4f5afcd5f
added subsection headings, cleaned up some proofs
huffman
parents:
15578
diff
changeset
|
35 |
|
15555 | 36 |
lemma discr_chain0: |
37 |
"!!S::nat=>('a::type)discr. chain S ==> S i = S 0" |
|
38 |
apply (unfold chain_def) |
|
39 |
apply (induct_tac "i") |
|
40 |
apply (rule refl) |
|
41 |
apply (erule subst) |
|
42 |
apply (rule sym) |
|
43 |
apply fast |
|
44 |
done |
|
45 |
||
15639 | 46 |
lemma discr_chain_range0 [simp]: |
15555 | 47 |
"!!S::nat=>('a::type)discr. chain(S) ==> range(S) = {S 0}" |
15639 | 48 |
by (fast elim: discr_chain0) |
15555 | 49 |
|
25782 | 50 |
lemma discr_directed_lemma: |
51 |
fixes S :: "'a::type discr set" |
|
52 |
assumes S: "directed S" |
|
53 |
shows "\<exists>x. S = {x}" |
|
54 |
proof - |
|
55 |
obtain x where x: "x \<in> S" |
|
56 |
using S by (rule directedE1) |
|
57 |
hence "S = {x}" |
|
58 |
proof (safe) |
|
59 |
fix y assume y: "y \<in> S" |
|
60 |
obtain z where "x \<sqsubseteq> z" "y \<sqsubseteq> z" |
|
61 |
using S x y by (rule directedE2) |
|
62 |
thus "y = x" by simp |
|
63 |
qed |
|
64 |
thus "\<exists>x. S = {x}" .. |
|
65 |
qed |
|
15555 | 66 |
|
25782 | 67 |
instance discr :: (type) dcpo |
68 |
proof |
|
69 |
fix S :: "'a discr set" |
|
70 |
assume "directed S" |
|
71 |
hence "\<exists>x. S = {x}" by (rule discr_directed_lemma) |
|
72 |
thus "\<exists>x. S <<| x" by (fast intro: is_lub_singleton) |
|
73 |
qed |
|
15590
17f4f5afcd5f
added subsection headings, cleaned up some proofs
huffman
parents:
15578
diff
changeset
|
74 |
|
17f4f5afcd5f
added subsection headings, cleaned up some proofs
huffman
parents:
15578
diff
changeset
|
75 |
subsection {* @{term undiscr} *} |
2841
c2508f4ab739
Added "discrete" CPOs and modified IMP to use those rather than "lift"
nipkow
parents:
diff
changeset
|
76 |
|
25131
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
19105
diff
changeset
|
77 |
definition |
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
19105
diff
changeset
|
78 |
undiscr :: "('a::type)discr => 'a" where |
2c8caac48ade
modernized specifications ('definition', 'abbreviation', 'notation');
wenzelm
parents:
19105
diff
changeset
|
79 |
"undiscr x = (case x of Discr y => y)" |
2841
c2508f4ab739
Added "discrete" CPOs and modified IMP to use those rather than "lift"
nipkow
parents:
diff
changeset
|
80 |
|
15555 | 81 |
lemma undiscr_Discr [simp]: "undiscr(Discr x) = x" |
15590
17f4f5afcd5f
added subsection headings, cleaned up some proofs
huffman
parents:
15578
diff
changeset
|
82 |
by (simp add: undiscr_def) |
15555 | 83 |
|
84 |
lemma discr_chain_f_range0: |
|
85 |
"!!S::nat=>('a::type)discr. chain(S) ==> range(%i. f(S i)) = {f(S 0)}" |
|
15590
17f4f5afcd5f
added subsection headings, cleaned up some proofs
huffman
parents:
15578
diff
changeset
|
86 |
by (fast dest: discr_chain0 elim: arg_cong) |
15555 | 87 |
|
88 |
lemma cont_discr [iff]: "cont(%x::('a::type)discr. f x)" |
|
16213 | 89 |
apply (unfold cont_def is_lub_def is_ub_def) |
15590
17f4f5afcd5f
added subsection headings, cleaned up some proofs
huffman
parents:
15578
diff
changeset
|
90 |
apply (simp add: discr_chain_f_range0) |
15555 | 91 |
done |
92 |
||
2841
c2508f4ab739
Added "discrete" CPOs and modified IMP to use those rather than "lift"
nipkow
parents:
diff
changeset
|
93 |
end |