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

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. LiteralVariable
  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:[1]

  • , 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

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

Basic algorithm

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

Conversion by syntactic means

Convert to CNF the propositional formula .

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

,[4]

where each is a conjunction of literals .[5]

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

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

Conversion by semantic means

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

.[6]

The corresponding truth table is

TTTFTFFTF
TTFFTFTTF
TFTTFTFTT
TFFTFFTFT
FTTTFTFTT
FTFTFFTFT
FFTTFTFTF
FFFTFTTTF

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

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

Consider a propositional formula with variables, .

There are possible literals: .

has non-empty subsets.[9]

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

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:[11]

This formula is a contradiction.

Computational complexity

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,[12] 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 k3) 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

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

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

See below for an example.

Converting from first-order logic

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

  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

Notes

  1. However, they are in negation normal form.
  2. 1 2 Howson 2005, p. 46.
  3. 1 2 3 see Disjunctive normal form#Conversion to DNF
  4. maximum number of conjunctions for
  5. maximum number of literals for
  6. 1 2 = ((NOT (p AND q)) IFF ((NOT r) NAND (p XOR q)))
  7. Tseitin 1968.
  8. Jackson & Sheridan 2004.
  9. like
  10. 1 2 It is assumed that repetitions and variations[10] 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

  • Andrews, Peter B. (2013). An Introduction to Mathematical Logic and Type Theory: To Truth Through Proof. ISBN 9401599343.
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.