41 |
41 |
42 record 'a clientState_u = |
42 record 'a clientState_u = |
43 clientState + |
43 clientState + |
44 extra :: 'a (*dummy field for new variables*) |
44 extra :: 'a (*dummy field for new variables*) |
45 |
45 |
46 consts |
46 constdefs |
47 rClient :: "(clientState * 'a) program" (*DUMMY CONSTANT*) |
47 (*DUPLICATED FROM Client.thy, but with "tok" removed*) |
48 |
48 (*Maybe want a special theory section to declare such maps*) |
|
49 non_extra :: 'a clientState_u => clientState |
|
50 "non_extra s == (|giv = giv s, ask = ask s, rel = rel s|)" |
|
51 |
|
52 (*Renaming map to put a Client into the standard form*) |
|
53 client_map :: "'a clientState_u => clientState*'a" |
|
54 "client_map == funPair non_extra extra" |
|
55 |
|
56 |
49 record allocState = |
57 record allocState = |
50 allocGiv :: nat => nat list (*OUTPUT history: source of "giv" for i*) |
58 allocGiv :: nat => nat list (*OUTPUT history: source of "giv" for i*) |
51 allocAsk :: nat => nat list (*INPUT: allocator's copy of "ask" for i*) |
59 allocAsk :: nat => nat list (*INPUT: allocator's copy of "ask" for i*) |
52 allocRel :: nat => nat list (*INPUT: allocator's copy of "rel" for i*) |
60 allocRel :: nat => nat list (*INPUT: allocator's copy of "rel" for i*) |
53 |
61 |
103 (INT h. {s. h <= giv s & h pfixGe ask s} |
111 (INT h. {s. h <= giv s & h pfixGe ask s} |
104 LeadsTo {s. tokens h <= (tokens o rel) s})" |
112 LeadsTo {s. tokens h <= (tokens o rel) s})" |
105 |
113 |
106 (*spec: preserves part*) |
114 (*spec: preserves part*) |
107 client_preserves :: 'a clientState_u program set |
115 client_preserves :: 'a clientState_u program set |
108 "client_preserves == preserves giv" |
116 "client_preserves == preserves (funPair giv clientState_u.extra)" |
109 |
117 |
110 client_spec :: 'a clientState_u program set |
118 client_spec :: 'a clientState_u program set |
111 "client_spec == client_increasing Int client_bounded Int client_progress |
119 "client_spec == client_increasing Int client_bounded Int client_progress |
112 Int client_preserves" |
120 Int client_preserves" |
113 |
121 |
147 LeadsTo |
155 LeadsTo |
148 {s. h pfixLe (sub i o allocGiv) s})" |
156 {s. h pfixLe (sub i o allocGiv) s})" |
149 |
157 |
150 (*spec: preserves part*) |
158 (*spec: preserves part*) |
151 alloc_preserves :: 'a allocState_u program set |
159 alloc_preserves :: 'a allocState_u program set |
152 "alloc_preserves == preserves (funPair allocRel allocAsk)" |
160 "alloc_preserves == preserves (funPair allocRel |
|
161 (funPair allocAsk allocState_u.extra))" |
153 |
162 |
154 alloc_spec :: 'a allocState_u program set |
163 alloc_spec :: 'a allocState_u program set |
155 "alloc_spec == alloc_increasing Int alloc_safety Int alloc_progress Int |
164 "alloc_spec == alloc_increasing Int alloc_safety Int alloc_progress Int |
156 alloc_preserves" |
165 alloc_preserves" |
157 |
166 |
204 allocAsk = allocAsk al, |
213 allocAsk = allocAsk al, |
205 allocRel = allocRel al, |
214 allocRel = allocRel al, |
206 client = cl, |
215 client = cl, |
207 systemState.extra = allocState_u.extra al|)" |
216 systemState.extra = allocState_u.extra al|)" |
208 |
217 |
209 |
218 consts |
|
219 Alloc :: 'a allocState_u program |
|
220 Client :: 'a clientState_u program |
|
221 Network :: 'a systemState program |
|
222 System :: 'a systemState program |
|
223 |
|
224 rules |
|
225 Alloc "Alloc : alloc_spec" |
|
226 Client "Client : client_spec" |
|
227 Network "Network : network_spec" |
|
228 |
|
229 defs |
|
230 System_def |
|
231 "System == rename sysOfAlloc Alloc Join Network Join |
|
232 (rename sysOfClient |
|
233 (plam x: lessThan Nclients. rename client_map Client))" |
|
234 |
|
235 |
|
236 (** |
210 locale System = |
237 locale System = |
211 fixes |
238 fixes |
212 Alloc :: 'a allocState program |
239 Alloc :: 'a allocState_u program |
213 Client :: clientState program |
240 Client :: 'a clientState_u program |
214 Network :: 'a systemState program |
241 Network :: 'a systemState program |
215 System :: 'a systemState program |
242 System :: 'a systemState program |
216 |
243 |
217 assumes |
244 assumes |
218 Alloc "Alloc : alloc_spec" |
245 Alloc "Alloc : alloc_spec" |
219 Client "Client : client_spec" |
246 Client "Client : client_spec" |
220 Network "Network : network_spec" |
247 Network "Network : network_spec" |
221 |
248 |
222 defines |
249 defines |
223 System_def |
250 System_def |
224 "System == rename sysOfAlloc Alloc Join Network Join |
251 "System == rename sysOfAlloc Alloc |
225 (rename sysOfClient (plam x: lessThan Nclients. Client))" |
252 Join |
226 |
253 Network |
|
254 Join |
|
255 (rename sysOfClient |
|
256 (plam x: lessThan Nclients. rename client_map Client))" |
|
257 **) |
227 |
258 |
228 |
259 |
229 end |
260 end |