Thread: [Toss-devel-svn] SF.net SVN: toss:[1437] trunk/Toss/www/reference/reference.tex
Status: Beta
Brought to you by:
lukaszkaiser
From: <luk...@us...> - 2011-05-13 12:42:38
|
Revision: 1437 http://toss.svn.sourceforge.net/toss/?rev=1437&view=rev Author: lukstafi Date: 2011-05-13 12:42:31 +0000 (Fri, 13 May 2011) Log Message: ----------- Reference specification of GDL translation: expanded {Rewriting Rule Creation}, first draft of {Translating Formulas}. Modified Paths: -------------- trunk/Toss/www/reference/reference.tex Modified: trunk/Toss/www/reference/reference.tex =================================================================== --- trunk/Toss/www/reference/reference.tex 2011-05-12 23:29:43 UTC (rev 1436) +++ trunk/Toss/www/reference/reference.tex 2011-05-13 12:42:31 UTC (rev 1437) @@ -1112,9 +1112,13 @@ \section{Game Description Language} The game description language, GDL, is a variant of Datalog used to -specify games in a compact, prolog-like way. The GDL syntax and semantics -are defined in \cite{GLP05,LHHSG08}, we refer the reader there for the -definition and will only recapitulate some notions here. +specify games in a compact, prolog-like way. The GDL syntax and +semantics are defined in \cite{GLP05,LHHSG08}, we refer the reader +there for the definition and will only recapitulate some notions +here. When we build first-order formulas over GDL atoms during +intermediate steps of translation, they are intended to be interpreted +in already existing GDL models (which are defined in +\cite{GLP05,LHHSG08}). The state of the game in GDL is defined by the set of propositions true in that state. These propositions are represented by terms of @@ -1133,6 +1137,7 @@ the second arguments of \texttt{legal} and \texttt{does} relations, \ie those terms which are used to specify the moves of the players. + The complete Tic-tac-toe specification in GDL is given in Figure~\ref{fig-ttt-gdl}. While games can be formalised in various ways in both systems, Figures \ref{fig-ttt-code} and \ref{fig-ttt-gdl} @@ -1762,49 +1767,62 @@ \subsubsection{Rewriting Rule Creation} \label{subsec-rules} -For each suitable tuple $\ol{\calC}, \ol{\calN}$ we have now -created the unifier $\sigma_{\ol{\calC}, \ol{\calN}}$ and computed -the erasure clauses $\calE_{\ol{\calC}, \ol{\calN}}$. To create the rules, -we first collect all atoms in the bodies of -$\sigma_{\ol{\calC}, \ol{\calN}}(\calC_i), \sigma_{\ol{\calC}, \ol{\calN}}(\calN_i)$ -and $\calE_{\ol{\calC}, \ol{\calN}}$. We generate a Toss rule candidate for -every partition of atoms into true and false ones, and later \emph{filter} -these candidates by checking for satisfiability in the initial structure -of the stable part of the rule matching criteria and precondition. +For each suitable tuple $\ol{\calC}, \ol{\calN}$ we have now created +the unifier $\sigma_{\ol{\calC}, \ol{\calN}}$ and computed the erasure +clauses $\calE_{\ol{\calC}, \ol{\calN}}$. To create the rules, we need +to further partition the \emph{rule clauses} $\sigma_{\ol{\calC}, + \ol{\calN}}(\calC_i), \sigma_{\ol{\calC}, \ol{\calN}}(\calN_i)$ and +$\calE_{\ol{\calC}, \ol{\calN}}$, and augment them with further +conditions. The reason is that the prepared rule clauses may have +different matches in different game states, while the Toss rule has to +be built from all the rule clauses that would match when the Toss rule +matches. Therefore, we need to build a Toss rule for each subset of +rule clauses that are ``selected'' by some game state (i.e. are +exactly the rule clauses matching in that state), but add to it +``separation conditions'' that prevent the Toss rule from matching in +game states where more rule clauses can match. -For a given a partition of GDL atoms into true and false ones, -we will construct the candidate rule in two steps. +We select groups of atoms (collected from rule clauses) that separate +rule clauses, and generate a Toss rule candidate for every partition +of the groups into true and false ones: we collect the rule clauses +that agree with the given partition. The selected atoms, some negated +according to the partition, form the separation condition. -In the first step, we transform the GDL atoms into Toss clauses. -This translation follows the definitions of atomic relations -presented in Section~\ref{subsec-rels}, and the relations there were -chosen so as to suffice for this translation. Due to space constraints -we omit further technical details of this step here. -%Before creating the rules, we currently expand (inline) -%relations of $G$ that directly or indirectly depend on game state, and -%we instantiate variables at fluent paths. We translate state terms -%as Toss variables, so that terms are translated as the same variable -%iff they are syntactically equal or differ only at fluent paths. +For each candidate, we will construct the Toss rule in two steps. -In the second step, we use Toss clauses to construct the structures -for the rule. The $\frakL$-structure and precondition of a Toss rewrite rule -is built by first translating the existential closure of conjunctions of -bodies of \texttt{next} clauses of the rule. Based on the heads of -\texttt{next} clauses, the relevant information is extracted from the -resulting precondition formula and quantification over variables -corresponding to $\frakL$ elements is dropped. The right-hand -structure is constructed similarly. +In the first step we generate the \emph{matching condition}: we +translate the conjunction of the bodies of rule clauses and the +separation condition. This translation follows the definitions of +atomic relations presented in Section~\ref{subsec-rels} and is +described in Section~\ref{subsec-translate}. -Having constructed and filtered the rewriting rule candidates, -we have almost completed the definition of $T(G)$. The rules -are assigned to locations based on who moves in which location, -as we only translate turn-based games for now. Payoff formulas -are derived by instantiating variables standing for the \texttt{goal} -values. The formulas defining the \texttt{terminal} condition and -specific \texttt{goal} value conditions are existential closures of -disjunctions of bodies of their respective clauses. +Later we \emph{filter} the rule candidates by checking for +satisfiability in the initial structure of the stable part of the +matching condition. +In the second step, we build a Toss rewrite rule itself. From the +heads of rule clauses of a rule candidate, we build the +$\frakR$-structure: each \texttt{next} term, with its fluent paths +replaced by \texttt{BLANK}, is an $\frakR$ element, and the fluent +predicates holding for the \texttt{next} state terms are the relations +of $\frakR$. The $\frakL$-structure and precondition of the Toss rule +is built from the matching condition, based on elements of $\frakR$. +Quantification over variables corresponding to $\frakR$ elements +(which are the same as $\frakL$ elements) is dropped, and atoms +involving only these variables and not occurring inside disjunctions +are extracted to be relations tuples in $\frakL$. +Having constructed and filtered the rewriting rule candidates, we have +almost completed the definition of $T(G)$. The rules are assigned to +locations based on who moves in which location, as we only translate +turn-based games for now. Payoff formulas are derived by instantiating +variables standing for the \texttt{goal} values. The formulas defining +the \texttt{terminal} condition and specific \texttt{goal} value +conditions are translated as described in +Section~\ref{subsec-translate}, from disjunctions of bodies of their +respective clauses. + + \subsection{Translating Moves between Toss and GDL} \label{subsec-move-tr} To play as a GDL client, we need to translate legal moves from $G$ @@ -1828,7 +1846,30 @@ such that $t\tpos_p = v$, and $a\tpos^m_p = s$, then we substitute $v$ by $s$. The move translation function $\mu$ is thus constructed. +\subsection{Translating Formulas} \label{subsec-translate} +\subsubsection{Stable Relations and Fluents} + +Divide Phi into the part other than \texttt{true}: LitsPhi (can +contain disjunctions), positive \texttt{true} literals: Tru+ and +negative \texttt{true} literals: Tru-. + +Translate conjunctions as conjunctions, and disjunctions as disjunctions. + +Translate TrLits(Phi, Tru1, Tru2) by translating each literal as a +conjunction of literals, for every combination of mask paths into Tru1 +terms, such that at least one of the terms is from Tru2. + +Translate \texttt{true} atoms as a conjunction of their anchor and +fluent predicates TrTru. + +Translate the whole Phi as ``ex Tru+ (TrLits(LitsPhi, Tru+, Tru+) and +conj of TrTru(Tru+) and TrLits(ex Tru- (not (TrLits(LitsPhi, Tru+ sum +Tru-, Tru-) and disj of TrTru(Tru-)))))''. + +\subsubsection{Introducing and Using Defined Relations} + + \section{Game Simplification in Toss} Games automatically translated from GDL, as described above, are verbose This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luk...@us...> - 2011-05-13 23:17:41
|
Revision: 1439 http://toss.svn.sourceforge.net/toss/?rev=1439&view=rev Author: lukstafi Date: 2011-05-13 23:17:33 +0000 (Fri, 13 May 2011) Log Message: ----------- Reference specification of GDL translation: subsection {Stable Relations and Fluents} of {Translating Formulas} (may require style corrections). Modified Paths: -------------- trunk/Toss/www/reference/reference.tex Modified: trunk/Toss/www/reference/reference.tex =================================================================== --- trunk/Toss/www/reference/reference.tex 2011-05-13 22:22:02 UTC (rev 1438) +++ trunk/Toss/www/reference/reference.tex 2011-05-13 23:17:33 UTC (rev 1439) @@ -90,6 +90,8 @@ \newcommand{\mgu}{\ensuremath{\mathrm{MGU}}} \newcommand{\ot}{\leftarrow} \newcommand{\tpos}{\downharpoonleft} +\newcommand{\TrRels}{\ensuremath{\mathrm{TrRels}}} +\newcommand{\TrST}{\ensuremath{\mathrm{TrST}}} % Theorem environments \theoremstyle{plain} @@ -1463,12 +1465,14 @@ the \emph{subterm equality relation} $Eq_{p,q}$: \[ Eq_{p,q}(a_1,a_2) \ \ \iff \ \ a_1\tpos^m_{p}\ =\ a_2\tpos^m_{q}. \] -\noindent \textbf{Fact relations.} -For all predicates $R$ of $G$ that do not (directly or indirectly) depend -on the state, and all pairs of paths $p,q \in \calP_m$, we introduce -the \emph{fact relation} $R_{p,q}$: -\[ R_{p,q}(a_1,a_2) \ \ \iff \ \ R(a_1\tpos^m_{p},\ a_2\tpos^m_{q}) - \text{ in any state}. \] +\noindent \textbf{Fact relations.} For all relations $R$ of $G$ that +do not (directly or indirectly) depend on the state, and all tuples of +paths $p_1,\ldots,p_n \in \calP_m$, we introduce the \emph{fact + relation} $R_{p_1,\ldots,p_n}$: +\[ +R_{p_1,\ldots,p_n}(a_1,\ldots,a_n) \ \ \iff \ \ R(a_1\tpos^m_{p_1},\ldots, +a_n\tpos^m_{p_n}) \text{ in any state}. +\] \noindent \textbf{Anchor predicates.} For all paths $p \in \calP_m$ and subterms $s = t\tpos_p, t \in \calS$, @@ -1522,7 +1526,7 @@ \emph{Fact relations.} -The only predicate in the example specification is \texttt{nextcol} +The only relation in the example specification is \texttt{nextcol} and we thus get the relations $\mathtt{nextcol}_{i, j}$. For example, the relation \begin{align*} @@ -1820,7 +1824,9 @@ the \texttt{terminal} condition and specific \texttt{goal} value conditions are translated as described in Section~\ref{subsec-translate}, from disjunctions of bodies of their -respective clauses. +respective clauses. Actually, instead of ``freshening'' the clauses +and translating the disjunction of their bodies, we (equivalently) +form disjunction of translations of each body. \subsection{Translating Moves between Toss and GDL} \label{subsec-move-tr} @@ -1848,25 +1854,81 @@ \subsection{Translating Formulas} \label{subsec-translate} +First we describe translation in the case all GDL relations other than +\texttt{next} are stable, \ie do not even indirectly depend on +\texttt{true}. A stable GDL relation is translated as multiple stable +Toss relations. Then we approach the GDL relations (other than +\texttt{next}) that depend on \texttt{true} by translating them as +defined relations in Toss. + \subsubsection{Stable Relations and Fluents} -Divide Phi into the part other than \texttt{true}: LitsPhi (can -contain disjunctions), positive \texttt{true} literals: Tru+ and -negative \texttt{true} literals: Tru-. +We normalize the GDL formula to be translated, which is composed of +conjunctions, disjunctions and literals, into a disjunction $\Phi_1 +\vee \ldots \vee \Phi_n$, so that every $\Phi_i \equiv G_i \wedge +ST^{+}_i \wedge ST^{-}_i$, where all literals in $G_i$ are other than +\texttt{true}, all literals in $ST^{+}_i$ are positive \texttt{true} +atoms, all literals in $ST^{-}_i$ are negated \texttt{true} atoms. (We +avoid unnecessary expansions.) Let $\mathrm{ST}(\phi)$ be all the +state terms, \ie arguments of \texttt{true} atoms, in $\phi$. -Translate conjunctions as conjunctions, and disjunctions as disjunctions. +$\TrRels(\phi, S_1, S_2)$ descends $\phi$ translating each literal as a +conjunction of literals, for every combination of mask paths into $S_1$ +state terms, such that at least one of those terms is from $S_2$. -Translate TrLits(Phi, Tru1, Tru2) by translating each literal as a -conjunction of literals, for every combination of mask paths into Tru1 -terms, such that at least one of the terms is from Tru2. +$\TrST(\phi)$ translates \texttt{true} atoms as a conjunction of their +anchor and fluent predicates. -Translate \texttt{true} atoms as a conjunction of their anchor and -fluent predicates TrTru. +Let $eqs_i$ be $\Land \big\{ \mathtt{EQ}(x,x) | x \in \fv(\Phi_i) +\big\}$. The relation name $\mathtt{EQ}$ serves technical purposes: +fact relations $\mathtt{EQ}_{p,q}$ are identified with subterm +equality relations $Eq_{p,q}$. -Translate the whole Phi as ``ex Tru+ (TrLits(LitsPhi, Tru+, Tru+) and -conj of TrTru(Tru+) and TrLits(ex Tru- (not (TrLits(LitsPhi, Tru+ sum -Tru-, Tru-) and disj of TrTru(Tru-)))))''. +The result of translation is the disjunction of translations of each +$\Phi_i$. A single $\Phi_i \equiv G_i \wedge ST^{+}_i \wedge ST^{-}_i$ +is translated as: +\begin{align*} +\exists \mathrm{ST}(ST^{+}_i) \big( & \TrRels(eqs_i +\wedge G_i, \mathrm{ST}(ST^{+}_i), \mathrm{ST}(ST^{+}_i)) \wedge +\TrST(ST^{+}_i) \wedge \\ & \neg \exists \mathrm{ST}(ST^{-}_i) \big( +\TrRels(eqs_i \wedge G_i, \mathrm{ST}(ST^{+}_i) \cup +\mathrm{ST}(ST^{-}_i), \mathrm{ST}(ST^{-}_i)) \wedge \\ & +\; \; \; \; \; \; \TrST(\mathtt{NNF}(\neg ST^{-}_i)) \big) \big) +\end{align*} + +We now proceed to define $\TrRels$ and $\TrST$. Let $\mathtt{BL}(t)$ +be the term $t$ with fluent paths replaced with \texttt{BLANK}. + +\begin{align*} + \TrRels (\phi_1 \wedge \phi_2, S_1, S_2) = & + \TrRels (\phi_1, S_1, S_2) \wedge \TrRels(\phi_2, S_1, S_2) \\ + \TrRels (\phi_1 \vee \phi_2, S_1, S_2) = & + \TrRels (\phi_1, S_1, S_2) \vee \TrRels(\phi_2, S_1, S_2) \\ + \TrRels (R(t_1, \ldots, t_n), S_1, S_2) = & \Land \big\{ + R_{p_1,\ldots,p_n}(v_1, \ldots, v_n) \; \big| \; s_1,\ldots,s_n \in S_1 \wedge \\ + & \{s_1,\ldots,s_n \} \cap S_2 \neq \emptyset \wedge + v_1 = \mathtt{BL}(s_1) \wedge \ldots \wedge v_n = \mathtt{BL}(s_n) \wedge \\ + & p_1, \ldots, p_n \in \calP_m \wedge + s_1 \tpos_{p_1} = t_1 \wedge \ldots \wedge s_n \tpos_{p_n} = t_n \big\} \\ + \TrRels (\neg R(t_1, \ldots, t_n), S_1, S_2) = & \Land \big\{ + \neg R_{p_1,\ldots,p_n}(v_1, \ldots, v_n) \; \big| \; s_1,\ldots,s_n \in S_1 \wedge \\ + & \{s_1,\ldots,s_n \} \cap S_2 \neq \emptyset \wedge + v_1 = \mathtt{BL}(s_1) \wedge \ldots \wedge v_n = \mathtt{BL}(s_n) \wedge \\ + & p_1, \ldots, p_n \in \calP_m \wedge + s_1 \tpos_{p_1} = t_1 \wedge \ldots \wedge s_n \tpos_{p_n} = t_n \big\} \\ + \TrST (\phi_1 \wedge \phi_2) = & + \TrST (\phi_1) \wedge \TrST(\phi_2) \\ + \TrST (\phi_1 \vee \phi_2) = & + \TrST (\phi_1) \vee \TrST(\phi_2) \\ + \TrST (\mathtt{true}(t)) = & \Land \big\{ + Anch^s_p(v) \; \big| \; v = \mathtt{BL}(t) \wedge + p \in \calP_m \wedge t \tpos_p = s \big\} \wedge \\ + & \Land \big\{ + Flu^s_p(v) \; \big| \; v = \mathtt{BL}(t) \wedge + p \in \calP_f \wedge t \tpos_p = s \big\} +\end{align*} + \subsubsection{Introducing and Using Defined Relations} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luk...@us...> - 2011-05-16 20:09:35
|
Revision: 1444 http://toss.svn.sourceforge.net/toss/?rev=1444&view=rev Author: lukstafi Date: 2011-05-16 20:09:29 +0000 (Mon, 16 May 2011) Log Message: ----------- Reference specification for GDL translation: {Introducing and Using Defined Relations} complete idea except for how to deal with recursion. Modified Paths: -------------- trunk/Toss/www/reference/reference.tex Modified: trunk/Toss/www/reference/reference.tex =================================================================== --- trunk/Toss/www/reference/reference.tex 2011-05-16 17:40:23 UTC (rev 1443) +++ trunk/Toss/www/reference/reference.tex 2011-05-16 20:09:29 UTC (rev 1444) @@ -1863,7 +1863,7 @@ \subsubsection{Stable Relations and Fluents} -We normalize the GDL formula to be translated, which is composed of +We normalize the GDL formula to be translated $\Phi$, which is composed of conjunctions, disjunctions and literals, into a disjunction $\Phi_1 \vee \ldots \vee \Phi_n$, so that every $\Phi_i \equiv G_i \wedge ST^{+}_i \wedge ST^{-}_i$, where all literals in $G_i$ are other than @@ -1889,14 +1889,17 @@ is translated as: \begin{align*} -\exists \mathrm{ST}(ST^{+}_i) \big( & \TrRels(eqs_i +\rho_i := \exists \mathrm{ST}(ST^{+}_i) \big( & \TrRels(eqs_i \wedge G_i, \mathrm{ST}(ST^{+}_i), \mathrm{ST}(ST^{+}_i)) \wedge \TrST(ST^{+}_i) \wedge \\ & \neg \exists \mathrm{ST}(ST^{-}_i) \big( \TrRels(eqs_i \wedge G_i, \mathrm{ST}(ST^{+}_i) \cup \mathrm{ST}(ST^{-}_i), \mathrm{ST}(ST^{-}_i)) \wedge \\ & -\; \; \; \; \; \; \TrST(\mathtt{NNF}(\neg ST^{-}_i)) \big) \big) +\ \ \ \ \ \ \ \ \TrST(\mathtt{NNF}(\neg ST^{-}_i)) \big) \big) \end{align*} +The result of translation is $\mathrm{Tr}(\Phi) := \rho_1 \vee \ldots +\vee \rho_n$. + We now proceed to define $\TrRels$ and $\TrST$. Let $\mathtt{BL}(t)$ be the term $t$ with fluent paths replaced with \texttt{BLANK}. @@ -1931,9 +1934,71 @@ \subsubsection{Introducing and Using Defined Relations} +A new Toss defined relation is generated for each atom of a GDL +non-stable relation, with parameters of the defined relation derived +from the use context. Yet the GDL non-stable relations can themselves +depend on other defined relations. We therefore generate Toss defined +relations in a stratified order, so that all Toss definitions of a +single GDL relation are generated from its (single) pre-processed +form, with the Toss defined relations it uses already generated. This +can lead to less constraining relations than their GDL originals, +because all interaction between the strata is mediated by local +variables, \ie when $R_3$ calls $R_2$ which calls $R_1$, $R_1$ defined +relation is created for the $R_2$-$R_1$ context, ignoring the $R_3$-$R_2$ +context. Should it pose problems in practice, countermeasures like +inlining can be used. -\section{Game Simplification in Toss} +Consider translating a GDL formula $\Phi$ with atoms of non-stable GDL +relations, we therefore need to generate Toss defined relations for +them. Let $R$ be non-stable GDL relation. We update $\TrRels$ to: +\[\TrRels (R(t_1, \ldots, t_n), S_1, S_2) = +\mathrm{GenDefRel}(R(t_1,\ldots,t_n), S_1) \] + +$\mathrm{GenDefRel}$ generates and stores Toss defined relation +$R_{def}$ under context $S_1$, and returns $R_{def}$ applied to +variables corresponding to state terms from $S_1$. Additional pass can +be added to game simplification (see Section~\ref{sec-game-simpl}) to +remove unused parameters of definitions and conflate equivalent +definitions. + +Consider generating defined relation for atom $r$ of relation $R$ with +GDL defining clauses $\mathtt{(<= h_1 \ b_1)}, \ldots, \mathtt{(<= h_k + \ b_k)}$. Let the context be a set $S$ of state terms, arbitrarily +ordered into a sequence $(s_1,\ldots,s_m)$. Let $\sigma_i = +\mathtt{MGU} (r, h_i)$ and $c = \mathtt{true}(s_1) \wedge \ldots +\wedge \mathtt{true}(s_m)$. The result of translation is + +\[ +R_{def}(\mathtt{BL}(s_1),\ldots,\mathtt{BL}(s_m)) = +\mathrm{Tr}_{S,\sigma_1}(\sigma_1(c \wedge b_1)) \vee \ldots \vee +\mathrm{Tr}_{S,\sigma_k}(\sigma_k(c \wedge b_k)) +\] + +where $\mathrm{Tr}_{S,\sigma_i}$ is $\mathrm{Tr}$ modified by not +introducing quantification over variables derived for $\sigma_i(c)$, +calling $\mathtt{BL}_{S,\sigma_i}$ instead of $\mathtt{BL}$, and +calling $\TrRels_{S,\sigma_i}$ instead of +$\TrRels$. $\mathtt{BL}_{S,\sigma_i}(\sigma_i(s_j)) = +\mathtt{BL}(s_j)$, and $\mathtt{BL}_{S,\sigma_i}(t) = \mathtt{BL}(t)$ +for other terms. $\TrRels_{S,\sigma_i}$ is the same as $\TrRels$ except for when it is called on a non-stable GDL relation $R'$: + +\begin{align*} +\TrRels_{S,\sigma_i} (R'(t_1, \ldots, t_n), S_1, S_2) = & +\mathrm{GenDefRel}(R(t_1,\ldots,t_n), S_1 \setminus \sigma_i(S)) \textit{ (for } R \neq R' \textit{)} \\ +\TrRels_{S,\sigma_i} (R(t_1, \ldots, t_n), S_1, S_2) = & +\textit{somehow use the least fixpoint for } R_{def} \\ +\end{align*} +Observe that $\mathrm{Tr}_{\emptyset,\sigma_i} = \mathrm{Tr}$. + +Using memoization for $\mathrm{GenDefRel}$, we only generate a single +defined relation per atom of non-stable GDL relation occurring in +another non-stable GDL relation, even though we might generate +multiple Toss defined relations for the GDL relation containing the +atom. + +\section{Game Simplification in Toss} \label{sec-game-simpl} + Games automatically translated from GDL, as described above, are verbose compared to games defined manually for Toss. They are also inefficient, since the current solver in Toss works fast only for sparse relations. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luk...@us...> - 2011-05-19 10:44:40
|
Revision: 1447 http://toss.svn.sourceforge.net/toss/?rev=1447&view=rev Author: lukstafi Date: 2011-05-19 10:44:34 +0000 (Thu, 19 May 2011) Log Message: ----------- Reference specification of GDL translation: {Introducing and Using Defined Relations} a better approach, work in progress. Modified Paths: -------------- trunk/Toss/www/reference/reference.tex Modified: trunk/Toss/www/reference/reference.tex =================================================================== --- trunk/Toss/www/reference/reference.tex 2011-05-18 15:52:15 UTC (rev 1446) +++ trunk/Toss/www/reference/reference.tex 2011-05-19 10:44:34 UTC (rev 1447) @@ -92,6 +92,7 @@ \newcommand{\tpos}{\downharpoonleft} \newcommand{\TrRels}{\ensuremath{\mathrm{TrRels}}} \newcommand{\TrST}{\ensuremath{\mathrm{TrST}}} +\newcommand{\TrDefRels}{\ensuremath{\mathrm{TrDefRels}}} % Theorem environments \theoremstyle{plain} @@ -1863,13 +1864,14 @@ \subsubsection{Stable Relations and Fluents} -We normalize the GDL formula to be translated $\Phi$, which is composed of -conjunctions, disjunctions and literals, into a disjunction $\Phi_1 -\vee \ldots \vee \Phi_n$, so that every $\Phi_i \equiv G_i \wedge -ST^{+}_i \wedge ST^{-}_i$, where all literals in $G_i$ are other than -\texttt{true}, all literals in $ST^{+}_i$ are positive \texttt{true} -atoms, all literals in $ST^{-}_i$ are negated \texttt{true} atoms. (We -avoid unnecessary expansions.) Let $\mathrm{ST}(\phi)$ be all the +We normalize the GDL formula to be translated $\Phi$, which is +composed of conjunctions, disjunctions and literals, into a +disjunction $\mathrm{TrDistr}(\Phi) := \Phi_1 \vee \ldots \vee +\Phi_n$, so that every $\Phi_i = G_i \wedge ST^{+}_i \wedge ST^{-}_i$, +where all literals in $ST^{+}_i$ are positive \texttt{true} atoms and all +literals in $ST^{-}_i$ are negated \texttt{true} atoms, and literals +in $D_i$ are of relations to be translated as defined relations. (We +avoid unnecessary expansions.) Let $\mathtt{ST}(\phi)$ be all the state terms, \ie arguments of \texttt{true} atoms, in $\phi$. $\TrRels(\phi, S_1, S_2)$ descends $\phi$ translating each literal as a @@ -1885,20 +1887,21 @@ equality relations $Eq_{p,q}$. The result of translation is the disjunction of translations of each -$\Phi_i$. A single $\Phi_i \equiv G_i \wedge ST^{+}_i \wedge ST^{-}_i$ +$\Phi_i$. A single $\Phi_i = G_i \wedge ST^{+}_i \wedge ST^{-}_i$ is translated as: \begin{align*} -\rho_i := \exists \mathrm{ST}(ST^{+}_i) \big( & \TrRels(eqs_i -\wedge G_i, \mathrm{ST}(ST^{+}_i), \mathrm{ST}(ST^{+}_i)) \wedge -\TrST(ST^{+}_i) \wedge \\ & \neg \exists \mathrm{ST}(ST^{-}_i) \big( -\TrRels(eqs_i \wedge G_i, \mathrm{ST}(ST^{+}_i) \cup -\mathrm{ST}(ST^{-}_i), \mathrm{ST}(ST^{-}_i)) \wedge \\ & + \mathrm{Tr}(\Phi_i) := \exists \mathtt{ST}(ST^{+}_i) \big( & + \TrRels(eqs_i \wedge G_i, \mathtt{ST}(ST^{+}_i), \mathtt{ST}(ST^{+}_i)) + \wedge \TrST(ST^{+}_i) \wedge \\ & + \neg \exists \mathtt{ST}(ST^{-}_i) \big( +\TrRels(eqs_i \wedge G_i, \mathtt{ST}(ST^{+}_i) \cup +\mathtt{ST}(ST^{-}_i), \mathtt{ST}(ST^{-}_i)) \wedge \\ & \ \ \ \ \ \ \ \ \TrST(\mathtt{NNF}(\neg ST^{-}_i)) \big) \big) \end{align*} -The result of translation is $\mathrm{Tr}(\Phi) := \rho_1 \vee \ldots -\vee \rho_n$. +The result of translation is $\mathrm{Tr}(\Phi) := \mathrm{Tr}(\Phi_1) \vee \ldots +\vee \mathrm{Tr}(\Phi_n)$. We now proceed to define $\TrRels$ and $\TrST$. Let $\mathtt{BL}(t)$ be the term $t$ with fluent paths replaced with \texttt{BLANK}. @@ -1914,12 +1917,14 @@ v_1 = \mathtt{BL}(s_1) \wedge \ldots \wedge v_n = \mathtt{BL}(s_n) \wedge \\ & p_1, \ldots, p_n \in \calP_m \wedge s_1 \tpos_{p_1} = t_1 \wedge \ldots \wedge s_n \tpos_{p_n} = t_n \big\} \\ + & \textit{(when $R$ is a stable relation)} \\ \TrRels (\neg R(t_1, \ldots, t_n), S_1, S_2) = & \Land \big\{ \neg R_{p_1,\ldots,p_n}(v_1, \ldots, v_n) \; \big| \; s_1,\ldots,s_n \in S_1 \wedge \\ & \{s_1,\ldots,s_n \} \cap S_2 \neq \emptyset \wedge v_1 = \mathtt{BL}(s_1) \wedge \ldots \wedge v_n = \mathtt{BL}(s_n) \wedge \\ & p_1, \ldots, p_n \in \calP_m \wedge s_1 \tpos_{p_1} = t_1 \wedge \ldots \wedge s_n \tpos_{p_n} = t_n \big\} \\ + & \textit{(when $R$ is a stable relation)} \\ \TrST (\phi_1 \wedge \phi_2) = & \TrST (\phi_1) \wedge \TrST(\phi_2) \\ \TrST (\phi_1 \vee \phi_2) = & @@ -1932,71 +1937,57 @@ p \in \calP_f \wedge t \tpos_p = s \big\} \end{align*} +The case of $\TrRels$ for non-stable relations will be covered in the +next section. + \subsubsection{Introducing and Using Defined Relations} -A new Toss defined relation is generated for each atom of a GDL -non-stable relation, with parameters of the defined relation derived -from the use context. Yet the GDL non-stable relations can themselves -depend on other defined relations. We therefore generate Toss defined -relations in a stratified order, so that all Toss definitions of a -single GDL relation are generated from its (single) pre-processed -form, with the Toss defined relations it uses already generated. This -can lead to less constraining relations than their GDL originals, -because all interaction between the strata is mediated by local -variables, \ie when $R_3$ calls $R_2$ which calls $R_1$, $R_1$ defined -relation is created for the $R_2$-$R_1$ context, ignoring the $R_3$-$R_2$ -context. Should it pose problems in practice, countermeasures like -inlining can be used. +Consider generating defined relation for relation $R$ with GDL +defining clauses $\mathtt{(<= (R \ t^1_1 \ldots t^1_n) \ b_1)}, +\ldots, \mathtt{(<= (R \ t^k_1 \ldots t^k_n) \ b_k)}$. For $i$th +argument of $R$ ($i \in \{1,\ldots,n\}$) we will find +$\mathtt{ArgType}(R,i)$ with possible values +$(\mathtt{DefSide},\calS_i,p_i)$, $(\mathtt{CallSide},\calS_i,p_i)$ or +$(\mathtt{NoSide},p_i)$, with a mapping $\calS_i$ into state terms +corresponding to the argument in a given context and a path $p_i \in +\calP_m$ corresponding to the subterm position selected to +``transfer'' the argument. -Consider translating a GDL formula $\Phi$ with atoms of non-stable GDL -relations, we therefore need to generate Toss defined relations for -them. Let $R$ be non-stable GDL relation. We update $\TrRels$ to: +Let $\mathrm{TrDistr}(b_j) = D^j_1 \wedge G^j_1 \wedge ST^{j+}_1 +\wedge ST^{j-}_1 \vee \ldots \vee D^j_{m_j} \wedge G^j_{m_j} \wedge ST^{j+}_{m_j} +\wedge ST^{j-}_{m_j}$. Let $\calS_i$ be a mapping from $(j,l)$ to +$s^i_{j,l} \in \mathtt{ST}(ST^{j+}_l)$ and $p_i \in \calP_m$ a path such that +$s^i_{j,l} \tpos_{p_i} = t^j_i$. If such a path and (total for $j,l$) mapping exist, +then $\mathtt{ArgType}(R,i) = (\mathtt{DefSide},\calS_i,p_i)$. -\[\TrRels (R(t_1, \ldots, t_n), S_1, S_2) = -\mathrm{GenDefRel}(R(t_1,\ldots,t_n), S_1) \] +Otherwise, let $r = R(u_1,\ldots,u_n)$ be an atom of $R$ occurring in +the $\Phi_d = G \wedge ST^{+} \wedge ST^{-}$ disjunct of +$\mathrm{TrDistr}$ result for arbitrary clause of the GDL game +definition. Let $\calS_i$ be a mapping from $\Phi_d$ to $s^i_{\Phi_d} +\in \mathtt{ST}(ST^{+})$ and $p_i \in \calP_m$ a path such that +$s^i_{\Phi_d} \tpos_{p_i} = u_i$. If such a path and (total for +$\Phi_d$) mapping exist, then $\mathtt{ArgType}(R,i) = +(\mathtt{CallSide},\calS_i,p_i)$. -$\mathrm{GenDefRel}$ generates and stores Toss defined relation -$R_{def}$ under context $S_1$, and returns $R_{def}$ applied to -variables corresponding to state terms from $S_1$. Additional pass can -be added to game simplification (see Section~\ref{sec-game-simpl}) to -remove unused parameters of definitions and conflate equivalent -definitions. +Still therwise, let $p_i \in \calP_m$ be a path whose domain, \ie the +set $\big\{t \big| s\tpos_{p_i} = t, s \in \calS\big\}$, contains the +domain of the $i$th argument of $R$, \ie the sum of projections of $R$ +on $i$th argument for all possible game states. Let +$\mathtt{ArgType}(R,i) = (\mathtt{NoSide},p_i)$. -Consider generating defined relation for atom $r$ of relation $R$ with -GDL defining clauses $\mathtt{(<= h_1 \ b_1)}, \ldots, \mathtt{(<= h_k - \ b_k)}$. Let the context be a set $S$ of state terms, arbitrarily -ordered into a sequence $(s_1,\ldots,s_m)$. Let $\sigma_i = -\mathtt{MGU} (r, h_i)$ and $c = \mathtt{true}(s_1) \wedge \ldots -\wedge \mathtt{true}(s_m)$. The result of translation is - +We are ready to provide the translated definition. Let $\big\{v_i \big| +\mathtt{ArgType}(R,i) = (\mathtt{DefSide},\calS_i,p_i)\big\}$ be fresh Toss variables, and let $\mathrm{Tr}(G^j_l +\wedge ST^{j+}_l) = \exists \mathtt{ST}(ST^{+}_i) \phi^j_l$. The +translation is: \[ -R_{def}(\mathtt{BL}(s_1),\ldots,\mathtt{BL}(s_m)) = -\mathrm{Tr}_{S,\sigma_1}(\sigma_1(c \wedge b_1)) \vee \ldots \vee -\mathrm{Tr}_{S,\sigma_k}(\sigma_k(c \wedge b_k)) +R_{def}(v_1,\ldots,v_n) = \big(\exists \mathtt{ST}(ST^{+}_i) +\big(\bigwedge \big\{v_1=s^i_{j,l} \big| \mathtt{ArgType}(R,i) = +(\mathtt{DefSide},\calS_i,p_i)\big\} \wedge +\mathtt{BL}(\phi^j_l) \big) \vee \ldots \vee \big) + \] -where $\mathrm{Tr}_{S,\sigma_i}$ is $\mathrm{Tr}$ modified by not -introducing quantification over variables derived for $\sigma_i(c)$, -calling $\mathtt{BL}_{S,\sigma_i}$ instead of $\mathtt{BL}$, and -calling $\TrRels_{S,\sigma_i}$ instead of -$\TrRels$. $\mathtt{BL}_{S,\sigma_i}(\sigma_i(s_j)) = -\mathtt{BL}(s_j)$, and $\mathtt{BL}_{S,\sigma_i}(t) = \mathtt{BL}(t)$ -for other terms. $\TrRels_{S,\sigma_i}$ is the same as $\TrRels$ except for when it is called on a non-stable GDL relation $R'$: -\begin{align*} -\TrRels_{S,\sigma_i} (R'(t_1, \ldots, t_n), S_1, S_2) = & -\mathrm{GenDefRel}(R(t_1,\ldots,t_n), S_1 \setminus \sigma_i(S)) \textit{ (for } R \neq R' \textit{)} \\ -\TrRels_{S,\sigma_i} (R(t_1, \ldots, t_n), S_1, S_2) = & -\textit{somehow use the least fixpoint for } R_{def} \\ -\end{align*} -Observe that $\mathrm{Tr}_{\emptyset,\sigma_i} = \mathrm{Tr}$. - -Using memoization for $\mathrm{GenDefRel}$, we only generate a single -defined relation per atom of non-stable GDL relation occurring in -another non-stable GDL relation, even though we might generate -multiple Toss defined relations for the GDL relation containing the -atom. - \section{Game Simplification in Toss} \label{sec-game-simpl} Games automatically translated from GDL, as described above, are verbose This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luk...@us...> - 2011-05-21 22:28:07
|
Revision: 1450 http://toss.svn.sourceforge.net/toss/?rev=1450&view=rev Author: lukstafi Date: 2011-05-21 22:28:01 +0000 (Sat, 21 May 2011) Log Message: ----------- Reference specification of GDL translation: minor correction. Modified Paths: -------------- trunk/Toss/www/reference/reference.tex Modified: trunk/Toss/www/reference/reference.tex =================================================================== --- trunk/Toss/www/reference/reference.tex 2011-05-21 14:32:28 UTC (rev 1449) +++ trunk/Toss/www/reference/reference.tex 2011-05-21 22:28:01 UTC (rev 1450) @@ -1315,15 +1315,13 @@ of all GDL state terms which are true at some game state reachable from the initial state of $G$. -For us, it is enough to approximate $\calS$ from above. To approximate $\calS$ -and determine the location structure of the Toss game, we currently perform -an \emph{aggregate playout}, \ie a symbolic play in where all players take -all their legal moves in a state. Since an approximation is sufficient, -we check only the positive part of the legality condition of each move. +For us, it is enough to approximate $\calS$ from above. To approximate +$\calS$, we currently perform an \emph{aggregate playout}, \ie a +symbolic play in where all players take all their legal moves in a +state. Since an approximation is sufficient, we check only the +positive part of the legality condition of each move. -%The \emph{noop move} of a player in a -%location is the only move available to her, determining them gives the -%player of a turn. In the future, instead of an aggregate playout we +%In the future, instead of an aggregate playout we %might use a form of type inference to approximate $\calS$. To construct the elements of the structure from state terms, @@ -1886,8 +1884,7 @@ equality relations $Eq_{p,q}$. The result of translation is the disjunction of translations of each -$\Phi_i$. Let $\mathtt{BL}(t)$ -be the term $t$ with fluent paths replaced with \texttt{BLANK}. A single $\Phi_i = G_i \wedge ST^{+}_i \wedge ST^{-}_i$ +$\Phi_i$. Let $\mathtt{BL}(t)=t\big[\calP_f \ot \mathtt{BLANK}\big]$. A single $\Phi_i = G_i \wedge ST^{+}_i \wedge ST^{-}_i$ is translated as: \begin{align*} @@ -1947,7 +1944,7 @@ \ldots, \mathtt{(<= (R \ t^k_1 \ldots t^k_n) \ b_k)}$. For $i$th argument of $R$ ($i \in \{1,\ldots,n\}$) we will find $\mathtt{ArgType}(R,i)$ with possible values -$(\mathtt{DefSide},\calS_i,p_i)$ and $(\mathtt{CallSide},\calS_i,p_i)$, with a mapping $\calS_i$ into state terms +$(\mathtt{DefSide},\calS_i,p_i)$ and $(\mathtt{CallSide},p_i)$, with a mapping $\calS_i$ into state terms corresponding to the argument in a given context and a path $p_i \in \calP_m$ corresponding to the subterm position selected to ``transfer'' the argument. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luk...@us...> - 2011-05-22 11:11:12
|
Revision: 1452 http://toss.svn.sourceforge.net/toss/?rev=1452&view=rev Author: lukstafi Date: 2011-05-22 11:11:05 +0000 (Sun, 22 May 2011) Log Message: ----------- Reference specification of GDL translation: fixes and cleanup. Modified Paths: -------------- trunk/Toss/www/reference/reference.tex Modified: trunk/Toss/www/reference/reference.tex =================================================================== --- trunk/Toss/www/reference/reference.tex 2011-05-22 00:36:07 UTC (rev 1451) +++ trunk/Toss/www/reference/reference.tex 2011-05-22 11:11:05 UTC (rev 1452) @@ -1928,10 +1928,12 @@ \TrST (\phi_1) \vee \TrST(\phi_2) \\ \TrST (\mathtt{true}(t)) = & \Land \big\{ Anch^s_p(v) \; \big| \; v = \mathtt{BL}(t) \wedge - p \in \calP_m \wedge t \tpos_p = s \big\} \wedge \\ + p \in \calP_m \wedge t \tpos_p = s \wedge s \neq \mathtt{BLANK} + \big\} \wedge \\ & \Land \big\{ Flu^s_p(v) \; \big| \; v = \mathtt{BL}(t) \wedge - p \in \calP_f \wedge t \tpos_p = s \big\} + p \in \calP_f \wedge t \tpos_p = s \wedge s \neq \mathtt{BLANK} + \big\} \end{align*} The case of $\TrRels$ for non-stable relations will be covered in the @@ -2007,18 +2009,20 @@ \begin{align*} \TrRels (\pm R(t_1, \ldots, t_n), S_1, S_2) = & - \exists \{v_1,\ldots,v_n\} \ \pm R_{def}(v_1, \ldots, v_n) \wedge \\ & - \Land \big\{\exists \mathtt{BL}(p_{R,i}\ot t_i) \big( - v_i = \mathtt{BL}(p_{R,i}\ot t_i) \wedge \\ & - \ \ \ \TrRels (\mathtt{EQ}(t_i,t_i), - S_1 \cup \{\mathtt{BL}(p_{R,i}\ot t_i)\}, - \{\mathtt{BL}(p_{R,i}\ot t_i)\}) \big) \\ & - \ \ \big| \ i \in \calI_R \vee - \neg \exists s \in S_1 (s\tpos_{p_{R,i}} = t_i) \big\} \wedge \\ & - \Land \big\{v_i = s - \ \big| \ i \not\in \calI_R \wedge - \exists s \in S_1 (s\tpos_{p_{R,i}} = t_i) \big\} \\ & - \textit{(when $R$ is not a stable relation)} + \exists \{v_i \ | \ i \in \calJ \} \big( + \pm R_{def}(v_1, \ldots, v_n) \wedge \\ & + \Land \big\{ + \TrRels (\mathtt{EQ}(t_i,t_i), + S_1 \cup \{v_i\}, \{v_i\}) + \ \big| \ i \in \calJ \big\} \big) \\ & + \textit{(when $R$ is not a stable relation)} \\ + \textit{where} \\ + \calJ = & + \big\{i \ \big| \ i \in \calI_R \vee + \neg \exists s \in S_1 (s\tpos_{p_{R,i}} = t_i) \big\} \\ + v_i = \mathtt{BL}(p_{R,i}\ot t_i) & \textit{ if } i \in \calJ \\ + v_i = \mathtt{BL}(s) & \textit{ if } i \not\in \calJ + \textit{ where $s$ such that } s \in S_1 \wedge s\tpos_{p_{R,i}} = t_i \end{align*} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luk...@us...> - 2011-05-22 14:52:07
|
Revision: 1454 http://toss.svn.sourceforge.net/toss/?rev=1454&view=rev Author: lukstafi Date: 2011-05-22 14:52:01 +0000 (Sun, 22 May 2011) Log Message: ----------- Reference specification of GDL translation: missing case of mask predicates. Modified Paths: -------------- trunk/Toss/www/reference/reference.tex Modified: trunk/Toss/www/reference/reference.tex =================================================================== --- trunk/Toss/www/reference/reference.tex 2011-05-22 13:40:35 UTC (rev 1453) +++ trunk/Toss/www/reference/reference.tex 2011-05-22 14:52:01 UTC (rev 1454) @@ -1489,7 +1489,8 @@ We say that a term $m$ is a \emph{mask term} if the paths to all variables of $m$ are contained in $\calP_m \cup \calP_f$ and for each $p \in \calP_m \cup \calP_f$ if $p$ exists in $m$ then $m \tpos_p$ is -a variable. We say that $m$ \emph{masks} a terms $t$ if there exists +a variable. We say that $m$ \emph{masks} a term $t$ if $m$ is a mask term +and there exists a substitution $\sigma$ such that $\sigma(m) = t$. For all mask terms $m \in \calS$ we introduce the \emph{mask predicate} $Mask_m$. Mask predicates are similar to the anchor predicates, but instead of @@ -1933,7 +1934,9 @@ & \Land \big\{ Flu^s_p(v) \; \big| \; v = \mathtt{BL}(t) \wedge p \in \calP_f \wedge t \tpos_p = s \wedge s \neq \mathtt{BLANK} - \big\} + \big\} \wedge \\ + & \Land \big\{ + Mask_m(v) \; \big| \; v = \mathtt{BL}(t) \wedge m \textit{ masks } t \big\} \end{align*} The case of $\TrRels$ for non-stable relations will be covered in the This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luk...@us...> - 2011-05-26 22:02:54
|
Revision: 1460 http://toss.svn.sourceforge.net/toss/?rev=1460&view=rev Author: lukstafi Date: 2011-05-26 22:02:48 +0000 (Thu, 26 May 2011) Log Message: ----------- Reference specification of GDL translation: {Concurrent Moves and Toss Locations}. Modified Paths: -------------- trunk/Toss/www/reference/reference.tex Modified: trunk/Toss/www/reference/reference.tex =================================================================== --- trunk/Toss/www/reference/reference.tex 2011-05-26 00:56:05 UTC (rev 1459) +++ trunk/Toss/www/reference/reference.tex 2011-05-26 22:02:48 UTC (rev 1460) @@ -1864,51 +1864,7 @@ such that $t\tpos_p = v$, and $a\tpos^m_p = s$, then we substitute $v$ by $s$. The move translation function $\mu$ is thus constructed. -\subsubsection{Concurrent Moves and Toss Locations} \label{subsec-concurrency} -In Section~\ref{subsec-rules}, we described the creation of -state-transition rewrite rules, \ie where a single Toss rule is -responsible for the transition to the next game state. But we also -remarked that the rule clauses can be divided by players to whose -actions they refer (by the \texttt{does} relation). In this case the -game state transition is jointly described by several Toss rules that -apply independently, each rule ``enacted'' by a player; such is the -default way of defining simultaneous moves in Toss. We now elaborate -on three modes of building the game graph in the translated game. - -\paragraph{Turn-based Games} are games where in any game state there -is at most a single player having genuine choice. Rather than -attempting a complex analysis to detect as many turn-based games as -possible, we recognize some cases where in all states, all players but -one have a single legal move that is a constant (term of size -one). Such move is conventionally called \texttt{noop}. We simply -check what moves are available to players in the states of the -aggregate playout. Due to the character of aggregate playout, we only -handle the case where the alternation of control forms a cycle -(players do not need to strictly alternate, for example a -single-player game is also a turn-based game, as another example in a -three-player game the first player may intersperse the moves of second -and third player). We build a corresponding cyclic graph of Toss -locations. - -\paragraph{Concurrent Moves Games} \label{par-concurrent-moves} When -translation as a turn-based game fails, but all rule clauses have at -most one atom of \texttt{does} relation, we divide the clauses among -players as mentioned earlier. For the clauses wihout \texttt{does} -atoms, a new player, ``environment'', is created. We designate the -``environment'' player to have all its matching rules applied, over -all embeddings, at each state transition. We translate using a -single-location game graph. (TODO: less terse descr) - -\paragraph{General Interaction Games} When some rule clause has -multiple \texttt{does} relations, we cannot use straightforward -translation of the previous paragraph. Instead, we translate into a -two-location graph, where game players declare their moves in one -location, and the (now obligatory) ``environment'' player carries out -state changes in the other location. In effect, large parts of the -translation function $\mu$ are built into the game. (TODO: will -specify soon) - \subsection{Translating Formulas} \label{subsec-translate} First we describe translation in the case all GDL relations other than @@ -2087,6 +2043,92 @@ \end{align*} +\subsection{Concurrent Moves and Toss Locations} \label{subsec-concurrency} + +In Section~\ref{subsec-rules}, we described the creation of +state-transition rewrite rules, \ie where a single Toss rule is +responsible for the transition to the next game state. But we also +remarked that the rule clauses can be divided by players to whose +actions they refer (by the \texttt{does} relation). In this case the +game state transition is jointly described by several Toss rules that +apply independently, each rule ``enacted'' by a player; such is the +default way of defining simultaneous moves in Toss. We now elaborate +on three modes of building the game graph in the translated game. + +\subsubsection{Turn-based Games} are games where in any game state there +is at most a single player having genuine choice. Rather than +attempting a complex analysis to detect as many turn-based games as +possible, we recognize some cases where in all states, all players but +one have a single legal move that is a constant (term of size +one). Such move is conventionally called \texttt{noop}. We simply +check what moves are available to players in the states of the +aggregate playout. Due to the character of aggregate playout, we only +handle the case where the alternation of control forms a cycle +(players do not need to strictly alternate, for example a +single-player game is also a turn-based game, as another example in a +three-player game the first player may intersperse the moves of second +and third player). We build a corresponding cyclic graph of Toss +locations. + +\subsubsection{Concurrent Moves Games} \label{par-concurrent-moves} +When translation as a turn-based game fails, but all rule clauses have +at most one atom of \texttt{does} relation, we divide the clauses +among players as mentioned earlier. We translate using a +single-location game graph. The \texttt{next} clauses wihout +\texttt{does} atoms, are assigned to a special player, +``environment''. + +% The \texttt{next} clauses assigned to the ``environment'' player should +% ideally form rewrite rule(s) that has all its matchings applied, +% over all embeddings, at each state transition. + +To synchronize the play, we introduce an additional element, or use an +existing element singled-out by a stable singleton predicate, and we +introduce \emph{player marker} predicates $Player_{p_i}$ for each +player $p_i$. We require that the player marker be absent in the +corresponding player's rule left-hand-sides, and we add it over the +singled-out element by each rule. Finally, we build a rule for the +``environment'' player that expects player markers for all players, +and clears them all at once. + +The \texttt{next} clauses assigned to the ``environment'' player +together with the player marker clearing can form a single rewrite +rule, or these can be separate rewrite rules. + +If rewriting all matchings, as in the previous comment, is +implemented, then these should be separate rules for ``environment'', +otherwise having a single rewrite rule seems neat. + +\subsubsection{General Interaction Games} When some rule clause has +multiple \texttt{does} relations, we cannot use straightforward +translation of the previous section. Instead, we use the +``environment'' player to carry out state changes, and have the +players declare their moves by their rewrite rules. + +This mode of translation differs from the ``standard modes'' in the +way the \texttt{does} atoms are expanded by the \texttt{legal} +clauses. For each \texttt{legal} clause we introduce a fresh GDL +relation over the variables of the head of the \texttt{legal} +clause. Instead of fully substituting \texttt{does} atoms by +\texttt{legal} clause bodies in a \texttt{next} clause body, we now +substitute by applications of the freshly introduced relations. Later, +we translate the introduced relations coupled with \texttt{legal} +clause bodies as defined relations. But we will not add the +``\texttt{legal} defined relations'' to the Toss game definition, +instead we will use their defining formulas to derive rewrite rules +for players. The introduced ``\texttt{legal} defined relation names'' +will be the fluents added by the player rules, we will call them +\emph{move markers}. Unlike the game state fluents $Flu^s_p$, the move +markers will usually have arity higher than one. Due to the injective +nature of rewrite rules (the matchings are graph embeddings), we +generate additional rewrite rules where some arguments of move markers +are made equal and the right-hand-sides of the rules are +correspondingly smaller. + +Besides move markers, player rules also introduce player markers, as +in the previous section. The move and player markers are erased by the +game state transition rule of the ``environment'' player. + \section{Game Simplification in Toss} \label{sec-game-simpl} Games automatically translated from GDL, as described above, are verbose This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luk...@us...> - 2011-07-19 15:21:02
|
Revision: 1516 http://toss.svn.sourceforge.net/toss/?rev=1516&view=rev Author: lukstafi Date: 2011-07-19 15:20:56 +0000 (Tue, 19 Jul 2011) Log Message: ----------- Reference specification: expanding the scope of translation (wave clauses). Modified Paths: -------------- trunk/Toss/www/reference/reference.tex Modified: trunk/Toss/www/reference/reference.tex =================================================================== --- trunk/Toss/www/reference/reference.tex 2011-07-16 21:54:34 UTC (rev 1515) +++ trunk/Toss/www/reference/reference.tex 2011-07-19 15:20:56 UTC (rev 1516) @@ -1326,8 +1326,8 @@ state. Since an approximation is sufficient, we check only the positive part of the legality condition of each move. -%In the future, instead of an aggregate playout we -%might use a form of type inference to approximate $\calS$. +In the future, instead of an aggregate playout we +might use a form of type inference to approximate $\calS$. To construct the elements of the structure from state terms, and to make that structure a good representation of the game in Toss, @@ -1359,15 +1359,29 @@ Definition~\ref{def-merge}, and of equally similar has smallest $d\calP(s,t)$ (if there are several, we pick one arbitrarily). + +\paragraph{Wave Clauses} + +Let \emph{wave clauses} $\mathrm{Next}_{W}$ be defined as follows: +$\calC \in \mathrm{Next}_{W}$ if there is $\calC' \in +\mathrm{Next}_{e}$ derived from $\calC$ such that the set of subterms +$s_{\calC'} \tpos d\calP(s_\calC, t_\calC)$ contains a variable. Let +the remaining expanded clauses be $\mathrm{Next}_{f} = \{\calC \in +\mathrm{Next}_{e} | FV(s_{\calC} \tpos d\calP(s_\calC, t_\calC)) = +\emptyset \}$. Wave clauses propagate information across terms rather +than describing a change of a term. + +\paragraph{Fluent Paths and Structure Elements} + We often use the word \emph{fluent} for changing objects, and so we define the set of \emph{fluent paths}, $\calP_f$, in the following way. We say that a term $t$ is a \emph{negative true} in a clause $\calC$ if it is the argument of a negative occurrence of \texttt{true} in $\calC$. -We write $\calL(t)$ for the set of path to all constant leaves in $t$. +We write $\calL(t)$ for the set of paths to all constant leaves in $t$. The set \[ \calP_f \ = \ - \bigcup_{\calC \in \mathrm{Next}_{e}} d\calP(s_\calC, t_\calC) \ \cup \ - \bigcup_{\calC \in \mathrm{Next}_{e},\ + \bigcup_{\calC \in \mathrm{Next}_{f}} d\calP(s_\calC, t_\calC) \ \cup \ + \bigcup_{\calC \in \mathrm{Next}_{f},\ t_\calC \text{ negative true in } \calC} \calL(t_\calC). \] Note that $\calP_f$ contains all merge sets for the selected terms in @@ -1618,6 +1632,12 @@ be the players in $G$, \ie let there be \texttt{(role $p_1$)} up to \texttt{(role $p_n$)} facts in $G$, in this order. +Prior to further processing, we modify the wave clauses of the +game. Let $\calN \in \mathrm{Next}_{W}$, we add to the body of $\calN$ +a \texttt{true} atom $(\mathtt{true} \ BL(s_\calN)$ (where +$\mathtt{BL}(t)=t\big[\calP_f \ot \mathtt{BLANK}\big]$). The added +state term will be the corresponding LHS element of the RHS element +introduced by the clause. \subsubsection{Move Clauses} @@ -1744,7 +1764,11 @@ We determine which clauses are frame clauses prior to partitioning into the rule clauses and computing the substitution $\sigma_{\ol{\calC},\ol{\calN}}$ -- at the point where fluent paths -are computed. +are computed. It is unclear which wave clauses should be considered +frame clauses -- we optimistically assume that all wave clauses not +depending on player actions (\ie not containing \texttt{does}) are +frame clauses (and in the current implementation we ignore frame-wave +clauses as they do not provide useful erasure clauses). From the frame clauses in $\sigma_{\ol{\calC}, \ol{\calN}}(\calN_1), \dots, \sigma_{\ol{\calC}, \ol{\calN}}(\calN_m)$, we select subsets $J$ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |