Disjunctive normal form#Disjunctive Normal Form Theorem
{{Short description|Standard form of a boolean function}}
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 {{mdash}} in philosophical logic {{mdash}} a cluster concept.{{sfn|Post|1921}} 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.{{sfn|Davey|Priestley|1990|page=153}}{{sfn|Gries|Schneider|1993|page=67}}{{sfn|Whitesitt|2012|pages=33-37}} 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 (), or (), and not (). 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 Conjunct Conjunct DNF
: Conjunct Literal Literal Conjunct
: Literal Variable Variable
Where Variable is any variable.
For example, all of the following formulas are in DNF:
The formula is in DNF, but not in full DNF; an equivalent full-DNF version is .
The following formulas are not in DNF:
- , since an OR is nested within a NOT
- , since an AND is nested within a NOT
- , since an OR is nested within an ANDHowever, this one is in negation normal form.
Conversion to DNF
In classical logic each propositional formula can be converted to DNF{{sfn|Davey|Priestley|1990|page=152-153}} ...
File:Karnaugh map KV 4mal4 18.svg of the disjunctive normal form {{color|#800000|(¬A∧¬B∧¬D)}} ∨ {{color|#000080|(¬A∧B∧C)}} ∨ {{color|#008000|(A∧B∧D)}} ∨ {{color|#800080|(A∧¬B∧¬C)}}]]
= ... 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 Formulas with other connectives can be brought into negation normal form first. can be converted to DNF by the following canonical term rewriting system:{{sfn|Dershowitz|Jouannaud|1990|page=270|loc=Sect.5.1}}
:
(\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 =
The full DNF of a formula can be read off its truth table.{{harvnb|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."{{sfn|Sobolev|2020}} For example, consider the formula
:. = ((NOT (p AND q)) IFF ((NOT r) NAND (p XOR q)))
The corresponding truth table is
:
class="wikitable" style="text-align:center;"
! ! ! ! style="background:black"| ! ! ! ! ! ! ! ! ! ! | |||||||||||||
T | T | T | style="background:black"| | F | T | style="background:papayawhip" | F | F | T | F | ||||
T | T | F | style="background:black"| | F | T | style="background:papayawhip" | F | T | T | F | ||||
style="background:lightgreen"|T | style="background:lightgreen"|F | style="background:lightgreen"|T | style="background:black"| | T | F | style="background:papayawhip" | T | F | T | T | ||||
T | F | F | style="background:black"| | T | F | style="background:papayawhip" | F | T | F | T | ||||
style="background:lightgreen"|F | style="background:lightgreen"|T | style="background:lightgreen"|T | style="background:black"| | T | F | style="background:papayawhip" | T | F | T | T | ||||
F | T | F | style="background:black"| | T | F | style="background:papayawhip" | F | T | F | T | ||||
style="background:lightgreen"|F | style="background:lightgreen"|F | style="background:lightgreen"|T | style="background:black"| | T | F | style="background:papayawhip" | T | F | T | F | ||||
style="background:lightgreen"|F | style="background:lightgreen"|F | style="background:lightgreen"|F | style="background:black"| | T | F | style="background:papayawhip" | T | T | T | F |
- The full DNF equivalent of is
:
( 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)
- The full DNF equivalent of is
:
( 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 =
A propositional formula can be represented by one and only one full DNF.{{refn|name="noreps"|It is assumed that repetitions and variationslike based on the commutativity and associativity of and do not occur.}} In contrast, several plain DNFs may be possible. For example, by applying the rule three times, the full DNF of the above can be simplified to . 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.{{Cite book |last=Halbeisen |first=Lorenz |title=Gödel´s theorems and zermelo´s axioms: a firm foundation of mathematics |last2=Kraph |first2=Regula |date=2020 |publisher=Birkhäuser |isbn=978-3-030-52279-7 |location=Cham |pages=27}}{{Cite book |last=Cenzer |first=Douglas |title=Set theory and foundations of mathematics: an introduction to mathematical logic |last2=Larson |first2=Jean |last3=Porter |first3=Christopher |last4=Zapletal |first4=Jindřich |date=2020 |publisher=World Scientific |isbn=978-981-12-0192-9 |location=New Jersey |pages=19–21}}{{Cite book |last=Halvorson |first=Hans |title=How logic works: a user's guide |date=2020 |publisher=Princeton University Press |isbn=978-0-691-18222-3 |location=Princeton Oxford |pages=195}} This is called the Disjunctive Normal Form Theorem. The formal statement is as follows:
Disjunctive Normal Form Theorem: Suppose is a sentence in a propositional language with sentence letters, which we shall denote by . If is not a contradiction, then it is truth-functionally equivalent to a disjunction of conjunctions of the form , where , and .{{Cite book |last=Howson |first=Colin |title=Logic with trees: an introduction to symbolic logic |date=1997 |publisher=Routledge |isbn=978-0-415-13342-5 |location=London; New York |pages=41}}The proof follows from the procedure given above for generating DNFs from truth tables. Formally, the proof is as follows:
Suppose is a sentence in a propositional language whose sentence letters are . For each row of 's truth table, write out a corresponding conjunction , where is defined to be if takes the value at that row, and is if takes the value at that row; similarly for , , etc. (the alphabetical ordering of in the conjunctions is quite arbitrary; any other could be chosen instead). Now form the disjunction of all these conjunctions which correspond to rows of 's truth table. This disjunction is a sentence in ,That is, the language with the propositional variables and the connectives . which by the reasoning above is truth-functionally equivalent to . This construction obviously presupposes that takes the value on at least one row of its truth table; if doesn’t, i.e., if is a contradiction, then is equivalent to , which is, of course, also a sentence in .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 is functionally complete.
Maximum number of conjunctions
Any propositional formula is built from variables, where .
There are possible literals: .
This is the maximum number of conjunctions a DNF can have.
A full DNF can have up to conjunctions, one for each row of the truth table.
Example 1
Consider a formula with two variables and .
The longest possible DNF has conjunctions:
:
\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 or to , which are also tautologies, as well as valid DNFs.
Example 2
Each DNF of the e.g. formula has 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.{{sfn|Arora|Barak|2009}}
See also
- Algebraic normal form – an XOR of AND clauses
- Blake canonical form – DNF including all prime implicants
- Quine–McCluskey algorithm – algorithm for calculating prime implicants
- Conjunction/disjunction duality
- Propositional logic
- Truth table
Notes
{{reflist}}
References
{{sfn whitelist |CITEREFSobolev2020}}
- {{cite book|last1=Arora | first1=Sanjeev |author1-link=Sanjeev Arora|last2=Barak|first2= Boaz |author2-link=Boaz Barak| title=Computational Complexity: A Modern Approach | publisher=Cambridge University Press|date=20 April 2009|pages=579|isbn=9780521424264|doi=10.1017/CBO9780511804090}}
- {{cite book|last1=Davey | first1=B.A.|last2=Priestley |first2= H.A. | title=Introduction to Lattices and Order |title-link= Introduction to Lattices and Order | publisher=Cambridge University Press | series=Cambridge Mathematical Textbooks | year=1990 }}
- {{cite book | isbn=0-444-88074-7 | editor-first=Jan |editor-last= Van Leeuwen | editor-link=Jan van Leeuwen | title=Formal Models and Semantics | publisher=Elsevier | series=Handbook of Theoretical Computer Science | volume=B | year=1990 | first1=Nachum |last1=Dershowitz |author1-link=Nachum Dershowitz |first2= Jean-Pierre |last2=Jouannaud |author2-link= Jean-Pierre Jouannaud | contribution=Rewrite Systems | pages=243–320 }}
- {{cite book|first1=David |last1=Gries|first2=Fred B. |last2=Schneider|title=A Logical Approach to Discrete Math|url=https://books.google.com/books?id=ZWTDQ6H6gsUC&q=%22disjunctive+normal+form%22&pg=PA67|date=22 October 1993|publisher=Springer Science & Business Media|isbn=978-0-387-94115-8}}
- {{cite book|last1= Hilbert|first1=David|author1-link=David Hilbert|last2= Ackermann|first2=Wilhelm |author2-link=Wilhelm Ackermann|title=Principles of Mathematical Logic|url=https://books.google.com/books?id=45ZGMjV9vfcC&q=%22disjunctive+normal+form%22|year=1999|publisher=American Mathematical Soc.|isbn=978-0-8218-2024-7}}
- {{cite book|last=Howson|first=Colin|author-link=Colin Howson|title=Logic with trees: an introduction to symbolic logic|url=https://books.google.com/books?id=Y4WGAgAAQBAJ&q=%22disjunctive+normal+form%22|date=11 October 2005|orig-date=1997|publisher=Routledge|isbn=978-1-134-78550-6}}
- {{Cite journal|last=Post|first=Emil|author-link=Emil Post|title=Introduction to a General Theory of Elementary Propositions|date=July 1921|volume=43|issue=3|pages= 163–185| journal=American Journal of Mathematics|doi=10.2307/2370324|jstor=2370324}}
- {{Cite book|last=Smullyan|first=Raymond M.|author-link=Raymond Smullyan |title=First-Order Logic|year=1968|edition=1st edition, Second Printing 1971 |publisher=Springer-Verlag|pages=160|location=New York Heidelberg Berlin|doi=10.1007/978-3-642-86718-7|isbn= 978-3-642-86718-7|series= Ergebnisse der Mathematik und ihrer Grenzgebiete|volume=43}}
- {{SpringerEOM|title=Disjunctive normal form|author-last1=Sobolev|author-first1=S.K.|oldid=54535|date=2020}}
- {{cite book|first=J. Eldon |last=Whitesitt|title=Boolean Algebra and Its Applications|url=https://books.google.com/books?id=20Un1T78GlMC&q=%22disjunctive+normal+form%22|date=24 May 2012|orig-year=1961|publisher=Courier Corporation|isbn=978-0-486-15816-7}}
{{Normal forms in logic}}