You are on page 1of 35
Gersting Mathematical Structures for Computer Science Page 3 CHAPTER 1: Formal Logic Chapter 1 is an introduction to formal logic and some of its implications for computer science, Formal logic is nothing more than a systematization of much of what we do daily when we communicate in natural language and when we draw conclusions using informal reasoning. It is certainly the basis for scientific thinking and reasoning, Because of its formalization, many students seem to find logic a difficult topic. ‘You can point out to the students, however, that this very formality actually relieves them of the burden of undirected creative thinking! There are certain patterns and rules that must be followed in constructing formal proofs, which serve to channel and limit the possible steps to be taken at any time, Students face similar constraints in following the rules of syntax of a programming language; in fact, they are so much more constrained in formal logic that their task is even simpler than in programming. Pointing this out to the students (who have usually experienced some success in programming tasks by this time) can serve as a morale-builder. Or you can also note the similarities to standard high school geometry, but you are on less firm ground here because some students hated their high school geometry class! At any rate, they need some reassurance that symbolism itself is not all that formidable and, by its constraining nature, is actually helpful. I usually point out that one of the purposes of symbolism is to strip away meaning in order to concentrate on form alone, and thus help ensure that we are "pure in heart" in our thinking processes. Students find this a bemusing idea, but they generally see the point. Of course, natural language statements must first be translated into symbolic form, and it is this part of the chapter that is most fun to teach. It points up how sloppy we tend to be in our natural language statements. (See "John loves only Mary," “John only loves Mary," and "Only John loves Mary" in Section 1.3.) One would think that students for whom English is a second language would have more difficulties than native English speakers with this type of translation exercise, but that doesn't seem to be the case - they all have to work at this, but they also enjoy it. Students often come back later and tell me that after this course, they never take words and sentences at face value again! Propositional logic is covered is Sections 1.1 and 1.2, while predicate logic is discussed in Sections 1.3 and 1.4. Sections 1.5 and 1.6 give some direct applications of formal systems to computer science; Section 1.5 is a brief introduction to logic programming and Section 1.6 introduces proof of correctness. The discrete structures course is too often seen as a collection of disjointed topics, so it behooves us as instructors to emphasize the connecting threads whenever possible. The notations of formal logic will be used throughout the book to clarify definitions. Logical reasoning, although not always formal, is the basis for much of the rest of the work in this course and will also stand the students in good stead in many other computer science courses, Page ¢ Mathematical Structures for Computer Science Gersting Answers that are starred also appear at the back of the textbook. EXERCISES 1.1 41, 2. 3. “4, @ © © O aTbT «TdF aTbF oF dF eTfiF g Tht a. antecedent: — sufficient water consequent: healthy plant growth b. antecedent: further technological advances consequent: increased availability of information c. antecedent: — errors will be introduced consequent: there is a modification of the program d. antecedent: fuel savings consequent: good insulation or storm windows throughout a land3 b2 64 *a. The food is good but the service is poor. *b. The food is poor and so is the service. c. Either the food is poor or the service is poor, but the price is low. d. Either the food is good or the service is excellent. The price is high but either the food is poor or the service is poor. 2 Either the processor is slow or the printer is fast. The processor is slow and the printer is fast. The processor is fast but so is the printer. |. Either the processor is slow or the printer is fast, but the file is not damaged The file is not damaged, the processor is fast, and the printer is not slow. The printer is slow and the file is not damaged. meaoge AaB AABVO) B>(AAC) A>@'vC) AIC > B'vO)] eaooe BaD AaD D>@vo Bad D>Cc esaore Gersting Mathematical Structures for Computer Science Page 5 10. UL a. Violets are blue or sugar is sour. Violets are not blue or, if roses are red, then sugar is sweet. Sugar is sweet and roses are not red, if and only if violets are blue. Sugar is sweet, and roses are not red if and only if violets are blue. If it is false that both violets are blue and sugar is sour, then roses are red. Roses are red, or violets are blue and sugar is sour. Roses are red or violets are blue, and sugar is sour. Rmeaos .a. A: prices go up; B: housing will be plentiful; C: housing will be expensive [A>BAC]A(C >B) b. A: going to bed; B: going swimming; C: changing clothes [(AvB) > C]A(C>By c. A: itwill rain; B: it will snow (AVB)A(AABY d. A: Janet wins; B: Janet loses; C: Janet will be tired (AvB)>C . A: Janet wins; B: Janet loses, C: Janet will be tired Av(@®>C) H: horse is fresh; K: knight will win; A: armor is strong a HK b. K +(HAA) c KH d KoA e. (AVH)>K a AST b. T> (AaB) c. E>T d ASE e. Eo (AvT) Tautology

You might also like