In mathematical logic, a formula is in negation normal form (NNF) if the negation operator (
lnot
\land
\lor
Negation normal form is not a canonical form: for example,
a\land(b\lorlnotc)
(a\landb)\lor(a\landlnotc)
In classical logic and many modal logics, every formula can be brought into this form by replacing implications and equivalences 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:
\begin{align} A ⇒ B&~\to~lnotA\lorB\\ A\LeftrightarrowB&~\to~(lnotA\lorB)\land(A\lorlnotB)\\ lnot(A\lorB)&~\to~lnotA\landlnotB\\ lnot(A\landB)&~\to~lnotA\lorlnotB\\ lnotlnotA&~\to~A\\ lnot\existsxA&~\to~\forallxlnotA\\ lnot\forallxA&~\to~\existsxlnotA \end{align}
(In these rules, the
⇒
\to
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
\land
\lor
lnot
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.
The following formulae are all in negation normal form:
\begin{align} (A&\veeB)\wedgeC\\ (A&\wedge(lnotB\veeC)\wedgelnotC)\veeD\\ A&\veelnotB\\ A&\wedgelnotB \end{align}
The first example is also in conjunctive normal form and the last two are in both conjunctive normal form and disjunctive normal form, but the second example is in neither.
The following formulae are not in negation normal form:
\begin{align} A& ⇒ B\\ lnot(A&\veeB)\\ lnot(A&\wedgeB)\\ lnot(A&\veelnotC) \end{align}
They are however respectively equivalent to the following formulae in negation normal form:
\begin{align} lnotA&\veeB\\ lnotA&\wedgelnotB\\ lnotA&\veelnotB\\ lnotA&\wedgeC \end{align}