{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

lecture08

# 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: 1. Mark a square as a mine; the display is updated and the total mine count is decremented by 1 (regardless of whether the mine actually exists).
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern