COMP232 - Mathematics for Computer Science

Similar documents
Notes. Notes. Introduction. Notes. Propositional Functions. Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry.

Chapter 1.3 Quantifiers, Predicates, and Validity. Reading: 1.3 Next Class: 1.4. Motivation

Section 2.2: Introduction to the Logic of Quantified Statements

(l) Represent each of the sets A, B and C using bit strings. Then, use bit string representation and bitwise logical operations to find

MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.

Predicate Logic and Quan0fies

Homework 1. Due Date: Wednesday 11/26/07 - at the beginning of the lecture

CSL105: Discrete Mathematical Structures. Ragesh Jaiswal, CSE, IIT Delhi

Propositional Calculus. CS 270: Mathematical Foundations of Computer Science Jeremy Johnson

CSC Discrete Math I, Spring Sets

CSE Discrete Structures

2.2 Set Operations. Introduction DEFINITION 1. EXAMPLE 1 The union of the sets {1, 3, 5} and {1, 2, 3} is the set {1, 2, 3, 5}; that is, EXAMPLE 2

Discrete structures - CS Fall 2017 Questions for chapter 2.1 and 2.2

CSE20: Discrete Mathematics

Computation Club: Gödel s theorem

Solutions to Selected Exercises

CSE 215: Foundations of Computer Science Recitation Exercises Set #4 Stony Brook University. Name: ID#: Section #: Score: / 4

CPSC 121: Models of Computation. Module 6: Rewriting predicate logic statements

Practice Final. Read all the problems first before start working on any of them, so you can manage your time wisely

CMPSCI 250: Introduction to Computation. Lecture #7: Quantifiers and Languages 6 February 2012

Lecture Notes 15 Number systems and logic CSS Data Structures and Object-Oriented Programming Professor Clark F. Olson

Propositional Calculus. Math Foundations of Computer Science

Predicate Logic CHAPTER What This Chapter Is About

Quantification. Using the suggested notation, symbolize the statements expressed by the following sentences.

Mathematical Logic

CITS2211 Discrete Structures Logic

Propositional Calculus: Boolean Algebra and Simplification. CS 270: Mathematical Foundations of Computer Science Jeremy Johnson

ITCS 6150 Intelligent Systems. Lecture 13 First-Order Logic Chapter 8

University of Illinois at Chicago Department of Computer Science. Final Examination. CS 151 Mathematical Foundations of Computer Science Fall 2012

First Order Logic and Resolution

L05 - Negating Statements

For next Tuesday. Read chapter 8 No written homework Initial posts due Thursday 1pm and responses due by class time Tuesday

1 / 43. Today. Finish Euclid. Bijection/CRT/Isomorphism. Fermat s Little Theorem. Review for Midterm.

Introduction to Boolean logic and Logical Gates

CPSC 121 Some Sample Questions for the Final Exam Tuesday, April 15, 2014, 8:30AM

Introduction to Boolean Algebra

Section 2.4: Arguments with Quantified Statements

Lecture 9: Predicate Logic. First: Finish Propositional Logic in Haskell. Semantics in Haskell. Syntax In Haskell. CS 181O Spring 2016 Kim Bruce

Introduction to Boolean Algebra

Today. Finish Euclid. Bijection/CRT/Isomorphism. Review for Midterm.

Vibhav Gogate University of Texas, Dallas Artificial Intelligence: CS 4365 First-order Logic

The set consisting of all natural numbers that are in A and are in B is the set f1; 3; 5g;

Today s Topics. What is a set?

FIVE YEARS OLD. P r o f e s s o r ikobbins B. Stoeckei ol is s h o w n b y the J u n e 1 pig c r o p

(a) (4 pts) Prove that if a and b are rational, then ab is rational. Since a and b are rational they can be written as the ratio of integers a 1

Module 6. Knowledge Representation and Logic (First Order Logic) Version 2 CSE IIT, Kharagpur

Unit 2: Accentuate the Negative Name:

Lecture 5: Predicate Calculus. ffl Predicate Logic ffl The Language ffl Semantics: Structures

ELEMENTARY NUMBER THEORY AND METHODS OF PROOF

Logic and its Applications

Going beyond propositional logic

Objectives: 1- Bolean Algebra. Eng. Ayman Metwali

Preliminary Mathematics Extension 1

Joint probability distributions

Automated Reasoning PROLOG and Automated Reasoning 13.4 Further Issues in Automated Reasoning 13.5 Epilogue and References 13.

Operations of Relational Algebra

Number System. Introduction. Natural Numbers (N) Whole Numbers (W) Integers (Z) Prime Numbers (P) Face Value. Place Value

Discrete Mathematics Lecture 4. Harper Langston New York University

Practice Problems: All Computer Science majors are people. Some computer science majors are logical thinkers. Some people are logical thinkers.

for all x, the assertion P(x) is false. there exists x, for which the assertion P(x) is true.

Section 1.8. Simplifying Expressions

Connecting Statements. Today. First there was logic jumping forward.. ..and then proofs and then induction...

Automatic Reasoning (Section 8.3)

3.1 Start Thinking. 3.1 Warm Up. 3.1 Cumulative Review Warm Up. Consider the equation y x.

THE LOGIC OF QUANTIFIED STATEMENTS

Two-Color Counters. Adding Integers, Part II. Key Term. Learning Goals. Essential Ideas. Common Core State Standards for Mathematics

Question about Final Exam. CS 416 Artificial Intelligence. What do we like about propositional logic? First-order logic

CS112 Friday, September 12, 2008

Programming in C++ PART 2

First-Order Logic Syntax

First Order Logic Part 1

COMP Logic for Computer Scientists. Lecture 23

Animation Curves and Splines 2

CMPS 277 Principles of Database Systems. Lecture #3

Partial Derivatives. Partial Derivatives. Partial Derivatives. Partial Derivatives. Partial Derivatives. Partial Derivatives

Computer Engineering Chapter 3 Boolean Algebra

My dear students, Believe in yourselves. Believe in your abilities. You can DO this! -Dr. M

4 Operations On Data 4.1. Foundations of Computer Science Cengage Learning

Overview. CS389L: Automated Logical Reasoning. Lecture 6: First Order Logic Syntax and Semantics. Constants in First-Order Logic.

-t:ma. u V:. 1! *VV; jf >*4: t i f n - v i ' ONABI E :VISITd:Rs ; 8 A EASTBOURNE, SAT. 5? -tesiste- COLLEGE. D ressm aker.

CSC 501 Semantics of Programming Languages

Chapter 3. Set Theory. 3.1 What is a Set?

Algebra. Chapter 4: FUNCTIONS. Name: Teacher: Pd:

CPSC 121: Models of Computation. Module 5: Predicate Logic

PHIL 240, Introduction to Logic, Sections Fall 2011 FINAL EXAM 14 December Name (5 points): Section (5 points):

Slide 1 / 96. Linear Relations and Functions

Mathematical Logic Part Two

[Ch 6] Set Theory. 1. Basic Concepts and Definitions. 400 lecture note #4. 1) Basics

LECTURE 2 An Introduction to Boolean Algebra

CS February 17

Chapter 3 Boolean Algebra

Unit 1 Calendar. 9/15 Review 1.1, 1.2, 1.3, 1.4, 1.6, 1.7 9/17 Unit 1 Test

For fine ti.ito vvt* have hcen in IS PUBLISHED EVERY. OF LOWELL. n t m r n T i l t " ^ n a i I Howk & White, CAPITAL, ,000.

Spring 2018 CSE191 Midterm Exam I

ELEMENTARY NUMBER THEORY AND METHODS OF PROOF

IE 521 Convex Optimization

Math 213 Calculus III Practice Exam 2 Solutions Fall 2002

Discrete Mathematics and Probability Theory Fall 2016 Seshia and Walrand Midterm 1

CSE 311: Foundations of Computing. Lecture 8: Predicate Logic Proofs

CSE 20 DISCRETE MATH. Winter

Transcription:

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