src/HOL/TLA/Memory/RPCParameters.thy
author berghofe
Fri, 28 Apr 2006 15:59:31 +0200
changeset 19497 630073ef9212
parent 17309 c43ed29bd197
child 21624 6f79647cf536
permissions -rw-r--r--
Added new targets for nominal datatype package.

(*
    File:        RPCParameters.thy
    ID:          $Id$
    Author:      Stephan Merz
    Copyright:   1997 University of Munich

    Theory Name: RPCParameters
    Logic Image: TLA

    RPC-Memory example: RPC parameters
    For simplicity, specify the instance of RPC that is used in the
    memory implementation.
*)

theory RPCParameters
imports MemoryParameters
begin

datatype rpcOp = memcall memOp | othercall Vals
datatype rpcState = rpcA | rpcB

consts
  (* some particular return values *)
  RPCFailure     :: Vals
  BadCall        :: Vals
  
  (* Translate an rpc call to a memory call and test if the current argument
     is legal for the receiver (i.e., the memory). This can now be a little
     simpler than for the generic RPC component. RelayArg returns an arbitrary
     memory call for illegal arguments. *)
  IsLegalRcvArg  :: "rpcOp => bool"
  RPCRelayArg    :: "rpcOp => memOp"

axioms
  (* RPCFailure is different from MemVals and exceptions *)
  RFNoMemVal:        "RPCFailure ~: MemVal"
  NotAResultNotRF:   "NotAResult ~= RPCFailure"
  OKNotRF:           "OK ~= RPCFailure"
  BANotRF:           "BadArg ~= RPCFailure"

defs
  IsLegalRcvArg_def: "IsLegalRcvArg ra ==
		         case ra of (memcall m) => True
		                  | (othercall v) => False"
  RPCRelayArg_def:   "RPCRelayArg ra ==
		         case ra of (memcall m) => m
		                  | (othercall v) => arbitrary"

ML {* use_legacy_bindings (the_context ()) *}

end