Disjunctive normal form explained

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.

Definition

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

), or (

\vee

), and not (

\neg

). The not operator can only be used as part of a literal, which means that it can only precede a propositional variable.

The following is a context-free grammar for DNF:

  1. DNF → (Conjunction)

\vee

DNF
  1. DNF → (Conjunction)
  2. ConjunctionLiteral

\wedge

Conjunction
  1. ConjunctionLiteral
  2. Literal

\neg

Variable
  1. LiteralVariable

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

is in DNF, but not in full DNF; an equivalent full-DNF version is

(A\landB)\lor(A\landlnotB)\lor(lnotA\landB)

.

The following formulas are not in DNF:[1]

\neg(A\lorB)

, since an OR is nested within a NOT

\neg(A\landB)\lorC

, since an AND is nested within a NOT

A\lor(B\land(C\lorD))

, since an OR is nested within an AND

Conversion to DNF

In classical logic each propositional formula can be converted to DNF ...

... by syntactic means

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\}

[2] can be converted to DNF by the following canonical term rewriting system:

\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}

... by semantic means

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(pq)))

.[3]

The corresponding truth table is

p

q

r

(

lnot

(p\landq)

)

\leftrightarrow

(

lnotr

\uparrow

(pq)

)

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

is

(p\landlnotq\landr)\lor (lnotp\landq\landr)\lor (lnotp\landlnotq\landr)\lor (lnotp\landlnotq\landlnotr)

lnot\phi

is

(p\landq\landr)\lor (p\landq\landlnotr)\lor (p\landlnotq\landlnotr)\lor (lnotp\landq\landlnotr)

Remark

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

three times, the full DNF of the above

\phi

can be simplified to

(lnotp\landlnotq)\lor(lnotp\landr)\lor(lnotq\landr)

. However, there are also equivalent DNF formulas that cannot be transformed one into another by this rule, see the pictures for an example.

Disjunctive Normal Form Theorem

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: Suppose

X

is a sentence in a propositional language

l{L}

with

n

sentence letters, which we shall denote by

A1,...,An

. If

X

is not a contradiction, then it is truth-functionally equivalent to a disjunction of conjunctions of the form

\pmA1\land...\land\pmAn

, where

+Ai=Ai

, and

-Ai=\negAi

.[7]
The proof follows from the procedure given above for generating DNFs from truth tables. Formally, the proof is as follows:
Suppose

X

is a sentence in a propositional language whose sentence letters are

A,B,C,\ldots

. For each row of

X

's truth table, write out a corresponding conjunction

\pmA\land\pmB\land\pmC\land\ldots

, where

\pmA

is defined to be

A

if

A

takes the value

T

at that row, and is

\negA

if

A

takes the value

F

at that row; similarly for

\pmB

,

\pmC

, etc. (the alphabetical ordering of

A,B,C,\ldots

in the conjunctions is quite arbitrary; any other could be chosen instead). Now form the disjunction of all these conjunctions which correspond to

T

rows of

X

's truth table. This disjunction is a sentence in

l{L}[A,B,C,\ldots;\land,\lor,\neg]

,[8] which by the reasoning above is truth-functionally equivalent to

X

. This construction obviously presupposes that

X

takes the value

T

on at least one row of its truth table; if

X

doesn’t, i.e., if

X

is a contradiction, then

X

is equivalent to

A\land\negA

, which is, of course, also a sentence in

l{L}[A,B,C,\ldots;\land,\lor,\neg]

.
This theorem is a convenient way to derive many useful metalogical results in propositional logic, such as, trivially, the result that the set of connectives

\{\land,\lor,\neg\}

is functionally complete.

Maximum number of conjunctions

Any propositional formula is built from

n

variables, where

n\ge1

.

There are

2n

possible literals:

L=\{p1,lnotp1,p2,lnotp2,\ldots,pn,lnotpn\}

.

L

has

(22n-1)

non-empty subsets.[9]

This is the maximum number of conjunctions a DNF can have.

A full DNF can have up to

2n

conjunctions, one for each row of the truth table.

Example 1

Consider a formula with two variables

p

and

q

.

The longest possible DNF has

2(2-1=15

conjunctions:

\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)

has

2n

conjunctions.

Computational complexity

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.

Variants

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.

See also

References

Notes and References

  1. However, they are in negation normal form.
  2. Formulas with other connectives can be brought into negation normal form first.
  3. \phi

    = ((NOT (p AND q)) IFF ((NOT r) NAND (p XOR q)))
  4. Book: Halbeisen, Lorenz . Gödel´s theorems and zermelo´s axioms: a firm foundation of mathematics . Kraph . Regula . 2020 . Birkhäuser . 978-3-030-52279-7 . Cham . 27.
  5. Book: Cenzer, Douglas . Set theory and foundations of mathematics: an introduction to mathematical logic . Larson . Jean . Porter . Christopher . Zapletal . Jindřich . 2020 . World Scientific . 978-981-12-0192-9 . New Jersey . 19-21.
  6. Book: Halvorson, Hans . How logic works: a user's guide . 2020 . Princeton University Press . 978-0-691-18222-3 . Princeton Oxford . 195.
  7. Book: Howson, Colin . Logic with trees: an introduction to symbolic logic . 1997 . Routledge . 978-0-415-13342-5 . London ; New York . 41.
  8. That is, the language with the propositional variables

    A,B,C,\ldots

    and the connectives

    \{\land,\lor,\neg\}

    .
  9. \left|l{P}(L)\right|=22n