Documentation

Complexity.Computability.Circuit.Decomposable

Threshold counting for decomposable DAGs #

A smooth 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:

The root has every coordinate in its scope, and a rank decreasing from each node to its children makes the DAG acyclic. Nodes may be shared, unions need not be disjoint (the DAG need not be deterministic), and different branches may split the coordinates in different ways. Over the alphabet Bool with literal leaves, these are the smooth DNNFs of knowledge compilation [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. 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].

Threshold counting. Let the accepted set be K-rectangle-free with at least K elements. Descend along a certificate of an accepted input x, from the root, to the lowest node v that accepts at least K assignments, so that the children of v on the certificate accept fewer. By rectangle-freeness v has fewer than K contexts. If v is a union, then x is determined by a child accepting it, its part on that child, and its context; if v is a product, by its parts on both children and its context. So each union edge is charged at most (K - 1) ^ 2 inputs and each product at most (K - 1) ^ 3 (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.

Instances For
    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 smooth 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 the scope 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. The root has every coordinate in its scope, and a rank decreasing from each node to its children makes the DAG acyclic.

    Instances For
      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.

      Instances For
        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.

        Instances For
          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

          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.

          Instances For
            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 {ι : 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.

            Instances For
              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.

              theorem Cslib.Circuits.DecomposableDAG.ncard_contexts_le {ι : Type u_1} {U : Type u_2} {K : ℕ} {N : Type u_3} (P : DecomposableDAG ι U N) (hS : Frontier.RectangleFree P.accepted K) {v : N} (hv : K ≤ (P.values v).ncard) :
              (P.contexts v).ncard ≤ K - 1

              A node accepting at least K assignments has fewer than K contexts, when the accepted set is K-rectangle-free.

              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.

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

                The threshold budget of a node: (K - 1) ^ 2 for each child of a union and (K - 1) ^ 3 for a product.

                Instances For
                  theorem Cslib.Circuits.DecomposableDAG.exists_mem_stops {ι : Type u_1} {U : Type u_2} {K : ℕ} {N : Type u_3} (P : DecomposableDAG ι U N) [Finite ι] [Finite U] (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 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.

                  theorem Cslib.Circuits.DecomposableDAG.ncard_stops_le {ι : Type u_1} {U : Type u_2} {K : ℕ} {N : Type u_3} (P : DecomposableDAG ι U N) [Finite ι] [Finite U] (hS : Frontier.RectangleFree P.accepted K) (v : N) :
                  (P.stops K v).ncard ≤ P.budget K v

                  The charge at a node. If the accepted set is K-rectangle-free, the descent stops at a node v for at most the budget of v inputs.

                  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.

                  Instances For
                    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.

                    Instances For
                      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.

                      Instances For
                        theorem Cslib.Circuits.DecomposableDAG.ncard_accepted_le {ι : Type u_1} {U : Type u_2} {K : ℕ} {N : Type u_3} (P : DecomposableDAG ι U N) [Finite ι] [Finite U] [Fintype N] (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 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) [Finite ι] [Finite U] [Fintype N] (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.