Conjunctive normal form

From HandWiki
Short description: Standard form of Boolean function

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 ([math]\displaystyle{ \vee }[/math]), and ([math]\displaystyle{ \wedge }[/math]), and not ([math]\displaystyle{ \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 CNF:

  1. CNF → (Disjunction) [math]\displaystyle{ \land }[/math] CNF
  2. CNF → (Disjunction)
  3. DisjunctionLiteral [math]\displaystyle{ \lor }[/math] Disjunction
  4. DisjunctionLiteral
  5. Literal[math]\displaystyle{ \neg }[/math]Variable
  6. LiteralVariable

Where Variable is any variable.

All of the following formulas in the variables [math]\displaystyle{ A,B,C,D,E }[/math], and [math]\displaystyle{ F }[/math] are in conjunctive normal form:

  • [math]\displaystyle{ (A \lor \neg B \lor \neg C) \land (\neg D \lor E \lor F \lor D \lor F) }[/math]
  • [math]\displaystyle{ (A \lor B) \land (C) }[/math]
  • [math]\displaystyle{ (A \lor B) }[/math]
  • [math]\displaystyle{ (A) }[/math]

The following formulas are not in conjunctive normal form:[1]

  • [math]\displaystyle{ \neg (A \land B) }[/math], since an AND is nested within a NOT
  • [math]\displaystyle{ \neg(A \lor B) \land C }[/math], since an OR is nested within a NOT
  • [math]\displaystyle{ A \land (B \lor (D \land E)) }[/math], 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 [math]\displaystyle{ \phi }[/math] builds upon [math]\displaystyle{ \lnot \phi }[/math] in disjunctive normal form (DNF): step 1.[3]
Then [math]\displaystyle{ \lnot \phi_{DNF} }[/math] is converted to [math]\displaystyle{ \phi_{CNF} }[/math] by swapping ANDs with ORs and vice versa while negating all the literals. Remove all [math]\displaystyle{ \lnot \lnot }[/math].[2]

Conversion by syntactic means

Convert to CNF the propositional formula [math]\displaystyle{ \phi }[/math].

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

[math]\displaystyle{ \lnot \phi_{DNF} = (C_1 \lor C_2 \lor \ldots \lor C_i \lor \ldots \lor C_m) }[/math],[4]

where each [math]\displaystyle{ C_i }[/math] is a conjunction of literals [math]\displaystyle{ l_{i1} \land l_{i2} \land \ldots \land l_{in_i} }[/math].[5]

Step 2: Negate [math]\displaystyle{ \lnot \phi_{DNF} }[/math]. Then shift [math]\displaystyle{ \lnot }[/math] inwards by applying the (generalized) De Morgan's equivalences until no longer possible.

[math]\displaystyle{ \begin{align} \phi &\leftrightarrow \lnot \lnot \phi_{DNF} \\ &= \lnot (C_1 \lor C_2 \lor \ldots \lor C_i \lor \ldots \lor C_m) \\ &\leftrightarrow \lnot C_1 \land \lnot C_2 \land \ldots \land \lnot C_i \land \ldots \land \lnot C_m &&\text{// (generalized) D.M.} \end{align} }[/math]

where
[math]\displaystyle{ \begin{align} \lnot C_i &= \lnot (l_{i1} \land l_{i2} \land \ldots \land l_{in_i}) \\ &\leftrightarrow (\lnot l_{i1} \lor \lnot l_{i2} \lor \ldots \lor \lnot l_{in_i}) &&\text{// (generalized) D.M.} \end{align} }[/math]

Step 3: Remove all double negations.

Example

Convert to CNF the propositional formula [math]\displaystyle{ \phi = ((\lnot (p \land q)) \leftrightarrow (\lnot r \uparrow (p \oplus q))) }[/math].[6]

The (full) DNF equivalent of its negation is[3]
[math]\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) }[/math]

[math]\displaystyle{ \begin{align} \phi &\leftrightarrow \lnot \lnot \phi_{DNF} \\ &= \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) \} \\ &\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)} &&\text{// generalized D.M. } \\ &\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) &&\text{// generalized D.M. } (4 \times) \\ &\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) &&\text{// remove all } \lnot \lnot \\ &= \phi_{CNF} \end{align} }[/math]

Conversion by semantic means

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

[math]\displaystyle{ \phi = ((\lnot (p \land q)) \leftrightarrow (\lnot r \uparrow (p \oplus q))) }[/math].[6]

The corresponding truth table is

[math]\displaystyle{ p }[/math] [math]\displaystyle{ q }[/math] [math]\displaystyle{ r }[/math] [math]\displaystyle{ ( }[/math] [math]\displaystyle{ \lnot }[/math] [math]\displaystyle{ (p \land q) }[/math] [math]\displaystyle{ ) }[/math] [math]\displaystyle{ \leftrightarrow }[/math] [math]\displaystyle{ ( }[/math] [math]\displaystyle{ \lnot r }[/math] [math]\displaystyle{ \uparrow }[/math] [math]\displaystyle{ (p \oplus q) }[/math] [math]\displaystyle{ ) }[/math]
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 [math]\displaystyle{ \phi }[/math] is

[math]\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) }[/math]

Each disjunction reflects an assignment of variables for which [math]\displaystyle{ \phi }[/math] evaluates to F(alse).
If in such an assignment a variable [math]\displaystyle{ V }[/math]

  • is T(rue), then the literal is set to [math]\displaystyle{ \lnot V }[/math] in the disjunction,
  • is F(alse), then the literal is set to [math]\displaystyle{ V }[/math] 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

[math]\displaystyle{ (X_1 \wedge Y_1) \vee (X_2 \wedge Y_2) \vee \ldots \vee (X_n \wedge Y_n) }[/math]

into CNF produces a formula with [math]\displaystyle{ 2^n }[/math] clauses:

[math]\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). }[/math]

Each clause contains either [math]\displaystyle{ X_i }[/math] or [math]\displaystyle{ Y_i }[/math] for each [math]\displaystyle{ i }[/math].

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 [math]\displaystyle{ Z_1,\ldots,Z_n }[/math] as follows:

[math]\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). }[/math]

An interpretation satisfies this formula only if at least one of the new variables is true. If this variable is [math]\displaystyle{ Z_i }[/math], then both [math]\displaystyle{ X_i }[/math] and [math]\displaystyle{ Y_i }[/math] 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 [math]\displaystyle{ Z_i }[/math] 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 [math]\displaystyle{ Z_i \vee \neg X_i \vee \neg Y_i }[/math]. With these clauses, the formula implies [math]\displaystyle{ Z_i \equiv X_i \wedge Y_i }[/math]; this formula is often regarded to "define" [math]\displaystyle{ Z_i }[/math] to be a name for [math]\displaystyle{ X_i \wedge Y_i }[/math].

Maximum number of disjunctions

Consider a propositional formula with [math]\displaystyle{ n }[/math] variables, [math]\displaystyle{ n \ge 1 }[/math].

There are [math]\displaystyle{ 2n }[/math] possible literals: [math]\displaystyle{ L = \{ p_1, \lnot p_1, p_2, \lnot p_2, \ldots, p_n, \lnot p_n\} }[/math].

[math]\displaystyle{ L }[/math] has [math]\displaystyle{ (2^{2n} -1) }[/math] non-empty subsets.[9]

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

All truth-functional combinations can be expressed with [math]\displaystyle{ 2^{n} }[/math] disjunctions, one for each row of the truth table.
In the example below they are underlined.

Example

Consider a formula with two variables [math]\displaystyle{ p }[/math] and [math]\displaystyle{ q }[/math].

The longest possible CNF has [math]\displaystyle{ 2^{(2 \times 2)} -1 = 15 }[/math] disjunctions:[11]

[math]\displaystyle{ \begin{array}{lcl} (\lnot p) \land (p) \land (\lnot q) \land (q) \land \\ (\lnot p \or p) \land \underline{(\lnot p \or \lnot q)} \land \underline{(\lnot p \or q)} \land \underline{( p \or \lnot q)} \land \underline{( p \or q)} \land (\lnot q \or q) \land \\ (\lnot p \or p \or \lnot q) \land (\lnot p \or p \or q) \land (\lnot p \or \lnot q \or q) \land ( p \or \lnot q \or q) \land \\ (\lnot p \or p \or \lnot q \or q) \end{array} }[/math]

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 k≥3) by replacing each conjunct with more than k variables [math]\displaystyle{ X_1 \vee \ldots \vee X_k \vee \ldots \vee X_n }[/math] by two conjuncts [math]\displaystyle{ X_1 \vee \ldots \vee X_{k-1} \vee Z }[/math] and [math]\displaystyle{ \neg Z \vee X_k \lor \ldots \vee X_n }[/math] 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

[math]\displaystyle{ ( }[/math] [math]\displaystyle{ l_{11} }[/math] [math]\displaystyle{ \lor }[/math] [math]\displaystyle{ \ldots }[/math] [math]\displaystyle{ \lor }[/math] [math]\displaystyle{ l_{1n_1} }[/math] [math]\displaystyle{ ) }[/math] [math]\displaystyle{ \land }[/math] [math]\displaystyle{ \ldots }[/math] [math]\displaystyle{ \land }[/math] [math]\displaystyle{ ( }[/math] [math]\displaystyle{ l_{m1} }[/math] [math]\displaystyle{ \lor }[/math] [math]\displaystyle{ \ldots }[/math] [math]\displaystyle{ \lor }[/math] [math]\displaystyle{ l_{mn_m} }[/math] [math]\displaystyle{ ) }[/math] ,[13] is commonly represented as a set of sets
[math]\displaystyle{ \{ }[/math] [math]\displaystyle{ \{ }[/math] [math]\displaystyle{ l_{11} }[/math] [math]\displaystyle{ , }[/math] [math]\displaystyle{ \ldots }[/math] [math]\displaystyle{ , }[/math] [math]\displaystyle{ l_{1n_1} }[/math] [math]\displaystyle{ \} }[/math] [math]\displaystyle{ , }[/math] [math]\displaystyle{ \ldots }[/math] [math]\displaystyle{ , }[/math] [math]\displaystyle{ \{ }[/math] [math]\displaystyle{ l_{m1} }[/math] [math]\displaystyle{ , }[/math] [math]\displaystyle{ \ldots }[/math] [math]\displaystyle{ , }[/math] [math]\displaystyle{ l_{mn_m} }[/math] [math]\displaystyle{ \} }[/math] [math]\displaystyle{ \} }[/math] .

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 [math]\displaystyle{ P \rightarrow Q }[/math] with [math]\displaystyle{ \lnot P \lor Q }[/math]; replace [math]\displaystyle{ P \leftrightarrow Q }[/math] with [math]\displaystyle{ (P \lor \lnot Q) \land (\lnot P \lor Q) }[/math]. Eventually, this will eliminate all occurrences of [math]\displaystyle{ \rightarrow }[/math] and [math]\displaystyle{ \leftrightarrow }[/math].
    2. Move NOTs inwards by repeatedly applying De Morgan's law. Specifically, replace [math]\displaystyle{ \lnot (P \lor Q) }[/math] with [math]\displaystyle{ (\lnot P) \land (\lnot Q) }[/math]; replace [math]\displaystyle{ \lnot (P \land Q) }[/math] with [math]\displaystyle{ (\lnot P) \lor (\lnot Q) }[/math]; and replace [math]\displaystyle{ \lnot\lnot P }[/math] with [math]\displaystyle{ P }[/math]; replace [math]\displaystyle{ \lnot (\forall x P(x)) }[/math] with [math]\displaystyle{ \exists x \lnot P(x) }[/math]; [math]\displaystyle{ \lnot (\exists x P(x)) }[/math] with [math]\displaystyle{ \forall x \lnot P(x) }[/math]. After that, a [math]\displaystyle{ \lnot }[/math] may occur only immediately before a predicate symbol.
  2. Standardize variables
    1. For sentences like [math]\displaystyle{ (\forall x P(x)) \lor (\exists x Q(x)) }[/math] which use the same variable name twice, change the name of one of the variables. This avoids confusion later when dropping quantifiers. For example, [math]\displaystyle{ \forall x [\exists y \mathrm{Animal}(y) \land \lnot \mathrm{Loves}(x, y)] \lor [\exists y \mathrm{Loves}(y, x)] }[/math] is renamed to [math]\displaystyle{ \forall x [\exists y \mathrm{Animal}(y) \land \lnot \mathrm{Loves}(x, y)] \lor [\exists z \mathrm{Loves}(z,x)] }[/math].
  3. Skolemize the statement
    1. Move quantifiers outwards: repeatedly replace [math]\displaystyle{ P \land (\forall x Q(x)) }[/math] with [math]\displaystyle{ \forall x (P \land Q(x)) }[/math]; replace [math]\displaystyle{ P \lor (\forall x Q(x)) }[/math] with [math]\displaystyle{ \forall x (P \lor Q(x)) }[/math]; replace [math]\displaystyle{ P \land (\exists x Q(x)) }[/math] with [math]\displaystyle{ \exists x (P \land Q(x)) }[/math]; replace [math]\displaystyle{ P \lor (\exists x Q(x)) }[/math] with [math]\displaystyle{ \exists x (P \lor Q(x)) }[/math]. These replacements preserve equivalence, since the previous variable standardization step ensured that [math]\displaystyle{ x }[/math] doesn't occur in [math]\displaystyle{ P }[/math]. After these replacements, a quantifier may occur only in the initial prefix of the formula, but never inside a [math]\displaystyle{ \lnot }[/math], [math]\displaystyle{ \land }[/math], or [math]\displaystyle{ \lor }[/math].
    2. Repeatedly replace [math]\displaystyle{ \forall x_1 \ldots \forall x_n \; \exists y \; P(y) }[/math] with [math]\displaystyle{ \forall x_1 \ldots \forall x_n \; P(f(x_1,\ldots,x_n)) }[/math], where [math]\displaystyle{ f }[/math] is a new [math]\displaystyle{ n }[/math]-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 [math]\displaystyle{ P \lor (Q \land R) }[/math] with [math]\displaystyle{ (P \lor Q) \land (P \lor R) }[/math].

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 [math]\displaystyle{ {\color{red}{\text{red}}} }[/math]):

[math]\displaystyle{ \forall x }[/math] [math]\displaystyle{ ( }[/math] [math]\displaystyle{ \forall y }[/math] [math]\displaystyle{ \mathrm{Animal}( }[/math] [math]\displaystyle{ y }[/math] [math]\displaystyle{ ) }[/math] [math]\displaystyle{ \color{red}\rightarrow }[/math] [math]\displaystyle{ \mathrm{Loves}(x, }[/math] [math]\displaystyle{ y }[/math] [math]\displaystyle{ ) }[/math] [math]\displaystyle{ ) }[/math] [math]\displaystyle{ \rightarrow }[/math] [math]\displaystyle{ ( }[/math] [math]\displaystyle{ \exists }[/math] [math]\displaystyle{ y }[/math] [math]\displaystyle{ \mathrm{Loves}( }[/math] [math]\displaystyle{ y }[/math] [math]\displaystyle{ ,x) }[/math] [math]\displaystyle{ ) }[/math]
[math]\displaystyle{ \forall x }[/math] [math]\displaystyle{ ( }[/math] [math]\displaystyle{ \forall y }[/math] [math]\displaystyle{ \lnot }[/math] [math]\displaystyle{ \mathrm{Animal}( }[/math] [math]\displaystyle{ y }[/math] [math]\displaystyle{ ) }[/math] [math]\displaystyle{ \lor }[/math] [math]\displaystyle{ \mathrm{Loves}(x, }[/math] [math]\displaystyle{ y }[/math] [math]\displaystyle{ ) }[/math] [math]\displaystyle{ ) }[/math] [math]\displaystyle{ \color{red}\rightarrow }[/math] [math]\displaystyle{ ( }[/math] [math]\displaystyle{ \exists }[/math] [math]\displaystyle{ y }[/math] [math]\displaystyle{ \mathrm{Loves}( }[/math] [math]\displaystyle{ y }[/math] [math]\displaystyle{ ,x) }[/math] [math]\displaystyle{ ) }[/math] by 1.1
[math]\displaystyle{ \forall x }[/math] [math]\displaystyle{ \color{red}\lnot }[/math] [math]\displaystyle{ ( }[/math] [math]\displaystyle{ {\color{red}{\forall y}} }[/math] [math]\displaystyle{ \lnot }[/math] [math]\displaystyle{ \mathrm{Animal}( }[/math] [math]\displaystyle{ y }[/math] [math]\displaystyle{ ) }[/math] [math]\displaystyle{ \lor }[/math] [math]\displaystyle{ \mathrm{Loves}(x, }[/math] [math]\displaystyle{ y }[/math] [math]\displaystyle{ ) }[/math] [math]\displaystyle{ ) }[/math] [math]\displaystyle{ \lor }[/math] [math]\displaystyle{ ( }[/math] [math]\displaystyle{ \exists }[/math] [math]\displaystyle{ y }[/math] [math]\displaystyle{ \mathrm{Loves}( }[/math] [math]\displaystyle{ y }[/math] [math]\displaystyle{ ,x) }[/math] [math]\displaystyle{ ) }[/math] by 1.1
[math]\displaystyle{ \forall x }[/math] [math]\displaystyle{ ( }[/math] [math]\displaystyle{ \exists y }[/math] [math]\displaystyle{ \color{red}\lnot }[/math] [math]\displaystyle{ ( }[/math] [math]\displaystyle{ \lnot }[/math] [math]\displaystyle{ \mathrm{Animal}( }[/math] [math]\displaystyle{ y }[/math] [math]\displaystyle{ ) }[/math] [math]\displaystyle{ \color{red}\lor }[/math] [math]\displaystyle{ \mathrm{Loves}(x, }[/math] [math]\displaystyle{ y }[/math] [math]\displaystyle{ ) }[/math] [math]\displaystyle{ ) }[/math] [math]\displaystyle{ ) }[/math] [math]\displaystyle{ \lor }[/math] [math]\displaystyle{ ( }[/math] [math]\displaystyle{ \exists }[/math] [math]\displaystyle{ y }[/math] [math]\displaystyle{ \mathrm{Loves}( }[/math] [math]\displaystyle{ y }[/math] [math]\displaystyle{ ,x) }[/math] [math]\displaystyle{ ) }[/math] by 1.2
[math]\displaystyle{ \forall x }[/math] [math]\displaystyle{ ( }[/math] [math]\displaystyle{ \exists y }[/math] [math]\displaystyle{ \color{red}\lnot }[/math] [math]\displaystyle{ \color{red}\lnot }[/math] [math]\displaystyle{ \mathrm{Animal}( }[/math] [math]\displaystyle{ y }[/math] [math]\displaystyle{ ) }[/math] [math]\displaystyle{ \land }[/math] [math]\displaystyle{ \lnot }[/math] [math]\displaystyle{ \mathrm{Loves}(x, }[/math] [math]\displaystyle{ y }[/math] [math]\displaystyle{ ) }[/math] [math]\displaystyle{ ) }[/math] [math]\displaystyle{ \lor }[/math] [math]\displaystyle{ ( }[/math] [math]\displaystyle{ \exists }[/math] [math]\displaystyle{ y }[/math] [math]\displaystyle{ \mathrm{Loves}( }[/math] [math]\displaystyle{ y }[/math] [math]\displaystyle{ ,x) }[/math] [math]\displaystyle{ ) }[/math] by 1.2
[math]\displaystyle{ \forall x }[/math] [math]\displaystyle{ ( }[/math] [math]\displaystyle{ {\color{red}{\exists y}} }[/math] [math]\displaystyle{ \mathrm{Animal}( }[/math] [math]\displaystyle{ y }[/math] [math]\displaystyle{ ) }[/math] [math]\displaystyle{ \land }[/math] [math]\displaystyle{ \lnot }[/math] [math]\displaystyle{ \mathrm{Loves}(x, }[/math] [math]\displaystyle{ y }[/math] [math]\displaystyle{ ) }[/math] [math]\displaystyle{ ) }[/math] [math]\displaystyle{ \lor }[/math] [math]\displaystyle{ ( }[/math] [math]\displaystyle{ \color{red}\exists }[/math] [math]\displaystyle{ \color{red}y }[/math] [math]\displaystyle{ \mathrm{Loves}( }[/math] [math]\displaystyle{ y }[/math] [math]\displaystyle{ ,x) }[/math] [math]\displaystyle{ ) }[/math] by 1.2
[math]\displaystyle{ \forall x }[/math] [math]\displaystyle{ ( }[/math] [math]\displaystyle{ \exists y }[/math] [math]\displaystyle{ \mathrm{Animal}( }[/math] [math]\displaystyle{ y }[/math] [math]\displaystyle{ ) }[/math] [math]\displaystyle{ \land }[/math] [math]\displaystyle{ \lnot }[/math] [math]\displaystyle{ \mathrm{Loves}(x, }[/math] [math]\displaystyle{ y }[/math] [math]\displaystyle{ ) }[/math] [math]\displaystyle{ ) }[/math] [math]\displaystyle{ \color{red}\lor }[/math] [math]\displaystyle{ ( }[/math] [math]\displaystyle{ \color{red}\exists }[/math] [math]\displaystyle{ \color{red}z }[/math] [math]\displaystyle{ \mathrm{Loves}( }[/math] [math]\displaystyle{ z }[/math] [math]\displaystyle{ ,x) }[/math] [math]\displaystyle{ ) }[/math] by 2
[math]\displaystyle{ \forall x }[/math] [math]\displaystyle{ \exists z }[/math] [math]\displaystyle{ ( }[/math] [math]\displaystyle{ {\color{red}{\exists y}} }[/math] [math]\displaystyle{ \mathrm{Animal}( }[/math] [math]\displaystyle{ y }[/math] [math]\displaystyle{ ) }[/math] [math]\displaystyle{ \land }[/math] [math]\displaystyle{ \lnot }[/math] [math]\displaystyle{ \mathrm{Loves}(x, }[/math] [math]\displaystyle{ y }[/math] [math]\displaystyle{ ) }[/math] [math]\displaystyle{ ) }[/math] [math]\displaystyle{ \color{red}\lor }[/math] [math]\displaystyle{ \mathrm{Loves}( }[/math] [math]\displaystyle{ z }[/math] [math]\displaystyle{ ,x) }[/math] by 3.1
[math]\displaystyle{ \forall x }[/math] [math]\displaystyle{ {\color{red}{\exists z}} }[/math] [math]\displaystyle{ \exists y }[/math] [math]\displaystyle{ ( }[/math] [math]\displaystyle{ \mathrm{Animal}( }[/math] [math]\displaystyle{ y }[/math] [math]\displaystyle{ ) }[/math] [math]\displaystyle{ \land }[/math] [math]\displaystyle{ \lnot }[/math] [math]\displaystyle{ \mathrm{Loves}(x, }[/math] [math]\displaystyle{ y }[/math] [math]\displaystyle{ ) }[/math] [math]\displaystyle{ ) }[/math] [math]\displaystyle{ \lor }[/math] [math]\displaystyle{ \mathrm{Loves}( }[/math] [math]\displaystyle{ z }[/math] [math]\displaystyle{ ,x) }[/math] by 3.1
[math]\displaystyle{ \forall x }[/math] [math]\displaystyle{ {\color{red}{\exists y}} }[/math] [math]\displaystyle{ ( }[/math] [math]\displaystyle{ \mathrm{Animal}( }[/math] [math]\displaystyle{ y }[/math] [math]\displaystyle{ ) }[/math] [math]\displaystyle{ \land }[/math] [math]\displaystyle{ \lnot }[/math] [math]\displaystyle{ \mathrm{Loves}(x, }[/math] [math]\displaystyle{ y }[/math] [math]\displaystyle{ ) }[/math] [math]\displaystyle{ ) }[/math] [math]\displaystyle{ \lor }[/math] [math]\displaystyle{ \mathrm{Loves}( }[/math] [math]\displaystyle{ g(x) }[/math] [math]\displaystyle{ ,x) }[/math] by 3.2
[math]\displaystyle{ ( }[/math] [math]\displaystyle{ \mathrm{Animal}( }[/math] [math]\displaystyle{ f(x) }[/math] [math]\displaystyle{ ) }[/math] [math]\displaystyle{ \color{red}\land }[/math] [math]\displaystyle{ \lnot }[/math] [math]\displaystyle{ \mathrm{Loves}(x, }[/math] [math]\displaystyle{ f(x) }[/math] [math]\displaystyle{ ) }[/math] [math]\displaystyle{ ) }[/math] [math]\displaystyle{ \color{red}\lor }[/math] [math]\displaystyle{ \mathrm{Loves}( }[/math] [math]\displaystyle{ g(x) }[/math] [math]\displaystyle{ ,x) }[/math] by 4
[math]\displaystyle{ ( }[/math] [math]\displaystyle{ \mathrm{Animal}( }[/math] [math]\displaystyle{ f(x) }[/math] [math]\displaystyle{ ) }[/math] [math]\displaystyle{ \color{red}\lor }[/math] [math]\displaystyle{ \mathrm{Loves}( }[/math] [math]\displaystyle{ g(x) }[/math] [math]\displaystyle{ ,x) }[/math] [math]\displaystyle{ ) }[/math] [math]\displaystyle{ \color{red}\land }[/math] [math]\displaystyle{ ( }[/math] [math]\displaystyle{ \lnot \mathrm{Loves}(x,f(x)) }[/math] [math]\displaystyle{ \color{red}\lor }[/math] [math]\displaystyle{ \mathrm{Loves}(g(x),x) }[/math] [math]\displaystyle{ ) }[/math] by 5
[math]\displaystyle{ \{ }[/math] [math]\displaystyle{ \{ }[/math] [math]\displaystyle{ \mathrm{Animal}( }[/math] [math]\displaystyle{ f(x) }[/math] [math]\displaystyle{ ) }[/math] [math]\displaystyle{ , }[/math] [math]\displaystyle{ \mathrm{Loves}( }[/math] [math]\displaystyle{ g(x) }[/math] [math]\displaystyle{ ,x) }[/math] [math]\displaystyle{ \} }[/math] [math]\displaystyle{ , }[/math] [math]\displaystyle{ \{ }[/math] [math]\displaystyle{ \lnot \mathrm{Loves}(x,f(x)) }[/math] [math]\displaystyle{ , }[/math] [math]\displaystyle{ \mathrm{Loves}(g(x),x) }[/math] [math]\displaystyle{ \} }[/math] [math]\displaystyle{ \} }[/math] (clause representation)

Informally, the Skolem function [math]\displaystyle{ g(x) }[/math] can be thought of as yielding the person by whom [math]\displaystyle{ x }[/math] is loved, while [math]\displaystyle{ f(x) }[/math] yields the animal (if any) that [math]\displaystyle{ x }[/math] doesn't love. The 3rd last line from below then reads as "[math]\displaystyle{ x }[/math] doesn't love the animal [math]\displaystyle{ f(x) }[/math], or else [math]\displaystyle{ x }[/math] is loved by [math]\displaystyle{ g(x) }[/math]".

The 2nd last line from above, [math]\displaystyle{ (\mathrm{Animal}(f(x)) \lor \mathrm{Loves}(g(x), x)) \land (\lnot \mathrm{Loves}(x, f(x)) \lor \mathrm{Loves}(g(x), x)) }[/math], is the CNF.

See also

Notes

  1. However, they are in negation normal form.
  2. 2.0 2.1 Howson 2005, p. 46.
  3. 3.0 3.1 3.2 see Disjunctive normal form
  4. [math]\displaystyle{ 1 \le m \le }[/math] maximum number of conjunctions for [math]\displaystyle{ \phi }[/math]
  5. [math]\displaystyle{ 1 \le in_i \le }[/math] maximum number of literals for [math]\displaystyle{ \phi }[/math]
  6. 6.0 6.1 [math]\displaystyle{ \phi }[/math] = ((NOT (p AND q)) IFF ((NOT r) NAND (p XOR q)))
  7. Tseitin 1968.
  8. Jackson & Sheridan 2004.
  9. [math]\displaystyle{ \left|\mathcal{P}(L)\right| = 2^{2n} }[/math]
  10. like [math]\displaystyle{ (a \land b) \lor (b \land a) \lor (a \land b \land b) }[/math]
  11. 11.0 11.1 It is assumed that repetitions and variations[10] based on the commutativity and associativity of [math]\displaystyle{ \lor }[/math] and [math]\displaystyle{ \land }[/math] do not occur.
  12. 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
  13. [math]\displaystyle{ 1 \le m \le }[/math] maximum number of disjunctions
    [math]\displaystyle{ 1 \le in_i \le }[/math] maximum number of literals
  14. 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. 

External links