fbpx
Wikipedia

Conjunctive normal form

In Boolean logic, a formula is in conjunctive normal form (CNF) or clausal normal form if it is a conjunction of one or more clauses, where a clause is a disjunction of literals; otherwise put, it is a product of sums or an AND of ORs. As a canonical normal form, it is useful in automated theorem proving and circuit theory.

In automated theorem proving, the notion "clausal normal form" is often used in a narrower sense, meaning a particular representation of a CNF formula as a set of sets of literals.

Definition edit

A logical formula is considered to be in CNF if it is a conjunction of one or more disjunctions of one or more literals. As in disjunctive normal form (DNF), the only propositional operators in CNF are or ( ), and ( ), 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 CNF:

  1. CNF → (Disjunction)   CNF
  2. CNF → (Disjunction)
  3. DisjunctionLiteral   Disjunction
  4. DisjunctionLiteral
  5. Literal Variable
  6. LiteralVariable

Where Variable is any variable.

All of the following formulas in the variables  , and   are in conjunctive normal form:

  •  
  •  
  •  
  •  

The following formulas are not in conjunctive normal form:

  •  , since an AND is nested within a NOT
  •  , since an OR is nested within a NOT
  •  , since an AND is nested within an OR

Conversion to CNF edit

In classical logic each propositional formula can be converted to an equivalent formula that is in CNF.[1] This transformation is based on rules about logical equivalences: double negation elimination, De Morgan's laws, and the distributive law.

Basic algorithm edit

The algorithm to compute a CNF-equivalent of a given propositional formula   builds upon   in disjunctive normal form (DNF): step 1.[2]
Then   is converted to   by swapping ANDs with ORs and vice versa while negating all the literals. Remove all  .[1]

Conversion by syntactic means edit

Convert to CNF the propositional formula  .

Step 1: Convert its negation to disjunctive normal form.[2]

 ,[3]

where each   is a conjunction of literals  .[4]

Step 2: Negate  . Then shift   inwards by applying the (generalized) De Morgan's equivalences until no longer possible.

 

where
 

Step 3: Remove all double negations.

Example

Convert to CNF the propositional formula  .[5]

The (full) DNF equivalent of its negation is[2]
 

 

Conversion by semantic means edit

A CNF equivalent of a formula can be derived from its truth table. Again, consider the formula

 .[5]

The corresponding truth table is

                         
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

A CNF equivalent of   is

 

Each disjunction reflects an assignment of variables for which   evaluates to F(alse).
If in such an assignment a variable  

  • is T(rue), then the literal is set to   in the disjunction,
  • is F(alse), then the literal is set to   in the disjunction.

Other approaches edit

Since all propositional formulas can be converted into an equivalent formula in conjunctive normal form, proofs are often based on the assumption that all formulae are CNF. However, in some cases this conversion to CNF can lead to an exponential explosion of the formula. For example, translating the non-CNF formula

 

into CNF produces a formula with   clauses:

 

Each clause contains either   or   for each  .

There exist transformations into CNF that avoid an exponential increase in size by preserving satisfiability rather than equivalence.[6][7] These transformations are guaranteed to only linearly increase the size of the formula, but introduce new variables. For example, the above formula can be transformed into CNF by adding variables   as follows:

 

An interpretation satisfies this formula only if at least one of the new variables is true. If this variable is  , then both   and   are true as well. This means that every model that satisfies this formula also satisfies the original one. On the other hand, only some of the models of the original formula satisfy this one: since the   are not mentioned in the original formula, their values are irrelevant to satisfaction of it, which is not the case in the last formula. This means that the original formula and the result of the translation are equisatisfiable but not equivalent.

An alternative translation, the Tseitin transformation, includes also the clauses  . With these clauses, the formula implies  ; this formula is often regarded to "define"   to be a name for  .

Maximum number of disjunctions edit

Consider a propositional formula with   variables,  .

There are   possible literals:  .

  has   non-empty subsets.[8]

This is the maximum number of disjunctions a CNF can have.[10]

All truth-functional combinations can be expressed with   disjunctions, one for each row of the truth table.
In the example below they are underlined.

Example

Consider a formula with two variables   and  .

The longest possible CNF has   disjunctions:[10]

 

This formula is a contradiction.

Computational complexity edit

An important set of problems in computational complexity involves finding assignments to the variables of a boolean formula expressed in conjunctive normal form, such that the formula is true. The k-SAT problem is the problem of finding a satisfying assignment to a boolean formula expressed in CNF in which each disjunction contains at most k variables. 3-SAT is NP-complete (like any other k-SAT problem with k>2) while 2-SAT is known to have solutions in polynomial time. As a consequence,[11] the task of converting a formula into a DNF, preserving satisfiability, is NP-hard; dually, converting into CNF, preserving validity, is also NP-hard; hence equivalence-preserving conversion into DNF or CNF is again NP-hard.

Typical problems in this case involve formulas in "3CNF": conjunctive normal form with no more than three variables per conjunct. Examples of such formulas encountered in practice can be very large, for example with 100,000 variables and 1,000,000 conjuncts.

A formula in CNF can be converted into an equisatisfiable formula in "kCNF" (for k≥3) by replacing each conjunct with more than k variables   by two conjuncts   and   with Z a new variable, and repeating as often as necessary.

First-order logic edit

In first 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 first-order resolution. In resolution-based automated theorem-proving, a CNF formula

                                  ,[12] is commonly represented as a set of sets
                                      .

See below for an example.

Converting from first-order logic edit

To convert first-order logic to CNF:[13]

  1. Convert to negation normal form.
    1. Eliminate implications and equivalences: repeatedly replace   with  ; replace   with  . Eventually, this will eliminate all occurrences of   and  .
    2. Move NOTs inwards by repeatedly applying De Morgan's law. Specifically, replace   with  ; replace   with  ; and replace   with  ; replace   with  ;   with  . After that, a   may occur only immediately before a predicate symbol.
  2. Standardize variables
    1. For sentences like   which use the same variable name twice, change the name of one of the variables. This avoids confusion later when dropping quantifiers. For example,   is renamed to  .
  3. Skolemize the statement
    1. Move quantifiers outwards: repeatedly replace   with  ; replace   with  ; replace   with  ; replace   with  . These replacements preserve equivalence, since the previous variable standardization step ensured that   doesn't occur in  . After these replacements, a quantifier may occur only in the initial prefix of the formula, but never inside a  ,  , or  .
    2. Repeatedly replace   with  , where   is a new  -ary function symbol, a so-called "Skolem function". This is the only step that preserves only satisfiability rather than equivalence. It eliminates all existential quantifiers.
  4. Drop all universal quantifiers.
  5. Distribute ORs inwards over ANDs: repeatedly replace   with  .

Example

As an example, the formula saying "Anyone who loves all animals, is in turn loved by someone" is converted into CNF (and subsequently into clause form in the last line) as follows (highlighting replacement rule redexes in  ):

                                     
                                        by 1.1
                                          by 1.1
                                              by 1.2
                                            by 1.2
                                        by 1.2
                                        by 2
                                  by 3.1
                                  by 3.1
                                by 3.2
                            by 4
                              by 5
                                  (clause representation)

Informally, the Skolem function   can be thought of as yielding the person by whom   is loved, while   yields the animal (if any) that   doesn't love. The 3rd last line from below then reads as "  doesn't love the animal  , or else   is loved by  ".

The 2nd last line from above,  , is the CNF.

See also edit

Notes edit

  1. ^ a b Howson 2005, p. 46.
  2. ^ a b c see Disjunctive normal form#Conversion to DNF
  3. ^   maximum number of conjunctions for  
  4. ^   maximum number of literals for  
  5. ^ a b   = ((NOT (p AND q)) IFF ((NOT r) NAND (p XOR q)))
  6. ^ Tseitin 1968.
  7. ^ Jackson & Sheridan 2004.
  8. ^  
  9. ^ like  
  10. ^ a b It is assumed that repetitions and variations[9] based on the commutativity and associativity of   and   do not occur.
  11. ^ since one way to check a CNF for satisfiability is to convert it into a DNF, the satisfiability of which can be checked in linear time
  12. ^   maximum number of disjunctions
      maximum number of literals
  13. ^ Russel & Norvig 2010, pp. 345–347, 9.5.1 Conjunctive normal form for first-order logic.

References edit

  • Andrews, Peter B. (2013). An Introduction to Mathematical Logic and Type Theory: To Truth Through Proof. ISBN 9401599343.
  • Jackson, Paul; Sheridan, Daniel (10 May 2004). "Clause Form Conversions for Boolean Circuits" (PDF). In Hoos, Holger H.; Mitchell, David G. (eds.). Theory and Applications of Satisfiability Testing,. 7th International Conference on Theory and Applications of Satisfiability Testing, SAT. Revised Selected Papers. Lecture Notes in Computer Science. Vol. 3542. Vancouver, BC, Canada: Springer 2005. pp. 183–198. doi:10.1007/11527695_15. ISBN 978-3-540-31580-3.
  • Tseitin, Grigori S. (1968). "On the Complexity of Derivation in Propositional Calculus" (PDF). In Slisenko, A.O. (ed.). Structures in Constructive Mathematics and Mathematical Logic, Part II, Seminars in Mathematics (translated from Russian). Steklov Mathematical Institute. pp. 115–125.
  • Whitesitt, J. Eldon (24 May 2012) [1961]. Boolean Algebra and Its Applications. Courier Corporation. ISBN 978-0-486-15816-7.

External links edit

  • "Java tool for converting a truth table into CNF and DNF". Universität Marburg. Retrieved 31 December 2023.

conjunctive, normal, form, confused, with, chomsky, normal, form, boolean, logic, formula, conjunctive, normal, form, clausal, normal, form, conjunction, more, clauses, where, clause, disjunction, literals, otherwise, product, sums, canonical, normal, form, us. Not to be confused with Chomsky normal form In Boolean logic a formula is in conjunctive normal form CNF or clausal normal form if it is a conjunction of one or more clauses where a clause is a disjunction of literals otherwise put it is a product of sums or an AND of ORs As a canonical normal form it is useful in automated theorem proving and circuit theory In automated theorem proving the notion clausal normal form is often used in a narrower sense meaning a particular representation of a CNF formula as a set of sets of literals Contents 1 Definition 2 Conversion to CNF 2 1 Basic algorithm 2 1 1 Conversion by syntactic means 2 1 2 Conversion by semantic means 2 2 Other approaches 3 Maximum number of disjunctions 4 Computational complexity 5 First order logic 5 1 Converting from first order logic 6 See also 6 1 Notes 7 References 8 External linksDefinition editA logical formula is considered to be in CNF if it is a conjunction of one or more disjunctions of one or more literals As in disjunctive normal form DNF the only propositional operators in CNF are or displaystyle vee nbsp and displaystyle wedge nbsp and not displaystyle neg nbsp 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 CNF CNF Disjunction displaystyle land nbsp CNF CNF Disjunction Disjunction Literal displaystyle lor nbsp Disjunction Disjunction Literal Literal displaystyle neg nbsp Variable Literal VariableWhere Variable is any variable All of the following formulas in the variables A B C D E displaystyle A B C D E nbsp and F displaystyle F nbsp are in conjunctive normal form A B C D E F D F displaystyle A lor neg B lor neg C land neg D lor E lor F lor D lor F nbsp A B C displaystyle A lor B land C nbsp A B displaystyle A lor B nbsp A displaystyle A nbsp The following formulas are not in conjunctive normal form A B displaystyle neg A land B nbsp since an AND is nested within a NOT A B C displaystyle neg A lor B land C nbsp since an OR is nested within a NOT A B D E displaystyle A land B lor D land E nbsp since an AND is nested within an ORConversion to CNF editIn classical logic each propositional formula can be converted to an equivalent formula that is in CNF 1 This transformation is based on rules about logical equivalences double negation elimination De Morgan s laws and the distributive law Basic algorithm edit The algorithm to compute a CNF equivalent of a given propositional formula ϕ displaystyle phi nbsp builds upon ϕ displaystyle lnot phi nbsp in disjunctive normal form DNF step 1 2 Then ϕDNF displaystyle lnot phi DNF nbsp is converted to ϕCNF displaystyle phi CNF nbsp by swapping ANDs with ORs and vice versa while negating all the literals Remove all displaystyle lnot lnot nbsp 1 Conversion by syntactic means edit Convert to CNF the propositional formula ϕ displaystyle phi nbsp Step 1 Convert its negation to disjunctive normal form 2 ϕDNF C1 C2 Ci Cm displaystyle lnot phi DNF C 1 lor C 2 lor ldots lor C i lor ldots lor C m nbsp 3 where each Ci displaystyle C i nbsp is a conjunction of literals li1 li2 lini displaystyle l i1 land l i2 land ldots land l in i nbsp 4 Step 2 Negate ϕDNF displaystyle lnot phi DNF nbsp Then shift displaystyle lnot nbsp inwards by applying the generalized De Morgan s equivalences until no longer possible ϕ ϕDNF C1 C2 Ci Cm C1 C2 Ci Cm generalized D M displaystyle begin aligned phi amp leftrightarrow lnot lnot phi DNF amp lnot C 1 lor C 2 lor ldots lor C i lor ldots lor C m amp leftrightarrow lnot C 1 land lnot C 2 land ldots land lnot C i land ldots land lnot C m amp amp text generalized D M end aligned nbsp where Ci li1 li2 lini li1 li2 lini generalized D M displaystyle begin aligned lnot C i amp lnot l i1 land l i2 land ldots land l in i amp leftrightarrow lnot l i1 lor lnot l i2 lor ldots lor lnot l in i amp amp text generalized D M end aligned nbsp Step 3 Remove all double negations ExampleConvert to CNF the propositional formula ϕ p q r p q displaystyle phi lnot p land q leftrightarrow lnot r uparrow p oplus q nbsp 5 The full DNF equivalent of its negation is 2 ϕDNF p q r p q r p q r p q r displaystyle lnot phi DNF 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 nbsp ϕ ϕDNF p q r p q r p q r p q r p q r p q r p q r p q r generalized D M p q r p q r p q r p q r generalized D M 4 p q r p q r p q r p q r remove all ϕCNF displaystyle begin aligned phi amp leftrightarrow lnot lnot phi DNF amp lnot 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 amp leftrightarrow underline lnot p land q land r land underline lnot p land q land lnot r land underline lnot p land lnot q land lnot r land underline lnot lnot p land q land lnot r amp amp text generalized D M amp leftrightarrow lnot p lor lnot q lor lnot r land lnot p lor lnot q lor lnot lnot r land lnot p lor lnot lnot q lor lnot lnot r land lnot lnot p lor lnot q lor lnot lnot r amp amp text generalized D M 4 times amp leftrightarrow lnot p lor lnot q lor lnot r land lnot p lor lnot q lor r land lnot p lor q lor r land p lor lnot q lor r amp amp text remove all lnot lnot amp phi CNF end aligned nbsp Conversion by semantic means edit A CNF equivalent of a formula can be derived from its truth table Again consider the formula ϕ p q r p q displaystyle phi lnot p land q leftrightarrow lnot r uparrow p oplus q nbsp 5 The corresponding truth table is p displaystyle p nbsp q displaystyle q nbsp r displaystyle r nbsp displaystyle nbsp displaystyle lnot nbsp p q displaystyle p land q nbsp displaystyle nbsp displaystyle leftrightarrow nbsp displaystyle nbsp r displaystyle lnot r nbsp displaystyle uparrow nbsp p q displaystyle p oplus q nbsp displaystyle nbsp T T T F T F F T FT T F F T F T T FT F T T F T F T TT F F T F F T F TF T T T F T F T TF T F T F F T F TF F T T F T F T FF F F T F T T T FA CNF equivalent of ϕ displaystyle phi nbsp is p q r p q r p q r p q r displaystyle lnot p lor lnot q lor lnot r land lnot p lor lnot q lor r land lnot p lor q lor r land p lor lnot q lor r nbsp Each disjunction reflects an assignment of variables for which ϕ displaystyle phi nbsp evaluates to F alse If in such an assignment a variable V displaystyle V nbsp is T rue then the literal is set to V displaystyle lnot V nbsp in the disjunction is F alse then the literal is set to V displaystyle V nbsp in the disjunction Other approaches edit Since all propositional formulas can be converted into an equivalent formula in conjunctive normal form proofs are often based on the assumption that all formulae are CNF However in some cases this conversion to CNF can lead to an exponential explosion of the formula For example translating the non CNF formula X1 Y1 X2 Y2 Xn Yn displaystyle X 1 wedge Y 1 vee X 2 wedge Y 2 vee ldots vee X n wedge Y n nbsp into CNF produces a formula with 2n displaystyle 2 n nbsp clauses X1 X2 Xn Y1 X2 Xn X1 Y2 Xn Y1 Y2 Xn Y1 Y2 Yn displaystyle X 1 vee X 2 vee ldots vee X n wedge Y 1 vee X 2 vee ldots vee X n wedge X 1 vee Y 2 vee ldots vee X n wedge Y 1 vee Y 2 vee ldots vee X n wedge ldots wedge Y 1 vee Y 2 vee ldots vee Y n nbsp Each clause contains either Xi displaystyle X i nbsp or Yi displaystyle Y i nbsp for each i displaystyle i nbsp There exist transformations into CNF that avoid an exponential increase in size by preserving satisfiability rather than equivalence 6 7 These transformations are guaranteed to only linearly increase the size of the formula but introduce new variables For example the above formula can be transformed into CNF by adding variables Z1 Zn displaystyle Z 1 ldots Z n nbsp as follows Z1 Zn Z1 X1 Z1 Y1 Zn Xn Zn Yn displaystyle Z 1 vee ldots vee Z n wedge neg Z 1 vee X 1 wedge neg Z 1 vee Y 1 wedge ldots wedge neg Z n vee X n wedge neg Z n vee Y n nbsp An interpretation satisfies this formula only if at least one of the new variables is true If this variable is Zi displaystyle Z i nbsp then both Xi displaystyle X i nbsp and Yi displaystyle Y i nbsp are true as well This means that every model that satisfies this formula also satisfies the original one On the other hand only some of the models of the original formula satisfy this one since the Zi displaystyle Z i nbsp are not mentioned in the original formula their values are irrelevant to satisfaction of it which is not the case in the last formula This means that the original formula and the result of the translation are equisatisfiable but not equivalent An alternative translation the Tseitin transformation includes also the clauses Zi Xi Yi displaystyle Z i vee neg X i vee neg Y i nbsp With these clauses the formula implies Zi Xi Yi displaystyle Z i equiv X i wedge Y i nbsp this formula is often regarded to define Zi displaystyle Z i nbsp to be a name for Xi Yi displaystyle X i wedge Y i nbsp Maximum number of disjunctions editConsider a propositional formula with n displaystyle n nbsp variables n 1 displaystyle n geq 1 nbsp There are 2n displaystyle 2n nbsp possible literals L p1 p1 p2 p2 pn pn displaystyle L p 1 lnot p 1 p 2 lnot p 2 ldots p n lnot p n nbsp L displaystyle L nbsp has 22n 1 displaystyle 2 2n 1 nbsp non empty subsets 8 This is the maximum number of disjunctions a CNF can have 10 All truth functional combinations can be expressed with 2n displaystyle 2 n nbsp disjunctions one for each row of the truth table In the example below they are underlined ExampleConsider a formula with two variables p displaystyle p nbsp and q displaystyle q nbsp The longest possible CNF has 2 2 2 1 15 displaystyle 2 2 times 2 1 15 nbsp disjunctions 10 p p q q p p p q p q p q p q q q p p q p p q p q q p q q p p q q displaystyle begin array lcl lnot p land p land lnot q land q land lnot p lor p land underline lnot p lor lnot q land underline lnot p lor q land underline p lor lnot q land underline p lor q land lnot q lor q land lnot p lor p lor lnot q land lnot p lor p lor q land lnot p lor lnot q lor q land p lor lnot q lor q land lnot p lor p lor lnot q lor q end array nbsp This formula is a contradiction Computational complexity editAn important set of problems in computational complexity involves finding assignments to the variables of a boolean formula expressed in conjunctive normal form such that the formula is true The k SAT problem is the problem of finding a satisfying assignment to a boolean formula expressed in CNF in which each disjunction contains at most k variables 3 SAT is NP complete like any other k SAT problem with k gt 2 while 2 SAT is known to have solutions in polynomial time As a consequence 11 the task of converting a formula into a DNF preserving satisfiability is NP hard dually converting into CNF preserving validity is also NP hard hence equivalence preserving conversion into DNF or CNF is again NP hard Typical problems in this case involve formulas in 3CNF conjunctive normal form with no more than three variables per conjunct Examples of such formulas encountered in practice can be very large for example with 100 000 variables and 1 000 000 conjuncts A formula in CNF can be converted into an equisatisfiable formula in kCNF for k 3 by replacing each conjunct with more than k variables X1 Xk Xn displaystyle X 1 vee ldots vee X k vee ldots vee X n nbsp by two conjuncts X1 Xk 1 Z displaystyle X 1 vee ldots vee X k 1 vee Z nbsp and Z Xk Xn displaystyle neg Z vee X k lor ldots vee X n nbsp with Z a new variable and repeating as often as necessary First order logic editIn first 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 first order resolution In resolution based automated theorem proving a CNF formula displaystyle nbsp l11 displaystyle l 11 nbsp displaystyle lor nbsp displaystyle ldots nbsp displaystyle lor nbsp l1n1 displaystyle l 1n 1 nbsp displaystyle nbsp displaystyle land nbsp displaystyle ldots nbsp displaystyle land nbsp displaystyle nbsp lm1 displaystyle l m1 nbsp displaystyle lor nbsp displaystyle ldots nbsp displaystyle lor nbsp lmnm displaystyle l mn m nbsp displaystyle nbsp 12 is commonly represented as a set of sets displaystyle nbsp displaystyle nbsp l11 displaystyle l 11 nbsp displaystyle nbsp displaystyle ldots nbsp displaystyle nbsp l1n1 displaystyle l 1n 1 nbsp displaystyle nbsp displaystyle nbsp displaystyle ldots nbsp displaystyle nbsp displaystyle nbsp lm1 displaystyle l m1 nbsp displaystyle nbsp displaystyle ldots nbsp displaystyle nbsp lmnm displaystyle l mn m nbsp displaystyle nbsp displaystyle nbsp See below for an example Converting from first order logic edit To convert first order logic to CNF 13 Convert to negation normal form Eliminate implications and equivalences repeatedly replace P Q displaystyle P rightarrow Q nbsp with P Q displaystyle lnot P lor Q nbsp replace P Q displaystyle P leftrightarrow Q nbsp with P Q P Q displaystyle P lor lnot Q land lnot P lor Q nbsp Eventually this will eliminate all occurrences of displaystyle rightarrow nbsp and displaystyle leftrightarrow nbsp Move NOTs inwards by repeatedly applying De Morgan s law Specifically replace P Q displaystyle lnot P lor Q nbsp with P Q displaystyle lnot P land lnot Q nbsp replace P Q displaystyle lnot P land Q nbsp with P Q displaystyle lnot P lor lnot Q nbsp and replace P displaystyle lnot lnot P nbsp with P displaystyle P nbsp replace xP x displaystyle lnot forall xP x nbsp with x P x displaystyle exists x lnot P x nbsp xP x displaystyle lnot exists xP x nbsp with x P x displaystyle forall x lnot P x nbsp After that a displaystyle lnot nbsp may occur only immediately before a predicate symbol Standardize variables For sentences like xP x xQ x displaystyle forall xP x lor exists xQ x nbsp which use the same variable name twice change the name of one of the variables This avoids confusion later when dropping quantifiers For example x yAnimal y Loves x y yLoves y x displaystyle forall x exists y mathrm Animal y land lnot mathrm Loves x y lor exists y mathrm Loves y x nbsp is renamed to x yAnimal y Loves x y zLoves z x displaystyle forall x exists y mathrm Animal y land lnot mathrm Loves x y lor exists z mathrm Loves z x nbsp Skolemize the statement Move quantifiers outwards repeatedly replace P xQ x displaystyle P land forall xQ x nbsp with x P Q x displaystyle forall x P land Q x nbsp replace P xQ x displaystyle P lor forall xQ x nbsp with x P Q x displaystyle forall x P lor Q x nbsp replace P xQ x displaystyle P land exists xQ x nbsp with x P Q x displaystyle exists x P land Q x nbsp replace P xQ x displaystyle P lor exists xQ x nbsp with x P Q x displaystyle exists x P lor Q x nbsp These replacements preserve equivalence since the previous variable standardization step ensured that x displaystyle x nbsp doesn t occur in P displaystyle P nbsp After these replacements a quantifier may occur only in the initial prefix of the formula but never inside a displaystyle lnot nbsp displaystyle land nbsp or displaystyle lor nbsp Repeatedly replace x1 xn yP y displaystyle forall x 1 ldots forall x n exists y P y nbsp with x1 xnP f x1 xn displaystyle forall x 1 ldots forall x n P f x 1 ldots x n nbsp where f displaystyle f nbsp is a new n displaystyle n nbsp ary function symbol a so called Skolem function This is the only step that preserves only satisfiability rather than equivalence It eliminates all existential quantifiers Drop all universal quantifiers Distribute ORs inwards over ANDs repeatedly replace P Q R displaystyle P lor Q land R nbsp with P Q P R displaystyle P lor Q land P lor R nbsp ExampleAs an example the formula saying Anyone who loves all animals is in turn loved by someone is converted into CNF and subsequently into clause form in the last line as follows highlighting replacement rule redexes in red displaystyle color red text red nbsp x displaystyle forall x nbsp displaystyle nbsp y displaystyle forall y nbsp Animal displaystyle mathrm Animal nbsp y displaystyle y nbsp displaystyle nbsp displaystyle color red rightarrow nbsp Loves x displaystyle mathrm Loves x nbsp y displaystyle y nbsp displaystyle nbsp displaystyle nbsp displaystyle rightarrow nbsp displaystyle nbsp displaystyle exists nbsp y displaystyle y nbsp Loves displaystyle mathrm Loves nbsp y displaystyle y nbsp x displaystyle x nbsp displaystyle nbsp x displaystyle forall x nbsp displaystyle nbsp y displaystyle forall y nbsp displaystyle lnot nbsp Animal displaystyle mathrm Animal nbsp y displaystyle y nbsp displaystyle nbsp displaystyle lor nbsp Loves x displaystyle mathrm Loves x nbsp y displaystyle y nbsp displaystyle nbsp displaystyle nbsp displaystyle color red rightarrow nbsp displaystyle nbsp displaystyle exists nbsp y displaystyle y nbsp Loves displaystyle mathrm Loves nbsp y displaystyle y nbsp x displaystyle x nbsp displaystyle nbsp by 1 1 x displaystyle forall x nbsp displaystyle color red lnot nbsp displaystyle nbsp y displaystyle color red forall y nbsp displaystyle lnot nbsp Animal displaystyle mathrm Animal nbsp y displaystyle y nbsp displaystyle nbsp displaystyle lor nbsp Loves x displaystyle mathrm Loves x nbsp y displaystyle y nbsp displaystyle nbsp displaystyle nbsp displaystyle lor nbsp displaystyle nbsp displaystyle exists nbsp y displaystyle y nbsp Loves displaystyle mathrm Loves nbsp y displaystyle y nbsp x displaystyle x nbsp displaystyle nbsp by 1 1 x displaystyle forall x nbsp displaystyle nbsp y displaystyle exists y nbsp displaystyle color red lnot nbsp displaystyle nbsp displaystyle lnot nbsp Animal displaystyle mathrm Animal nbsp y displaystyle y nbsp displaystyle nbsp displaystyle color red lor nbsp Loves x displaystyle mathrm Loves x nbsp y displaystyle y nbsp displaystyle nbsp displaystyle nbsp displaystyle nbsp displaystyle lor nbsp displaystyle nbsp displaystyle exists nbsp y displaystyle y nbsp Loves displaystyle mathrm Loves nbsp y displaystyle y nbsp x displaystyle x nbsp displaystyle nbsp by 1 2 x displaystyle forall x nbsp displaystyle nbsp y displaystyle exists y nbsp displaystyle color red lnot nbsp displaystyle color red lnot nbsp Animal displaystyle mathrm Animal nbsp y displaystyle y nbsp displaystyle nbsp displaystyle land nbsp displaystyle lnot nbsp Loves x displaystyle mathrm Loves x nbsp y displaystyle y nbsp displaystyle nbsp displaystyle nbsp displaystyle lor nbsp displaystyle nbsp displaystyle exists nbsp y displaystyle y nbsp Loves displaystyle mathrm Loves nbsp y displaystyle y nbsp x displaystyle x nbsp displaystyle nbsp by 1 2 x displaystyle forall x nbsp displaystyle nbsp y displaystyle color red exists y nbsp Animal displaystyle mathrm Animal nbsp y displaystyle y nbsp displaystyle nbsp displaystyle land nbsp displaystyle lnot nbsp Loves x displaystyle mathrm Loves x nbsp y displaystyle y nbsp displaystyle nbsp displaystyle nbsp displaystyle lor nbsp displaystyle nbsp displaystyle color red exists nbsp y displaystyle color red y nbsp Loves displaystyle mathrm Loves nbsp y displaystyle y nbsp x displaystyle x nbsp displaystyle nbsp by 1 2 x displaystyle forall x nbsp displaystyle nbsp y displaystyle exists y nbsp Animal displaystyle mathrm Animal nbsp y displaystyle y nbsp displaystyle nbsp displaystyle land nbsp displaystyle lnot nbsp Loves x displaystyle mathrm Loves x nbsp y displaystyle y nbsp displaystyle nbsp displaystyle nbsp displaystyle color red lor nbsp displaystyle nbsp displaystyle color red exists nbsp z displaystyle color red z nbsp Loves displaystyle mathrm Loves nbsp z displaystyle z nbsp x displaystyle x nbsp displaystyle nbsp by 2 x displaystyle forall x nbsp z displaystyle exists z nbsp displaystyle nbsp y displaystyle color red exists y nbsp Animal displaystyle mathrm Animal nbsp y displaystyle y nbsp displaystyle nbsp displaystyle land nbsp displaystyle lnot nbsp Loves x displaystyle mathrm Loves x nbsp y displaystyle y nbsp displaystyle nbsp displaystyle nbsp displaystyle color red lor nbsp Loves displaystyle mathrm Loves nbsp z displaystyle z nbsp x displaystyle x nbsp by 3 1 x displaystyle forall x nbsp z displaystyle color red exists z nbsp y displaystyle exists y nbsp displaystyle nbsp Animal displaystyle mathrm Animal nbsp y displaystyle y nbsp displaystyle nbsp displaystyle land nbsp displaystyle lnot nbsp Loves x displaystyle mathrm Loves x nbsp y displaystyle y nbsp displaystyle nbsp displaystyle nbsp displaystyle lor nbsp Loves displaystyle mathrm Loves nbsp z displaystyle z nbsp x displaystyle x nbsp by 3 1 x displaystyle forall x nbsp y displaystyle color red exists y nbsp displaystyle nbsp Animal displaystyle mathrm Animal nbsp y displaystyle y nbsp displaystyle nbsp displaystyle land nbsp displaystyle lnot nbsp Loves x displaystyle mathrm Loves x nbsp y displaystyle y nbsp displaystyle nbsp displaystyle nbsp displaystyle lor nbsp Loves displaystyle mathrm Loves nbsp g x displaystyle g x nbsp x displaystyle x nbsp by 3 2 displaystyle nbsp Animal displaystyle mathrm Animal nbsp f x displaystyle f x nbsp displaystyle nbsp displaystyle color red land nbsp displaystyle lnot nbsp Loves x displaystyle mathrm Loves x nbsp f x displaystyle f x nbsp displaystyle nbsp displaystyle nbsp displaystyle color red lor nbsp Loves displaystyle mathrm Loves nbsp g x displaystyle g x nbsp x displaystyle x nbsp by 4 displaystyle nbsp Animal displaystyle mathrm Animal nbsp f x displaystyle f x nbsp displaystyle nbsp displaystyle color red lor nbsp Loves displaystyle mathrm Loves nbsp g x displaystyle g x nbsp x displaystyle x nbsp displaystyle nbsp displaystyle color red land nbsp displaystyle nbsp Loves x f x displaystyle lnot mathrm Loves x f x nbsp displaystyle color red lor nbsp Loves g x x displaystyle mathrm Loves g x x nbsp displaystyle nbsp by 5 displaystyle nbsp displaystyle nbsp Animal displaystyle mathrm Animal nbsp f x displaystyle f x nbsp displaystyle nbsp displaystyle nbsp Loves displaystyle mathrm Loves nbsp g x displaystyle g x nbsp x displaystyle x nbsp displaystyle nbsp displaystyle nbsp displaystyle nbsp Loves x f x displaystyle lnot mathrm Loves x f x nbsp displaystyle nbsp Loves g x x displaystyle mathrm Loves g x x nbsp displaystyle nbsp displaystyle nbsp clause representation Informally the Skolem function g x displaystyle g x nbsp can be thought of as yielding the person by whom x displaystyle x nbsp is loved while f x displaystyle f x nbsp yields the animal if any that x displaystyle x nbsp doesn t love The 3rd last line from below then reads as x displaystyle x nbsp doesn t love the animal f x displaystyle f x nbsp or else x displaystyle x nbsp is loved by g x displaystyle g x nbsp The 2nd last line from above Animal f x Loves g x x Loves x f x Loves g x x displaystyle mathrm Animal f x lor mathrm Loves g x x land lnot mathrm Loves x f x lor mathrm Loves g x x nbsp is the CNF See also editAlgebraic normal form Disjunctive normal form Horn clause A Horn clause is a disjunctive clause a disjunction of literals with at most one positive i e unnegated literal Quine McCluskey algorithmNotes edit a b Howson 2005 p 46 a b c see Disjunctive normal form Conversion to DNF 1 m displaystyle 1 leq m leq nbsp maximum number of conjunctions for ϕ displaystyle phi nbsp 1 ini displaystyle 1 leq in i leq nbsp maximum number of literals for ϕ displaystyle phi nbsp a b ϕ displaystyle phi nbsp NOT p AND q IFF NOT r NAND p XOR q Tseitin 1968 Jackson amp Sheridan 2004 P L 22n displaystyle left mathcal P L right 2 2n nbsp like a b b a a b b displaystyle a land b lor b land a lor a land b land b nbsp a b It is assumed that repetitions and variations 9 based on the commutativity and associativity of displaystyle lor nbsp and displaystyle land nbsp do not occur since one way to check a CNF for satisfiability is to convert it into a DNF the satisfiability of which can be checked in linear time 1 m displaystyle 1 leq m leq nbsp maximum number of disjunctions1 ini displaystyle 1 leq in i leq nbsp maximum number of literals Russel amp Norvig 2010 pp 345 347 9 5 1 Conjunctive normal form for first order logic References editAndrews Peter B 2013 An Introduction to Mathematical Logic and Type Theory To Truth Through Proof ISBN 9401599343 Howson Colin 11 October 2005 1997 Logic with trees an introduction to symbolic logic Routledge ISBN 978 1 134 78550 6 Jackson Paul Sheridan Daniel 10 May 2004 Clause Form Conversions for Boolean Circuits PDF In Hoos Holger H Mitchell David G eds Theory and Applications of Satisfiability Testing 7th International Conference on Theory and Applications of Satisfiability Testing SAT Revised Selected Papers Lecture Notes in Computer Science Vol 3542 Vancouver BC Canada Springer 2005 pp 183 198 doi 10 1007 11527695 15 ISBN 978 3 540 31580 3 Kleine Buning Hans Lettmann Theodor 28 August 1999 Propositional Logic Deduction and Algorithms Cambridge University Press ISBN 978 0 521 63017 7 Russel Stuart Norvig Peter eds 2010 1995 Artificial Intelligence A Modern Approach PDF 3rd ed Upper Saddle River NJ Prentice Hall ISBN 978 0 13 604259 4 Archived PDF from the original on 31 August 2017 Tseitin Grigori S 1968 On the Complexity of Derivation in Propositional Calculus PDF In Slisenko A O ed Structures in Constructive Mathematics and Mathematical Logic Part II Seminars in Mathematics translated from Russian Steklov Mathematical Institute pp 115 125 Whitesitt J Eldon 24 May 2012 1961 Boolean Algebra and Its Applications Courier Corporation ISBN 978 0 486 15816 7 External links edit Conjunctive normal form Encyclopedia of Mathematics EMS Press 2001 1994 Java tool for converting a truth table into CNF and DNF Universitat Marburg Retrieved 31 December 2023 Retrieved from https en wikipedia org w index php title Conjunctive normal form amp oldid 1207259709, wikipedia, wiki, book, books, library,

article

, read, download, free, free download, mp3, video, mp4, 3gp, jpg, jpeg, gif, png, picture, music, song, movie, book, game, games.