Documentation

CslibFrontier.Computability.Circuit.Decomposable

Decomposable DAGs: rectangles, multi-partition covers and threshold counting #

A decomposable DAG (DecomposableDAG) represents a set of inputs ι → U by nodes of three kinds, each about a set of coordinates, its scope, and accepting a set of assignments of its scope:

A rank decreasing from each node to its children makes the DAG acyclic. Nodes may be shared, different branches may split the coordinates in different ways, and neither smoothness nor determinism is built into the structure; instead, they are orthogonal predicates:

Over the alphabet Bool with literal and constant leaves, decomposable DAGs are the DNNFs of knowledge compilation, and deterministic decomposable DAGs are the d-DNNFs [Dar01].

Certificates and rectangles. A node occurs on an accepting certificate of an input x (DecomposableDAG.Occurs) when it is the root and accepts x, a child of an occurring union that accepts x, or a child of an occurring product. Even without smoothness, if a node occurs for x, then replacing the part of x on its scope by any assignment that the node accepts keeps the input accepted (DecomposableDAG.Occurs.mem_accepted). So the assignments accepted by a node and its contexts, the parts outside its scope of the inputs for which it occurs, form a rectangle inside the accepted set (DecomposableDAG.rectangle_subset) [BCMS16].

Multi-partition covers. Over finitely many coordinates (n ≥ 2) and an arbitrary alphabet U, walking down an accepting certificate from the root—always to the heavier child at a product and to an accepting child at a union—stops at a balanced node, a large leaf, or a union edge to a small child (DecomposableDAG.exists_isCover_size, DecomposableDAG.coverNumber_accepted_le_size), covering accepted by at most max 1 size balanced rectangles. When every union is binary and its scope is the union of its children's scopes (as in Cslib.Circuits.NNF), at most one child of a large union is small, giving a cover by at most |N| balanced rectangles (DecomposableDAG.exists_isCover_card, DecomposableDAG.coverNumber_accepted_le_card) [BCMS16].

Threshold counting. For a smooth decomposable DAG whose accepted set is K-rectangle-free with at least K elements, descending along a certificate of an accepted input x from the root to the lowest node v accepting at least K assignments charges at most (K - 1) ^ 2 inputs to each union edge and (K - 1) ^ 3 to each product (DecomposableDAG.ncard_accepted_le):

|accepted| ≤ (K - 1) ^ 2 · #(union edges) + (K - 1) ^ 3 · #(products).

For dense rectangle-free sets with small thresholds, every smooth decomposable DAG is therefore exponentially large.

Main definitions #

Main results #

References #

The gate at a node of a decomposable DAG on the nodes N.

  • leaf {N : Type u_3} : Gate N

    A leaf, accepting at most one assignment of its scope.

  • union {N : Type u_3} (children : Finset N) : Gate N

    A union of finitely many children.

  • product {N : Type u_3} (left right : N) : Gate N

    A product of two children.

structure Cslib.Circuits.DecomposableDAG (ι : Type u_3) (U : Type u_4) (N : Type u_5) :
Type (max (max u_3 u_4) u_5)

A decomposable DAG on the nodes N, representing a set of inputs ι → U. Each node has a scope, a set of coordinates, and accepts a set of assignments of its scope. The gate at a node is a leaf, accepting at most one assignment; a union of children, each with scope contained in that of the node, accepting what one of them accepts; or a product of two children whose scopes split the scope of the node into two disjoint parts, accepting what both accept. A rank decreasing from each node to its children makes the DAG acyclic. Smoothness (IsSmooth) and determinism (IsDeterministic) are orthogonal predicates rather than fields of the structure.

def Cslib.Circuits.DecomposableDAG.accepts {ι : Type u_1} {U : Type u_2} {N : Type u_3} (P : DecomposableDAG ι U N) (v : N) :
Set (ι → U)

The inputs accepted by a node: those whose part on its scope it accepts.

def Cslib.Circuits.DecomposableDAG.accepted {ι : Type u_1} {U : Type u_2} {N : Type u_3} (P : DecomposableDAG ι U N) :
Set (ι → U)

The set represented by the DAG: the inputs accepted by the root.

structure Cslib.Circuits.DecomposableDAG.IsSmooth {ι : Type u_1} {U : Type u_2} {N : Type u_3} (P : DecomposableDAG ι U N) :

A decomposable DAG is smooth (over all coordinates ι) when the root covers every coordinate and every child of a union has the same scope as the union.

def Cslib.Circuits.DecomposableDAG.IsDeterministic {ι : Type u_1} {U : Type u_2} {N : Type u_3} (P : DecomposableDAG ι U N) :

A decomposable DAG is deterministic when no two distinct children of any union node accept a common input.

theorem Cslib.Circuits.DecomposableDAG.accepts_congr {ι : Type u_1} {U : Type u_2} {N : Type u_3} (P : DecomposableDAG ι U N) {v : N} {x y : ι → U} (h : Set.EqOn x y (P.scope v)) :
x ∈ P.accepts v ↔ y ∈ P.accepts v

Acceptance at a node v depends only on the coordinates in P.scope v.

Certificates and rectangles #

inductive Cslib.Circuits.DecomposableDAG.Occurs {ι : Type u_1} {U : Type u_2} {N : Type u_3} (P : DecomposableDAG ι U N) (x : ι → U) :
N → Prop

A node occurs on an accepting certificate of the input x.

theorem Cslib.Circuits.DecomposableDAG.Occurs.accepts {ι : Type u_1} {U : Type u_2} {N : Type u_3} {P : DecomposableDAG ι U N} {x : ι → U} {v : N} (h : P.Occurs x v) :
x ∈ P.accepts v

A node occurring for x accepts x.

theorem Cslib.Circuits.DecomposableDAG.Occurs.mem_accepted_self {ι : Type u_1} {U : Type u_2} {N : Type u_3} {P : DecomposableDAG ι U N} {x : ι → U} {v : N} (h : P.Occurs x v) :

Any node occurring for x witnesses that x is accepted by the DAG.

theorem Cslib.Circuits.DecomposableDAG.Occurs.subst {ι : Type u_1} {U : Type u_2} {N : Type u_3} {P : DecomposableDAG ι U N} {x : ι → U} {v : N} (h : P.Occurs x v) {y : ι → U} (hy : y ∈ P.accepts v) (hout : Set.EqOn y x (P.scope v)ᶜ) :
P.Occurs y v

Certificate substitution. If a node occurs for x, then it also occurs for any input that the node accepts and that agrees with x outside the scope of the node.

theorem Cslib.Circuits.DecomposableDAG.Occurs.mem_accepted {ι : Type u_1} {U : Type u_2} {N : Type u_3} {P : DecomposableDAG ι U N} {x : ι → U} {v : N} (h : P.Occurs x v) {y : ι → U} (hy : y ∈ P.accepts v) (hout : Set.EqOn y x (P.scope v)ᶜ) :

Substitution. If a node occurs for x, then any input that the node accepts and that agrees with x outside the scope of the node is accepted.

def Cslib.Circuits.DecomposableDAG.contexts {ι : Type u_1} {U : Type u_2} {N : Type u_3} (P : DecomposableDAG ι U N) (v : N) :
Set (↑(P.scope v)ᶜ → U)

The contexts of a node: the parts outside its scope of the inputs for which it occurs.

theorem Cslib.Circuits.DecomposableDAG.occurs_eq_rectangle {ι : Type u_1} {U : Type u_2} {N : Type u_3} (P : DecomposableDAG ι U N) (v : N) :
{x : ι → U | P.Occurs x v} = Frontier.rectangle (P.scope v) (P.values v) (P.contexts v)

The inputs for which a node occurs form a rectangle when the node occurs for at least one input: they are the inputs whose part on P.scope v lies in P.values v and whose part outside lies in P.contexts v. (When v never occurs, P.contexts v is empty and both sets are empty.)

theorem Cslib.Circuits.DecomposableDAG.rectangle_subset {ι : Type u_1} {U : Type u_2} {N : Type u_3} (P : DecomposableDAG ι U N) (v : N) :

A node and its contexts form a rectangle inside the accepted set.

def Cslib.Circuits.DecomposableDAG.SmallSides {ι : Type u_1} {U : Type u_2} {N : Type u_3} (P : DecomposableDAG ι U N) (K : ℕ) :

Every node of P has fewer than K accepted assignments or fewer than K contexts, counted with Set.encard.

If the accepted set is K-rectangle-free, every node has a side smaller than K.

theorem Cslib.Circuits.DecomposableDAG.SmallSides.pos {ι : Type u_1} {U : Type u_2} {K : ℕ} {N : Type u_3} {P : DecomposableDAG ι U N} (h : P.SmallSides K) :
0 < K

The threshold of SmallSides is positive.

theorem Cslib.Circuits.DecomposableDAG.SmallSides.one_lt {ι : Type u_1} {U : Type u_2} {K : ℕ} {N : Type u_3} {P : DecomposableDAG ι U N} (h : P.SmallSides K) (hne : P.accepted.Nonempty) :
1 < K

When the accepted set is nonempty, SmallSides K forces 1 < K: the root has both a value and a context.

Threshold counting #

def Cslib.Circuits.DecomposableDAG.stops {ι : Type u_1} {U : Type u_2} {N : Type u_3} (P : DecomposableDAG ι U N) (K : ℕ) (v : N) :
Set (ι → U)

The inputs for which the descent to the threshold K stops at the node v: the node occurs for the input and accepts at least K assignments, while the children of v through which the input is accepted accept fewer.

theorem Cslib.Circuits.DecomposableDAG.exists_mem_stops {ι : Type u_1} {U : Type u_2} {K : ℕ} {N : Type u_3} (P : DecomposableDAG ι U N) (hsmooth : P.IsSmooth) (hK : 1 < K) (hS : K ≤ P.accepted.ncard) {x : ι → U} (hx : x ∈ P.accepted) :
∃ (v : N), x ∈ P.stops K v

The descent stops. If the accepted set of a smooth DAG has at least K > 1 elements, the descent from the root along a certificate of an accepted input stops at some node. The rank makes the descent finite, even with shared nodes.

def Cslib.Circuits.DecomposableDAG.unionEdges {ι : Type u_1} {U : Type u_2} {N : Type u_3} (P : DecomposableDAG ι U N) [Fintype N] :

The number of union edges: the children of each union, a shared child being counted once for each of its parents.

def Cslib.Circuits.DecomposableDAG.products {ι : Type u_1} {U : Type u_2} {N : Type u_3} (P : DecomposableDAG ι U N) [Fintype N] :

The number of products.

def Cslib.Circuits.DecomposableDAG.size {ι : Type u_1} {U : Type u_2} {N : Type u_3} (P : DecomposableDAG ι U N) [Fintype N] :

The size of the DAG: its union edges and its products. Leaves are free.

theorem Cslib.Circuits.DecomposableDAG.ncard_accepted_le_of_smallSides {ι : Type u_1} {U : Type u_2} {K : ℕ} {N : Type u_3} (P : DecomposableDAG ι U N) [Fintype N] (hsmooth : P.IsSmooth) (hsmall : P.SmallSides K) (hS : K ≤ P.accepted.ncard) :
P.accepted.ncard ≤ (K - 1) ^ 2 * P.unionEdges + (K - 1) ^ 3 * P.products

Threshold counting under SmallSides. If every node of a smooth decomposable DAG has a side smaller than K and the accepted set has at least K elements, then

|accepted| ≤ (K - 1) ^ 2 · #(union edges) + (K - 1) ^ 3 · #(products).

theorem Cslib.Circuits.DecomposableDAG.ncard_accepted_le {ι : Type u_1} {U : Type u_2} {K : ℕ} {N : Type u_3} (P : DecomposableDAG ι U N) [Fintype N] (hsmooth : P.IsSmooth) (hrect : Frontier.RectangleFree P.accepted K) (hS : K ≤ P.accepted.ncard) :
P.accepted.ncard ≤ (K - 1) ^ 2 * P.unionEdges + (K - 1) ^ 3 * P.products

Threshold counting for smooth decomposable DAGs. If the set represented by a smooth decomposable DAG is K-rectangle-free and has at least K elements, then

|accepted| ≤ (K - 1) ^ 2 · #(union edges) + (K - 1) ^ 3 · #(products).

Unions need not be disjoint, and different branches may split the coordinates differently.

theorem Cslib.Circuits.DecomposableDAG.ncard_accepted_le_size {ι : Type u_1} {U : Type u_2} {K : ℕ} {N : Type u_3} (P : DecomposableDAG ι U N) [Fintype N] (hsmooth : P.IsSmooth) (hrect : Frontier.RectangleFree P.accepted K) (hS : K ≤ P.accepted.ncard) :
P.accepted.ncard ≤ (K - 1) ^ 3 * P.size

Threshold counting by size. If the set represented by a smooth decomposable DAG is K-rectangle-free and has at least K elements, then |accepted| ≤ (K - 1) ^ 3 · size.

Multi-partition balanced rectangle covers #

theorem Cslib.Circuits.DecomposableDAG.exists_isCover_size {ι : Type u_1} {U : Type u_2} {N : Type u_3} [Fintype ι] [DecidableEq ι] [Fintype N] (P : DecomposableDAG ι U N) (hn : 2 ≤ Fintype.card ι) :
∃ (R : Fin (max 1 P.size) → Set (ι → U)), Communication.MultiPartition.IsCover P.accepted R

BCMS multi-partition cover by size. Over n ≥ 2 coordinates and an arbitrary alphabet U, any (not necessarily smooth or deterministic) decomposable DAG admits a cover of its accepted set by max 1 P.size balanced rectangles [BCMS16].

BCMS cover-number bound by size. Over n ≥ 2 coordinates and an arbitrary alphabet U, the multi-partition rectangle cover number of a decomposable DAG is at most max 1 P.size [BCMS16].

theorem Cslib.Circuits.DecomposableDAG.exists_isCover_card {ι : Type u_1} {U : Type u_2} {N : Type u_3} [Fintype ι] [DecidableEq ι] [Fintype N] (P : DecomposableDAG ι U N) (hn : 2 ≤ Fintype.card ι) (hbin : ∀ (v : N) (c : Finset N), P.gate v = Gate.union c → c.card ≤ 2 ∧ P.scope v = ⋃ u ∈ c, P.scope u) :

BCMS multi-partition cover by node count for decomposable DAGs with binary unions whose scope is the union of their children's scopes (such as Cslib.Circuits.NNF): over n ≥ 2 coordinates and an arbitrary alphabet U, P.accepted is covered by Fintype.card N balanced rectangles [BCMS16].

theorem Cslib.Circuits.DecomposableDAG.coverNumber_accepted_le_card {ι : Type u_1} {U : Type u_2} {N : Type u_3} [Fintype ι] [DecidableEq ι] [Fintype N] (P : DecomposableDAG ι U N) (hn : 2 ≤ Fintype.card ι) (hbin : ∀ (v : N) (c : Finset N), P.gate v = Gate.union c → c.card ≤ 2 ∧ P.scope v = ⋃ u ∈ c, P.scope u) :

BCMS cover-number bound by node count for binary-union decomposable DAGs over n ≥ 2 coordinates and an arbitrary alphabet U [BCMS16].