Documentation

CslibFrontier.Computability.Circuit.Boolean.DeterministicDecomposable

Deterministic decomposable circuits #

A deterministic decomposable circuit (d-D) is a Boolean circuit with constants, inputs, and AND, OR and NOT gates in which every AND is decomposable, its arguments reading disjoint sets of inputs, and every OR is deterministic, at most one of its arguments being true on any input Monet and Olteanu, Definition 3. NOT gates may occur anywhere, not only at the inputs as in a d-DNNF. Both conditions are pairwise over the arguments of a gate. Decomposability is a syntactic condition on the inputs that can reach each argument (Cslib.Circuits.Program.IsDecomposableAt); determinism is a semantic condition on the values.

Here the circuits are those of the De Morgan basis (Cslib.Circuits.Boolean.signature), with binary AND and OR and also Boolean constants, and size counts gates (Cslib.Circuits.Circuit.size). An unbounded fan-in AND or OR with k arguments is a binary tree of k - 1 gates of the same kind, which is decomposable or deterministic when the original gate is, so a d-D with unbounded fan-in and s wires gives a binary one with at most s AND and OR gates, besides its NOT gates and constants.

Positions, not predecessors. Definition 3 compares the distinct predecessor gates of an AND or OR. Here the conditions compare argument positions, and two positions of a gate can read the same earlier line. Such a gate can fail the conditions even with one distinct predecessor: x ∨ x is not deterministic at x = true, and x ∧ x is not decomposable, both arguments reading {x}. So the definitions agree with Definition 3 for circuits whose ANDs and ORs have distinct predecessors, which removing repeated arguments achieves (x ∧ x and x ∨ x are x). The positional form is the one the arithmetic simulation of #8623 uses, where an AND becomes a product of its arguments.

The conditions are stated gate by gate on the lines of the program (Cslib.Circuits.Program.lines), so they are decidable, and they split along the last gate (Cslib.Circuits.Program.isDecomposableAt_gate_iff, Cslib.Circuits.Program.isDeterministic_gate_iff).

Embedding d-DNNFs (NNF.toCircuit). Sorting the nodes of an NNF (Fin n) N by rank compiles it into a De Morgan circuit Circuit Boolean.signature n 1 with at most C.size gates (zero gates for positive literals and one gate for each other node), preserving evaluation (NNF.eval_toCircuit), decomposability (NNF.isDecomposableAt_toCircuit) and determinism (NNF.isDeterministic_toCircuit). In particular, every d-DNNF is a d-D (NNF.isDeterministicDecomposable_toCircuit). The converse fails: Circuit.IsDeterministicDecomposable allows internal NOT gates (so negating any d-D costs one gate), whereas NNF pushes negations to leaves, a gap witnessed per-graph for balanced-cut cubic 3-edge-coloured expanders in CslibFrontier/Computability/Circuit/NNF/Negation/Separation.lean (CubicEdgeColoring.ddnnf_negation_separation, conditional exponential family step NNF.exponential_separation_of_expanders, open unconditionally under #4668).

Main definitions #

Main results #

References #

Every OR of a De Morgan program is deterministic: no input makes two distinct arguments of it true Monet and Olteanu, Definition 3.

Instances For
    @[simp]

    The empty program is deterministic.

    @[simp]

    A program with one more gate is deterministic when the earlier gates are and, if the new gate is an OR, no input makes two distinct arguments of it true.

    A deterministic decomposable circuit (d-D): a De Morgan circuit whose ANDs are decomposable and whose ORs are deterministic, with NOT gates anywhere Monet and Olteanu, Definition 3.

    Instances For

      Compiling NNF circuits into De Morgan circuits #

      noncomputable def Cslib.Circuits.NNF.toCircuit {n : ℕ} {N : Type u_1} [Fintype N] (C : NNF (Fin n) N) :

      Compile an NNF circuit on Fin n into a De Morgan straight-line circuit Circuit Boolean.signature n 1: positive literals reuse input wires directly and every other node becomes one De Morgan gate.

      theorem Cslib.Circuits.NNF.size_toCircuit_le {n : ℕ} {N : Type u_1} [Fintype N] (C : NNF (Fin n) N) :

      The compiled circuit has at most C.size gates (positive literals cost zero gates).

      theorem Cslib.Circuits.NNF.eval_toCircuit {n : ℕ} {N : Type u_1} [Fintype N] (C : NNF (Fin n) N) (x : Fin n → Bool) :

      The compiled circuit computes the same Boolean function as C.

      Compiling a decomposable NNF produces a De Morgan program decomposable at AND gates.

      Compiling a deterministic NNF produces a deterministic De Morgan program.

      Every d-DNNF compiles to a deterministic decomposable circuit (d-D) of at most the same size. The converse fails because Circuit.IsDeterministicDecomposable permits internal NOT gates, whereas NNF restricts negations to leaves (see CslibFrontier/Computability/Circuit/NNF/Negation/Separation.lean).