|
3807
|
1 |
(*
|
|
|
2 |
File: ProcedureInterface.ML
|
|
|
3 |
Author: Stephan Merz
|
|
|
4 |
Copyright: 1997 University of Munich
|
|
|
5 |
|
|
|
6 |
Procedure interface (ML file)
|
|
|
7 |
*)
|
|
|
8 |
|
|
|
9 |
Addsimps [slice_def];
|
|
|
10 |
|
|
|
11 |
(* ---------------------------------------------------------------------------- *)
|
|
|
12 |
|
|
|
13 |
val Procedure_defs = [caller_def, rtrner_def, action_rewrite Calling_def,
|
|
|
14 |
Call_def, Return_def,
|
|
|
15 |
PLegalCaller_def, LegalCaller_def,
|
|
|
16 |
PLegalReturner_def, LegalReturner_def];
|
|
|
17 |
|
|
|
18 |
(* sample theorems (not used in the proof):
|
|
|
19 |
1. calls and returns are mutually exclusive
|
|
|
20 |
|
|
|
21 |
qed_goal "CallReturnMutex" ProcedureInterface.thy
|
|
|
22 |
"Call ch p v .-> .~ Return ch p w"
|
|
|
23 |
(fn prems => [ auto_tac (action_css addsimps2 [Call_def,Return_def]) ]);
|
|
|
24 |
|
|
|
25 |
|
|
|
26 |
2. enabledness of calls and returns
|
|
|
27 |
NB: action_simp_tac is significantly faster than auto_tac
|
|
|
28 |
|
|
|
29 |
qed_goal "Call_enabled" ProcedureInterface.thy
|
|
|
30 |
"!!p. base_var ((caller ch)@p) ==> (.~ $(Calling ch p) .-> $(Enabled (Call ch p (#v))))"
|
|
4089
|
31 |
(fn _ => [action_simp_tac (simpset() addsimps [caller_def, Call_def])
|
|
3807
|
32 |
[] [base_enabled,Pair_inject] 1
|
|
|
33 |
]);
|
|
|
34 |
|
|
|
35 |
qed_goal "Return_enabled" ProcedureInterface.thy
|
|
|
36 |
"!!p. base_var ((rtrner ch)@p) ==> $(Calling ch p) .-> $(Enabled (Return ch p (#v)))"
|
|
4089
|
37 |
(fn _ => [action_simp_tac (simpset() addsimps [rtrner_def, Return_def])
|
|
3807
|
38 |
[] [base_enabled,Pair_inject] 1
|
|
|
39 |
]);
|
|
|
40 |
|
|
|
41 |
*)
|
|
|
42 |
|
|
|
43 |
(* Calls and returns change their subchannel *)
|
|
|
44 |
qed_goal "Call_changed" ProcedureInterface.thy
|
|
|
45 |
"Call ch p v .-> <Call ch p v>_((caller ch)@p)"
|
|
4089
|
46 |
(fn _ => [auto_tac (claset(),
|
|
|
47 |
simpset() addsimps [angle_def,Call_def,caller_def,
|
|
3807
|
48 |
action_rewrite Calling_def])
|
|
|
49 |
]);
|
|
|
50 |
|
|
|
51 |
qed_goal "Return_changed" ProcedureInterface.thy
|
|
|
52 |
"Return ch p v .-> <Return ch p v>_((rtrner ch)@p)"
|
|
4089
|
53 |
(fn _ => [auto_tac (claset(),
|
|
|
54 |
simpset() addsimps [angle_def,Return_def,rtrner_def,
|
|
3807
|
55 |
action_rewrite Calling_def])
|
|
|
56 |
]);
|
|
|
57 |
|
|
|
58 |
(* For convenience, generate elimination rules.
|
|
|
59 |
These rules loop if angle_def is active! *)
|
|
|
60 |
bind_thm("Call_changedE", action_impE Call_changed);
|
|
|
61 |
bind_thm("Return_changedE", action_impE Return_changed);
|
|
|
62 |
|