Negation normal form

Revision as of 02:00, 9 May 2025 by imported>Marc Schroeder (→‎Definition: better layout of context-free grammar)
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

Template:Short description In mathematical logic, a formula is in negation normal form (NNF) if the negation operator (<math>\lnot</math>, Template:Smallcaps) is only applied to variables and the only other allowed Boolean operators are conjunction (<math>\land</math>, Template:Smallcaps) and disjunction (<math>\lor</math>, Template:Smallcaps).

Negation normal form is not a canonical form: for example, <math>a \land (b\lor \lnot c)</math> and <math>(a \land b) \lor (a \land \lnot c)</math> are equivalent, and are both in negation normal form.

DefinitionEdit

The following is a context-free grammar for NNF:

NNF <math>\to</math> Literal
Template:Spaces<math>\mid \quad</math>( NNF <math>\, \land \,</math> NNF Template:Spaces)
Template:Spaces<math>\mid \quad</math>( NNF <math>\, \lor \,</math> NNF Template:Spaces)
Literal <math>\to</math> Variable
Template:Spaces<math>\mid \quad \neg \,</math> Variable

where Variable is any variable.

Examples and counterexamplesEdit

         ∨
       /   \
      ∧     D
    /   \
   ∧     ¬
 /   \   |
A     ∨  C
     /  \
    ¬    C
    |
    B         

The following formulae are all in negation normal form:

<math>\begin{align}

&((A \lor B) \land C) \\ &(A \lor \lnot B) \\ &(A \land \lnot B) \\ &\{[(A \land (\lnot B \lor C)) \land \lnot C] \lor D \} \end{align}</math> The first example is also in conjunctive normal form, the next two are in both conjunctive normal form and disjunctive normal form, but the last example is in neither.

The following formulae are not in negation normal form:

<math>\begin{align}
        (A &\to B) \\
 \lnot (A &\lor B) \\
 \lnot (A &\land B) \\
 \lnot (A &\lor \lnot C)

\end{align}</math>

They are however respectively equivalent to the following formulae in negation normal form:

<math>\begin{align}
 (\lnot A &\lor B) \\
 (\lnot A &\land \lnot B) \\
 (\lnot A &\lor \lnot B) \\
 (\lnot A &\land C)

\end{align}</math>

Conversion to NNFEdit

In classical logic and many modal logics, every formula can be brought into this form by replacing implications (<math>\to</math>) and equivalences (<math>\leftrightarrow</math>) by their definitions, using De Morgan's laws to push negation inwards, and eliminating double negations. This process can be represented using the following rewrite rules:Template:Sfn

<math>\begin{align}
   A \to B &~\rightsquigarrow~ \lnot A \lor B \\
   A \leftrightarrow B &~\rightsquigarrow~ (\lnot A \lor B) \land (A \lor \lnot B) \\
  \lnot (A \lor B) &~\rightsquigarrow~ \lnot A \land \lnot B \\
 \lnot (A \land B) &~\rightsquigarrow~ \lnot A \lor \lnot B \\
     \lnot \lnot A &~\rightsquigarrow~ A \\
 \lnot \exists x A &~\rightsquigarrow~ \forall x \lnot A \\
 \lnot \forall x A &~\rightsquigarrow~ \exists x \lnot A

\end{align}</math>

Transformation into negation normal form can increase the size of a formula only linearly: the number of occurrences of atomic formulas remains the same, the total number of occurrences of <math>\land</math> and <math>\lor</math> is unchanged, and the number of occurrences of <math>\lnot</math> in the normal form is bounded by the length of the original formula.

A formula in negation normal form can be put into the stronger conjunctive normal form or disjunctive normal form by applying distributivity. Repeated application of distributivity may exponentially increase the size of a formula. In the classical propositional logic, transformation to negation normal form does not impact computational properties: the satisfiability problem continues to be NP-complete, and the validity problem continues to be co-NP-complete. For formulas in conjunctive normal form, the validity problem is solvable in polynomial time, and for formulas in disjunctive normal form, the satisfiability problem is solvable in polynomial time.

See alsoEdit

NotesEdit

Template:Reflist

ReferencesEdit

External linksEdit

Template:Normal forms in logic