| 3807 |      1 | (* 
 | 
|  |      2 |     File:        RPC.ML
 | 
|  |      3 |     Author:      Stephan Merz
 | 
|  |      4 |     Copyright:   1997 University of Munich
 | 
|  |      5 | 
 | 
| 6255 |      6 |     RPC-Memory example: RPC specification (theorems and proofs)
 | 
| 3807 |      7 | *)
 | 
|  |      8 | 
 | 
| 6255 |      9 | val RPC_action_defs = [RPCInit_def, RPCFwd_def, RPCReject_def, RPCFail_def, 
 | 
|  |     10 |                        RPCReply_def, RPCNext_def];
 | 
| 3807 |     11 | 
 | 
|  |     12 | val RPC_temp_defs = [RPCIPSpec_def, RPCISpec_def];
 | 
|  |     13 | 
 | 
| 6255 |     14 | val mem_css = (claset(), simpset());
 | 
|  |     15 | 
 | 
| 3807 |     16 | (* The RPC component engages in an action for process p only if there is an outstanding,
 | 
|  |     17 |    unanswered call for that process.
 | 
|  |     18 | *)
 | 
|  |     19 | 
 | 
|  |     20 | qed_goal "RPCidle" RPC.thy
 | 
| 6255 |     21 |    "|- ~$(Calling send p) --> ~RPCNext send rcv rst p"
 | 
|  |     22 |    (fn _ => [ auto_tac (mem_css addsimps2 (Return_def::RPC_action_defs)) ]);
 | 
| 3807 |     23 | 
 | 
|  |     24 | qed_goal "RPCbusy" RPC.thy
 | 
| 6255 |     25 |    "|- $(Calling rcv p) & $(rst!p) = #rpcB --> ~RPCNext send rcv rst p"
 | 
|  |     26 |    (fn _ => [ auto_tac (mem_css addsimps2 RPC_action_defs) ]);
 | 
| 3807 |     27 | 
 | 
|  |     28 | (* RPC failure actions are visible. *)
 | 
|  |     29 | qed_goal "RPCFail_vis" RPC.thy
 | 
| 6255 |     30 |    "|- RPCFail send rcv rst p --> \
 | 
|  |     31 | \      <RPCNext send rcv rst p>_(rst!p, rtrner send!p, caller rcv!p)"
 | 
|  |     32 |    (fn _ => [auto_tac (claset() addSDs [Return_changed],
 | 
| 4089 |     33 | 		       simpset() addsimps [angle_def,RPCNext_def,RPCFail_def])
 | 
| 3807 |     34 | 	    ]);
 | 
|  |     35 | 
 | 
|  |     36 | qed_goal "RPCFail_Next_enabled" RPC.thy
 | 
| 6255 |     37 |    "|- Enabled (RPCFail send rcv rst p) --> \
 | 
|  |     38 | \      Enabled (<RPCNext send rcv rst p>_(rst!p, rtrner send!p, caller rcv!p))"
 | 
|  |     39 |    (fn _ => [force_tac (mem_css addSEs2 [enabled_mono,RPCFail_vis]) 1]);
 | 
| 3807 |     40 | 
 | 
|  |     41 | (* Enabledness of some actions *)
 | 
|  |     42 | 
 | 
|  |     43 | qed_goal "RPCFail_enabled" RPC.thy
 | 
| 6255 |     44 |    "!!p. basevars (rtrner send!p, caller rcv!p, rst!p) ==> \
 | 
|  |     45 | \        |- ~Calling rcv p & Calling send p --> Enabled (RPCFail send rcv rst p)"
 | 
| 4089 |     46 |    (fn _ => [action_simp_tac (simpset() addsimps [RPCFail_def,Return_def,caller_def,rtrner_def])
 | 
| 7881 |     47 |                              [exI] [base_enabled,Pair_inject] 1
 | 
| 3807 |     48 | 	    ]);
 | 
|  |     49 | 
 | 
|  |     50 | qed_goal "RPCReply_enabled" RPC.thy
 | 
| 6255 |     51 |    "!!p. basevars (rtrner send!p, caller rcv!p, rst!p) ==> \
 | 
|  |     52 | \        |- ~Calling rcv p & Calling send p & rst!p = #rpcB \
 | 
|  |     53 | \           --> Enabled (RPCReply send rcv rst p)"
 | 
| 4089 |     54 |    (fn _ => [action_simp_tac (simpset() addsimps [RPCReply_def,Return_def,caller_def,rtrner_def])
 | 
| 7881 |     55 |                              [exI] [base_enabled,Pair_inject] 1]);
 | 
| 3807 |     56 | 
 |