Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Disjunctive normal form
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{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 (abstract rewriting)|normal form]], it is useful in [[automated theorem proving]]. ==Definition== A logical formula is considered to be in DNF if it is a [[logical disjunction|disjunction]] of one or more [[logical conjunction|conjunctions]] of one or more [[literal (mathematical logic)|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 [[logical conjunction|and]] (<math>\wedge</math>), [[logical disjunction|or]] (<math>\vee</math>), and [[negation|not]] (<math>\neg</math>). 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'' <math>\, \to \,</math> ''Conjunct'' <math>\, \mid \, </math> ''Conjunct'' <math>\, \lor \,</math> ''DNF'' : ''Conjunct'' <math>\, \to \,</math> ''Literal'' <math>\, \mid\, </math> ''Literal'' <math>\, \land \,</math> ''Conjunct'' : ''Literal'' <math>\, \to \,</math> ''Variable'' <math>\, \mid \,</math> <math>\, \neg \,</math> ''Variable'' Where ''Variable'' is any variable. For example, all of the following formulas are in DNF: *<math>(A \land \neg B \land \neg C) \lor (\neg D \land E \land F \land D \land F)</math> *<math>(A \land B) \lor (C)</math> *<math>(A \land B)</math> *<math>(A)</math> The formula <math>A \lor B</math> is in DNF, but not in full DNF; an equivalent full-DNF version is <math>(A \land B) \lor (A \land \lnot B) \lor (\lnot A \land B)</math>. The following formulas are '''not''' in DNF: *<math>\neg(A \lor B)</math>, since an OR is nested within a NOT *<math>\neg(A \land B) \lor C</math>, since an AND is nested within a NOT *<math>A \lor (B \land (C \lor D))</math>, since an OR is nested within an AND<ref>However, this one is in [[negation normal form]].</ref> ==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|thumb|[[Karnaugh map]] 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'')}}]] [[File:Karnaugh map KV 4mal4 19.svg|thumb|Karnaugh map of the disjunctive normal form {{color|#800080|(¬''A''∧''C''∧¬''D'')}} ∨ {{color|#008000|(''B''∧''C''∧''D'')}} ∨ {{color|#000080|(''A''∧¬''C''∧''D'')}} ∨ {{color|#800000|(¬''B''∧¬''C''∧¬''D'')}}. Despite the different grouping, the same fields contain a "1" as in the previous map.]] === ... by syntactic means === The conversion involves using [[logical equivalence]]s, such as [[double negation elimination]], [[De Morgan's laws]], and the [[Distributive property#Propositional logic|distributive law]]. Formulas built from the [[Functional completeness#Introduction|primitive]] [[Logical connective|connectives]] <math>\{\land,\lor,\lnot\}</math><ref>Formulas with other connectives can be brought into [[negation normal form]] first.</ref> can be converted to DNF by the following [[Abstract rewriting system|canonical term rewriting system]]:{{sfn|Dershowitz|Jouannaud|1990|page=270|loc=Sect.5.1}} :<math>\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}</math> === ... by semantic means === The full DNF of a formula can be read off its [[truth table]].<ref>{{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."</ref>{{sfn|Sobolev|2020}} For example, consider the formula :<math>\phi = ((\lnot (p \land q)) \leftrightarrow (\lnot r \uparrow (p \oplus q)))</math>.<ref><math>\phi</math> = (('''[[Negation|NOT]]''' (p '''[[Logical conjunction|AND]]''' q)) '''[[If and only if|IFF]]''' (('''[[Negation|NOT]]''' r) '''[[Sheffer stroke|NAND]]''' (p '''[[XOR]]''' q)))</ref> The corresponding [[truth table]] is :{| class="wikitable" style="text-align:center;" ! <math>p</math> ! <math>q</math> ! <math>r</math> ! style="background:black"| ! <math>(</math> ! <math>\lnot</math> ! <math>(p \land q)</math> ! <math>)</math> ! <math>\leftrightarrow</math> ! <math>(</math> ! <math>\lnot r</math> ! <math>\uparrow</math> ! <math>(p \oplus q)</math> ! <math>)</math> |- | 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 <math>\phi</math> is :<math> ( 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) </math> * The full DNF equivalent of <math>\lnot \phi</math> is :<math> ( 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) </math> === Remark === A propositional formula can be represented by one and only one full DNF.{{refn|name="noreps"|It is assumed that repetitions and variations<ref>like <math>(a \land b) \lor (b \land a) \lor (a \land b \land b)</math></ref> based on the [[Commutative property|commutativity]] and [[Associative property|associativity]] of <math>\lor</math> and <math>\land</math> do not occur.}} In contrast, several ''plain'' DNFs may be possible. For example, by applying the rule <math>((a \land b) \lor (\lnot a \land b)) \rightsquigarrow b</math> three times, the full DNF of the above <math>\phi</math> can be simplified to <math>(\lnot p \land \lnot q) \lor (\lnot p \land r) \lor (\lnot q \land r)</math>. 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 calculus|propositional logic]] can be converted to disjunctive normal form.<ref name=":0">{{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}}</ref><ref name=":13" /><ref name=":1">{{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}}</ref><ref name=":2">{{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}}</ref> This is called the '''Disjunctive Normal Form Theorem'''.<ref name=":0" /><ref name=":13" /><ref name=":1" /><ref name=":2" /> The formal statement is as follows:<blockquote>'''Disjunctive Normal Form Theorem:''' Suppose <math>X</math> is a sentence in a propositional language <math>\mathcal{L}</math> with <math>n</math> sentence letters, which we shall denote by <math>A_1,...,A_n</math>. If <math>X</math> is not a contradiction, then it is truth-functionally equivalent to a disjunction of conjunctions of the form <math>\pm A_1 \land ... \land \pm A_n</math>, where <math>+A_i=A_i</math>, and <math>-A_i= \neg A_i</math>.<ref name=":13">{{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}}</ref></blockquote>The proof follows from the procedure given above for generating DNFs from [[truth table]]s. Formally, the proof is as follows:<blockquote>Suppose <math>X</math> is a sentence in a propositional language whose sentence letters are <math>A, B, C, \ldots</math>. For each row of <math>X</math>'s truth table, write out a corresponding [[Logical conjunction|conjunction]] <math>\pm A \land \pm B \land \pm C \land \ldots</math>, where <math>\pm A</math> is defined to be <math>A</math> if <math>A</math> takes the value <math>T</math> at that row, and is <math>\neg A</math> if <math>A</math> takes the value <math>F</math> at that row; similarly for <math>\pm B</math>, <math>\pm C</math>, etc. (the [[alphabetical order]]ing of <math>A, B, C, \ldots</math> in the conjunctions is quite arbitrary; any other could be chosen instead). Now form the [[Logical disjunction|disjunction]] of all these conjunctions which correspond to <math>T</math> rows of <math>X</math>'s truth table. This disjunction is a sentence in <math>\mathcal{L}[A, B, C, \ldots; \land, \lor, \neg]</math>,<ref>That is, the language with the propositional variables <math>A, B, C, \ldots</math> and the connectives <math>\{\land, \lor, \neg\}</math>.</ref> which by the reasoning above is truth-functionally equivalent to <math>X</math>. This construction obviously presupposes that <math>X</math> takes the value <math>T</math> on at least one row of its truth table; if <math>X</math> doesn’t, i.e., if <math>X</math> is a [[contradiction]], then <math>X</math> is equivalent to <math>A \land \neg A</math>, which is, of course, also a sentence in <math>\mathcal{L}[A, B, C, \ldots; \land, \lor, \neg]</math>.<ref name=":13" /></blockquote>This theorem is a convenient way to derive many useful [[metalogic]]al results in propositional logic, such as, [[Triviality (mathematics)|trivially]], the result that the set of connectives <math>\{\land, \lor, \neg\}</math> is [[Functional completeness|functionally complete]].<ref name=":13" /> == Maximum number of conjunctions == <span id="max_conjunctions"> <!-- is anker: do not delete --></span> Any propositional formula is built from <math>n</math> variables, where <math>n \ge 1</math>. There are <math>2n</math> possible literals: <math>L = \{ p_1, \lnot p_1, p_2, \lnot p_2, \ldots, p_n, \lnot p_n\}</math>. <math>L</math> has <math>(2^{2n} -1)</math> non-empty subsets.<ref><math>\left|\mathcal{P}(L)\right| = 2^{2n}</math></ref> This is the maximum number of conjunctions a DNF can have.<ref name="noreps" /> A full DNF can have up to <math>2^{n}</math> conjunctions, one for each row of the truth table. '''Example 1''' Consider a formula with two variables <math>p</math> and <math>q</math>. The longest possible DNF has <math>2^{(2 \times 2)} -1 = 15</math> conjunctions:<ref name= "noreps" /> :<math> \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}</math> The longest possible full DNF has 4 conjunctions: they are underlined. This formula is a [[Tautology (logic)|tautology]]. It can be simplified to <math>(\neg p \lor p)</math> or to <math>(\neg q \lor q)</math>, which are also tautologies, as well as valid DNFs. '''Example 2''' Each DNF of the e.g. formula <math>(X_1 \lor Y_1) \land (X_2 \lor Y_2) \land \dots \land (X_n \lor Y_n)</math> has <math>2^n</math> conjunctions. ==Computational complexity== The [[Boolean satisfiability problem]] on [[conjunctive normal form]] formulas is [[NP-completeness#Boolean satisfiability problem|NP-complete]]. By the [[duality principle (Boolean algebra)|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 (logic)|tautology]]. Conversely, a DNF formula is satisfiable if, and only if, one of its conjunctions is satisfiable. This can be decided in [[P (complexity)|polynomial time]] simply by checking that at least one conjunction does not contain conflicting literals. ==Variants== An important variation used in the study of [[Analysis of algorithms|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 Science+Business Media|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}} [[Category:Normal forms (logic)]] [[Category:Knowledge compilation]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Cite book
(
edit
)
Template:Cite journal
(
edit
)
Template:Color
(
edit
)
Template:Harvnb
(
edit
)
Template:Ifsubst
(
edit
)
Template:Mdash
(
edit
)
Template:Normal forms in logic
(
edit
)
Template:Reflist
(
edit
)
Template:Refn
(
edit
)
Template:Sfn
(
edit
)
Template:Sfn whitelist
(
edit
)
Template:Short description
(
edit
)
Template:SpringerEOM
(
edit
)