VOOZH about

URL: https://en.wikipedia.org/wiki/Disjunctive_normal_form

⇱ Disjunctive normal form - Wikipedia


Jump to content
From Wikipedia, the free encyclopedia
Standard form of a boolean function

In boolean logic, a disjunctive normal form (DNF) is a 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.[1] The disjunctive normal form and its counterpart, the conjunctive normal form, are the most common standardized ways of representing boolean expressions. They are widely used in various applications such as circuit design or automated theorem proving.

Definition

[edit]

A logical formula is considered to be in DNF if it is a disjunction of one or more conjunctions of one or more literals.[2][3][4] 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 (πŸ‘ {\displaystyle \wedge }
), or (πŸ‘ {\displaystyle \vee }
), and not (πŸ‘ {\displaystyle \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:

DNF πŸ‘ {\displaystyle \,\to \,}
(Disjunct) πŸ‘ {\displaystyle \,\mid \,}
(Disjunct) πŸ‘ {\displaystyle \,\lor \,}
DNF
Disjunct πŸ‘ {\displaystyle \,\to \,}
Literal πŸ‘ {\displaystyle \,\mid \,}
Literal πŸ‘ {\displaystyle \,\land \,}
Disjunct
Literal πŸ‘ {\displaystyle \,\to \,}
Variable πŸ‘ {\displaystyle \,\mid \,}
πŸ‘ {\displaystyle \,\neg \,}
Variable

Where Variable is any variable.

For example, all of the following formulas are in DNF:

The formula πŸ‘ {\displaystyle A\lor B}
is in DNF, but not in full DNF; an equivalent full-DNF version is πŸ‘ {\displaystyle (A\land B)\lor (A\land \lnot B)\lor (\lnot A\land B)}
.

The following formulas are not in DNF:

Conversion to DNF

[edit]

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

πŸ‘ Image
Karnaugh map of the disjunctive normal form (¬A∧¬B∧¬D) ∨ (¬A∧B∧C) ∨ (A∧B∧D) ∨ (A∧¬B∧¬C)
πŸ‘ Image
Karnaugh map of the disjunctive normal form (¬A∧C∧¬D) ∨ (B∧C∧D) ∨ (A∧¬C∧D) ∨ (¬B∧¬C∧¬D). Despite the different grouping, the same fields contain a "1" as in the previous map.

... by syntactic means

[edit]

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 πŸ‘ {\displaystyle \{\land ,\lor ,\lnot \}}
[7] can be converted to DNF by the following canonical term rewriting system:[8]

πŸ‘ {\displaystyle {\begin{array}{rcl}(\lnot \lnot x)&\rightsquigarrow &x\\(\lnot (x\lor y))&\rightsquigarrow &((\lnot x)\land (\lnot y))\\(\lnot (x\land y))&\rightsquigarrow &((\lnot x)\lor (\lnot y))\\(x\land (y\lor z))&\rightsquigarrow &((x\land y)\lor (x\land z))\\((x\lor y)\land z)&\rightsquigarrow &((x\land z)\lor (y\land z))\\\end{array}}}

... by semantic means

[edit]

The full DNF of a formula can be read off its truth table.[9][10] For example, consider the formula

πŸ‘ {\displaystyle \phi =((\lnot (p\land q))\leftrightarrow (\lnot r\uparrow (p\oplus q)))}
.[11]

The corresponding truth table is

πŸ‘ {\displaystyle p}
πŸ‘ {\displaystyle q}
πŸ‘ {\displaystyle r}
πŸ‘ {\displaystyle (}
πŸ‘ {\displaystyle \lnot }
πŸ‘ {\displaystyle (p\land q)}
πŸ‘ {\displaystyle )}
πŸ‘ {\displaystyle \leftrightarrow }
πŸ‘ {\displaystyle (}
πŸ‘ {\displaystyle \lnot r}
πŸ‘ {\displaystyle \uparrow }
πŸ‘ {\displaystyle (p\oplus q)}
πŸ‘ {\displaystyle )}
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
πŸ‘ {\displaystyle (p\land \lnot q\land r)\lor (\lnot p\land q\land r)\lor (\lnot p\land \lnot q\land r)\lor (\lnot p\land \lnot q\land \lnot r)}
πŸ‘ {\displaystyle (p\land q\land r)\lor (p\land q\land \lnot r)\lor (p\land \lnot q\land \lnot r)\lor (\lnot p\land q\land \lnot r)}

Remark

[edit]

A propositional formula can be represented by one and only one full DNF.[13] In contrast, several plain DNFs may be possible. For example, by applying the rule πŸ‘ {\displaystyle ((a\land b)\lor (\lnot a\land b))\rightsquigarrow b}
three times, the full DNF of the above πŸ‘ {\displaystyle \phi }
can be simplified to πŸ‘ {\displaystyle (\lnot p\land \lnot q)\lor (\lnot p\land r)\lor (\lnot q\land r)}
. 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

[edit]

It is a theorem that all consistent formulas in propositional logic can be converted to disjunctive normal form.[14][15][16][17] This is called the Disjunctive Normal Form Theorem.[14][15][16][17] The formal statement is as follows:

Disjunctive Normal Form Theorem: Suppose πŸ‘ {\displaystyle X}
is a sentence in a propositional language πŸ‘ {\displaystyle {\mathcal {L}}}
with πŸ‘ {\displaystyle n}
sentence letters, which we shall denote by πŸ‘ {\displaystyle A_{1},...,A_{n}}
. If πŸ‘ {\displaystyle X}
is not a contradiction, then it is truth-functionally equivalent to a disjunction of conjunctions of the form πŸ‘ {\displaystyle \pm A_{1}\land ...\land \pm A_{n}}
, where πŸ‘ {\displaystyle +A_{i}=A_{i}}
, and πŸ‘ {\displaystyle -A_{i}=\neg A_{i}}
.[15]

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

Suppose πŸ‘ {\displaystyle X}
is a sentence in a propositional language whose sentence letters are πŸ‘ {\displaystyle A,B,C,\ldots }
. For each row of πŸ‘ {\displaystyle X}
's truth table, write out a corresponding conjunction πŸ‘ {\displaystyle \pm A\land \pm B\land \pm C\land \ldots }
, where πŸ‘ {\displaystyle \pm A}
is defined to be πŸ‘ {\displaystyle A}
if πŸ‘ {\displaystyle A}
takes the value πŸ‘ {\displaystyle T}
at that row, and is πŸ‘ {\displaystyle \neg A}
if πŸ‘ {\displaystyle A}
takes the value πŸ‘ {\displaystyle F}
at that row; similarly for πŸ‘ {\displaystyle \pm B}
, πŸ‘ {\displaystyle \pm C}
, etc. (the alphabetical ordering of πŸ‘ {\displaystyle 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 πŸ‘ {\displaystyle T}
rows of πŸ‘ {\displaystyle X}
's truth table. This disjunction is a sentence in πŸ‘ {\displaystyle {\mathcal {L}}[A,B,C,\ldots ;\land ,\lor ,\neg ]}
,[18] which by the reasoning above is truth-functionally equivalent to πŸ‘ {\displaystyle X}
. This construction obviously presupposes that πŸ‘ {\displaystyle X}
takes the value πŸ‘ {\displaystyle T}
on at least one row of its truth table; if πŸ‘ {\displaystyle X}
doesn’t, i.e., if πŸ‘ {\displaystyle X}
is a contradiction, then πŸ‘ {\displaystyle X}
is equivalent to πŸ‘ {\displaystyle A\land \neg A}
, which is, of course, also a sentence in πŸ‘ {\displaystyle {\mathcal {L}}[A,B,C,\ldots ;\land ,\lor ,\neg ]}
.[15]

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 πŸ‘ {\displaystyle \{\land ,\lor ,\neg \}}
is functionally complete.[15]

Maximum number of conjunctions

[edit]

Any propositional formula is built from πŸ‘ {\displaystyle n}
variables, where πŸ‘ {\displaystyle n\geq 1}
.

There are πŸ‘ {\displaystyle 2n}
possible literals: πŸ‘ {\displaystyle L=\{p_{1},\lnot p_{1},p_{2},\lnot p_{2},\ldots ,p_{n},\lnot p_{n}\}}
.

πŸ‘ {\displaystyle L}
has πŸ‘ {\displaystyle (2^{2n}-1)}
non-empty subsets.[19]

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

A full DNF can have up to πŸ‘ {\displaystyle 2^{n}}
conjunctions, one for each row of the truth table.

Example 1

Consider a formula with two variables πŸ‘ {\displaystyle p}
and πŸ‘ {\displaystyle q}
.

The longest possible DNF has πŸ‘ {\displaystyle 2^{(2\times 2)}-1=15}
conjunctions:[13]

πŸ‘ {\displaystyle {\begin{array}{lcl}(\lnot p)\lor (p)\lor (\lnot q)\lor (q)\lor \\(\lnot p\land p)\lor {\underline {(\lnot p\land \lnot q)}}\lor {\underline {(\lnot p\land q)}}\lor {\underline {(p\land \lnot q)}}\lor {\underline {(p\land q)}}\lor (\lnot q\land q)\lor \\(\lnot p\land p\land \lnot q)\lor (\lnot p\land p\land q)\lor (\lnot p\land \lnot q\land q)\lor (p\land \lnot q\land q)\lor \\(\lnot p\land p\land \lnot q\land q)\end{array}}}

The longest possible full DNF has 4 conjunctions: they are underlined.

This formula is a tautology. It can be simplified to πŸ‘ {\displaystyle (\neg p\lor p)}
or to πŸ‘ {\displaystyle (\neg q\lor q)}
, which are also tautologies, as well as valid DNFs.

Example 2

Each DNF of the e.g. formula πŸ‘ {\displaystyle (X_{1}\lor Y_{1})\land (X_{2}\lor Y_{2})\land \dots \land (X_{n}\lor Y_{n})}
has πŸ‘ {\displaystyle 2^{n}}
conjunctions.

Computational complexity

[edit]

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

[edit]

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.[20]

See also

[edit]

Notes

[edit]
  1. ^ Post 1921.
  2. ^ Davey & Priestley 1990, p. 153.
  3. ^ Gries & Schneider 1993, p. 67.
  4. ^ Whitesitt 2012, pp. 33–37.
  5. ^ However, this one is in negation normal form.
  6. ^ Davey & Priestley 1990, p. 152-153.
  7. ^ Formulas with other connectives can be brought into negation normal form first.
  8. ^ Dershowitz & Jouannaud 1990, p. 270, Sect.5.1.
  9. ^ Smullyan 1968, p. 14: "Make a truth-table for the formula. Each line of the table which comes out "T" will yield one of the basic conjunctions of the disjunctive normal form."
  10. ^ Sobolev 2020.
  11. ^ πŸ‘ {\displaystyle \phi }
    = ((NOT (p AND q)) IFF ((NOT r) NAND (p XOR q)))
  12. ^ like πŸ‘ {\displaystyle (a\land b)\lor (b\land a)\lor (a\land b\land b)}
  13. ^ a b c It is assumed that repetitions and variations[12] based on the commutativity and associativity of πŸ‘ {\displaystyle \lor }
    and πŸ‘ {\displaystyle \land }
    do not occur.
  14. ^ a b Halbeisen, Lorenz; Kraph, Regula (2020). GΓΆdelΒ΄s theorems and zermeloΒ΄s axioms: a firm foundation of mathematics. Cham: BirkhΓ€user. p. 27. ISBN 978-3-030-52279-7.
  15. ^ a b c d e Howson, Colin (1997). Logic with trees: an introduction to symbolic logic. London; New York: Routledge. p. 41. ISBN 978-0-415-13342-5.
  16. ^ a b Cenzer, Douglas; Larson, Jean; Porter, Christopher; Zapletal, JindΕ™ich (2020). Set theory and foundations of mathematics: an introduction to mathematical logic. New Jersey: World Scientific. pp. 19–21. ISBN 978-981-12-0192-9.
  17. ^ a b Halvorson, Hans (2020). How logic works: a user's guide. Princeton Oxford: Princeton University Press. p. 195. ISBN 978-0-691-18222-3.
  18. ^ That is, the language with the propositional variables πŸ‘ {\displaystyle A,B,C,\ldots }
    and the connectives πŸ‘ {\displaystyle \{\land ,\lor ,\neg \}}
    .
  19. ^ πŸ‘ {\displaystyle \left|{\mathcal {P}}(L)\right|=2^{2n}}
  20. ^ Arora & Barak 2009.

References

[edit]