On optimum left-to-right strategies for context-free games
←
→
Page content transcription
If your browser does not render page correctly, please read the page content below
On optimum left-to-right strategies for
context-free games
H. Björklund1 M. Schuster2 T. Schwentick2
J. Kulbatzki3
1 Umeå University
2 TU Dortmund
3 SCISYS Deutschland GmbH
To be presented at ICDT 2013XML
Dortmund
City
9◦ C/rain
Name Meteo Events
Dortmund 9◦ C/rain Sports ConcertXML
City
City → Name, Meteo, Events
Name → S TRING
Meteo → S TRING Name Meteo Events
Events → (Sports|Concert)*
.. Dortmund 9◦ C/rain Sports Concert
.Active XML
City → Name, Meteo, Events
Name → S TRING City
Meteo → @meteo_svc
Events → @event_svc Name Meteo Events
event_svc: → (Sports|Concert)*
meteo_svc: → S TRING Dortmund @meteo_svc @event_svc
..
.The Schema Rewriting Problem
Server Client
City → Name, Meteo, Events City → Name, Meteo, Events
Events → @event_svc Events → Sports*|Concert*
event_svc: → (Sports|Concert)*
Server (CC-BY-SA 3.0) RRZE Icons, Client (LGPL) Everaldo Coelho
Goal: Rewrite server documents into client schema
Milo et al., 2003: Sufficient to examine each node’s child string
Rewriting problem for words
(Muscholl, Schwentick, Segoufin 2006) Context-free gamesContext-free Games: Intuition
Basic idea:
Two-player game on Example
strings T = {afba, aafafa, abafa},
J ULIET chooses function f → af | b
symbols af f a
ROMEO chooses return ↓
values af afa
↓
J ULIET wins if a target
abafa
string is reachedContext-Free Games
Definition
A context-free game G = (Σ, R, T ) consists of
◮ a finite alphabet Σ,
◮ a rule set R ⊆ Σ × Σ∗
◮ and a regular target language T ⊆ Σ∗ ,
such that for each f ∈ Σ, the set Rf =def {u | (f , u) ∈ R} is regular.
Rules of the Game
On a given string, J ULIET has the following moves:
◮ "Read ": Go one symbol to the right;
◮ "Call ": Have R OMEO replace the next symbol;
◮ "LS": Jump to the string’s left end.
J ULIET wins if the current string is in T .Winning strategies
Intuitively, J ULIET has a winning strategy (on w in G) if she can
always win the game, no matter how ROMEO plays.
safe(G) = {w ∈ Σ∗ | J ULIET has a winning strategy on w in G}
[MSS06]: safe(G) is undecidable
restricted strategies for J ULIET ...
...that simplify implementationLeft-To-Right Strategies
Definition
A Left-to-right (L2R) strategy is a strategy σ ∈ STRAT, in which
J ULIET never does a LS move.
safeL2R (G) = {w ∈ Σ∗ |
J ULIET has a winning L2R strategy on w in G}
Theorem[MSS06]
Let G = (Σ, R, T ) be a context-free game where T is
represented by a DFA. Then safeL2R (G) is regular and
EXPTIME-complete.General vs. L2R Strategies
Here, J ULIET has a winning
Example strategy...
T = ...but no winning L2R strategy.
{afba, aafafa, abafa}, When is this the case?
f → af | b
af f a L2RA LL
↓ Input: Context-free game G
af afa Question: safe(G) = safeL2R (G)?
↓
abafa Abiteboul et al. 2005:
L2RA LL claimed undecidable.Our Results Let G = (Σ, R, T ) be a context-free game with target language T represented as a DFA A(T ) = (Q, Σ, δ, q0 , F ) Theorem L2RA LL is EXPSPACE-complete. Special case: R is finite Theorem L2RA LL is EXPTIME-complete for games with explicitly enumerated finite replacement languages.
Basic Ideas
Want to decide, whether safe(G) \ safeL2R (G) = ∅.
Problem: safe(G) generally undecidable.
Solution: Simpler "non-L2R" strategies suffice
L2R+
A strategy σ of J ULIET is a L2R+ strategy if J ULIET always
◮ plays LS at most once and
◮ plays at most one Call before the LS-move.
Lemma
Let G be a context-free game. Then safe(G) = safeL2R (G) if
and only if safeL2R+ (G) = safeL2R (G).
Therefore: G ∈ L2RA LL ⇔ safeL2R+ (G) \ safeL2R (G) = ∅.NFA for safeL2R (G)
Lemma
(a) There exists an NFA AL2R (G) with state set P(Q) and
L(AL2R (G)) = safeL2R (G);
(b) There exists an NFA Ab L2R (G) with state set P(Q) and
b ∗
L(AL2R (G)) = Σ \ safeL2R (G).
(c) These NFA can be computed in exponential time.Upper Bounds
Theorem
L2RA LL ∈ EXPSPACE
Proof idea: Show Σ∗ \ L2RA LL ∈ NEXPSPACE by guessing a
string ufw ∈ safeL2R+ (G) \ safeL2R (G).
To verify:
Check (using Ab L2R (G)) that ufw ∈
/ safeL2R (G)
Check that uvw ∈ safeL2R (G) for all v ∈ Rf
with |v| ≤ |Qf | · 2|Q| .
Standard pumping argument on AL2R × A(Rf ):
If there is a string v ∈ Rf s.t. uvw ∈
/ safeL2R (G),
then there is one of length ≤ |AL2R × A(Rf )| = |Qf | · 2|Q|Lower Bounds
Theorem
L2RA LL is EXPSPACE-hard.
Proof idea: Reduction from
Example
E XPONENTIAL W IDTH
U={ , , , , , ,
C ORRIDOR T ILING
, , , , }
Given ui = ,uf = , n = 2
◮ a set U of tiles,
◮ an initial tile ui ∈ U,
◮ a final tile uf ∈ U,
◮ a unary number n,
is there a valid tiling of width
2n ?Lower Bounds
(Proof Idea)
Encode tilings as strings:
.. 00 01 10 11# 00 01 10 11#. . .
.
Want: gvf ∈ safeL2R+ (G) \ safeL2R (G) iff v valid tiling
Main part of target language: gvh + g ′ vh′ for valid tiling v
Rules g → g ′ , f → h | h′ ensure L2R+
L2R pass on v:
J ULIET tries to verify that v encodes valid tiling
R OMEO objects to inconsistencies.
Protest technique [MSS06]Lower Bounds
(Protest technique, example)
ROMEO has to flag mismatched tiles
→ Force J ULIET to call every tile
→ Add marked tiles Ub
↓
b 00 b 01 @ 10 11# 00 01 10 11# . . .
Target language contains
no string with @ right of unmarked tiles
(prevent J ULIET from cheating)
all strings with only marked tiles left of @
(prevent @-abuse by ROMEO)Summary
Our Results
L2RA LL is
◮ EXPSPACE-complete in general,
◮ EXPTIME-complete for games with explicitly enumerated
finite replacement languages.
Main tools and techniques:
L2R+ strategies to capture "non-L2R-winnable" words,
Effects to summarize gameplay,
Protest technique to prove lower bounds.
Outlook
One-pass (1P) strategies:
safe1P (G) = safeL2R (G) not known to be decidable.
Context-free games on trees.Literature I
S. Abiteboul, T. Milo, O. Benjelloun.
Regular rewriting of active XML and unambiguity.
PODS 2005, 295–303
T. Milo, S. Abiteboul, B. Amann, O. Benjelloun, F. Dang
Ngoc.
Exchanging intensional XML data.
ACM Trans. Database Syst.,30(1):1–40, 2005
A. Muscholl, T. Schwentick, L. Segoufin.
Active Context-Free Games.
Theory Comput. Syst., 39(1):237–276, 2006You can also read