1 (* Title: HOL/TLA/Memory/RPCParameters.thy
2 Author: Stephan Merz, University of Munich
5 header {* RPC-Memory example: RPC parameters *}
8 imports MemoryParameters
12 For simplicity, specify the instance of RPC that is used in the
13 memory implementation.
16 datatype rpcOp = memcall memOp | othercall Vals
17 datatype rpcState = rpcA | rpcB
20 (* some particular return values *)
24 (* Translate an rpc call to a memory call and test if the current argument
25 is legal for the receiver (i.e., the memory). This can now be a little
26 simpler than for the generic RPC component. RelayArg returns an arbitrary
27 memory call for illegal arguments. *)
28 IsLegalRcvArg :: "rpcOp => bool"
29 RPCRelayArg :: "rpcOp => memOp"
32 (* RPCFailure is different from MemVals and exceptions *)
33 RFNoMemVal: "RPCFailure ~: MemVal"
34 NotAResultNotRF: "NotAResult ~= RPCFailure"
35 OKNotRF: "OK ~= RPCFailure"
36 BANotRF: "BadArg ~= RPCFailure"
39 IsLegalRcvArg_def: "IsLegalRcvArg ra ==
40 case ra of (memcall m) => True
41 | (othercall v) => False"
42 RPCRelayArg_def: "RPCRelayArg ra ==
43 case ra of (memcall m) => m
44 | (othercall v) => undefined"
46 lemmas [simp] = RFNoMemVal NotAResultNotRF OKNotRF BANotRF
47 NotAResultNotRF [symmetric] OKNotRF [symmetric] BANotRF [symmetric]