author | wenzelm |
Fri, 26 Jun 2015 11:44:22 +0200 | |
changeset 60587 | 0318b43ee95c |
parent 58889 | 5b7a9633cfa8 |
child 60588 | 750c533459b1 |
permissions | -rw-r--r-- |
41589 | 1 |
(* Title: HOL/TLA/Memory/RPCParameters.thy |
2 |
Author: Stephan Merz, University of Munich |
|
21624 | 3 |
*) |
3807 | 4 |
|
58889 | 5 |
section {* RPC-Memory example: RPC parameters *} |
3807 | 6 |
|
17309 | 7 |
theory RPCParameters |
8 |
imports MemoryParameters |
|
9 |
begin |
|
3807 | 10 |
|
21624 | 11 |
(* |
12 |
For simplicity, specify the instance of RPC that is used in the |
|
13 |
memory implementation. |
|
14 |
*) |
|
15 |
||
58310 | 16 |
datatype rpcOp = memcall memOp | othercall Vals |
17 |
datatype rpcState = rpcA | rpcB |
|
3807 | 18 |
|
19 |
consts |
|
20 |
(* some particular return values *) |
|
6255 | 21 |
RPCFailure :: Vals |
22 |
BadCall :: Vals |
|
3807 | 23 |
|
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. *) |
|
17309 | 28 |
IsLegalRcvArg :: "rpcOp => bool" |
29 |
RPCRelayArg :: "rpcOp => memOp" |
|
3807 | 30 |
|
47968 | 31 |
axiomatization where |
3807 | 32 |
(* RPCFailure is different from MemVals and exceptions *) |
60587 | 33 |
RFNoMemVal: "RPCFailure \<notin> MemVal" and |
34 |
NotAResultNotRF: "NotAResult \<noteq> RPCFailure" and |
|
35 |
OKNotRF: "OK \<noteq> RPCFailure" and |
|
36 |
BANotRF: "BadArg \<noteq> RPCFailure" |
|
3807 | 37 |
|
6255 | 38 |
defs |
17309 | 39 |
IsLegalRcvArg_def: "IsLegalRcvArg ra == |
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
28524
diff
changeset
|
40 |
case ra of (memcall m) => True |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
28524
diff
changeset
|
41 |
| (othercall v) => False" |
17309 | 42 |
RPCRelayArg_def: "RPCRelayArg ra == |
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
28524
diff
changeset
|
43 |
case ra of (memcall m) => m |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
28524
diff
changeset
|
44 |
| (othercall v) => undefined" |
17309 | 45 |
|
21624 | 46 |
lemmas [simp] = RFNoMemVal NotAResultNotRF OKNotRF BANotRF |
47 |
NotAResultNotRF [symmetric] OKNotRF [symmetric] BANotRF [symmetric] |
|
17309 | 48 |
|
3807 | 49 |
end |