author | paulson |
Thu, 06 Aug 1998 15:47:26 +0200 | |
changeset 5277 | e4297d03e5d2 |
parent 5258 | d1c0504d6c42 |
child 5313 | 1861a564d7e2 |
permissions | -rw-r--r-- |
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 |
||
5258 | 48 |
Goal "LeadsTo (Join prgF prgG) UNIV {s. m < NF s}"; |
49 |
br LeadsTo_weaken_R 1; |
|
50 |
by (res_inst_tac [("f", "NF"), ("l","Suc m"), ("B","{}")] |
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
5258
diff
changeset
|
51 |
GreaterThan_bounded_induct 1); |
5258 | 52 |
by (auto_tac (claset(), simpset() addsimps [vimage_def])); |
53 |
by (trans_tac 2); |
|
54 |
(*The inductive step: LeadsTo (Join prgF prgG) {x. NF x = ma} {x. ma < NF x}*) |
|
5252 | 55 |
br LeadsTo_Diff 1; |
56 |
br lemma2_2 2; |
|
57 |
br LeadsTo_Trans 1; |
|
58 |
br lemma2_2 2; |
|
59 |
br (lemma2_1 RS LeadsTo_weaken_L) 1; |
|
60 |
by Auto_tac; |
|
5258 | 61 |
qed "progress"; |