Documentation

CslibFrontier.Computability.Circuit.NNF.Disjunction

Disjunctions of NNF circuits #

The disjunction of two NNF circuits (NNF.disj) is their disjoint union with a new ∨ output: its nodes are Option (N₁ ⊕ N₂), so its size is the sum of their sizes plus one (NNF.size_disj). It computes the disjunction of their functions (NNF.toFun_disj), is a DNNF when both are (NNF.isDecomposable_disj), and is a d-DNNF when moreover the two functions are never true together (NNF.isDeterministic_disj).

Copies of a circuit inside a larger one compute the same values (NNF.eval_eq_of_gate_map, NNF.vars_eq_of_gate_map).

Main definitions #

Main results #

def Cslib.Circuits.NNF.Gate.map {ι : Type u_1} {N : Type u_2} {N' : Type u_3} (f : N → N') :
Gate ι N → Gate ι N'

Relabel the children of a gate.

theorem Cslib.Circuits.NNF.eval_eq_of_gate_map {ι : Type u_1} {N : Type u_2} {N' : Type u_3} {C : NNF ι N} {C' : NNF ι N'} (f : N → N') (hf : ∀ (v : N), C'.gate (f v) = Gate.map f (C.gate v)) (x : ι → Bool) (v : N) :
C'.eval x (f v) = C.eval x v

Copies compute the same values. If f maps each node of C to a node of C' whose gate is that of the node with its children mapped by f, then f preserves values.

theorem Cslib.Circuits.NNF.vars_eq_of_gate_map {ι : Type u_1} {N : Type u_2} {N' : Type u_3} [DecidableEq ι] {C : NNF ι N} {C' : NNF ι N'} (f : N → N') (hf : ∀ (v : N), C'.gate (f v) = Gate.map f (C.gate v)) (v : N) :
C'.vars (f v) = C.vars v

Copies mention the same variables.

def Cslib.Circuits.NNF.disjGate {ι : Type u_1} {N₁ : Type u_4} {N₂ : Type u_5} (C₁ : NNF ι N₁) (C₂ : NNF ι N₂) :
Option (N₁ ⊕ N₂) → Gate ι (Option (N₁ ⊕ N₂))

The gate at a node of the disjunction of two circuits.

def Cslib.Circuits.NNF.disjRank {ι : Type u_1} {N₁ : Type u_4} {N₂ : Type u_5} (C₁ : NNF ι N₁) (C₂ : NNF ι N₂) :
Option (N₁ ⊕ N₂) → ℕ

The rank of a node of the disjunction of two circuits.

def Cslib.Circuits.NNF.disj {ι : Type u_1} {N₁ : Type u_4} {N₂ : Type u_5} (C₁ : NNF ι N₁) (C₂ : NNF ι N₂) :
NNF ι (Option (N₁ ⊕ N₂))

The disjunction of two circuits: their disjoint union with a new ∨ output.

theorem Cslib.Circuits.NNF.eval_disj_inl {ι : Type u_1} {N₁ : Type u_4} {N₂ : Type u_5} (C₁ : NNF ι N₁) (C₂ : NNF ι N₂) (x : ι → Bool) (v : N₁) :
(C₁.disj C₂).eval x (some (Sum.inl v)) = C₁.eval x v
theorem Cslib.Circuits.NNF.eval_disj_inr {ι : Type u_1} {N₁ : Type u_4} {N₂ : Type u_5} (C₁ : NNF ι N₁) (C₂ : NNF ι N₂) (x : ι → Bool) (v : N₂) :
(C₁.disj C₂).eval x (some (Sum.inr v)) = C₂.eval x v
theorem Cslib.Circuits.NNF.vars_disj_inl {ι : Type u_1} {N₁ : Type u_4} {N₂ : Type u_5} (C₁ : NNF ι N₁) (C₂ : NNF ι N₂) [DecidableEq ι] (v : N₁) :
(C₁.disj C₂).vars (some (Sum.inl v)) = C₁.vars v
theorem Cslib.Circuits.NNF.vars_disj_inr {ι : Type u_1} {N₁ : Type u_4} {N₂ : Type u_5} (C₁ : NNF ι N₁) (C₂ : NNF ι N₂) [DecidableEq ι] (v : N₂) :
(C₁.disj C₂).vars (some (Sum.inr v)) = C₂.vars v
theorem Cslib.Circuits.NNF.toFun_disj {ι : Type u_1} {N₁ : Type u_4} {N₂ : Type u_5} (C₁ : NNF ι N₁) (C₂ : NNF ι N₂) (x : ι → Bool) :
(C₁.disj C₂).toFun x = (C₁.toFun x || C₂.toFun x)

The disjunction computes the disjunction of the two functions.

theorem Cslib.Circuits.NNF.isDecomposable_disj {ι : Type u_1} {N₁ : Type u_4} {N₂ : Type u_5} {C₁ : NNF ι N₁} {C₂ : NNF ι N₂} [DecidableEq ι] (h₁ : C₁.IsDecomposable) (h₂ : C₂.IsDecomposable) :
(C₁.disj C₂).IsDecomposable

The disjunction of two DNNFs is a DNNF.

theorem Cslib.Circuits.NNF.isDeterministic_disj {ι : Type u_1} {N₁ : Type u_4} {N₂ : Type u_5} {C₁ : NNF ι N₁} {C₂ : NNF ι N₂} (h₁ : C₁.IsDeterministic) (h₂ : C₂.IsDeterministic) (hex : ∀ (x : ι → Bool), ¬(C₁.toFun x = true ∧ C₂.toFun x = true)) :
(C₁.disj C₂).IsDeterministic

The disjunction of two d-DNNFs computing functions that are never true together is a d-DNNF.

theorem Cslib.Circuits.NNF.size_disj {ι : Type u_1} {N₁ : Type u_4} {N₂ : Type u_5} {C₁ : NNF ι N₁} {C₂ : NNF ι N₂} [Fintype N₁] [Fintype N₂] :
(C₁.disj C₂).size = C₁.size + C₂.size + 1

The size of a disjunction.