author | paulson |
Tue, 24 May 2005 11:19:50 +0200 | |
changeset 16063 | 7dd4eb2c8055 |
parent 15639 | 99ed5113783b |
child 16070 | 4a83dd540b88 |
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 |
15555 | 4 |
License: GPL (GNU GENERAL PUBLIC LICENSE) |
2841
c2508f4ab739
Added "discrete" CPOs and modified IMP to use those rather than "lift"
nipkow
parents:
diff
changeset
|
5 |
|
12030 | 6 |
Discrete CPOs. |
2841
c2508f4ab739
Added "discrete" CPOs and modified IMP to use those rather than "lift"
nipkow
parents:
diff
changeset
|
7 |
*) |
c2508f4ab739
Added "discrete" CPOs and modified IMP to use those rather than "lift"
nipkow
parents:
diff
changeset
|
8 |
|
15578 | 9 |
header {* Discrete cpo types *} |
10 |
||
15555 | 11 |
theory Discrete |
12 |
imports Cont Datatype |
|
13 |
begin |
|
14 |
||
15 |
datatype 'a discr = Discr "'a :: type" |
|
16 |
||
15590
17f4f5afcd5f
added subsection headings, cleaned up some proofs
huffman
parents:
15578
diff
changeset
|
17 |
subsection {* Type @{typ "'a discr"} is a partial order *} |
17f4f5afcd5f
added subsection headings, cleaned up some proofs
huffman
parents:
15578
diff
changeset
|
18 |
|
15555 | 19 |
instance discr :: (type) sq_ord .. |
20 |
||
21 |
defs (overloaded) |
|
22 |
less_discr_def: "((op <<)::('a::type)discr=>'a discr=>bool) == op =" |
|
23 |
||
24 |
lemma discr_less_eq [iff]: "((x::('a::type)discr) << y) = (x = y)" |
|
15639 | 25 |
by (unfold less_discr_def) (rule refl) |
15555 | 26 |
|
27 |
instance discr :: (type) po |
|
28 |
proof |
|
29 |
fix x y z :: "'a discr" |
|
30 |
show "x << x" by simp |
|
31 |
{ assume "x << y" and "y << x" thus "x = y" by simp } |
|
32 |
{ assume "x << y" and "y << z" thus "x << z" by simp } |
|
33 |
qed |
|
2841
c2508f4ab739
Added "discrete" CPOs and modified IMP to use those rather than "lift"
nipkow
parents:
diff
changeset
|
34 |
|
15590
17f4f5afcd5f
added subsection headings, cleaned up some proofs
huffman
parents:
15578
diff
changeset
|
35 |
subsection {* Type @{typ "'a discr"} is a cpo *} |
17f4f5afcd5f
added subsection headings, cleaned up some proofs
huffman
parents:
15578
diff
changeset
|
36 |
|
15555 | 37 |
lemma discr_chain0: |
38 |
"!!S::nat=>('a::type)discr. chain S ==> S i = S 0" |
|
39 |
apply (unfold chain_def) |
|
40 |
apply (induct_tac "i") |
|
41 |
apply (rule refl) |
|
42 |
apply (erule subst) |
|
43 |
apply (rule sym) |
|
44 |
apply fast |
|
45 |
done |
|
46 |
||
15639 | 47 |
lemma discr_chain_range0 [simp]: |
15555 | 48 |
"!!S::nat=>('a::type)discr. chain(S) ==> range(S) = {S 0}" |
15639 | 49 |
by (fast elim: discr_chain0) |
15555 | 50 |
|
51 |
lemma discr_cpo: |
|
52 |
"!!S. chain S ==> ? x::('a::type)discr. range(S) <<| x" |
|
15639 | 53 |
by (unfold is_lub_def is_ub_def) simp |
15555 | 54 |
|
15590
17f4f5afcd5f
added subsection headings, cleaned up some proofs
huffman
parents:
15578
diff
changeset
|
55 |
instance discr :: (type) cpo |
17f4f5afcd5f
added subsection headings, cleaned up some proofs
huffman
parents:
15578
diff
changeset
|
56 |
by intro_classes (rule discr_cpo) |
17f4f5afcd5f
added subsection headings, cleaned up some proofs
huffman
parents:
15578
diff
changeset
|
57 |
|
17f4f5afcd5f
added subsection headings, cleaned up some proofs
huffman
parents:
15578
diff
changeset
|
58 |
subsection {* @{term undiscr} *} |
2841
c2508f4ab739
Added "discrete" CPOs and modified IMP to use those rather than "lift"
nipkow
parents:
diff
changeset
|
59 |
|
c2508f4ab739
Added "discrete" CPOs and modified IMP to use those rather than "lift"
nipkow
parents:
diff
changeset
|
60 |
constdefs |
15555 | 61 |
undiscr :: "('a::type)discr => 'a" |
2841
c2508f4ab739
Added "discrete" CPOs and modified IMP to use those rather than "lift"
nipkow
parents:
diff
changeset
|
62 |
"undiscr x == (case x of Discr y => y)" |
c2508f4ab739
Added "discrete" CPOs and modified IMP to use those rather than "lift"
nipkow
parents:
diff
changeset
|
63 |
|
15555 | 64 |
lemma undiscr_Discr [simp]: "undiscr(Discr x) = x" |
15590
17f4f5afcd5f
added subsection headings, cleaned up some proofs
huffman
parents:
15578
diff
changeset
|
65 |
by (simp add: undiscr_def) |
15555 | 66 |
|
67 |
lemma discr_chain_f_range0: |
|
68 |
"!!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
|
69 |
by (fast dest: discr_chain0 elim: arg_cong) |
15555 | 70 |
|
71 |
lemma cont_discr [iff]: "cont(%x::('a::type)discr. f x)" |
|
72 |
apply (unfold cont is_lub_def is_ub_def) |
|
15590
17f4f5afcd5f
added subsection headings, cleaned up some proofs
huffman
parents:
15578
diff
changeset
|
73 |
apply (simp add: discr_chain_f_range0) |
15555 | 74 |
done |
75 |
||
2841
c2508f4ab739
Added "discrete" CPOs and modified IMP to use those rather than "lift"
nipkow
parents:
diff
changeset
|
76 |
end |