Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
sav08:normal_forms_for_propositional_logic [2008/03/09 13:25] thibaud Filled-in DNF |
sav08:normal_forms_for_propositional_logic [2008/03/09 15:03] thibaud Filled-in Circuits |
||
---|---|---|---|
Line 26: | Line 26: | ||
Solving the SAT problem for DNF formulas is in P, but transforming an arbitrary propositional formula to DNF causes an exponential blow-up. | 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. For a formula over $n$ variables, there are $2^{n}$ rows in the truth table. Over $n$ variables, there are $2^{2^{n}}$ different (i.e. non-equivalent) formulas. | + | 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: |
+ | ^ $x_1$ ^ $x_2$ ^ $F$ ^ | ||
+ | | 0 | 0 | 0 | | ||
+ | | 1 | 0 | 1 | | ||
+ | | 0 | 1 | 1 | | ||
+ | | 1 | 1 | 0 | | ||
+ | The corresponding formula in DNF is $(x_1 \land \lnot x_2) \lor (\lnot x_1 \land x_2)$ | ||
+ | |||
+ | For a formula over $n$ variables, there are $2^{n}$ rows in the truth table. Over $n$ variables, there are $2^{2^{n}}$ different (i.e. non-equivalent) formulas. | ||
=== Conjunctive Normal Form === | === Conjunctive Normal Form === | ||
- | CNF | + | Formulas in Conjunctive-normal form look like this: |
+ | $(x_1 \lor x_2 \lor \lor x_3) \land (\lnot x_1 \lor x_3 \lor x_4) \land ...$ \\ | ||
+ | It's defined as $F = \bigwedge^{n}_{i=1} \bigvee_{j=1}^{n_i} L_{ij}$ \\ | ||
+ | Like for DNF, $L_{ij}$ are elementary propositions or their negation. The terminology of clauses and literals also applies to CNF. | ||
- | Literal. Clause. | + | There is no polynomial-time equivalence preserving transformation to CNF or to DNF. |
- | + | ||
- | No polynomial-time equivalence preserving transformation to CNF or to DNF. | + | |
=== Complete Sets of Connectives === | === Complete Sets of Connectives === | ||
Line 53: | Line 62: | ||
=== Circuits === | === Circuits === | ||
- | Circuits (acyclic graph labelled by propositional operators) and formulas. if-then-else expression. Fresh variables. | + | 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 $ite(p, q ,r)$, that yields $q$ whenever $p$ is true and $r$ otherwise, can be encoded with the following propositional logic formula: $(p \land q) \lor (\lnot p \land r)$ | ||
+ | |||
+ | 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. | ||
=== Satisfiability-Preserving Transformation === | === Satisfiability-Preserving Transformation === |