6828
|
1 |
(* Title: HOL/UNITY/Alloc
|
|
2 |
ID: $Id$
|
|
3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory
|
|
4 |
Copyright 1998 University of Cambridge
|
|
5 |
|
|
6 |
Specification of Chandy and Charpentier's Allocator
|
|
7 |
*)
|
|
8 |
|
6837
|
9 |
|
6840
|
10 |
(*Generalized version allowing different clients*)
|
|
11 |
Goal "[| Alloc : alloc_spec; \
|
|
12 |
\ Client : (lessThan Nclients) funcset client_spec; \
|
|
13 |
\ Network : network_spec |] \
|
|
14 |
\ ==> (extend sysOfAlloc Alloc) \
|
|
15 |
\ Join (extend sysOfClient (PLam (lessThan Nclients) Client)) \
|
|
16 |
\ Join Network : system_spec";
|
|
17 |
|
|
18 |
Goal "System : system_spec";
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
|
6828
|
23 |
Goalw [sysOfAlloc_def] "inj sysOfAlloc";
|
|
24 |
by (rtac injI 1);
|
|
25 |
by Auto_tac;
|
|
26 |
qed "inj_sysOfAlloc";
|
|
27 |
|
|
28 |
Goalw [sysOfAlloc_def] "surj sysOfAlloc";
|
|
29 |
by (res_inst_tac [("f", "%s. ((| allocGiv = allocGiv s, \
|
|
30 |
\ allocAsk = allocAsk s, \
|
|
31 |
\ allocRel = allocRel s |), \
|
|
32 |
\ client s)")] surjI 1);
|
|
33 |
by Auto_tac;
|
|
34 |
qed "surj_sysOfAlloc";
|
|
35 |
|
|
36 |
AddIffs [inj_sysOfAlloc, surj_sysOfAlloc];
|
|
37 |
|
|
38 |
|
|
39 |
Open_locale "System";
|
|
40 |
|
|
41 |
val Alloc = thm "Alloc";
|
|
42 |
val Client = thm "Client";
|
|
43 |
val Network = thm "Network";
|
|
44 |
val System_def = thm "System_def";
|
|
45 |
|
|
46 |
AddIffs [finite_lessThan];
|
|
47 |
|
|
48 |
|
|
49 |
|
|
50 |
Goal "i < Nclients ==> \
|
6837
|
51 |
\ lift_prog i Client : UNIV guar Increasing (rel o sub i)";
|
|
52 |
|
|
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
|
57 |
|
|
58 |
|
|
59 |
|
|
60 |
by (stac Acts_eq 1);
|
|
61 |
|
|
62 |
fr conjI;
|
|
63 |
by (Clarify_tac 1);
|
|
64 |
by (stac Init_eq 1);
|
|
65 |
|
|
66 |
|
|
67 |
{GX. EX G:X. lift_prog i G component GX}
|
|
68 |
{GY. EX G:Y. lift_prog i G component GY}
|
|
69 |
|
|
70 |
|
|
71 |
|
|
72 |
uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu;
|
|
73 |
|
6828
|
74 |
|
|
75 |
|
|
76 |
|
|
77 |
Goal "i < Nclients ==> System : Increasing (sub i o allocRel)";
|
|
78 |
by (cut_facts_tac [Client] 1);
|
|
79 |
by (full_simp_tac
|
|
80 |
(simpset() addsimps [System_def,
|
|
81 |
client_spec_def, client_increasing_def,
|
|
82 |
guarantees_Int_right]) 1);
|
|
83 |
by Auto_tac;
|
|
84 |
by (dtac lift_prog_guarantees 1);
|
|
85 |
by (dtac (UNIV_I RSN (2, guaranteesD)) 1);
|
|
86 |
back();
|
6840
|
87 |
by (dtac (lessThan_iff RS iffD2 RS const_PLam_Increasing RS iffD2) 1);
|
6828
|
88 |
by Auto_tac;
|
|
89 |
|
|
90 |
|
6840
|
91 |
by (full_simp_tac (simpset() addsimps [read_instantiate [("f1","rel"),("I1","lessThan Nclients")] (const_PLam_Increasing RS sym)]) 1);
|
6828
|
92 |
|
6840
|
93 |
yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy;
|
6828
|
94 |
|
|
95 |
|
|
96 |
(*partial system...*)
|
|
97 |
Goal "[| Alloc : alloc_spec; Network : network_spec |] \
|
|
98 |
\ ==> (extend sysOfAlloc Alloc) Join Network : system_spec";
|
|
99 |
|
|
100 |
(*partial system...*)
|
|
101 |
Goal "[| Client : client_spec; Network : network_spec |] \
|
6840
|
102 |
\ ==> (extend sysOfClient (plam x: lessThan Nclients. Client)) \
|
6828
|
103 |
\ Join Network : system_spec";
|
|
104 |
|
|
105 |
|
|
106 |
|
|
107 |
Goal "[| Alloc : alloc_spec; Client : client_spec; \
|
|
108 |
\ Network : network_spec |] \
|
|
109 |
\ ==> (extend sysOfAlloc Alloc) \
|
6840
|
110 |
\ Join (extend sysOfClient (plam x: lessThan Nclients. Client)) \
|
6828
|
111 |
\ Join Network : system_spec";
|
|
112 |
by (full_simp_tac
|
|
113 |
(simpset() addsimps [system_spec_def, system_safety_def]) 1);
|
|
114 |
by Auto_tac;
|
|
115 |
by (full_simp_tac
|
|
116 |
(simpset() addsimps [client_spec_def, client_increasing_def,
|
|
117 |
guarantees_Int_right]) 1);
|
|
118 |
by Auto_tac;
|
|
119 |
by (dtac (UNIV_I RSN (2, guaranteesD)) 1);
|
|
120 |
back();
|
|
121 |
by (full_simp_tac
|
|
122 |
(simpset() addsimps [network_spec_def, network_rel_def]) 1);
|
|
123 |
|
|
124 |
by (subgoal_tac "" 1);
|
|
125 |
by (full_simp_tac
|
|
126 |
(simpset() addsimps [alloc_spec_def, alloc_safety_def]) 1);
|
|
127 |
by Auto_tac;
|
|
128 |
|
|
129 |
by (Simp_tac 1);
|