Documentation

Complexity.Computability.Circuit.Boolean.NegationNormalForm

Negation normal form of De Morgan formulas #

Pushing the negations of a De Morgan formula to the inputs by De Morgan's laws, cancelling double negations and evaluating negated constants, gives a formula in negation normal form (Formula.nnf), with negations only directly on inputs (Formula.IsNNF, Formula.isNNF_nnf). It computes the same function (Formula.eval_nnf) with the same leaves (Formula.leafSize_nnf) Jukna, Chapter 6. Its depth counts every gate, negations included, and is at most one more than the number of AND and OR gates on a path of the original formula (Formula.depth_nnf_le). So the depth of a function with negations and constants free, Boolean.formulaDepth, and its depth with every gate counted differ by at most one (Formula.depthWith_le_depth, Boolean.exists_computes_depth_le_formulaDepth_add_one).

Main definitions #

Main results #

References #

The negation normal form of a De Morgan formula, of its negation when b is true: negations are pushed to the inputs by De Morgan's laws, double negations cancel, and negated constants are evaluated.

Instances For

    A De Morgan formula is in negation normal form when its negations apply directly to inputs: it is built from inputs, negated inputs and constants by conjunctions and disjunctions.

    Instances For

      A balanced disjunction of formulas in negation normal form is in negation normal form.

      A balanced conjunction of formulas in negation normal form is in negation normal form.

      The negation normal form is in negation normal form.

      @[simp]

      The negation normal form computes the formula, negated when b is true.

      @[simp]

      The negation normal form has the leaves of the formula.

      The negation normal form is deeper than the formula with negations and constants free by at most one.

      Every Boolean function has a De Morgan formula whose depth, counting every gate, is at most its formula depth plus one.