theory SPRViewSingle imports
KBPsAlg
SPRView
List_local
ODList
Trie2 "HOL-Library.Mapping" begin (*>*)
subsection‹Perfect Recall for a Single Agent›
text‹
label{sec:kbps-spr-single-agent}
capture our expectations of a single-agent scenario in the
locale:
›
locale FiniteSingleAgentEnvironment =
FiniteEnvironment jkbp envInit envAction envTrans envVal envObs for jkbp :: "('a, 'p, 'aAct) JKBP" and envInit :: "('s :: {finite, linorder}) list" and envAction :: "'s ==> 'eAct list" and envTrans :: "'eAct ==> ('a ==> 'aAct) ==> 's ==> 's" and envVal :: "'s ==> 'p ==> bool" and envObs :: "'a ==> 's ==> 'obs"
+ fixes agent :: "'a" assumes envSingleAgent: "a = agent"
text‹
per the clock semantics of \S\ref{sec:kbps-theory-clock-view}, we
that the set of states is finite and linearly ordered. We give
sole agent the name ‹agent›.
simulation is quite similar to the one for the clock semantics of
S\ref{sec:kbps-theory-clock-view}: it records the set of worlds that
agent considers possible relative to a trace and the SPR view. The
difference is that it is path-sensitive:
lemma spr_absI[elim]: "[ t' ∈ SPR.jkbpC; spr_jview a t' = spr_jview a t; v = tLast t' ] ==> v ∈ spr_abs t" unfolding spr_abs_def using envSingleAgent[where a=a] by blast
lemma spr_abs_tLastD[simp]: "v ∈ spr_abs t ==> envObs a v = envObs a (tLast t)" unfolding spr_abs_def using envSingleAgent[where a=a] by auto
lemma spr_abs_conv: "v ∈ spr_abs t ⟷ (∃t'. t' ∈ SPR.jkbpC ∧ spr_jview a t' = spr_jview a t ∧ v = tLast t')" unfolding spr_abs_def using envSingleAgent[where a=a] by blast
lemma spr_abs_eq[dest]: "spr_jview a t = spr_jview a t' ==> spr_abs t = spr_abs t'" unfolding spr_abs_def using envSingleAgent[where a=a] by auto
lemma spr_abs_refl[intro, simp]: "t ∈ SPR.jkbpC ==> tLast t ∈ spr_abs t" unfolding spr_abs_def using envSingleAgent[where a=a] by auto
Kripke structure for this simulation relates worlds for @{term
agent"} if the sets of states it considers possible coincide, and the
of the final states of the trace is the same. Propositions
evaluated at the final state.
›
definition spr_simRels :: "'a ==> 's spr_simWorlds Relation"where "spr_simRels ≡ λa. { ((U, u), (V, v)) |U u V v. U = V ∧ {u, v} ⊆ U ∧ envObs a u = envObs a v }"
lemma spr_sim_r: "sim_r SPR.MC spr_simMC spr_sim" proof fix a t v' assume t: "t ∈ worlds SPR.MC" and tv': "(spr_sim t, v') ∈ relations spr_simMC a" from tv' obtain s where vv': "v' = (spr_abs t, s)" and st: "s ∈ spr_abs t" unfolding spr_simRels_def spr_sim_def mkKripke_def SPR.mkM_def by auto from st obtain v where"v ∈ SPR.jkbpC" and"spr_jview a v = spr_jview a t" and"tLast v = s" by (auto(*<*)iff: spr_abs_conv(*>*)) with t vv' have"(t, v) ∈ relations SPR.MC a" and"spr_sim v = v'" unfolding spr_simRels_def spr_sim_def mkKripke_def SPR.mkM_def by auto thus"∃v. (t, v) ∈ relations SPR.MC a ∧ spr_sim v = v'"by blast qed
(*>*) text‹
that this is a simulation \S\ref{sec:kripke-theory-simulations}) is straightforward.
›
lemma spr_sim: "sim SPR.MC spr_simMC spr_sim" (*<*) proof show"sim_f SPR.MC spr_simMC spr_sim" unfolding spr_simRels_def spr_sim_def mkKripke_def SPR.mkM_def by (rule) auto next show"sim_r SPR.MC spr_simMC spr_sim" by (rule spr_sim_r) qed auto
in \S\ref{sec:kbps-theory-clock-view-algops}, we quotient @{typ "'s
"} by @{term "spr_simRels"}. Because there is only a
agent, an element of this quotient corresponding to a cononical
@{term "t"} is isomorphic to the set of states that are possible
the sequence of observations made by @{term "agent"} on @{term
t"}. Therefore we have a very simple representation:
›
context FiniteSingleAgentEnvironment begin
type_synonym (in -) 's spr_simWorldsRep = "'s odlist"
text‹
is very easy to map these representations back to simulated
classes:
›
definition
spr_simAbs :: "'s spr_simWorldsRep ==> 's spr_simWorlds set" where "spr_simAbs ≡ λss. { (toSet ss, s) |s. s ∈ toSet ss }"
text‹
time our representation is unconditionally canonical:
›
lemma spr_simAbs_inj: "inj spr_simAbs" (*<*) apply (rule injI) unfolding spr_simAbs_def apply (subgoal_tac "toSet x = toSet y") apply auto using toSet_inj apply (erule injD) done
lemma spr_sim_rep_abs[simp]: assumes ec: "spr_simAbs ec = SPRsingle.sim_equiv_class a t" shows"toSet ec = spr_abs t" proof show"toSet ec ⊆ spr_abs t" proof fix x assume x: "x ∈ toSet ec" hence"(toSet ec, x) ∈ spr_simAbs ec" unfolding spr_simAbs_def by simp with ec have"(toSet ec, x) ∈ SPRsingle.sim_equiv_class a t" by simp with x envSingleAgent[where a=a] show"x ∈ spr_abs t" unfolding spr_sim_def spr_abs_def by auto qed next show"spr_abs t ⊆ toSet ec" proof fix x assume x: "x ∈ spr_abs t" with ec envSingleAgent[where a=a] show"x ∈ toSet ec" unfolding spr_simAbs_def spr_sim_def spr_abs_def by auto qed qed
lemma spr_simAbs_list: "spr_simAbs ` fromList ` X = (λss. { (ss, s) |s. s ∈ ss }) ` set ` X" unfolding spr_simAbs_def Set.image_def by auto
(*>*) text‹
again make use of the following Kripke structure, where the worlds
the final states of the subset of the temporal slice that @{term
agent"} believes possible:
›
definition spr_repRels :: "'a ==> ('s × 's) set"where "spr_repRels ≡ λa. { (s, s'). envObs a s' = envObs a s }"
abbreviation spr_repMC :: "'s set ==> ('a, 'p, 's) KripkeStructure"where "spr_repMC ≡ λX. mkKripke X spr_repRels envVal"
text‹
we show that this Kripke structure is adequate by
an intermediate structure and connecting them all with a
of simulations:
lemma spr_simObs: assumes tC: "t ∈ SPR.jkbpC" assumes ec: "spr_simAbs ec = SPRsingle.sim_equiv_class a t" shows"spr_simObs a ec = envObs a (tLast t)" (*<*) proof - have A: "∀s ∈ set (toList ec). envObs a s = envObs a (tLast t)" using spr_sim_rep_abs[OF ec] by (simp add: toSet_def) from tC ec have B: "tLast t ∈ set (toList ec)" using envSingleAgent[where a=a] by simp show ?thesis unfolding spr_simObs_def by (simp add: list_choose_hd[OF A B] ODList.hd_def) qed (*>*)
(* **************************************** *)
subsubsection‹Evaluation›
text‹
label{sec:kbps-spr-single-agent-eval}
the single-agent case is much simpler than the multi-agent ones, we
an evaluation function specialised to its representation.
@{term "eval"} yields the subset of @{term "X"} where the
holds, where @{term "X"} is taken to be a representation of a
equivalence class for @{term "agent"}.
›
fun (in -)
eval :: "(('s :: linorder) ==> 'p ==> bool) ==> 's odlist ==> ('a, 'p) Kform ==> 's odlist" where "eval val X (Kprop p) = ODList.filter (λs. val s p) X"
| "eval val X (Knot φ) = ODList.difference X (eval val X φ)"
| "eval val X (Kand φ ψ) = ODList.intersect (eval val X φ) (eval val X ψ)"
| "eval val X (Kknows a φ) = (if eval val X φ = X then X else ODList.empty)"
| "eval val X (Kcknows as φ) = (if as = [] ∨ eval val X φ = X then X else ODList.empty)"
text‹
general this is less efficient than the tableau approach of 🍋‹‹Proposition~3.2.1› in "FHMV:1995"›, which labels all states with all
. However it is often the case that the set of relevant worlds
much smaller than the set of all system states.
that this corresponds with the standard models relation is
.
› (*<*)
lemma eval_ec_subseteq: shows"toSet (eval envVal ec φ) ⊆ toSet ec" by (induct φ) auto
lemma eval_models_aux: assumes ec: "spr_simAbs ec = SPRsingle.sim_equiv_class agent t" assumes s: "s ∈ toSet ec" shows"s ∈ toSet (eval envVal ec φ) ⟷ spr_repMC (toSet ec), s ⊨ φ" using s proof(induct φ arbitrary: s) case (Kknows a φ s) with ec envSingleAgent[where a=a] show ?case unfolding spr_repRels_def by (auto simp: inj_eq[OF toSet_inj, symmetric] dest: subsetD[OF eval_ec_subseteq]) next case (Kcknows as φ s) from ec show ?case proof(cases as) case Nil with Kcknows show ?thesis by clarsimp next case (Cons x xs) hence"set as = {agent}" by (induct as) (auto simp: envSingleAgent) moreover have"(spr_repRels agent ∩ toSet ec × toSet ec)+ = (spr_repRels agent ∩ toSet ec × toSet ec)" by (rule trancl_id) (simp add: spr_repRels_def trans_def) moreovernote Kcknows ec ultimatelyshow ?thesis unfolding spr_repRels_def by (auto simp: inj_eq[OF toSet_inj, symmetric] dest: subsetD[OF eval_ec_subseteq]) qed qed simp_all
in \S\ref{sec:kbps-theory-clock-view-maps}, we use a pair of tries
an association list to handle the automata representation. Recall
the keys of these tries are lists of system states.
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 und die Messung sind noch experimentell.