Topological Sorting under Regular...

104
Topological Sorting under Regular Constraints Antoine Amarilli , Charles Paperman July th, Télécom ParisTech Université de Lille /

Transcript of Topological Sorting under Regular...

Page 1: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Topological Sorting under Regular Constraints

Antoine Amarilli1, Charles Paperman2

July 12th, 20181Télécom ParisTech

2Université de Lille

1/14

Page 2: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Constrained Topological Sorting

• Fix an alphabet: e.g., Σ = {a,b}

• Fix a language: e.g., L = (ab)∗

• We study constrained topological sorting:• Input: directed acyclic graph (DAG)with vertices labeled with Σ

• Output: is there a topological sortthat falls in L?

• Question: when is this problem tractable?

a

b a b

b a

a b a b a b... in L!

2/14

Page 3: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Constrained Topological Sorting

• Fix an alphabet: e.g., Σ = {a,b}

• Fix a language: e.g., L = (ab)∗

• We study constrained topological sorting:• Input: directed acyclic graph (DAG)with vertices labeled with Σ

• Output: is there a topological sortthat falls in L?

• Question: when is this problem tractable?

a

b a b

b a

a b a b a b... in L!

2/14

Page 4: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Constrained Topological Sorting

• Fix an alphabet: e.g., Σ = {a,b}

• Fix a language: e.g., L = (ab)∗

• We study constrained topological sorting:

• Input: directed acyclic graph (DAG)with vertices labeled with Σ

• Output: is there a topological sortthat falls in L?

• Question: when is this problem tractable?

a

b a b

b a

a b a b a b... in L!

2/14

Page 5: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Constrained Topological Sorting

• Fix an alphabet: e.g., Σ = {a,b}

• Fix a language: e.g., L = (ab)∗

• We study constrained topological sorting:• Input: directed acyclic graph (DAG)with vertices labeled with Σ

• Output: is there a topological sortthat falls in L?

• Question: when is this problem tractable?

a

b a b

b a

a b a b a b... in L!

2/14

Page 6: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Constrained Topological Sorting

• Fix an alphabet: e.g., Σ = {a,b}

• Fix a language: e.g., L = (ab)∗

• We study constrained topological sorting:• Input: directed acyclic graph (DAG)with vertices labeled with Σ

• Output: is there a topological sortthat falls in L?

• Question: when is this problem tractable?

a

b a b

b a

a b a b a b... in L!

2/14

Page 7: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Constrained Topological Sorting

• Fix an alphabet: e.g., Σ = {a,b}

• Fix a language: e.g., L = (ab)∗

• We study constrained topological sorting:• Input: directed acyclic graph (DAG)with vertices labeled with Σ

• Output: is there a topological sortthat falls in L?

• Question: when is this problem tractable?

a

b a b

b a

a

b a b b a... not in L!

2/14

Page 8: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Constrained Topological Sorting

• Fix an alphabet: e.g., Σ = {a,b}

• Fix a language: e.g., L = (ab)∗

• We study constrained topological sorting:• Input: directed acyclic graph (DAG)with vertices labeled with Σ

• Output: is there a topological sortthat falls in L?

• Question: when is this problem tractable?

a

b a b

b a

a b

a b b a... not in L!

2/14

Page 9: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Constrained Topological Sorting

• Fix an alphabet: e.g., Σ = {a,b}

• Fix a language: e.g., L = (ab)∗

• We study constrained topological sorting:• Input: directed acyclic graph (DAG)with vertices labeled with Σ

• Output: is there a topological sortthat falls in L?

• Question: when is this problem tractable?

a

b a b

b a

a b a

b b a... not in L!

2/14

Page 10: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Constrained Topological Sorting

• Fix an alphabet: e.g., Σ = {a,b}

• Fix a language: e.g., L = (ab)∗

• We study constrained topological sorting:• Input: directed acyclic graph (DAG)with vertices labeled with Σ

• Output: is there a topological sortthat falls in L?

• Question: when is this problem tractable?

a

b a b

b a

a b a b

b a... not in L!

2/14

Page 11: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Constrained Topological Sorting

• Fix an alphabet: e.g., Σ = {a,b}

• Fix a language: e.g., L = (ab)∗

• We study constrained topological sorting:• Input: directed acyclic graph (DAG)with vertices labeled with Σ

• Output: is there a topological sortthat falls in L?

• Question: when is this problem tractable?

a

b a b

b a

a b a b b

a... not in L!

2/14

Page 12: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Constrained Topological Sorting

• Fix an alphabet: e.g., Σ = {a,b}

• Fix a language: e.g., L = (ab)∗

• We study constrained topological sorting:• Input: directed acyclic graph (DAG)with vertices labeled with Σ

• Output: is there a topological sortthat falls in L?

• Question: when is this problem tractable?

a

b a b

b a

a b a b b a

... not in L!

2/14

Page 13: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Constrained Topological Sorting

• Fix an alphabet: e.g., Σ = {a,b}

• Fix a language: e.g., L = (ab)∗

• We study constrained topological sorting:• Input: directed acyclic graph (DAG)with vertices labeled with Σ

• Output: is there a topological sortthat falls in L?

• Question: when is this problem tractable?

a

b a b

b a

a b a b b a... not in L!

2/14

Page 14: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Constrained Topological Sorting

• Fix an alphabet: e.g., Σ = {a,b}

• Fix a language: e.g., L = (ab)∗

• We study constrained topological sorting:• Input: directed acyclic graph (DAG)with vertices labeled with Σ

• Output: is there a topological sortthat falls in L?

• Question: when is this problem tractable?

a

b a b

b a

a b a b a b... in L!

2/14

Page 15: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Constrained Topological Sorting

• Fix an alphabet: e.g., Σ = {a,b}

• Fix a language: e.g., L = (ab)∗

• We study constrained topological sorting:• Input: directed acyclic graph (DAG)with vertices labeled with Σ

• Output: is there a topological sortthat falls in L?

• Question: when is this problem tractable?

a

b a b

b a

a

b a b a b... in L!

2/14

Page 16: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Constrained Topological Sorting

• Fix an alphabet: e.g., Σ = {a,b}

• Fix a language: e.g., L = (ab)∗

• We study constrained topological sorting:• Input: directed acyclic graph (DAG)with vertices labeled with Σ

• Output: is there a topological sortthat falls in L?

• Question: when is this problem tractable?

a

b a b

b a

a b

a b a b... in L!

2/14

Page 17: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Constrained Topological Sorting

• Fix an alphabet: e.g., Σ = {a,b}

• Fix a language: e.g., L = (ab)∗

• We study constrained topological sorting:• Input: directed acyclic graph (DAG)with vertices labeled with Σ

• Output: is there a topological sortthat falls in L?

• Question: when is this problem tractable?

a

b a b

b a

a b a

b a b... in L!

2/14

Page 18: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Constrained Topological Sorting

• Fix an alphabet: e.g., Σ = {a,b}

• Fix a language: e.g., L = (ab)∗

• We study constrained topological sorting:• Input: directed acyclic graph (DAG)with vertices labeled with Σ

• Output: is there a topological sortthat falls in L?

• Question: when is this problem tractable?

a

b a b

b a

a b a b

a b... in L!

2/14

Page 19: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Constrained Topological Sorting

• Fix an alphabet: e.g., Σ = {a,b}

• Fix a language: e.g., L = (ab)∗

• We study constrained topological sorting:• Input: directed acyclic graph (DAG)with vertices labeled with Σ

• Output: is there a topological sortthat falls in L?

• Question: when is this problem tractable?

a

b a b

b a

a b a b a

b... in L!

2/14

Page 20: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Constrained Topological Sorting

• Fix an alphabet: e.g., Σ = {a,b}

• Fix a language: e.g., L = (ab)∗

• We study constrained topological sorting:• Input: directed acyclic graph (DAG)with vertices labeled with Σ

• Output: is there a topological sortthat falls in L?

• Question: when is this problem tractable?

a

b a b

b a

a b a b a b

... in L!

2/14

Page 21: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Constrained Topological Sorting

• Fix an alphabet: e.g., Σ = {a,b}

• Fix a language: e.g., L = (ab)∗

• We study constrained topological sorting:• Input: directed acyclic graph (DAG)with vertices labeled with Σ

• Output: is there a topological sortthat falls in L?

• Question: when is this problem tractable?

a

b a b

b a

a b a b a b... in L!

2/14

Page 22: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Constrained Topological Sorting

• Fix an alphabet: e.g., Σ = {a,b}

• Fix a language: e.g., L = (ab)∗

• We study constrained topological sorting:• Input: directed acyclic graph (DAG)with vertices labeled with Σ

• Output: is there a topological sortthat falls in L?

• Question: when is this problem tractable?

a

b a b

b a

a b a b a b... in L!

2/14

Page 23: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Constrained Topological Sorting

• Fix an alphabet: e.g., Σ = {a,b}

• Fix a language: e.g., L = (ab)∗

• We study constrained topological sorting:• Input: directed acyclic graph (DAG)with vertices labeled with Σ

• Output: is there a topological sortthat falls in L?

• Question: when is this problem tractable?

a

b a b

b a

a b a b a b... in L!

2/14

Page 24: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Motivation

• How we really ended up studying this problem:

2011 2012 2013 2014 2015 2016 2017 2018

Probabilistic XMLXML versioning

• Which a-posteriori motivation did we invent for the problem?→ Scheduling with constraints! → Veri�cation for concurrent code!→ Computational biology! → Blockchain! (joke)

• But why do we actually care?→ Natural problem and apparently nothing was known about it!

3/14

Page 25: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Motivation

• How we really ended up studying this problem:2011 2012 2013 2014 2015 2016 2017 2018

Probabilistic XMLXML versioning

• Which a-posteriori motivation did we invent for the problem?→ Scheduling with constraints! → Veri�cation for concurrent code!→ Computational biology! → Blockchain! (joke)

• But why do we actually care?→ Natural problem and apparently nothing was known about it!

3/14

Page 26: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Motivation

• How we really ended up studying this problem:2011 2012 2013 2014 2015 2016 2017 2018

Probabilistic XMLXML versioning

Order-uncertain databasesTop-k Aggregate queries

• Which a-posteriori motivation did we invent for the problem?→ Scheduling with constraints! → Veri�cation for concurrent code!→ Computational biology! → Blockchain! (joke)

• But why do we actually care?→ Natural problem and apparently nothing was known about it!

3/14

Page 27: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Motivation

• How we really ended up studying this problem:2011 2012 2013 2014 2015 2016 2017 2018

Probabilistic XMLXML versioning

Order-uncertain databasesTop-k Aggregate queries

Possible answers

• Which a-posteriori motivation did we invent for the problem?→ Scheduling with constraints! → Veri�cation for concurrent code!→ Computational biology! → Blockchain! (joke)

• But why do we actually care?→ Natural problem and apparently nothing was known about it!

3/14

Page 28: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Motivation

• How we really ended up studying this problem:2011 2012 2013 2014 2015 2016 2017 2018

Probabilistic XMLXML versioning

Order-uncertain databasesTop-k Aggregate queries

Possible answers

DAGs

Algebraic language theory?!

• Which a-posteriori motivation did we invent for the problem?→ Scheduling with constraints! → Veri�cation for concurrent code!→ Computational biology! → Blockchain! (joke)

• But why do we actually care?→ Natural problem and apparently nothing was known about it!

3/14

Page 29: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Motivation

• How we really ended up studying this problem:2011 2012 2013 2014 2015 2016 2017 2018

Probabilistic XMLXML versioning

Order-uncertain databasesTop-k Aggregate queries

Possible answers

DAGs

Algebraic language theory?!

• Which a-posteriori motivation did we invent for the problem?

→ Scheduling with constraints! → Veri�cation for concurrent code!→ Computational biology! → Blockchain! (joke)

• But why do we actually care?→ Natural problem and apparently nothing was known about it!

3/14

Page 30: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Motivation

• How we really ended up studying this problem:2011 2012 2013 2014 2015 2016 2017 2018

Probabilistic XMLXML versioning

Order-uncertain databasesTop-k Aggregate queries

Possible answers

DAGs

Algebraic language theory?!

• Which a-posteriori motivation did we invent for the problem?→ Scheduling with constraints! → Veri�cation for concurrent code!

→ Computational biology! → Blockchain! (joke)

• But why do we actually care?→ Natural problem and apparently nothing was known about it!

3/14

Page 31: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Motivation

• How we really ended up studying this problem:2011 2012 2013 2014 2015 2016 2017 2018

Probabilistic XMLXML versioning

Order-uncertain databasesTop-k Aggregate queries

Possible answers

DAGs

Algebraic language theory?!

• Which a-posteriori motivation did we invent for the problem?→ Scheduling with constraints! → Veri�cation for concurrent code!→ Computational biology! → Blockchain!

(joke)

• But why do we actually care?→ Natural problem and apparently nothing was known about it!

3/14

Page 32: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Motivation

• How we really ended up studying this problem:2011 2012 2013 2014 2015 2016 2017 2018

Probabilistic XMLXML versioning

Order-uncertain databasesTop-k Aggregate queries

Possible answers

DAGs

Algebraic language theory?!

• Which a-posteriori motivation did we invent for the problem?→ Scheduling with constraints! → Veri�cation for concurrent code!→ Computational biology! → Blockchain! (joke)

• But why do we actually care?→ Natural problem and apparently nothing was known about it!

3/14

Page 33: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Motivation

• How we really ended up studying this problem:2011 2012 2013 2014 2015 2016 2017 2018

Probabilistic XMLXML versioning

Order-uncertain databasesTop-k Aggregate queries

Possible answers

DAGs

Algebraic language theory?!

• Which a-posteriori motivation did we invent for the problem?→ Scheduling with constraints! → Veri�cation for concurrent code!→ Computational biology! → Blockchain! (joke)

• But why do we actually care?

→ Natural problem and apparently nothing was known about it!

3/14

Page 34: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Motivation

• How we really ended up studying this problem:2011 2012 2013 2014 2015 2016 2017 2018

Probabilistic XMLXML versioning

Order-uncertain databasesTop-k Aggregate queries

Possible answers

DAGs

Algebraic language theory?!

• Which a-posteriori motivation did we invent for the problem?→ Scheduling with constraints! → Veri�cation for concurrent code!→ Computational biology! → Blockchain! (joke)

• But why do we actually care?→ Natural problem and apparently nothing was known about it!

3/14

Page 35: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Formal problem statement

• Fix a regular language L on an �nite alphabet Σ

• Constrained topological sort problem CTS(L):• Input: a DAG G with vertices labeled by letters of Σ

• Output: is there a topological sort of G such thatthe sequence of vertex labels is a word of L

• Special case: the constrained shu�e problem CSh(L):• Input: a set of words w1, . . . ,wn of Σ∗

• Output: is there a shu�e of w1, . . . ,wn which is in L

• This is like CTS but the input DAG is an union of paths→ Question: What is the complexity of CTS(L) and CSh(L),

depending on the �xed language L ?

4/14

Page 36: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Formal problem statement

• Fix a regular language L on an �nite alphabet Σ

• Constrained topological sort problem CTS(L):• Input: a DAG G with vertices labeled by letters of Σ

• Output: is there a topological sort of G such thatthe sequence of vertex labels is a word of L

a

b a b

b a

• Special case: the constrained shu�e problem CSh(L):• Input: a set of words w1, . . . ,wn of Σ∗

• Output: is there a shu�e of w1, . . . ,wn which is in L

• This is like CTS but the input DAG is an union of paths→ Question: What is the complexity of CTS(L) and CSh(L),

depending on the �xed language L ?

4/14

Page 37: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Formal problem statement

• Fix a regular language L on an �nite alphabet Σ

• Constrained topological sort problem CTS(L):• Input: a DAG G with vertices labeled by letters of Σ

• Output: is there a topological sort of G such thatthe sequence of vertex labels is a word of L

a

b a b

b a

• Special case: the constrained shu�e problem CSh(L):• Input: a set of words w1, . . . ,wn of Σ∗

• Output: is there a shu�e of w1, . . . ,wn which is in L

• This is like CTS but the input DAG is an union of paths→ Question: What is the complexity of CTS(L) and CSh(L),

depending on the �xed language L ?

4/14

Page 38: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Formal problem statement

• Fix a regular language L on an �nite alphabet Σ

• Constrained topological sort problem CTS(L):• Input: a DAG G with vertices labeled by letters of Σ

• Output: is there a topological sort of G such thatthe sequence of vertex labels is a word of L

a

b a b

b a

• Special case: the constrained shu�e problem CSh(L):• Input: a set of words w1, . . . ,wn of Σ∗

• Output: is there a shu�e of w1, . . . ,wn which is in L

• This is like CTS but the input DAG is an union of paths

a

a

b

b

b

a

→ Question: What is the complexity of CTS(L) and CSh(L),depending on the �xed language L ?

4/14

Page 39: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Formal problem statement

• Fix a regular language L on an �nite alphabet Σ

• Constrained topological sort problem CTS(L):• Input: a DAG G with vertices labeled by letters of Σ

• Output: is there a topological sort of G such thatthe sequence of vertex labels is a word of L

a

b a b

b a

• Special case: the constrained shu�e problem CSh(L):• Input: a set of words w1, . . . ,wn of Σ∗

• Output: is there a shu�e of w1, . . . ,wn which is in L

• This is like CTS but the input DAG is an union of paths

a

a

b

b

b

a

→ Question: What is the complexity of CTS(L) and CSh(L),depending on the �xed language L ?

4/14

Page 40: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Dichotomy

Conjecture

Conjecture

For every regular language L, exactly one of the following holds:

• L has [some nice property] and CTS(L) is in NL

• L has [some nasty property] and CTS(L) is NP-hard

Here’s what we actually know:

• CTS and CSh are NP-hard for some languages, including (ab)∗

• They are in NL for some language families (monomials, groups)• Some languages are tractable for seemingly unrelated reasons→ Very mysterious landscape! (to us)

5/14

Page 41: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Dichotomy Conjecture

ConjectureFor every regular language L, exactly one of the following holds:

• L has [some nice property] and CTS(L) is in NL

• L has [some nasty property] and CTS(L) is NP-hard

Here’s what we actually know:

• CTS and CSh are NP-hard for some languages, including (ab)∗

• They are in NL for some language families (monomials, groups)• Some languages are tractable for seemingly unrelated reasons→ Very mysterious landscape! (to us)

5/14

Page 42: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Dichotomy Conjecture

ConjectureFor every regular language L, exactly one of the following holds:

• L has [some nice property] and CTS(L) is in NL

• L has [some nasty property] and CTS(L) is NP-hard

Here’s what we actually know:

• CTS and CSh are NP-hard for some languages, including (ab)∗

• They are in NL for some language families (monomials, groups)• Some languages are tractable for seemingly unrelated reasons→ Very mysterious landscape! (to us)

5/14

Page 43: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Dichotomy Conjecture

ConjectureFor every regular language L, exactly one of the following holds:

• L has [some nice property] and CTS(L) is in NL

• L has [some nasty property] and CTS(L) is NP-hard

Here’s what we actually know:

• CTS and CSh are NP-hard for some languages, including (ab)∗

• They are in NL for some language families (monomials, groups)

• Some languages are tractable for seemingly unrelated reasons→ Very mysterious landscape! (to us)

5/14

Page 44: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Dichotomy Conjecture

ConjectureFor every regular language L, exactly one of the following holds:

• L has [some nice property] and CTS(L) is in NL

• L has [some nasty property] and CTS(L) is NP-hard

Here’s what we actually know:

• CTS and CSh are NP-hard for some languages, including (ab)∗

• They are in NL for some language families (monomials, groups)• Some languages are tractable for seemingly unrelated reasons

→ Very mysterious landscape! (to us)

5/14

Page 45: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Dichotomy Conjecture

ConjectureFor every regular language L, exactly one of the following holds:

• L has [some nice property] and CTS(L) is in NL

• L has [some nasty property] and CTS(L) is NP-hard

Here’s what we actually know:

• CTS and CSh are NP-hard for some languages, including (ab)∗

• They are in NL for some language families (monomials, groups)• Some languages are tractable for seemingly unrelated reasons→ Very mysterious landscape! (to us)

5/14

Page 46: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Hardness Results

Page 47: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Existing Hardness Result

... but the target is a word which is provided as input!

→ Does not directly apply for us, because we �x the target language

6/14

Page 48: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Existing Hardness Result

... but the target is a word which is provided as input!

→ Does not directly apply for us, because we �x the target language

6/14

Page 49: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Existing Hardness Result

... but the target is a word which is provided as input!

→ Does not directly apply for us, because we �x the target language

6/14

Page 50: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Hardness for CTS

• We can reduce their problem to CSh for the language (aA+ bB)∗

• To determine if the shu�e of aab and bb contains ababb ...

solve the CSh-problem for aab and bb and ABABB→ CSh((aA+ bB)∗) is NP-hard and the same holds for CTS

• Similar technique: CSh((ab)∗) is NP-hard

• Custom reduction technique to show NP-hardness for:• (ab+ b)∗

• (aa+ bb)∗

• u∗ if u contains two di�erent letters

• Conjecture: if F is �nite then CTS(F∗) is NP-hardunless it contains a power of each of its letters

7/14

Page 51: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Hardness for CTS

• We can reduce their problem to CSh for the language (aA+ bB)∗

• To determine if the shu�e of aab and bb contains ababb ...solve the CSh-problem for aab and bb and ABABB

→ CSh((aA+ bB)∗) is NP-hard and the same holds for CTS

• Similar technique: CSh((ab)∗) is NP-hard

• Custom reduction technique to show NP-hardness for:• (ab+ b)∗

• (aa+ bb)∗

• u∗ if u contains two di�erent letters

• Conjecture: if F is �nite then CTS(F∗) is NP-hardunless it contains a power of each of its letters

7/14

Page 52: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Hardness for CTS

• We can reduce their problem to CSh for the language (aA+ bB)∗

• To determine if the shu�e of aab and bb contains ababb ...solve the CSh-problem for aab and bb and ABABB

→ CSh((aA+ bB)∗) is NP-hard and the same holds for CTS

• Similar technique: CSh((ab)∗) is NP-hard

• Custom reduction technique to show NP-hardness for:• (ab+ b)∗

• (aa+ bb)∗

• u∗ if u contains two di�erent letters

• Conjecture: if F is �nite then CTS(F∗) is NP-hardunless it contains a power of each of its letters

7/14

Page 53: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Hardness for CTS

• We can reduce their problem to CSh for the language (aA+ bB)∗

• To determine if the shu�e of aab and bb contains ababb ...solve the CSh-problem for aab and bb and ABABB

→ CSh((aA+ bB)∗) is NP-hard and the same holds for CTS

• Similar technique: CSh((ab)∗) is NP-hard

• Custom reduction technique to show NP-hardness for:• (ab+ b)∗

• (aa+ bb)∗

• u∗ if u contains two di�erent letters

• Conjecture: if F is �nite then CTS(F∗) is NP-hardunless it contains a power of each of its letters

7/14

Page 54: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Hardness for CTS

• We can reduce their problem to CSh for the language (aA+ bB)∗

• To determine if the shu�e of aab and bb contains ababb ...solve the CSh-problem for aab and bb and ABABB

→ CSh((aA+ bB)∗) is NP-hard and the same holds for CTS

• Similar technique: CSh((ab)∗) is NP-hard

• Custom reduction technique to show NP-hardness for:• (ab+ b)∗

• (aa+ bb)∗

• u∗ if u contains two di�erent letters

• Conjecture: if F is �nite then CTS(F∗) is NP-hardunless it contains a power of each of its letters

7/14

Page 55: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Hardness for CTS

• We can reduce their problem to CSh for the language (aA+ bB)∗

• To determine if the shu�e of aab and bb contains ababb ...solve the CSh-problem for aab and bb and ABABB

→ CSh((aA+ bB)∗) is NP-hard and the same holds for CTS

• Similar technique: CSh((ab)∗) is NP-hard

• Custom reduction technique to show NP-hardness for:• (ab+ b)∗

• (aa+ bb)∗

• u∗ if u contains two di�erent letters

• Conjecture: if F is �nite then CTS(F∗) is NP-hardunless it contains a power of each of its letters

7/14

Page 56: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Hardness for CTS

• We can reduce their problem to CSh for the language (aA+ bB)∗

• To determine if the shu�e of aab and bb contains ababb ...solve the CSh-problem for aab and bb and ABABB

→ CSh((aA+ bB)∗) is NP-hard and the same holds for CTS

• Similar technique: CSh((ab)∗) is NP-hard

• Custom reduction technique to show NP-hardness for:• (ab+ b)∗

• (aa+ bb)∗

• u∗ if u contains two di�erent letters

• Conjecture: if F is �nite then CTS(F∗) is NP-hardunless it contains a power of each of its letters

7/14

Page 57: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Tractability Results

Page 58: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Tractability for Monomials

• Monomial: language of the form A∗1 a1 A∗2 a2 · · · A∗n an A∗n+1where a1, . . . ,an ∈ Σ and A1, . . . ,An+1 ⊆ Σ

• Union of monomials: union of �nitely many such languages

• Example: pattern matching Σ∗ word1 Σ∗ + Σ∗ word2 Σ∗

• Logical interpretation: languages de�nable in Σ2[<]

TheoremFor any union of monomials L, the problem CTS(L) is in NL

Proof idea:

• Tractable languages are clearly closed under union• We can guess the positions of the individual ai• Check that the other vertices can �t in the A∗i (uses NL = co-NL)

8/14

Page 59: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Tractability for Monomials

• Monomial: language of the form A∗1 a1 A∗2 a2 · · · A∗n an A∗n+1where a1, . . . ,an ∈ Σ and A1, . . . ,An+1 ⊆ Σ

• Union of monomials: union of �nitely many such languages• Example: pattern matching Σ∗ word1 Σ∗ + Σ∗ word2 Σ∗

• Logical interpretation: languages de�nable in Σ2[<]

TheoremFor any union of monomials L, the problem CTS(L) is in NL

Proof idea:

• Tractable languages are clearly closed under union• We can guess the positions of the individual ai• Check that the other vertices can �t in the A∗i (uses NL = co-NL)

8/14

Page 60: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Tractability for Monomials

• Monomial: language of the form A∗1 a1 A∗2 a2 · · · A∗n an A∗n+1where a1, . . . ,an ∈ Σ and A1, . . . ,An+1 ⊆ Σ

• Union of monomials: union of �nitely many such languages• Example: pattern matching Σ∗ word1 Σ∗ + Σ∗ word2 Σ∗

• Logical interpretation: languages de�nable in Σ2[<]

TheoremFor any union of monomials L, the problem CTS(L) is in NL

Proof idea:

• Tractable languages are clearly closed under union• We can guess the positions of the individual ai• Check that the other vertices can �t in the A∗i (uses NL = co-NL)

8/14

Page 61: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Tractability for Monomials

• Monomial: language of the form A∗1 a1 A∗2 a2 · · · A∗n an A∗n+1where a1, . . . ,an ∈ Σ and A1, . . . ,An+1 ⊆ Σ

• Union of monomials: union of �nitely many such languages• Example: pattern matching Σ∗ word1 Σ∗ + Σ∗ word2 Σ∗

• Logical interpretation: languages de�nable in Σ2[<]

TheoremFor any union of monomials L, the problem CTS(L) is in NL

Proof idea:

• Tractable languages are clearly closed under union• We can guess the positions of the individual ai• Check that the other vertices can �t in the A∗i (uses NL = co-NL)

8/14

Page 62: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Tractability for Monomials

• Monomial: language of the form A∗1 a1 A∗2 a2 · · · A∗n an A∗n+1where a1, . . . ,an ∈ Σ and A1, . . . ,An+1 ⊆ Σ

• Union of monomials: union of �nitely many such languages• Example: pattern matching Σ∗ word1 Σ∗ + Σ∗ word2 Σ∗

• Logical interpretation: languages de�nable in Σ2[<]

TheoremFor any union of monomials L, the problem CTS(L) is in NL

Proof idea:

• Tractable languages are clearly closed under union

• We can guess the positions of the individual ai• Check that the other vertices can �t in the A∗i (uses NL = co-NL)

8/14

Page 63: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Tractability for Monomials

• Monomial: language of the form A∗1 a1 A∗2 a2 · · · A∗n an A∗n+1where a1, . . . ,an ∈ Σ and A1, . . . ,An+1 ⊆ Σ

• Union of monomials: union of �nitely many such languages• Example: pattern matching Σ∗ word1 Σ∗ + Σ∗ word2 Σ∗

• Logical interpretation: languages de�nable in Σ2[<]

TheoremFor any union of monomials L, the problem CTS(L) is in NL

Proof idea:

• Tractable languages are clearly closed under union• We can guess the positions of the individual ai

• Check that the other vertices can �t in the A∗i (uses NL = co-NL)

8/14

Page 64: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Tractability for Monomials

• Monomial: language of the form A∗1 a1 A∗2 a2 · · · A∗n an A∗n+1where a1, . . . ,an ∈ Σ and A1, . . . ,An+1 ⊆ Σ

• Union of monomials: union of �nitely many such languages• Example: pattern matching Σ∗ word1 Σ∗ + Σ∗ word2 Σ∗

• Logical interpretation: languages de�nable in Σ2[<]

TheoremFor any union of monomials L, the problem CTS(L) is in NL

Proof idea:

• Tractable languages are clearly closed under union• We can guess the positions of the individual ai• Check that the other vertices can �t in the A∗i (uses NL = co-NL)

8/14

Page 65: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

The Algebraic Approach

Fails

Can we just study algebraically the tractable languages?

Not really...

• Not closed under intersection• Not closed under complement• Not closed under inverse morphism• Not closed under concatenation(not in paper, only known for CTS)

• For CSh: not closed under quotientRemark: For the language L = bΣ∗ + aaΣ∗ + (ab)∗

• CTS(L) is NP-hard because (ab)−1L = (ab)∗

• CSh(L) is in NL: trivial if there is more than one word

9/14

Page 66: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

The Algebraic Approach Fails

Can we just study algebraically the tractable languages? Not really...

• Not closed under intersection• Not closed under complement• Not closed under inverse morphism• Not closed under concatenation(not in paper, only known for CTS)

• For CSh: not closed under quotientRemark: For the language L = bΣ∗ + aaΣ∗ + (ab)∗

• CTS(L) is NP-hard because (ab)−1L = (ab)∗

• CSh(L) is in NL: trivial if there is more than one word

9/14

Page 67: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

The Algebraic Approach Fails

Can we just study algebraically the tractable languages? Not really...

• Not closed under intersection• Not closed under complement• Not closed under inverse morphism• Not closed under concatenation(not in paper, only known for CTS)

• For CSh: not closed under quotient

Remark: For the language L = bΣ∗ + aaΣ∗ + (ab)∗

• CTS(L) is NP-hard because (ab)−1L = (ab)∗

• CSh(L) is in NL: trivial if there is more than one word

9/14

Page 68: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

The Algebraic Approach Fails

Can we just study algebraically the tractable languages? Not really...

• Not closed under intersection• Not closed under complement• Not closed under inverse morphism• Not closed under concatenation(not in paper, only known for CTS)

• For CSh: not closed under quotientRemark: For the language L = bΣ∗ + aaΣ∗ + (ab)∗

• CTS(L) is NP-hard because (ab)−1L = (ab)∗

• CSh(L) is in NL: trivial if there is more than one word

9/14

Page 69: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Tractability Based on Width

• CSh(L) is in NL for any regular language L if we assume thatthere are at most k input words w1, . . . ,wk for a constant k ∈ N

→ Need k counters to remember the current position in each word,plus automaton state

• CTS(L) is in in NL for any regular language L ifthe input DAG G has width ≤ k for constant k ∈ N

• Width: size of the largest antichain(subset of pairwise incomparable vertices)

→ Partition G in k chains (Dilworth’s theorem),and conclude by NL algorithm

a

b a b

b a

→ These results are making an additional assumption, but...

10/14

Page 70: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Tractability Based on Width

• CSh(L) is in NL for any regular language L if we assume thatthere are at most k input words w1, . . . ,wk for a constant k ∈ N→ Need k counters to remember the current position in each word,

plus automaton state

• CTS(L) is in in NL for any regular language L ifthe input DAG G has width ≤ k for constant k ∈ N

• Width: size of the largest antichain(subset of pairwise incomparable vertices)

→ Partition G in k chains (Dilworth’s theorem),and conclude by NL algorithm

a

b a b

b a

→ These results are making an additional assumption, but...

10/14

Page 71: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Tractability Based on Width

• CSh(L) is in NL for any regular language L if we assume thatthere are at most k input words w1, . . . ,wk for a constant k ∈ N→ Need k counters to remember the current position in each word,

plus automaton state

• CTS(L) is in in NL for any regular language L ifthe input DAG G has width ≤ k for constant k ∈ N

• Width: size of the largest antichain(subset of pairwise incomparable vertices)

→ Partition G in k chains (Dilworth’s theorem),and conclude by NL algorithm

a

b a b

b a

→ These results are making an additional assumption, but...

10/14

Page 72: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Tractability Based on Width

• CSh(L) is in NL for any regular language L if we assume thatthere are at most k input words w1, . . . ,wk for a constant k ∈ N→ Need k counters to remember the current position in each word,

plus automaton state

• CTS(L) is in in NL for any regular language L ifthe input DAG G has width ≤ k for constant k ∈ N

• Width: size of the largest antichain(subset of pairwise incomparable vertices)

→ Partition G in k chains (Dilworth’s theorem),and conclude by NL algorithm

a

b a b

b a

→ These results are making an additional assumption, but...

10/14

Page 73: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Tractability Based on Width

• CSh(L) is in NL for any regular language L if we assume thatthere are at most k input words w1, . . . ,wk for a constant k ∈ N→ Need k counters to remember the current position in each word,

plus automaton state

• CTS(L) is in in NL for any regular language L ifthe input DAG G has width ≤ k for constant k ∈ N

• Width: size of the largest antichain(subset of pairwise incomparable vertices)

→ Partition G in k chains (Dilworth’s theorem),and conclude by NL algorithm

a

b a b

b a

→ These results are making an additional assumption, but...

10/14

Page 74: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Tractability Based on Width

• CSh(L) is in NL for any regular language L if we assume thatthere are at most k input words w1, . . . ,wk for a constant k ∈ N→ Need k counters to remember the current position in each word,

plus automaton state

• CTS(L) is in in NL for any regular language L ifthe input DAG G has width ≤ k for constant k ∈ N

• Width: size of the largest antichain(subset of pairwise incomparable vertices)

→ Partition G in k chains (Dilworth’s theorem),and conclude by NL algorithm

a

b a b

b a

→ These results are making an additional assumption, but...

10/14

Page 75: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Tractability Based on Width

• CSh(L) is in NL for any regular language L if we assume thatthere are at most k input words w1, . . . ,wk for a constant k ∈ N→ Need k counters to remember the current position in each word,

plus automaton state

• CTS(L) is in in NL for any regular language L ifthe input DAG G has width ≤ k for constant k ∈ N

• Width: size of the largest antichain(subset of pairwise incomparable vertices)

→ Partition G in k chains (Dilworth’s theorem),and conclude by NL algorithm

a

b a b

b a

→ These results are making an additional assumption, but...

10/14

Page 76: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Tractability Based on Width

• CSh(L) is in NL for any regular language L if we assume thatthere are at most k input words w1, . . . ,wk for a constant k ∈ N→ Need k counters to remember the current position in each word,

plus automaton state

• CTS(L) is in in NL for any regular language L ifthe input DAG G has width ≤ k for constant k ∈ N

• Width: size of the largest antichain(subset of pairwise incomparable vertices)

→ Partition G in k chains (Dilworth’s theorem),and conclude by NL algorithm

a

b a b

b a

→ These results are making an additional assumption, but...

10/14

Page 77: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Tractability Based on Width

• CSh(L) is in NL for any regular language L if we assume thatthere are at most k input words w1, . . . ,wk for a constant k ∈ N→ Need k counters to remember the current position in each word,

plus automaton state

• CTS(L) is in in NL for any regular language L ifthe input DAG G has width ≤ k for constant k ∈ N

• Width: size of the largest antichain(subset of pairwise incomparable vertices)

→ Partition G in k chains (Dilworth’s theorem),and conclude by NL algorithm

a

b a b

b a

→ These results are making an additional assumption, but...10/14

Page 78: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Tractability Based on Width (2)

• Fix Σ = {a,b}, take any regular language L and constant k ∈ N,we know that CTS is in NL for L+ Σ∗(ak + bk)Σ∗

• If the input DAG has width < 2k, use the result for bounded width• Otherwise we can achieve ak or bk with a large antichain

• A similar technique shows that (ab)∗ + Σ∗aaΣ∗ is tractable

→ Does it su�ce to bound the width of all letters but one?→ Unknown for L+ Σ∗akΣ∗ with arbitrary L and k > 2!

11/14

Page 79: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Tractability Based on Width (2)

• Fix Σ = {a,b}, take any regular language L and constant k ∈ N,we know that CTS is in NL for L+ Σ∗(ak + bk)Σ∗

• If the input DAG has width < 2k, use the result for bounded width

• Otherwise we can achieve ak or bk with a large antichain

• A similar technique shows that (ab)∗ + Σ∗aaΣ∗ is tractable

→ Does it su�ce to bound the width of all letters but one?→ Unknown for L+ Σ∗akΣ∗ with arbitrary L and k > 2!

11/14

Page 80: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Tractability Based on Width (2)

• Fix Σ = {a,b}, take any regular language L and constant k ∈ N,we know that CTS is in NL for L+ Σ∗(ak + bk)Σ∗

• If the input DAG has width < 2k, use the result for bounded width• Otherwise we can achieve ak or bk with a large antichain

• A similar technique shows that (ab)∗ + Σ∗aaΣ∗ is tractable

→ Does it su�ce to bound the width of all letters but one?→ Unknown for L+ Σ∗akΣ∗ with arbitrary L and k > 2!

11/14

Page 81: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Tractability Based on Width (2)

• Fix Σ = {a,b}, take any regular language L and constant k ∈ N,we know that CTS is in NL for L+ Σ∗(ak + bk)Σ∗

• If the input DAG has width < 2k, use the result for bounded width• Otherwise we can achieve ak or bk with a large antichain

• A similar technique shows that (ab)∗ + Σ∗aaΣ∗ is tractable

→ Does it su�ce to bound the width of all letters but one?

→ Unknown for L+ Σ∗akΣ∗ with arbitrary L and k > 2!

11/14

Page 82: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Tractability Based on Width (2)

• Fix Σ = {a,b}, take any regular language L and constant k ∈ N,we know that CTS is in NL for L+ Σ∗(ak + bk)Σ∗

• If the input DAG has width < 2k, use the result for bounded width• Otherwise we can achieve ak or bk with a large antichain

• A similar technique shows that (ab)∗ + Σ∗aaΣ∗ is tractable

→ Does it su�ce to bound the width of all letters but one?→ Unknown for L+ Σ∗akΣ∗ with arbitrary L and k > 2!

11/14

Page 83: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Tractability Based on the Structure of Groups

• Group language: the underlying monoid is a �nite group→ Automata where each letter acts bijectively

• District group monomial: language G1 a1 · · · Gn an Gn+1where a1, . . . ,an ∈ Σ and G1, . . . ,Gn are group languageson subsets of the alphabet Σ

TheoremFor any union L of district group monomials, CSh(L) is in NL

→ Only for CSh; complexity for CTS is unknown!

12/14

Page 84: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Tractability Based on the Structure of Groups

• Group language: the underlying monoid is a �nite group→ Automata where each letter acts bijectively

• District group monomial: language G1 a1 · · · Gn an Gn+1where a1, . . . ,an ∈ Σ and G1, . . . ,Gn are group languageson subsets of the alphabet Σ

TheoremFor any union L of district group monomials, CSh(L) is in NL

→ Only for CSh; complexity for CTS is unknown!

12/14

Page 85: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Tractability Based on the Structure of Groups

• Group language: the underlying monoid is a �nite group→ Automata where each letter acts bijectively

• District group monomial: language G1 a1 · · · Gn an Gn+1where a1, . . . ,an ∈ Σ and G1, . . . ,Gn are group languageson subsets of the alphabet Σ

TheoremFor any union L of district group monomials, CSh(L) is in NL

→ Only for CSh; complexity for CTS is unknown!

12/14

Page 86: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Tractability Based on the Structure of Groups

• Group language: the underlying monoid is a �nite group→ Automata where each letter acts bijectively

• District group monomial: language G1 a1 · · · Gn an Gn+1where a1, . . . ,an ∈ Σ and G1, . . . ,Gn are group languageson subsets of the alphabet Σ

TheoremFor any union L of district group monomials, CSh(L) is in NL

→ Only for CSh; complexity for CTS is unknown!

12/14

Page 87: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Tractability Based on All Sorts of Strange Reasons

• (aa+ b)∗ is in NL for CSh:

• Ad-hoc greedy algorithm: consume chain with most odd a blocks• Complexity open for CTS!• Complexity open for (ak + b)∗ for k > 2!• What about similar languages like (aa+ bb+ ab)∗?

• (caa)∗d(cbb)∗dΣ∗ + Σ∗ccΣ∗ is in NL for CSh but NP-hard for CTS• Tractability argument: another ad hoc greedy algorithm• Hardness argument: from k-clique encoded to a bipartite graph

13/14

Page 88: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Tractability Based on All Sorts of Strange Reasons

• (aa+ b)∗ is in NL for CSh:• Ad-hoc greedy algorithm: consume chain with most odd a blocks

• Complexity open for CTS!• Complexity open for (ak + b)∗ for k > 2!• What about similar languages like (aa+ bb+ ab)∗?

• (caa)∗d(cbb)∗dΣ∗ + Σ∗ccΣ∗ is in NL for CSh but NP-hard for CTS• Tractability argument: another ad hoc greedy algorithm• Hardness argument: from k-clique encoded to a bipartite graph

13/14

Page 89: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Tractability Based on All Sorts of Strange Reasons

• (aa+ b)∗ is in NL for CSh:• Ad-hoc greedy algorithm: consume chain with most odd a blocks• Complexity open for CTS!

• Complexity open for (ak + b)∗ for k > 2!• What about similar languages like (aa+ bb+ ab)∗?

• (caa)∗d(cbb)∗dΣ∗ + Σ∗ccΣ∗ is in NL for CSh but NP-hard for CTS• Tractability argument: another ad hoc greedy algorithm• Hardness argument: from k-clique encoded to a bipartite graph

13/14

Page 90: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Tractability Based on All Sorts of Strange Reasons

• (aa+ b)∗ is in NL for CSh:• Ad-hoc greedy algorithm: consume chain with most odd a blocks• Complexity open for CTS!• Complexity open for (ak + b)∗ for k > 2!

• What about similar languages like (aa+ bb+ ab)∗?

• (caa)∗d(cbb)∗dΣ∗ + Σ∗ccΣ∗ is in NL for CSh but NP-hard for CTS• Tractability argument: another ad hoc greedy algorithm• Hardness argument: from k-clique encoded to a bipartite graph

13/14

Page 91: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Tractability Based on All Sorts of Strange Reasons

• (aa+ b)∗ is in NL for CSh:• Ad-hoc greedy algorithm: consume chain with most odd a blocks• Complexity open for CTS!• Complexity open for (ak + b)∗ for k > 2!• What about similar languages like (aa+ bb+ ab)∗?

• (caa)∗d(cbb)∗dΣ∗ + Σ∗ccΣ∗ is in NL for CSh but NP-hard for CTS• Tractability argument: another ad hoc greedy algorithm• Hardness argument: from k-clique encoded to a bipartite graph

13/14

Page 92: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Tractability Based on All Sorts of Strange Reasons

• (aa+ b)∗ is in NL for CSh:• Ad-hoc greedy algorithm: consume chain with most odd a blocks• Complexity open for CTS!• Complexity open for (ak + b)∗ for k > 2!• What about similar languages like (aa+ bb+ ab)∗?

• (caa)∗d(cbb)∗dΣ∗ + Σ∗ccΣ∗ is in NL for CSh but NP-hard for CTS• Tractability argument: another ad hoc greedy algorithm• Hardness argument: from k-clique encoded to a bipartite graph

13/14

Page 93: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Conclusion

Page 94: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Summary and Future Work

Language CSh (shu�e) CTS (top. sort)

(ab)∗, u∗ with di�erent letters NP-hard NP-hard

Monomials A∗1a1 · · ·A∗nanA∗n+1 in NL in NLGroups, district group monomials in NL

bΣ∗ + aaΣ∗ + (ab)∗ in NL NP-hard

L+ Σ∗(ak + bk)Σ∗ in NL in NL(ab)∗ + Σ∗a2Σ∗ in NL in NLL+ Σ∗akΣ∗

(aa+ bb)∗, (ab+ a)∗ NP-hard NP-hard(aa+ b)∗ in NL(ak + b)∗

Essentially all other languages...

Thanks for your attention!

14/14

Page 95: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Summary and Future Work

Language CSh (shu�e) CTS (top. sort)

(ab)∗, u∗ with di�erent letters NP-hard NP-hard

Monomials A∗1a1 · · ·A∗nanA∗n+1 in NL in NLGroups, district group monomials in NL

bΣ∗ + aaΣ∗ + (ab)∗ in NL NP-hard

L+ Σ∗(ak + bk)Σ∗ in NL in NL(ab)∗ + Σ∗a2Σ∗ in NL in NLL+ Σ∗akΣ∗

(aa+ bb)∗, (ab+ a)∗ NP-hard NP-hard(aa+ b)∗ in NL(ak + b)∗

Essentially all other languages...

Thanks for your attention!

14/14

Page 96: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Summary and Future Work

Language CSh (shu�e) CTS (top. sort)

(ab)∗, u∗ with di�erent letters NP-hard NP-hard

Monomials A∗1a1 · · ·A∗nanA∗n+1 in NL in NLGroups, district group monomials in NL

bΣ∗ + aaΣ∗ + (ab)∗ in NL NP-hard

L+ Σ∗(ak + bk)Σ∗ in NL in NL(ab)∗ + Σ∗a2Σ∗ in NL in NLL+ Σ∗akΣ∗

(aa+ bb)∗, (ab+ a)∗ NP-hard NP-hard(aa+ b)∗ in NL(ak + b)∗

Essentially all other languages...

Thanks for your attention!

14/14

Page 97: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Summary and Future Work

Language CSh (shu�e) CTS (top. sort)

(ab)∗, u∗ with di�erent letters NP-hard NP-hard

Monomials A∗1a1 · · ·A∗nanA∗n+1 in NL in NLGroups, district group monomials in NL

bΣ∗ + aaΣ∗ + (ab)∗ in NL NP-hard

L+ Σ∗(ak + bk)Σ∗ in NL in NL(ab)∗ + Σ∗a2Σ∗ in NL in NLL+ Σ∗akΣ∗

(aa+ bb)∗, (ab+ a)∗ NP-hard NP-hard(aa+ b)∗ in NL(ak + b)∗

Essentially all other languages...

Thanks for your attention!

14/14

Page 98: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Summary and Future Work

Language CSh (shu�e) CTS (top. sort)

(ab)∗, u∗ with di�erent letters NP-hard NP-hard

Monomials A∗1a1 · · ·A∗nanA∗n+1 in NL in NLGroups, district group monomials in NL

bΣ∗ + aaΣ∗ + (ab)∗ in NL NP-hard

L+ Σ∗(ak + bk)Σ∗ in NL in NL(ab)∗ + Σ∗a2Σ∗ in NL in NLL+ Σ∗akΣ∗

(aa+ bb)∗, (ab+ a)∗ NP-hard NP-hard(aa+ b)∗ in NL(ak + b)∗

Essentially all other languages...

Thanks for your attention!

14/14

Page 99: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Summary and Future Work

Language CSh (shu�e) CTS (top. sort)

(ab)∗, u∗ with di�erent letters NP-hard NP-hard

Monomials A∗1a1 · · ·A∗nanA∗n+1 in NL in NLGroups, district group monomials in NL

bΣ∗ + aaΣ∗ + (ab)∗ in NL NP-hard

L+ Σ∗(ak + bk)Σ∗ in NL in NL(ab)∗ + Σ∗a2Σ∗ in NL in NLL+ Σ∗akΣ∗

(aa+ bb)∗, (ab+ a)∗ NP-hard NP-hard(aa+ b)∗ in NL(ak + b)∗

Essentially all other languages...

Thanks for your attention!

14/14

Page 100: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Summary and Future Work

Language CSh (shu�e) CTS (top. sort)

(ab)∗, u∗ with di�erent letters NP-hard NP-hard

Monomials A∗1a1 · · ·A∗nanA∗n+1 in NL in NLGroups, district group monomials in NL

bΣ∗ + aaΣ∗ + (ab)∗ in NL NP-hard

L+ Σ∗(ak + bk)Σ∗ in NL in NL(ab)∗ + Σ∗a2Σ∗ in NL in NLL+ Σ∗akΣ∗

(aa+ bb)∗, (ab+ a)∗ NP-hard NP-hard(aa+ b)∗ in NL(ak + b)∗

Essentially all other languages...

Thanks for your attention!

14/14

Page 101: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Summary and Future Work

Language CSh (shu�e) CTS (top. sort)

(ab)∗, u∗ with di�erent letters NP-hard NP-hard

Monomials A∗1a1 · · ·A∗nanA∗n+1 in NL in NLGroups, district group monomials in NL

bΣ∗ + aaΣ∗ + (ab)∗ in NL NP-hard

L+ Σ∗(ak + bk)Σ∗ in NL in NL(ab)∗ + Σ∗a2Σ∗ in NL in NLL+ Σ∗akΣ∗

(aa+ bb)∗, (ab+ a)∗ NP-hard NP-hard(aa+ b)∗ in NL(ak + b)∗

Essentially all other languages...

Thanks for your attention!

14/14

Page 102: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Summary and Future Work

Language CSh (shu�e) CTS (top. sort)

(ab)∗, u∗ with di�erent letters NP-hard NP-hard

Monomials A∗1a1 · · ·A∗nanA∗n+1 in NL in NLGroups, district group monomials in NL

bΣ∗ + aaΣ∗ + (ab)∗ in NL NP-hard

L+ Σ∗(ak + bk)Σ∗ in NL in NL(ab)∗ + Σ∗a2Σ∗ in NL in NLL+ Σ∗akΣ∗

(aa+ bb)∗, (ab+ a)∗ NP-hard NP-hard(aa+ b)∗ in NL(ak + b)∗

Essentially all other languages...

Thanks for your attention! 14/14

Page 103: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

References

Amarilli, A. and Paperman, C. (2018).Topological Sorting under Regular Constraints.In ICALP.Warmuth, M. K. and Haussler, D. (1984).On the complexity of iterated shu�e.JCSS, 28(3).

Page 104: Topological Sorting under Regular Constraintsa3nm.net/work/talks/icalp2018/amarilli2018topological_slides.pdf · Constrained Topological Sorting • Fix an alphabet: e.g., = fa;bg

Image Credits

Super-Dupont (slide 14) : Oui nide iou, Superdupont, Lob & Gotlib,drawn by Neal Adams, Alexis, Al Coutelis, Daniel Goossens, Solé,Gotlib. Fair use.