diff -r 2332d9be352b -r 331be2820f90 src/ZF/UNITY/AllocImpl.thy --- a/src/ZF/UNITY/AllocImpl.thy Sat Oct 10 21:43:07 2015 +0200 +++ b/src/ZF/UNITY/AllocImpl.thy Sat Oct 10 22:02:23 2015 +0200 @@ -248,7 +248,7 @@ alloc_prog \ G \ Incr(lift(rel)); k\nat |] ==> alloc_prog \ G \ {s\state. k \ length(s`rel)} \ {s\state. succ(s`NbR) = k} - LeadsTo {s\state. k \ s`NbR}" + \w {s\state. k \ s`NbR}" apply (subgoal_tac "alloc_prog \ G \ Stable ({s\state. k \ length (s`rel)})") apply (drule_tac [2] a = k and g1 = length in imp_Increasing_comp [THEN Increasing_imp_Stable]) apply (rule_tac [2] mono_length) @@ -268,7 +268,7 @@ k\nat; n \ nat; n < k |] ==> alloc_prog \ G \ {s\state . k \ length(s ` rel)} \ {s\state . s ` NbR = n} - LeadsTo {x \ state. k \ length(x`rel)} \ + \w {x \ state. k \ length(x`rel)} \ (\m \ greater_than(n). {x \ state. x ` NbR=m})" apply (unfold greater_than_def) apply (rule_tac A' = "{x \ state. k \ length(x`rel)} \ {x \ state. n < x`NbR}" @@ -301,7 +301,7 @@ "[|G \ program; alloc_prog ok G; alloc_prog \ G \ Incr(lift(rel)); k\nat|] ==> alloc_prog \ G \ - {s\state. k \ length(s`rel)} LeadsTo {s\state. k \ s`NbR}" + {s\state. k \ length(s`rel)} \w {s\state. k \ s`NbR}" (* Proof by induction over the difference between k and n *) apply (rule_tac f = "\s\state. k #- s`NbR" in LessThan_induct) apply (simp_all add: lam_def, auto) @@ -376,8 +376,8 @@ {s\state. nth(length(s`giv), s`ask) \ s`available_tok} \ {s\state. k < length(s`ask)} \ {s\state. length(s`giv) = k} - LeadsTo {s\state. k < length(s`giv)}" -apply (subgoal_tac "alloc_prog \ G \ {s\state. nth (length(s`giv), s`ask) \ s`available_tok} \ {s\state. k < length(s`ask) } \ {s\state. length(s`giv) = k} LeadsTo {s\state. ~ k {s\state. length(s`giv) \ k}") + \w {s\state. k < length(s`giv)}" +apply (subgoal_tac "alloc_prog \ G \ {s\state. nth (length(s`giv), s`ask) \ s`available_tok} \ {s\state. k < length(s`ask) } \ {s\state. length(s`giv) = k} \w {s\state. ~ k {s\state. length(s`giv) \ k}") prefer 2 apply (blast intro: alloc_prog_giv_Ensures_lemma [THEN LeadsTo_Basis]) apply (subgoal_tac "alloc_prog \ G \ Stable ({s\state. k < length(s`ask) }) ") apply (drule PSP_Stable, assumption) @@ -424,12 +424,12 @@ subsubsection\Main lemmas towards proving property (31)\ lemma LeadsTo_strength_R: - "[| F \ C LeadsTo B'; F \ A-C LeadsTo B; B'<=B |] ==> F \ A LeadsTo B" + "[| F \ C \w B'; F \ A-C \w B; B'<=B |] ==> F \ A \w B" by (blast intro: LeadsTo_weaken LeadsTo_Un_Un) lemma PSP_StableI: -"[| F \ Stable(C); F \ A - C LeadsTo B; - F \ A \ C LeadsTo B \ (state - C) |] ==> F \ A LeadsTo B" +"[| F \ Stable(C); F \ A - C \w B; + F \ A \ C \w B \ (state - C) |] ==> F \ A \w B" apply (rule_tac A = " (A-C) \ (A \ C)" in LeadsTo_weaken_L) prefer 2 apply blast apply (rule LeadsTo_Un, assumption) @@ -453,7 +453,7 @@ and safety: "alloc_prog \ G \ Always(\k \ nat. {s\state. nth(k, s`ask) \ NbT})" and progress: "alloc_prog \ G - \ (\k\nat. {s\state. k \ tokens(s`giv)} LeadsTo + \ (\k\nat. {s\state. k \ tokens(s`giv)} \w {s\state. k \ tokens(s`rel)})" (*First step in proof of (31) -- the corrected version from Charpentier. @@ -463,7 +463,7 @@ "k \ tokbag ==> alloc_prog \ G \ {s\state. k \ tokens(s`rel)} - LeadsTo {s\state. k \ tokens(take(s`NbR, s`rel))}" + \w {s\state. k \ tokens(take(s`NbR, s`rel))}" apply (rule single_LeadsTo_I, safe) apply (rule_tac a1 = "s`rel" in Increasing_imp_Stable [THEN PSP_StableI]) apply (rule_tac [4] k1 = "length(s`rel)" in alloc_prog_NbR_LeadsTo_lemma3 [THEN LeadsTo_strength_R]) @@ -477,12 +477,12 @@ (*** Rest of proofs done by lcp ***) (*Second step in proof of (31): by LHS of the guarantee and transivity of - LeadsTo *) + \w *) lemma (in alloc_progress) tokens_take_NbR_lemma2: "k \ tokbag ==> alloc_prog \ G \ {s\state. tokens(s`giv) = k} - LeadsTo {s\state. k \ tokens(take(s`NbR, s`rel))}" + \w {s\state. k \ tokens(take(s`NbR, s`rel))}" apply (rule LeadsTo_Trans) apply (rule_tac [2] tokens_take_NbR_lemma) prefer 2 apply assumption @@ -495,7 +495,7 @@ "[| k \ tokbag; n \ nat |] ==> alloc_prog \ G \ {s\state. length(s`giv) = n & tokens(s`giv) = k} - LeadsTo + \w {s\state. (length(s`giv) = n & tokens(s`giv) = k & k \ tokens(take(s`NbR, s`rel))) | n < length(s`giv)}" apply (rule single_LeadsTo_I, safe) @@ -515,7 +515,7 @@ "[|k \ tokbag; n \ nat|] ==> alloc_prog \ G \ {s\state. length(s`giv) = n & tokens(s`giv) = k} - LeadsTo + \w {s\state. (length(s`giv) = n & NbT \ s`available_tok) | n < length(s`giv)}" apply (rule LeadsTo_weaken_R) @@ -528,7 +528,7 @@ "n \ nat ==> alloc_prog \ G \ {s\state. length(s`giv) = n} - LeadsTo + \w {s\state. (length(s`giv) = n & NbT \ s`available_tok) | n < length(s`giv)}" apply (rule LeadsTo_weaken_L) @@ -543,7 +543,7 @@ "[|k \ nat; n < k|] ==> alloc_prog \ G \ {s\state. length(s`ask) = k & length(s`giv) = n} - LeadsTo + \w {s\state. (NbT \ s`available_tok & length(s`giv) < length(s`ask) & length(s`giv) = n) | n < length(s`giv)}" @@ -566,7 +566,7 @@ "[|k \ nat; n < k|] ==> alloc_prog \ G \ {s\state. length(s`ask) = k & length(s`giv) = n} - LeadsTo + \w {s\state. (nth(length(s`giv), s`ask) \ s`available_tok & length(s`giv) < length(s`ask) & length(s`giv) = n) | n < length(s`giv)}" @@ -583,7 +583,7 @@ "[| k \ nat; n < k|] ==> alloc_prog \ G \ {s\state. length(s`ask) = k & length(s`giv) = n} - LeadsTo {s\state. n < length(s`giv)}" + \w {s\state. n < length(s`giv)}" apply (rule LeadsTo_Un_duplicate) apply (rule LeadsTo_cancel1) apply (rule_tac [2] alloc_prog_giv_LeadsTo_lemma) @@ -598,7 +598,7 @@ lemma (in alloc_progress) alloc_prog_ask_LeadsTo_giv: "k \ nat ==> alloc_prog \ G \ - {s\state. k \ length(s`ask)} LeadsTo {s\state. k \ length(s`giv)}" + {s\state. k \ length(s`ask)} \w {s\state. k \ length(s`giv)}" (* Proof by induction over the difference between k and n *) apply (rule_tac f = "\s\state. k #- length(s`giv)" in LessThan_induct) apply (auto simp add: lam_def Collect_vimage_eq) @@ -623,7 +623,7 @@ lemma (in alloc_progress) final: "h \ list(tokbag) ==> alloc_prog \ G - \ {s\state. \ prefix(tokbag)} LeadsTo + \ {s\state. \ prefix(tokbag)} \w {s\state. \ prefix(tokbag)}" apply (rule single_LeadsTo_I) prefer 2 apply simp @@ -647,10 +647,10 @@ "alloc_prog \ Incr(lift(ask)) \ Incr(lift(rel)) \ Always(\k \ nat. {s\state. nth(k, s`ask) \ NbT}) \ - (\k\nat. {s\state. k \ tokens(s`giv)} LeadsTo + (\k\nat. {s\state. k \ tokens(s`giv)} \w {s\state. k \ tokens(s`rel)}) guarantees (\h \ list(tokbag). - {s\state. \ prefix(tokbag)} LeadsTo + {s\state. \ prefix(tokbag)} \w {s\state. \ prefix(tokbag)})" apply (rule guaranteesI) apply (rule INT_I)