algorithms for lattice transforms and

111
Algorithms for Lattice Transforms and Lattice Transforms for Algorithms Thore Husfeldt Lund University and IT University of Copenhagen 2 3 23 24 39 234 239 248 2348 2349

Upload: others

Post on 11-Sep-2021

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Algorithms for Lattice Transforms and

Algorithms for Lattice Transforms andLattice Transforms for

Algorithms Thore Husfeldt

Lund University and IT University of Copenhagen2

3

23 24 39

234239248

23482349

Page 2: Algorithms for Lattice Transforms and

This Talk in 60 Seconds

x1

x2

x4

x3

y1

y2

y3

y4

In Out “Prefix sum”

y

i

= Âji

x

j

Page 3: Algorithms for Lattice Transforms and

This Talk in 60 Seconds

5

32

4

1

5

32+5=

37

32+5+1=

38

32+5+1+4=

42

In Out “Prefix sum”

y

i

= Âji

x

j

Time: Quadratic

Page 4: Algorithms for Lattice Transforms and

This Talk in 60 Seconds

5

32

4

1

5

32+5=

37

32+5+1=

38

32+5+1+4=

42

In Out “Prefix sum”

y

i

= Âji

x

j

5

32+5=

37

37+1=

38

38+4=

42

Out

Time: Quadratic

But: can do better

Page 5: Algorithms for Lattice Transforms and

In This Talk

Nice combinatoricsNice algebra

Recent developments in algorithms for NP-hard problems

Our SODA result from last week

Fast Algorithms for computing the zeta transform on various lattices

with applications

Page 6: Algorithms for Lattice Transforms and

Collaborators

Andreas Björklund (Lund), Petteri Kaski (Helsinki),Mikko Koivisto (Helsinki), Jesper Nederlof (Bergen),Pekka Parviainen (Helsinki)

Page 7: Algorithms for Lattice Transforms and

Lattices & Partial Orders

Circuits

Zeta TransformYates’s Algorithm

Möbius InversionGraph colouring

Page 8: Algorithms for Lattice Transforms and

What?Why?How?

Page 9: Algorithms for Lattice Transforms and

Partial Orders & Lattices

Page 10: Algorithms for Lattice Transforms and

Partial Orders & Lattices

ordered by size

1

2

3

Page 11: Algorithms for Lattice Transforms and

Partial Orders & Lattices

ordered by size

1

2

3

1

2

3

ordered by divisibility

Page 12: Algorithms for Lattice Transforms and

Partial Orders & Lattices

ordered by size

1

2

3

1

2

3

ordered by divisibility

1

2

3

6

1

2

3

12

18

36

1

2

3

4

6

8

9

12

18

24

36

72

Page 13: Algorithms for Lattice Transforms and

Partial Orders & Lattices

ordered by size

1

2

3

1

2

3

ordered by divisibility

1

2

3

6

1

2

3

12

18

36

1

2

3

4

6

8

9

12

18

24

36

72

1

23

1

23

6

1

2 3

12 18

36

9 6 4

8

1

3 2

1218

36 24

72

Page 14: Algorithms for Lattice Transforms and

Partial Orders & Lattices

ordered by size

1

2

3

1

2

3

ordered by divisibility

1

2

3

6

1

2

3

12

18

36

1

2

3

4

6

8

9

12

18

24

36

72

1

23

1

23

6

1

2 3

12 18

36

9 6 4

8

1

3 2

1218

36 24

72join of 2 and 3

Page 15: Algorithms for Lattice Transforms and

Partial Orders & Lattices

ordered by size

1

2

3

1

2

3

ordered by divisibility

1

2

3

6

1

2

3

12

18

36

1

2

3

4

6

8

9

12

18

24

36

72

1

23

1

23

6

1

2 3

12 18

36

9 6 4

8

1

3 2

1218

36 24

72join of 2 and 3

lattice

Page 16: Algorithms for Lattice Transforms and

Partial Orders & Lattices

ordered by size

1

2

3

1

2

3

ordered by divisibility

1

2

3

6

1

2

3

12

18

36

1

2

3

4

6

8

9

12

18

24

36

72

1

23

1

23

6

1

2 3

12 18

36

9 6 4

8

1

3 2

1218

36 24

72join of 2 and 3

latticezero

join-irreducible

Page 17: Algorithms for Lattice Transforms and

Zeta Transform

f: L → Rf z(x) = Â

yx

f (y)

Page 18: Algorithms for Lattice Transforms and

Zeta Transform

f: L → Rf z(x) = Â

yx

f (y)

4

3

4

7

Page 19: Algorithms for Lattice Transforms and

Zeta Transform

f: L → Rf z(x) = Â

yx

f (y)

4

3

4

7

4

3

16

4

14

510

Page 20: Algorithms for Lattice Transforms and

Zeta Transform (linear algebra view)

f: L → Rf z(x) = Â

yx

f (y)

4

3

16

4

14

510

f =

2

664

3614

3

775

Page 21: Algorithms for Lattice Transforms and

Zeta Transform (linear algebra view)

f: L → Rf z(x) = Â

yx

f (y)

4

3

16

4

14

510

f =

2

664

3614

3

775 z =

2

664

1 1 1 10 1 0 10 0 1 10 0 0 1

3

775

Page 22: Algorithms for Lattice Transforms and

Zeta Transform (linear algebra view)

f: L → Rf z(x) = Â

yx

f (y)

4

3

16

4

14

510

f =

2

664

3614

3

775 z =

2

664

1 1 1 10 1 0 10 0 1 10 0 0 1

3

775

Note: zeta transform has inverse, called the Möbius transform

Page 23: Algorithms for Lattice Transforms and

Zeta Transform (categoric view)

f: L → Rf z(x) = Â

yx

f (y)

4

3

16

4

14

510

2 FREL : L ! Linduces a map

Partial order on finite sets (here, a lattice)

RL ! RL

Page 24: Algorithms for Lattice Transforms and

Zeta Transform (categoric view)

f: L → Rf z(x) = Â

yx

f (y)

4

3

16

4

14

510

2 FREL : L ! Linduces a map

Partial order on finite sets (here, a lattice)

RL ! RL

S

T

RS

RT

Page 25: Algorithms for Lattice Transforms and

for i ∈ {1,…,N}g(i) = 0for j ∈ {1,…,N}

if j ≤ i: g(i) = g(i) + f(j)

Page 26: Algorithms for Lattice Transforms and

for i ∈ {1,…,N}g(i) = 0for j ∈ {1,…,N}

if j ≤ i: g(i) = g(i) + f(j)

4 132 5

0 5 37 38 42 0 5 37 38 38 38 38 38 0 5 37 37 37 37 37 37 37 37 370 5 5 5 5 5 5 5 5 5 5 5 5

f g

Page 27: Algorithms for Lattice Transforms and

for i ∈ {1,…,N}g(i) = 0for j ∈ {1,…,N}

if j ≤ i: g(i) = g(i) + f(j)

4 132 5

0 5 37 38 42 0 5 37 38 38 38 38 38 0 5 37 37 37 37 37 37 37 37 370 5 5 5 5 5 5 5 5 5 5 5 5

f g

Page 28: Algorithms for Lattice Transforms and

time = # steps = # gates

f fζ

?

Page 29: Algorithms for Lattice Transforms and

time = # steps = # gates

f fζ

?

v2 gates

Page 30: Algorithms for Lattice Transforms and

time = # steps = # gates

f fζ

?

v2 gates v gates

Page 31: Algorithms for Lattice Transforms and

Which lattices allow optimal circuits for the

zeta transform?

Page 32: Algorithms for Lattice Transforms and

What?Why?How?

Page 33: Algorithms for Lattice Transforms and

Yates’s Algorithm

[Frank Yates, The Design and analysis of factorial experiments, Imperial Bureau of Soil Science Tech. Comm. 35, 1937.]

“The Fast Zeta Transform”, FZT

Page 34: Algorithms for Lattice Transforms and
Page 35: Algorithms for Lattice Transforms and

The subset lattice

{}

{2}{1}

{1,2}

Page 36: Algorithms for Lattice Transforms and

The subset lattice

{}

{2}{1}

{1,2}

Page 37: Algorithms for Lattice Transforms and

Circuits for Zeta Transform

f: L → R

f z(x) = Âyx

f (y) 4

3

16

4

14

510

Page 38: Algorithms for Lattice Transforms and

Circuits for Zeta Transform

f: L → R

f z(x) = Âyx

f (y) 4

3

16

4

14

510

Page 39: Algorithms for Lattice Transforms and

Circuits for Zeta Transform

f: L → R

f z(x) = Âyx

f (y) 4

3

16

4

14

510

Page 40: Algorithms for Lattice Transforms and

1 1 1

0

00 0

0

0 1 1

0 0 0

0

1

Page 41: Algorithms for Lattice Transforms and

1 1 1

0

11 0

0

1 1 1

1 1 0

0

11 1 1

0

00 0

0

0 1 1

0 0 0

0

1

Page 42: Algorithms for Lattice Transforms and

1 1 1

0

11 0

0

1 1 1

1 1 0

0

11 1 1

0

00 0

0

0 1 1

0 0 0

0

1

1 1 1

0

12 1

1

1 2 1

2 1 1

1

1

Page 43: Algorithms for Lattice Transforms and

1 1 1

0

11 0

0

1 1 1

1 1 0

0

11 1 1

0

00 0

0

0 1 1

0 0 0

0

1

1 1 1

0

12 1

1

1 2 1

2 1 1

1

11 1 1

0

22 2

3

1 2 2

2 2 3

3

1

Page 44: Algorithms for Lattice Transforms and

1 1 1

0

11 0

0

1 1 1

1 1 0

0

11 1 1

0

00 0

0

0 1 1

0 0 0

0

1

1 1 1

0

12 1

1

1 2 1

2 1 1

1

11 1 1

0

22 2

3

1 2 2

2 2 3

3

11 1 1

0

22 2

3

Page 45: Algorithms for Lattice Transforms and

1 1 1

0

11 0

0

1 1 1

1 1 0

0

11 1 1

0

00 0

0

0 1 1

0 0 0

0

1

1 1 1

0

12 1

1

1 2 1

2 1 1

1

11 1 1

0

22 2

3

1 2 2

2 2 3

3

1

1 1 1

0

22 2

3

Page 46: Algorithms for Lattice Transforms and

1 1 1

0

11 0

0

1 1 1

1 1 0

0

11 1 1

0

00 0

0

0 1 1

0 0 0

0

1

1 1 1

0

12 1

1

1 2 1

2 1 1

1

11 1 1

0

22 2

3

1 2 2

2 2 3

3

1

Page 47: Algorithms for Lattice Transforms and

1 1 1

0

11 0

0

1 1 1

1 1 0

0

11 1 1

0

00 0

0

0 1 1

0 0 0

0

1

1 1 1

0

12 1

1

1 2 1

2 1 1

1

11 1 1

0

22 2

3

1 2 2

2 2 3

3

1

1 1 1

0

22 2

3

2 3 3

4 4 5

6

1

Page 48: Algorithms for Lattice Transforms and

1 1 1

0

11 0

0

1 1 1

1 1 0

0

11 1 1

0

00 0

0

0 1 1

0 0 0

0

1

1 1 1

0

12 1

1

1 2 1

2 1 1

1

11 1 1

0

22 2

3

1 2 2

2 2 3

3

1

1 1 1

0

22 2

3

2 3 3

4 4 5

6

1

Page 49: Algorithms for Lattice Transforms and

Fast Zeta Transform

AB

C

DG

0

1 1 1 1

0 0 0 0 1

BD

1 CD

0 0 0 0

0g0 = f

0

1 1 1 1

1 1 0 1 1 1

0 1 1 0

0g1

0

1 1 1 1

2 1 1 1 2 1

1 2 1 1

1g2

0

1 1 1 1

2 2 2 1 2 2

3 2 2 3

3g3

0

1 1 1 1

2 2 2 2 3 3

3 4 4 5

6g = g4

Fig. 7. Yates’s algorithm on the indicator function of the nonempty independent sets ofthe graph G. Arrows indicate how the value of gi(S) for i ⇤ S is computed by addinggi�1(S \ {i}) to the ‘previous’ value gi�1(S).

In particular, gn(S) = �R⇥S f (R). Correctness of (14) is established by a straight-forward but tedious induction argument for (15). The base case g0 = f is im-mediate. For the inductive step, adopt the notation S(i) for S ⌅ {i + 1, . . . , n}.Then the right hand side of (15) can be written as

�R⇥S

[S(i) = R(i)] f (R)

= �R⇥Si⇤R

[S(i) = R(i)] f (R) + �R⇥Si/⇤R

[S(i) = R(i)] f (R) .

If i /⇤ S then the first sum vanishes and the second sum simplifies to

�R⇥S

[S(i� 1) = R(i� 1)] f (R) = gi�1(S)

by induction. If i ⇤ S then we can rewrite both sums to

�R⇥S

[S(i� 1) = R(i� 1)] f (R) + �R⇥Si/⇤S

[S(i� 1) = R(i� 1)] f (R)

= gi�1(S) + gi�1(S \ {i})

by induction. Finally, by (14) the entire expression equals gi(S). �

Perspective. As before, our approach is basically dynamic programming for adecrease-and-conquer recurrence. The time and space requirements are within

Page 50: Algorithms for Lattice Transforms and
Page 51: Algorithms for Lattice Transforms and

time = # lines (“edges”) in Hasse diagram

e = v log v < v2

#edges#lattice points

(vertices)

Page 52: Algorithms for Lattice Transforms and

Fast Zeta Transform for v = 24

a linear factor of the ones given in §2. However, the expression (14) is moregeneral and does not depend on the structure of independent sets. It appliesto any function f : 2N ⇤ R from subsets to a ring, extending the algorithm tomany other covering problems than graph colouring.

Yates’s algorithm has much in common with the fast Fourier transform. Wecan illustrate its operation using a butterfly-like network, see Fig. 8.

?AB

ABCACBC

ABCD

ADBD

ABDCDACDBCD

ABCD

11

1

1

1

1

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

g0 g1 g2 g3 g4

0122122312343456

Fig. 8. Yates’s algorithm for the zeta transform.

Here we used Yates’s algorithm to compute (13), but the method is moregeneral than that. For example, it computes the Möbius transform, see (17) below,and many others. A classical treatment of the algorithm appears in [13], recentapplications and modifications are in [7] and the forthcoming journal versionof [3].

11 Möbius inversion. Let f : 2N ⇤ {0, 1} be a function of subsets of N to{0, 1} (indeed, any ring would do). To connect to the graph colouring examplefrom §2, think of f as the indicator function of the nonempty independent setsin a graph. The zeta transform of f is the function ( f ⇥) : 2N ⇤ {0, 1} definedpoint-wise by

( f ⇥)(T) = �S⇥T

f (S) . (16)

The brackets around ( f ⇥) are usually omitted. The Möbius transform of f is thefunction ( f µ) : 2N ⇤ {0, 1} defined point-wise by

( f µ)(T) = �S⇥T

(�1)|T\S| f (S), (17)

Page 53: Algorithms for Lattice Transforms and

What?

How?Why?

Page 54: Algorithms for Lattice Transforms and

Subset lattice in time O(v⋅log v) [Yates]

What we know

v = |L| = # vertices in Hasse diagram

e = # “edges” in Hasse diagram

Every lattice in time O(v2) [Brute force]Most lattices not in time o(v3/2/log v) [Count]

Subset lattice in time O(e) [Yates]No lattice in time o(e) [Kennes]

Page 55: Algorithms for Lattice Transforms and

Most lattices for the zeta transform need

v3/2/log v gates

Page 56: Algorithms for Lattice Transforms and

There are exp(Θ(v3/2)) lattices on v points

1

0

(v/2)–1 “atoms”

(v/2)–1 “hyperatoms”

Page 57: Algorithms for Lattice Transforms and

There are exp(Θ(v3/2)) lattices on v points

1

0

(v/2)–1 “atoms”

(v/2)–1 “hyperatoms”

possible edges2Q(v2)

Page 58: Algorithms for Lattice Transforms and

There are exp(Θ(v3/2)) lattices on v points

1

0

(v/2)–1 “atoms”

(v/2)–1 “hyperatoms”

possible edges2Q(v2)

Doesn’t quite work (not a lattice, isomorphisms,…), but OK with more care.

[Klotz und Lucht, Endliche Verbände, J. Reine Angew. Math., 247:58–68, 1971]

Page 59: Algorithms for Lattice Transforms and

There are exp(O(s log s)) circuits on s gates

gate input 1 input 2

1 v1 v22 v3 v4

3 v5 v6

4 v7 v8

5 g1 g2

6 v2 v4

7 g3 g4

8 v6 v8

9 g5 g7

10 g6 g8

11 g2 g4

12 v4 v8

output

g9g10

g11

g12

g7

g8

g4

v8

O(log s) bits

Page 60: Algorithms for Lattice Transforms and

There are exp(O(s log s)) circuits on s gates

There are exp(Θ(v3/2)) lattices on v points

Thus, most lattices need exp(Θ(v3/2/log v)) gates

Page 61: Algorithms for Lattice Transforms and

Monotone circuits for the zeta transform need

O(e) gates

Page 62: Algorithms for Lattice Transforms and
Page 63: Algorithms for Lattice Transforms and
Page 64: Algorithms for Lattice Transforms and

f z(x) = Âyx

f (y)

Page 65: Algorithms for Lattice Transforms and

Need to argue: some gate handles this contribution only.

f z(x) = Âyx

f (y)

Page 66: Algorithms for Lattice Transforms and

Need to argue: some gate handles this contribution only.

f z(x) = Âyx

f (y)

[Kennes, Computational aspects of the Möbius transform of graphs, IEEE Transactions on Systems, Man and Cybernetics, 22(2):201–223, 1992.]

Page 67: Algorithms for Lattice Transforms and

Subset lattice in time O(v⋅log v) [Yates]

What we know

v = |L| = # vertices in Hasse diagram

e = # “edges” in Hasse diagram

Every lattice in time O(v2) [Brute force]Most lattices not in time o(v3/2/log v) [Count]

Subset lattice in time O(e) [Yates]No lattice in time o(e) [Kennes]

Page 68: Algorithms for Lattice Transforms and

What?

No, really: Why?How?

Why?

Page 69: Algorithms for Lattice Transforms and

Invitation to Algorithmic Uses ofInclusion–Exclusion

Thore Husfeldt

IT University of Copenhagen, DenmarkLund University, Sweden

Abstract. I give an introduction to algorithmic uses of the principle ofinclusion–exclusion. The presentation is intended to be be concrete andaccessible, at the expense of generality and comprehensiveness.

R

T1 The principle of inclusion–exclusion. There are asmany odd-sized as even-sized subsets sandwiched be-tween two different sets: For R ⇤ T,

�R⇤S⇤T

(�1)|T\S| = [R = T] . (1)

We use Iverson notation [P] for proposition P, mean-ing [P] = 1 if P and [P] = 0 otherwise.

Proof of (1). If R = T then there is exactly one sandwiched set, namely S = T.Otherwise we set up a bijection between the odd- and even-sized subsets asfollows. Fix t ⌅ T \ R. For every odd-sized subset S1 with R ⇤ S1 ⇤ T letS0 = S1 ⇥ {t} denote the symmetric difference of S1 with {t}. Note that thesize of S0 is even and that S0 contains R. Furthermore, S1 can be recovered fromS0 as S1 = S0 ⇥ {t}. ⌦

Perspective. We will see the (perhaps more familiar) formulation of the principleof inclusion–exclusion in terms of intersecting sets in §6, and another equivalentformulation in §11.

AB

C

D

I1

I2

I32 Graph colouring. A k-colouring of a graph G = (N, E) onn = |N| nodes assigns one of k colours to every node such thatneighbouring nodes have different colours. In any such colour-ing, the nodes of the same colour form a nonempty independentset, a set of nodes none of which are neighbours.

Let g(S) denote the number of nonempty independent sub-sets in S ⇤ N. Then G can be k-coloured if and only if

�S⇤N

(�1)n�|S|�g(S)⇥k

> 0 . (2)

Base revision d124530. . ., Tue Jul 5 09:02:55 2011 +0200, Thore Husfeldt.

Graph Colouring

# colourings =# covers with independent sets

artistic freedom; should say “partitions”

Page 70: Algorithms for Lattice Transforms and

0

1 1 1 1

0 0 0 0 1 1

0 0 0 0

0f

0

1 1 1 1

2 2 2 2 3 3

3 4 4 5

6f ⇥

0

1 1 1 1

4 4 4 4 9 9

9 16 16 25

36( f ⇥)2

0

1 1 1 1

8 8 8 8 27 27

27 64 64 125

216( f ⇥)3

0

1 1 1 1

2 2 2 2 7 7

0 2 2 6

0( f ⇥)2µ

0

1 1 1 1

6 6 6 6 25 25

6 24 24 66

18( f ⇥)3µ

µ

µ

x ⌅⇤ x2

x ⌅⇤ x3

Fig. 10. Covering by Möbius inversion for k = 2 and k = 3.

To see this, for every T ⇥ V, view g⇥(T) and�

f ⇥(T)⇥k as two different ways of

counting the number of ways so select k nonempty independent subsets of T.Now, by Möbius inversion (18), we have

g = ( f ⇥)kµ ,

which is the left hand side of (2). In fact, we can now rewrite and understandthe left hand side of (2) as

�S⇥N

(�1)|N\S|⇤

�R⇥S

f (R)⌅ k

µ ⇥

function in the original domainoperation in the transformed domain

Invitation to Algorithmic Uses ofInclusion–Exclusion

Thore Husfeldt

IT University of Copenhagen, DenmarkLund University, Sweden

Abstract. I give an introduction to algorithmic uses of the principle ofinclusion–exclusion. The presentation is intended to be be concrete andaccessible, at the expense of generality and comprehensiveness.

R

T1 The principle of inclusion–exclusion. There are asmany odd-sized as even-sized subsets sandwiched be-tween two different sets: For R ⇤ T,

�R⇤S⇤T

(�1)|T\S| = [R = T] . (1)

We use Iverson notation [P] for proposition P, mean-ing [P] = 1 if P and [P] = 0 otherwise.

Proof of (1). If R = T then there is exactly one sandwiched set, namely S = T.Otherwise we set up a bijection between the odd- and even-sized subsets asfollows. Fix t ⌅ T \ R. For every odd-sized subset S1 with R ⇤ S1 ⇤ T letS0 = S1 ⇥ {t} denote the symmetric difference of S1 with {t}. Note that thesize of S0 is even and that S0 contains R. Furthermore, S1 can be recovered fromS0 as S1 = S0 ⇥ {t}. ⌦

Perspective. We will see the (perhaps more familiar) formulation of the principleof inclusion–exclusion in terms of intersecting sets in §6, and another equivalentformulation in §11.

AB

C

D

I1

I2

I32 Graph colouring. A k-colouring of a graph G = (N, E) onn = |N| nodes assigns one of k colours to every node such thatneighbouring nodes have different colours. In any such colour-ing, the nodes of the same colour form a nonempty independentset, a set of nodes none of which are neighbours.

Let g(S) denote the number of nonempty independent sub-sets in S ⇤ N. Then G can be k-coloured if and only if

�S⇤N

(�1)n�|S|�g(S)⇥k

> 0 . (2)

Base revision d124530. . ., Tue Jul 5 09:02:55 2011 +0200, Thore Husfeldt.

Graph 3-Colouring

g

Page 71: Algorithms for Lattice Transforms and

0

1 1 1 1

0 0 0 0 1 1

0 0 0 0

0f

0

1 1 1 1

2 2 2 2 3 3

3 4 4 5

6f ⇥

0

1 1 1 1

4 4 4 4 9 9

9 16 16 25

36( f ⇥)2

0

1 1 1 1

8 8 8 8 27 27

27 64 64 125

216( f ⇥)3

0

1 1 1 1

2 2 2 2 7 7

0 2 2 6

0( f ⇥)2µ

0

1 1 1 1

6 6 6 6 25 25

6 24 24 66

18( f ⇥)3µ

µ

µ

x ⌅⇤ x2

x ⌅⇤ x3

Fig. 10. Covering by Möbius inversion for k = 2 and k = 3.

To see this, for every T ⇥ V, view g⇥(T) and�

f ⇥(T)⇥k as two different ways of

counting the number of ways so select k nonempty independent subsets of T.Now, by Möbius inversion (18), we have

g = ( f ⇥)kµ ,

which is the left hand side of (2). In fact, we can now rewrite and understandthe left hand side of (2) as

�S⇥N

(�1)|N\S|⇤

�R⇥S

f (R)⌅ k

µ ⇥

function in the original domainoperation in the transformed domain

Invitation to Algorithmic Uses ofInclusion–Exclusion

Thore Husfeldt

IT University of Copenhagen, DenmarkLund University, Sweden

Abstract. I give an introduction to algorithmic uses of the principle ofinclusion–exclusion. The presentation is intended to be be concrete andaccessible, at the expense of generality and comprehensiveness.

R

T1 The principle of inclusion–exclusion. There are asmany odd-sized as even-sized subsets sandwiched be-tween two different sets: For R ⇤ T,

�R⇤S⇤T

(�1)|T\S| = [R = T] . (1)

We use Iverson notation [P] for proposition P, mean-ing [P] = 1 if P and [P] = 0 otherwise.

Proof of (1). If R = T then there is exactly one sandwiched set, namely S = T.Otherwise we set up a bijection between the odd- and even-sized subsets asfollows. Fix t ⌅ T \ R. For every odd-sized subset S1 with R ⇤ S1 ⇤ T letS0 = S1 ⇥ {t} denote the symmetric difference of S1 with {t}. Note that thesize of S0 is even and that S0 contains R. Furthermore, S1 can be recovered fromS0 as S1 = S0 ⇥ {t}. ⌦

Perspective. We will see the (perhaps more familiar) formulation of the principleof inclusion–exclusion in terms of intersecting sets in §6, and another equivalentformulation in §11.

AB

C

D

I1

I2

I32 Graph colouring. A k-colouring of a graph G = (N, E) onn = |N| nodes assigns one of k colours to every node such thatneighbouring nodes have different colours. In any such colour-ing, the nodes of the same colour form a nonempty independentset, a set of nodes none of which are neighbours.

Let g(S) denote the number of nonempty independent sub-sets in S ⇤ N. Then G can be k-coloured if and only if

�S⇤N

(�1)n�|S|�g(S)⇥k

> 0 . (2)

Base revision d124530. . ., Tue Jul 5 09:02:55 2011 +0200, Thore Husfeldt.

Graph 3-Colouring

f(S) = 1 iff S is independent

g(S) = # triplets of independent subsets

covering S

g

Page 72: Algorithms for Lattice Transforms and

0

1 1 1 1

0 0 0 0 1 1

0 0 0 0

0f

0

1 1 1 1

2 2 2 2 3 3

3 4 4 5

6f ⇥

0

1 1 1 1

4 4 4 4 9 9

9 16 16 25

36( f ⇥)2

0

1 1 1 1

8 8 8 8 27 27

27 64 64 125

216( f ⇥)3

0

1 1 1 1

2 2 2 2 7 7

0 2 2 6

0( f ⇥)2µ

0

1 1 1 1

6 6 6 6 25 25

6 24 24 66

18( f ⇥)3µ

µ

µ

x ⌅⇤ x2

x ⌅⇤ x3

Fig. 10. Covering by Möbius inversion for k = 2 and k = 3.

To see this, for every T ⇥ V, view g⇥(T) and�

f ⇥(T)⇥k as two different ways of

counting the number of ways so select k nonempty independent subsets of T.Now, by Möbius inversion (18), we have

g = ( f ⇥)kµ ,

which is the left hand side of (2). In fact, we can now rewrite and understandthe left hand side of (2) as

�S⇥N

(�1)|N\S|⇤

�R⇥S

f (R)⌅ k

µ ⇥

function in the original domainoperation in the transformed domain

Invitation to Algorithmic Uses ofInclusion–Exclusion

Thore Husfeldt

IT University of Copenhagen, DenmarkLund University, Sweden

Abstract. I give an introduction to algorithmic uses of the principle ofinclusion–exclusion. The presentation is intended to be be concrete andaccessible, at the expense of generality and comprehensiveness.

R

T1 The principle of inclusion–exclusion. There are asmany odd-sized as even-sized subsets sandwiched be-tween two different sets: For R ⇤ T,

�R⇤S⇤T

(�1)|T\S| = [R = T] . (1)

We use Iverson notation [P] for proposition P, mean-ing [P] = 1 if P and [P] = 0 otherwise.

Proof of (1). If R = T then there is exactly one sandwiched set, namely S = T.Otherwise we set up a bijection between the odd- and even-sized subsets asfollows. Fix t ⌅ T \ R. For every odd-sized subset S1 with R ⇤ S1 ⇤ T letS0 = S1 ⇥ {t} denote the symmetric difference of S1 with {t}. Note that thesize of S0 is even and that S0 contains R. Furthermore, S1 can be recovered fromS0 as S1 = S0 ⇥ {t}. ⌦

Perspective. We will see the (perhaps more familiar) formulation of the principleof inclusion–exclusion in terms of intersecting sets in §6, and another equivalentformulation in §11.

AB

C

D

I1

I2

I32 Graph colouring. A k-colouring of a graph G = (N, E) onn = |N| nodes assigns one of k colours to every node such thatneighbouring nodes have different colours. In any such colour-ing, the nodes of the same colour form a nonempty independentset, a set of nodes none of which are neighbours.

Let g(S) denote the number of nonempty independent sub-sets in S ⇤ N. Then G can be k-coloured if and only if

�S⇤N

(�1)n�|S|�g(S)⇥k

> 0 . (2)

Base revision d124530. . ., Tue Jul 5 09:02:55 2011 +0200, Thore Husfeldt.

Graph 3-Colouring

f(S) = 1 iff S is independent

g(S) = # triplets of independent subsets

covering S

g

f z

gz

Page 73: Algorithms for Lattice Transforms and

0

1 1 1 1

0 0 0 0 1 1

0 0 0 0

0f

0

1 1 1 1

2 2 2 2 3 3

3 4 4 5

6f ⇥

0

1 1 1 1

4 4 4 4 9 9

9 16 16 25

36( f ⇥)2

0

1 1 1 1

8 8 8 8 27 27

27 64 64 125

216( f ⇥)3

0

1 1 1 1

2 2 2 2 7 7

0 2 2 6

0( f ⇥)2µ

0

1 1 1 1

6 6 6 6 25 25

6 24 24 66

18( f ⇥)3µ

µ

µ

x ⌅⇤ x2

x ⌅⇤ x3

Fig. 10. Covering by Möbius inversion for k = 2 and k = 3.

To see this, for every T ⇥ V, view g⇥(T) and�

f ⇥(T)⇥k as two different ways of

counting the number of ways so select k nonempty independent subsets of T.Now, by Möbius inversion (18), we have

g = ( f ⇥)kµ ,

which is the left hand side of (2). In fact, we can now rewrite and understandthe left hand side of (2) as

�S⇥N

(�1)|N\S|⇤

�R⇥S

f (R)⌅ k

µ ⇥

function in the original domainoperation in the transformed domain

Page 74: Algorithms for Lattice Transforms and

Graph k-colouring in time O*(2|V|).Trivial algorithm: time O*(k|V|).

Page 75: Algorithms for Lattice Transforms and

[Björklund, H., Koivisto, Set partitioning via inclusion-exclusion. SIAM J. Comput., 39(2):546–563, 2009.]

Graph k-colouring in time O*(2|V|).Trivial algorithm: time O*(k|V|).

Page 76: Algorithms for Lattice Transforms and

Graph k-colouring in time O*(2|V|).Trivial algorithm: time O*(k|V|).

Exciting new trend in algorithms for hard problems

Page 77: Algorithms for Lattice Transforms and

Graph k-colouring in time O*(2|V|).Trivial algorithm: time O*(k|V|).

Exciting new trend in algorithms for hard problems

Theory of NP-hardness

1960 1980 2000

Page 78: Algorithms for Lattice Transforms and

Graph k-colouring in time O*(2|V|).Trivial algorithm: time O*(k|V|).

Exciting new trend in algorithms for hard problems

Theory of NP-hardness

1960 1980 2000

Let’s give up

Page 79: Algorithms for Lattice Transforms and

Graph k-colouring in time O*(2|V|).Trivial algorithm: time O*(k|V|).

Exciting new trend in algorithms for hard problems

Theory of NP-hardness

1960 1980 2000

Let’s give up Approximation algorithms

Let’s find the wrong answer real

fast!

Page 80: Algorithms for Lattice Transforms and

Graph k-colouring in time O*(2|V|).Trivial algorithm: time O*(k|V|).

Exciting new trend in algorithms for hard problems

Theory of NP-hardness

1960 1980 2000

Let’s give up Approximation algorithms

Let’s find the wrong answer real

fast!Exponential time (exact) algorithms

Let’s find the right answer faster.

Page 81: Algorithms for Lattice Transforms and

Graph k-colouring in time O*(2|V|).Trivial algorithm: time O*(k|V|).

Exciting new trend in algorithms for hard problems

Theory of NP-hardness

1960 1980 2000

Let’s give up Approximation algorithms

Let’s find the wrong answer real

fast!Exponential time (exact) algorithms

Let’s find the right answer faster.

French connection: Kratsch, Liedloff,

Thomassé, Paul, Havet, Escoffier, Paschos,…

Page 82: Algorithms for Lattice Transforms and

What?

No, really: Why?How?

Why?

Page 83: Algorithms for Lattice Transforms and

How fast can we multiply?

Page 84: Algorithms for Lattice Transforms and

Multiply polynomials

(1x0+1x1+3x2) ⋅ (1x0+2x1) = 1x0+3x1+5x2+6x3

Page 85: Algorithms for Lattice Transforms and

Multiply polynomials

(1x0+1x1+3x2) ⋅ (1x0+2x1) = 1x0+3x1+5x2+6x3

elements in semigroup S (monomials)

mapping f from S to some field K

multiplication on S

Page 86: Algorithms for Lattice Transforms and

Multiplication in semigroups

(1x0+1x1+3x2) ⋅ (1x0+2x1) = 1x0+3x1+5x2+6x3

( f _ g)(c) = Âa,b2L : a_b=c

f (a)g(b)

For lattices: join product

Page 87: Algorithms for Lattice Transforms and

semigroup S monomial lattice point

field K of scalars coefficient f,g: S → K

product in the semigroup

algebra

multiplication of polynomials join product

Algebraic view

Page 88: Algorithms for Lattice Transforms and

Fourier meets Möbius

p

q

F(p)

F(q)

˙ F�1polynomial

multiplication

join productf

g

_ µ

Page 89: Algorithms for Lattice Transforms and
Page 90: Algorithms for Lattice Transforms and

Zeta circuits for lattices with

n nonzero irreducibles of size O(vn)

C’EST FRAIS!

Page 91: Algorithms for Lattice Transforms and

Zeta circuits for lattices with

n nonzero irreducibles of size O(vn)

[Björklund, H. Kaski, Koivisto, Nederlof, Parviainen, SODA, last week]

C’EST FRAIS!

Page 92: Algorithms for Lattice Transforms and

What?Why?How?

Page 93: Algorithms for Lattice Transforms and

9 6 4

8

1

3 2

1218

36 24

72

5 nonzero irreducibles

Divisors of 72

“6” is reducible (join of 2 and 3)

Page 94: Algorithms for Lattice Transforms and

9 6 4

8

1

3 2

1218

36 24

72

prime powers

Page 95: Algorithms for Lattice Transforms and

9 6 4

8

1

3 2

1218

36 24

72

prime powers ground set A

vn = e = 2|A||A|

Page 96: Algorithms for Lattice Transforms and

9 6 4

8

1

3 2

1218

36 24

72

prime powers ground set A

vn = e = 2|A||A|

Also works optimally forsublattices of the subset lattice that are

downward closedintersection closedunion closed

Page 97: Algorithms for Lattice Transforms and

9 6 4

8

1

3 2

1218

36 24

72

prime powers ground set A

vn = e = 2|A||A|

Also works optimally forsublattices of the subset lattice that are

downward closedintersection closedunion closed

e = Q(v)

Page 98: Algorithms for Lattice Transforms and

What?Why?How?

Page 99: Algorithms for Lattice Transforms and

9 6 4

8

1

3 2

1218

36 24

72

The Spectrum Map

Page 100: Algorithms for Lattice Transforms and

9 6 4

8

1

3 2

1218

36 24

72

{3,9} {2,3} {2,4}

{2,4,8}

Ø

{3} {2}

{2,3,4}{2,3,9}

{2,3,4,9} {2,3,4,8}

{2,3,4,8,9}

The Spectrum Map

Page 101: Algorithms for Lattice Transforms and

9 6 4

8

1

3 2

1218

36 24

72

{3,9} {2,3} {2,4}

{2,4,8}

Ø

{3} {2}

{2,3,4}{2,3,9}

{2,3,4,9} {2,3,4,8}

{2,3,4,8,9}

The Spectrum Map

Page 102: Algorithms for Lattice Transforms and

9 6 4

8

1

3 2

1218

36 24

72

{3,9} {2,3} {2,4}

{2,4,8}

Ø

{3} {2}

{2,3,4}{2,3,9}

{2,3,4,9} {2,3,4,8}

{2,3,4,8,9}

The Spectrum Map

23

23 24 39

234239248

23482349

Page 103: Algorithms for Lattice Transforms and

Arbitrary finite lattice can be embedded into the subset lattice 2[n].Result is closed under intersection.

n = # nonzero, join-irreducible elements.

23

23 24 39

234239248

23482349

The Spectrum Map

9 6 4

8

1

3 2

1218

36 24

72

Page 104: Algorithms for Lattice Transforms and

23

23 24 39

234239248

23482349

What we can’t just do

Yates’s algorithm takes time 2nn.Exponential in # irreducibles

Page 105: Algorithms for Lattice Transforms and

What we do: walks

S

T

Every pair S, T of elements is connected by a unique walk

23

23 24 39

234239248

23482349

392 2393 2394 23498 23499 2349

Page 106: Algorithms for Lattice Transforms and

(Not necessarily walks in the Hasse diagram)

Ø

21

12

Ø

21

12Ø

1 {1}

2 {1,2}

Ø

1 {1}

2 {1,2}

From Ø to {1,2}

Page 107: Algorithms for Lattice Transforms and

(Not necessarily walks in the Hasse diagram)

Ø

21

12

Ø

21

12Ø

1 {1}

2 {1,2}

Ø

1 {1}

2 {1,2}

From Ø to {1,2}

For i = 1,2,…,n walk from Bi–1 to Bi using

Bi = (Bi�1 [ {i})?

Page 108: Algorithms for Lattice Transforms and

(Not necessarily walks in the Hasse diagram)

Ø

21

12

Ø

21

12Ø

1 {1}

2 {1,2}

Ø

1 {1}

2 {1,2}

From Ø to {1,2}

For i = 1,2,…,n walk from Bi–1 to Bi using

Bi = (Bi�1 [ {i})?

“bottom” above

Page 109: Algorithms for Lattice Transforms and

(Not necessarily walks in the Hasse diagram)

Ø

21

12

Ø

21

12Ø

1 {1}

2 {1,2}

Ø

1 {1}

2 {1,2}

From Ø to {1,2}

For i = 1,2,…,n walk from Bi–1 to Bi using

Bi = (Bi�1 [ {i})? A? = minB◆AB2L

B

“bottom” above

Page 110: Algorithms for Lattice Transforms and

23

23 24 39

234239248

23482349

Summary

Embed L in subset lattice using spectrum map.Define unique family of “bottom” walks.

Circuit sums over these.Time = # irreducibles ⋅ # elements = # covering pairs (Hasse edges)

Page 111: Algorithms for Lattice Transforms and

Applications of FZToutside of exponential time algorithms and

Dempster–Schafer belief propagation?

Which other semigroups allow FZTs?

Faster? Lower bounds?

Killer application beyond graph colouring?