Negation normal form circuits, DNNF and d-DNNF #
A negation normal form circuit (NNF, also called a De Morgan circuit) over variables ι is a
directed acyclic graph whose nodes are literals xᵢ or ¬xᵢ, constants, or fan-in-two ∧ and
∨ gates (Cslib.Circuits.NNF). Nodes are numbered 0, …, size - 1 and every gate's children
have smaller numbers, so nodes are shared: the circuit is a DAG, not a formula, and its size is
its number of nodes (gates, literals and constants alike). One node is the output.
- An
∧gate is decomposable when its two children mention disjoint sets of variables (NNF.vars); a circuit all of whose∧gates are decomposable is a DNNF (NNF.IsDecomposable) [Dar01]. - An
∨gate is deterministic when on no assignment both of its children evaluate to true; a DNNF all of whose∨gates are deterministic is a d-DNNF (NNF.IsDeterministic) [Dar01].
These are the definitions of [ArenasBroadrickLiewVanDenBroeck2026, Section 3.1], with constant leaves also allowed, as in [Dar01]. Allowing constants only enlarges the class against which lower bounds hold.
Relation to DecomposableDAG and Circuit.IsDeterministicDecomposable.
Cslib.Circuits.DecomposableDAG (CslibFrontier/Computability/Circuit/Decomposable.lean) is the
semantic model of (not necessarily smooth) decomposable DAGs over an arbitrary alphabet. Every
decomposable NNF embeds into it on the same node set via
NNF.IsDecomposable.toDecomposableDAG (CslibFrontier/Computability/Circuit/NNF/Rectangle.lean),
preserving acceptance and determinism, and specializing the general multi-partition rectangle cover
theorem to DNNF size. Every NNF on Fin n also compiles into a De Morgan straight-line circuit
via NNF.toCircuit (CslibFrontier/Computability/Circuit/Boolean/DeterministicDecomposable.lean),
mapping d-DNNFs into Circuit.IsDeterministicDecomposable and hence into syntactically multilinear
arithmetic circuits (NNF.exists_syntacticallyMultilinear). This file keeps the syntactic NNF
model with literal leaves, explicit node sharing and node-count size matching the paper.
Evaluation and variable sets are both instances of one bottom-up fold (NNF.fold, with the
unfolding equation NNF.fold_eq), defined by structural recursion on a bound for the node
number, so concrete circuits evaluate by decide.
Main definitions #
Cslib.Circuits.NNF.Gate,Cslib.Circuits.NNF: NNF gates and NNF circuits.Cslib.Circuits.NNF.eval,Cslib.Circuits.NNF.toFun: the value of a node and the function computed by the circuit.Cslib.Circuits.NNF.vars: the variables mentioned below a node.Cslib.Circuits.NNF.IsDecomposable,Cslib.Circuits.NNF.IsDeterministic: DNNF and the determinism of every∨gate.
Main results #
Cslib.Circuits.NNF.eval_congr: a node's value depends only on the variables it mentions.
References #
A gate of a negation normal form circuit over the variables ι, with children among the
nodes N.
- lit {ι : Type u_1} {N : Type u_2} (i : ι) (b : Bool) : Gate ι N
The literal
xᵢwhenbis true,¬xᵢwhenbis false. - const {ι : Type u_1} {N : Type u_2} (b : Bool) : Gate ι N
A constant.
- and {ι : Type u_1} {N : Type u_2} (l r : N) : Gate ι N
A fan-in-two conjunction.
- or {ι : Type u_1} {N : Type u_2} (l r : N) : Gate ι N
A fan-in-two disjunction.
A negation normal form circuit (NNF) over the variables ι on the nodes N: every node is
a literal, a constant, or a fan-in-two ∧ or ∨ gate, a rank decreasing from each gate to its
children makes the graph acyclic, and one node is the output. Nodes may be shared, so this is a
DAG. For finite N, its size is the number of nodes (NNF.size).
- gate : N → Gate ι N
The gate at each node.
- rank : N → ℕ
A rank that decreases from each gate to its children.
- and_lt (v l r : N) : self.gate v = Gate.and l r → self.rank l < self.rank v ∧ self.rank r < self.rank v
The children of an
∧gate have lower rank. - or_lt (v l r : N) : self.gate v = Gate.or l r → self.rank l < self.rank v ∧ self.rank r < self.rank v
The children of an
∨gate have lower rank. - root : N
The output node.
The variables mentioned by the subcircuit below a node.
A circuit is decomposable (a DNNF) when the two children of each of its ∧ gates
mention disjoint sets of variables.