equal
deleted
inserted
replaced
2045 section {* RAG is acyclic *} |
2045 section {* RAG is acyclic *} |
2046 |
2046 |
2047 subsection {* Uniqueness of waiting *} |
2047 subsection {* Uniqueness of waiting *} |
2048 |
2048 |
2049 text {* |
2049 text {* |
2050 Uniqueness of waiting is expressed by the following |
2050 {\em Uniqueness of waiting} means that |
2051 predicate over system state (or event trace). |
2051 a thread can only be blocked on one resource. |
2052 It says a thread can only be blocked on one resource. |
2052 This property is needed in order to prove that @{term RAG} |
|
2053 is acyclic. Therefore, we need to prove it first in the following |
|
2054 lemma @{text "waiting_unqiue"}, all lemmas before it are auxiliary. |
|
2055 |
|
2056 The property is expressed by the following predicate over system |
|
2057 state (or event trace), which is also named @{text "waiting_unqiue"}. |
2053 *} |
2058 *} |
2054 |
2059 |
2055 definition |
2060 definition |
2056 "waiting_unique (ss::state) = |
2061 "waiting_unique (ss::state) = |
2057 (\<forall> th cs1 cs2. waiting ss th cs1 \<longrightarrow> |
2062 (\<forall> th cs1 cs2. waiting ss th cs1 \<longrightarrow> |
2062 lemma named @{text waiting_unique}) that |
2067 lemma named @{text waiting_unique}) that |
2063 this property holds on any valid trace (or system state). |
2068 this property holds on any valid trace (or system state). |
2064 *} |
2069 *} |
2065 |
2070 |
2066 text {* |
2071 text {* |
2067 As a first step, we need to understand how |
2072 As a first step to prove lemma @{text "waiting_unqiue"}, |
|
2073 we need to understand how |
2068 a thread is get blocked. |
2074 a thread is get blocked. |
2069 We show in the following lemmas |
2075 We show in the following lemmas |
2070 (all named @{text "waiting_inv"}) that |
2076 (all named @{text "waiting_inv"}) that |
2071 @{term P}-operation is the only cause. |
2077 @{term P}-operation is the only cause. |
2072 *} |
2078 *} |
2149 and "waiting (e#s) th' cs'" |
2155 and "waiting (e#s) th' cs'" |
2150 shows "e = P th' cs'" |
2156 shows "e = P th' cs'" |
2151 proof - |
2157 proof - |
2152 from assms(2) |
2158 from assms(2) |
2153 show ?thesis |
2159 show ?thesis |
2154 by (cases rule:waiting_esE, insert assms, auto) |
2160 by (cases rule:waiting_esE, insert assms, auto) (* ccc *) |
2155 qed |
2161 qed |
2156 |
2162 |
2157 end |
2163 end |
2158 |
2164 |
2159 context valid_trace_v_e |
2165 context valid_trace_v_e |
2168 show ?thesis |
2174 show ?thesis |
2169 by (cases rule:waiting_esE, insert assms, auto) |
2175 by (cases rule:waiting_esE, insert assms, auto) |
2170 qed |
2176 qed |
2171 |
2177 |
2172 end |
2178 end |
2173 |
|
2174 |
2179 |
2175 context valid_trace_e |
2180 context valid_trace_e |
2176 begin |
2181 begin |
2177 |
2182 |
2178 lemma waiting_inv: |
2183 lemma waiting_inv: |
2215 by (unfold_locales, simp) |
2220 by (unfold_locales, simp) |
2216 show ?thesis using vt.waiting_inv[OF assms] by simp |
2221 show ?thesis using vt.waiting_inv[OF assms] by simp |
2217 qed |
2222 qed |
2218 qed |
2223 qed |
2219 |
2224 |
|
2225 text {* |
|
2226 Now, with @{thm waiting_inv} in place, the following lemma |
|
2227 shows the uniqueness of waiting is kept by every operation |
|
2228 in the PIP protocol. This lemma constitutes the main part |
|
2229 in the proof of lemma @{text "waiting_unique"}. |
|
2230 *} |
|
2231 |
2220 lemma waiting_unique_kept: |
2232 lemma waiting_unique_kept: |
2221 assumes "waiting_unique s" |
2233 assumes "waiting_unique s" |
2222 shows "waiting_unique (e#s)" |
2234 shows "waiting_unique (e#s)" |
2223 proof - |
2235 proof - |
2224 note h = assms[unfolded waiting_unique_def, rule_format] |
2236 note h = assms[unfolded waiting_unique_def, rule_format] |
2260 end |
2272 end |
2261 |
2273 |
2262 context valid_trace |
2274 context valid_trace |
2263 begin |
2275 begin |
2264 |
2276 |
|
2277 text {* |
|
2278 With @{thm valid_trace_e.waiting_unique_kept} in place, |
|
2279 the proof of the following lemma @{text "waiting_unique"} |
|
2280 needs only a very simple induction. |
|
2281 *} |
|
2282 |
2265 lemma waiting_unique |
2283 lemma waiting_unique |
2266 [unfolded waiting_unique_def, rule_format]: |
2284 [unfolded waiting_unique_def, rule_format]: |
2267 shows "waiting_unique s" |
2285 shows "waiting_unique s" |
2268 proof(induct rule:ind) |
2286 proof(induct rule:ind) |
2269 case Nil |
2287 case Nil |
2276 by simp |
2294 by simp |
2277 qed |
2295 qed |
2278 |
2296 |
2279 end |
2297 end |
2280 |
2298 |
|
2299 |
2281 subsection {* Acyclic keeping *} |
2300 subsection {* Acyclic keeping *} |
|
2301 |
|
2302 text {* |
|
2303 To prove that @{term RAG} is acyclic, we need to show the acyclic property |
|
2304 is preserved by all system operations. There are only two non-trivial cases, |
|
2305 the @{term P} and @{term V} operation, where are treated in the following |
|
2306 locales, under the name @{text "acylic_RAG_kept"}: |
|
2307 *} |
2282 |
2308 |
2283 context valid_trace_v_e |
2309 context valid_trace_v_e |
2284 begin |
2310 begin |
2285 |
2311 |
2286 lemma |
2312 lemma |
2399 |
2425 |
2400 end |
2426 end |
2401 |
2427 |
2402 context valid_trace |
2428 context valid_trace |
2403 begin |
2429 begin |
|
2430 |
|
2431 text {* |
|
2432 With these @{text "acylic_RAG_kept"}-lemmas proved, |
|
2433 the proof of the following @{text "acyclic_RAG"} is |
|
2434 straight forward. |
|
2435 *} |
2404 |
2436 |
2405 lemma acyclic_RAG: |
2437 lemma acyclic_RAG: |
2406 shows "acyclic (RAG s)" |
2438 shows "acyclic (RAG s)" |
2407 proof(induct rule:ind) |
2439 proof(induct rule:ind) |
2408 case Nil |
2440 case Nil |
2464 qed |
2496 qed |
2465 |
2497 |
2466 end |
2498 end |
2467 |
2499 |
2468 section {* RAG is single-valued *} |
2500 section {* RAG is single-valued *} |
|
2501 |
|
2502 text {* |
|
2503 The proof that @{term RAG} is single-valued makes use of |
|
2504 @{text "unique_waiting"} and @{thm held_unique} and the |
|
2505 proof itself is very simple: |
|
2506 *} |
2469 |
2507 |
2470 context valid_trace |
2508 context valid_trace |
2471 begin |
2509 begin |
2472 |
2510 |
2473 lemma unique_RAG: "\<lbrakk>(n, n1) \<in> RAG s; (n, n2) \<in> RAG s\<rbrakk> \<Longrightarrow> n1 = n2" |
2511 lemma unique_RAG: "\<lbrakk>(n, n1) \<in> RAG s; (n, n2) \<in> RAG s\<rbrakk> \<Longrightarrow> n1 = n2" |