5252
|
1 |
(* Title: HOL/UNITY/Handshake
|
|
2 |
ID: $Id$
|
|
3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory
|
|
4 |
Copyright 1998 University of Cambridge
|
|
5 |
|
|
6 |
Handshake Protocol
|
|
7 |
|
|
8 |
From Misra, "Asynchronous Compositions of Programs", Section 5.3.2
|
|
9 |
*)
|
|
10 |
|
|
11 |
(*split_all_tac causes a big blow-up*)
|
|
12 |
claset_ref() := claset() delSWrapper "split_all_tac";
|
|
13 |
|
|
14 |
(*Simplification for records*)
|
|
15 |
Addsimps (thms"state.update_defs");
|
|
16 |
Addsimps [invFG_def];
|
|
17 |
|
|
18 |
|
|
19 |
Goalw [prgF_def, Join_def] "id : Acts (Join prgF prgG) ";
|
|
20 |
by (Simp_tac 1);
|
|
21 |
qed "id_in_Acts";
|
|
22 |
AddIffs [id_in_Acts];
|
|
23 |
|
|
24 |
|
|
25 |
Goalw [prgF_def, prgG_def] "invariant (Join prgF prgG) invFG";
|
|
26 |
by (rtac invariantI 1);
|
|
27 |
by (force_tac (claset(),
|
|
28 |
simpset() addsimps [Join_def]) 1);
|
|
29 |
by (auto_tac (claset(), simpset() addsimps [stable_Join]));
|
|
30 |
by (constrains_tac [prgG_def,cmdG_def] 2);
|
|
31 |
by (auto_tac (claset() addIs [le_anti_sym] addSEs [le_SucE], simpset()));
|
|
32 |
by (constrains_tac [prgF_def,cmdF_def] 1);
|
|
33 |
qed "invFG";
|
|
34 |
|
|
35 |
Goal "LeadsTo (Join prgF prgG) {s. NF s = k & ~ BB s} {s. NF s = k & BB s}";
|
|
36 |
br (ensures_stable_Join1 RS leadsTo_Basis RS leadsTo_imp_LeadsTo) 1;
|
|
37 |
by (ensures_tac [prgG_def,cmdG_def] "cmdG" 2);
|
|
38 |
by (constrains_tac [prgF_def,cmdF_def] 1);
|
|
39 |
qed "lemma2_1";
|
|
40 |
|
|
41 |
Goal "LeadsTo (Join prgF prgG) {s. NF s = k & BB s} {s. k < NF s}";
|
|
42 |
br (ensures_stable_Join2 RS leadsTo_Basis RS leadsTo_imp_LeadsTo) 1;
|
|
43 |
by (constrains_tac [prgG_def,cmdG_def] 2);
|
|
44 |
by (ensures_tac [prgF_def,cmdF_def] "cmdF" 1);
|
|
45 |
qed "lemma2_2";
|
|
46 |
|
|
47 |
|
|
48 |
Goal "LeadsTo (Join prgF prgG) {s. NF s = k} {s. k < NF s}";
|
|
49 |
br LeadsTo_Diff 1;
|
|
50 |
br lemma2_2 2;
|
|
51 |
br LeadsTo_Trans 1;
|
|
52 |
br lemma2_2 2;
|
|
53 |
br (lemma2_1 RS LeadsTo_weaken_L) 1;
|
|
54 |
by Auto_tac;
|
|
55 |
val lemma = result();
|
|
56 |
|
|
57 |
|
|
58 |
Goal "LeadsTo (Join prgF prgG) UNIV {s. m < NF s}";
|
|
59 |
by (res_inst_tac [("f", "NF")] R_lessThan_induct 1);
|
|
60 |
auto();
|
|
61 |
br (lemma RS LeadsTo_weaken) 1;
|
|
62 |
auto();
|