Topological Sorting under Regular Constraints
Antoine Amarilli1, Charles Paperman2 July 12th, 2018
1Télécom ParisTech
Constrained Topological Sorting
•
Fix analphabet: e.g.,Σ ={a,b}•
Fix alanguage: e.g.,L= (ab)∗•
We studyconstrained topological sorting:• Input:directed acyclic graph(DAG) with vertices labeled withΣ
• Output: is there atopological sort that falls inL?
•
Question:when is this problemtractable?a
b a b
b a
a b a b a b ... inL!
Constrained Topological Sorting
•
Fix analphabet: e.g.,Σ ={a,b}•
Fix alanguage: e.g.,L= (ab)∗•
We studyconstrained topological sorting:• Input:directed acyclic graph(DAG) with vertices labeled withΣ
• Output: is there atopological sort that falls inL?
•
Question:when is this problemtractable?a
b a b
b a
a b a b a b ... inL!
Constrained Topological Sorting
•
Fix analphabet: e.g.,Σ ={a,b}•
Fix alanguage: e.g.,L= (ab)∗•
We studyconstrained topological sorting:• Input:directed acyclic graph(DAG) with vertices labeled withΣ
• Output: is there atopological sort that falls inL?
•
Question:when is this problemtractable?a
b a b
b a
a b a b a b ... inL!
Constrained Topological Sorting
•
Fix analphabet: e.g.,Σ ={a,b}•
Fix alanguage: e.g.,L= (ab)∗•
We studyconstrained topological sorting:• Input:directed acyclic graph(DAG) with vertices labeled withΣ
• Output: is there atopological sort that falls inL?
•
Question:when is this problemtractable?a
b a b
b a
a b a b a b ... inL!
Constrained Topological Sorting
•
Fix analphabet: e.g.,Σ ={a,b}•
Fix alanguage: e.g.,L= (ab)∗•
We studyconstrained topological sorting:• Input:directed acyclic graph(DAG) with vertices labeled withΣ
• Output: is there atopological sort that falls inL?
•
Question:when is this problemtractable?a
b a b
b a
a b a b a b ... inL!
Constrained Topological Sorting
•
Fix analphabet: e.g.,Σ ={a,b}•
Fix alanguage: e.g.,L= (ab)∗•
We studyconstrained topological sorting:• Input:directed acyclic graph(DAG) with vertices labeled withΣ
• Output: is there atopological sort that falls inL?
•
Question:when is this problemtractable?a
b a b
b a
a
b a b b a ... not inL!
Constrained Topological Sorting
•
Fix analphabet: e.g.,Σ ={a,b}•
Fix alanguage: e.g.,L= (ab)∗•
We studyconstrained topological sorting:• Input:directed acyclic graph(DAG) with vertices labeled withΣ
• Output: is there atopological sort that falls inL?
•
Question:when is this problemtractable?a
b a b
b a
a b
a b b a ... not inL!
Constrained Topological Sorting
•
Fix analphabet: e.g.,Σ ={a,b}•
Fix alanguage: e.g.,L= (ab)∗•
We studyconstrained topological sorting:• Input:directed acyclic graph(DAG) with vertices labeled withΣ
• Output: is there atopological sort that falls inL?
•
Question:when is this problemtractable?a
b a b
b a
a b a
b b a ... not inL!
Constrained Topological Sorting
•
Fix analphabet: e.g.,Σ ={a,b}•
Fix alanguage: e.g.,L= (ab)∗•
We studyconstrained topological sorting:• Input:directed acyclic graph(DAG) with vertices labeled withΣ
• Output: is there atopological sort that falls inL?
•
Question:when is this problemtractable?a
b a b
b a
a b a b
b a ... not inL!
Constrained Topological Sorting
•
Fix analphabet: e.g.,Σ ={a,b}•
Fix alanguage: e.g.,L= (ab)∗•
We studyconstrained topological sorting:• Input:directed acyclic graph(DAG) with vertices labeled withΣ
• Output: is there atopological sort that falls inL?
•
Question:when is this problemtractable?a
b a b
b a
a b a b b
a ... not inL!
Constrained Topological Sorting
•
Fix analphabet: e.g.,Σ ={a,b}•
Fix alanguage: e.g.,L= (ab)∗•
We studyconstrained topological sorting:• Input:directed acyclic graph(DAG) with vertices labeled withΣ
• Output: is there atopological sort that falls inL?
•
Question:when is this problemtractable?a
b a b
b a
a b a b b a
... not inL!
Constrained Topological Sorting
•
Fix analphabet: e.g.,Σ ={a,b}•
Fix alanguage: e.g.,L= (ab)∗•
We studyconstrained topological sorting:• Input:directed acyclic graph(DAG) with vertices labeled withΣ
• Output: is there atopological sort that falls inL?
•
Question:when is this problemtractable?a
b a b
b a
a b a b b a ... not inL!
Constrained Topological Sorting
•
Fix analphabet: e.g.,Σ ={a,b}•
Fix alanguage: e.g.,L= (ab)∗•
We studyconstrained topological sorting:• Input:directed acyclic graph(DAG) with vertices labeled withΣ
• Output: is there atopological sort that falls inL?
•
Question:when is this problemtractable?a
b a b
b a
a b a b a b ... inL!
Constrained Topological Sorting
•
Fix analphabet: e.g.,Σ ={a,b}•
Fix alanguage: e.g.,L= (ab)∗•
We studyconstrained topological sorting:• Input:directed acyclic graph(DAG) with vertices labeled withΣ
• Output: is there atopological sort that falls inL?
•
Question:when is this problemtractable?a
b a b
b a
a
b a b a b ... inL!
Constrained Topological Sorting
•
Fix analphabet: e.g.,Σ ={a,b}•
Fix alanguage: e.g.,L= (ab)∗•
We studyconstrained topological sorting:• Input:directed acyclic graph(DAG) with vertices labeled withΣ
• Output: is there atopological sort that falls inL?
•
Question:when is this problemtractable?a
b a b
b a
a b
a b a b ... inL!
Constrained Topological Sorting
•
Fix analphabet: e.g.,Σ ={a,b}•
Fix alanguage: e.g.,L= (ab)∗•
We studyconstrained topological sorting:• Input:directed acyclic graph(DAG) with vertices labeled withΣ
• Output: is there atopological sort that falls inL?
•
Question:when is this problemtractable?a
b a b
b a
a b a
b a b ... inL!
Constrained Topological Sorting
•
Fix analphabet: e.g.,Σ ={a,b}•
Fix alanguage: e.g.,L= (ab)∗•
We studyconstrained topological sorting:• Input:directed acyclic graph(DAG) with vertices labeled withΣ
• Output: is there atopological sort that falls inL?
•
Question:when is this problemtractable?a
b a b
b a
a b a b
a b ... inL!
Constrained Topological Sorting
•
Fix analphabet: e.g.,Σ ={a,b}•
Fix alanguage: e.g.,L= (ab)∗•
We studyconstrained topological sorting:• Input:directed acyclic graph(DAG) with vertices labeled withΣ
• Output: is there atopological sort that falls inL?
•
Question:when is this problemtractable?a
b a b
b a
a b a b a
b ... inL!
Constrained Topological Sorting
•
Fix analphabet: e.g.,Σ ={a,b}•
Fix alanguage: e.g.,L= (ab)∗•
We studyconstrained topological sorting:• Input:directed acyclic graph(DAG) with vertices labeled withΣ
• Output: is there atopological sort that falls inL?
•
Question:when is this problemtractable?a
b a b
b a
a b a b a b
... inL!
Constrained Topological Sorting
•
Fix analphabet: e.g.,Σ ={a,b}•
Fix alanguage: e.g.,L= (ab)∗•
We studyconstrained topological sorting:• Input:directed acyclic graph(DAG) with vertices labeled withΣ
• Output: is there atopological sort that falls inL?
•
Question:when is this problemtractable?a
b a b
b a
a b a b a b ... inL!
Constrained Topological Sorting
•
Fix analphabet: e.g.,Σ ={a,b}•
Fix alanguage: e.g.,L= (ab)∗•
We studyconstrained topological sorting:• Input:directed acyclic graph(DAG) with vertices labeled withΣ
• Output: is there atopological sort that falls inL?
•
Question:when is this problemtractable?a
b a b
b a
a b a b a b ... inL!
Constrained Topological Sorting
•
Fix analphabet: e.g.,Σ ={a,b}•
Fix alanguage: e.g.,L= (ab)∗•
We studyconstrained topological sorting:• Input:directed acyclic graph(DAG) with vertices labeled withΣ
• Output: is there atopological sort that falls inL?
•
Question:when is this problemtractable?a
b a b
b a
a b a b a b ... inL!
Motivation
•
How wereally ended upstudying this problem:2011 2012 2013 2014 2015 2016 2017 2018
Probabilistic XML XML versioning
•
Whicha-posteriori motivationdid we invent for the problem?→Schedulingwith constraints! →Verification forconcurrent code!
→Computational biology! →Blockchain! (joke)
•
But why do weactually care?→ Naturalproblem and apparentlynothingwas known about it!
Motivation
•
How wereally ended upstudying this problem:2011 2012 2013 2014 2015 2016 2017 2018
Probabilistic XML XML versioning
•
Whicha-posteriori motivationdid we invent for the problem?→Schedulingwith constraints! →Verification forconcurrent code!
→Computational biology! →Blockchain! (joke)
•
But why do weactually care?→ Naturalproblem and apparentlynothingwas known about it!
Motivation
•
How wereally ended upstudying this problem:2011 2012 2013 2014 2015 2016 2017 2018
Probabilistic XML XML versioning
Order-uncertain databases Top-k Aggregate queries
•
Whicha-posteriori motivationdid we invent for the problem?→Schedulingwith constraints! →Verification forconcurrent code!
→Computational biology! →Blockchain! (joke)
•
But why do weactually care?→ Naturalproblem and apparentlynothingwas known about it!
Motivation
•
How wereally ended upstudying this problem:2011 2012 2013 2014 2015 2016 2017 2018
Probabilistic XML XML versioning
Order-uncertain databases Top-k Aggregate queries Possible answers
•
Whicha-posteriori motivationdid we invent for the problem?→Schedulingwith constraints! →Verification forconcurrent code!
→Computational biology! →Blockchain! (joke)
•
But why do weactually care?→ Naturalproblem and apparentlynothingwas known about it!
Motivation
•
How wereally ended upstudying this problem:2011 2012 2013 2014 2015 2016 2017 2018
Probabilistic XML XML versioning
Order-uncertain databases Top-k Aggregate queries Possible answers
DAGs Algebraic language theory?!
•
Whicha-posteriori motivationdid we invent for the problem?→Schedulingwith constraints! →Verification forconcurrent code!
→Computational biology! →Blockchain! (joke)
•
But why do weactually care?→ Naturalproblem and apparentlynothingwas known about it!
Motivation
•
How wereally ended upstudying this problem:2011 2012 2013 2014 2015 2016 2017 2018
Probabilistic XML XML versioning
Order-uncertain databases Top-k Aggregate queries Possible answers
DAGs Algebraic language theory?!
•
Whicha-posteriori motivationdid we invent for the problem?→Schedulingwith constraints! →Verification forconcurrent code!
→Computational biology! →Blockchain! (joke)
•
But why do weactually care?→ Naturalproblem and apparentlynothingwas known about it!
Motivation
•
How wereally ended upstudying this problem:2011 2012 2013 2014 2015 2016 2017 2018
Probabilistic XML XML versioning
Order-uncertain databases Top-k Aggregate queries Possible answers
DAGs Algebraic language theory?!
•
Whicha-posteriori motivationdid we invent for the problem?→Schedulingwith constraints! →Verification forconcurrent code!
→Computational biology! →Blockchain! (joke)
•
But why do weactually care?→ Naturalproblem and apparentlynothingwas known about it!
Motivation
•
How wereally ended upstudying this problem:2011 2012 2013 2014 2015 2016 2017 2018
Probabilistic XML XML versioning
Order-uncertain databases Top-k Aggregate queries Possible answers
DAGs Algebraic language theory?!
•
Whicha-posteriori motivationdid we invent for the problem?→Schedulingwith constraints! →Verification forconcurrent code!
→Computational biology! →Blockchain!
(joke)
•
But why do weactually care?→ Naturalproblem and apparentlynothingwas known about it!
Motivation
•
How wereally ended upstudying this problem:2011 2012 2013 2014 2015 2016 2017 2018
Probabilistic XML XML versioning
Order-uncertain databases Top-k Aggregate queries Possible answers
DAGs Algebraic language theory?!
•
Whicha-posteriori motivationdid we invent for the problem?→Schedulingwith constraints! →Verification forconcurrent code!
→Computational biology! →Blockchain! (joke)
•
But why do weactually care?→ Naturalproblem and apparentlynothingwas known about it!
Motivation
•
How wereally ended upstudying this problem:2011 2012 2013 2014 2015 2016 2017 2018
Probabilistic XML XML versioning
Order-uncertain databases Top-k Aggregate queries Possible answers
DAGs Algebraic language theory?!
•
Whicha-posteriori motivationdid we invent for the problem?→Schedulingwith constraints! →Verification forconcurrent code!
→Computational biology! →Blockchain! (joke)
→ Naturalproblem and apparentlynothingwas known about it!
Motivation
•
How wereally ended upstudying this problem:2011 2012 2013 2014 2015 2016 2017 2018
Probabilistic XML XML versioning
Order-uncertain databases Top-k Aggregate queries Possible answers
DAGs Algebraic language theory?!
•
Whicha-posteriori motivationdid we invent for the problem?→Schedulingwith constraints! →Verification forconcurrent code!
→Computational biology! →Blockchain! (joke)
Formal problem statement
•
Fix aregular languageLon anfinite alphabetΣ•
Constrained topological sortproblemCTS(L):• Input:aDAGGwith vertices labeled by letters ofΣ
• Output:is there atopological sortofGsuch that the sequence of vertex labels is awordofL
•
Special case: theconstrained shuffle problemCSh(L):• Input:a set ofwordsw1, . . . ,wnofΣ∗
• Output:is there ashuffleofw1, . . . ,wnwhich is inL
•
This is likeCTSbut the input DAG is anunion of paths→ Question:What is thecomplexityofCTS(L)andCSh(L), depending on the fixed languageL?
Formal problem statement
•
Fix aregular languageLon anfinite alphabetΣ•
Constrained topological sortproblemCTS(L):• Input:aDAGGwith vertices labeled by letters ofΣ
• Output:is there atopological sortofGsuch that the sequence of vertex labels is awordofL
a
b a b
b a
•
Special case: theconstrained shuffle problemCSh(L):• Input:a set ofwordsw1, . . . ,wnofΣ∗
• Output:is there ashuffleofw1, . . . ,wnwhich is inL
•
This is likeCTSbut the input DAG is anunion of paths→ Question:What is thecomplexityofCTS(L)andCSh(L), depending on the fixed languageL?
Formal problem statement
•
Fix aregular languageLon anfinite alphabetΣ•
Constrained topological sortproblemCTS(L):• Input:aDAGGwith vertices labeled by letters ofΣ
• Output:is there atopological sortofGsuch that the sequence of vertex labels is awordofL
a
b a b
b a
•
Special case: theconstrained shuffle problemCSh(L):• Input:a set ofwordsw1, . . . ,wnofΣ∗
• Output:is there ashuffleofw1, . . . ,wnwhich is inL
•
This is likeCTSbut the input DAG is anunion of paths→ Question:What is thecomplexityofCTS(L)andCSh(L), depending on the fixed languageL?
Formal problem statement
•
Fix aregular languageLon anfinite alphabetΣ•
Constrained topological sortproblemCTS(L):• Input:aDAGGwith vertices labeled by letters ofΣ
• Output:is there atopological sortofGsuch that the sequence of vertex labels is awordofL
a
b a b
b a
•
Special case: theconstrained shuffle problemCSh(L):• Input:a set ofwordsw1, . . . ,wnofΣ∗
• Output:is there ashuffleofw1, . . . ,wnwhich is inL
•
This is likeCTSbut the input DAG is anunion of pathsa a b
b b a
→ Question:What is thecomplexityofCTS(L)andCSh(L), depending on the fixed languageL?
Formal problem statement
•
Fix aregular languageLon anfinite alphabetΣ•
Constrained topological sortproblemCTS(L):• Input:aDAGGwith vertices labeled by letters ofΣ
• Output:is there atopological sortofGsuch that the sequence of vertex labels is awordofL
a
b a b
b a
•
Special case: theconstrained shuffle problemCSh(L):• Input:a set ofwordsw1, . . . ,wnofΣ∗
• Output:is there ashuffleofw1, . . . ,wnwhich is inL
•
This is likeCTSbut the input DAG is anunion of pathsa a b
b b a
Dichotomy
Conjecture
Conjecture
For everyregular language L, exactly one of the following holds:
•
Lhas [some nice property] andCTS(L)isin NL•
Lhas [some nasty property] andCTS(L)isNP-hardHere’s what we actually know:
•
CTSandCShareNP-hardfor some languages, including(ab)∗•
They arein NLforsome language families(monomials, groups)•
Some languages are tractable forseemingly unrelatedreasons→ Very mysterious landscape!(to us)
Dichotomy Conjecture
Conjecture
For everyregular language L, exactly one of the following holds:
•
Lhas [some nice property] andCTS(L)isin NL•
Lhas [some nasty property] andCTS(L)isNP-hardHere’s what we actually know:
•
CTSandCShareNP-hardfor some languages, including(ab)∗•
They arein NLforsome language families(monomials, groups)•
Some languages are tractable forseemingly unrelatedreasons→ Very mysterious landscape!(to us)
Dichotomy Conjecture
Conjecture
For everyregular language L, exactly one of the following holds:
•
Lhas [some nice property] andCTS(L)isin NL•
Lhas [some nasty property] andCTS(L)isNP-hard Here’s what we actually know:•
CTSandCShareNP-hardfor some languages, including(ab)∗•
They arein NLforsome language families(monomials, groups)•
Some languages are tractable forseemingly unrelatedreasons→ Very mysterious landscape!(to us)
Dichotomy Conjecture
Conjecture
For everyregular language L, exactly one of the following holds:
•
Lhas [some nice property] andCTS(L)isin NL•
Lhas [some nasty property] andCTS(L)isNP-hard Here’s what we actually know:•
CTSandCShareNP-hardfor some languages, including(ab)∗•
They arein NLforsome language families(monomials, groups)•
Some languages are tractable forseemingly unrelatedreasons→ Very mysterious landscape!(to us)
Dichotomy Conjecture
Conjecture
For everyregular language L, exactly one of the following holds:
•
Lhas [some nice property] andCTS(L)isin NL•
Lhas [some nasty property] andCTS(L)isNP-hard Here’s what we actually know:•
CTSandCShareNP-hardfor some languages, including(ab)∗•
They arein NLforsome language families(monomials, groups)•
→ Very mysterious landscape!(to us)
Dichotomy Conjecture
Conjecture
For everyregular language L, exactly one of the following holds:
•
Lhas [some nice property] andCTS(L)isin NL•
Lhas [some nasty property] andCTS(L)isNP-hard Here’s what we actually know:•
CTSandCShareNP-hardfor some languages, including(ab)∗•
They arein NLforsome language families(monomials, groups)•
Some languages are tractable forseemingly unrelatedreasonsHardness Results
Existing Hardness Result
... but the target is awordwhich isprovided as input!
→ Does not directly apply for us, because wefixthe target language
Existing Hardness Result
→ Does not directly apply for us, because wefixthe target language
Existing Hardness Result
... but the target is awordwhich isprovided as input!
Hardness for CTS
•
We can reduce their problem toCShfor thelanguage(aA+bB)∗•
To determine if the shuffle of aab and bbcontains ababb ...solve theCSh-problem for aab and bband ABABB
→ CSh((aA+bB)∗)isNP-hardand the same holds forCTS
•
Similar technique:CSh((ab)∗)isNP-hard•
Customreduction techniqueto show NP-hardness for:• (ab+b)∗
• (aa+bb)∗
• u∗ifucontains two different letters
•
Conjecture:ifFis finite thenCTS(F∗)isNP-hard unless it contains a power of each of its lettersHardness for CTS
•
We can reduce their problem toCShfor thelanguage(aA+bB)∗•
To determine if the shuffle of aab and bbcontains ababb ...solve theCSh-problem for aab and bband ABABB
→ CSh((aA+bB)∗)isNP-hardand the same holds forCTS
•
Similar technique:CSh((ab)∗)isNP-hard•
Customreduction techniqueto show NP-hardness for:• (ab+b)∗
• (aa+bb)∗
• u∗ifucontains two different letters
•
Conjecture:ifFis finite thenCTS(F∗)isNP-hard unless it contains a power of each of its lettersHardness for CTS
•
We can reduce their problem toCShfor thelanguage(aA+bB)∗•
To determine if the shuffle of aab and bbcontains ababb ...solve theCSh-problem for aab and bband ABABB
→ CSh((aA+bB)∗)isNP-hardand the same holds forCTS
•
Similar technique:CSh((ab)∗)isNP-hard•
Customreduction techniqueto show NP-hardness for:• (ab+b)∗
• (aa+bb)∗
• u∗ifucontains two different letters
•
Conjecture:ifFis finite thenCTS(F∗)isNP-hard unless it contains a power of each of its lettersHardness for CTS
•
We can reduce their problem toCShfor thelanguage(aA+bB)∗•
To determine if the shuffle of aab and bbcontains ababb ...solve theCSh-problem for aab and bband ABABB
→ CSh((aA+bB)∗)isNP-hardand the same holds forCTS
•
Similar technique:CSh((ab)∗)isNP-hard•
Customreduction techniqueto show NP-hardness for:• (ab+b)∗
• (aa+bb)∗
• u∗ifucontains two different letters
•
Conjecture:ifFis finite thenCTS(F∗)isNP-hard unless it contains a power of each of its lettersHardness for CTS
•
We can reduce their problem toCShfor thelanguage(aA+bB)∗•
To determine if the shuffle of aab and bbcontains ababb ...solve theCSh-problem for aab and bband ABABB
→ CSh((aA+bB)∗)isNP-hardand the same holds forCTS
•
Similar technique:CSh((ab)∗)isNP-hard•
Customreduction techniqueto show NP-hardness for:• (ab+b)∗
• (aa+bb)∗
• u∗ifucontains two different letters
•
Conjecture:ifFis finite thenCTS(F∗)isNP-hard unless it contains a power of each of its lettersHardness for CTS
•
We can reduce their problem toCShfor thelanguage(aA+bB)∗•
To determine if the shuffle of aab and bbcontains ababb ...solve theCSh-problem for aab and bband ABABB
→ CSh((aA+bB)∗)isNP-hardand the same holds forCTS
•
Similar technique:CSh((ab)∗)isNP-hard•
Customreduction techniqueto show NP-hardness for:• (ab+b)∗
• (aa+bb)∗
• u∗ifucontains two different letters
•
Hardness for CTS
•
We can reduce their problem toCShfor thelanguage(aA+bB)∗•
To determine if the shuffle of aab and bbcontains ababb ...solve theCSh-problem for aab and bband ABABB
→ CSh((aA+bB)∗)isNP-hardand the same holds forCTS
•
Similar technique:CSh((ab)∗)isNP-hard•
Customreduction techniqueto show NP-hardness for:• (ab+b)∗
• (aa+bb)∗
• u∗ifucontains two different letters
Tractability Results
Tractability for Monomials
•
Monomial:language of the formA∗1 a1A∗2 a2 · · · A∗nanA∗n+1 wherea1, . . . ,an∈ΣandA1, . . . ,An+1 ⊆Σ•
Union of monomials:union of finitely many such languages• Example:pattern matchingΣ∗word1Σ∗+ Σ∗word2Σ∗
• Logical interpretation:languages definable inΣ2[<]
Theorem
For any union of monomialsL, the problemCTS(L)isin NL Proof idea:
•
Tractable languages are clearlyclosed under union•
We canguessthe positions of the individualai•
Check that the other verticescan fitin theA∗i (uses NL = co-NL)Tractability for Monomials
•
Monomial:language of the formA∗1 a1A∗2 a2 · · · A∗nanA∗n+1 wherea1, . . . ,an∈ΣandA1, . . . ,An+1 ⊆Σ•
Union of monomials:union of finitely many such languages• Example:pattern matchingΣ∗word1Σ∗+ Σ∗word2Σ∗
• Logical interpretation:languages definable inΣ2[<]
Theorem
For any union of monomialsL, the problemCTS(L)isin NL Proof idea:
•
Tractable languages are clearlyclosed under union•
We canguessthe positions of the individualai•
Check that the other verticescan fitin theA∗i (uses NL = co-NL)Tractability for Monomials
•
Monomial:language of the formA∗1 a1A∗2 a2 · · · A∗nanA∗n+1 wherea1, . . . ,an∈ΣandA1, . . . ,An+1 ⊆Σ•
Union of monomials:union of finitely many such languages• Example:pattern matchingΣ∗word1Σ∗+ Σ∗word2Σ∗
• Logical interpretation:languages definable inΣ2[<]
Theorem
For any union of monomialsL, the problemCTS(L)isin NL Proof idea:
•
Tractable languages are clearlyclosed under union•
We canguessthe positions of the individualai•
Check that the other verticescan fitin theA∗i (uses NL = co-NL)Tractability for Monomials
•
Monomial:language of the formA∗1 a1A∗2 a2 · · · A∗nanA∗n+1 wherea1, . . . ,an∈ΣandA1, . . . ,An+1 ⊆Σ•
Union of monomials:union of finitely many such languages• Example:pattern matchingΣ∗word1Σ∗+ Σ∗word2Σ∗
• Logical interpretation:languages definable inΣ2[<]
Theorem
For any union of monomialsL, the problemCTS(L)isin NL
Proof idea:
•
Tractable languages are clearlyclosed under union•
We canguessthe positions of the individualai•
Check that the other verticescan fitin theA∗i (uses NL = co-NL)Tractability for Monomials
•
Monomial:language of the formA∗1 a1A∗2 a2 · · · A∗nanA∗n+1 wherea1, . . . ,an∈ΣandA1, . . . ,An+1 ⊆Σ•
Union of monomials:union of finitely many such languages• Example:pattern matchingΣ∗word1Σ∗+ Σ∗word2Σ∗
• Logical interpretation:languages definable inΣ2[<]
Theorem
For any union of monomialsL, the problemCTS(L)isin NL Proof idea:
•
Tractable languages are clearly•
We canguessthe positions of the individualai•
Check that the other verticescan fitin theA∗i (uses NL = co-NL)Tractability for Monomials
•
Monomial:language of the formA∗1 a1A∗2 a2 · · · A∗nanA∗n+1 wherea1, . . . ,an∈ΣandA1, . . . ,An+1 ⊆Σ•
Union of monomials:union of finitely many such languages• Example:pattern matchingΣ∗word1Σ∗+ Σ∗word2Σ∗
• Logical interpretation:languages definable inΣ2[<]
Theorem
For any union of monomialsL, the problemCTS(L)isin NL Proof idea:
•
Tractable languages are clearlyclosed under union•
•
Check that the other verticescan fitin theA∗i (uses NL = co-NL)Tractability for Monomials
•
Monomial:language of the formA∗1 a1A∗2 a2 · · · A∗nanA∗n+1 wherea1, . . . ,an∈ΣandA1, . . . ,An+1 ⊆Σ•
Union of monomials:union of finitely many such languages• Example:pattern matchingΣ∗word1Σ∗+ Σ∗word2Σ∗
• Logical interpretation:languages definable inΣ2[<]
Theorem
For any union of monomialsL, the problemCTS(L)isin NL Proof idea:
•
Tractable languages are clearlyThe Algebraic Approach
Fails
Can we just studyalgebraicallythe tractable languages?
Not really...
•
Not closed underintersection•
Not closed undercomplement•
Not closed underinverse morphism•
Not closed underconcatenation (not in paper, only known forCTS)•
ForCSh: not closed underquotientRemark:For the languageL=bΣ∗+aaΣ∗+ (ab)∗
•
CTS(L)isNP-hardbecause(ab)−1L= (ab)∗•
CSh(L)isin NL: trivial if there is more than one wordThe Algebraic Approach Fails
Can we just studyalgebraicallythe tractable languages?Not really...
•
Not closed underintersection•
Not closed undercomplement•
Not closed underinverse morphism•
Not closed underconcatenation (not in paper, only known forCTS)•
ForCSh: not closed underquotientRemark:For the languageL=bΣ∗+aaΣ∗+ (ab)∗
•
CTS(L)isNP-hardbecause(ab)−1L= (ab)∗•
CSh(L)isin NL: trivial if there is more than one wordThe Algebraic Approach Fails
Can we just studyalgebraicallythe tractable languages?Not really...
•
Not closed underintersection•
Not closed undercomplement•
Not closed underinverse morphism•
Not closed underconcatenation (not in paper, only known forCTS)•
ForCSh: not closed underquotientRemark:For the languageL=bΣ∗+aaΣ∗+ (ab)∗
•
CTS(L)isNP-hardbecause(ab)−1L= (ab)∗•
CSh(L)isin NL: trivial if there is more than one wordThe Algebraic Approach Fails
Can we just studyalgebraicallythe tractable languages?Not really...
•
Not closed underintersection•
Not closed undercomplement•
Not closed underinverse morphism•
Not closed underconcatenation (not in paper, only known forCTS)•
ForCSh: not closed underquotientRemark:For the languageL=bΣ∗+aaΣ∗+ (ab)∗
Tractability Based on Width
•
CSh(L)isin NLforany regular languageLif we assume that there areat mostkinput wordsw1, . . . ,wkfor a constantk∈N→ Needkcountersto remember the current position in each word, plusautomaton state
•
CTS(L)is inin NLforany regular languageLif the input DAGGhaswidth≤kfor constantk∈N• Width: size of the largestantichain (subset of pairwise incomparable vertices)
→ PartitionGinkchains(Dilworth’s theorem), and conclude by NL algorithm
a
b a b
b a
→ These results are making anadditional assumption, but...
Tractability Based on Width
•
CSh(L)isin NLforany regular languageLif we assume that there areat mostkinput wordsw1, . . . ,wkfor a constantk∈N→ Needkcountersto remember the current position in each word, plusautomaton state
•
CTS(L)is inin NLforany regular languageLif the input DAGGhaswidth≤kfor constantk∈N• Width: size of the largestantichain (subset of pairwise incomparable vertices)
→ PartitionGinkchains(Dilworth’s theorem), and conclude by NL algorithm
a
b a b
b a
→ These results are making anadditional assumption, but...
Tractability Based on Width
•
CSh(L)isin NLforany regular languageLif we assume that there areat mostkinput wordsw1, . . . ,wkfor a constantk∈N→ Needkcountersto remember the current position in each word, plusautomaton state
•
CTS(L)is inin NLforany regular languageLif the input DAGGhaswidth≤kfor constantk∈N• Width: size of the largestantichain (subset of pairwise incomparable vertices)
→ PartitionGinkchains(Dilworth’s theorem), and conclude by NL algorithm
a
b a b
b a
→ These results are making anadditional assumption, but...
Tractability Based on Width
•
CSh(L)isin NLforany regular languageLif we assume that there areat mostkinput wordsw1, . . . ,wkfor a constantk∈N→ Needkcountersto remember the current position in each word, plusautomaton state
•
CTS(L)is inin NLforany regular languageLif the input DAGGhaswidth≤kfor constantk∈N• Width: size of the largestantichain (subset of pairwise incomparable vertices)
→ PartitionGinkchains(Dilworth’s theorem), and conclude by NL algorithm
a
b a b
b a
→ These results are making anadditional assumption, but...
Tractability Based on Width
•
CSh(L)isin NLforany regular languageLif we assume that there areat mostkinput wordsw1, . . . ,wkfor a constantk∈N→ Needkcountersto remember the current position in each word, plusautomaton state
•
CTS(L)is inin NLforany regular languageLif the input DAGGhaswidth≤kfor constantk∈N• Width: size of the largestantichain (subset of pairwise incomparable vertices)
→ PartitionGinkchains(Dilworth’s theorem), and conclude by NL algorithm
a
b a b
b a
→ These results are making anadditional assumption, but...
Tractability Based on Width
•
CSh(L)isin NLforany regular languageLif we assume that there areat mostkinput wordsw1, . . . ,wkfor a constantk∈N→ Needkcountersto remember the current position in each word, plusautomaton state
•
CTS(L)is inin NLforany regular languageLif the input DAGGhaswidth≤kfor constantk∈N• Width: size of the largestantichain (subset of pairwise incomparable vertices)
→ PartitionGinkchains(Dilworth’s theorem), and conclude by NL algorithm
a
b a b
b a
→ These results are making anadditional assumption, but...
Tractability Based on Width
•
CSh(L)isin NLforany regular languageLif we assume that there areat mostkinput wordsw1, . . . ,wkfor a constantk∈N→ Needkcountersto remember the current position in each word, plusautomaton state
•
CTS(L)is inin NLforany regular languageLif the input DAGGhaswidth≤kfor constantk∈N• Width: size of the largestantichain (subset of pairwise incomparable vertices)
→ PartitionGinkchains(Dilworth’s theorem), and conclude by NL algorithm
a
b a b
b a
→ These results are making anadditional assumption, but...
Tractability Based on Width
•
CSh(L)isin NLforany regular languageLif we assume that there areat mostkinput wordsw1, . . . ,wkfor a constantk∈N→ Needkcountersto remember the current position in each word, plusautomaton state
•
CTS(L)is inin NLforany regular languageLif the input DAGGhaswidth≤kfor constantk∈N• Width: size of the largestantichain (subset of pairwise incomparable vertices)
→ PartitionGinkchains(Dilworth’s theorem),
a
b a b
b a
→ These results are making anadditional assumption, but...
Tractability Based on Width
•
CSh(L)isin NLforany regular languageLif we assume that there areat mostkinput wordsw1, . . . ,wkfor a constantk∈N→ Needkcountersto remember the current position in each word, plusautomaton state
•
CTS(L)is inin NLforany regular languageLif the input DAGGhaswidth≤kfor constantk∈N• Width: size of the largestantichain (subset of pairwise incomparable vertices)
→ PartitionGinkchains(Dilworth’s theorem), and conclude by NL algorithm
a
b a b
b a