Normal Forms for Propositional Logic
In Negation-normal from, negations are only allowed on elementary proposition. Moreover, NNF formulas contain no implication, so the only binary operators are conjunctions and disjunctions. The following rules can be used to turn arbitrary propositional formulas into negation-normal form.
Note that this transformation is linear in the size of the formula. No exponential blow-up.
Polarity of formula.
Disjunctive Normal Form
Formulas in Disjunctive-normal form look like this:
More formally where .
Each is a clause and is defined as .
Each is a literal. It's either an elementary proposition or its negation.
Solving the SAT problem for DNF formulas is in P, but transforming an arbitrary propositional formula to DNF causes an exponential blow-up.
DNF formulas can be easily generated from truth tables. Each row of the truth table that makes the formula true can be written as a clause. Here is an example:
The corresponding formula in DNF is
For a formula over variables, there are rows in the truth table. Over variables, there are different (i.e. non-equivalent) formulas.
Conjunctive Normal Form
Formulas in Conjunctive-normal form look like this:
It's defined as
Like for DNF, are elementary propositions or their negation. The terminology of clauses and literals also applies to CNF.
There is no polynomial-time equivalence preserving transformation to CNF or to DNF.
Complete Sets of Connectives
If we can express every formula. Examples:
- because every formula has DNF (or CNF)
Formulas can be represented as abstract syntax tree (AST) where each node is labeled with an operator that applies to the sub-tree(s). If two sub-trees are identical, instead of duplicating the sub-tree in each place where its used, one can make all the references to this sub-tree point to a unique representation of it. This is called a circuit.
The if-then-else primitive, written , that yields whenever is true and otherwise, can be encoded with the following propositional logic formula:
For each node of an AST, it is possible to replace it with a fresh variable, provided that a clause is added that makes sure that the fresh variable and the sub-tree it represents are equivalent. Note that this transformation preserve equisatisfiability but not equivalence, because it introduces new variables.
There exists a linear transformation from arbitrary formulas to CNF preserving equisatisfiability. The main idea is to use fresh variables as described above. For each node of the AST, a representative (i.e. a fresh variable) will be introduced. We need to add clauses to ensure that a sub-formula and its representative are equivalent. To avoid exponential blow-up, we will not use the sub-formulas' children directly, but their representative when expressing this constraint.
The key transformation steps are:
Each equivalence between a representative and the ones from the sub-formulas has to be flatten to conjunctive-normal form. This can be done by splitting the equivalences into two implications. Example:
Optimization: for cases of only positive or only negative polarity.