Edit this page Backlinks This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== Lab 10: SAT ====== === 0. Recap Conjunctive Normal === **CNF** is a form of boolean logic formulae that consists of a **conjunction** of one or more **clauses**. A **clause** is a **disjunction** of **literals**. A good analogy for **conjunction** is **product** and for **disjunction** is **sum**. Thus, a formula in **CNF** can be seen as a product of sums. Examples of **terminals**: * $math[X, Y, Z, a, b, X_{1}, X_{2}, ..., X_{n}] Examples of **disjunctions**: * $math[X\vee Y\vee Z] * $math[a\vee b] * $math[X_{1}\vee X_{2}\vee X_{3}\vee ... \vee X_{n - 1}\vee X_{n}] Examples of **conjunctions**: * $math[a\wedge b\wedge c] * $math[X\wedge Z] Examples of **CNF**: * $math[a\wedge (b\vee c)\wedge d] * $math[(X_{1}\vee X_{2})\wedge (Y_{1}\vee Y_{2})\wedge (Z_{1}\vee Z_{2})] * $math[(X\vee Y)\wedge (Y\vee Z)\wedge (Z\vee X)] \\ ** 1. Conjunctive Normal Form ** Rewrite the following formulae in Conjunctive Normal Form: ** 1.1. ** $math[\neg (a\leftrightarrow b)\wedge (b\vee c)] ** 1.2. ** $math[\neg ((a\vee c)\to (b \wedge \neg (a\vee c)))] \\ ** 2. Interpretations ** ** 2.1. ** Write an interpretation which makes each of the previous formulae: * true * false \\ ** 3. Satisfiability and validity ** Write down a formula with 3 variables which is: * valid * satisfiable * invalid \\ ** 4. Binary Decision Diagrams ** Write binary decision diagrams for the formulae at 1. \\ ** 5. Encodings ** ** 5.1. ** Express the following as ** CNF SAT ** formulae: * $math[a\oplus b] (xor) * if c then t else p * exactly one of $math[{X_{1}, X_{2}, ..., X_{n}}] is true. ** 5.2. ** Encode the n-queens problem as a ** SAT ** formula. In the n-queens problem, we have a n x n board and we need to find a position for each n queens such that no queen is attacking another. ** 5.3. ** What is ** 3SAT **? Construct a transformation that takes a ** SAT ** formula and builds a ** 3SAT ** formula. Motivation: a lot of ** SAT ** solvers use as input ** 3SAT **.