1 / 27

CS 103 Discrete Structures Lecture 07 Logic and Proofs ( 7 )

CS 103 Discrete Structures Lecture 07 Logic and Proofs ( 7 ). First Midterm Exam. Thursday, 30 October 2014 (same time as the lecture) 75 minute duration Will cover all lectures delivered before the exam date

declan-hahn
Download Presentation

CS 103 Discrete Structures Lecture 07 Logic and Proofs ( 7 )

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS 103Discrete StructuresLecture 07 Logic and Proofs (7)

  2. First Midterm Exam • Thursday, 30 October 2014 (same time as the lecture) • 75 minute duration • Will cover all lectures delivered before the exam date • Will consist of MCQ’s, fill-in-the-blanks, questions with short answers, writing of proofs, and drawing of diagrams • If you miss this exam for anyreason, you will have to appear for a makeup exam on the Thursday of the last week of teaching. That exam will cover alllectures delivered in the semester. It will consist of writing of proofs, drawing of diagrams and answering questions having 0.5-1 page answers.

  3. Chapter 1 The Foundations:Logic and Proofs1.5 Nested Quantifiers

  4. Nested Quantifiers Two quantifiers can be nested if one is within the scope of the other: x y (x + y = 0) This is can also be written as: x [y (x + y = 0)] Everything within the scope of a quantifier can be thought of as a propositional function. For example,x y (x + y = 0)is the same thing asx Q(x),whereQ(x) is y P(x, y),andP(x, y) is x + y = 0

  5. Nested Quantifiers: Example Assume that the domain for the variables x and y consists of all real numbers. x y (x + y = y +x)Means x + y = y + x for all x and y (Commutative law for addition of real numbers) x y (x + y = 0) Means that for every x there is some y such thatx + y = 0 (Every real number has an additive inverse) x y z [x + (y + z)] = [(x + y) + z]Associative law for addition of real numbers x y (xy = 0)There exists an x such that for all y (xy = 0) is true

  6. Nested Quantifiers: Example Translate into English the statement x y [(x > 0)  (y < 0] → (xy < 0))where the domain for x and y is all real numbers Possible Solutions: • For every real number x and for every real number y, if x > 0 and y < 0, then xy < 0 • For real numbers x and y, if x is positive and y is negative, then xy is negative • The product of a positive real number and a negative real number is always a negative real number

  7. Order of Nested Quantifiers x y and x y are not equivalent x y : for some x and every y x y : for every x and some y However, the order of nested universal quantifiers (without other quantifiers) can be changed without changing the meaning of the statement x y : for every x and every y y x : for every yand every x

  8. Order of Nested Quantifiers Example Let P(x, y) be the statement "x + y = y + x" What are the truth values of the quantificationsx y P(x, y) and y x P(x, y) where the domain for all variables consists of all real numbers? Solution • Both xy P(x, y) & y x P(x, y) mean "For all real numbers x, for all real numbers y, x + y = y + x" • Since P(x , y) is true for all real numbers x and y,the propositions xy P(x, y) and y x P(x, y) are true

  9. Order of Nested Quantifiers Example: Let Q(x, y) be "x + y = 0" What are the truth values of y x Q(x, y) & x y Q(x, y), where the domain for x and y consists of all real numbers? Solution: y x Q(x, y) denotes the proposition "There is a y such that for every x, Q(x, y)" There is no y such that x + y = 0 for all x, therefore the statement y x Q(x, y) is false x y Q(x, y) denotes the proposition "For every x there is a y such that Q(x, y)" Given an x, there is a y such that x + y = 0; (y = -x), therefore the statement x y Q(x, y) is true. Conclusion: The order of dissimilar quantifiers is important. y x Q(x, y) and x y Q(x, y) are not logically equivalent

  10. Order of Nested Quantifiers

  11. Order of Nested Quantifiers Example: Let Q(x, y, z) be the statement "x + y = z" What are the truth values of the statementsxy z Q(x, y, z)and z x y Q(x, y, z), where the domain of all variables consists of all real numbers? Solution: Suppose that x and y are assigned values • x y z Q(x, y, z) means "For all x and for all y, there is a z such that x + y = z"and is true • z x y Q(x, y, z) means "There is a z such that for all x and for all y it is true that x + y = z" It is false because there is no value of z that satisfies the equation x + y = z for all values of x and y The order of the quantifiers here is important

  12. Translating into Logical Expressions Translate the statement "The sum of two positive integers is always positive" into a logical expression Solution: We can rewrite the statement by introducing the variables x and y as: "For all positive integers x and y, x + y is positive“ Consequently, we can express this statement as:x y [(x > 0)  (y > 0) → (x + y > 0)] where the domain for x and y consists of all integers If we consider the positive integers as the domain, then the original statement becomes: "For every two positive integers, the sum of these integers is positive" We can express this asx y(x + y > 0)

  13. Translating into Logical Expressions Translate the statement "Every real number except zero has a multiplicative inverse" Solution: We can rewrite this as "For every real number x, if x ≠ 0, then there exists a real number y such that xy= I" This can be rewritten as:x [(x ≠ 0) → y (xy = 1)] Translate the statement "The product of two negative integers is positive" Solution: x y [(x < 0)  (y < 0) → (xy > 0)]

  14. Translating into Logical Expressions Translate the statement "The average of two positive integers is positive" Solution: x y [(x>0)  (y>0) → ((x + y)/2 > 0)] Translate the statement "The difference of two negative integers is not necessarily negative" Solution: x y [(x < 0)  (y < 0)  (x - y ≥ 0)] Translate the statement "Absolute value of the sum of 2 integers doesn’t exceed the sum of their absolute values" Solution: x y (|x + y| ≤ |x| + |y|)

  15. Translating into English Translate the following into English: x (C(x ) y [C(y)  F(x, y)]), where • C(x) is "x has a computer" • F(x, y) is "x and y are friends“ The domain for both x and y consists of all students in your faculty Possible Solutions: • For every student x in your faculty, x has a computer or there is a student y such that y has a computer and x and y are friends • Every student in your faculty has a computer or has a friend who has a computer

  16. Translating into English: Examples x y (x + y = y) There exists an additive identity for all real numbers x y ([(x ≥ 0)  (y < 0)] → [x - y > 0]) A non-negative number minus a negative number is greater than zero x y ([(x ≤ 0 )  (y ≤ 0 )]  [x - y > 0]) The difference between two non-positive numbers is not necessarily non-positive (i.e. can be positive) x y ([(x ≠ 0)  (y ≠ 0)] ↔ [xy ≠ 0]) The product of two non-zero numbers is non-zero if and only if both factors are non-zero

  17. Translating into English: Examples Express "If a person is female and is a parent, then this person is someone's mother" as a logical expression with a domain consisting of all people Solution: This statement can be rephrased as "For every person x, if person x is female and person x is a parent, then there exists a person y such that person x is the mother of person y." Suppose that: • F(x) represents "x is female," • P(x) represents "x is a parent" • M(x, y) represents "x is the mother of y" Then, we can say x [(F(x)  P(x)] →y M(x, y)) As y is not in the scope of , we can move y to the left after x. The result then is: x y ([F(x)  P(x)] → M(x, y))

  18. Negating Nested Quantifiers Recall negation rules for single quantifiers: • ¬x P(x) = x ¬P(x) • ¬x P(x) = x ¬P(x) Example: Express the negation of the statementx y (xy = 1) so that no negation precedes the quantifiers Solution: ¬x y (xy = 1)  ¬x [y (xy = 1)]  x ¬[y (xy= 1)]  x [y ¬(xy= 1)]  x [y (xy≠ 1)]  x y (xy ≠ 1)

  19. Negating Nested Quantifiers: Example Find the negation of the statements: a) x y P(x, y) b) x y z P(x, y, z) Solution: a) ¬[x y P(x, y)]  x ¬y P(x, y)  x y ¬P(x, y) b) ¬[x y z P(x, y, z)]  x ¬y z P(x, y, z)  x y ¬z P(x, y, z)  x y z ¬P(x, y, z)

  20. Exercises 1. Translate these statements into English, where the domain for each variable consists of all real numbers 2. Let Q(x, y) be the statement "x has sent an e-mail message to y," where the domain for both x and y is all students in your class. Express each of these quantifications in English.

  21. Exercises 3. Let I(x) be the statement "x has an Internet connection" and C(x , y) be the statement "x and y have chatted over the Internet," where the domain for the variables x and y consists of all students in your class. Use quantifiers to express each of these statements: a) Ahmad does not have an Internet connection. b) Ali has not chatted over the Internet with Basel. c) Tourky and Naif have never chatted over the Internet. d) No one in the class has chatted with Zeiad. e) Saleh has chatted with everyone except Yousf. f) Someone in your class does not have an Internet connection. g) Not everyone in your class has an Internet connection. h) Exactly one student in your class has an Internet connection. i) There are two students in the class who between them

  22. Exercises (follow exercise 3) j) Everyone in your class with an Internet connection has chatted over the Internet with at least one other student in your class. k) Someone in your class has an Internet connection but has not chatted with anyone else in your class. I) There are two students in your class who have not chatted with each other over the Internet. m) There is a student in your class who has chatted with everyone in your class over the Internet. n) There are at least two students in your class who have not chatted with the same person in your class. o) Everyone except one student in your class has an Internet connection

  23. Exercises 4. Translate each of these nested quantifications into an English statement that expresses a mathematical fact. The domain in each case consists of all real numbers.

  24. Exercises 5. Let Q(x, y) be the statement "x + y = x -y" If the domain for both variables consists of all integers, what are the truth values?

  25. Exercises 6. Determine the truth value of each of these statements if the domain for all variables consists of all integers.

  26. Exercises 7. Determine the truth value of each of these statements if the domain of each variable consists of all real numbers.

  27. Exercises 8. Express the negations of each of these statements so that all negation symbols immediately precede predicates

More Related