1 King Fahd University of Petroleum Minerals Information

  • Slides: 78
Download presentation
1 King Fahd University of Petroleum & Minerals Information & Computer Science Department ICS

1 King Fahd University of Petroleum & Minerals Information & Computer Science Department ICS 253: Discrete Structures I Summer Semester 2012 - 2013 (123) Dr. Wasfi G. Al-Khatib SUMT: 12: 45 -2: 00 pm - 24: 158

ICS 253: Discrete Structures I 2 The Foundations: Logic and Proofs Reading Assignment •

ICS 253: Discrete Structures I 2 The Foundations: Logic and Proofs Reading Assignment • K. H. Rosen, Discrete Mathematics and Its Applications, 6 th Ed. , Mc. Graw-Hill, 2006. • Chapter 1, Sections 1 -6

ICS 253: Discrete Structures I • 3 The Foundations: Logic and Proofs Section 1.

ICS 253: Discrete Structures I • 3 The Foundations: Logic and Proofs Section 1. 1: Propositional Logic Traditionally, logic distinguishes valid and invalid arguments (2 -valued logic). • Is there other types of logic? • The building blocks of logic are propositions. A proposition is a declarative statement that is either true or false 1. Dr. Wasfi holds a Ph. D. in arts. 2. KFUPM is either a big University or a small University. 3. Do you have a van? 4. 82 = 16. 5. I will go fishing tomorrow. 6. Do not drive while you are asleep. 7. X – 8 = 12

ICS 253: Discrete Structures I 4 The Foundations: Logic and Proofs Compound Propositions •

ICS 253: Discrete Structures I 4 The Foundations: Logic and Proofs Compound Propositions • Compound propositions are formed from single propositions using logical operators • • • Negation Conjunction Disjunction Exclusive or Implication biconditional

ICS 253: Discrete Structures I 5 The Foundations: Logic and Proofs Truth Tables •

ICS 253: Discrete Structures I 5 The Foundations: Logic and Proofs Truth Tables • A truth table displays the relationship between the truth values of propositions • Usually we are interested in knowing the compound truth value of ALL possible truth values of the “input” propositions

6 ICS 253: Discrete Structures I The Foundations: Logic and Proofs Truth table for

6 ICS 253: Discrete Structures I The Foundations: Logic and Proofs Truth table for negation p p T F p

ICS 253: Discrete Structures I 7 The Foundations: Logic and Proofs Truth Table for

ICS 253: Discrete Structures I 7 The Foundations: Logic and Proofs Truth Table for Conjunction p q

ICS 253: Discrete Structures I 8 The Foundations: Logic and Proofs Truth Table for

ICS 253: Discrete Structures I 8 The Foundations: Logic and Proofs Truth Table for Disjunction p q

ICS 253: Discrete Structures I 9 The Foundations: Logic and Proofs Truth Table for

ICS 253: Discrete Structures I 9 The Foundations: Logic and Proofs Truth Table for Exclusive Or p q

ICS 253: Discrete Structures I 10 The Foundations: Logic and Proofs Truth Table for

ICS 253: Discrete Structures I 10 The Foundations: Logic and Proofs Truth Table for Implication p q

ICS 253: Discrete Structures I 11 The Foundations: Logic and Proofs Implication p q

ICS 253: Discrete Structures I 11 The Foundations: Logic and Proofs Implication p q • Implication is expressed in many ways • • If p then q p is sufficient for q a sufficient condition for q is p q is necessary for p a necessary condition for p is q p only if q q follows from p • • • If p, q p implies q q whenever p q when p q if p q unless p

ICS 253: Discrete Structures I 12 The Foundations: Logic and Proofs Implication p q

ICS 253: Discrete Structures I 12 The Foundations: Logic and Proofs Implication p q • Discuss the validity of the following statements: • If today is Friday, then 2 + 3 = 5 • If today is Friday, then 2 + 3 = 6 • Note that “if … then” in programming languages is different from the one used in logic.

ICS 253: Discrete Structures I 13 The Foundations: Logic and Proofs Converse, Contrapositive and

ICS 253: Discrete Structures I 13 The Foundations: Logic and Proofs Converse, Contrapositive and Inverse • Converse of an implication • q p • Contrapositive of an implication • q p • Inverse of an implication • p q

ICS 253: Discrete Structures I 14 The Foundations: Logic and Proofs Truth Table for

ICS 253: Discrete Structures I 14 The Foundations: Logic and Proofs Truth Table for Bi-conditional p q

ICS 253: Discrete Structures I 15 The Foundations: Logic and Proofs Translating English Sentences

ICS 253: Discrete Structures I 15 The Foundations: Logic and Proofs Translating English Sentences into Logical Expressions • Removes ambiguity • May introduce certain assumptions • Identify “single” propositions and then write the logical expressions corresponding to the following compound propositions (Q 10 pp 17): 1. You get an A on the final, you do every exercise in this book, and you get an A in this class. 2. To get an A in this class, it is necessary for you to get an A on the final. 3. Getting an A on the final and doing every exercise in this book is sufficient for getting an A in this class.

ICS 253: Discrete Structures I 16 The Foundations: Logic and Proofs Translating English Sentences

ICS 253: Discrete Structures I 16 The Foundations: Logic and Proofs Translating English Sentences into Logical Expressions • Example 13 Page 11: You cannot ride the roller coaster if you are under 4 feet tall unless you are older than 16 years old

ICS 253: Discrete Structures I 17 The Foundations: Logic and Proofs Translating English Sentences

ICS 253: Discrete Structures I 17 The Foundations: Logic and Proofs Translating English Sentences into Logical Expressions • Q 16 page 18: For each of these sentences, determine whether an inclusive or an exclusive or is intended. Explain your answer a. Experience with C++ or Java is required b. Lunch includes soup or salad c. To enter the country, you need a passport or a voter registration card d. Publish or perish

ICS 253: Discrete Structures I 18 The Foundations: Logic and Proofs System Specifications •

ICS 253: Discrete Structures I 18 The Foundations: Logic and Proofs System Specifications • System specifications should be consistent, i. e. not contain conflicting requirements • i. e. all “requirements” are true • (Q 51 pp 20). • The router can send packets to the edge system only if it supports the new address space. • For the router to support the new address space, it is necessary that the latest software release be installed. • The router can send packets to the edge system if the latest software release is installed. • The router does not support the new address space.

ICS 253: Discrete Structures I 19 The Foundations: Logic and Proofs Logic and Bit

ICS 253: Discrete Structures I 19 The Foundations: Logic and Proofs Logic and Bit Operations • Computers represent information using bits • A bit string is a sequence of zero or more bits. • 0 represents F and 1 represents T • How does C represent True and False? ? ? • Bit operations are carried out in exactly the same manner as their corresponding logic operations. • Evaluate 0001110001 1001001000

ICS 253: Discrete Structures I 20 The Foundations: Logic and Proofs Section 1. 2:

ICS 253: Discrete Structures I 20 The Foundations: Logic and Proofs Section 1. 2: Propositional Equivalences • Tautology: A compound proposition that is always true, regardless of the truth values of the single/simple propositions in it. • Propositions p and q are called logically equivalent if p q is a tautology, denoted by p q • Contradiction: A compound proposition that is always false. • Contingency:

ICS 253: Discrete Structures I 21 The Foundations: Logic and Proofs Example • Show

ICS 253: Discrete Structures I 21 The Foundations: Logic and Proofs Example • Show that the following proposition is a tautology: (p q) p q p q T T T F F p q (p q) p q p q

ICS 253: Discrete Structures I 22 The Foundations: Logic and Proofs Some Useful Equivalences

ICS 253: Discrete Structures I 22 The Foundations: Logic and Proofs Some Useful Equivalences p T p Identity p F p Laws p T T Domination p F F Laws p p p Idempotent p p p Laws p q q p Commutative p q q p Laws ( p) p Double Negation Law (p q) r p (q r) Associative (p q) r p (q r) Laws (p q) p q De. Morgan (p q) p q Laws p (q r) (p q) (p r) Distributive p (q r) (p q) (p r) Laws p p T p p F Other Useful (p q) ( p q) Laws

ICS 253: Discrete Structures I 23 The Foundations: Logic and Proofs Why Know These

ICS 253: Discrete Structures I 23 The Foundations: Logic and Proofs Why Know These Equivalences? • Instead of using truth tables, we can use these equivalences to arrive to the same conclusion • Any good reasons for not using truth tables?

ICS 253: Discrete Structures I 24 The Foundations: Logic and Proofs Examples • Show

ICS 253: Discrete Structures I 24 The Foundations: Logic and Proofs Examples • Show that (p ( p q)) ( p q) • Show that (p q) r is not equivalent to p (q r)

ICS 253: Discrete Structures I 25 The Foundations: Logic and Proofs Section 1. 3:

ICS 253: Discrete Structures I 25 The Foundations: Logic and Proofs Section 1. 3: Predicates and Quantifiers • Propositional logic, studied in Sections 1. 1 and 1. 2 cannot adequately express the meaning of statements in mathematics and in natural language. • E. g. , suppose that we know that “Every student at KFUPM has a computer account. ” Are there any rules in propositional logic that can make us conclude the truth of the statement that “Ahmad, who is a student at KFUPM, has a computer account”

26 ICS 253: Discrete Structures I The Foundations: Logic and Proofs Predicates • Predicates

26 ICS 253: Discrete Structures I The Foundations: Logic and Proofs Predicates • Predicates refer to a property that the subject(s) (variable(s)) of the statement has/have. • Once value(s) has/have been assigned to the variable(s), the predicate becomes a proposition. • Examples • • P(x) x > 1 Q(x, y) x = y – 5 R(x, y, z) z > x – y if P(x) then x = x - 1; else x = x 2; end if;

ICS 253: Discrete Structures I 27 The Foundations: Logic and Proofs Quantifiers • Universal

ICS 253: Discrete Structures I 27 The Foundations: Logic and Proofs Quantifiers • Universal quantification of P(x) is the proposition “P(x) is true for all values of x in the universe of discourse (domain of x)” which is denoted by x P(x) • Existential quantification of P(x) is the proposition: “There exists an element x in the universe of discourse (domain of x) such that P(x) is true” which is denoted by x P(x)

ICS 253: Discrete Structures I 28 The Foundations: Logic and Proofs Quantifiers • Uniqueness

ICS 253: Discrete Structures I 28 The Foundations: Logic and Proofs Quantifiers • Uniqueness quantifier of P(x) is the proposition that “there exists a unique element x, in the domain of x, such that P(x) is true, ” which is denoted by !x P(x).

ICS 253: Discrete Structures I 29 The Foundations: Logic and Proofs Examples • Express

ICS 253: Discrete Structures I 29 The Foundations: Logic and Proofs Examples • Express the following statement using proper quantification • Every student in this class has studied calculus • Question 9 pp 47 • • • P(x) x can speak Russian Q(x) x knows C++ For the universe of discourse “all students at your school” • • There is a student at your school who can speak Russian and who knows C++ There is a student at your school who can speak Russian but who doesn’t know C++ Every student at your school either can speak Russian or knows C++ No student at your school can speak Russian or knows C++

ICS 253: Discrete Structures I 30 The Foundations: Logic and Proofs Scientific Joke •

ICS 253: Discrete Structures I 30 The Foundations: Logic and Proofs Scientific Joke • An astronomer, a physicist and a mathematician (it is said) were holidaying in Scotland. Glancing from a train window, they observed a black sheep in the middle of a field. • The astronomer said: "How interesting, all scottish sheep are black!" • To which the physicist responded, "No, no! Some Scottish sheep are black!" • The mathematician gazed heavenward in supplication, and then intoned, "In Scotland there exists at least one field, containing at least one sheep, at least one side of which is black. "

ICS 253: Discrete Structures I 31 The Foundations: Logic and Proofs Truth of Quantifiers

ICS 253: Discrete Structures I 31 The Foundations: Logic and Proofs Truth of Quantifiers Statement x P(x) !x P(x) When True? When False?

32 ICS 253: Discrete Structures I The Foundations: Logic and Proofs Precedence of Quantifiers

32 ICS 253: Discrete Structures I The Foundations: Logic and Proofs Precedence of Quantifiers and Logical Operators Operator Precedence , 1 2 3 4 5 6

ICS 253: Discrete Structures I 33 The Foundations: Logic and Proofs • The quantifiers

ICS 253: Discrete Structures I 33 The Foundations: Logic and Proofs • The quantifiers and have higher precedence than all logical operators from propositional calculus. • E. g. , x P(x) Q(x) • means……………. . • does not mean …………

ICS 253: Discrete Structures I 34 The Foundations: Logic and Proofs Binding Variables •

ICS 253: Discrete Structures I 34 The Foundations: Logic and Proofs Binding Variables • The occurrence of a variable x is bound iff a value is assigned to x or when a quantifier is used on x. Otherwise, it is called free. • •

ICS 253: Discrete Structures I 35 The Foundations: Logic and Proofs Logical Equivalences Involving

ICS 253: Discrete Structures I 35 The Foundations: Logic and Proofs Logical Equivalences Involving Quantifiers • Statements involving predicates and quantifiers are logically equivalent if and only if they have the same truth value no matter which predicates are substituted into these statements and which domain of discourse is used for the variables in these propositional functions.

ICS 253: Discrete Structures I 36 The Foundations: Logic and Proofs Logical Equivalences Involving

ICS 253: Discrete Structures I 36 The Foundations: Logic and Proofs Logical Equivalences Involving Quantifiers • Q 46 pp 49.

37 ICS 253: Discrete Structures I The Foundations: Logic and Proofs Negation • x

37 ICS 253: Discrete Structures I The Foundations: Logic and Proofs Negation • x P(x) • These are called De Morgan’s Laws for Quantifiers • Find the negation of • There is an honest politician •

ICS 253: Discrete Structures I 38 Examples • • • Q 21 pp 47

ICS 253: Discrete Structures I 38 Examples • • • Q 21 pp 47 Q 23 pp 48 Q 28 pp 48 Q 31 pp 48 Q 33 pp 48 The Foundations: Logic and Proofs

ICS 253: Discrete Structures I 39 The Foundations: Logic and Proofs Question 59 pp.

ICS 253: Discrete Structures I 39 The Foundations: Logic and Proofs Question 59 pp. 50 • P(x) = “x is a professor” Q(x) = “x is ignorant” R(x) = “x is vain” Express the following statements using quantifiers; logical connectives; and P(x), Q(x), and R(x) where the universe of discourse is the set of all people 1. 2. 3. 4. No professors are ignorant All ignorant people are vain No professors are vain Does (3. ) follow from (1. ) and (2. )? If not, is there a correct conclusion?

ICS 253: Discrete Structures I 40 The Foundations: Logic and Proofs Prolog: Programming in

ICS 253: Discrete Structures I 40 The Foundations: Logic and Proofs Prolog: Programming in Logic • Prolog Facts: Define predicates by specifying the elements that satisfy these predicates • Prolog Rules: Define new predicates from prolog facts.

41 ICS 253: Discrete Structures I The Foundations: Logic and Proofs Example Facts instructor(Wasfi,

41 ICS 253: Discrete Structures I The Foundations: Logic and Proofs Example Facts instructor(Wasfi, ics 253). instructor(Yahya, ics 324). instructor(Marwan, coe 202). enrolled(991101, ics 253). enrolled(200111, ics 324). enrolled(981101, coe 202). enrolled(200123, coe 202). enrolled(991101, ics 253). enrolled(200123, ics 324). enrolled(991101, coe 202). enrolled(200111, ics 253). Queries instructor(Wasfi, ics 324) enrolled(X, coe 202) teaches(X, 200123) Rule Teaches(P, S) : - instructor(P, C), enrolled(S, C)

ICS 253: Discrete Structures I 42 The Foundations: Logic and Proofs Section 1. 4:

ICS 253: Discrete Structures I 42 The Foundations: Logic and Proofs Section 1. 4: Nested Quantifiers • Nested Quantifiers: Quantifiers that occur within the scope of other quantifiers • Examples • x y (x + y = 0) • You can think of it as x. Q(x) where Q(x) is y P(x, y) where P(x, y) is x + y = 0. • x y (x + y = y + x) • Does this remind you of nested loops? ?

ICS 253: Discrete Structures I 43 The Foundations: Logic and Proofs Understanding Nested Quantification

ICS 253: Discrete Structures I 43 The Foundations: Logic and Proofs Understanding Nested Quantification • Determine whether the following statements are true or false: • • • x y (x > y) (domain of discourse is R) x y (x > y) (domain of discourse is N) x y (x < y) (domain of discourse is Z) x y (x > y) (domain of discourse is Q) x y (x < y) (domain of discourse is N) x y (x < y) (domain of discourse is Z)

ICS 253: Discrete Structures I 44 The Foundations: Logic and Proofs The Order of

ICS 253: Discrete Structures I 44 The Foundations: Logic and Proofs The Order of Quantifiers • The order of quantifiers is important unless all the quantifiers are universal or all the quantifiers are existential. • Let Q(x, y) denote “x + y = 0”. What are the truth values of the quantifications • x y Q(x, y) • y x Q(x, y)

ICS 253: Discrete Structures I 45 The Foundations: Logic and Proofs Quantifications of Two

ICS 253: Discrete Structures I 45 The Foundations: Logic and Proofs Quantifications of Two Variables

ICS 253: Discrete Structures I 46 The Foundations: Logic and Proofs Example • Question

ICS 253: Discrete Structures I 46 The Foundations: Logic and Proofs Example • Question 6 page 58: Let C(x, y) mean that x is enrolled in y, where the universe of discourse for x is the set of all students in your school and the universe of discourse for y is the set of classes being given at your school. Express each of the following statements by a simple English sentence. • • • C(Randy Goldberg, CS 252) x C(x, Math 695) y C(Carol Sitea, y) x ( C(x, Math 222) C(x, CS 252)) x y z ( (x y) (C(x, z) C(y, z)) ) x y z ((x y) (C(x, z) C(y, z)) )

ICS 253: Discrete Structures I 47 The Foundations: Logic and Proofs Translating Mathematical Statements

ICS 253: Discrete Structures I 47 The Foundations: Logic and Proofs Translating Mathematical Statements Using Quantifiers • Q 19 Page 60 Express each of these statements using mathematical and logical operators, predicates, and quantifiers, where the domain consists of all integers. a) The sum of two negative integers is negative. b) The difference of two positive integers is not necessarily positive. c) The sum of the squares of two integers is greater than or equal to the square of their sum. d) The absolute value of the product of two integers is the product of their absolute values.

ICS 253: Discrete Structures I 48 The Foundations: Logic and Proofs More Examples •

ICS 253: Discrete Structures I 48 The Foundations: Logic and Proofs More Examples • Question 26 page 61: Q(x, y) ”x+y=x-y” Using the set of integers as a universe of discourse, what are the truth values of the following • Q(1, 1) • Q(2, 0) • y Q(1, y) • x Q(x, 2) • What is the truth values of x P(x) and x P(x) where P(x) is the statement “x 2 > 10” and the universe of discourse is the set of positive integers not exceeding 4?

ICS 253: Discrete Structures I The Foundations: Logic and Proofs 49 More Examples •

ICS 253: Discrete Structures I The Foundations: Logic and Proofs 49 More Examples • What is the truth value of the following statements • x y (x < y) • x y z (xy = z) x, y, z

ICS 253: Discrete Structures I 50 The Foundations: Logic and Proofs Negating Nested Quantifiers

ICS 253: Discrete Structures I 50 The Foundations: Logic and Proofs Negating Nested Quantifiers • Apply negation rules “successively” • Example (Question 33[b, d] pp. 61 ): Rewrite each of the following statements so that negations appear only within predicates • y x P(x, y) • ( x y P(x, y) x y Q(x, y) )

ICS 253: Discrete Structures I 51 The Foundations: Logic and Proofs Translating Sentences into

ICS 253: Discrete Structures I 51 The Foundations: Logic and Proofs Translating Sentences into Logical Expressions • Q 9 pp 59: Let L(x, y) be the statement “x loves y”, where the domain for both x and y consists of all people in the world. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. Everybody loves Jerry. Everybody loves somebody. There is somebody whom everybody loves. Nobody loves everybody. There is somebody whom Lydia does not love. There is somebody whom no one loves. There is exactly one person whom everybody loves. There are exactly two people whom Lynn loves. Everyone loves himself or herself There is someone who loves no one besides himself or herself

ICS 253: Discrete Structures I 52 The Foundations: Logic and Proofs Section 1. 5:

ICS 253: Discrete Structures I 52 The Foundations: Logic and Proofs Section 1. 5: Rules of Inference • Proofs in mathematics are valid arguments that establish the truth of a mathematical statements • An argument is a sequence of statements that end with a conclusion. • Valid means the conclusion must follow from the truth of the preceding statements (premises) of the argument.

ICS 253: Discrete Structures I 53 The Foundations: Logic and Proofs Valid Arguments in

ICS 253: Discrete Structures I 53 The Foundations: Logic and Proofs Valid Arguments in Propositional Logic p • “If you have a current password, then you can log onto the network” q • “You have a current password” • Therefore, “You can log onto the network. ” • Is this a valid argument? • Note that both p q and p are true

ICS 253: Discrete Structures I 54 The Foundations: Logic and Proofs Definitions • An

ICS 253: Discrete Structures I 54 The Foundations: Logic and Proofs Definitions • An argument in propositional logic is a sequence of propositions. All but the final proposition in the argument are called premises and the final proposition is called the conclusion. • An argument is valid if the truth of all its premises implies that the conclusion is true. • An argument form in propositional logic is a sequence of compound propositions involving propositional variables. • An argument form is valid if no matter which particular propositions are substituted for the propositional variables in its premises, the conclusion is true if the premises are all true.

ICS 253: Discrete Structures I 55 The Foundations: Logic and Proofs Valid Arguments in

ICS 253: Discrete Structures I 55 The Foundations: Logic and Proofs Valid Arguments in Propositional Logic • Note that is a tautology. • From the previous definition, an argument form with premises p 1, p 2, …, pn and conclusion q is valid when (p 1 p 2 … pn q) is a tautology. • This rule of inference is called modus ponens

ICS 253: Discrete Structures I 56 The Foundations: Logic and Proofs Valid Arguments in

ICS 253: Discrete Structures I 56 The Foundations: Logic and Proofs Valid Arguments in Propositional Logic • A valid argument form can lead to incorrect conclusions if one or more false propositions are used • If , then

ICS 253: Discrete Structures I 57 The Foundations: Logic and Proofs Some Important Rules

ICS 253: Discrete Structures I 57 The Foundations: Logic and Proofs Some Important Rules of Inference Tautology Rule of Inference Name Addition Simplification Conjunction Modus ponens Modus tollens Hypothetical syllogism Disjunctive syllogism Resolution

ICS 253: Discrete Structures I 58 The Foundations: Logic and Proofs Examples for Use

ICS 253: Discrete Structures I 58 The Foundations: Logic and Proofs Examples for Use of Rules of Inference • Q 2 pp 72: Find the argument form for the following argument and determine whether it is valid. Can we conclude that the conclusion is true if the premises are true? • If George does not have eight legs, then he is not an insect. George is an insect. George has eight legs.

ICS 253: Discrete Structures I 59 The Foundations: Logic and Proofs Examples for Use

ICS 253: Discrete Structures I 59 The Foundations: Logic and Proofs Examples for Use of Rules of Inference • Q 4 pp 72: What rule of inference is used in each argument? a) Kangaroos live in Australia and are marsupials. Therefore, kangaroos are marsupials. b) It is either hotter than 100 degrees today or the pollution is dangerous. It is less than 100 degrees outside today. Therefore, the pollution is dangerous. c) Linda is an excellent swimmer. If Linda is an excellent swimmer, then she can work as a lifeguard. Therefore, Linda can work as a lifeguard. d) Steve will work at a computer company this summer. Therefore, this summer Steve will work at a computer company or he will be a beach bum. e) If I work all night on this homework, then I can answer all the exercises. If I answer all the exercises, I will understand the material. Therefore, if I work all night on this homework, then I will understand the material.

ICS 253: Discrete Structures I 60 The Foundations: Logic and Proofs Using Rules of

ICS 253: Discrete Structures I 60 The Foundations: Logic and Proofs Using Rules of Inference to Build Arguments • Q 6 pp 72: Use rules of inference to show that the hypotheses "If it does not rain or if it is not foggy, then the sailing race will be held and the lifesaving demonstration will go on, " "If the sailing race is held, then the trophy will be awarded, ” and "The trophy was not awarded" imply the conclusion "It rained. "

ICS 253: Discrete Structures I The Foundations: Logic and Proofs 61 Resolution • Rule

ICS 253: Discrete Structures I The Foundations: Logic and Proofs 61 Resolution • Rule of inference used in many computer programs (Prolog, Automatic Theorem Proving, …) • ((p q) ( p r)) q r resolvent

ICS 253: Discrete Structures I 62 The Foundations: Logic and Proofs Fallacies • Fallacies

ICS 253: Discrete Structures I 62 The Foundations: Logic and Proofs Fallacies • Fallacies resemble rules of inference but are based on contingencies rather than tautologies • For example

ICS 253: Discrete Structures I 63 The Foundations: Logic and Proofs Rules of Inference

ICS 253: Discrete Structures I 63 The Foundations: Logic and Proofs Rules of Inference for Quantified Statements U is the Universe of Discourse Rule of Inference Name Universal instantiation Universal generalization Existential instantiation Existential generalization

ICS 253: Discrete Structures I 64 The Foundations: Logic and Proofs Example • Show

ICS 253: Discrete Structures I 64 The Foundations: Logic and Proofs Example • Show that the premises "A student in this class has not read the book, " and "Everyone in this class passed the first exam" imply the conclusion "Someone who passed the first exam has not read the book. "

ICS 253: Discrete Structures I 65 The Foundations: Logic and Proofs Combining Rules of

ICS 253: Discrete Structures I 65 The Foundations: Logic and Proofs Combining Rules of Inference for Propositions and Quantified Statements

ICS 253: Discrete Structures I 66 The Foundations: Logic and Proofs Question 16(a, b)

ICS 253: Discrete Structures I 66 The Foundations: Logic and Proofs Question 16(a, b) pp. 73 • For each of the following arguments, determine whether it is correct or not and explain why: • Everyone enrolled in the University has lived in a dormitory. Mia has never lived in a dormitory. Therefore, Mia is not enrolled in the University. • A convertible car is fun to drive. Isaac’s car is not a convertible. Therefore, Isaac’s car is not fun to drive.

ICS 253: Discrete Structures I 67 The Foundations: Logic and Proofs Section 1. 8:

ICS 253: Discrete Structures I 67 The Foundations: Logic and Proofs Section 1. 8: Introduction to Proofs • The methods of proof discussed in this section are important not only because they are used to prove mathematical theorems, but also for their many applications to computer science. • • • Verifying that computer programs are correct Establishing that operating systems are secure Making inferences in artificial intelligence Showing that system specifications are consistent …etc.

ICS 253: Discrete Structures I 68 The Foundations: Logic and Proofs Terminology • Theorem=

ICS 253: Discrete Structures I 68 The Foundations: Logic and Proofs Terminology • Theorem= A statement that can be shown to be true. • • Less important theorems are called propositions. Demonstrated to be true through a proof. • Proof = A sequence of statements that forms an argument. • Some of these statements can be axioms or postulates. • Axioms = • • • Underlying assumptions about mathematical structures Hypotheses of theorem to be proved Previously proved theorems

ICS 253: Discrete Structures I 69 The Foundations: Logic and Proofs Definitions • Rules

ICS 253: Discrete Structures I 69 The Foundations: Logic and Proofs Definitions • Rules of Inference = Means used to draw conclusions from other assertions, which tie together the steps of a proof. • Lemma = A simple theorem used in the proof of other theorems. • Corollary = A proposition that can be established directly from a theorem. • Conjecture = A statement whose truth value is unknown, but “thought” to be true.

ICS 253: Discrete Structures I 70 The Foundations: Logic and Proofs How Theorems are

ICS 253: Discrete Structures I 70 The Foundations: Logic and Proofs How Theorems are Stated • Many theorems assert that a property holds for all elements in a domain. • Although the precise statement of such theorems needs to include a universal quantifier, the standard convention in mathematics is to omit it. • For example, the statement "If x > y, where x and y are positive real numbers, then x 2 > y 2. " really means "For all positive real numbers x and y, if x > y, then x 2 > y 2. " • The law of universal instantiation is often used without explicit mention. • Proof Steps: • Select a general (arbitrary) element of the domain. • Show that this element has the property in question (using rules of inference!) • Finally, universal generalization implies that theorem holds for all members of the domain.

ICS 253: Discrete Structures I 71 The Foundations: Logic and Proofs Methods of Proving

ICS 253: Discrete Structures I 71 The Foundations: Logic and Proofs Methods of Proving Theorems • Direct Proof (Modus Ponens) • Assume that p is true and use axioms, definitions, and previously proven theorems, together with rules of inference, to show that q must also be true. • Indirect Proof (Modus tollens or Proof by Contraposition) • Vacuous Proof • If p is false in the implication p q, then the implication is true • Trivial Proof • If the conclusion q is true, p q is trivially true • Proof By Contradiction • If a contradiction q can be found such that p q is true

ICS 253: Discrete Structures I 72 The Foundations: Logic and Proofs Methods of Proving

ICS 253: Discrete Structures I 72 The Foundations: Logic and Proofs Methods of Proving Theorems • PROOFS OF EQUIVALENCE • To prove a theorem that is a biconditional statement, that is, a statement of the form p q, we show that p � q and � q p are both true. T validity of this approach is based on the tautology (p q) [(p q) (q p)]

ICS 253: Discrete Structures I 73 The Foundations: Logic and Proofs Proof Strategy 1.

ICS 253: Discrete Structures I 73 The Foundations: Logic and Proofs Proof Strategy 1. Check whether a direct proof seems promising • Expand definitions from hypotheses and reason using theorems and axioms 2. Otherwise, look for an indirect proof

ICS 253: Discrete Structures I 74 The Foundations: Logic and Proofs Examples • Q

ICS 253: Discrete Structures I 74 The Foundations: Logic and Proofs Examples • Q 10 pp 85: Use a direct proof to show that the product of two rational numbers is rational. • Q 11 pp 85: Prove or disprove that the product of two irrational numbers is irrational. • Q 15 pp 85: Use a proof by contraposition to show that if x + y 2, where x and y are real numbers, then x 1 or y 1.

ICS 253: Discrete Structures I 75 The Foundations: Logic and Proofs Examples • Q

ICS 253: Discrete Structures I 75 The Foundations: Logic and Proofs Examples • Q 17 (b) pp 85: Show that if n is an integer and n 3 + 5 is odd, then n is even using a proof by contradiction. • Q 19 pp 85: Prove the proposition P(0), where P(n) is the proposition "If n is a positive integer greater than 1, then n 2 > n. “ What kind of proof did you use?

ICS 253: Discrete Structures I 76 The Foundations: Logic and Proofs Examples • Q

ICS 253: Discrete Structures I 76 The Foundations: Logic and Proofs Examples • Q 21 pp 85: Let P(n) be the proposition "If a and b are positive real numbers, then (a + b)n an + bn. " Prove that P (1) is true. What kind of proof did you use? • Show that these statements about the integer n are equivalent: p 1: n is even. p 2: n – 1 is odd. p 3: n 2 is even.

ICS 253: Discrete Structures I 77 The Foundations: Logic and Proofs Counter Examples •

ICS 253: Discrete Structures I 77 The Foundations: Logic and Proofs Counter Examples • To prove that is false, you only need to look for one y in the domain such that P(y) is false.

ICS 253: Discrete Structures I 78 The Foundations: Logic and Proofs Mistakes in Proofs

ICS 253: Discrete Structures I 78 The Foundations: Logic and Proofs Mistakes in Proofs • Incorrect operations/conclusions: (Prove that 1=2) 1. a = b 2. a 2 = ab 3. a 2 – b 2 = ab – b 2 4. (a – b)(a + b) = b(a – b) 5. a + b = b 6. 2 b = b 7. 2 = 1 • Circular reasoning: (if n 2 is even, n is even) • Suppose that n 2 is even. Then n 2 = 2 k for some integer k. Let n = 2 m for some integer m. This shows that n is even.