author | wenzelm |
Fri, 02 Jun 2006 19:41:37 +0200 | |
changeset 19763 | ec18656a2c10 |
parent 19759 | 2d0896653e7a |
child 21404 | eb85850d3eb7 |
permissions | -rw-r--r-- |
17293 | 1 |
(* Title: HOLCF/ex/Stream_adm.thy |
11355 | 2 |
ID: $Id$ |
17293 | 3 |
Author: David von Oheimb, TU Muenchen |
11350
4c55b020d6ee
added FOCUS including the One-Element Buffer by Manfred Broy
oheimb
parents:
diff
changeset
|
4 |
*) |
4c55b020d6ee
added FOCUS including the One-Element Buffer by Manfred Broy
oheimb
parents:
diff
changeset
|
5 |
|
17293 | 6 |
header {* Admissibility for streams *} |
11350
4c55b020d6ee
added FOCUS including the One-Element Buffer by Manfred Broy
oheimb
parents:
diff
changeset
|
7 |
|
17293 | 8 |
theory Stream_adm |
9 |
imports Stream Continuity |
|
10 |
begin |
|
11350
4c55b020d6ee
added FOCUS including the One-Element Buffer by Manfred Broy
oheimb
parents:
diff
changeset
|
11 |
|
19763 | 12 |
definition |
17293 | 13 |
|
14 |
stream_monoP :: "(('a stream) set \<Rightarrow> ('a stream) set) \<Rightarrow> bool" |
|
19763 | 15 |
"stream_monoP F = (\<exists>Q i. \<forall>P s. Fin i \<le> #s \<longrightarrow> |
16 |
(s \<in> F P) = (stream_take i\<cdot>s \<in> Q \<and> iterate i\<cdot>rt\<cdot>s \<in> P))" |
|
17293 | 17 |
|
18 |
stream_antiP :: "(('a stream) set \<Rightarrow> ('a stream) set) \<Rightarrow> bool" |
|
19763 | 19 |
"stream_antiP F = (\<forall>P x. \<exists>Q i. |
17293 | 20 |
(#x < Fin i \<longrightarrow> (\<forall>y. x \<sqsubseteq> y \<longrightarrow> y \<in> F P \<longrightarrow> x \<in> F P)) \<and> |
21 |
(Fin i <= #x \<longrightarrow> (\<forall>y. x \<sqsubseteq> y \<longrightarrow> |
|
19763 | 22 |
(y \<in> F P) = (stream_take i\<cdot>y \<in> Q \<and> iterate i\<cdot>rt\<cdot>y \<in> P))))" |
17293 | 23 |
|
11350
4c55b020d6ee
added FOCUS including the One-Element Buffer by Manfred Broy
oheimb
parents:
diff
changeset
|
24 |
antitonP :: "'a set => bool" |
19763 | 25 |
"antitonP P = (\<forall>x y. x \<sqsubseteq> y \<longrightarrow> y\<in>P \<longrightarrow> x\<in>P)" |
17293 | 26 |
|
27 |
||
19759 | 28 |
(* ----------------------------------------------------------------------- *) |
29 |
||
30 |
section "admissibility" |
|
31 |
||
32 |
lemma flatstream_adm_lemma: |
|
33 |
assumes 1: "chain Y" |
|
34 |
assumes 2: "!i. P (Y i)" |
|
35 |
assumes 3: "(!!Y. [| chain Y; !i. P (Y i); !k. ? j. Fin k < #((Y j)::'a::flat stream)|] |
|
36 |
==> P(lub (range Y)))" |
|
37 |
shows "P(lub (range Y))" |
|
38 |
apply (rule increasing_chain_adm_lemma [OF 1 2]) |
|
39 |
apply (erule 3, assumption) |
|
40 |
apply (erule thin_rl) |
|
41 |
apply (rule allI) |
|
42 |
apply (case_tac "!j. stream_finite (Y j)") |
|
43 |
apply ( rule chain_incr) |
|
44 |
apply ( rule allI) |
|
45 |
apply ( drule spec) |
|
46 |
apply ( safe) |
|
47 |
apply ( rule exI) |
|
48 |
apply ( rule slen_strict_mono) |
|
49 |
apply ( erule spec) |
|
50 |
apply ( assumption) |
|
51 |
apply ( assumption) |
|
52 |
apply (drule not_ex [THEN iffD1]) |
|
53 |
apply (subst slen_infinite) |
|
54 |
apply (erule thin_rl) |
|
55 |
apply (drule spec) |
|
56 |
apply (fold ile_def) |
|
57 |
apply (erule ile_iless_trans [THEN Infty_eq [THEN iffD1]]) |
|
58 |
apply (simp) |
|
59 |
done |
|
60 |
||
61 |
||
62 |
(* should be without reference to stream length? *) |
|
63 |
lemma flatstream_admI: "[|(!!Y. [| chain Y; !i. P (Y i); |
|
64 |
!k. ? j. Fin k < #((Y j)::'a::flat stream)|] ==> P(lub (range Y)))|]==> adm P" |
|
65 |
apply (unfold adm_def) |
|
66 |
apply (intro strip) |
|
67 |
apply (erule (1) flatstream_adm_lemma) |
|
68 |
apply (fast) |
|
69 |
done |
|
70 |
||
71 |
||
72 |
(* context (theory "Nat_InFinity");*) |
|
73 |
lemma ile_lemma: "Fin (i + j) <= x ==> Fin i <= x" |
|
74 |
apply (rule ile_trans) |
|
75 |
prefer 2 |
|
76 |
apply (assumption) |
|
77 |
apply (simp) |
|
78 |
done |
|
79 |
||
80 |
lemma stream_monoP2I: |
|
81 |
"!!X. stream_monoP F ==> !i. ? l. !x y. |
|
82 |
Fin l <= #x --> (x::'a::flat stream) << y --> x:down_iterate F i --> y:down_iterate F i" |
|
83 |
apply (unfold stream_monoP_def) |
|
84 |
apply (safe) |
|
85 |
apply (rule_tac x="i*ia" in exI) |
|
86 |
apply (induct_tac "ia") |
|
87 |
apply ( simp) |
|
88 |
apply (simp) |
|
89 |
apply (intro strip) |
|
90 |
apply (erule allE, erule all_dupE, drule mp, erule ile_lemma) |
|
91 |
apply (drule_tac P="%x. x" in subst, assumption) |
|
92 |
apply (erule allE, drule mp, rule ile_lemma) back |
|
93 |
apply ( erule ile_trans) |
|
94 |
apply ( erule slen_mono) |
|
95 |
apply (erule ssubst) |
|
96 |
apply (safe) |
|
97 |
apply ( erule (2) ile_lemma [THEN slen_take_lemma3, THEN subst]) |
|
98 |
apply (erule allE) |
|
99 |
apply (drule mp) |
|
100 |
apply ( erule slen_rt_mult) |
|
101 |
apply (erule allE) |
|
102 |
apply (drule mp) |
|
103 |
apply (erule monofun_rt_mult) |
|
104 |
apply (drule (1) mp) |
|
105 |
apply (assumption) |
|
106 |
done |
|
107 |
||
108 |
lemma stream_monoP2_gfp_admI: "[| !i. ? l. !x y. |
|
109 |
Fin l <= #x --> (x::'a::flat stream) << y --> x:down_iterate F i --> y:down_iterate F i; |
|
110 |
down_cont F |] ==> adm (%x. x:gfp F)" |
|
111 |
apply (erule INTER_down_iterate_is_gfp [THEN ssubst]) (* cont *) |
|
112 |
apply (simp (no_asm)) |
|
113 |
apply (rule adm_lemmas) |
|
114 |
apply (rule flatstream_admI) |
|
115 |
apply (erule allE) |
|
116 |
apply (erule exE) |
|
117 |
apply (erule allE, erule exE) |
|
118 |
apply (erule allE, erule allE, drule mp) (* stream_monoP *) |
|
119 |
apply ( drule ileI1) |
|
120 |
apply ( drule ile_trans) |
|
121 |
apply ( rule ile_iSuc) |
|
122 |
apply ( drule iSuc_ile_mono [THEN iffD1]) |
|
123 |
apply ( assumption) |
|
124 |
apply (drule mp) |
|
125 |
apply ( erule is_ub_thelub) |
|
126 |
apply (fast) |
|
127 |
done |
|
128 |
||
129 |
lemmas fstream_gfp_admI = stream_monoP2I [THEN stream_monoP2_gfp_admI] |
|
130 |
||
131 |
lemma stream_antiP2I: |
|
132 |
"!!X. [|stream_antiP (F::(('a::flat stream)set => ('a stream set)))|] |
|
133 |
==> !i x y. x << y --> y:down_iterate F i --> x:down_iterate F i" |
|
134 |
apply (unfold stream_antiP_def) |
|
135 |
apply (rule allI) |
|
136 |
apply (induct_tac "i") |
|
137 |
apply ( simp) |
|
138 |
apply (simp) |
|
139 |
apply (intro strip) |
|
140 |
apply (erule allE, erule all_dupE, erule exE, erule exE) |
|
141 |
apply (erule conjE) |
|
142 |
apply (case_tac "#x < Fin i") |
|
143 |
apply ( fast) |
|
144 |
apply (fold ile_def) |
|
145 |
apply (drule (1) mp) |
|
146 |
apply (erule all_dupE, drule mp, rule refl_less) |
|
147 |
apply (erule ssubst) |
|
148 |
apply (erule allE, drule (1) mp) |
|
149 |
apply (drule_tac P="%x. x" in subst, assumption) |
|
150 |
apply (erule conjE, rule conjI) |
|
151 |
apply ( erule slen_take_lemma3 [THEN ssubst], assumption) |
|
152 |
apply ( assumption) |
|
153 |
apply (erule allE, erule allE, drule mp, erule monofun_rt_mult) |
|
154 |
apply (drule (1) mp) |
|
155 |
apply (assumption) |
|
156 |
done |
|
157 |
||
158 |
lemma stream_antiP2_non_gfp_admI: |
|
159 |
"!!X. [|!i x y. x << y --> y:down_iterate F i --> x:down_iterate F i; down_cont F |] |
|
160 |
==> adm (%u. ~ u:gfp F)" |
|
161 |
apply (unfold adm_def) |
|
162 |
apply (simp add: INTER_down_iterate_is_gfp) |
|
163 |
apply (fast dest!: is_ub_thelub) |
|
164 |
done |
|
165 |
||
166 |
lemmas fstream_non_gfp_admI = stream_antiP2I [THEN stream_antiP2_non_gfp_admI] |
|
167 |
||
168 |
||
169 |
||
170 |
(**new approach for adm********************************************************) |
|
171 |
||
172 |
section "antitonP" |
|
173 |
||
174 |
lemma antitonPD: "[| antitonP P; y:P; x<<y |] ==> x:P" |
|
175 |
apply (unfold antitonP_def) |
|
176 |
apply auto |
|
177 |
done |
|
178 |
||
179 |
lemma antitonPI: "!x y. y:P --> x<<y --> x:P ==> antitonP P" |
|
180 |
apply (unfold antitonP_def) |
|
181 |
apply (fast) |
|
182 |
done |
|
183 |
||
184 |
lemma antitonP_adm_non_P: "antitonP P ==> adm (%u. u~:P)" |
|
185 |
apply (unfold adm_def) |
|
186 |
apply (auto dest: antitonPD elim: is_ub_thelub) |
|
187 |
done |
|
188 |
||
189 |
lemma def_gfp_adm_nonP: "P \<equiv> gfp F \<Longrightarrow> {y. \<exists>x::'a::pcpo. y \<sqsubseteq> x \<and> x \<in> P} \<subseteq> F {y. \<exists>x. y \<sqsubseteq> x \<and> x \<in> P} \<Longrightarrow> |
|
190 |
adm (\<lambda>u. u\<notin>P)" |
|
191 |
apply (simp) |
|
192 |
apply (rule antitonP_adm_non_P) |
|
193 |
apply (rule antitonPI) |
|
194 |
apply (drule gfp_upperbound) |
|
195 |
apply (fast) |
|
196 |
done |
|
197 |
||
198 |
lemma adm_set: |
|
199 |
"{lub (range Y) |Y. chain Y & (\<forall>i. Y i \<in> P)} \<subseteq> P \<Longrightarrow> adm (\<lambda>x. x\<in>P)" |
|
200 |
apply (unfold adm_def) |
|
201 |
apply (fast) |
|
202 |
done |
|
203 |
||
204 |
lemma def_gfp_admI: "P \<equiv> gfp F \<Longrightarrow> {lub (range Y) |Y. chain Y \<and> (\<forall>i. Y i \<in> P)} \<subseteq> |
|
205 |
F {lub (range Y) |Y. chain Y \<and> (\<forall>i. Y i \<in> P)} \<Longrightarrow> adm (\<lambda>x. x\<in>P)" |
|
206 |
apply (simp) |
|
207 |
apply (rule adm_set) |
|
208 |
apply (erule gfp_upperbound) |
|
209 |
done |
|
210 |
||
11350
4c55b020d6ee
added FOCUS including the One-Element Buffer by Manfred Broy
oheimb
parents:
diff
changeset
|
211 |
end |