HOME

TheInfoList



OR:

In
Boolean logic In mathematics and mathematical logic, Boolean algebra is a branch of algebra. It differs from elementary algebra in two ways. First, the values of the variables are the truth values ''true'' and ''false'', usually denoted 1 and 0, whereas in ...
, a formula is in conjunctive normal form (CNF) or clausal normal form if it is a conjunction of one or more
clauses In language, a clause is a constituent that comprises a semantic predicand (expressed or not) and a semantic predicate. A typical clause consists of a subject and a syntactic predicate, the latter typically a verb phrase composed of a verb ...
, where a clause is a
disjunction In logic, disjunction is a logical connective typically notated as \lor and read aloud as "or". For instance, the English language sentence "it is raining or it is snowing" can be represented in logic using the disjunctive formula R \lor ...
of
literal Literal may refer to: * Interpretation of legal concepts: ** Strict constructionism ** The plain meaning rule (a.k.a. "literal rule") * Literal (mathematical logic), certain logical roles taken by propositions * Literal (computer programmin ...
s; 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 Automated theorem proving (also known as ATP or automated deduction) is a subfield of automated reasoning and mathematical logic dealing with proving mathematical theorems by computer programs. Automated reasoning over mathematical proof was ...
and
circuit theory Circuit may refer to: Science and technology Electrical engineering * Electrical circuit, a complete electrical network with a closed-loop giving a return path for current ** Analog circuit, uses continuous signal levels ** Balanced circ ...
. 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 only propositional connectives a formula in CNF can contain are and, or, and not. The not operator can only be used as part of a literal, which means that it can only precede a
propositional variable In mathematical logic, a propositional variable (also called a sentential variable or sentential letter) is an input variable (that can either be true or false) of a truth function. Propositional variables are the basic building-blocks of propos ...
or a predicate symbol. 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.


Examples and non-examples

All of the following formulas in the variables A,B,C,D,E, and F are in conjunctive normal form: * (A \lor \neg B \lor \neg C) \land (\neg D \lor E \lor F) * (A \lor B) \land (C) * (A \lor B) * (A) For clarity, the disjunctive clauses are written inside parentheses above. In disjunctive normal form with parenthesized conjunctive clauses, the last case is the same, but the next to last is (A) \lor (B). The constants ''true'' and ''false'' are denoted by the empty conjunct and one clause consisting of the empty disjunct, but are normally written explicitly. The following formulas are not in conjunctive normal form: * \neg (B \lor C), since an OR is nested within a NOT * (A \land B) \lor C * A \land (B \lor (D \land E)), since an AND is nested within an OR Every formula can be equivalently written as a formula in conjunctive normal form. The three non-examples in CNF are: * (\neg B) \land (\neg C) * (A \lor C) \land (B \lor C) * (A) \land (B \lor D) \land (B \lor E).


Conversion into CNF

Every propositional formula can be converted into an equivalent formula that is in CNF. This transformation is based on rules about logical equivalences: double negation elimination, De Morgan's laws, and the distributive law. 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 following non-CNF formula into CNF produces a formula with 2^n clauses: :(X_1 \wedge Y_1) \vee (X_2 \wedge Y_2) \vee \dots \vee (X_n \wedge Y_n). In particular, the generated formula is: :(X_1 \vee X_2 \vee \cdots \vee X_n) \wedge (Y_1 \vee X_2 \vee \cdots \vee X_n) \wedge (X_1 \vee Y_2 \vee \cdots \vee X_n) \wedge (Y_1 \vee Y_2 \vee \cdots \vee X_n) \wedge \cdots \wedge (Y_1 \vee Y_2 \vee \cdots \vee Y_n). This formula contains 2^n clauses; each clause contains either X_i or Y_i for each i. There exist transformations into CNF that avoid an exponential increase in size by preserving satisfiability rather than
equivalence Equivalence or Equivalent may refer to: Arts and entertainment *Album-equivalent unit, a measurement unit in the music industry *Equivalence class (music) *''Equivalent VIII'', or ''The Bricks'', a minimalist sculpture by Carl Andre *'' Equival ...
. 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 Z_1,\ldots,Z_n as follows: :(Z_1 \vee \cdots \vee Z_n) \wedge (\neg Z_1 \vee X_1) \wedge (\neg Z_1 \vee Y_1) \wedge \cdots \wedge (\neg Z_n \vee X_n) \wedge (\neg Z_n \vee Y_n). An
interpretation Interpretation may refer to: Culture * Aesthetic interpretation, an explanation of the meaning of a work of art * Allegorical interpretation, an approach that assumes a text should not be interpreted literally * Dramatic Interpretation, an event ...
satisfies this formula only if at least one of the new variables is true. If this variable is Z_i, then both X_i and Y_i 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 Z_i 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 Z_i \vee \neg X_i \vee \neg Y_i. With these clauses, the formula implies Z_i \equiv X_i \wedge Y_i; this formula is often regarded to "define" Z_i to be a name for X_i \wedge Y_i.


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 See
below Below may refer to: *Earth * Ground (disambiguation) * Soil * Floor * Bottom (disambiguation) * Less than *Temperatures below freezing * Hell or underworld People with the surname * Ernst von Below (1863–1955), German World War I general * Fr ...
for an example.


Computational complexity

An important set of problems in
computational complexity In computer science, the computational complexity or simply complexity of an algorithm is the amount of resources required to run it. Particular focus is given to computation time (generally measured by the number of needed elementary operations) ...
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 In computational complexity theory, a problem is NP-complete when: # it is a problem for which the correctness of each solution can be verified quickly (namely, in polynomial time) and a brute-force search algorithm can find a solution by tryin ...
(like any other ''k''-SAT problem with ''k''>2) while 2-SAT is known to have solutions in
polynomial time In computer science, the time complexity is the computational complexity that describes the amount of computer time it takes to run an algorithm. Time complexity is commonly estimated by counting the number of elementary operations performed by ...
. As a consequence,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 the task of converting a formula into a DNF, preserving satisfiability, is
NP-hard In computational complexity theory, NP-hardness ( non-deterministic polynomial-time hardness) is the defining property of a class of problems that are informally "at least as hard as the hardest problems in NP". A simple example of an NP-hard pr ...
; dually, converting into CNF, preserving
validity Validity or Valid may refer to: Science/mathematics/statistics: * Validity (logic), a property of a logical argument * Scientific: ** Internal validity, the validity of causal inferences within scientific studies, usually based on experiments ...
, 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 "''k''CNF" (for ''k''≥3) by replacing each conjunct with more than ''k'' variables X_1 \vee \cdots \vee X_k \vee \cdots \vee X_n by two conjuncts X_1 \vee \cdots \vee X_ \vee Z and \neg Z \vee X_k \cdots \vee X_n with a new variable, and repeating as often as necessary.


Converting from first-order logic

To convert
first-order logic First-order logic—also known as predicate logic, quantificational logic, and first-order predicate calculus—is a collection of formal systems used in mathematics, philosophy, linguistics, and computer science. First-order logic uses quanti ...
to CNF:Artificial Intelligence: A modern Approach
995...Russell and Norvig
#Convert to negation normal form. ## Eliminate implications and equivalences: repeatedly replace P \rightarrow Q with \lnot P \lor Q; replace P \leftrightarrow Q with (P \lor \lnot Q) \land (\lnot P \lor Q). Eventually, this will eliminate all occurrences of \rightarrow and \leftrightarrow. ##Move NOTs inwards by repeatedly applying De Morgan's law. Specifically, replace \lnot (P \lor Q) with (\lnot P) \land (\lnot Q); replace \lnot (P \land Q) with (\lnot P) \lor (\lnot Q); and replace \lnot\lnot P with P; replace \lnot (\forall x P(x)) with \exists x \lnot P(x); \lnot (\exists x P(x)) with \forall x \lnot P(x). After that, a \lnot may occur only immediately before a predicate symbol. #Standardize variables ##For sentences like (\forall x P(x)) \lor (\exists x Q(x)) which use the same variable name twice, change the name of one of the variables. This avoids confusion later when dropping quantifiers. For example, \forall x exists y \mathrm(y) \land \lnot \mathrm(x, y)\lor exists y \mathrm(y, x)/math> is renamed to \forall x exists y \mathrm(y) \land \lnot \mathrm(x, y)\lor exists z \mathrm(z,x)/math>. # Skolemize the statement ##Move quantifiers outwards: repeatedly replace P \land (\forall x Q(x)) with \forall x (P \land Q(x)); replace P \lor (\forall x Q(x)) with \forall x (P \lor Q(x)); replace P \land (\exists x Q(x)) with \exists x (P \land Q(x)); replace P \lor (\exists x Q(x)) with \exists x (P \lor Q(x)). These replacements preserve equivalence, since the previous variable standardization step ensured that x doesn't occur in P. After these replacements, a quantifier may occur only in the initial prefix of the formula, but never inside a \lnot, \land, or \lor. ##Repeatedly replace \forall x_1 \ldots \forall x_n \; \exists y \; P(y) with \forall x_1 \ldots \forall x_n \; P(f(x_1,\ldots,x_n)), where f is a new n-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 \lor (Q \land R) with (P \lor Q) \land (P \lor R). 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 In language, a clause is a constituent that comprises a semantic predicand (expressed or not) and a semantic predicate. A typical clause consists of a subject and a syntactic predicate, the latter typically a verb phrase composed of a verb wi ...
form in the last line) as follows (highlighting replacement rule
redex In mathematics, computer science, and logic, rewriting covers a wide range of methods of replacing subterms of a formula with other terms. Such methods may be achieved by rewriting systems (also known as rewrite systems, rewrite engines, or reduc ...
es in ): Informally, the Skolem function g(x) can be thought of as yielding the person by whom x is loved, while f(x) yields the 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, (\mathrm(f(x)) \lor \mathrm(g(x), x)) \land (\lnot \mathrm(x, f(x)) \lor \mathrm(g(x), x)), is the CNF.


Notes


See also

*
Algebraic normal form In Boolean algebra, the algebraic normal form (ANF), ring sum normal form (RSNF or RNF), ''Zhegalkin normal form'', or '' Reed–Muller expansion'' is a way of writing logical formulas in one of three subforms: * The entire formula is purely tr ...
* Disjunctive normal form * Horn clause * Quine–McCluskey algorithm


References

* * * Paul Jackson, Daniel Sheridan
Clause Form Conversions for Boolean Circuits
In: Holger H. Hoos, David G. Mitchell (Eds.): Theory and Applications of Satisfiability Testing, 7th International Conference, SAT 2004, Vancouver, BC, Canada, May 10–13, 2004, Revised Selected Papers. Lecture Notes in Computer Science 3542, Springer 2005, pp. 183–198 * G.S. Tseitin
On the complexity of derivation in propositional calculus
In: Slisenko, A.O. (ed.) Structures in Constructive Mathematics and Mathematical Logic, Part II, Seminars in Mathematics (translated from Russian), pp. 115–125. Steklov Mathematical Institute (1968)


External links

* {{springer, title=Conjunctive normal form, id=p/c025090


Java applet for converting to CNF and DNF, showing laws used
Normal forms (logic)