conjunctive normal form

9

Click here to load reader

Upload: man

Post on 16-Aug-2015

217 views

Category:

Documents


3 download

DESCRIPTION

1. From Wikipedia, the free encyclopedia2. Lexicographical order

TRANSCRIPT

Conjunctive normal formFrom Wikipedia, the free encyclopediaContents1 Conjunctive normal form 11.1 Examples and Non-Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.2 Conversion into CNF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.3 First-order logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.4 Computational complexity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.5 Converting from rst-order logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.6 Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.7 See also . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41.8 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41.9 External links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 Negation normal form 52.1 Examples and counterexamples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52.2 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62.3 External links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62.4 Text and image sources, contributors, and licenses . . . . . . . . . . . . . . . . . . . . . . . . . . 72.4.1 Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72.4.2 Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72.4.3 Content license . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7iChapter 1Conjunctive normal formIn Boolean logic, a formula is in conjunctive normal form (CNF) or clausal normal form if it is a conjunction ofclauses, where a clause is a disjunction of literals; otherwise put, it is an AND of ORs. As a normal form, it is usefulin automated theorem proving. It is similar to the product of sums form used in circuit theory.All conjunctions of literals and all disjunctions of literals are in CNF, as they can be seen as conjunctions of one-literal clauses and conjunctions of a single clause, respectively.As in the disjunctive normal form (DNF), the onlypropositional connectives a formula in CNF can contain are and, or, and not. The not operator can only be used aspart of a literal, which means that it can only precede a propositional variable or a predicate symbol.In automated theorem proving, the notion "clausal normal form" is often used in a narrower sense, meaning a par-ticular representation of a CNF formula as a set of sets of literals.1.1 Examples and Non-ExamplesAll of the following formulas in the variables A, B, C, D, and E are in conjunctive normal form: A (B C) (A B) (B C D) (D E) A B A BThe last formula is in conjunctive normal form because it can be seen as the conjunction of the two single-literalclauses A and B . Incidentally, the last two formulas are also in disjunctive normal form.The following formulas are not in conjunctive normal form: (B C) (A B) C A (B (D E)).Every formula can be equivalently written as a formula in conjunctive normal form. In particular this is the case forthe three non-examples just mentioned; they are respectively equivalent to the following three formulas, which are inconjunctive normal form: B C (A C) (B C) A (B D) (B E).12 CHAPTER 1. CONJUNCTIVE NORMAL FORM1.2 Conversion into CNFEvery propositional formula can be converted into an equivalent formula that is in CNF. This transformation is basedon rules about logical equivalences: the double negative law, De Morgans laws, and the distributive law.Since all logical formulae can be converted into an equivalent formula in conjunctive normal form, proofs are oftenbased on the assumption that all formulae are CNF. However, in some cases this conversion to CNF can lead to anexponential explosion of the formula. For example, translating the following non-CNF formula into CNF produces aformula with 2nclauses:(X1 Y1) (X2 Y2) (Xn Yn).In particular, the generated formula is:(X1X2 Xn)(Y1X2 Xn)(X1Y2 Xn)(Y1Y2 Xn) (Y1Y2 Yn).This formula contains 2nclauses; each clause contains either Xi or Yi for each i .There exist transformations into CNF that avoid an exponential increase in size by preserving satisability rather thanequivalence.[1][2] These transformations are guaranteed to only linearly increase the size of the formula, but introducenew variables. For example, the above formula can be transformed into CNF by adding variablesZ1, . . . , Zn asfollows:(Z1 Zn) (Z1 X1) (Z1 Y1) (Zn Xn) (Zn Yn).An interpretation satises this formula only if at least one of the new variables is true. If this variable is Zi , thenboth Xi and Yi are true as well. This means that every model that satises this formula also satises the original one.On the other hand, only some of the models of the original formula satisfy this one: since the Zi are not mentionedin the original formula, their values are irrelevant to satisfaction of it, which is not the case in the last formula. Thismeans that the original formula and the result of the translation are equisatisable but not equivalent.An alternative translation, the Tseitin transformation, includes also the clauses ZiXiYi . With these clauses,the formula implies Zi Xi Yi ; this formula is often regarded to dene Zi to be a name for Xi Yi .1.3 First-order logicIn rst order logic, conjunctive normal form can be taken further to yield the clausal normal form of a logical formula,which can be then used to perform rst-order resolution. In resolution-based automated theorem-proving, a CNFformulaSee below for an example.1.4 Computational complexityAn important set of problems in computational complexity involves nding assignments to the variables of a booleanformula expressed in Conjunctive Normal Form, such that the formula is true. The k-SAT problem is the problem ofnding a satisfying assignment to a boolean formula expressed in CNF in which each disjunction contains at most kvariables. 3-SAT is NP-complete (like any other k-SAT problem with k>2) while 2-SAT is known to have solutionsin polynomial time. As a consequence,[3] the task of converting a formula into a DNF, preserving satisability, isNP-hard; dually, converting into CNF, preserving validity, is also NP-hard; hence equivalence-preserving conversioninto DNF or CNF is again NP-hard.Typical problems in this case involve formulas in 3CNF": conjunctive normal formwith no more than three variablesper conjunct. Examples of such formulas encountered in practice can be very large, for example with 100,000variables and 1,000,000 conjuncts.1.5. CONVERTING FROM FIRST-ORDER LOGIC 3A formula in CNF can be converted into an equisatisable formula in "kCNF (for k>=3) by replacing each conjunctwith more than k variables X1 Xk Xn by two conjuncts X1 Xk1Z and Z Xk Xnwith Z a new variable, and repeating as often as necessary.1.5 Converting from rst-order logicTo convert rst-order logic to CNF:[4]1. Convert to negation normal form.(a) Eliminate implications and equivalences:repeatedly replace P Q with P Q ; replace P Qwith (P Q) (P Q) . Eventually, this will eliminate all occurrences of and .(b) Move NOTs inwards by repeatedly applying De Morgans Law. Specically, replace (P Q) with(P) (Q) ; replace (P Q) with (P) (Q) ; and replace P with P ; replace (xP(x))with xP(x) ; (xP(x)) with xP(x) . After that, a may occur only immediately before apredicate symbol.2. Standardize variables(a) For sentences like(xP(x)) (xQ(x)) which use the same variable name twice, change the nameof one of the variables. This avoids confusion later when dropping quantiers later. For example,x[yAnimal(y)Loves(x, y)][yLoves(y, x)] is renamed to x[yAnimal(y)Loves(x, y)][zLoves(z, x)] .3. Skolemize the statement(a) Move quantiers outwards: repeatedly replace P(xQ(x)) with x(PQ(x)) ; replace P(xQ(x))with x(P Q(x)) ; replace P (xQ(x)) with x(P Q(x)) ; replace P (xQ(x)) with x(P Q(x)) . These replacements preserve equivalence, since the previous variable standardization step en-sured that x doesn't occur in P . After these replacements, a quantier may occur only in the initial prexof the formula, but never inside a , , or .(b) Repeatedly replace x1. . . xn yP(y) with x1. . . xnP(f(x1, . . . , xn)) , where f is a new n -aryfunction symbol, a so-called "skolem function". This is the only step that preserves only satisabilityrather than equivalence. It eliminates all existential quantiers.4. Drop all universal quantiers.5. Distribute ORs inwards over ANDs: repeatedly replace P (Q R) with (P Q) (P R) .As an example, the formula saying Who loves all animals, is in turn loved by someone is converted into CNF (andsubsequently into clause form in the last line) as follows (highlighting replacement rule redices in red ):Informally, the skolem function g(x) can be thought of as yielding the person by whom x is loved, while f(x) yieldsthe animal (if any) that x doesn't love. The 3rd last line from below then reads as "x doesn't love the animal f(x) ,or else x is loved by g(x) ".The 2nd last line from above, (Animal(f(x)) Loves(g(x), x)) (Loves(x, f(x)) Loves(g(x), x)) , is theCNF.1.6 Notes[1] Tseitin (1968)[2] Jackson and Sheridan (2004)[3] since one way to check a CNF for satisability is to convert it into a DNF, the satisability of which can be checked inlinear time[4] Articial Intelligence: A modern Approach [1995...] Russell and Norvig4 CHAPTER 1. CONJUNCTIVE NORMAL FORM1.7 See alsoAlgebraic normal formDisjunctive normal formHorn clauseQuineMcCluskey algorithm1.8 ReferencesPaul Jackson, Daniel Sheridan: Clause Form Conversions for Boolean Circuits. In: Holger H. Hoos, David G.Mitchell (Eds.):Theory and Applications of Satisability Testing, 7th International Conference, SAT 2004,Vancouver, BC, Canada, May 1013, 2004, Revised Selected Papers. Lecture Notes in Computer Science3542, Springer 2005, pp. 183198G.S. Tseitin: On the complexity of derivation in propositional calculus. In: Slisenko, A.O. (ed.) Structures inConstructive Mathematics and Mathematical Logic, Part II, Seminars in Mathematics (translated from Rus-sian), pp. 115125. Steklov Mathematical Institute (1968)1.9 External linksHazewinkel, Michiel, ed. (2001), Conjunctive normal form, Encyclopedia of Mathematics, Springer, ISBN978-1-55608-010-4Java applet for converting to CNF and DNF, showing laws usedMayuresh S. Pardeshi, Dr. Bashirahamed F. Momin Conversion of cnf to dnf using grid computing IEEE,ISBN 978-1-4673-2816-6Mayuresh S. Pardeshi, Dr. Bashirahamed F. Momin Conversion of cnf to dnf using grid computing in parallelIEEE, ISBN 978-1-4799-4041-7Chapter 2Negation normal formIn mathematical logic, a formula is in negation normal form if the negation operator ( , not) is only applied tovariables and the only other allowed Boolean operators are conjunction ( , and) and disjunction ( , or).Negation normal form is not a canonical form: for example, a (b c) and (a b) (a c) are equivalent, andare both in negation normal form.In classical logic and many modal logics, every formula can be brought into this form by replacing implications andequivalences by their denitions, using De Morgans laws to push negation inwards, and eliminating double negations.This process can be represented using the following rewrite rules:(x.G) x.G(x.G) x.GG G(G1 G2) (G1) (G2)(G1 G2) (G1) (G2)A formula in negation normal form can be put into the stronger conjunctive normal form or disjunctive normal formby applying distributivity.2.1 Examples and counterexamplesThe following formulae are all in negation normal form:(A B) C(A (B C) C) DA BA BThe rst example is also in conjunctive normal form and the last two are in both conjunctive normal form anddisjunctive normal form, but the second example is in neither.The following formulae are not in negation normal form:A B(A B)56 CHAPTER 2. NEGATION NORMAL FORM(A B)(A C)They are however respectively equivalent to the following formulae in negation normal form:A BA BA BA C2.2 ReferencesAlan J.A. Robinson and Andrei Voronkov, Handbook of Automated Reasoning 1:203 (2001) ISBN0444829490.2.3 External linksJava applet for converting logical formula to Negation Normal Form, showing laws used2.4. TEXT AND IMAGE SOURCES, CONTRIBUTORS, AND LICENSES 72.4 Text and image sources, contributors, and licenses2.4.1 Text Conjunctive normal formSource: https://en.wikipedia.org/wiki/Conjunctive_normal_form?oldid=672056976 Contributors: Bryan Derk-sen, Robert Merkel, BenBaker, Arvindn, Toby Bartels, B4hand, Michael Hardy, Aquatopia~enwiki, Ldo, Thesilverbail, Jleedev, Giftlite,CyborgTosser, Niteowlneils, Macrakis, Gubbubu, Wzwz, Ary29, Erik Garrison, MementoVivere, ESkog, Cherlin, Obradovic Goran,Poromenos, Oleg Alexandrov, Linas, Jacobolus, Eclecticos, Graham87, BD2412, Tizio, Salix alba, Mike Segal, Mathbot, Jrtayloriv,Fresheneesz, Masnevets, Chobot, Dresdnhope, YurikBot, Hairy Dude, GrinBot~enwiki, SmackBot, Jpvinall, Rotemliss, Mhss, Bluebot,PrimeHunter, Jon Awbrey, Danlev, Ylloh, CBM, Andkore, Myasuda, Simeon, Gregbard, Blaisorblade, Thijs!bot, Hermel, A3nm, Ay-dos~enwiki, Mikhail Dvorkin, AntiSpamBot, Policron, Ross Fraser, TXiKiBoT, Mx2323, Jamelan, AlleborgoBot, IsleLaMotte, Tesi1700,Dardasavta, Alejandrocaro35, DumZiBoT, Addbot, Yobot, IM Serious, LilHelpa, Snikeris, Hobsonlane, D'ohBot, Mikolasj, EmausBot,Frostyandy2k, Bobogoobo, Tijfo098, Cognominally, Hofmic, OSDevLabs, Jamesx12345, Jochen Burghardt, Tleo and Anonymous: 73 Negationnormalform Source: https://en.wikipedia.org/wiki/Negation_normal_form?oldid=665947556 Contributors: Vkuncak, Sil-versh, Olathe, Macrakis, Starblue, Obradovic Goran, Pearle, Oleg Alexandrov, Linas, Kbdank71, Mets501, CRGreathouse, CBM,Gregbard, Cydebot, Christian75, Amikake3, Brian Geppert, Addbot, Luckas-bot, Tomdwrightenator, Kejia, Mogism, Ayush3292 andAnonymous: 62.4.2 Images File:Text_document_with_red_question_mark.svg Source: https://upload.wikimedia.org/wikipedia/commons/a/a4/Text_document_with_red_question_mark.svg License:Public domain Contributors:Created by bdesham with Inkscape; based upon Text-x-generic.svgfrom the Tango project. Original artist: Benjamin D. Esham (bdesham)2.4.3 Content license Creative Commons Attribution-Share Alike 3.0