src/HOL/TLA/Memory/RPC.thy
changeset 60588 750c533459b1
parent 60587 0318b43ee95c
child 60591 e0b77517f9a9
equal deleted inserted replaced
60587:0318b43ee95c 60588:750c533459b1
     8 imports RPCParameters ProcedureInterface Memory
     8 imports RPCParameters ProcedureInterface Memory
     9 begin
     9 begin
    10 
    10 
    11 type_synonym rpcSndChType = "(rpcOp,Vals) channel"
    11 type_synonym rpcSndChType = "(rpcOp,Vals) channel"
    12 type_synonym rpcRcvChType = "memChType"
    12 type_synonym rpcRcvChType = "memChType"
    13 type_synonym rpcStType = "(PrIds => rpcState) stfun"
    13 type_synonym rpcStType = "(PrIds \<Rightarrow> rpcState) stfun"
    14 
    14 
    15 consts
    15 consts
    16   (* state predicates *)
    16   (* state predicates *)
    17   RPCInit      :: "rpcRcvChType => rpcStType => PrIds => stpred"
    17   RPCInit      :: "rpcRcvChType \<Rightarrow> rpcStType \<Rightarrow> PrIds \<Rightarrow> stpred"
    18 
    18 
    19   (* actions *)
    19   (* actions *)
    20   RPCFwd     :: "rpcSndChType => rpcRcvChType => rpcStType => PrIds => action"
    20   RPCFwd     :: "rpcSndChType \<Rightarrow> rpcRcvChType \<Rightarrow> rpcStType \<Rightarrow> PrIds \<Rightarrow> action"
    21   RPCReject  :: "rpcSndChType => rpcRcvChType => rpcStType => PrIds => action"
    21   RPCReject  :: "rpcSndChType \<Rightarrow> rpcRcvChType \<Rightarrow> rpcStType \<Rightarrow> PrIds \<Rightarrow> action"
    22   RPCFail    :: "rpcSndChType => rpcRcvChType => rpcStType => PrIds => action"
    22   RPCFail    :: "rpcSndChType \<Rightarrow> rpcRcvChType \<Rightarrow> rpcStType \<Rightarrow> PrIds \<Rightarrow> action"
    23   RPCReply   :: "rpcSndChType => rpcRcvChType => rpcStType => PrIds => action"
    23   RPCReply   :: "rpcSndChType \<Rightarrow> rpcRcvChType \<Rightarrow> rpcStType \<Rightarrow> PrIds \<Rightarrow> action"
    24   RPCNext    :: "rpcSndChType => rpcRcvChType => rpcStType => PrIds => action"
    24   RPCNext    :: "rpcSndChType \<Rightarrow> rpcRcvChType \<Rightarrow> rpcStType \<Rightarrow> PrIds \<Rightarrow> action"
    25 
    25 
    26   (* temporal *)
    26   (* temporal *)
    27   RPCIPSpec   :: "rpcSndChType => rpcRcvChType => rpcStType => PrIds => temporal"
    27   RPCIPSpec   :: "rpcSndChType \<Rightarrow> rpcRcvChType \<Rightarrow> rpcStType \<Rightarrow> PrIds \<Rightarrow> temporal"
    28   RPCISpec   :: "rpcSndChType => rpcRcvChType => rpcStType => temporal"
    28   RPCISpec   :: "rpcSndChType \<Rightarrow> rpcRcvChType \<Rightarrow> rpcStType \<Rightarrow> temporal"
    29 
    29 
    30 defs
    30 defs
    31   RPCInit_def:       "RPCInit rcv rst p == PRED ((rst!p = #rpcA) & \<not>Calling rcv p)"
    31   RPCInit_def:       "RPCInit rcv rst p == PRED ((rst!p = #rpcA) & \<not>Calling rcv p)"
    32 
    32 
    33   RPCFwd_def:        "RPCFwd send rcv rst p == ACT
    33   RPCFwd_def:        "RPCFwd send rcv rst p == ACT
    79 
    79 
    80 (* The RPC component engages in an action for process p only if there is an outstanding,
    80 (* The RPC component engages in an action for process p only if there is an outstanding,
    81    unanswered call for that process.
    81    unanswered call for that process.
    82 *)
    82 *)
    83 
    83 
    84 lemma RPCidle: "|- \<not>$(Calling send p) --> \<not>RPCNext send rcv rst p"
    84 lemma RPCidle: "\<turnstile> \<not>$(Calling send p) \<longrightarrow> \<not>RPCNext send rcv rst p"
    85   by (auto simp: Return_def RPC_action_defs)
    85   by (auto simp: Return_def RPC_action_defs)
    86 
    86 
    87 lemma RPCbusy: "|- $(Calling rcv p) & $(rst!p) = #rpcB --> \<not>RPCNext send rcv rst p"
    87 lemma RPCbusy: "\<turnstile> $(Calling rcv p) & $(rst!p) = #rpcB \<longrightarrow> \<not>RPCNext send rcv rst p"
    88   by (auto simp: RPC_action_defs)
    88   by (auto simp: RPC_action_defs)
    89 
    89 
    90 (* RPC failure actions are visible. *)
    90 (* RPC failure actions are visible. *)
    91 lemma RPCFail_vis: "|- RPCFail send rcv rst p -->  
    91 lemma RPCFail_vis: "\<turnstile> RPCFail send rcv rst p \<longrightarrow>  
    92     <RPCNext send rcv rst p>_(rst!p, rtrner send!p, caller rcv!p)"
    92     <RPCNext send rcv rst p>_(rst!p, rtrner send!p, caller rcv!p)"
    93   by (auto dest!: Return_changed [temp_use] simp: angle_def RPCNext_def RPCFail_def)
    93   by (auto dest!: Return_changed [temp_use] simp: angle_def RPCNext_def RPCFail_def)
    94 
    94 
    95 lemma RPCFail_Next_enabled: "|- Enabled (RPCFail send rcv rst p) -->  
    95 lemma RPCFail_Next_enabled: "\<turnstile> Enabled (RPCFail send rcv rst p) \<longrightarrow>  
    96     Enabled (<RPCNext send rcv rst p>_(rst!p, rtrner send!p, caller rcv!p))"
    96     Enabled (<RPCNext send rcv rst p>_(rst!p, rtrner send!p, caller rcv!p))"
    97   by (force elim!: enabled_mono [temp_use] RPCFail_vis [temp_use])
    97   by (force elim!: enabled_mono [temp_use] RPCFail_vis [temp_use])
    98 
    98 
    99 (* Enabledness of some actions *)
    99 (* Enabledness of some actions *)
   100 lemma RPCFail_enabled: "\<And>p. basevars (rtrner send!p, caller rcv!p, rst!p) ==>  
   100 lemma RPCFail_enabled: "\<And>p. basevars (rtrner send!p, caller rcv!p, rst!p) \<Longrightarrow>  
   101     |- \<not>Calling rcv p & Calling send p --> Enabled (RPCFail send rcv rst p)"
   101     \<turnstile> \<not>Calling rcv p & Calling send p \<longrightarrow> Enabled (RPCFail send rcv rst p)"
   102   by (tactic {* action_simp_tac (@{context} addsimps [@{thm RPCFail_def},
   102   by (tactic {* action_simp_tac (@{context} addsimps [@{thm RPCFail_def},
   103     @{thm Return_def}, @{thm caller_def}, @{thm rtrner_def}]) [exI]
   103     @{thm Return_def}, @{thm caller_def}, @{thm rtrner_def}]) [exI]
   104     [@{thm base_enabled}, @{thm Pair_inject}] 1 *})
   104     [@{thm base_enabled}, @{thm Pair_inject}] 1 *})
   105 
   105 
   106 lemma RPCReply_enabled: "\<And>p. basevars (rtrner send!p, caller rcv!p, rst!p) ==>  
   106 lemma RPCReply_enabled: "\<And>p. basevars (rtrner send!p, caller rcv!p, rst!p) \<Longrightarrow>  
   107       |- \<not>Calling rcv p & Calling send p & rst!p = #rpcB  
   107       \<turnstile> \<not>Calling rcv p & Calling send p & rst!p = #rpcB  
   108          --> Enabled (RPCReply send rcv rst p)"
   108          \<longrightarrow> Enabled (RPCReply send rcv rst p)"
   109   by (tactic {* action_simp_tac (@{context} addsimps [@{thm RPCReply_def},
   109   by (tactic {* action_simp_tac (@{context} addsimps [@{thm RPCReply_def},
   110     @{thm Return_def}, @{thm caller_def}, @{thm rtrner_def}]) [exI]
   110     @{thm Return_def}, @{thm caller_def}, @{thm rtrner_def}]) [exI]
   111     [@{thm base_enabled}, @{thm Pair_inject}] 1 *})
   111     [@{thm base_enabled}, @{thm Pair_inject}] 1 *})
   112 
   112 
   113 end
   113 end