| author | wenzelm | 
| Tue, 24 Nov 2009 17:19:33 +0100 | |
| changeset 33889 | 4328de748fb2 | 
| parent 31084 | f4db921165ce | 
| child 35174 | e15040ae75d7 | 
| 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 | 
| 24107 | 9 | imports "../ex/Stream" Continuity | 
| 17293 | 10 | begin | 
| 11350 
4c55b020d6ee
added FOCUS including the One-Element Buffer by Manfred Broy
 oheimb parents: diff
changeset | 11 | |
| 19763 | 12 | definition | 
| 21404 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
19763diff
changeset | 13 |   stream_monoP  :: "(('a stream) set \<Rightarrow> ('a stream) set) \<Rightarrow> bool" where
 | 
| 19763 | 14 | "stream_monoP F = (\<exists>Q i. \<forall>P s. Fin i \<le> #s \<longrightarrow> | 
| 15 | (s \<in> F P) = (stream_take i\<cdot>s \<in> Q \<and> iterate i\<cdot>rt\<cdot>s \<in> P))" | |
| 17293 | 16 | |
| 21404 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
19763diff
changeset | 17 | definition | 
| 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
19763diff
changeset | 18 |   stream_antiP  :: "(('a stream) set \<Rightarrow> ('a stream) set) \<Rightarrow> bool" where
 | 
| 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 | |
| 21404 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
19763diff
changeset | 24 | definition | 
| 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
 wenzelm parents: 
19763diff
changeset | 25 | antitonP :: "'a set => bool" where | 
| 19763 | 26 | "antitonP P = (\<forall>x y. x \<sqsubseteq> y \<longrightarrow> y\<in>P \<longrightarrow> x\<in>P)" | 
| 17293 | 27 | |
| 28 | ||
| 19759 | 29 | (* ----------------------------------------------------------------------- *) | 
| 30 | ||
| 31 | section "admissibility" | |
| 32 | ||
| 33 | lemma flatstream_adm_lemma: | |
| 26451 
f8a615f3bb31
avoid amiguity of Continuity.chain vs. Porder.chain;
 wenzelm parents: 
26102diff
changeset | 34 | assumes 1: "Porder.chain Y" | 
| 19759 | 35 | assumes 2: "!i. P (Y i)" | 
| 26451 
f8a615f3bb31
avoid amiguity of Continuity.chain vs. Porder.chain;
 wenzelm parents: 
26102diff
changeset | 36 | assumes 3: "(!!Y. [| Porder.chain Y; !i. P (Y i); !k. ? j. Fin k < #((Y j)::'a::flat stream)|] | 
| 27413 | 37 | ==> P(LUB i. Y i))" | 
| 38 | shows "P(LUB i. Y i)" | |
| 26838 
7f7c6a9e083a
Instantiated rule increasing_chain_adm_lemma in proof of flatstream_adm_lemma
 berghofe parents: 
26451diff
changeset | 39 | apply (rule increasing_chain_adm_lemma [of _ P, OF 1 2]) | 
| 19759 | 40 | apply (erule 3, assumption) | 
| 41 | apply (erule thin_rl) | |
| 42 | apply (rule allI) | |
| 43 | apply (case_tac "!j. stream_finite (Y j)") | |
| 44 | apply ( rule chain_incr) | |
| 45 | apply ( rule allI) | |
| 46 | apply ( drule spec) | |
| 47 | apply ( safe) | |
| 48 | apply ( rule exI) | |
| 49 | apply ( rule slen_strict_mono) | |
| 50 | apply ( erule spec) | |
| 51 | apply ( assumption) | |
| 52 | apply ( assumption) | |
| 31084 | 53 | apply (metis inat_ord_code(4) slen_infinite) | 
| 19759 | 54 | done | 
| 55 | ||
| 56 | (* should be without reference to stream length? *) | |
| 26451 
f8a615f3bb31
avoid amiguity of Continuity.chain vs. Porder.chain;
 wenzelm parents: 
26102diff
changeset | 57 | lemma flatstream_admI: "[|(!!Y. [| Porder.chain Y; !i. P (Y i); | 
| 27413 | 58 | !k. ? j. Fin k < #((Y j)::'a::flat stream)|] ==> P(LUB i. Y i))|]==> adm P" | 
| 19759 | 59 | apply (unfold adm_def) | 
| 60 | apply (intro strip) | |
| 61 | apply (erule (1) flatstream_adm_lemma) | |
| 62 | apply (fast) | |
| 63 | done | |
| 64 | ||
| 65 | ||
| 66 | (* context (theory "Nat_InFinity");*) | |
| 67 | lemma ile_lemma: "Fin (i + j) <= x ==> Fin i <= x" | |
| 27101 
864d29f11c9d
slightly tuning of some proofs involving case distinction and induction on natural numbers and similar
 haftmann parents: 
26838diff
changeset | 68 | by (rule order_trans) auto | 
| 19759 | 69 | |
| 70 | lemma stream_monoP2I: | |
| 71 | "!!X. stream_monoP F ==> !i. ? l. !x y. | |
| 72 | Fin l <= #x --> (x::'a::flat stream) << y --> x:down_iterate F i --> y:down_iterate F i" | |
| 73 | apply (unfold stream_monoP_def) | |
| 74 | apply (safe) | |
| 75 | apply (rule_tac x="i*ia" in exI) | |
| 76 | apply (induct_tac "ia") | |
| 77 | apply ( simp) | |
| 78 | apply (simp) | |
| 79 | apply (intro strip) | |
| 80 | apply (erule allE, erule all_dupE, drule mp, erule ile_lemma) | |
| 81 | apply (drule_tac P="%x. x" in subst, assumption) | |
| 82 | apply (erule allE, drule mp, rule ile_lemma) back | |
| 27101 
864d29f11c9d
slightly tuning of some proofs involving case distinction and induction on natural numbers and similar
 haftmann parents: 
26838diff
changeset | 83 | apply ( erule order_trans) | 
| 19759 | 84 | apply ( erule slen_mono) | 
| 85 | apply (erule ssubst) | |
| 86 | apply (safe) | |
| 87 | apply ( erule (2) ile_lemma [THEN slen_take_lemma3, THEN subst]) | |
| 88 | apply (erule allE) | |
| 89 | apply (drule mp) | |
| 90 | apply ( erule slen_rt_mult) | |
| 91 | apply (erule allE) | |
| 92 | apply (drule mp) | |
| 93 | apply (erule monofun_rt_mult) | |
| 94 | apply (drule (1) mp) | |
| 95 | apply (assumption) | |
| 96 | done | |
| 97 | ||
| 98 | lemma stream_monoP2_gfp_admI: "[| !i. ? l. !x y. | |
| 99 | Fin l <= #x --> (x::'a::flat stream) << y --> x:down_iterate F i --> y:down_iterate F i; | |
| 100 | down_cont F |] ==> adm (%x. x:gfp F)" | |
| 101 | apply (erule INTER_down_iterate_is_gfp [THEN ssubst]) (* cont *) | |
| 102 | apply (simp (no_asm)) | |
| 103 | apply (rule adm_lemmas) | |
| 104 | apply (rule flatstream_admI) | |
| 105 | apply (erule allE) | |
| 106 | apply (erule exE) | |
| 107 | apply (erule allE, erule exE) | |
| 108 | apply (erule allE, erule allE, drule mp) (* stream_monoP *) | |
| 109 | apply ( drule ileI1) | |
| 27101 
864d29f11c9d
slightly tuning of some proofs involving case distinction and induction on natural numbers and similar
 haftmann parents: 
26838diff
changeset | 110 | apply ( drule order_trans) | 
| 19759 | 111 | apply ( rule ile_iSuc) | 
| 112 | apply ( drule iSuc_ile_mono [THEN iffD1]) | |
| 113 | apply ( assumption) | |
| 114 | apply (drule mp) | |
| 115 | apply ( erule is_ub_thelub) | |
| 116 | apply (fast) | |
| 117 | done | |
| 118 | ||
| 119 | lemmas fstream_gfp_admI = stream_monoP2I [THEN stream_monoP2_gfp_admI] | |
| 120 | ||
| 121 | lemma stream_antiP2I: | |
| 122 | "!!X. [|stream_antiP (F::(('a::flat stream)set => ('a stream set)))|]
 | |
| 123 | ==> !i x y. x << y --> y:down_iterate F i --> x:down_iterate F i" | |
| 124 | apply (unfold stream_antiP_def) | |
| 125 | apply (rule allI) | |
| 126 | apply (induct_tac "i") | |
| 127 | apply ( simp) | |
| 128 | apply (simp) | |
| 129 | apply (intro strip) | |
| 130 | apply (erule allE, erule all_dupE, erule exE, erule exE) | |
| 131 | apply (erule conjE) | |
| 132 | apply (case_tac "#x < Fin i") | |
| 133 | apply ( fast) | |
| 26102 | 134 | apply (unfold linorder_not_less) | 
| 19759 | 135 | apply (drule (1) mp) | 
| 136 | apply (erule all_dupE, drule mp, rule refl_less) | |
| 137 | apply (erule ssubst) | |
| 138 | apply (erule allE, drule (1) mp) | |
| 139 | apply (drule_tac P="%x. x" in subst, assumption) | |
| 140 | apply (erule conjE, rule conjI) | |
| 141 | apply ( erule slen_take_lemma3 [THEN ssubst], assumption) | |
| 142 | apply ( assumption) | |
| 143 | apply (erule allE, erule allE, drule mp, erule monofun_rt_mult) | |
| 144 | apply (drule (1) mp) | |
| 145 | apply (assumption) | |
| 146 | done | |
| 147 | ||
| 148 | lemma stream_antiP2_non_gfp_admI: | |
| 149 | "!!X. [|!i x y. x << y --> y:down_iterate F i --> x:down_iterate F i; down_cont F |] | |
| 150 | ==> adm (%u. ~ u:gfp F)" | |
| 151 | apply (unfold adm_def) | |
| 152 | apply (simp add: INTER_down_iterate_is_gfp) | |
| 153 | apply (fast dest!: is_ub_thelub) | |
| 154 | done | |
| 155 | ||
| 156 | lemmas fstream_non_gfp_admI = stream_antiP2I [THEN stream_antiP2_non_gfp_admI] | |
| 157 | ||
| 158 | ||
| 159 | ||
| 160 | (**new approach for adm********************************************************) | |
| 161 | ||
| 162 | section "antitonP" | |
| 163 | ||
| 164 | lemma antitonPD: "[| antitonP P; y:P; x<<y |] ==> x:P" | |
| 165 | apply (unfold antitonP_def) | |
| 166 | apply auto | |
| 167 | done | |
| 168 | ||
| 169 | lemma antitonPI: "!x y. y:P --> x<<y --> x:P ==> antitonP P" | |
| 170 | apply (unfold antitonP_def) | |
| 171 | apply (fast) | |
| 172 | done | |
| 173 | ||
| 174 | lemma antitonP_adm_non_P: "antitonP P ==> adm (%u. u~:P)" | |
| 175 | apply (unfold adm_def) | |
| 176 | apply (auto dest: antitonPD elim: is_ub_thelub) | |
| 177 | done | |
| 178 | ||
| 179 | 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> 
 | |
| 180 | adm (\<lambda>u. u\<notin>P)" | |
| 181 | apply (simp) | |
| 182 | apply (rule antitonP_adm_non_P) | |
| 183 | apply (rule antitonPI) | |
| 184 | apply (drule gfp_upperbound) | |
| 185 | apply (fast) | |
| 186 | done | |
| 187 | ||
| 188 | lemma adm_set: | |
| 27413 | 189 | "{\<Squnion>i. Y i |Y. Porder.chain Y & (\<forall>i. Y i \<in> P)} \<subseteq> P \<Longrightarrow> adm (\<lambda>x. x\<in>P)"
 | 
| 19759 | 190 | apply (unfold adm_def) | 
| 191 | apply (fast) | |
| 192 | done | |
| 193 | ||
| 27413 | 194 | lemma def_gfp_admI: "P \<equiv> gfp F \<Longrightarrow> {\<Squnion>i. Y i |Y. Porder.chain Y \<and> (\<forall>i. Y i \<in> P)} \<subseteq> 
 | 
| 195 |   F {\<Squnion>i. Y i |Y. Porder.chain Y \<and> (\<forall>i. Y i \<in> P)} \<Longrightarrow> adm (\<lambda>x. x\<in>P)"
 | |
| 19759 | 196 | apply (simp) | 
| 197 | apply (rule adm_set) | |
| 198 | apply (erule gfp_upperbound) | |
| 199 | done | |
| 200 | ||
| 11350 
4c55b020d6ee
added FOCUS including the One-Element Buffer by Manfred Broy
 oheimb parents: diff
changeset | 201 | end |