COMP232 - Mathematics for Computer Science Tutorial 3 Ali Moallemi moa ali@encs.concordia.ca Iraj Hedayati h iraj@encs.concordia.ca Concordia University, Winter 2017 Ali Moallemi, Iraj Hedayati COMP232 - Mathematics for Computer Science 1 / 20
Table of Contents 1 1.5 Propositional Logic Exercise 4 Exercise 7 Exercise 9 Exercise 11 Exercise 20 Exercise 28 Exercise 28 Exercise 32 Exercise 34 Exercise 36 Exercise 46 Ali Moallemi, Iraj Hedayati COMP232 - Mathematics for Computer Science 2 / 20
Exercise 4 Express quantifications in English Remark P(x, y): Student x has taken class y Domain of x: all students Domain of y: all computer science courses at your school a) x y P(x, y) Answer: Some students have taken some computer science courses b) x y P(x, y) Answer: Some students have taken all computer science courses c) x y P(x, y) Answer: All students have taken some computer science courses Ali Moallemi, Iraj Hedayati COMP232 - Mathematics for Computer Science 3 / 20
Exercise 4 (cont...) Express quantifications in English Remark P(x, y): Student x has taken class y Domain of x: all students Domain of y: all computer science courses at your school d) y x P(x, y) Answer: Some computer science courses have been taken by all students e) y x P(x, y) Answer: All computer science courses have been taken by some students f) x y P(x, y) Answer: All students have taken all computer science courses Ali Moallemi, Iraj Hedayati COMP232 - Mathematics for Computer Science 4 / 20
Exercise 7 Express sentences by simple English sentence Remark T (x, y): Student x likes cuisine y Domain of x: all students at your school Domain of y: all cuisines a) T (AbdallahHussein, Japanese) Answer: Abdallah Hussein does not like Japanese cuisine b) x T (x, Korean) xt (x, Mexican) Answer: Some students at our school like Korean cuisine and all students at our school like Mexican cuisine c) y (T (MoniqueArsenault, y) T (JayJohnson, y)) Answer: There exists some cuisines which Monique or Jay like them Ali Moallemi, Iraj Hedayati COMP232 - Mathematics for Computer Science 5 / 20
Exercise 7 (cont...) Express sentences by simple English sentence Remark T (x, y): Student x likes cuisine y Domain of x: all students at your school Domain of y: all cuisines d) x y z ((x z) (T (x, y) T (z, y)) Answer: There is no restaurant that you can find a pair of students which both of them like it. e) x z y (T (x, y) T (z, y)) Answer: There are some pair of students, which for all cuisines, both of them either like it or not f) x z y (T (x, y) T (z, y)) Answer: For every couple of students, there are some cuisines which both of them either like it or not Ali Moallemi, Iraj Hedayati COMP232 - Mathematics for Computer Science 6 / 20
Exercise 9 Use quantifiers to express each of these statements Remark L(x, y): x loves y Domain of x and y: all people in the world a) Everybody loves Jerry Answer: x L(x, Jerry) b) Everybody loves somebody Answer: x y L(x, y) c) There is somebody whom everybody loves Answer: y x L(x, y) d) Nobody loves everybody Answer: x y L(x, y) x y L(x, y) De Morgan s law e) There is somebody whom Lydia does not love Answer: y L(Lydia, y) Ali Moallemi, Iraj Hedayati COMP232 - Mathematics for Computer Science 7 / 20
Exercise 9 (cont...) Use quantifiers to express each of these statements Remark L(x, y): x loves y Domain of x and y: all people in the world f) There is somebody whom no one loves Answer: y x L(x, y) y x L(x, y) De Morgan s law g) There is exactly one person whom everybody loves Answer: y( x L(x, y) ( z w (L(w, z) z = y))) h) There are exactly two people whom Lynn loves Answer: x y (x y L(Lynn, x) L(Lynn, y) z (L(Lynn, z) (z = x z = y))) i) Everyone loves himself or herself Answer: x L(x, x) j) There is someone who loves no one besides himself or herself. Answer: x y (L(x, y) x = y) Ali Moallemi, Iraj Hedayati COMP232 - Mathematics for Computer Science 8 / 20
Exercise 11 Use quantifiers to express each of these statements Remark S(x): x is a student F (x): x is a faculty member A(x, y): x has asked y a question Domain of x and y: all people associated with your school a) Lois has asked Professor Michaels a question Answer:A(Lois, ProfessorMichaels) b) Every student has asked Professor Gross a question Answer: x (S(x) A(x, ProfessorGross)) c) Every faculty member has either asked Professor Miller a question or been asked a question by Professor Miller Answer: x (F (x) (A(x, ProfessorMiller) A(ProfessorMiller, x))) d) Some student has not asked any faculty member a question Answer: x y (S(x) (F (y) A(x, y))) Ali Moallemi, Iraj Hedayati COMP232 - Mathematics for Computer Science 9 / 20
Exercise 11(cont...) Use quantifiers to express each of these statements Remark S(x): x is a student F (x): x is a faculty member A(x, y): x has asked y a question Domain of x and y: all people associated with your school e) There is a faculty member who has never been asked a question by student Answer: x y(f (x) (S(y) A(y, x))) f) Some student has asked every faculty member a question Answer: x y (S(x) (F (y) A(x, y))) g) There is a faculty member who has asked every other faculty member a question Answer: x y (F (x) ((F (y) x y) A(x, y))) h) Some student has never been asked a question by a faculty member Answer: x y (S(x) (F (y) A(y, x))) Ali Moallemi, Iraj Hedayati COMP232 - Mathematics for Computer Science 10 / 20
Exercise 20 Express each of the statements using predicates, quantifiers, logical connectives, and mathematical operators Remark Domain consists of all integers a) The product of two negative integers is positive Answer: x y((x < 0 y < 0) xy > 0) b) The average of two positive integers is positive Answer: x y((x > 0 y > 0) x+y 2 > 0) c) The difference of two negative integers is not necessarily negative Answer: x y((x < 0 y < 0) (x y < 0)) d) The absolute value of the sum of two integers does not exceed the sum of the absolute values of the integers Answer: x y( x + y x + y ) Ali Moallemi, Iraj Hedayati COMP232 - Mathematics for Computer Science 11 / 20
Exercise 28 Determine the truth value of each of these statements if the domain of each variable consists of all real numbers. a) x y(x 2 = y) Solution: True b) x y(x = y 2 ) Solution: False c) x y(xy = 0) Solution: True d) x y(x + y y + x) Solution: False e) x(x 0 y xy = 1) Solution: True Ali Moallemi, Iraj Hedayati COMP232 - Mathematics for Computer Science 12 / 20
Exercise 28 Cont.. Determine the truth value of each of these statements if the domain of each variable consists of all real numbers. f) x y(y 0 xy = 1) Solution: False g) x y(x + y = 1) Solution: True h) x y(x + 2y = 2 2x + 4y = 5) Solution: False i) x y(x + y = 2 2x y = 1) Solution: False j) x y z(z = (x + y)/2) Solution: True Ali Moallemi, Iraj Hedayati COMP232 - Mathematics for Computer Science 13 / 20
Exercise 32 Express the negations of each of these statements so that all negation symbols immediately precede predicates a) z y xt (x, y, z) Answer: z y xt (x, y, z) z y xt (x, y, z) z y xt (x, y, z) z y x T (x, y, z) b) x yp(x, y) x yq(x, y) Answer: ( x yp(x, y) x yq(x, y)) x yp(x, y) x yq(x, y) x y P(x, y) x y Q(x, y) Ali Moallemi, Iraj Hedayati COMP232 - Mathematics for Computer Science 14 / 20
Exercise 32 (cont...) Express the negations of each of these statements so that all negation symbols immediately precede predicates c) x y(q(x, y) Q(y, x)) Answer: x y(q(x, y) Q(y, x)) x y (Q(x, y) Q(y, x)) x y(q(x, y) Q(y, x)) d) y x z(t (x, y, z) Q(x, y)) Answer: y x z(t (x, y, z) Q(x, y)) y x z (T (x, y, z) Q(x, y)) y x z( T (x, y, z) Q(x, y)) Ali Moallemi, Iraj Hedayati COMP232 - Mathematics for Computer Science 15 / 20
Exercise 34 Find a common domain for the variable x, y, z for which below statement is true and another domain for which it is false. Statement Answer: x y((x y) z((z = x) (z = y))) TRUE: On the domain D = {a, b} the statement is true. If x = a and y = b (or x = b, y = a), any choice of z must be either equal to x or y. FALSE: With other domains more than two elements, the statement is false. Let D = {a, b, c}, and x = a, y = b. Then z = c, makes above statement truth value, FALSE. Ali Moallemi, Iraj Hedayati COMP232 - Mathematics for Computer Science 16 / 20
Exercise 36 Express each of these statements using quantifiers. Then form the negation of the statement so that no negation is to the left of a quantifier. Next, express the negation in simple English. (Do not simply use the phrase It is not the case that. ) a) No one has lost more than one thousand dollars playing the lottery. x y (Lost(x, y) y > 1000) x y(lost(x, y) y > 1000) There is someone who lost 1000$ or more. b) There is a student in this class who has chatted with exactly one other student. x y(y x z(z x (z = y Chatted(x, z))) x y(y x z(z x (z = y Chatted(x, z))) Everybody has either chatted with no one or more than one student. Ali Moallemi, Iraj Hedayati COMP232 - Mathematics for Computer Science 17 / 20
Exercise 36 Cont... c) No student in this class has sent e-mail to exactly two other students in this class. x y w(y x y w w x z(z x ((z = y z = w) Emailed(x, z))) x y w(y x y w w x z(z x ((z = y z = w) Emailed(x, z))) some student in this class has sent email to exactly two other students in the class. d) Some student has solved every exercise in this book. x ysolved(x, y) x y Solved(x, y) No student solved all questions Ali Moallemi, Iraj Hedayati COMP232 - Mathematics for Computer Science 18 / 20
Exercise 36 Cont... e) No student has solved at least one exercise in every section of this book. x y z(solved(x, z) InSection(z, y)) x y z(solved(x, z) InSection(z, y)) Some student has solved at least one exercise in every section of the book Ali Moallemi, Iraj Hedayati COMP232 - Mathematics for Computer Science 19 / 20
Exercise 46 Determine the truth value of the statement x y(x y 2 ) if the domain for the variables consists of a) the positive real numbers. Answer:False, for any positive real number x, then y = x/2 is also a positive real number, but, x y 2. b) the integers. Answer:True, 0 y 2 for any integer y. c) the nonzero real numbers. Answer:True, 1 y 2 for any real number y. Ali Moallemi, Iraj Hedayati COMP232 - Mathematics for Computer Science 20 / 20