41589
|
1 |
(* Title: HOL/TLA/Memory/MemClerkParameters.thy
|
|
2 |
Author: Stephan Merz, University of Munich
|
21624
|
3 |
*)
|
3807
|
4 |
|
21624
|
5 |
header {* RPC-Memory example: Parameters of the memory clerk *}
|
3807
|
6 |
|
17309
|
7 |
theory MemClerkParameters
|
|
8 |
imports RPCParameters
|
|
9 |
begin
|
3807
|
10 |
|
17309
|
11 |
datatype mClkState = clkA | clkB
|
3807
|
12 |
|
|
13 |
types
|
|
14 |
(* types sent on the clerk's send and receive channels are argument types
|
|
15 |
of the memory and the RPC, respectively *)
|
6255
|
16 |
mClkSndArgType = "memOp"
|
|
17 |
mClkRcvArgType = "rpcOp"
|
3807
|
18 |
|
36866
|
19 |
definition
|
3807
|
20 |
(* translate a memory call to an RPC call *)
|
6255
|
21 |
MClkRelayArg :: "memOp => rpcOp"
|
36866
|
22 |
where "MClkRelayArg marg = memcall marg"
|
|
23 |
|
|
24 |
definition
|
3807
|
25 |
(* translate RPC failures to memory failures *)
|
|
26 |
MClkReplyVal :: "Vals => Vals"
|
36866
|
27 |
where "MClkReplyVal v = (if v = RPCFailure then MemFailure else v)"
|
3807
|
28 |
|
|
29 |
end
|