| author | wenzelm | 
| Sun, 22 Aug 2021 17:52:27 +0200 | |
| changeset 74165 | 86163ea20e77 | 
| parent 71989 | bad75618fb82 | 
| permissions | -rw-r--r-- | 
| 62008 | 1 | (* Title: HOL/HOLCF/IOA/Abstraction.thy | 
| 40945 | 2 | Author: Olaf Müller | 
| 17233 | 3 | *) | 
| 4559 | 4 | |
| 62002 | 5 | section \<open>Abstraction Theory -- tailored for I/O automata\<close> | 
| 4559 | 6 | |
| 17233 | 7 | theory Abstraction | 
| 8 | imports LiveIOA | |
| 9 | begin | |
| 4559 | 10 | |
| 36452 | 11 | default_sort type | 
| 4559 | 12 | |
| 62192 | 13 | definition cex_abs :: "('s1 \<Rightarrow> 's2) \<Rightarrow> ('a, 's1) execution \<Rightarrow> ('a, 's2) execution"
 | 
| 63549 | 14 | where "cex_abs f ex = (f (fst ex), Map (\<lambda>(a, t). (a, f t)) \<cdot> (snd ex))" | 
| 62192 | 15 | |
| 16 | text \<open>equals cex_abs on Sequences -- after ex2seq application\<close> | |
| 17 | definition cex_absSeq :: | |
| 18 |     "('s1 \<Rightarrow> 's2) \<Rightarrow> ('a option, 's1) transition Seq \<Rightarrow> ('a option, 's2)transition Seq"
 | |
| 63549 | 19 | where "cex_absSeq f = (\<lambda>s. Map (\<lambda>(s, a, t). (f s, a, f t)) \<cdot> s)" | 
| 4559 | 20 | |
| 62192 | 21 | definition is_abstraction :: "('s1 \<Rightarrow> 's2) \<Rightarrow> ('a, 's1) ioa \<Rightarrow> ('a, 's2) ioa \<Rightarrow> bool"
 | 
| 22 | where "is_abstraction f C A \<longleftrightarrow> | |
| 23 | ((\<forall>s \<in> starts_of C. f s \<in> starts_of A) \<and> | |
| 24 | (\<forall>s t a. reachable C s \<and> s \<midarrow>a\<midarrow>C\<rightarrow> t \<longrightarrow> f s \<midarrow>a\<midarrow>A\<rightarrow> f t))" | |
| 25 | ||
| 26 | definition weakeningIOA :: "('a, 's2) ioa \<Rightarrow> ('a, 's1) ioa \<Rightarrow> ('s1 \<Rightarrow> 's2) \<Rightarrow> bool"
 | |
| 27 | where "weakeningIOA A C h \<longleftrightarrow> (\<forall>ex. ex \<in> executions C \<longrightarrow> cex_abs h ex \<in> executions A)" | |
| 4559 | 28 | |
| 62192 | 29 | definition temp_strengthening :: "('a, 's2) ioa_temp \<Rightarrow> ('a, 's1) ioa_temp \<Rightarrow> ('s1 \<Rightarrow> 's2) \<Rightarrow> bool"
 | 
| 30 | where "temp_strengthening Q P h \<longleftrightarrow> (\<forall>ex. (cex_abs h ex \<TTurnstile> Q) \<longrightarrow> (ex \<TTurnstile> P))" | |
| 31 | ||
| 32 | definition temp_weakening :: "('a, 's2) ioa_temp \<Rightarrow> ('a, 's1) ioa_temp \<Rightarrow> ('s1 \<Rightarrow> 's2) \<Rightarrow> bool"
 | |
| 33 | where "temp_weakening Q P h \<longleftrightarrow> temp_strengthening (\<^bold>\<not> Q) (\<^bold>\<not> P) h" | |
| 4559 | 34 | |
| 62192 | 35 | definition state_strengthening :: "('a, 's2) step_pred \<Rightarrow> ('a, 's1) step_pred \<Rightarrow> ('s1 \<Rightarrow> 's2) \<Rightarrow> bool"
 | 
| 36 | where "state_strengthening Q P h \<longleftrightarrow> (\<forall>s t a. Q (h s, a, h t) \<longrightarrow> P (s, a, t))" | |
| 4559 | 37 | |
| 62192 | 38 | definition state_weakening :: "('a, 's2) step_pred \<Rightarrow> ('a, 's1) step_pred \<Rightarrow> ('s1 \<Rightarrow> 's2) \<Rightarrow> bool"
 | 
| 39 | where "state_weakening Q P h \<longleftrightarrow> state_strengthening (\<^bold>\<not> Q) (\<^bold>\<not> P) h" | |
| 40 | ||
| 41 | definition is_live_abstraction :: "('s1 \<Rightarrow> 's2) \<Rightarrow> ('a, 's1) live_ioa \<Rightarrow> ('a, 's2) live_ioa \<Rightarrow> bool"
 | |
| 42 | where "is_live_abstraction h CL AM \<longleftrightarrow> | |
| 43 | is_abstraction h (fst CL) (fst AM) \<and> temp_weakening (snd AM) (snd CL) h" | |
| 4559 | 44 | |
| 45 | ||
| 70381 
b151d1f00204
More results about measure and integration theory
 paulson <lp15@cam.ac.uk> parents: 
63549diff
changeset | 46 | (* thm about ex2seq which is not provable by induction as ex2seq is not continuous *) | 
| 25135 
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
 wenzelm parents: 
23560diff
changeset | 47 | axiomatization where | 
| 62192 | 48 | ex2seq_abs_cex: "ex2seq (cex_abs h ex) = cex_absSeq h (ex2seq ex)" | 
| 4559 | 49 | |
| 5976 | 50 | (* analog to the proved thm strength_Box - proof skipped as trivial *) | 
| 25135 
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
 wenzelm parents: 
23560diff
changeset | 51 | axiomatization where | 
| 62192 | 52 | weak_Box: "temp_weakening P Q h \<Longrightarrow> temp_weakening (\<box>P) (\<box>Q) h" | 
| 53 | ||
| 5976 | 54 | (* analog to the proved thm strength_Next - proof skipped as trivial *) | 
| 62192 | 55 | axiomatization where | 
| 62441 | 56 | weak_Next: "temp_weakening P Q h \<Longrightarrow> temp_weakening (\<circle>P) (\<circle>Q) h" | 
| 4559 | 57 | |
| 19741 | 58 | |
| 62192 | 59 | subsection \<open>\<open>cex_abs\<close>\<close> | 
| 25135 
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
 wenzelm parents: 
23560diff
changeset | 60 | |
| 62192 | 61 | lemma cex_abs_UU [simp]: "cex_abs f (s, UU) = (f s, UU)" | 
| 19741 | 62 | by (simp add: cex_abs_def) | 
| 63 | ||
| 62192 | 64 | lemma cex_abs_nil [simp]: "cex_abs f (s,nil) = (f s, nil)" | 
| 19741 | 65 | by (simp add: cex_abs_def) | 
| 66 | ||
| 62192 | 67 | lemma cex_abs_cons [simp]: | 
| 68 | "cex_abs f (s, (a, t) \<leadsto> ex) = (f s, (a, f t) \<leadsto> (snd (cex_abs f (t, ex))))" | |
| 19741 | 69 | by (simp add: cex_abs_def) | 
| 70 | ||
| 25135 
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
 wenzelm parents: 
23560diff
changeset | 71 | |
| 62192 | 72 | subsection \<open>Lemmas\<close> | 
| 19741 | 73 | |
| 62192 | 74 | lemma temp_weakening_def2: "temp_weakening Q P h \<longleftrightarrow> (\<forall>ex. (ex \<TTurnstile> P) \<longrightarrow> (cex_abs h ex \<TTurnstile> Q))" | 
| 19741 | 75 | apply (simp add: temp_weakening_def temp_strengthening_def NOT_def temp_sat_def satisfies_def) | 
| 76 | apply auto | |
| 77 | done | |
| 78 | ||
| 62192 | 79 | lemma state_weakening_def2: "state_weakening Q P h \<longleftrightarrow> (\<forall>s t a. P (s, a, t) \<longrightarrow> Q (h s, a, h t))" | 
| 19741 | 80 | apply (simp add: state_weakening_def state_strengthening_def NOT_def) | 
| 81 | apply auto | |
| 82 | done | |
| 83 | ||
| 84 | ||
| 62192 | 85 | subsection \<open>Abstraction Rules for Properties\<close> | 
| 19741 | 86 | |
| 25135 
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
 wenzelm parents: 
23560diff
changeset | 87 | lemma exec_frag_abstraction [rule_format]: | 
| 62192 | 88 | "is_abstraction h C A \<Longrightarrow> | 
| 89 | \<forall>s. reachable C s \<and> is_exec_frag C (s, xs) \<longrightarrow> is_exec_frag A (cex_abs h (s, xs))" | |
| 90 | apply (simp add: cex_abs_def) | |
| 62195 | 91 | apply (pair_induct xs simp: is_exec_frag_def) | 
| 62192 | 92 | txt \<open>main case\<close> | 
| 93 | apply (auto dest: reachable.reachable_n simp add: is_abstraction_def) | |
| 94 | done | |
| 95 | ||
| 96 | lemma abs_is_weakening: "is_abstraction h C A \<Longrightarrow> weakeningIOA A C h" | |
| 97 | apply (simp add: weakeningIOA_def) | |
| 98 | apply auto | |
| 99 | apply (simp add: executions_def) | |
| 100 | txt \<open>start state\<close> | |
| 101 | apply (rule conjI) | |
| 102 | apply (simp add: is_abstraction_def cex_abs_def) | |
| 103 | txt \<open>is-execution-fragment\<close> | |
| 104 | apply (erule exec_frag_abstraction) | |
| 105 | apply (simp add: reachable.reachable_0) | |
| 106 | done | |
| 19741 | 107 | |
| 108 | ||
| 62192 | 109 | lemma AbsRuleT1: | 
| 110 | "is_abstraction h C A \<Longrightarrow> validIOA A Q \<Longrightarrow> temp_strengthening Q P h \<Longrightarrow> validIOA C P" | |
| 111 | apply (drule abs_is_weakening) | |
| 112 | apply (simp add: weakeningIOA_def validIOA_def temp_strengthening_def) | |
| 113 | apply (auto simp add: split_paired_all) | |
| 114 | done | |
| 19741 | 115 | |
| 116 | ||
| 25135 
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
 wenzelm parents: 
23560diff
changeset | 117 | lemma AbsRuleT2: | 
| 62192 | 118 | "is_live_abstraction h (C, L) (A, M) \<Longrightarrow> validLIOA (A, M) Q \<Longrightarrow> temp_strengthening Q P h | 
| 119 | \<Longrightarrow> validLIOA (C, L) P" | |
| 120 | apply (unfold is_live_abstraction_def) | |
| 121 | apply auto | |
| 122 | apply (drule abs_is_weakening) | |
| 123 | apply (simp add: weakeningIOA_def temp_weakening_def2 validLIOA_def validIOA_def temp_strengthening_def) | |
| 124 | apply (auto simp add: split_paired_all) | |
| 125 | done | |
| 19741 | 126 | |
| 127 | ||
| 25135 
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
 wenzelm parents: 
23560diff
changeset | 128 | lemma AbsRuleTImprove: | 
| 62192 | 129 | "is_live_abstraction h (C, L) (A, M) \<Longrightarrow> validLIOA (A,M) (H1 \<^bold>\<longrightarrow> Q) \<Longrightarrow> | 
| 130 | temp_strengthening Q P h \<Longrightarrow> temp_weakening H1 H2 h \<Longrightarrow> validLIOA (C, L) H2 \<Longrightarrow> | |
| 131 | validLIOA (C, L) P" | |
| 132 | apply (unfold is_live_abstraction_def) | |
| 133 | apply auto | |
| 134 | apply (drule abs_is_weakening) | |
| 135 | apply (simp add: weakeningIOA_def temp_weakening_def2 validLIOA_def validIOA_def temp_strengthening_def) | |
| 136 | apply (auto simp add: split_paired_all) | |
| 137 | done | |
| 19741 | 138 | |
| 139 | ||
| 62192 | 140 | subsection \<open>Correctness of safe abstraction\<close> | 
| 141 | ||
| 142 | lemma abstraction_is_ref_map: "is_abstraction h C A \<Longrightarrow> is_ref_map h C A" | |
| 143 | apply (auto simp: is_abstraction_def is_ref_map_def) | |
| 144 | apply (rule_tac x = "(a,h t) \<leadsto>nil" in exI) | |
| 145 | apply (simp add: move_def) | |
| 146 | done | |
| 19741 | 147 | |
| 62192 | 148 | lemma abs_safety: "inp C = inp A \<Longrightarrow> out C = out A \<Longrightarrow> is_abstraction h C A \<Longrightarrow> C =<| A" | 
| 149 | apply (simp add: ioa_implements_def) | |
| 150 | apply (rule trace_inclusion) | |
| 151 | apply (simp (no_asm) add: externals_def) | |
| 152 | apply (auto)[1] | |
| 153 | apply (erule abstraction_is_ref_map) | |
| 154 | done | |
| 19741 | 155 | |
| 156 | ||
| 62192 | 157 | subsection \<open>Correctness of life abstraction\<close> | 
| 158 | ||
| 159 | text \<open> | |
| 160 | Reduces to \<open>Filter (Map fst x) = Filter (Map fst (Map (\<lambda>(a, t). (a, x)) x)\<close>, | |
| 161 | that is to special Map Lemma. | |
| 162 | \<close> | |
| 163 | lemma traces_coincide_abs: | |
| 63549 | 164 | "ext C = ext A \<Longrightarrow> mk_trace C \<cdot> xs = mk_trace A \<cdot> (snd (cex_abs f (s, xs)))" | 
| 62192 | 165 | apply (unfold cex_abs_def mk_trace_def filter_act_def) | 
| 166 | apply simp | |
| 62195 | 167 | apply (pair_induct xs) | 
| 62192 | 168 | done | 
| 19741 | 169 | |
| 170 | ||
| 62192 | 171 | text \<open> | 
| 172 | Does not work with \<open>abstraction_is_ref_map\<close> as proof of \<open>abs_safety\<close>, because | |
| 173 | \<open>is_live_abstraction\<close> includes \<open>temp_strengthening\<close> which is necessarily based | |
| 174 | on \<open>cex_abs\<close> and not on \<open>corresp_ex\<close>. Thus, the proof is redone in a more specific | |
| 175 | way for \<open>cex_abs\<close>. | |
| 176 | \<close> | |
| 177 | lemma abs_liveness: | |
| 178 | "inp C = inp A \<Longrightarrow> out C = out A \<Longrightarrow> is_live_abstraction h (C, M) (A, L) \<Longrightarrow> | |
| 179 | live_implements (C, M) (A, L)" | |
| 180 | apply (simp add: is_live_abstraction_def live_implements_def livetraces_def liveexecutions_def) | |
| 181 | apply auto | |
| 182 | apply (rule_tac x = "cex_abs h ex" in exI) | |
| 183 | apply auto | |
| 184 | text \<open>Traces coincide\<close> | |
| 62195 | 185 | apply (pair ex) | 
| 19741 | 186 | apply (rule traces_coincide_abs) | 
| 187 | apply (simp (no_asm) add: externals_def) | |
| 188 | apply (auto)[1] | |
| 25135 
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
 wenzelm parents: 
23560diff
changeset | 189 | |
| 62192 | 190 | text \<open>\<open>cex_abs\<close> is execution\<close> | 
| 62195 | 191 | apply (pair ex) | 
| 19741 | 192 | apply (simp add: executions_def) | 
| 62192 | 193 | text \<open>start state\<close> | 
| 19741 | 194 | apply (rule conjI) | 
| 195 | apply (simp add: is_abstraction_def cex_abs_def) | |
| 62192 | 196 | text \<open>\<open>is_execution_fragment\<close>\<close> | 
| 19741 | 197 | apply (erule exec_frag_abstraction) | 
| 198 | apply (simp add: reachable.reachable_0) | |
| 199 | ||
| 62192 | 200 | text \<open>Liveness\<close> | 
| 201 | apply (simp add: temp_weakening_def2) | |
| 62195 | 202 | apply (pair ex) | 
| 62192 | 203 | done | 
| 19741 | 204 | |
| 205 | ||
| 62192 | 206 | subsection \<open>Abstraction Rules for Automata\<close> | 
| 19741 | 207 | |
| 62192 | 208 | lemma AbsRuleA1: | 
| 209 | "inp C = inp A \<Longrightarrow> out C = out A \<Longrightarrow> inp Q = inp P \<Longrightarrow> out Q = out P \<Longrightarrow> | |
| 210 | is_abstraction h1 C A \<Longrightarrow> A =<| Q \<Longrightarrow> is_abstraction h2 Q P \<Longrightarrow> C =<| P" | |
| 211 | apply (drule abs_safety) | |
| 212 | apply assumption+ | |
| 213 | apply (drule abs_safety) | |
| 214 | apply assumption+ | |
| 215 | apply (erule implements_trans) | |
| 216 | apply (erule implements_trans) | |
| 217 | apply assumption | |
| 218 | done | |
| 19741 | 219 | |
| 62192 | 220 | lemma AbsRuleA2: | 
| 221 | "inp C = inp A \<Longrightarrow> out C = out A \<Longrightarrow> inp Q = inp P \<Longrightarrow> out Q = out P \<Longrightarrow> | |
| 222 | is_live_abstraction h1 (C, LC) (A, LA) \<Longrightarrow> live_implements (A, LA) (Q, LQ) \<Longrightarrow> | |
| 223 | is_live_abstraction h2 (Q, LQ) (P, LP) \<Longrightarrow> live_implements (C, LC) (P, LP)" | |
| 224 | apply (drule abs_liveness) | |
| 225 | apply assumption+ | |
| 226 | apply (drule abs_liveness) | |
| 227 | apply assumption+ | |
| 228 | apply (erule live_implements_trans) | |
| 229 | apply (erule live_implements_trans) | |
| 230 | apply assumption | |
| 231 | done | |
| 19741 | 232 | |
| 233 | ||
| 234 | declare split_paired_All [simp del] | |
| 235 | ||
| 236 | ||
| 62192 | 237 | subsection \<open>Localizing Temporal Strengthenings and Weakenings\<close> | 
| 19741 | 238 | |
| 25135 
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
 wenzelm parents: 
23560diff
changeset | 239 | lemma strength_AND: | 
| 62192 | 240 | "temp_strengthening P1 Q1 h \<Longrightarrow> temp_strengthening P2 Q2 h \<Longrightarrow> | 
| 241 | temp_strengthening (P1 \<^bold>\<and> P2) (Q1 \<^bold>\<and> Q2) h" | |
| 242 | by (auto simp: temp_strengthening_def) | |
| 19741 | 243 | |
| 25135 
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
 wenzelm parents: 
23560diff
changeset | 244 | lemma strength_OR: | 
| 62192 | 245 | "temp_strengthening P1 Q1 h \<Longrightarrow> temp_strengthening P2 Q2 h \<Longrightarrow> | 
| 246 | temp_strengthening (P1 \<^bold>\<or> P2) (Q1 \<^bold>\<or> Q2) h" | |
| 247 | by (auto simp: temp_strengthening_def) | |
| 19741 | 248 | |
| 62192 | 249 | lemma strength_NOT: "temp_weakening P Q h \<Longrightarrow> temp_strengthening (\<^bold>\<not> P) (\<^bold>\<not> Q) h" | 
| 250 | by (auto simp: temp_weakening_def2 temp_strengthening_def) | |
| 19741 | 251 | |
| 25135 
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
 wenzelm parents: 
23560diff
changeset | 252 | lemma strength_IMPLIES: | 
| 62192 | 253 | "temp_weakening P1 Q1 h \<Longrightarrow> temp_strengthening P2 Q2 h \<Longrightarrow> | 
| 254 | temp_strengthening (P1 \<^bold>\<longrightarrow> P2) (Q1 \<^bold>\<longrightarrow> Q2) h" | |
| 255 | by (simp add: temp_weakening_def2 temp_strengthening_def) | |
| 19741 | 256 | |
| 257 | ||
| 25135 
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
 wenzelm parents: 
23560diff
changeset | 258 | lemma weak_AND: | 
| 62192 | 259 | "temp_weakening P1 Q1 h \<Longrightarrow> temp_weakening P2 Q2 h \<Longrightarrow> | 
| 260 | temp_weakening (P1 \<^bold>\<and> P2) (Q1 \<^bold>\<and> Q2) h" | |
| 261 | by (simp add: temp_weakening_def2) | |
| 19741 | 262 | |
| 25135 
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
 wenzelm parents: 
23560diff
changeset | 263 | lemma weak_OR: | 
| 62192 | 264 | "temp_weakening P1 Q1 h \<Longrightarrow> temp_weakening P2 Q2 h \<Longrightarrow> | 
| 265 | temp_weakening (P1 \<^bold>\<or> P2) (Q1 \<^bold>\<or> Q2) h" | |
| 266 | by (simp add: temp_weakening_def2) | |
| 19741 | 267 | |
| 25135 
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
 wenzelm parents: 
23560diff
changeset | 268 | lemma weak_NOT: | 
| 62192 | 269 | "temp_strengthening P Q h \<Longrightarrow> temp_weakening (\<^bold>\<not> P) (\<^bold>\<not> Q) h" | 
| 270 | by (auto simp add: temp_weakening_def2 temp_strengthening_def) | |
| 19741 | 271 | |
| 25135 
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
 wenzelm parents: 
23560diff
changeset | 272 | lemma weak_IMPLIES: | 
| 62192 | 273 | "temp_strengthening P1 Q1 h \<Longrightarrow> temp_weakening P2 Q2 h \<Longrightarrow> | 
| 274 | temp_weakening (P1 \<^bold>\<longrightarrow> P2) (Q1 \<^bold>\<longrightarrow> Q2) h" | |
| 275 | by (simp add: temp_weakening_def2 temp_strengthening_def) | |
| 19741 | 276 | |
| 277 | ||
| 62002 | 278 | subsubsection \<open>Box\<close> | 
| 19741 | 279 | |
| 62192 | 280 | (* FIXME: should be same as nil_is_Conc2 when all nils are turned to right side! *) | 
| 281 | lemma UU_is_Conc: "(UU = x @@ y) = (((x::'a Seq)= UU) | (x = nil \<and> y = UU))" | |
| 62195 | 282 | by (Seq_case_simp x) | 
| 19741 | 283 | |
| 284 | lemma ex2seqConc [rule_format]: | |
| 62192 | 285 | "Finite s1 \<longrightarrow> (\<forall>ex. (s \<noteq> nil \<and> s \<noteq> UU \<and> ex2seq ex = s1 @@ s) \<longrightarrow> (\<exists>ex'. s = ex2seq ex'))" | 
| 286 | apply (rule impI) | |
| 62195 | 287 | apply Seq_Finite_induct | 
| 62192 | 288 | apply blast | 
| 289 | text \<open>main case\<close> | |
| 290 | apply clarify | |
| 62195 | 291 | apply (pair ex) | 
| 292 | apply (Seq_case_simp x2) | |
| 62192 | 293 | text \<open>\<open>UU\<close> case\<close> | 
| 294 | apply (simp add: nil_is_Conc) | |
| 295 | text \<open>\<open>nil\<close> case\<close> | |
| 296 | apply (simp add: nil_is_Conc) | |
| 297 | text \<open>cons case\<close> | |
| 62195 | 298 | apply (pair aa) | 
| 62192 | 299 | done | 
| 19741 | 300 | |
| 301 | (* important property of ex2seq: can be shiftet, as defined "pointwise" *) | |
| 62192 | 302 | lemma ex2seq_tsuffix: "tsuffix s (ex2seq ex) \<Longrightarrow> \<exists>ex'. s = (ex2seq ex')" | 
| 303 | apply (unfold tsuffix_def suffix_def) | |
| 304 | apply auto | |
| 305 | apply (drule ex2seqConc) | |
| 306 | apply auto | |
| 307 | done | |
| 19741 | 308 | |
| 309 | ||
| 62192 | 310 | (*important property of cex_absSeq: As it is a 1to1 correspondence, | 
| 19741 | 311 | properties carry over *) | 
| 62192 | 312 | lemma cex_absSeq_tsuffix: "tsuffix s t \<Longrightarrow> tsuffix (cex_absSeq h s) (cex_absSeq h t)" | 
| 313 | apply (unfold tsuffix_def suffix_def cex_absSeq_def) | |
| 314 | apply auto | |
| 315 | apply (simp add: Mapnil) | |
| 316 | apply (simp add: MapUU) | |
| 63549 | 317 | apply (rule_tac x = "Map (% (s,a,t) . (h s,a, h t))\<cdot>s1" in exI) | 
| 62192 | 318 | apply (simp add: Map2Finite MapConc) | 
| 319 | done | |
| 19741 | 320 | |
| 321 | ||
| 62192 | 322 | lemma strength_Box: "temp_strengthening P Q h \<Longrightarrow> temp_strengthening (\<box>P) (\<box>Q) h" | 
| 323 | apply (unfold temp_strengthening_def state_strengthening_def temp_sat_def satisfies_def Box_def) | |
| 324 | apply clarify | |
| 325 | apply (frule ex2seq_tsuffix) | |
| 326 | apply clarify | |
| 327 | apply (drule_tac h = "h" in cex_absSeq_tsuffix) | |
| 328 | apply (simp add: ex2seq_abs_cex) | |
| 329 | done | |
| 19741 | 330 | |
| 331 | ||
| 62002 | 332 | subsubsection \<open>Init\<close> | 
| 19741 | 333 | |
| 25135 
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
 wenzelm parents: 
23560diff
changeset | 334 | lemma strength_Init: | 
| 62192 | 335 | "state_strengthening P Q h \<Longrightarrow> temp_strengthening (Init P) (Init Q) h" | 
| 336 | apply (unfold temp_strengthening_def state_strengthening_def | |
| 337 | temp_sat_def satisfies_def Init_def unlift_def) | |
| 338 | apply auto | |
| 62195 | 339 | apply (pair ex) | 
| 340 | apply (Seq_case_simp x2) | |
| 341 | apply (pair a) | |
| 62192 | 342 | done | 
| 19741 | 343 | |
| 344 | ||
| 62002 | 345 | subsubsection \<open>Next\<close> | 
| 19741 | 346 | |
| 63549 | 347 | lemma TL_ex2seq_UU: "TL \<cdot> (ex2seq (cex_abs h ex)) = UU \<longleftrightarrow> TL \<cdot> (ex2seq ex) = UU" | 
| 62195 | 348 | apply (pair ex) | 
| 349 | apply (Seq_case_simp x2) | |
| 350 | apply (pair a) | |
| 351 | apply (Seq_case_simp s) | |
| 352 | apply (pair a) | |
| 62192 | 353 | done | 
| 19741 | 354 | |
| 63549 | 355 | lemma TL_ex2seq_nil: "TL \<cdot> (ex2seq (cex_abs h ex)) = nil \<longleftrightarrow> TL \<cdot> (ex2seq ex) = nil" | 
| 62195 | 356 | apply (pair ex) | 
| 357 | apply (Seq_case_simp x2) | |
| 358 | apply (pair a) | |
| 359 | apply (Seq_case_simp s) | |
| 360 | apply (pair a) | |
| 62192 | 361 | done | 
| 19741 | 362 | |
| 62192 | 363 | (*important property of cex_absSeq: As it is a 1to1 correspondence, | 
| 364 | properties carry over*) | |
| 63549 | 365 | lemma cex_absSeq_TL: "cex_absSeq h (TL \<cdot> s) = TL \<cdot> (cex_absSeq h s)" | 
| 62192 | 366 | by (simp add: MapTL cex_absSeq_def) | 
| 19741 | 367 | |
| 368 | (* important property of ex2seq: can be shiftet, as defined "pointwise" *) | |
| 63549 | 369 | lemma TLex2seq: "snd ex \<noteq> UU \<Longrightarrow> snd ex \<noteq> nil \<Longrightarrow> \<exists>ex'. TL\<cdot>(ex2seq ex) = ex2seq ex'" | 
| 62195 | 370 | apply (pair ex) | 
| 371 | apply (Seq_case_simp x2) | |
| 372 | apply (pair a) | |
| 62192 | 373 | apply auto | 
| 374 | done | |
| 19741 | 375 | |
| 63549 | 376 | lemma ex2seqnilTL: "TL \<cdot> (ex2seq ex) \<noteq> nil \<longleftrightarrow> snd ex \<noteq> nil \<and> snd ex \<noteq> UU" | 
| 62195 | 377 | apply (pair ex) | 
| 378 | apply (Seq_case_simp x2) | |
| 379 | apply (pair a) | |
| 380 | apply (Seq_case_simp s) | |
| 381 | apply (pair a) | |
| 62192 | 382 | done | 
| 19741 | 383 | |
| 62441 | 384 | lemma strength_Next: "temp_strengthening P Q h \<Longrightarrow> temp_strengthening (\<circle>P) (\<circle>Q) h" | 
| 62192 | 385 | apply (unfold temp_strengthening_def state_strengthening_def temp_sat_def satisfies_def Next_def) | 
| 386 | apply simp | |
| 387 | apply auto | |
| 388 | apply (simp add: TL_ex2seq_nil TL_ex2seq_UU) | |
| 389 | apply (simp add: TL_ex2seq_nil TL_ex2seq_UU) | |
| 390 | apply (simp add: TL_ex2seq_nil TL_ex2seq_UU) | |
| 391 | apply (simp add: TL_ex2seq_nil TL_ex2seq_UU) | |
| 392 | text \<open>cons case\<close> | |
| 393 | apply (simp add: TL_ex2seq_nil TL_ex2seq_UU ex2seq_abs_cex cex_absSeq_TL [symmetric] ex2seqnilTL) | |
| 394 | apply (erule conjE) | |
| 395 | apply (drule TLex2seq) | |
| 396 | apply assumption | |
| 397 | apply auto | |
| 398 | done | |
| 19741 | 399 | |
| 400 | ||
| 62192 | 401 | text \<open>Localizing Temporal Weakenings - 2\<close> | 
| 19741 | 402 | |
| 62192 | 403 | lemma weak_Init: "state_weakening P Q h \<Longrightarrow> temp_weakening (Init P) (Init Q) h" | 
| 404 | apply (simp add: temp_weakening_def2 state_weakening_def2 | |
| 405 | temp_sat_def satisfies_def Init_def unlift_def) | |
| 406 | apply auto | |
| 62195 | 407 | apply (pair ex) | 
| 408 | apply (Seq_case_simp x2) | |
| 409 | apply (pair a) | |
| 62192 | 410 | done | 
| 19741 | 411 | |
| 412 | ||
| 62002 | 413 | text \<open>Localizing Temproal Strengthenings - 3\<close> | 
| 19741 | 414 | |
| 62192 | 415 | lemma strength_Diamond: "temp_strengthening P Q h \<Longrightarrow> temp_strengthening (\<diamond>P) (\<diamond>Q) h" | 
| 416 | apply (unfold Diamond_def) | |
| 417 | apply (rule strength_NOT) | |
| 418 | apply (rule weak_Box) | |
| 419 | apply (erule weak_NOT) | |
| 420 | done | |
| 19741 | 421 | |
| 25135 
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
 wenzelm parents: 
23560diff
changeset | 422 | lemma strength_Leadsto: | 
| 62192 | 423 | "temp_weakening P1 P2 h \<Longrightarrow> temp_strengthening Q1 Q2 h \<Longrightarrow> | 
| 424 | temp_strengthening (P1 \<leadsto> Q1) (P2 \<leadsto> Q2) h" | |
| 425 | apply (unfold Leadsto_def) | |
| 426 | apply (rule strength_Box) | |
| 427 | apply (erule strength_IMPLIES) | |
| 428 | apply (erule strength_Diamond) | |
| 429 | done | |
| 19741 | 430 | |
| 431 | ||
| 62002 | 432 | text \<open>Localizing Temporal Weakenings - 3\<close> | 
| 19741 | 433 | |
| 62192 | 434 | lemma weak_Diamond: "temp_weakening P Q h \<Longrightarrow> temp_weakening (\<diamond>P) (\<diamond>Q) h" | 
| 435 | apply (unfold Diamond_def) | |
| 436 | apply (rule weak_NOT) | |
| 437 | apply (rule strength_Box) | |
| 438 | apply (erule strength_NOT) | |
| 439 | done | |
| 19741 | 440 | |
| 25135 
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
 wenzelm parents: 
23560diff
changeset | 441 | lemma weak_Leadsto: | 
| 62192 | 442 | "temp_strengthening P1 P2 h \<Longrightarrow> temp_weakening Q1 Q2 h \<Longrightarrow> | 
| 443 | temp_weakening (P1 \<leadsto> Q1) (P2 \<leadsto> Q2) h" | |
| 444 | apply (unfold Leadsto_def) | |
| 445 | apply (rule weak_Box) | |
| 446 | apply (erule weak_IMPLIES) | |
| 447 | apply (erule weak_Diamond) | |
| 448 | done | |
| 19741 | 449 | |
| 25135 
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
 wenzelm parents: 
23560diff
changeset | 450 | lemma weak_WF: | 
| 62192 | 451 | "(\<And>s. Enabled A acts (h s) \<Longrightarrow> Enabled C acts s) | 
| 452 | \<Longrightarrow> temp_weakening (WF A acts) (WF C acts) h" | |
| 453 | apply (unfold WF_def) | |
| 454 | apply (rule weak_IMPLIES) | |
| 455 | apply (rule strength_Diamond) | |
| 456 | apply (rule strength_Box) | |
| 457 | apply (rule strength_Init) | |
| 458 | apply (rule_tac [2] weak_Box) | |
| 459 | apply (rule_tac [2] weak_Diamond) | |
| 460 | apply (rule_tac [2] weak_Init) | |
| 461 | apply (auto simp add: state_weakening_def state_strengthening_def | |
| 462 | xt2_def plift_def option_lift_def NOT_def) | |
| 463 | done | |
| 19741 | 464 | |
| 25135 
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
 wenzelm parents: 
23560diff
changeset | 465 | lemma weak_SF: | 
| 62192 | 466 | "(\<And>s. Enabled A acts (h s) \<Longrightarrow> Enabled C acts s) | 
| 467 | \<Longrightarrow> temp_weakening (SF A acts) (SF C acts) h" | |
| 468 | apply (unfold SF_def) | |
| 469 | apply (rule weak_IMPLIES) | |
| 470 | apply (rule strength_Box) | |
| 471 | apply (rule strength_Diamond) | |
| 472 | apply (rule strength_Init) | |
| 473 | apply (rule_tac [2] weak_Box) | |
| 474 | apply (rule_tac [2] weak_Diamond) | |
| 475 | apply (rule_tac [2] weak_Init) | |
| 476 | apply (auto simp add: state_weakening_def state_strengthening_def | |
| 477 | xt2_def plift_def option_lift_def NOT_def) | |
| 478 | done | |
| 19741 | 479 | |
| 480 | ||
| 481 | lemmas weak_strength_lemmas = | |
| 482 | weak_OR weak_AND weak_NOT weak_IMPLIES weak_Box weak_Next weak_Init | |
| 483 | weak_Diamond weak_Leadsto strength_OR strength_AND strength_NOT | |
| 484 | strength_IMPLIES strength_Box strength_Next strength_Init | |
| 485 | strength_Diamond strength_Leadsto weak_WF weak_SF | |
| 486 | ||
| 62002 | 487 | ML \<open> | 
| 30607 
c3d1590debd8
eliminated global SIMPSET, CLASET etc. -- refer to explicit context;
 wenzelm parents: 
27208diff
changeset | 488 | fun abstraction_tac ctxt = | 
| 42793 | 489 | SELECT_GOAL (auto_tac | 
| 490 |     (ctxt addSIs @{thms weak_strength_lemmas}
 | |
| 51717 
9e7d1c139569
simplifier uses proper Proof.context instead of historic type simpset;
 wenzelm parents: 
42814diff
changeset | 491 |       addsimps [@{thm state_strengthening_def}, @{thm state_weakening_def}]))
 | 
| 62002 | 492 | \<close> | 
| 17233 | 493 | |
| 62002 | 494 | method_setup abstraction = \<open>Scan.succeed (SIMPLE_METHOD' o abstraction_tac)\<close> | 
| 30607 
c3d1590debd8
eliminated global SIMPSET, CLASET etc. -- refer to explicit context;
 wenzelm parents: 
27208diff
changeset | 495 | |
| 17233 | 496 | end |