| author | huffman | 
| Fri, 20 Jun 2008 22:28:10 +0200 | |
| changeset 27307 | 70c98cd37161 | 
| parent 27101 | 864d29f11c9d | 
| child 27413 | 3154f3765cc7 | 
| 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)|] | 
| 19759 | 37 | ==> P(lub (range Y)))" | 
| 38 | shows "P(lub (range Y))" | |
| 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) | |
| 53 | apply (drule not_ex [THEN iffD1]) | |
| 54 | apply (subst slen_infinite) | |
| 55 | apply (erule thin_rl) | |
| 27101 
864d29f11c9d
slightly tuning of some proofs involving case distinction and induction on natural numbers and similar
 haftmann parents: 
26838diff
changeset | 56 | apply (erule_tac x = j in allE) | 
| 
864d29f11c9d
slightly tuning of some proofs involving case distinction and induction on natural numbers and similar
 haftmann parents: 
26838diff
changeset | 57 | apply auto | 
| 19759 | 58 | done | 
| 59 | ||
| 60 | (* should be without reference to stream length? *) | |
| 26451 
f8a615f3bb31
avoid amiguity of Continuity.chain vs. Porder.chain;
 wenzelm parents: 
26102diff
changeset | 61 | lemma flatstream_admI: "[|(!!Y. [| Porder.chain Y; !i. P (Y i); | 
| 19759 | 62 | !k. ? j. Fin k < #((Y j)::'a::flat stream)|] ==> P(lub (range Y)))|]==> adm P" | 
| 63 | apply (unfold adm_def) | |
| 64 | apply (intro strip) | |
| 65 | apply (erule (1) flatstream_adm_lemma) | |
| 66 | apply (fast) | |
| 67 | done | |
| 68 | ||
| 69 | ||
| 70 | (* context (theory "Nat_InFinity");*) | |
| 71 | 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 | 72 | by (rule order_trans) auto | 
| 19759 | 73 | |
| 74 | lemma stream_monoP2I: | |
| 75 | "!!X. stream_monoP F ==> !i. ? l. !x y. | |
| 76 | Fin l <= #x --> (x::'a::flat stream) << y --> x:down_iterate F i --> y:down_iterate F i" | |
| 77 | apply (unfold stream_monoP_def) | |
| 78 | apply (safe) | |
| 79 | apply (rule_tac x="i*ia" in exI) | |
| 80 | apply (induct_tac "ia") | |
| 81 | apply ( simp) | |
| 82 | apply (simp) | |
| 83 | apply (intro strip) | |
| 84 | apply (erule allE, erule all_dupE, drule mp, erule ile_lemma) | |
| 85 | apply (drule_tac P="%x. x" in subst, assumption) | |
| 86 | 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 | 87 | apply ( erule order_trans) | 
| 19759 | 88 | apply ( erule slen_mono) | 
| 89 | apply (erule ssubst) | |
| 90 | apply (safe) | |
| 91 | apply ( erule (2) ile_lemma [THEN slen_take_lemma3, THEN subst]) | |
| 92 | apply (erule allE) | |
| 93 | apply (drule mp) | |
| 94 | apply ( erule slen_rt_mult) | |
| 95 | apply (erule allE) | |
| 96 | apply (drule mp) | |
| 97 | apply (erule monofun_rt_mult) | |
| 98 | apply (drule (1) mp) | |
| 99 | apply (assumption) | |
| 100 | done | |
| 101 | ||
| 102 | lemma stream_monoP2_gfp_admI: "[| !i. ? l. !x y. | |
| 103 | Fin l <= #x --> (x::'a::flat stream) << y --> x:down_iterate F i --> y:down_iterate F i; | |
| 104 | down_cont F |] ==> adm (%x. x:gfp F)" | |
| 105 | apply (erule INTER_down_iterate_is_gfp [THEN ssubst]) (* cont *) | |
| 106 | apply (simp (no_asm)) | |
| 107 | apply (rule adm_lemmas) | |
| 108 | apply (rule flatstream_admI) | |
| 109 | apply (erule allE) | |
| 110 | apply (erule exE) | |
| 111 | apply (erule allE, erule exE) | |
| 112 | apply (erule allE, erule allE, drule mp) (* stream_monoP *) | |
| 113 | apply ( drule ileI1) | |
| 27101 
864d29f11c9d
slightly tuning of some proofs involving case distinction and induction on natural numbers and similar
 haftmann parents: 
26838diff
changeset | 114 | apply ( drule order_trans) | 
| 19759 | 115 | apply ( rule ile_iSuc) | 
| 116 | apply ( drule iSuc_ile_mono [THEN iffD1]) | |
| 117 | apply ( assumption) | |
| 118 | apply (drule mp) | |
| 119 | apply ( erule is_ub_thelub) | |
| 120 | apply (fast) | |
| 121 | done | |
| 122 | ||
| 123 | lemmas fstream_gfp_admI = stream_monoP2I [THEN stream_monoP2_gfp_admI] | |
| 124 | ||
| 125 | lemma stream_antiP2I: | |
| 126 | "!!X. [|stream_antiP (F::(('a::flat stream)set => ('a stream set)))|]
 | |
| 127 | ==> !i x y. x << y --> y:down_iterate F i --> x:down_iterate F i" | |
| 128 | apply (unfold stream_antiP_def) | |
| 129 | apply (rule allI) | |
| 130 | apply (induct_tac "i") | |
| 131 | apply ( simp) | |
| 132 | apply (simp) | |
| 133 | apply (intro strip) | |
| 134 | apply (erule allE, erule all_dupE, erule exE, erule exE) | |
| 135 | apply (erule conjE) | |
| 136 | apply (case_tac "#x < Fin i") | |
| 137 | apply ( fast) | |
| 26102 | 138 | apply (unfold linorder_not_less) | 
| 19759 | 139 | apply (drule (1) mp) | 
| 140 | apply (erule all_dupE, drule mp, rule refl_less) | |
| 141 | apply (erule ssubst) | |
| 142 | apply (erule allE, drule (1) mp) | |
| 143 | apply (drule_tac P="%x. x" in subst, assumption) | |
| 144 | apply (erule conjE, rule conjI) | |
| 145 | apply ( erule slen_take_lemma3 [THEN ssubst], assumption) | |
| 146 | apply ( assumption) | |
| 147 | apply (erule allE, erule allE, drule mp, erule monofun_rt_mult) | |
| 148 | apply (drule (1) mp) | |
| 149 | apply (assumption) | |
| 150 | done | |
| 151 | ||
| 152 | lemma stream_antiP2_non_gfp_admI: | |
| 153 | "!!X. [|!i x y. x << y --> y:down_iterate F i --> x:down_iterate F i; down_cont F |] | |
| 154 | ==> adm (%u. ~ u:gfp F)" | |
| 155 | apply (unfold adm_def) | |
| 156 | apply (simp add: INTER_down_iterate_is_gfp) | |
| 157 | apply (fast dest!: is_ub_thelub) | |
| 158 | done | |
| 159 | ||
| 160 | lemmas fstream_non_gfp_admI = stream_antiP2I [THEN stream_antiP2_non_gfp_admI] | |
| 161 | ||
| 162 | ||
| 163 | ||
| 164 | (**new approach for adm********************************************************) | |
| 165 | ||
| 166 | section "antitonP" | |
| 167 | ||
| 168 | lemma antitonPD: "[| antitonP P; y:P; x<<y |] ==> x:P" | |
| 169 | apply (unfold antitonP_def) | |
| 170 | apply auto | |
| 171 | done | |
| 172 | ||
| 173 | lemma antitonPI: "!x y. y:P --> x<<y --> x:P ==> antitonP P" | |
| 174 | apply (unfold antitonP_def) | |
| 175 | apply (fast) | |
| 176 | done | |
| 177 | ||
| 178 | lemma antitonP_adm_non_P: "antitonP P ==> adm (%u. u~:P)" | |
| 179 | apply (unfold adm_def) | |
| 180 | apply (auto dest: antitonPD elim: is_ub_thelub) | |
| 181 | done | |
| 182 | ||
| 183 | 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> 
 | |
| 184 | adm (\<lambda>u. u\<notin>P)" | |
| 185 | apply (simp) | |
| 186 | apply (rule antitonP_adm_non_P) | |
| 187 | apply (rule antitonPI) | |
| 188 | apply (drule gfp_upperbound) | |
| 189 | apply (fast) | |
| 190 | done | |
| 191 | ||
| 192 | lemma adm_set: | |
| 26451 
f8a615f3bb31
avoid amiguity of Continuity.chain vs. Porder.chain;
 wenzelm parents: 
26102diff
changeset | 193 | "{lub (range Y) |Y. Porder.chain Y & (\<forall>i. Y i \<in> P)} \<subseteq> P \<Longrightarrow> adm (\<lambda>x. x\<in>P)"
 | 
| 19759 | 194 | apply (unfold adm_def) | 
| 195 | apply (fast) | |
| 196 | done | |
| 197 | ||
| 26451 
f8a615f3bb31
avoid amiguity of Continuity.chain vs. Porder.chain;
 wenzelm parents: 
26102diff
changeset | 198 | lemma def_gfp_admI: "P \<equiv> gfp F \<Longrightarrow> {lub (range Y) |Y. Porder.chain Y \<and> (\<forall>i. Y i \<in> P)} \<subseteq> 
 | 
| 
f8a615f3bb31
avoid amiguity of Continuity.chain vs. Porder.chain;
 wenzelm parents: 
26102diff
changeset | 199 |   F {lub (range Y) |Y. Porder.chain Y \<and> (\<forall>i. Y i \<in> P)} \<Longrightarrow> adm (\<lambda>x. x\<in>P)"
 | 
| 19759 | 200 | apply (simp) | 
| 201 | apply (rule adm_set) | |
| 202 | apply (erule gfp_upperbound) | |
| 203 | done | |
| 204 | ||
| 11350 
4c55b020d6ee
added FOCUS including the One-Element Buffer by Manfred Broy
 oheimb parents: diff
changeset | 205 | end |