definition MInit :: "memType \ Locs \ stpred" where"MInit mm l == PRED mm!l = #InitVal"
definition PInit :: "resType \ PrIds \ stpred" where"PInit rs p == PRED rs!p = #NotAResult"
(* auxiliary predicates: is there a pending read/write request for
some process id and location/value? *)
definition RdRequest :: "memChType \ PrIds \ Locs \ stpred" where"RdRequest ch p l == PRED Calling ch p \ (arg = #(read l))"
definition WrRequest :: "memChType \ PrIds \ Locs \ Vals \ stpred" where"WrRequest ch p l v == PRED Calling ch p \ (arg = #(write l v))"
(* actions *)
(* a read that doesn't raise BadArg *) definition GoodRead :: "memType \ resType \ PrIds \ Locs \ action" where"GoodRead mm rs p l == ACT #l \ #MemLoc \ ((rs!p)$ = $(mm!l))"
(* a read that raises BadArg *) definition BadRead :: "memType \ resType \ PrIds \ Locs \ action" where"BadRead mm rs p l == ACT #l \ #MemLoc \ ((rs!p)$ = #BadArg)"
(* the read action with l visible *) definition ReadInner :: "memChType \ memType \ resType \ PrIds \ Locs \ action" where"ReadInner ch mm rs p l == ACT
$(RdRequest ch p l) \<and> (GoodRead mm rs p l \<or> BadRead mm rs p l) \<and> unchanged (rtrner ch ! p)"
(* the read action with l quantified *) definition Read :: "memChType \ memType \ resType \ PrIds \ action" where"Read ch mm rs p == ACT (\l. ReadInner ch mm rs p l)"
(* similar definitions for the write action *) definition GoodWrite :: "memType \ resType \ PrIds \ Locs \ Vals \ action" where"GoodWrite mm rs p l v ==
ACT #l \<in> #MemLoc \<and> #v \<in> #MemVal \<and> ((mm!l)$ = #v) \<and> ((rs!p)$ = #OK)"
definition BadWrite :: "memType \ resType \ PrIds \ Locs \ Vals \ action" where"BadWrite mm rs p l v == ACT \<not> (#l \<in> #MemLoc \<and> #v \<in> #MemVal) \<and> ((rs!p)$ = #BadArg) \<and> unchanged (mm!l)"
definition WriteInner :: "memChType \ memType \ resType \ PrIds \ Locs \ Vals \ action" where"WriteInner ch mm rs p l v == ACT
$(WrRequest ch p l v) \<and> (GoodWrite mm rs p l v \<or> BadWrite mm rs p l v) \<and> unchanged (rtrner ch ! p)"
definition Write :: "memChType \ memType \ resType \ PrIds \ Locs \ action" where"Write ch mm rs p l == ACT (\v. WriteInner ch mm rs p l v)"
(* memory invariant: in the paper, the invariant is hidden in the definition of the predicate S used in the implementation proof, but it is easier to verify
at this level. *) definition MemInv :: "memType \ Locs \ stpred" where"MemInv mm l == PRED #l \ #MemLoc \ mm!l \ #MemVal"
(* The reliable memory is an implementation of the unreliable one *) lemma ReliableImplementsUnReliable: "\ IRSpec ch mm rs \ IUSpec ch mm rs" by (force simp: UNext_def UPSpec_def IUSpec_def RM_temp_defs elim!: STL4E [temp_use] squareE)
(* The memory spec implies the memory invariant *) lemma MemoryInvariant: "\ MSpec ch mm rs l \ \(MemInv mm l)" by (auto_invariant simp: RM_temp_defs RM_action_defs)
(* The invariant is trivial for non-locations *) lemma NonMemLocInvariant: "\ #l \ #MemLoc \ \(MemInv mm l)" by (auto simp: MemInv_def intro!: necT [temp_use])
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.