| author | blanchet | 
| Tue, 17 Nov 2009 14:10:31 +0100 | |
| changeset 33737 | e441fede163d | 
| parent 32960 | 69916a850301 | 
| child 35416 | d8d7d1b785af | 
| permissions | -rw-r--r-- | 
| 
32960
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
1  | 
(* Title: HOL/UNITY/Comp/AllocImpl.thy  | 
| 
11194
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
2  | 
Author: Lawrence C Paulson, Cambridge University Computer Laboratory  | 
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
3  | 
Copyright 1998 University of Cambridge  | 
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
4  | 
*)  | 
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
5  | 
|
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
6  | 
header{*Implementation of a multiple-client allocator from a single-client allocator*}
 | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
7  | 
|
| 16417 | 8  | 
theory AllocImpl imports AllocBase Follows PPROD begin  | 
| 
11194
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
9  | 
|
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
10  | 
|
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
11  | 
(** State definitions. OUTPUT variables are locals **)  | 
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
12  | 
|
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
13  | 
(*Type variable 'b is the type of items being merged*)  | 
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
14  | 
record 'b merge =  | 
| 14114 | 15  | 
In :: "nat => 'b list" (*merge's INPUT histories: streams to merge*)  | 
16  | 
Out :: "'b list" (*merge's OUTPUT history: merged items*)  | 
|
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
17  | 
iOut :: "nat list" (*merge's OUTPUT history: origins of merged items*)  | 
| 
11194
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
18  | 
|
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
19  | 
record ('a,'b) merge_d =
 | 
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
20  | 
"'b merge" +  | 
| 
11194
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
21  | 
dummy :: 'a (*dummy field for new variables*)  | 
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
22  | 
|
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
23  | 
constdefs  | 
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
24  | 
  non_dummy :: "('a,'b) merge_d => 'b merge"
 | 
| 
11194
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
25  | 
"non_dummy s == (|In = In s, Out = Out s, iOut = iOut s|)"  | 
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
26  | 
|
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
27  | 
record 'b distr =  | 
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
28  | 
In :: "'b list" (*items to distribute*)  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
29  | 
iIn :: "nat list" (*destinations of items to distribute*)  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
30  | 
Out :: "nat => 'b list" (*distributed items*)  | 
| 
11194
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
31  | 
|
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
32  | 
record ('a,'b) distr_d =
 | 
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
33  | 
"'b distr" +  | 
| 
11194
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
34  | 
dummy :: 'a (*dummy field for new variables*)  | 
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
35  | 
|
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
36  | 
record allocState =  | 
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
37  | 
giv :: "nat list" (*OUTPUT history: source of tokens*)  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
38  | 
ask :: "nat list" (*INPUT: tokens requested from allocator*)  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
39  | 
rel :: "nat list" (*INPUT: tokens released to allocator*)  | 
| 
11194
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
40  | 
|
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
41  | 
record 'a allocState_d =  | 
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
42  | 
allocState +  | 
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
43  | 
dummy :: 'a (*dummy field for new variables*)  | 
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
44  | 
|
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
45  | 
record 'a systemState =  | 
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
46  | 
allocState +  | 
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
47  | 
mergeRel :: "nat merge"  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
48  | 
mergeAsk :: "nat merge"  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
49  | 
distr :: "nat distr"  | 
| 
11194
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
50  | 
dummy :: 'a (*dummy field for new variables*)  | 
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
51  | 
|
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
52  | 
|
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
53  | 
constdefs  | 
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
54  | 
|
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
55  | 
(** Merge specification (the number of inputs is Nclients) ***)  | 
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
56  | 
|
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
57  | 
(*spec (10)*)  | 
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
58  | 
  merge_increasing :: "('a,'b) merge_d program set"
 | 
| 
11194
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
59  | 
"merge_increasing ==  | 
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
60  | 
UNIV guarantees (Increasing merge.Out) Int (Increasing merge.iOut)"  | 
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
61  | 
|
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
62  | 
(*spec (11)*)  | 
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
63  | 
  merge_eqOut :: "('a,'b) merge_d program set"
 | 
| 
11194
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
64  | 
"merge_eqOut ==  | 
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
65  | 
UNIV guarantees  | 
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
66  | 
         Always {s. length (merge.Out s) = length (merge.iOut s)}"
 | 
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
67  | 
|
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
68  | 
(*spec (12)*)  | 
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
69  | 
  merge_bounded :: "('a,'b) merge_d program set"
 | 
| 
11194
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
70  | 
"merge_bounded ==  | 
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
71  | 
UNIV guarantees  | 
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
72  | 
         Always {s. \<forall>elt \<in> set (merge.iOut s). elt < Nclients}"
 | 
| 
11194
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
73  | 
|
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
74  | 
(*spec (13)*)  | 
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
75  | 
  merge_follows :: "('a,'b) merge_d program set"
 | 
| 
11194
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
76  | 
"merge_follows ==  | 
| 
32960
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
77  | 
(\<Inter>i \<in> lessThan Nclients. Increasing (sub i o merge.In))  | 
| 
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
78  | 
guarantees  | 
| 
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
79  | 
(\<Inter>i \<in> lessThan Nclients.  | 
| 
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
80  | 
(%s. sublist (merge.Out s)  | 
| 
11194
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
81  | 
                       {k. k < size(merge.iOut s) & merge.iOut s! k = i})
 | 
| 
32960
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
82  | 
Fols (sub i o merge.In))"  | 
| 
11194
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
83  | 
|
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
84  | 
(*spec: preserves part*)  | 
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
85  | 
  merge_preserves :: "('a,'b) merge_d program set"
 | 
| 
11194
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
86  | 
"merge_preserves == preserves merge.In Int preserves merge_d.dummy"  | 
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
87  | 
|
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
88  | 
(*environmental constraints*)  | 
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
89  | 
  merge_allowed_acts :: "('a,'b) merge_d program set"
 | 
| 
11194
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
90  | 
"merge_allowed_acts ==  | 
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
91  | 
       {F. AllowedActs F =
 | 
| 
32960
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
92  | 
insert Id (UNION (preserves (funPair merge.Out merge.iOut)) Acts)}"  | 
| 
11194
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
93  | 
|
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
94  | 
  merge_spec :: "('a,'b) merge_d program set"
 | 
| 
11194
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
95  | 
"merge_spec == merge_increasing Int merge_eqOut Int merge_bounded Int  | 
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
96  | 
merge_follows Int merge_allowed_acts Int merge_preserves"  | 
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
97  | 
|
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
98  | 
(** Distributor specification (the number of outputs is Nclients) ***)  | 
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
99  | 
|
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
100  | 
(*spec (14)*)  | 
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
101  | 
  distr_follows :: "('a,'b) distr_d program set"
 | 
| 
11194
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
102  | 
"distr_follows ==  | 
| 
32960
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
103  | 
Increasing distr.In Int Increasing distr.iIn Int  | 
| 
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
104  | 
         Always {s. \<forall>elt \<in> set (distr.iIn s). elt < Nclients}
 | 
| 
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
105  | 
guarantees  | 
| 
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
106  | 
(\<Inter>i \<in> lessThan Nclients.  | 
| 
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
107  | 
(sub i o distr.Out) Fols  | 
| 
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
108  | 
(%s. sublist (distr.In s)  | 
| 
11194
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
109  | 
                       {k. k < size(distr.iIn s) & distr.iIn s ! k = i}))"
 | 
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
110  | 
|
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
111  | 
  distr_allowed_acts :: "('a,'b) distr_d program set"
 | 
| 
11194
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
112  | 
"distr_allowed_acts ==  | 
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
113  | 
       {D. AllowedActs D = insert Id (UNION (preserves distr.Out) Acts)}"
 | 
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
114  | 
|
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
115  | 
  distr_spec :: "('a,'b) distr_d program set"
 | 
| 
11194
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
116  | 
"distr_spec == distr_follows Int distr_allowed_acts"  | 
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
117  | 
|
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
118  | 
(** Single-client allocator specification (required) ***)  | 
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
119  | 
|
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
120  | 
(*spec (18)*)  | 
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
121  | 
alloc_increasing :: "'a allocState_d program set"  | 
| 
11194
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
122  | 
"alloc_increasing == UNIV guarantees Increasing giv"  | 
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
123  | 
|
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
124  | 
(*spec (19)*)  | 
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
125  | 
alloc_safety :: "'a allocState_d program set"  | 
| 
11194
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
126  | 
"alloc_safety ==  | 
| 
32960
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
127  | 
Increasing rel  | 
| 14114 | 128  | 
         guarantees  Always {s. tokens (giv s) \<le> NbT + tokens (rel s)}"
 | 
| 
11194
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
129  | 
|
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
130  | 
(*spec (20)*)  | 
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
131  | 
alloc_progress :: "'a allocState_d program set"  | 
| 
11194
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
132  | 
"alloc_progress ==  | 
| 
32960
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
133  | 
Increasing ask Int Increasing rel Int  | 
| 14114 | 134  | 
         Always {s. \<forall>elt \<in> set (ask s). elt \<le> NbT}
 | 
| 
11194
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
135  | 
Int  | 
| 14114 | 136  | 
         (\<Inter>h. {s. h \<le> giv s & h pfixGe (ask s)}
 | 
| 
32960
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
137  | 
LeadsTo  | 
| 
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
138  | 
                 {s. tokens h \<le> tokens (rel s)})
 | 
| 14114 | 139  | 
         guarantees  (\<Inter>h. {s. h \<le> ask s} LeadsTo {s. h pfixLe giv s})"
 | 
| 
11194
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
140  | 
|
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
141  | 
(*spec: preserves part*)  | 
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
142  | 
alloc_preserves :: "'a allocState_d program set"  | 
| 
11194
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
143  | 
"alloc_preserves == preserves rel Int  | 
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
144  | 
preserves ask Int  | 
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
145  | 
preserves allocState_d.dummy"  | 
| 14114 | 146  | 
|
| 
11194
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
147  | 
|
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
148  | 
(*environmental constraints*)  | 
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
149  | 
alloc_allowed_acts :: "'a allocState_d program set"  | 
| 
11194
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
150  | 
"alloc_allowed_acts ==  | 
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
151  | 
       {F. AllowedActs F = insert Id (UNION (preserves giv) Acts)}"
 | 
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
152  | 
|
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
153  | 
alloc_spec :: "'a allocState_d program set"  | 
| 
11194
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
154  | 
"alloc_spec == alloc_increasing Int alloc_safety Int alloc_progress Int  | 
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
155  | 
alloc_allowed_acts Int alloc_preserves"  | 
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
156  | 
|
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
157  | 
locale Merge =  | 
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
158  | 
  fixes M :: "('a,'b::order) merge_d program"
 | 
| 
11194
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
159  | 
assumes  | 
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
160  | 
Merge_spec: "M \<in> merge_spec"  | 
| 
11194
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
161  | 
|
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
162  | 
locale Distrib =  | 
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
163  | 
  fixes D :: "('a,'b::order) distr_d program"
 | 
| 
11194
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
164  | 
assumes  | 
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
165  | 
Distrib_spec: "D \<in> distr_spec"  | 
| 
11194
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
166  | 
|
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
167  | 
|
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
168  | 
(****  | 
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
169  | 
#  {** Network specification ***}
 | 
| 
11194
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
170  | 
|
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
171  | 
#    {*spec (9.1)*}
 | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
172  | 
# network_ask :: "'a systemState program set  | 
| 
32960
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
173  | 
# "network_ask == \<Inter>i \<in> lessThan Nclients.  | 
| 
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
174  | 
# Increasing (ask o sub i o client)  | 
| 
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
175  | 
# guarantees[ask]  | 
| 
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
176  | 
# (ask Fols (ask o sub i o client))"  | 
| 
11194
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
177  | 
|
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
178  | 
#    {*spec (9.2)*}
 | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
179  | 
# network_giv :: "'a systemState program set  | 
| 
32960
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
180  | 
# "network_giv == \<Inter>i \<in> lessThan Nclients.  | 
| 
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
181  | 
# Increasing giv  | 
| 
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
182  | 
# guarantees[giv o sub i o client]  | 
| 
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
183  | 
# ((giv o sub i o client) Fols giv)"  | 
| 
11194
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
184  | 
|
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
185  | 
#    {*spec (9.3)*}
 | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
186  | 
# network_rel :: "'a systemState program set  | 
| 
32960
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
187  | 
# "network_rel == \<Inter>i \<in> lessThan Nclients.  | 
| 
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
188  | 
# Increasing (rel o sub i o client)  | 
| 
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
189  | 
# guarantees[rel]  | 
| 
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
190  | 
# (rel Fols (rel o sub i o client))"  | 
| 
11194
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
191  | 
|
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
192  | 
#    {*spec: preserves part*}
 | 
| 
32960
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
193  | 
# network_preserves :: "'a systemState program set  | 
| 
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
194  | 
# "network_preserves == preserves giv Int  | 
| 
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
195  | 
# (\<Inter>i \<in> lessThan Nclients.  | 
| 
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
196  | 
# preserves (funPair rel ask o sub i o client))"  | 
| 
11194
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
197  | 
|
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
198  | 
# network_spec :: "'a systemState program set  | 
| 
32960
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
199  | 
# "network_spec == network_ask Int network_giv Int  | 
| 
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
200  | 
# network_rel Int network_preserves"  | 
| 
11194
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
201  | 
|
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
202  | 
|
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
203  | 
#  {** State mappings **}
 | 
| 
11194
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
204  | 
# sysOfAlloc :: "((nat => merge) * 'a) allocState_d => 'a systemState"  | 
| 
32960
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
205  | 
# "sysOfAlloc == %s. let (cl,xtr) = allocState_d.dummy s  | 
| 
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
206  | 
# in (| giv = giv s,  | 
| 
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
207  | 
# ask = ask s,  | 
| 
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
208  | 
# rel = rel s,  | 
| 
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
209  | 
# client = cl,  | 
| 
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
210  | 
# dummy = xtr|)"  | 
| 
11194
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
211  | 
|
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
212  | 
|
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
213  | 
# sysOfClient :: "(nat => merge) * 'a allocState_d => 'a systemState"  | 
| 
32960
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
214  | 
# "sysOfClient == %(cl,al). (| giv = giv al,  | 
| 
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
215  | 
# ask = ask al,  | 
| 
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
216  | 
# rel = rel al,  | 
| 
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
217  | 
# client = cl,  | 
| 
 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 
wenzelm 
parents: 
16417 
diff
changeset
 | 
218  | 
# systemState.dummy = allocState_d.dummy al|)"  | 
| 
11194
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
219  | 
****)  | 
| 
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
220  | 
|
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
221  | 
|
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
222  | 
declare subset_preserves_o [THEN subsetD, intro]  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
223  | 
declare funPair_o_distrib [simp]  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
224  | 
declare Always_INT_distrib [simp]  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
225  | 
declare o_apply [simp del]  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
226  | 
|
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
227  | 
|
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
228  | 
subsection{*Theorems for Merge*}
 | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
229  | 
|
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
230  | 
lemma (in Merge) Merge_Allowed:  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
231  | 
"Allowed M = (preserves merge.Out) Int (preserves merge.iOut)"  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
232  | 
apply (cut_tac Merge_spec)  | 
| 14114 | 233  | 
apply (auto simp add: merge_spec_def merge_allowed_acts_def Allowed_def  | 
234  | 
safety_prop_Acts_iff)  | 
|
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
235  | 
done  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
236  | 
|
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
237  | 
lemma (in Merge) M_ok_iff [iff]:  | 
| 14114 | 238  | 
"M ok G = (G \<in> preserves merge.Out & G \<in> preserves merge.iOut &  | 
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
239  | 
M \<in> Allowed G)"  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
240  | 
by (auto simp add: Merge_Allowed ok_iff_Allowed)  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
241  | 
|
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
242  | 
|
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
243  | 
lemma (in Merge) Merge_Always_Out_eq_iOut:  | 
| 14114 | 244  | 
"[| G \<in> preserves merge.Out; G \<in> preserves merge.iOut; M \<in> Allowed G |]  | 
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
245  | 
      ==> M Join G \<in> Always {s. length (merge.Out s) = length (merge.iOut s)}"
 | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
246  | 
apply (cut_tac Merge_spec)  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
247  | 
apply (force dest: guaranteesD simp add: merge_spec_def merge_eqOut_def)  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
248  | 
done  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
249  | 
|
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
250  | 
lemma (in Merge) Merge_Bounded:  | 
| 14114 | 251  | 
"[| G \<in> preserves merge.iOut; G \<in> preserves merge.Out; M \<in> Allowed G |]  | 
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
252  | 
      ==> M Join G \<in> Always {s. \<forall>elt \<in> set (merge.iOut s). elt < Nclients}"
 | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
253  | 
apply (cut_tac Merge_spec)  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
254  | 
apply (force dest: guaranteesD simp add: merge_spec_def merge_bounded_def)  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
255  | 
done  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
256  | 
|
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
257  | 
lemma (in Merge) Merge_Bag_Follows_lemma:  | 
| 14114 | 258  | 
"[| G \<in> preserves merge.iOut; G \<in> preserves merge.Out; M \<in> Allowed G |]  | 
259  | 
==> M Join G \<in> Always  | 
|
260  | 
          {s. (\<Sum>i \<in> lessThan Nclients. bag_of (sublist (merge.Out s)
 | 
|
261  | 
                                  {k. k < length (iOut s) & iOut s ! k = i})) =
 | 
|
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
262  | 
(bag_of o merge.Out) s}"  | 
| 14114 | 263  | 
apply (rule Always_Compl_Un_eq [THEN iffD1])  | 
264  | 
apply (blast intro: Always_Int_I [OF Merge_Always_Out_eq_iOut Merge_Bounded])  | 
|
265  | 
apply (rule UNIV_AlwaysI, clarify)  | 
|
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
266  | 
apply (subst bag_of_sublist_UN_disjoint [symmetric])  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
267  | 
apply (simp)  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
268  | 
apply blast  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
269  | 
apply (simp add: set_conv_nth)  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
270  | 
apply (subgoal_tac  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
271  | 
       "(\<Union>i \<in> lessThan Nclients. {k. k < length (iOut x) & iOut x ! k = i}) =
 | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
272  | 
lessThan (length (iOut x))")  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
273  | 
apply (simp (no_asm_simp) add: o_def)  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
274  | 
apply blast  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
275  | 
done  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
276  | 
|
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
277  | 
lemma (in Merge) Merge_Bag_Follows:  | 
| 14114 | 278  | 
"M \<in> (\<Inter>i \<in> lessThan Nclients. Increasing (sub i o merge.In))  | 
279  | 
guarantees  | 
|
280  | 
(bag_of o merge.Out) Fols  | 
|
281  | 
(%s. \<Sum>i \<in> lessThan Nclients. (bag_of o sub i o merge.In) s)"  | 
|
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
282  | 
apply (rule Merge_Bag_Follows_lemma [THEN Always_Follows1, THEN guaranteesI], auto)  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
283  | 
apply (rule Follows_setsum)  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
284  | 
apply (cut_tac Merge_spec)  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
285  | 
apply (auto simp add: merge_spec_def merge_follows_def o_def)  | 
| 14114 | 286  | 
apply (drule guaranteesD)  | 
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
287  | 
prefer 3  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
288  | 
apply (best intro: mono_bag_of [THEN mono_Follows_apply, THEN subsetD], auto)  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
289  | 
done  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
290  | 
|
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
291  | 
|
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
292  | 
subsection{*Theorems for Distributor*}
 | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
293  | 
|
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
294  | 
lemma (in Distrib) Distr_Increasing_Out:  | 
| 14114 | 295  | 
"D \<in> Increasing distr.In Int Increasing distr.iIn Int  | 
296  | 
          Always {s. \<forall>elt \<in> set (distr.iIn s). elt < Nclients}
 | 
|
297  | 
guarantees  | 
|
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
298  | 
(\<Inter>i \<in> lessThan Nclients. Increasing (sub i o distr.Out))"  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
299  | 
apply (cut_tac Distrib_spec)  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
300  | 
apply (simp add: distr_spec_def distr_follows_def)  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
301  | 
apply clarify  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
302  | 
apply (blast intro: guaranteesI Follows_Increasing1 dest: guaranteesD)  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
303  | 
done  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
304  | 
|
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
305  | 
lemma (in Distrib) Distr_Bag_Follows_lemma:  | 
| 14114 | 306  | 
"[| G \<in> preserves distr.Out;  | 
307  | 
         D Join G \<in> Always {s. \<forall>elt \<in> set (distr.iIn s). elt < Nclients} |]
 | 
|
308  | 
==> D Join G \<in> Always  | 
|
309  | 
          {s. (\<Sum>i \<in> lessThan Nclients. bag_of (sublist (distr.In s)
 | 
|
310  | 
                                  {k. k < length (iIn s) & iIn s ! k = i})) =
 | 
|
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
311  | 
bag_of (sublist (distr.In s) (lessThan (length (iIn s))))}"  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
312  | 
apply (erule Always_Compl_Un_eq [THEN iffD1])  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
313  | 
apply (rule UNIV_AlwaysI, clarify)  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
314  | 
apply (subst bag_of_sublist_UN_disjoint [symmetric])  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
315  | 
apply (simp (no_asm))  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
316  | 
apply blast  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
317  | 
apply (simp add: set_conv_nth)  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
318  | 
apply (subgoal_tac  | 
| 14114 | 319  | 
       "(\<Union>i \<in> lessThan Nclients. {k. k < length (iIn x) & iIn x ! k = i}) =
 | 
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
320  | 
lessThan (length (iIn x))")  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
321  | 
apply (simp (no_asm_simp))  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
322  | 
apply blast  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
323  | 
done  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
324  | 
|
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
325  | 
lemma (in Distrib) D_ok_iff [iff]:  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
326  | 
"D ok G = (G \<in> preserves distr.Out & D \<in> Allowed G)"  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
327  | 
apply (cut_tac Distrib_spec)  | 
| 14114 | 328  | 
apply (auto simp add: distr_spec_def distr_allowed_acts_def Allowed_def  | 
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
329  | 
safety_prop_Acts_iff ok_iff_Allowed)  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
330  | 
done  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
331  | 
|
| 14114 | 332  | 
lemma (in Distrib) Distr_Bag_Follows:  | 
333  | 
"D \<in> Increasing distr.In Int Increasing distr.iIn Int  | 
|
334  | 
      Always {s. \<forall>elt \<in> set (distr.iIn s). elt < Nclients}
 | 
|
335  | 
guarantees  | 
|
336  | 
(\<Inter>i \<in> lessThan Nclients.  | 
|
337  | 
(%s. \<Sum>i \<in> lessThan Nclients. (bag_of o sub i o distr.Out) s)  | 
|
338  | 
Fols  | 
|
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
339  | 
(%s. bag_of (sublist (distr.In s) (lessThan (length(distr.iIn s))))))"  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
340  | 
apply (rule guaranteesI, clarify)  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
341  | 
apply (rule Distr_Bag_Follows_lemma [THEN Always_Follows2], auto)  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
342  | 
apply (rule Follows_setsum)  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
343  | 
apply (cut_tac Distrib_spec)  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
344  | 
apply (auto simp add: distr_spec_def distr_follows_def o_def)  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
345  | 
apply (drule guaranteesD)  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
346  | 
prefer 3  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
347  | 
apply (best intro: mono_bag_of [THEN mono_Follows_apply, THEN subsetD], auto)  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
348  | 
done  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
349  | 
|
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
350  | 
|
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
351  | 
subsection{*Theorems for Allocator*}
 | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
352  | 
|
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
353  | 
lemma alloc_refinement_lemma:  | 
| 14114 | 354  | 
     "!!f::nat=>nat. (\<Inter>i \<in> lessThan n. {s. f i \<le> g i s})
 | 
| 15074 | 355  | 
      \<subseteq> {s. (SUM x: lessThan n. f x) \<le> (SUM x: lessThan n. g x s)}"
 | 
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
356  | 
apply (induct_tac "n")  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
357  | 
apply (auto simp add: lessThan_Suc)  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
358  | 
done  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
359  | 
|
| 14114 | 360  | 
lemma alloc_refinement:  | 
361  | 
"(\<Inter>i \<in> lessThan Nclients. Increasing (sub i o allocAsk) Int  | 
|
362  | 
Increasing (sub i o allocRel))  | 
|
363  | 
Int  | 
|
364  | 
  Always {s. \<forall>i. i<Nclients -->
 | 
|
365  | 
(\<forall>elt \<in> set ((sub i o allocAsk) s). elt \<le> NbT)}  | 
|
366  | 
Int  | 
|
367  | 
(\<Inter>i \<in> lessThan Nclients.  | 
|
368  | 
   \<Inter>h. {s. h \<le> (sub i o allocGiv)s & h pfixGe (sub i o allocAsk)s}
 | 
|
369  | 
        LeadsTo {s. tokens h \<le> (tokens o sub i o allocRel)s})
 | 
|
370  | 
\<subseteq>  | 
|
371  | 
(\<Inter>i \<in> lessThan Nclients. Increasing (sub i o allocAsk) Int  | 
|
372  | 
Increasing (sub i o allocRel))  | 
|
373  | 
Int  | 
|
374  | 
  Always {s. \<forall>i. i<Nclients -->
 | 
|
375  | 
(\<forall>elt \<in> set ((sub i o allocAsk) s). elt \<le> NbT)}  | 
|
376  | 
Int  | 
|
377  | 
(\<Inter>hf. (\<Inter>i \<in> lessThan Nclients.  | 
|
378  | 
         {s. hf i \<le> (sub i o allocGiv)s & hf i pfixGe (sub i o allocAsk)s})
 | 
|
379  | 
  LeadsTo {s. (\<Sum>i \<in> lessThan Nclients. tokens (hf i)) \<le>
 | 
|
380  | 
(\<Sum>i \<in> lessThan Nclients. (tokens o sub i o allocRel)s)})"  | 
|
| 
14089
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
381  | 
apply (auto simp add: ball_conj_distrib)  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
382  | 
apply (rename_tac F hf)  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
383  | 
apply (rule LeadsTo_weaken_R [OF Finite_stable_completion alloc_refinement_lemma], blast, blast)  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
384  | 
apply (subgoal_tac "F \<in> Increasing (tokens o (sub i o allocRel))")  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
385  | 
apply (simp add: Increasing_def o_assoc)  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
386  | 
apply (blast intro: mono_tokens [THEN mono_Increasing_o, THEN subsetD])  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
387  | 
done  | 
| 
 
7b34f58b1b81
converted UNITY/Comp/{AllocImpl,Client} to Isar scripts
 
paulson 
parents: 
11194 
diff
changeset
 | 
388  | 
|
| 
11194
 
ea13ff5a26d1
reorganization of HOL/UNITY, moving examples to subdirectories Simple and Comp
 
paulson 
parents:  
diff
changeset
 | 
389  | 
end  |