Upload
michael-soltys
View
144
Download
1
Embed Size (px)
DESCRIPTION
This is a presentation given at the University of California at San Diego on December 3, 2013 (and at McMaster on February 6, 2013) based on the eponymous paper by Sam Buss and Michael Soltys: http://arxiv.org/abs/1211.7161
Citation preview
Unshu!ing a Square is NP-hard
Sam Buss and Michael Soltys
February 6, 2013
Unshuffling - Buss & Soltys Slides - Feb 6, 2013 Title - 1/27
Shu!e
w is the shu!e of u, v : w = u ! v
w = 0110110011101000
u = 01101110
v = 10101000
w = 0110110011101000
Unshuffling - Buss & Soltys Slides - Feb 6, 2013 Definition - 2/27
Shu!e
w is the shu!e of u, v : w = u ! v
w = 0110110011101000
u = 01101110
v = 10101000
w = 0110110011101000
w is a shu!e of u and v provided:
u = x1x2 · · · xk
v = y1y2 · · · yk
and w obtained by “interleaving” w = x1y1x2y2 · · · xkyk .
Unshuffling - Buss & Soltys Slides - Feb 6, 2013 Definition - 2/27
Square Shu!e
w is a square provided it is equal to a shu!e of a u with itself, i.e.,"u s.t. w = u ! u
The string w = 0110110011101000 is a square:
w = 0110110011101000
andu = 01101100 = 01101100
Unshuffling - Buss & Soltys Slides - Feb 6, 2013 Definition - 3/27
Result
given an alphabet ", |"| # 7,
Square = {w : "u(w = u ! u)}
is NP-complete.
What we leave open:
! What about |"| = 2 (for |"| = 1, Square is just the set ofeven length strings)
! What about if |"| = $ but each symbol cannot occur moreoften than, say, 6 times (if each symbol occurs at most 4times, Square can be reduced to 2-Sat – see P. AustrinStack Exchange post bit.ly/WATco3)
Unshuffling - Buss & Soltys Slides - Feb 6, 2013 Definition - 4/27
Bipartite graph
w = (c1x3c2)2(c1x2c2)2(c1xc2)2 is a square:
w = u ! u where u = c1xxxc2xc2c1xc1xc2.
Unshuffling - Buss & Soltys Slides - Feb 6, 2013 Definition - 5/27
Bipartite graph
w = (c1x3c2)2(c1x2c2)2(c1xc2)2 is a square:
w = u ! u where u = c1xxxc2xc2c1xc1xc2.
Bipartite graph G associated with particular solution w = u ! u:
c1 x x x c2 c1 x x x c2 c1 x x c2 c1 x x c2 c1 x c2 c1 x c2
Unshuffling - Buss & Soltys Slides - Feb 6, 2013 Definition - 5/27
Bipartite graph
w = (c1x3c2)2(c1x2c2)2(c1xc2)2 is a square:
w = u ! u where u = c1xxxc2xc2c1xc1xc2.
Bipartite graph G associated with particular solution w = u ! u:
c1 x x x c2 c1 x x x c2 c1 x x c2 c1 x x c2 c1 x c2 c1 x c2
We also have w = v ! v with v = c1x3c2c1x2c2c1xc2
which would have its associated bipartite graph
Unshuffling - Buss & Soltys Slides - Feb 6, 2013 Definition - 5/27
Nesting
a b a b a b b a
G has the “non-nesting” property: if G contains an edge from wk
to w! and an edge from wp to wq, then it is not the case thatk < p < q < !
Claim: There is a complete bipartite graph G of degree one (i.e., aperfect matching) on the symbols of w which is non-nesting, i# wcan be expressed as a square shu!e.
Unshuffling - Buss & Soltys Slides - Feb 6, 2013 Definition - 6/27
! Formal languages! Ginsburg & Spanier in ’65
! Modelling sequential execution of concurrent processes! Riddle (’73 & ’79), Shaw (’78), Hoare
! Shu!e on its own! Mansfield (’82 & ’83; polytime dynamic prog. alg. for
w = u1 ! u2 ! · · ·! uk for constant k ; when k varies,NP-complete)
! Warmuth & Haussler (’84; show w = u ! u ! · · ·! uNP-complete by reduction from 3-Partition)
! More complexity! Buss & Yianilos (’98; “Monge condition”)! Erickson (2010; how hard is "u,w = u ! u?); as mentioned,
Austrin gives polytime algorithm when each symbol occurs atmost 4 times. Problem of the year on Stack Exchange.
! Soltys (2012; shu!e in AC1 but not AC0.)
Unshuffling - Buss & Soltys Slides - Feb 6, 2013 History - 7/27
Monge
The Monge condition (or “quasi-convexity” condition) allowsnested edges but prohibits crossing edges; widely studied formatching and transportation problems.
Many problems that satisfy the Monge condition are known tohave e$cient polynomial time algorithms: Buss & Yianilos ’98
Thus, the non-nesting property on our G can be viewed as an“anti-Monge.” Fewer algorithms for this case:
This is another reason why we find the NP-completeness of thesquare problem to be interesting: it provides a hardness result foranti-Monge matching in a very simple and abstract situation.
Unshuffling - Buss & Soltys Slides - Feb 6, 2013 History - 8/27
PDA
A queue automaton is a PDA but with a queue instead of a stack.
Reads the input w fromleft to right.
Queue is initially emptyand supports theoperations push-bottomand pop-top.
Automaton accepts if itsqueue is empty after thelast symbol of w hasbeen read.
w
Pop
Push
Unshuffling - Buss & Soltys Slides - Feb 6, 2013 PDAs - 9/27
PDA algorithm for Square
Repeatedly do one of the following:
a Read the next input symbol " and push it onto thequeue, or
b If the next input symbol " is the same as the symbolat the top of the queue, read past the inputsymbol " and pop " from the queue.
We can view an accepting computation as imposing a non-nestingmatching.
! When either step a. or b. is performed, we say that the inputsymbol " has been consumed.
! In case b., we say that the symbol " on the queue has beenmatched by the input symbol.
Unshuffling - Buss & Soltys Slides - Feb 6, 2013 PDAs - 10/27
w = 0110110011101000
andu = 01101100 = 01101100
Unshuffling - Buss & Soltys Slides - Feb 6, 2013 PDAs - 11/27
# 0110110011101000
Unshuffling - Buss & Soltys Slides - Feb 6, 2013 PDAs - 12/27
0 110110011101000
Unshuffling - Buss & Soltys Slides - Feb 6, 2013 PDAs - 12/27
01 10110011101000
Unshuffling - Buss & Soltys Slides - Feb 6, 2013 PDAs - 12/27
011 0110011101000
Unshuffling - Buss & Soltys Slides - Feb 6, 2013 PDAs - 12/27
11 110011101000
Unshuffling - Buss & Soltys Slides - Feb 6, 2013 PDAs - 12/27
1 10011101000
Unshuffling - Buss & Soltys Slides - Feb 6, 2013 PDAs - 12/27
# 0011101000
Unshuffling - Buss & Soltys Slides - Feb 6, 2013 PDAs - 12/27
0 011101000
Unshuffling - Buss & Soltys Slides - Feb 6, 2013 PDAs - 12/27
# 11101000
Unshuffling - Buss & Soltys Slides - Feb 6, 2013 PDAs - 12/27
1 1101000
Unshuffling - Buss & Soltys Slides - Feb 6, 2013 PDAs - 12/27
# 101000
Unshuffling - Buss & Soltys Slides - Feb 6, 2013 PDAs - 12/27
1 01000
Unshuffling - Buss & Soltys Slides - Feb 6, 2013 PDAs - 12/27
10 1000
Unshuffling - Buss & Soltys Slides - Feb 6, 2013 PDAs - 12/27
0 000
Unshuffling - Buss & Soltys Slides - Feb 6, 2013 PDAs - 12/27
# 00
Unshuffling - Buss & Soltys Slides - Feb 6, 2013 PDAs - 12/27
0 0
Unshuffling - Buss & Soltys Slides - Feb 6, 2013 PDAs - 12/27
# # accepted
Unshuffling - Buss & Soltys Slides - Feb 6, 2013 PDAs - 12/27
Square is NP-complete
Many-one logspace reduction of 3-Partition to Square.
S = %ni : 1 & i & 3m' such that the ni ’s are given in unarynotation and such that B = (
!3mi=1 ni )/m is an integer.
The question is: can S be partitioned into m disjoint subsequencesS1, . . . ,Sm such that each Sk has exactly three elements with thesum of the three members of Sk equal to B?
Assume ni given in non-increasing order.
Unshuffling - Buss & Soltys Slides - Feb 6, 2013 Proof - 13/27
Reduction
The many-one reduction to Square constructs a string wS overthe alphabet
" = {a1, a2, b, e0, e, c1, c2, x , y},
such that wS is a square i# S is a “yes” instance of 3-Partition.
The string wS consists of three parts:
wS := %loaderS'%distributorS'%verifierS '.
Unshuffling - Buss & Soltys Slides - Feb 6, 2013 Proof - 14/27
%loaderS' = e0
m"
i=1
(b2Be)
%distributorS' = e0
m"
i=1
((a1bBa2)
3e)
%verifierS' =3m"
k=1
[v4k!3Dkv4k!3v4k!2Dkv4k!2v4k!1Ekv4k!1v4kFkv4k ]
where
v! = c1x!y !c2
Dk = (a21bnk a22)
3m!k+1
Ek = (a21bBa22)
3m!k(a1bnka2)(a
21b
Ba22)3m!k
Fk = (a21bBa22)
2(3m!k)
Unshuffling - Buss & Soltys Slides - Feb 6, 2013 Proof - 15/27
Action of %loaderS'
e0b2Beb2Be...
b2Be
Unshuffling - Buss & Soltys Slides - Feb 6, 2013 Proof - 16/27
Action of %distributorS'
b2Be QQ a1bi1a2
a1bi2a2a1bi3a2
(a1bBa2)3e
where i1 + i2 + i3 = B .
Unshuffling - Buss & Soltys Slides - Feb 6, 2013 Proof - 17/27
After %loaderS'%distributorS ' has been scanned, we have thefollowing configuration:
3m"
k=1
(a1bika2)(%verifierS'
The role of the verifier is to check wheter %ik'3mk=1 is a re-orderingof %nk'3mk=1.
Unshuffling - Buss & Soltys Slides - Feb 6, 2013 Proof - 18/27
Correctness
Given any sequence of non-negative integers %ik'3mk=1 such that
)j * {1, 2, . . . ,m}, i3j!2 + i3j!1 + i3j = B , (1)
there exists a computation
#(wS +"3m"
k=1
(a1bika2)(%verifierS'
Conversely, if#(wS +"W (%verifierS '
then W must be of the form#3m
k=1(a1bika2), so that condition (1)
holds.
Unshuffling - Buss & Soltys Slides - Feb 6, 2013 Proof - 19/27
Therefore it su$ces to show that
3m"
k=1
(a1bika2)(%verifierS'
is accepted ,-%ik'3mk=1 is a permutation of %nk'3mk=1.
Unshuffling - Buss & Soltys Slides - Feb 6, 2013 Proof - 20/27
If %ik'3mk=1 is a permutation of %nk'3mk=1, then it is a matter ofkeeping track of lots of details to show that
3m"
k=1
(a1bika2)(%verifierS '+"#(#,
and hence wS * Square.
The other direction is more complicated because we have to showthat if a computation accepts, then the ik ’s must be a permutationof the nk ’s.
Unshuffling - Buss & Soltys Slides - Feb 6, 2013 Proof - 21/27
Recall that:
%verifierS' =3m"
k=1
[v4k!3Dkv4k!3v4k!2Dkv4k!2v4k!1Ekv4k!1v4kFkv4k ]
where
v! = c1x!y !c2
Dk = (a21bnk a22)
3m!k+1
Ek = (a21bBa22)
3m!k(a1bnka2)(a
21b
Ba22)3m!k
Fk = (a21bBa22)
2(3m!k)
Unshuffling - Buss & Soltys Slides - Feb 6, 2013 Proof - 22/27
The role of the v ’s is that of delimiters; they impose a scope onthe edges.
The role of the D’s is to make sure that at each of the k steps, theremaining ij ’s are all less than or equal to the next nk .
The role of the Ek and Fk is to cycle the queue until the righta1bixa2 is found for a1bnk a2; i.e., such that ix = nk .
Unshuffling - Buss & Soltys Slides - Feb 6, 2013 Proof - 23/27
The main idea is that if n1 corresponds to ix then:
a1bi1a2 a1bixa2a1bi2aa a1bix+1a2 a1bix+1a2 a1bB!i1a2 a1bi1a2
......
......
...a1bixa2 a1bi3ma2 a1bi3ma2 a1bB!ix!1a2 a1bix!1a2a1bix+1a2 a1bB!i1a2 a1bB!i1a2 a1bB!ix+1a2 a1bix+1a2
......
......
...a1bi3ma2 a1bB!ix!1a2 a1bB!ix!1a2 a1bB!ima2 a1bima2
The changes to the queue while applying E1,F1 with theassumption that ix = n1.
Unshuffling - Buss & Soltys Slides - Feb 6, 2013 Proof - 24/27
If a computation accepts, then the ik ’s must be a permutation ofthe nk ’s.
Elements of the proof:
! If y is consumed by u yielding the resultant z , then y = u! z .
u QQ z
y
so a subsequence of u has to be a subsequence of y .
! A string z has k alternations of the symbols a1, a2 provided(a1a2)k is a subsequence of z but (a1a2)k+1 is not.
Unshuffling - Buss & Soltys Slides - Feb 6, 2013 Proof - 25/27
a1bija2 Q
Q Zj = a1bB!m1#!
s=2(a22a
21b
B!ms )a2
Yj = (a21bBa22)
! * Ek
where m1 +m2 + · · ·+m! = ij . Note that Yj and Zj both have !alternations of a1, a2.
Zj = a1bB!m1#!
s=2(a22a
21b
B!ms )a2 QQ a1bija2
Yj = (a21bBa22)
! * Fk
Unshuffling - Buss & Soltys Slides - Feb 6, 2013 Proof - 26/27
! Buss: bit.ly/Sxsr5I
! Soltys: bit.ly/UyD7lh
! arXiv: arxiv.org/abs/1211.7161
! Stack Exchange Post: bit.ly/TzD7hH
Unshuffling - Buss & Soltys Slides - Feb 6, 2013 Sources - 27/27