Knowledge Compilation: power and limits

Florent Capelli

CRIL, Université d’Artois

Reasoning Web Summer School

28 August 2026

Part 0
Knowledge Compilation: an introduction

In a nutshell

Representing Boolean functions f:{0,1}X{0,1}f : \{0,1\}^X \rightarrow \{0,1\} in a tractable way.

Given a representation of ff, can we:

  • Tractable tasks:
    • Find τ\tau st f(τ)=1f(\tau)=1.
    • Compute #f\#f, Prτ{0,1}X(f(τ)=1)Pr_{\tau \in \{0,1\}^X}(f(\tau) = 1).
    • Enumerate the models of ff
  • Tractable transformations:
    • Build a representation of ¬f\neg f
    • Build a representation of f[τ]f[\tau]
    • Build a representation of Z.f\exists Z. f for some ZXZ \subseteq X

Representation examples

f:{0,1}{x,y,z}{0,1} f : \{0,1\}^{\{x,y,z\}} \rightarrow \{0,1\}

ff is represented as a CNF formula (xy)(x¬z)(¬x¬z¬y)(x \vee y) \wedge (x \vee \neg z) \wedge (\neg x \vee \neg z \vee \neg y)

  • Succinct
  • Not tractable in general (SAT is NP-complete).

ff as a list of models:

xx yy zz f(x,y,z)f(x,y,z)
0 1 0 1
1 0 0 1
1 0 1 1
1 1 0 1
  • Not succint.
  • Very tractable.

Why Knowledge?

Old roots in the study of expert systems (MYCIN, DENDRAL…):

Simplest abstraction: facts as propositional variables, knowledge as propositional formulas.

Propositional knowledge base can be seen as a Boolean function.

Why compilation?

Natural way of encoding this “knowledge” rarely optimal for computational purposes:

Preprocess a better representation allowing more tractability.

The bike configuration example

Knowledge base, “natural representation”:




Other Representations

Set of constraints.

  • ExactlyOne(road, gravel, city)
  • ExactlyOne(21C, 25C, 32C)
  • road ⇒ (21C ∨ 25C)
  • city ⇒ ¬21C
  • electric ⇒ (city ∨ gravel)
  • electric ⇒ 32C

Set of models.

Tires Type Electric
21C road no
21C gravel yes
21C gravel no
25C road no
25C city yes
25C city no
25C gravel yes
25C gravel no
32C city yes
32C city no
32C gravel yes
32C gravel no

Diagram.

MDD TRUE TRUE FALSE FALSE tires tires t21 type tires->t21 21C t25 type tires->t25 25C t32 type tires->t32 32C t21->FALSE city t21_road electric t21->t21_road road t25_city electric t21->t25_city gravel t25->t25_city city t25->t25_city gravel t25_road electric t25->t25_road road t32->FALSE road t32->t25_city city t32->t25_city gravel t21_road->TRUE no t21_road->FALSE yes t25_city->TRUE yes t25_city->TRUE no t25_road->TRUE no t25_road->FALSE yes

Knowledge Compilation today

Despite expert systems being outfashioned, KC is still relevant:

The Menu

I. An overview of interesting representation languages for Boolean functions.

  1. How to build such representations.

  2. How to prove limits of such representations.

Part I
Basics

Representation Language

A representation language =(L,||,)\mathcal{L}= (L, |\cdot|_{\mathcal{L}},\|\cdot\|_{\mathcal{L}}) for Boolean functions:

Examples

Object Size Interpretation
Truth Table Variables XX
List of τ{0,1}X\tau \in \{0,1\}^X with bτ{0,1}b_\tau \in \{0,1\}
|X|+2|X||X|+2^{|X|} f(τ)=bτf(\tau) = b_{\tau}
List of models Set S{0,1}XS \subseteq \{0,1\}^X |X||S||X| \cdot |S| f(τ)=1f(\tau) = 1 iff τS\tau \in S
CNF Formula Set SS of sets of literals cS|c|\sum_{c \in S} |c| f(τ)=1f(\tau) = 1 iff
cS,c,τ()=1\forall c \in S,\exists \ell \in c, \tau(\ell) = 1
DNF Formula Set SS of sets of literals cS|c|\sum_{c \in S} |c| f(τ)=1f(\tau) = 1 iff
cS,c,τ()=1\exists c \in S,\forall \ell \in c, \tau(\ell) = 1
  • CNF formula (xy)(x¬z)(¬x¬y)(x \vee y) \wedge (x \vee \neg z) \wedge (\neg x \vee \neg y):
    • x1,y0,z1x \mapsto 1, y \mapsto 0, z \mapsto 1 is a model
    • x1,y1,z1x \mapsto 1, y \mapsto 1, z \mapsto 1 is not a model because clause (¬x¬y)(\neg x \vee \neg y) is not satisfied.
  • DNF formula (xy)(x¬z)(¬x¬y)(x \wedge y) \vee (x \wedge \neg z) \vee (\neg x \wedge \neg y):
    • x1,y1,z1x \mapsto 1, y \mapsto 1, z \mapsto 1 is a model
    • x1,y0,z1x \mapsto 1, y \mapsto 0, z \mapsto 1 is not a model

Tractable Queries

Query q(f,p)q(f,p) maps Boolean functions ff and (optional) parameters pp to a value.

\mathcal{L} supports query q(,)q(\cdot,\cdot) if given oLo \in L and pp, we can compute q(o,p)q(\|o\|_{\mathcal{L}}, p) in ptime in |o||o|_{\mathcal{L}}.

We also say: qq is tractable for \mathcal{L}.

Example of tractable queries

Details on board.

“Not supporting” a query is often a conditional statement (e.g. “unless P \neq NP).

Tractable Transformations

Transformation t(f,p)t(f,p) maps Boolean functions ff and (optional) parameters pp to another Boolean function.

\mathcal{L} supports transformation t(,)t(\cdot,\cdot) if given oLo \in L and pp, we can compute oLo' \in L such that o=t(o,p)\|o'\|_{\mathcal{L}} = t(\|o\|_{\mathcal{L}}, p) in ptime in |o||o|_{\mathcal{L}}.

We also say: tt is tractable for \mathcal{L}.

Example of tractable transformations

Details on board.

In many cases, we are able to show that a transformation is not supported unconditionnally.

Succinctness

\mathcal{L} is more succinct that \mathcal{L}' written <\mathcal{L}< \mathcal{L}' if there exists a polynomial pp such that:

For every LL' \in \mathcal{L}', there exists LL \in \mathcal{L} such that:

\mathcal{L} can succinctly represent everything that \mathcal{L}' can (modulo a polynomial factor).

Succinctness examples

Compilability

Early theoretical notion (Cadoli, Liberatore, Schaerf [1]): study the power of precomputation.

Simplified version:

A query q(f,p)q(f,p) is compilable if there exists a language \mathcal{L} such that:

  • For any propositional formula ϕ\phi, there exists oo \in \mathcal{L} such that
    1. o=ϕProp\|o\|_{\mathcal{L}} = \|\phi\|_{Prop} and
    2. |o|=poly(|ϕ|Prop)|o|_{\mathcal{L}} = poly(|\phi|_{Prop}).
  • qq is tractable in \mathcal{L}.

Observation / Example: if q(f)Sq(f) \in S does not have parameter, then it is compilable.

  1. Prop×S\mathcal{L}\subseteq Prop \times S.
  2. (ϕ,s)(\phi,s) \in \mathcal{L} iff q(ϕProp)=sq(\|\phi\|_{Prop}) = s.
  3. qq is tractable in \mathcal{L} and any ϕ\phi has a small representation in \mathcal{L}.

[1] Marco Cadoli, Francesco M. Donini, Paolo Liberatore, and Marco Schaerf. Preprocessing of intractable problems. Information and Computation, 176(2):89 – 120, 2002.

Compilability : bad news

Most interesting queries with parameters are not compilable (unless NP \subseteq P/poly). [1]

Candidate: q(f,τ):q(f, \tau): does ff has a model extending τ\tau?

If qq is compilable, then NP \subseteq P/poly. More precisely, 33-SAT can be solved with non-uniform polynomial size circuits.

Proof (details on board): by compiling

ϕn=c3-clauses(n)(csc) \phi_n = \bigwedge_{c \in \text{3-clauses}(n)} (c \vee s_c)

[1] Marco Cadoli, Francesco M Donini, and Marco Schaerf. Is intractability of non-monotonic reasoning a real drawback? Artificial intelligence, 88(1-2):215–251, 1996.

Where to go from there

No representation language fits.

The Knowledge Compilation Maps

Term coined by Darwiche and Marquis in [1].

Help the practicionner “navigates” languages and their properties using tables.

And now, a guided tour of the Circuit Zoo by David Kahdian, Oliver Broadrick, Renato Geh, and Guy Van den Broeck.

[1]: A. Darwiche and P. Marquis, “A Knowledge Compilation Map,” Journal of Artificial Intelligence Research, vol. 17, pp. 229–264, 2002.

A case study: OBDDs

Free Binary Decision Diagrams (FBDD)

Represent functions by successively testing variables:

c x 𝑥 y0 𝑦 x->y0 z0 𝑧 x->z0 z1 𝑧 y0->z1 z2 𝑧 y0->z2 y1 𝑦 z0->y1 y2 𝑦 z0->y2 t0 𝑡 y1->t0 t1 𝑡 y1->t1 y2->t0 y2->t1 z1->t0 z1->t1 z2->t0 z2->t1 t t0->t b t0->b t1->t t1->b

x=1,y=1,z=1,t=1x=1, y=1, z=1, t=1 is a not model.

x=0,y=0,z=1,t=1x=0, y=0, z=1, t=1 is a model.

Read-once: on a path, a variable can be tested at most once.

Missing variables

c x 𝑥 y 𝑦 x->y t x->t y->t b y->b

Both x=0,y=0x=0,y=0 and x=0,y=1x=0,y=1 are models.

Observation: this is a convention. Other popular convention: missing variables are default to 00 (in which case, we call the structure a ZDD).

Ordered BDD (OBDD)

Variables tested in a fixed order:

c x10 𝑥₁ x20 𝑥₂ x10->x20 x21 𝑥₂ x10->x21 x30 𝑥₃ x20->x30 x31 𝑥₃ x20->x31 x21->x30 x21->x31 x40 𝑥₄ x30->x40 x41 𝑥₄ x30->x41 x31->x40 x31->x41 x50 x40->x50 x51 x40->x51 x41->x50 x41->x51 c x 𝑥 y0 𝑦 x->y0 z0 𝑧 x->z0 z1 𝑧 y0->z1 z2 𝑧 y0->z2 y1 𝑦 z0->y1 y2 𝑦 z0->y2 t0 𝑡 y1->t0 t1 𝑡 y1->t1 y2->t0 y2->t1 z1->t0 z1->t1 z2->t0 z2->t1 t t0->t b t0->b t1->t t1->b

Order Matters

ROWn(x1,1,,xn,n)ROW_n(x_{1,1}, \dots, x_{n,n}): the matrix contains a row of 11.

Easy when testing row by row (x1,1,x1,2,...,x1,n,x2,1,x2,2,...,x2,n,...,xn,1,xn,2,...,xn,nx_{1,1}, x_{1,2}, ..., x_{1,n}, x_{2,1}, x_{2,2}, ..., x_{2,n}, ..., x_{n,1}, x_{n,2}, ..., x_{n,n}).

c t b x11 𝑥₁₁ x12 𝑥₁₂ x11->x12 x21 𝑥₂₁ x11->x21 x13 𝑥₁₃ x12->x13 x12->x21 x13->t x13->x21 x22 𝑥₂₂ x21->x22 x31 𝑥₃₁ x21->x31 x23 𝑥₂₃ x22->x23 x22->x31 x23->t x23->x31 x31->b x32 𝑥₃₂ x31->x32 x32->b x33 𝑥₃₃ x32->x33 x33->t x33->b
1 0 0
1 1 1
1 0 0

Hard when testing col by col (x1,1,x2,1,...,xn,1,x1,2,x2,2,...,xn,2,...,x1,n,x2,n,...,xn,nx_{1,1}, x_{2,1}, ..., x_{n,1}, x_{1,2}, x_{2,2}, ..., x_{n,2}, ..., x_{1,n}, x_{2,n}, ..., x_{n,n}).

Negation

FBDD and OBDD support Negation: swap and .

For example, ¬ROW3\neg ROW_3:

c t b x11 𝑥₁₁ x12 𝑥₁₂ x11->x12 x21 𝑥₂₁ x11->x21 x13 𝑥₁₃ x12->x13 x12->x21 x13->t x13->x21 x22 𝑥₂₂ x21->x22 x31 𝑥₃₁ x21->x31 x23 𝑥₂₃ x22->x23 x22->x31 x23->t x23->x31 x31->b x32 𝑥₃₂ x31->x32 x32->b x33 𝑥₃₃ x32->x33 x33->t x33->b
1 0 0
1 1 1
1 0 0

Counting with BDDs

Dynamic programming algorithm:

c x10 𝑥₁ 8 x20 𝑥₂ 4 x10->x20 x21 𝑥₂ 4 x10->x21 x30 𝑥₃ 2 x20->x30 x31 𝑥₃ 2 x20->x31 x21->x30 x21->x31 x40 𝑥₄ 1 x30->x40 x41 𝑥₄ 1 x30->x41 x31->x40 x31->x41 x50 1 x40->x50 x51 0 x40->x51 x41->x50 x41->x51

Counting: mind Δ

The previous algorithm is wrong: missing variables are not accounted for.

c t 1 b 0 x11 𝑥₁₁ 169 x12 𝑥₁₂ 109 x11->x12 x21 𝑥₂₁ 15 x11->x21 x13 𝑥₁₃ 79 x12->x13 x12->x21 x13->t x13->x21 x22 𝑥₂₂ 11 x21->x22 x31 𝑥₃₁ 1 x21->x31 x23 𝑥₂₃ 9 x22->x23 x22->x31 x23->t x23->x31 x31->b x32 𝑥₃₂ 1 x31->x32 x32->b x33 𝑥₃₃ 1 x32->x33 x33->t x33->b

N(g)=2|Δ0|N(g0)+2|Δ1|N(g1)N(g) = 2^{|\Delta_0|}N(g_0) + 2^{|\Delta_1|}N(g_1)

where Δ0=var(g1)\var(g0)\Delta_0 = var(g_1) \setminus var(g_0) and Δ1=var(g0)\var(g1)\Delta_1 = var(g_0) \setminus var(g_1)

Counting without Δ

Computing the variables after each gate is a bit costly (set operations). Other algorithm:

c t 512 b 0 x11 𝑥₁₁ 169.0 x12 𝑥₁₂ 218.0 x11->x12 x21 𝑥₂₁ 120.0 x11->x21 x13 𝑥₁₃ 316.0 x12->x13 x12->x21 x13->t x13->x21 x22 𝑥₂₂ 176.0 x21->x22 x31 𝑥₃₁ 64.0 x21->x31 x23 𝑥₂₃ 288.0 x22->x23 x22->x31 x23->t x23->x31 x31->b x32 𝑥₃₂ 128.0 x31->x32 x32->b x33 𝑥₃₃ 256.0 x32->x33 x33->t x33->b

Conjunction

Given two OBDD C1,C2C_1,C_2 using the same order π=x1,,xn\pi = x_1,\dots,x_n, we can construct an OBDD CC' computing C1C2C_1 \wedge C_2 of size |C1||C2||C_1|\cdot |C_2|.

Product construction: for gg in C1C_1 and hh in C2C_2, build n(g,h)n(g,h) accepting assignments that are accepted by both gg and hh.

x xᵢ g g0 g₀ x->g0 g1 g₁ x->g1 x xᵢ h g0 h₀ x->g0 g1 h₁ x->g1
x xᵢ n(g,h) g0 n(g₀,h₀) x->g0 g1 n(g₁,h₁) x->g1
x xᵢ g g0 g₀ x->g0 g1 g₁ x->g1 x xⱼ h g0 h₀ x->g0 g1 h₁ x->g1
x xᵢ n(g,h) g0 n(g₀,h) x->g0 g1 n(g₁,h) x->g1

if i<ji < j.

APPLY

Since Negation and Conjunction are supported:

Given two OBDD C1,C2C_1,C_2 using the same order π=x1,,xn\pi = x_1,\dots,x_n, \diamond a Boolean operator, we can construct an OBDD CC' computing C1C2C_1 \diamond C_2 of size O(|C1||C2|)O(|C_1|\cdot|C_2|).

We write: APPLY(C1,C2,)APPLY(C_1,C_2,\diamond).

Canonicity

For a function ff on XX and an order π\pi on XX, there is a unique and minimal OBDD computing ff and respecting π\pi.

Iteratively apply two simplifications:


a1 x xᵢ A a1->x a2 a2->x a3 a3->x y xᵢ B a3->y a4 a4->y a5 a5->y g0 g₀ x->g0 g1 g₁ x->g1 y->g0 y->g1

\rightarrow merge twins \rightarrow

a1 x xᵢ A+B a1->x a2 a2->x a3 a3->x a3->x a4 a4->x a5 a5->x g0 g₀ x->g0 g1 g₁ x->g1

a1 x xᵢ A a1->x a2 a2->x a3 a3->x a4 a4->x a5 a5->x g0 g x->g0 x->g0

\rightarrow remove useless node \rightarrow

a1 g0 g a1->g0 a2 a2->g0 a3 a3->g0 a4 a4->g0 a5 a5->g0

Wrap-up on OBDD

OBDD are highly tractable, and have nice properties (minimisation and canonicity).

Many supported queries and transformations not presented:

Not the most succinct data structure however, order is enforcing a lot of structure.

Circuit Based Representation

Negation Normal Form Circuits (NNF)

Boolean circuits with:

c r o1 o1->r a1 a1->o1 o2 a1->o2 a2 a2->o1 o2->r a3 a3->o2 x 𝑥 x->a1 x->a3 nx ¬𝑥 nx->a2 y 𝑦 y->a1 ny ¬𝑦 ny->a2 z 𝑧 z->a3

x=0,y=0,z=0x=0,y=0,z=0 is not a model.

x=1,y=1,z=0x=1,y=1,z=0 is a model.

NNF circuits are as succinct as Boolean circuits but not tractable: deciding whether they have a model is NP-complete.

Decomposable NNF (DNNF)

c r w1 w1->r w2 w2->r o1 o1->w1 a1 a1->o1 o2 a1->o2 b4 a1->b4 a2 a2->o1 a3 a3->o2 o2->w2 x 𝑥 x->a1 x->a3 nx ¬𝑥 nx->a2 y 𝑦 y->a1 ny ¬𝑦 ny->a2 ny->a3 v1 v1->w1 b1 b1->v1 v2 b1->v2 b1->b4 b2 b2->v1 v2->w2 b3 b3->v2 z 𝑧 z->b1 z->b3 nz ¬𝑧 nz->b2 w 𝑤 w->b1 nw ¬𝑤 nw->b2 nw->b3 b4->r

Every \wedge-node is decomposable: each input mentions distinct variables.

Finding models of DNNF

c r w1 w1->r w2 w2->r o1 o1->w1 a1 a1->o1 o2 a1->o2 b4 a1->b4 a2 a2->o1 a3 a3->o2 o2->w2 x 𝑥 x->a1 x->a3 nx ¬𝑥 nx->a2 y 𝑦 y->a1 ny ¬𝑦 ny->a2 ny->a3 v1 v1->w1 b1 b1->v1 v2 b1->v2 b1->b4 b2 b2->v1 v2->w2 b3 b3->v2 z 𝑧 z->b1 z->b3 nz ¬𝑧 nz->b2 w 𝑤 w->b1 nw ¬𝑤 nw->b2 nw->b3 b4->r c r w1 w1->r w2 w2->r o1 o1->w1 a1 a1->o1 o2 a1->o2 b4 a1->b4 a2 a2->o1 a3 a3->o2 o2->w2 x x->a1 x->a3 nx nx->a2 y 𝑦 y->a1 ny ¬𝑦 ny->a2 ny->a3 v1 v1->w1 b1 b1->v1 v2 b1->v2 b1->b4 b2 b2->v1 v2->w2 b3 b3->v2 z z->b1 z->b3 nz nz->b2 w 𝑤 w->b1 nw ¬𝑤 nw->b2 nw->b3 b4->r c r w1 w1->r w2 w2->r o1 o1->w1 a1 a1->o1 o2 a1->o2 b4 a1->b4 a2 a2->o1 a3 a3->o2 o2->w2 x x->a1 x->a3 nx nx->a2 y 𝑦 y->a1 ny ¬𝑦 ny->a2 ny->a3 v1 v1->w1 b1 b1->v1 v2 b1->v2 b1->b4 b2 b2->v1 v2->w2 b3 b3->v2 z z->b1 z->b3 nz nz->b2 w 𝑤 w->b1 nw ¬𝑤 nw->b2 nw->b3 b4->r

Given partial assignment τ\tau, decide whether there is a model of CC extending τ\tau.

  • Fix τ\tau in the circuit (here x=0,z=1x=0,z=1).
  • Propagate upward the information: “the gate has a model”.
  • A decomposable \wedge-gate gg has a model iff every input gg has a model.

Finding all models of a DNNF

c r w1 w1->r w2 w2->r o1 o1->w1 a1 a1->o1 o2 a1->o2 b4 a1->b4 a2 a2->o1 a3 a3->o2 o2->w2 x 𝑥 x->a1 x->a3 nx ¬𝑥 nx->a2 y 𝑦 y->a1 ny ¬𝑦 ny->a2 ny->a3 v1 v1->w1 b1 b1->v1 v2 b1->v2 b1->b4 b2 b2->v1 v2->w2 b3 b3->v2 z 𝑧 z->b1 z->b3 nz ¬𝑧 nz->b2 w 𝑤 w->b1 nw ¬𝑤 nw->b2 nw->b3 b4->r

Conditioning on <>. Satisfiable. Keep going

c r w1 w1->r w2 w2->r o1 o1->w1 a1 a1->o1 o2 a1->o2 b4 a1->b4 a2 a2->o1 a3 a3->o2 o2->w2 x 𝑥 x->a1 x->a3 nx ¬𝑥 nx->a2 y 𝑦 y->a1 ny ¬𝑦 ny->a2 ny->a3 v1 v1->w1 b1 b1->v1 v2 b1->v2 b1->b4 b2 b2->v1 v2->w2 b3 b3->v2 z 𝑧 z->b1 z->b3 nz ¬𝑧 nz->b2 w 𝑤 w->b1 nw ¬𝑤 nw->b2 nw->b3 b4->r

Conditioning on <𝑥: 0>. Satisfiable. Keep going

c r w1 w1->r w2 w2->r o1 o1->w1 a1 a1->o1 o2 a1->o2 b4 a1->b4 a2 a2->o1 a3 a3->o2 o2->w2 x 𝑥 x->a1 x->a3 nx ¬𝑥 nx->a2 y 𝑦 y->a1 ny ¬𝑦 ny->a2 ny->a3 v1 v1->w1 b1 b1->v1 v2 b1->v2 b1->b4 b2 b2->v1 v2->w2 b3 b3->v2 z 𝑧 z->b1 z->b3 nz ¬𝑧 nz->b2 w 𝑤 w->b1 nw ¬𝑤 nw->b2 nw->b3 b4->r

Conditioning on <𝑥: 0,𝑦: 0>. Satisfiable. Keep going

c r w1 w1->r w2 w2->r o1 o1->w1 a1 a1->o1 o2 a1->o2 b4 a1->b4 a2 a2->o1 a3 a3->o2 o2->w2 x 𝑥 x->a1 x->a3 nx ¬𝑥 nx->a2 y 𝑦 y->a1 ny ¬𝑦 ny->a2 ny->a3 v1 v1->w1 b1 b1->v1 v2 b1->v2 b1->b4 b2 b2->v1 v2->w2 b3 b3->v2 z 𝑧 z->b1 z->b3 nz ¬𝑧 nz->b2 w 𝑤 w->b1 nw ¬𝑤 nw->b2 nw->b3 b4->r

Conditioning on <𝑥: 0,𝑦: 0,𝑧: 0>. Satisfiable. Keep going

c r w1 w1->r w2 w2->r o1 o1->w1 a1 a1->o1 o2 a1->o2 b4 a1->b4 a2 a2->o1 a3 a3->o2 o2->w2 x 𝑥 x->a1 x->a3 nx ¬𝑥 nx->a2 y 𝑦 y->a1 ny ¬𝑦 ny->a2 ny->a3 v1 v1->w1 b1 b1->v1 v2 b1->v2 b1->b4 b2 b2->v1 v2->w2 b3 b3->v2 z 𝑧 z->b1 z->b3 nz ¬𝑧 nz->b2 w 𝑤 w->b1 nw ¬𝑤 nw->b2 nw->b3 b4->r

Conditioning on <𝑥: 0,𝑦: 0,𝑧: 0,𝑤: 0>. Model found.

c r w1 w1->r w2 w2->r o1 o1->w1 a1 a1->o1 o2 a1->o2 b4 a1->b4 a2 a2->o1 a3 a3->o2 o2->w2 x 𝑥 x->a1 x->a3 nx ¬𝑥 nx->a2 y 𝑦 y->a1 ny ¬𝑦 ny->a2 ny->a3 v1 v1->w1 b1 b1->v1 v2 b1->v2 b1->b4 b2 b2->v1 v2->w2 b3 b3->v2 z 𝑧 z->b1 z->b3 nz ¬𝑧 nz->b2 w 𝑤 w->b1 nw ¬𝑤 nw->b2 nw->b3 b4->r

Conditioning on <𝑥: 0,𝑦: 0,𝑧: 0,𝑤: 1>. Not satisfiable: backtrack

c r w1 w1->r w2 w2->r o1 o1->w1 a1 a1->o1 o2 a1->o2 b4 a1->b4 a2 a2->o1 a3 a3->o2 o2->w2 x 𝑥 x->a1 x->a3 nx ¬𝑥 nx->a2 y 𝑦 y->a1 ny ¬𝑦 ny->a2 ny->a3 v1 v1->w1 b1 b1->v1 v2 b1->v2 b1->b4 b2 b2->v1 v2->w2 b3 b3->v2 z 𝑧 z->b1 z->b3 nz ¬𝑧 nz->b2 w 𝑤 w->b1 nw ¬𝑤 nw->b2 nw->b3 b4->r

Conditioning on <𝑥: 0,𝑦: 0,𝑧: 1>. Satisfiable. Keep going

c r w1 w1->r w2 w2->r o1 o1->w1 a1 a1->o1 o2 a1->o2 b4 a1->b4 a2 a2->o1 a3 a3->o2 o2->w2 x 𝑥 x->a1 x->a3 nx ¬𝑥 nx->a2 y 𝑦 y->a1 ny ¬𝑦 ny->a2 ny->a3 v1 v1->w1 b1 b1->v1 v2 b1->v2 b1->b4 b2 b2->v1 v2->w2 b3 b3->v2 z 𝑧 z->b1 z->b3 nz ¬𝑧 nz->b2 w 𝑤 w->b1 nw ¬𝑤 nw->b2 nw->b3 b4->r

Conditioning on <𝑥: 0,𝑦: 0,𝑧: 1,𝑤: 0>. Not satisfiable: backtrack

c r w1 w1->r w2 w2->r o1 o1->w1 a1 a1->o1 o2 a1->o2 b4 a1->b4 a2 a2->o1 a3 a3->o2 o2->w2 x 𝑥 x->a1 x->a3 nx ¬𝑥 nx->a2 y 𝑦 y->a1 ny ¬𝑦 ny->a2 ny->a3 v1 v1->w1 b1 b1->v1 v2 b1->v2 b1->b4 b2 b2->v1 v2->w2 b3 b3->v2 z 𝑧 z->b1 z->b3 nz ¬𝑧 nz->b2 w 𝑤 w->b1 nw ¬𝑤 nw->b2 nw->b3 b4->r

Conditioning on <𝑥: 0,𝑦: 0,𝑧: 1,𝑤: 1>. Model found.

c r w1 w1->r w2 w2->r o1 o1->w1 a1 a1->o1 o2 a1->o2 b4 a1->b4 a2 a2->o1 a3 a3->o2 o2->w2 x 𝑥 x->a1 x->a3 nx ¬𝑥 nx->a2 y 𝑦 y->a1 ny ¬𝑦 ny->a2 ny->a3 v1 v1->w1 b1 b1->v1 v2 b1->v2 b1->b4 b2 b2->v1 v2->w2 b3 b3->v2 z 𝑧 z->b1 z->b3 nz ¬𝑧 nz->b2 w 𝑤 w->b1 nw ¬𝑤 nw->b2 nw->b3 b4->r

Conditioning on <𝑥: 0,𝑦: 1>. Not satisfiable: backtrack

c r w1 w1->r w2 w2->r o1 o1->w1 a1 a1->o1 o2 a1->o2 b4 a1->b4 a2 a2->o1 a3 a3->o2 o2->w2 x 𝑥 x->a1 x->a3 nx ¬𝑥 nx->a2 y 𝑦 y->a1 ny ¬𝑦 ny->a2 ny->a3 v1 v1->w1 b1 b1->v1 v2 b1->v2 b1->b4 b2 b2->v1 v2->w2 b3 b3->v2 z 𝑧 z->b1 z->b3 nz ¬𝑧 nz->b2 w 𝑤 w->b1 nw ¬𝑤 nw->b2 nw->b3 b4->r

Conditioning on <𝑥: 1>. Satisfiable. Keep going

c r w1 w1->r w2 w2->r o1 o1->w1 a1 a1->o1 o2 a1->o2 b4 a1->b4 a2 a2->o1 a3 a3->o2 o2->w2 x 𝑥 x->a1 x->a3 nx ¬𝑥 nx->a2 y 𝑦 y->a1 ny ¬𝑦 ny->a2 ny->a3 v1 v1->w1 b1 b1->v1 v2 b1->v2 b1->b4 b2 b2->v1 v2->w2 b3 b3->v2 z 𝑧 z->b1 z->b3 nz ¬𝑧 nz->b2 w 𝑤 w->b1 nw ¬𝑤 nw->b2 nw->b3 b4->r

Conditioning on <𝑥: 1,𝑦: 0>. Satisfiable. Keep going

c r w1 w1->r w2 w2->r o1 o1->w1 a1 a1->o1 o2 a1->o2 b4 a1->b4 a2 a2->o1 a3 a3->o2 o2->w2 x 𝑥 x->a1 x->a3 nx ¬𝑥 nx->a2 y 𝑦 y->a1 ny ¬𝑦 ny->a2 ny->a3 v1 v1->w1 b1 b1->v1 v2 b1->v2 b1->b4 b2 b2->v1 v2->w2 b3 b3->v2 z 𝑧 z->b1 z->b3 nz ¬𝑧 nz->b2 w 𝑤 w->b1 nw ¬𝑤 nw->b2 nw->b3 b4->r

Conditioning on <𝑥: 1,𝑦: 0,𝑧: 0>. Not satisfiable: backtrack

c r w1 w1->r w2 w2->r o1 o1->w1 a1 a1->o1 o2 a1->o2 b4 a1->b4 a2 a2->o1 a3 a3->o2 o2->w2 x 𝑥 x->a1 x->a3 nx ¬𝑥 nx->a2 y 𝑦 y->a1 ny ¬𝑦 ny->a2 ny->a3 v1 v1->w1 b1 b1->v1 v2 b1->v2 b1->b4 b2 b2->v1 v2->w2 b3 b3->v2 z 𝑧 z->b1 z->b3 nz ¬𝑧 nz->b2 w 𝑤 w->b1 nw ¬𝑤 nw->b2 nw->b3 b4->r

Conditioning on <𝑥: 1,𝑦: 0,𝑧: 1>. Satisfiable. Keep going

c r w1 w1->r w2 w2->r o1 o1->w1 a1 a1->o1 o2 a1->o2 b4 a1->b4 a2 a2->o1 a3 a3->o2 o2->w2 x 𝑥 x->a1 x->a3 nx ¬𝑥 nx->a2 y 𝑦 y->a1 ny ¬𝑦 ny->a2 ny->a3 v1 v1->w1 b1 b1->v1 v2 b1->v2 b1->b4 b2 b2->v1 v2->w2 b3 b3->v2 z 𝑧 z->b1 z->b3 nz ¬𝑧 nz->b2 w 𝑤 w->b1 nw ¬𝑤 nw->b2 nw->b3 b4->r

Conditioning on <𝑥: 1,𝑦: 0,𝑧: 1,𝑤: 0>. Model found.

c r w1 w1->r w2 w2->r o1 o1->w1 a1 a1->o1 o2 a1->o2 b4 a1->b4 a2 a2->o1 a3 a3->o2 o2->w2 x 𝑥 x->a1 x->a3 nx ¬𝑥 nx->a2 y 𝑦 y->a1 ny ¬𝑦 ny->a2 ny->a3 v1 v1->w1 b1 b1->v1 v2 b1->v2 b1->b4 b2 b2->v1 v2->w2 b3 b3->v2 z 𝑧 z->b1 z->b3 nz ¬𝑧 nz->b2 w 𝑤 w->b1 nw ¬𝑤 nw->b2 nw->b3 b4->r

Conditioning on <𝑥: 1,𝑦: 0,𝑧: 1,𝑤: 1>. Model found.

c r w1 w1->r w2 w2->r o1 o1->w1 a1 a1->o1 o2 a1->o2 b4 a1->b4 a2 a2->o1 a3 a3->o2 o2->w2 x 𝑥 x->a1 x->a3 nx ¬𝑥 nx->a2 y 𝑦 y->a1 ny ¬𝑦 ny->a2 ny->a3 v1 v1->w1 b1 b1->v1 v2 b1->v2 b1->b4 b2 b2->v1 v2->w2 b3 b3->v2 z 𝑧 z->b1 z->b3 nz ¬𝑧 nz->b2 w 𝑤 w->b1 nw ¬𝑤 nw->b2 nw->b3 b4->r

Conditioning on <𝑥: 1,𝑦: 1>. Satisfiable. Keep going

c r w1 w1->r w2 w2->r o1 o1->w1 a1 a1->o1 o2 a1->o2 b4 a1->b4 a2 a2->o1 a3 a3->o2 o2->w2 x 𝑥 x->a1 x->a3 nx ¬𝑥 nx->a2 y 𝑦 y->a1 ny ¬𝑦 ny->a2 ny->a3 v1 v1->w1 b1 b1->v1 v2 b1->v2 b1->b4 b2 b2->v1 v2->w2 b3 b3->v2 z 𝑧 z->b1 z->b3 nz ¬𝑧 nz->b2 w 𝑤 w->b1 nw ¬𝑤 nw->b2 nw->b3 b4->r

Conditioning on <𝑥: 1,𝑦: 1,𝑧: 0>. Satisfiable. Keep going

c r w1 w1->r w2 w2->r o1 o1->w1 a1 a1->o1 o2 a1->o2 b4 a1->b4 a2 a2->o1 a3 a3->o2 o2->w2 x 𝑥 x->a1 x->a3 nx ¬𝑥 nx->a2 y 𝑦 y->a1 ny ¬𝑦 ny->a2 ny->a3 v1 v1->w1 b1 b1->v1 v2 b1->v2 b1->b4 b2 b2->v1 v2->w2 b3 b3->v2 z 𝑧 z->b1 z->b3 nz ¬𝑧 nz->b2 w 𝑤 w->b1 nw ¬𝑤 nw->b2 nw->b3 b4->r

Conditioning on <𝑥: 1,𝑦: 1,𝑧: 0,𝑤: 0>. Model found.

c r w1 w1->r w2 w2->r o1 o1->w1 a1 a1->o1 o2 a1->o2 b4 a1->b4 a2 a2->o1 a3 a3->o2 o2->w2 x 𝑥 x->a1 x->a3 nx ¬𝑥 nx->a2 y 𝑦 y->a1 ny ¬𝑦 ny->a2 ny->a3 v1 v1->w1 b1 b1->v1 v2 b1->v2 b1->b4 b2 b2->v1 v2->w2 b3 b3->v2 z 𝑧 z->b1 z->b3 nz ¬𝑧 nz->b2 w 𝑤 w->b1 nw ¬𝑤 nw->b2 nw->b3 b4->r

Conditioning on <𝑥: 1,𝑦: 1,𝑧: 0,𝑤: 1>. Not satisfiable: backtrack

c r w1 w1->r w2 w2->r o1 o1->w1 a1 a1->o1 o2 a1->o2 b4 a1->b4 a2 a2->o1 a3 a3->o2 o2->w2 x 𝑥 x->a1 x->a3 nx ¬𝑥 nx->a2 y 𝑦 y->a1 ny ¬𝑦 ny->a2 ny->a3 v1 v1->w1 b1 b1->v1 v2 b1->v2 b1->b4 b2 b2->v1 v2->w2 b3 b3->v2 z 𝑧 z->b1 z->b3 nz ¬𝑧 nz->b2 w 𝑤 w->b1 nw ¬𝑤 nw->b2 nw->b3 b4->r

Conditioning on <𝑥: 1,𝑦: 1,𝑧: 1>. Satisfiable. Keep going

c r w1 w1->r w2 w2->r o1 o1->w1 a1 a1->o1 o2 a1->o2 b4 a1->b4 a2 a2->o1 a3 a3->o2 o2->w2 x 𝑥 x->a1 x->a3 nx ¬𝑥 nx->a2 y 𝑦 y->a1 ny ¬𝑦 ny->a2 ny->a3 v1 v1->w1 b1 b1->v1 v2 b1->v2 b1->b4 b2 b2->v1 v2->w2 b3 b3->v2 z 𝑧 z->b1 z->b3 nz ¬𝑧 nz->b2 w 𝑤 w->b1 nw ¬𝑤 nw->b2 nw->b3 b4->r

Conditioning on <𝑥: 1,𝑦: 1,𝑧: 1,𝑤: 0>. Model found.

c r w1 w1->r w2 w2->r o1 o1->w1 a1 a1->o1 o2 a1->o2 b4 a1->b4 a2 a2->o1 a3 a3->o2 o2->w2 x 𝑥 x->a1 x->a3 nx ¬𝑥 nx->a2 y 𝑦 y->a1 ny ¬𝑦 ny->a2 ny->a3 v1 v1->w1 b1 b1->v1 v2 b1->v2 b1->b4 b2 b2->v1 v2->w2 b3 b3->v2 z 𝑧 z->b1 z->b3 nz ¬𝑧 nz->b2 w 𝑤 w->b1 nw ¬𝑤 nw->b2 nw->b3 b4->r

Conditioning on <𝑥: 1,𝑦: 1,𝑧: 1,𝑤: 1>. Model found.

𝑥: 0,𝑦: 0,𝑧: 0,𝑤: 0
𝑥: 0,𝑦: 0,𝑧: 1,𝑤: 1
𝑥: 1,𝑦: 0,𝑧: 1,𝑤: 0
𝑥: 1,𝑦: 0,𝑧: 1,𝑤: 1
𝑥: 1,𝑦: 1,𝑧: 0,𝑤: 0
𝑥: 1,𝑦: 1,𝑧: 1,𝑤: 0
𝑥: 1,𝑦: 1,𝑧: 1,𝑤: 1

Model Counting on DNNF

Previous algorithm allows to count the models of CC in time O(#var|C|#C)O(\#var \cdot |C| \cdot \#C) but #C\#C may be exponential in |C||C|.

Can we find the number of models of a given DNNF CC in polynomial time in CC?

[1] Kuldeep S. Meel, Alexis de Colnet, #CFG and #DNNF admit FPRAS. SODA 2026: 5978-6010.

Determinism (unambiguity)

  • #(αβ)=#α×#β\# (\alpha \wedge \beta) = \#\alpha \times \#\beta when α\alpha and β\beta do not share variables (decomposable \wedge).
  • #(αβ)=#α+#β\# (\alpha \vee \beta) = \#\alpha + \#\beta #(αβ)-\#(\alpha \wedge \beta), when α\alpha and β\beta are defined on the same variables.
    Hard to evaluate in a DNNF.

A \vee-gate gg is deterministic if g1g2=g_1 \wedge g_2 = \bot for inputs g1,g2g_1,g_2 of gg. In this case:

#g=#g12|Δ1|+#g22|Δ2|\#g = \#g_1 \cdot 2^{|\Delta_1|} + \#g_2 \cdot 2^{|\Delta_2|} with Δ1=var(g2)\var(g1)\Delta_1 = var(g_2) \setminus var(g_1) and Δ2=var(g1)\var(g2)\Delta_2 = var(g_1) \setminus var(g_2).

c r w1 w1->r w2 w2->r xey xey->w1 xney xney->w2 xy xy->xey nxy nxy->xney xny xny->xney nxny nxny->xey zw zw->w1 zvw zvw->w2 z 𝑧 z->zw z->zvw w 𝑤 w->zw w->zvw x 𝑥 x->xy x->xny nx ¬𝑥 nx->nxy nx->nxny y 𝑦 y->xy y->nxy ny ¬𝑦 ny->xny ny->nxny
  • deterministic DNNF (d-DNNF): DNNF where every \vee-gate is deterministic.
  • Counting is tractable on d-DNNF: intuitively, replace \vee by ++, \wedge by ×\times and inputs by 11 (more on this later).

Decision-gates: a Syntactic Determinism

c r w1 w1->r w0 w0->r alpha α alpha->w1 beta β beta->w0 x 𝑥 x->w1 nx ¬𝑥 nx->w0 c r 𝑥 alpha α r->alpha beta β r->beta

decDNNF: every \vee-gate is a decision-gate.

c r 𝑥 alpha α alpha->r beta β beta->r

Observation: DNNF <s<_s d-DNNF <s<_s decDNNF (separation in the last part).

Weighted Model Counting

w(f)=τfxXw(x,τ(x)) w(f) = \sum_{\tau \models f} \prod_{x \in X} w(x, \tau(x))

Example: f=xyf = x \vee y

  • w(x,0)=1w(x,0) = 1
  • w(x,1)=2w(x,1)=2
  • w(y,0)=2w(y,0) = 2
  • w(y,1)=1w(y,1)=1
xx yy ww
11 00 2×2=42 \times 2 = 4
00 11 1×1=11 \times 1 = 1
11 11 2×1=22 \times 1 = 2
w(f)=w(f)= 4+1+2=74+1+2 = 7

Application:

Optimising

Weighted model counting:

w(f)=τfxXw(x,τ(x)) w(f) = \sum_{\tau \models f} \prod_{x \in X} w(x, \tau(x))

Related optimisation problems:

wmax(f)=max{xXw(x,τ(x))τf} w_{max}(f) = \max \{ \prod_{x \in X} w(x, \tau(x)) \mid {\tau \models f}\}

wm(f)=min{xXw(x,τ(x))τf} w_{m}(f) = \min \{ \sum_{x \in X} w(x, \tau(x)) \mid {\tau \models f}\}

What is the relation between ww, wmaxw_{max}, wmw_m etc.?

Counting over semiring

Commutative semiring 𝕂=(K,,,0𝕂,1𝕂)\mathbb{K} = (K, \oplus, \otimes, 0_\mathbb{K}, 1_\mathbb{K}):

Example: (,min,+,+,0)(\mathbb{Q}, \min, +, +\infty, 0), ([0,1],max,×,0,1)([0,1], \max, \times, 0, 1), (2X,,,,X)(2^X, \cup, \cap, \emptyset, X)… (check Nina Pardal lecture on Sunday).

Algebraic Model Counting [1] for w:X×{0,1}𝕂w : X \times \{0,1\} \rightarrow \mathbb{K} and ff on variables XX:

w(f)=τfxXw(x,τ(x))w(f) = \bigoplus_{\tau \models f} \bigoplus_{x \in X} w(x,\tau(x))

By changing the semiring, we unify counting and optimisation problems.

[1] Angelika Kimmig, Guy Van den Broeck, and Luc De Raedt. Algebraic model counting. Journal of Applied Logic, 22:46–62, 2017.

Evaluation Algorithm

c r w1 w1->r w2 w2->r o1 o1->w1 a1 a1->o1 o2 a1->o2 a2 a2->o1 a3 a3->o2 o2->w2 x 𝑥₁ x->a1 x->a3 nx ¬𝑥₁ nx->a2 y 𝑥₂ y->a1 ny ¬𝑥₂ ny->a2 ny->a3 b1 v1 b1->v1 v2 b1->v2 b2 b2->v1 v1->w1 v2->w2 b3 b3->v2 z 𝑥₃ z->b1 z->b3 nz ¬𝑥₃ nz->b2 w 𝑥₄ w->b1 nw ¬𝑥₄ nw->b2 nw->b3 c r w1 w1->r w2 w2->r o1 o1->w1 a1 a1->o1 o2 a1->o2 a2 a2->o1 a3 a3->o2 o2->w2 x 𝑥₁ 𝑤(𝑥₁, 1) x->a1 x->a3 nx ¬𝑥₁ 𝑤(𝑥₁, 0) nx->a2 y 𝑥₂ 𝑤(𝑥₂, 1) y->a1 ny ¬𝑥₂ 𝑤(𝑥₂, 0) ny->a2 ny->a3 b1 v1 b1->v1 v2 b1->v2 b2 b2->v1 v1->w1 v2->w2 b3 b3->v2 z 𝑥₃ 𝑤(𝑥₃, 1) z->b1 z->b3 nz ¬𝑥₃ 𝑤(𝑥₃, 0) nz->b2 w 𝑥₄ 𝑤(𝑥₄, 1) w->b1 nw ¬𝑥₄ 𝑤(𝑥₄, 0) nw->b2 nw->b3

If CC is a smooth d-DNNF, it computes w(f)w(f) by making O(|C|)O(|C|) arithmetic operations.

Smooth: for g1g2g_1 \vee g_2, we must have var(g1)=var(g2)var(g_1)=var(g_2). Details on board.

Without determinism

Correctness depends on determinism but for some semiring, we can drop it if 𝕂\mathbb{K} is idempotent:

a,aa=a.\forall a, a \oplus a = a.

Typically, (min,+)(min, +), (max,×)(max, \times) etc. are idempotent: many optimisation problems are tractable on DNNF directly.

Wrap up

Next part: how to build such circuits.

Part II
Building Circuits

Building circuits top-down

Original representation

We assume the input is always given as a CNF formula: ϕ=cϕc\phi = \bigwedge_{c \phi} \bigvee_{\ell \in c} \ell.

  1. Standard input for SAT solver.
  2. Every Boolean circuit can be encoded into a CNF formula with isomorphic models (Tseitin transform).
  3. Rich literature for encoding involved constraints.
  4. Simple form.

Goal: transform a given CNF formula into a d-DNNF.

Convention

To lighten the notations, CNF formulas are denoted as follows:

Example: (x1¬x2)(x1x3¬x4)(x2¬x4)(x_1 \vee \neg x_2) \wedge (x_1 \vee x_3 \vee \neg x_4) \wedge (x_2 \vee \neg x_4) is denoted by

Stupid Brute Force

c d0 𝑥₁ d1 𝑥₂ d1->d0 d2 𝑥₃ d2->d1 d3 𝑥₄ d3->d2 b b->d3 b->d3 d4 𝑥₄ b->d4 d6 𝑥₄ b->d6 b->d6 d7 𝑥₄ b->d7 d9 𝑥₄ b->d9 d4->d2 t t->d4 t->d7 d8 𝑥₂ t->d8 t->d9 d5 𝑥₃ d5->d1 d6->d5 d7->d5 d8->d0 d9->d8
-4 1 3
1 4
-1 2 4
-3 -2 1 4

Adding unit propagation

c d0 𝑥₁ d1 𝑥₄ d1->d0 d2 𝑥₃ d2->d1 t t->d2 d3 𝑥₂ t->d3 d4 𝑥₄ t->d4 d3->d0 d4->d3
-4 1 3
1 4
-1 2 4
-3 -2 1 4

No factorization

Current algorithm builds decision trees.

c d0 𝑥₁ d1 𝑥₄ d1->d0 d2 𝑥₂ d2->d1 d3 𝑥₃ d3->d2 t t->d2 t->d3 d5 𝑥₂ t->d5 d6 𝑥₃ t->d6 d4 𝑥₄ d4->d0 d5->d4 d6->d5
1 2 3
-1 2 3
-4 -1
-4 1

Caching

c d0 𝑥₁ d1 𝑥₄ d1->d0 d1->d0 d2 𝑥₂ d2->d1 d3 𝑥₃ d3->d2 t t->d2 t->d3
1 2 3
-1 2 3
-4 -1
-4 1
Recall that ϕ[x1=0]:\phi[x_1=0]:
1 2 3
-1 2 3
-4 -1
-4 1

Component Caching

Cache cleaning

In practice, the cache may grow too much.

Need for a cleaning strategy:

Decomposability

Exhaustive DPLL + Caching builds FBDD. Can we exploit decomposability?

If ϕ=ϕ1ϕ2\phi = \phi_1 \wedge \phi_2 with var(ϕ1)var(ϕ2)=var(\phi_1) \cap var(\phi_2) = \emptyset then compile(ϕ1)compile(ϕ2)compile(\phi_1) \wedge compile(\phi_2) is a decomposable \wedge-gate.

Connected components:

  • c1c_1: 1 5
  • c2c_2: -1 2
  • c3c_3: 3 6
  • c4c_4: 3 7
  • c5c_5: 1 4
  • c6c_6: 6 7 8
%3 c1 c1 c2 c2 c1--c2 c5 c5 c1--c5 c3 c3 c4 c4 c3--c4 c6 c6 c3--c6 c4--c6

At each recursive call, if ϕ=ϕ1ϕk\phi = \phi_1 \wedge \dots \wedge \phi_k has more than 11 connected component, recursively compile each ϕi\phi_i independently.

Decomposability example

c d0 𝑥₁ a1 a1->d0 d2 𝑥₄ d2->a1 a7 d2->a7 t t->d2 d3 𝑥₅ t->d3 d4 𝑥₆ t->d4 d5 𝑥₂ t->d5 d6 𝑥₃ t->d6 d9 𝑥₆ t->d9 d3->a1 d4->d3 d8 𝑥₅ d4->d8 d5->a1 d5->a7 d6->d5 a7->d0 d8->a7 d9->d8
-1 2 3
-6 -5
-4 -1
-1 5 6
1 2 3
-4 1

Variables heuristics

Branch on variables likely to split the formula into balanced disjoint cc.

Heuristics rely on graph theory:

*^* I do love tree decompositions and treewidth, don’t get me started.

Improvement

Consider the following likely scenario:

blob computing... u1 blob->u1 u2 blob->u2 u3 blob->u3 u4 blob->u4 x1 x1 x1->blob

Lost in a conflict.

u1 x1 x1 x1->u1

That’s better.

We are using DPLL to see that ϕ[x1=1]\phi[x_1=1] is UNSAT…

SAT solvers use better algorithm CDCL.

Always check a branch is satisfiable before exploring it.

Bonus: CDCL returns implied clauses, which can be used to later detect unit propagation.

Wrap up

Building circuits bottom-up

A word on bottom-up

In a nutshell: apply, minimise, apply, minimise, apply…

F = CNF(...)
p = choose a "good" order for F
D = OBDD(p)

for c in F:
    DC = OBDD(c,p)
    D.apply(DC)
    D.minimize()

Apply, minimise, apply, minimise…

c OBDD for clause [1 3] t b n0 𝑥₁ n0->t n1 𝑥₃ n0->n1 n1->t n1->b
c OBDD for clause [1 2 -3] t b n0 𝑥₁ n0->t n1 𝑥₂ n0->n1 n1->t n2 𝑥₃ n1->n2 n2->t n2->b
c OBDD for clause [-2 -3] t b n0 𝑥₂ n0->t n1 𝑥₃ n0->n1 n1->t n1->b
c OBDD for clause [2 4] t b n0 𝑥₂ n0->t n1 𝑥₄ n0->n1 n1->t n1->b
c b t n0 𝑥₃ n0->b n0->t n1 𝑥₁ n1->t n1->n0

Apply clause 1 3.

c b t n0 𝑥₃ n0->b n0->t n1 𝑥₁ n1->t n1->n0

Minimise.

c b t n0 𝑥₃ n0->b n0->b n1 𝑥₃ n1->b n1->t n2 𝑥₂ n2->n0 n2->n1 n3 𝑥₁ n3->t n3->n2

Apply clause 1 2 -3.

c b t n1 𝑥₃ n1->b n1->t n2 𝑥₂ n2->b n2->n1 n3 𝑥₁ n3->t n3->n2

Minimise.

c b t n0 𝑥₃ n0->b n0->b n1 𝑥₂ n1->b n1->n0 n2 𝑥₃ n2->b n2->t n3 𝑥₂ n3->t n3->n2 n4 𝑥₁ n4->n1 n4->n3

Apply clause -2 -3.

c b t n2 𝑥₃ n2->b n2->t n3 𝑥₂ n3->t n3->n2 n4 𝑥₁ n4->b n4->n3

Minimise.

c b t n0 𝑥₄ n0->b n0->t n1 𝑥₃ n1->b n1->t n2 𝑥₂ n2->n0 n2->n1 n3 𝑥₁ n3->b n3->n2

Apply clause 2 4.

c b t n0 𝑥₄ n0->b n0->t n1 𝑥₃ n1->b n1->t n2 𝑥₂ n2->n0 n2->n1 n3 𝑥₁ n3->b n3->n2

Minimise.

Advantages and disadvantages

Pros:

Cons:

Min-fill heuristics

Computing optimal order is NP-hard [1]: use heuristics.

Example: Min-Fill.

Rationale: branching on a variable will introduce “new” dependencies. We try to minimize it.

Beyond OBDD

Idea: OBDD is a way of structuring variables in FBDD. Add structure variables in DNNF too?

Structured d-DNNF [1]

r r t1 r->t1 t2 r' r->t2 x1 𝑥₁ t1->x1 x2 𝑥₂ t1->x2 t3 t2->t3 t4 t2->t4 x3 𝑥₃ t3->x3 x4 𝑥₄ t3->x4 x5 𝑥₅ t4->x5 x6 𝑥₆ t4->x6

Structured along a variable tree (vtree).

Every \wedge-gate of the DNNF must split variables accoring to a node of the vtree:

  • for example g(x1,x2)g(x3,x5)g(x_1,x_2) \wedge g'(x_3,x_5) (split according to rr)
  • or g(x3,x4)g(x5,x6)g(x_3,x_4) \wedge g'(x_5,x_6) (split according to rr')
  • but not g(x1,x4)g(x2)g(x_1,x_4) \wedge g'(x_2)
  • nor g(x3,x5)g(x4,x6)g(x_3,x_5) \wedge g'(x_4,x_6)

[1] Knot Pipatsrisawat and Adnan Darwiche. New compilation languages based on structured decomposability. In AAAI, volume 8, pages 517–522, 2008.

Structured d-DNNF and Bottom-up compilation

If C1,C2C_1,C_2 respect the same vtree TT, we can build a circuit for C1C2C_1 \wedge C_2 respecting TT of size at most |C1||C2||C_1|\cdot|C_2|.

Good news for bottom up compilation?

But not enough:

  • no minimisation
  • no canonical representation
  • the size of the circuit can only grow!

SDD and TDD

Both are canonical restrictions of structured d-DNNF: allows for bottom-up compilation.

Some observations:

Part III
Limits

Subfunctions

Notion of Subfunctions

Let f:{0,1}X{0,1}f : \{0,1\}^X \rightarrow \{0,1\} be a Boolean function.

A YY-subfunction of ff is a Boolean function on variables YY defined as: f[τ]f[\tau] for some τ{0,1}X\Y\tau \in \{0,1\}^{X \setminus Y}.

subY(f)={f[τ]τ{0,1}X\Y}.sub_Y(f) = \{f[\tau] \mid \tau \in \{0,1\}^{X \setminus Y}\}.

Of size at most 2|X||Y|2^{|X|-|Y|} but often smaller.

EVEN(x1,...,x4)EVEN(x_1,...,x_4) has two {x3,x4}\{x_3,x_4\}-subfunctions:

  • EVEN4[x1=0,x2=0]=EVEN4[x1=1,x2=1]=EVEN2(x3,x4)EVEN_4[x_1=0,x_2=0] = EVEN_4[x_1=1,x_2=1] = EVEN_2(x_3,x_4)
  • EVEN4[x1=1,x2=0]=EVEN4[x1=0,x2=1]=ODD2(x3,x4)EVEN_4[x_1=1,x_2=0] = EVEN_4[x_1=0,x_2=1] = ODD_2(x_3,x_4)

Subfunctions and OBDD

f[τ1]f[\tau_1] and f[τ2]f[\tau_2] define the same {xi,,xn}\{x_i, \dots, x_{n}\}-subfunction.

At least #sub{xi,,xn}(f)\#sub_{\{x_i,\dots,x_n\}}(f) nodes testing xix_i.

The Sieling-Wegener’s bound

Let CC the smallest complete OBDD computing ff. The decision-gates of CC testing xix_i are in one to one correspondence with subxi,,xn(f)sub_{x_i,\dots,x_n}(f).

Orders and sizes

MATCHn(X,Y)=i=1nxiyiMATCH_n(X, Y) = \bigwedge_{i=1}^n x_i \vee y_i.

Hard function for OBDD

M={x1,1,,xn,n}M = \{x_{1,1}, \dots, x_{n,n}\} matrix of Boolean variables.

f=ROWnCOLnf = ROW_n \vee COL_n

No OBDD for ff of size less than 2n2^n:

  • π={z1,,zn2}\pi = \{z_1,\dots,z_{n^2}\}, Z={z1,,zn}Z = \{z_1,\dots,z_n\}.
  • τ{0,1}Z\tau \in \{0,1\}^Z: at least nn partially tested rows or columns.
  • gives 2n2^n distinct (M\Z)(M \setminus Z)-subfunctions.

Consequences: limits of OBDD

f=ROWnCOLnf = ROW_n \vee COL_n has no OBDD for ff of size less than 2n2^n:

Rectangles

Rectangles: A combinatorial object

Origin in communication complexity.

Rectangle covers I

Rectangle cover {r1,,rk}\{r_1,\dots,r_k\} of f:{0,1}X{0,1}f : \{0,1\}^X \rightarrow \{0,1\} is:

Example:

  • EVEN(x1,,xn)=r1r2EVEN(x_1,\dots,x_{n}) = r_1 \vee r_2 where
    • r1=EVEN(x1,,xi)EVEN(xi+1,,x2n)r_1 = EVEN(x_1,\dots, x_i) \wedge EVEN(x_{i+1}, \dots, x_{2n})
    • r2=ODD(x1,,xi)ODD(xi+1,,x2n)r_2 = ODD(x_1,\dots, x_i) \wedge ODD(x_{i+1}, \dots, x_{2n})
  • f=r0r1f = r_0 \vee r_1 using Shanon expansion
    • r0=¬xf[x0]r_0 = \neg x \wedge f[x \mapsto 0]
    • r1=xf[x1]r_1 = x \wedge f[x \mapsto 1]
    • both are ({x},X\{x})(\{x\}, X \setminus \{x\})-rectangle.
    • Not “balanced”.

Rectangle covers II

Rectangle cover {r1,,rk}\{r_1,\dots,r_k\} of f:{0,1}X{0,1}f : \{0,1\}^X \rightarrow \{0,1\} is:

Rectangle and DNNF

(Bova, C., Mengel, Slivovsky) If ff is computed by a DNNF CC of size ss then ff has a (1/3)(1/3)-balanced rectangle cover of size at most ss.

Observation: If CC is deterministic, then we can assume the cover to be disjoint.

Covering DNNF with rectangles

Details on board.

DNNF CC:

A lower bound on rectangle covers

Details on board.

For a graph G=(V,E)G=(V,E), VC(G)={x,y}ExyVC(G) = \bigwedge_{\{x,y\} \in E} x \vee y (vertex cover of GG).

If GG is the n×nn \times n grid, GG cannot be covered by less than cnc^{n} (1/3)(1/3)-balanced rectangles for some c>1c>1.

Corollaries:

  1. VC(G)VC(G) cannot be represented by polynomial sized DNNFs.
  2. CNF and DNNF are not comparable.
  3. DNNF do not support negation.

Sauerhoff’s function

fn=RnCn f_n = R_n \vee C_n

(Sauerhoff03) Any disjoint rectangle cover for fnf_n has size at least cnc^n for c>1c > 1.

Corollary: d-DNNF < DNNF

Challenging open questions

  1. DNF vs d-DNNF.
  2. Negation of d-DNNF.

Main hurdle: finding the right candidate function and prove the rectangle lower bounds. Work from communication complexity brings insights.

Conclusion

Wrap up

  1. Many ways of representing Boolean functions.
    • Most used in practice: OBDD, decision-DNNF, SDD.
    • Others offer interesting theoretical framework.
  2. Two classes of practical compilation algorithms.
    • Top-down (d4, Ganak…)
    • Bottom-up (sdd, cudd, BuDDy, TiDiDi).
    • Strong links with (algebraic) model counting.
  3. Tools for lower bounds.
    • Subfunctions for OBDD.
    • Rectangle based techniques.

Uncovered aspects

Going further