Counting CSPs and Fixed Points of Datalog Andrei A. Bulatov, - - PowerPoint PPT Presentation

counting csps and fixed points of datalog
SMART_READER_LITE
LIVE PREVIEW

Counting CSPs and Fixed Points of Datalog Andrei A. Bulatov, - - PowerPoint PPT Presentation

Counting CSPs and Fixed Points of Datalog Andrei A. Bulatov, Victor Dalmau, Marc Thurley CanaDAM 2013, St Johns, NL 2 / 22 Constraint Satisfaction Let B be a relational structure #CSP( B ): Instance: A relational structure A of the


slide-1
SLIDE 1

Counting CSPs and Fixed Points of Datalog

Andrei A. Bulatov, Victor Dalmau, Marc Thurley

CanaDAM 2013, St John’s, NL

slide-2
SLIDE 2

2 / 22

Constraint Satisfaction

Let B be a relational structure #CSP(B): Instance: A relational structure A of the same type as B. Objective: How many homomorphisms from A to B are there?

slide-3
SLIDE 3

Counting Problems

#k-Coloring: Instance: A graph G. Objective: How many k-colorings of G are there? G

#?

K k

How many homomorphisms from G to are there?

k

K

3 / 22

slide-4
SLIDE 4

4 / 22

Examples: #SAT, Linear Equations

#3-SAT: Instance: A propositional formula in 3-CNF. Objective: How many satisfying assignments are there?

n

C C ∧ ∧ = Φ K

1

#Linear Equations: Instance: A system of linear equations Objective: How many solutions are there?      = + + = + +

n m nm n m m

b x a x a b x a x a K L K

1 1 1 1 1 11

= #CSP( )

3

C

= #CSP( F )

slide-5
SLIDE 5

5 / 22

#BIS

#Bipartite Independent Set (#BIS): Instance: A bipartite graph G. Objective: How many independent sets in G are there? G

#?

How many homomorphisms from G to are there? Hbis Hbis

slide-6
SLIDE 6

6 / 36

Approximation

Relative error: Pr[ ] ≥ 3/4 An FPRAS: given I and ε, output A(I) satisfying the inequality above in time polynomial in |I| and

) ( ) ( ) ( I Z e I A I Z e

ε ε

≤ ≤

AP-reductions – reductions that preserve approximation

slide-7
SLIDE 7

7 / 22

#BIS and Friends

#BIS is not believed to have FPRAS or be #SAT AP-interreducible Many other problems are interreducible with #BIS #Downset: Given a poset, find the number of downsets in it

Hds #CSP(H )

ds

#1p1nSAT Given a CNF such that every clause has a positive and a negative literal, find the number of satisfying assignments #BeachConfigs

#CSP(H )

bc

H

bc

slide-8
SLIDE 8

8 / 22

Boolean Approximation

Theorem (Dyer,Goldberg,Jerrum, 2007) Let A be a relational structure over {0,1}. Then

  • if every relation of A is, then #CSP(A) is solvable in

polynomial time;

  • otherwise, if every relation of A is both max- and

min-closed then #CSP(A) is as hard as #BIS;

  • otherwise it is hard.
slide-9
SLIDE 9

9 / 22

Logic for #BIS (and Others)

Fagin’s Theorem 1983: NP is the class of problem that can be described by an existential second order formula ∃T Φ(T) Saluja et al. 1995: #P is the class of problems that can be described as counting models of a second order formula |{ (T,z) : A |= Φ(T,z) }| Dyer et al. 2003: #BIS is the class of problems that are interreducible with counting models of a formula |{ (T,z) : A |= ∀y.Φ(T,y,z) }|, where Φ is a CNF such that each of its clauses contains at most one negated and one unnegated symbol from T

1

# Π RH

slide-10
SLIDE 10

10 / 22

Datalog

A Datalog program is a finite set of rules of the form ) ( , ), ( : ) (

1 1 r r y

S y S x T K − relational symbols head body Let H = (V,E) be a graph ) , ( ), , ( : ) , ( ) , ( : ) , ( y z T z x E y x T y x E y x T − − A Datalog program is linear if each rule contains at most one auxiliary predicate in the body

slide-11
SLIDE 11

11 / 22

Fixed Points

#FixedPoints(P): Given an instance A of Datalog program P, find the number of fixed points of P on A A fixed point of a Datalog program is a value of T(x,y) such that all the rules are satisfied

slide-12
SLIDE 12

12 / 22

Example

T(x) :- T(y), y → x Fact of the program on A is expression T(a), a ∈ A Fixed point S is a set of facts such that if T(b) ∈ S and b → a then T(a) ∈ S The set of facts can be represented as a digraph

T(b) T(a)

G(P,A)

slide-13
SLIDE 13

13 / 22

Example (cntd)

Every fixed point of P is a downset in the digraph Therefore #FixedPoints(P) and #Downset are AP- interreducible

T(b) T(a)

slide-14
SLIDE 14

14 / 22

#FixedPoints vs. #BIS

Theorem (Dyer et al.; 2003) A problem is reducible to #BIS if and only if it is AP-interreducible with #FixedPoints(P) for some linear Datalog program P. Proof (idea): Construct a digraph as above. Only there will be lot more

  • facts. However, still polynomially many.
slide-15
SLIDE 15

15 / 22

Question

Question What structures B satisfy the condition that #CSP(B) is expressible by a linear Datalog program? In the example above the reduction between #CSP and #FixedPoint(P) is trivial: it does not change input structure If for a program P and structure B it is the case for #CSP(B) and #FixedPoints(P), we say that #CSP(B) is expressible by P.

slide-16
SLIDE 16

16 / 22

Simpler Datalog

Theorem 1 If #CSP(B) is expressible by a linear Datalog program then it is expressible by a monadic linear Datalog program. Datalog program is monadic if every its IDB is unary.

slide-17
SLIDE 17

Facts are called independent if there is no path from to in G(P,A) for any i ≠ j. Observation: If G(P,A) contains m independent facts then P has at least fixed points Consider instance consisting of n isolated points Since the number of fixed points equals hom( ,B), there are of them

17 / 22

Simpler Datalog: Proof

n

A

m

F F , ,

1 K i

F

j

F

n

A

m

2

n

| |B

slide-18
SLIDE 18

18 / 22

Simpler Datalog: Proof (cntd)

Lemma. Suppose P has an `essentially’ binary IDB. Then G(P, ) contains at least independent facts QED

n

A

      2 n

slide-19
SLIDE 19

19 / 22

Structures with Equality

Theorem 2 #CSP(B), B is a structure with equality, is expressible by a linear Datalog program, if and only if B has binary encoding that is max- and min-closed A relational structure A contains equality if there is a binary symbol = in the signature of A such that is the equality relation

A

=

slide-20
SLIDE 20

20 / 22

Construction

Suppose #CSP(B) is expressible by a linear Datalog program P and B is a structure with equality. P is assumed monadic We

  • construct a structure C using P
  • show that C is has a right encoding
  • show that C is isomorphic to B
slide-21
SLIDE 21

21 / 22

Construction (cntd)

  • The universe of C is the set of fixed points of P on

Thus, the universe of C is a collection of subsets of the set

  • f IDBs of P
  • For every relational symbol R the relation is the set of

fixed points of P on structure .

  • If R is k-ary, structure contains k elements

and contains only one tuple all other relations empty. A fixed point of P on is a set of facts and the set facts for each is a member of C Therefore every fixed point of P on is a k-tuple of elements of C

1

A

R

A

R

A

R

A

k

a a , ,

1 K

R

RA

) , , ( 1

k

a a K

C

R ) ( i a I

i

a

R

A

slide-22
SLIDE 22

22 / 22

Construction: Properties

  • |C| = |B|
  • For any R,
  • C is invariant under ∪, ∩, and also under 0-ary operation

1 that returns the set all fixed points Key Lemma: There is an injective homomorphism from B to C Then by the properties above it must be an isomorphism

| | | |

B C

R R =

slide-23
SLIDE 23

23 / 22

Structures without Equality

Nothing is clear There is a counterexample for the construction: a structure B a program P that expresses #CSP(B) however, the structure C constructed as above is not isomorphic to B

slide-24
SLIDE 24

Thank you!