In boolean logic, a disjunctive normal form (DNF) is a canonical normal form of a logical formula consisting of a disjunction of conjunctions; it can also be described as an OR of ANDs, a sum of products, or in philosophical logic a cluster concept. As a normal form, it is useful in automated theorem proving.
A logical formula is considered to be in DNF if it is a disjunction of one or more conjunctions of one or more literals. A DNF formula is in full disjunctive normal form if each of its variables appears exactly once in every conjunction and each conjunction appears at most once (up to the order of variables). As in conjunctive normal form (CNF), the only propositional operators in DNF are and (
\wedge
\vee
\neg
The following is a context-free grammar for DNF:
\vee
\wedge
\neg
Where Variable is any variable.
For example, all of the following formulas are in DNF:
(A\land\negB\land\negC)\lor(\negD\landE\landF\landD\landF)
(A\landB)\lor(C)
(A\landB)
(A)
The formula
A\lorB
(A\landB)\lor(A\landlnotB)\lor(lnotA\landB)
The following formulas are not in DNF:[1]
\neg(A\lorB)
\neg(A\landB)\lorC
A\lor(B\land(C\lorD))
In classical logic each propositional formula can be converted to DNF ...
The conversion involves using logical equivalences, such as double negation elimination, De Morgan's laws, and the distributive law. Formulas built from the primitive connectives
\{\land,\lor,lnot\}
\begin{array}{rcl} (lnotlnotx)&\rightsquigarrow&x\\ (lnot(x\lory))&\rightsquigarrow&((lnotx)\land(lnoty))\\ (lnot(x\landy))&\rightsquigarrow&((lnotx)\lor(lnoty))\\ (x\land(y\lorz))&\rightsquigarrow&((x\landy)\lor(x\landz))\\ ((x\lory)\landz)&\rightsquigarrow&((x\landz)\lor(y\landz))\\ \end{array}
The full DNF of a formula can be read off its truth table. For example, consider the formula
\phi=((lnot(p\landq))\leftrightarrow(lnotr\uparrow(p ⊕ q)))
The corresponding truth table is
p | q | r | ( | lnot | (p\landq) | ) | \leftrightarrow | ( | lnotr | \uparrow | (p ⊕ q) | ) | ||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
T | T | T | F | T | F | F | T | F | ||||||
T | T | F | F | T | F | T | T | F | ||||||
T | F | T | T | F | T | F | T | T | ||||||
T | F | F | T | F | F | T | F | T | ||||||
F | T | T | T | F | T | F | T | T | ||||||
F | T | F | T | F | F | T | F | T | ||||||
F | F | T | T | F | T | F | T | F | ||||||
F | F | F | T | F | T | T | T | F |
\phi
(p\landlnotq\landr)\lor (lnotp\landq\landr)\lor (lnotp\landlnotq\landr)\lor (lnotp\landlnotq\landlnotr)
lnot\phi
(p\landq\landr)\lor (p\landq\landlnotr)\lor (p\landlnotq\landlnotr)\lor (lnotp\landq\landlnotr)
A propositional formula can be represented by one and only one full DNF. In contrast, several plain DNFs may be possible. For example, by applying the rule
((a\landb)\lor(lnota\landb))\rightsquigarrowb
\phi
(lnotp\landlnotq)\lor(lnotp\landr)\lor(lnotq\landr)
It is a theorem that all consistent formulas in propositional logic can be converted to disjunctive normal form.[4] [5] [6] This is called the Disjunctive Normal Form Theorem. The formal statement is as follows:
Disjunctive Normal Form Theorem: SupposeThe proof follows from the procedure given above for generating DNFs from truth tables. Formally, the proof is as follows:is a sentence in a propositional languageX
withl{L}
sentence letters, which we shall denote byn
. IfA1,...,An
is not a contradiction, then it is truth-functionally equivalent to a disjunction of conjunctions of the formX
, where\pmA1\land...\land\pmAn
, and+Ai=Ai
.[7]-Ai=\negAi
SupposeThis theorem is a convenient way to derive many useful metalogical results in propositional logic, such as, trivially, the result that the set of connectivesis a sentence in a propositional language whose sentence letters areX
. For each row ofA,B,C,\ldots
's truth table, write out a corresponding conjunctionX
, where\pmA\land\pmB\land\pmC\land\ldots
is defined to be\pmA
ifA
takes the valueA
at that row, and isT
if\negA
takes the valueA
at that row; similarly forF
,\pmB
, etc. (the alphabetical ordering of\pmC
in the conjunctions is quite arbitrary; any other could be chosen instead). Now form the disjunction of all these conjunctions which correspond toA,B,C,\ldots
rows ofT
's truth table. This disjunction is a sentence inX
,[8] which by the reasoning above is truth-functionally equivalent tol{L}[A,B,C,\ldots;\land,\lor,\neg]
. This construction obviously presupposes thatX
takes the valueX
on at least one row of its truth table; ifT
doesn’t, i.e., ifX
is a contradiction, thenX
is equivalent toX
, which is, of course, also a sentence inA\land\negA
.l{L}[A,B,C,\ldots;\land,\lor,\neg]
\{\land,\lor,\neg\}
n
n\ge1
There are
2n
L=\{p1,lnotp1,p2,lnotp2,\ldots,pn,lnotpn\}
L
(22n-1)
This is the maximum number of conjunctions a DNF can have.
A full DNF can have up to
2n
Example 1
Consider a formula with two variables
p
q
The longest possible DNF has
2(2-1=15
\begin{array}{lcl} (lnotp)\lor(p)\lor(lnotq)\lor(q)\lor\\ (lnotp\landp)\lor \underline{(lnotp\landlnotq)}\lor \underline{(lnotp\landq)}\lor \underline{(p\landlnotq)}\lor \underline{(p\landq)}\lor (lnotq\landq)\lor\\ (lnotp\landp\landlnotq)\lor (lnotp\landp\landq)\lor (lnotp\landlnotq\landq)\lor (p\landlnotq\landq)\lor\\ (lnotp\landp\landlnotq\landq) \end{array}
The longest possible full DNF has 4 conjunctions: they are underlined.
This formula is a tautology.
Example 2
Each DNF of the e.g. formula
(X1\lorY1)\land(X2\lorY2)\land...\land(Xn\lorYn)
2n
The Boolean satisfiability problem on conjunctive normal form formulas is NP-complete. By the duality principle, so is the falsifiability problem on DNF formulas. Therefore, it is co-NP-hard to decide if a DNF formula is a tautology.
Conversely, a DNF formula is satisfiable if, and only if, one of its conjunctions is satisfiable. This can be decided in polynomial time simply by checking that at least one conjunction does not contain conflicting literals.
An important variation used in the study of computational complexity is k-DNF. A formula is in k-DNF if it is in DNF and each conjunction contains at most k literals.
\phi
A,B,C,\ldots
\{\land,\lor,\neg\}
\left|l{P}(L)\right|=22n