# lecture08 - CS 70 Spring 2005 Discrete Mathematics for CS...

This preview shows pages 1–3. Sign up to view the full content.

CS 70 Discrete Mathematics for CS Spring 2005 Clancy/Wagner Notes 8 Why CNF? Lecture Notes 6 introduced DNF and CNF, and stated that CNF is more natural for applications involving reasoning. Why is this? There are two obvious reasons. First, reasoning uses collections of sentences (often called databases or knowledge bases ) that are naturally expressed as a conjunction of the sentences—the DATABASES KNOWLEDGE BASES knowledge base asserts that all the sentences it contains are true. Translating this conjunction into DNF might involve unnecessary work and expansion of the size of the representation. Second, many sentences used in reasoning are implications with several antecedents and a single conclusion. These have the form P 1 ... P k = Q . (Logic programs consist entirely of such sentences.) We have ( P 1 ... P k = Q ) ( ¬ ( P 1 ... P k ) Q ) (( ¬ P 1 ... ∨¬ P k ) Q ) (de Morgan’s) ( ¬ P 1 ... ∨¬ P k Q ) (associativity) Hence, any implication sentence converts easily into a clause with the same number of literals. Many problems of interest in CS can be converted into CNF representations; solved using theorem-proving algorithms for CNF; and then the solution is translated back into the original language of the problem. Why would we do this? • Because we can work on finding efficient algorithms for CNF instead of finding efficient algorithms for hundreds of different problems. • Because we can take advantage of all the work other people have done in finding efficient algorithms for CNF. • Because often we find, once we reach CNF, that we have one or other special case of CNF for which very efficient (e.g., linear-time) algorithms are known. There are other “canonical problem” targets besides CNF, including matrix inversion and determinants, lin- ear programming , and finding roots of polynomials. As one becomes a good computer scientists, one LINEAR PROGRAMMING develops a mental “web” of interrelated standard computational problems and learns to map any new prob- lem onto this web. Minesweeper is a good example. Minesweeper The rules of Minesweeper are as follows: CS 70, Spring 2005, Notes 8 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
MINES LEFT: 6 MINES LEFT: 0 MINES LEFT: 1 MINES LEFT: 2 4 3 2 1 1 2 3 4 4 m 2 2 m 3 3 4 m 2 2 m m 2 1 1 m 3 1 0 1 2 3 4 2 1 1 1 1 1 2 3 2 1 1 1 1 1 1 1 2 3 4 5 (a) (b) (c) (d) Figure 1: Minesweeper examples. (a) Initial display for a 4 × 4 game. (b) Final display after successful discovery of all mines. (c) Simple case: only one solution. (d) Two possible solutions, but both have (3,1) blank. • The game is played by a single player on an X × Y board. (We will use Cartesian coordinates, so that (1,1) is at bottom left and (X,1) is at bottom right.) The display is initially empty. The player is told the total number of mines remaining undiscovered; these are distributed uniformly at random on the board. (See Figure 1(a).) • At each turn the player has three options:
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 09/03/2011 for the course CS 70 taught by Professor Papadimitrou during the Fall '08 term at University of California, Berkeley.

### Page1 / 5

lecture08 - CS 70 Spring 2005 Discrete Mathematics for CS...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online