EECS 1028 M: Discrete Mathematics for Engineers

Similar documents
Today. Proof using contrapositive. Compound Propositions. Manipulating Propositions. Tautology

Tools for reasoning: Logic. Ch. 1: Introduction to Propositional Logic Truth values, truth tables Boolean logic: Implications:

3. The Logic of Quantified Statements Summary. Aaron Tan August 2017

EECS 1028 M: Discrete Mathematics for Engineers

COMP 182 Algorithmic Thinking. Proofs. Luay Nakhleh Computer Science Rice University

Predicate Logic. Andreas Klappenecker

EECS 1028 M: Discrete Mathematics for Engineers

Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques

Lecture 3. Logic Predicates and Quantified Statements Statements with Multiple Quantifiers. Introduction to Proofs. Reading (Epp s textbook)

CSCE 222 Discrete Structures for Computing. Predicate Logic. Dr. Hyunyoung Lee. !!!!! Based on slides by Andreas Klappenecker

2-4: The Use of Quantifiers

First order Logic ( Predicate Logic) and Methods of Proof

Conjunction: p q is true if both p, q are true, and false if at least one of p, q is false. The truth table for conjunction is as follows.

Section Summary. Section 1.5 9/9/2014

cse 311: foundations of computing Fall 2015 Lecture 6: Predicate Logic, Logical Inference

2/2/2018. CS 103 Discrete Structures. Chapter 1. Propositional Logic. Chapter 1.1. Propositional Logic

MAT 243 Test 1 SOLUTIONS, FORM A

CSCE 222 Discrete Structures for Computing. Review for Exam 1. Dr. Hyunyoung Lee !!!

CSE 311: Foundations of Computing. Lecture 6: More Predicate Logic

Lecture Predicates and Quantifiers 1.5 Nested Quantifiers

Intro to Logic and Proofs

ECOM Discrete Mathematics

Predicate Logic. CSE 191, Class Note 02: Predicate Logic Computer Sci & Eng Dept SUNY Buffalo

EECS 1028 M: Discrete Mathematics for Engineers

Discrete Mathematics Logics and Proofs. Liangfeng Zhang School of Information Science and Technology ShanghaiTech University

Introduction to Sets and Logic (MATH 1190)

Discrete Mathematics

Logic and Proof. Aiichiro Nakano

PREDICATE LOGIC. Schaum's outline chapter 4 Rosen chapter 1. September 11, ioc.pdf

Foundations of Mathematics MATH 220 FALL 2017 Lecture Notes

UNIVERSITY OF CALICUT SCHOOL OF DISTANCE EDUCATION B Sc (MATHEMATICS) I Semester Core Course. FOUNDATIONS OF MATHEMATICS (MODULE I & ii) QUESTION BANK

Discrete Mathematics and Probability Theory Spring 2014 Anant Sahai Note 1

Some Review Problems for Exam 1: Solutions

Chapter 2: The Logic of Quantified Statements

Predicate Calculus lecture 1

LECTURE NOTES DISCRETE MATHEMATICS. Eusebius Doedel

Proposi'onal Logic Not Enough

The Process of Mathematical Proof

A. Propositional Logic

Propositional Logic Not Enough

WUCT121. Discrete Mathematics. Logic. Tutorial Exercises

Mat 243 Exam 1 Review

Proofs: A General How To II. Rules of Inference. Rules of Inference Modus Ponens. Rules of Inference Addition. Rules of Inference Conjunction

Why Learning Logic? Logic. Propositional Logic. Compound Propositions

Math 3336: Discrete Mathematics Practice Problems for Exam I

Thinking of Nested Quantification

Lecture Notes on DISCRETE MATHEMATICS. Eusebius Doedel

Chapter 1, Logic and Proofs (3) 1.6. Rules of Inference

Supplementary Logic Notes CSE 321 Winter 2009

Basic Logic and Proof Techniques

Predicate Calculus - Syntax

Section 1.7 Proof Methods and Strategy. Existence Proofs. xp(x). Constructive existence proof:

Predicate Logic - Deductive Systems

Review 1. Andreas Klappenecker

x P(x) x P(x) CSE 311: Foundations of Computing announcements last time: quantifiers, review: logical Inference Fall 2013 Lecture 7: Proofs

2. Use quantifiers to express the associative law for multiplication of real numbers.

CS 220: Discrete Structures and their Applications. Predicate Logic Section in zybooks

Proofs. Introduction II. Notes. Notes. Notes. Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry. Fall 2007

Discrete Mathematics and Its Applications

EECS 1028 M: Discrete Mathematics for Engineers

Chapter 2: The Logic of Quantified Statements. January 22, 2010

software design & management Gachon University Chulyun Kim

Math.3336: Discrete Mathematics. Nested Quantifiers

With Question/Answer Animations. Chapter 2

Discrete Structures for Computer Science

Chapter 3. The Logic of Quantified Statements

Background for Discrete Mathematics

1 The Foundation: Logic and Proofs

MACM 101 Discrete Mathematics I. Exercises on Predicates and Quantifiers. Due: Tuesday, October 13th (at the beginning of the class)

Section 2.1: Introduction to the Logic of Quantified Statements

Argument. whenever all the assumptions are true, then the conclusion is true. If today is Wednesday, then yesterday is Tuesday. Today is Wednesday.

3/29/2017. Logic. Propositions and logical operations. Main concepts: propositions truth values propositional variables logical operations

Packet #2: Set Theory & Predicate Calculus. Applied Discrete Mathematics

For all For every For each For any There exists at least one There exists There is Some

Section 3.1: Direct Proof and Counterexample 1

Chapter 1 Elementary Logic

Logic Overview, I. and T T T T F F F T F F F F

2 Truth Tables, Equivalences and the Contrapositive

Logic. Propositional Logic: Syntax. Wffs

Discrete Mathematics Recitation Course 張玟翔

1 The Foundation: Logic and Proofs

Mathematical Reasoning. The Foundation of Algorithmics

Computational Logic. Recall of First-Order Logic. Damiano Zanardini

Predicate Logic: Sematics Part 1

Before you get started, make sure you ve read Chapter 1, which sets the tone for the work we will begin doing here.

Predicate Logic Thursday, January 17, 2013 Chittu Tripathy Lecture 04

Propositional Functions. Quantifiers. Assignment of values. Existential Quantification of P(x) Universal Quantification of P(x)

Logic and Proofs. (A brief summary)

CITS2211 Discrete Structures Proofs

MATH 13 FINAL EXAM SOLUTIONS

! Predicates! Variables! Quantifiers. ! Universal Quantifier! Existential Quantifier. ! Negating Quantifiers. ! De Morgan s Laws for Quantifiers

Formal Logic: Quantifiers, Predicates, and Validity. CS 130 Discrete Structures

Section Summary. Predicate logic Quantifiers. Negating Quantifiers. Translating English to Logic. Universal Quantifier Existential Quantifier

Logic and Proofs. (A brief summary)

Propositional and Predicate Logic

1 Predicates and Quantifiers

Quantifiers Here is a (true) statement about real numbers: Every real number is either rational or irrational.

Discrete Mathematical Structures: Theory and Applications

1. Consider the conditional E = p q r. Use de Morgan s laws to write simplified versions of the following : The negation of E : 5 points

Examples: P: it is not the case that P. P Q: P or Q P Q: P implies Q (if P then Q) Typical formula:

Transcription:

EECS 1028 M: Discrete Mathematics for Engineers Suprakash Datta Office: LAS 3043 Course page: http://www.eecs.yorku.ca/course/1028 Also on Moodle S. Datta (York Univ.) EECS 1028 W 18 1 / 21

Predicate Logic Definitions Predicate Logic? A predicate is a proposition that is a function of one or more variables E.g.:For an integer x, Even(x) : x is an even number. So Even(1) is false, Even(2) is true, and so on. Examples of predicates: Domain ASCII characters - IsAlpha(x) : TRUE iff x is an alphabetical character. Domain floating point numbers - IsInt(x): TRUE iff x is an integer. Domain integers: Prime(x) - TRUE if x is prime, FALSE otherwise. The domain of the variable(s) must ALWAYS be specified S. Datta (York Univ.) EECS 1028 W 18 2 / 21

Predicate Logic Definitions Predicates Ways of defining predicates: Domain R Explicit: Positive(x) is True iff x is positive Implicit: x > 0 Recall: Positive(2), Positive( 3) are predicates, but Positive(2/0), Positive(x) is not. Q:Is Positive(x 2 ) a predicate? The purpose of Predicate Logic is to make general statements like all birds can fly. Need some more constructs to make such statements S. Datta (York Univ.) EECS 1028 W 18 3 / 21

Predicate Logic Definitions Quantifiers describes the values of a variable that make the predicate true. Existential quantifier: xp(x) P(x) is true for some x in the domain or there exists x such that P(x) is TRUE. Universal quantifier: xp(x) P(x) is true for all x in the domain Either is meaningless if the domain is not known/specified. Examples (domain R, uses implicit predicates): x(x 2 0) x(x > 1) Quantifiers with restricted domain ( x > 1)(x 2 > x) S. Datta (York Univ.) EECS 1028 W 18 4 / 21

Predicate Logic Definitions Using Quantifiers Domain integers: The cube of all negative integers is negative. x(x < 0) (x 3 < 0) Expressing sums : ( n n i = i=1 ) n(n + 1) 2 S. Datta (York Univ.) EECS 1028 W 18 5 / 21

Predicate Logic Definitions Scope of Quantifiers have higher precedence than operators from Propositional Logic; so xp(x) Q(x) is not logically equivalent to x(p(x) Q(x)) x(p(x) Q(x)) ( xr(x)) Say P(x) : x is odd, Q(x) : x is divisible by 3, R(x) : (x = 0) (2x > x) S. Datta (York Univ.) EECS 1028 W 18 6 / 21

Conditionals Conditionals Defined similarly as before. Examples: Domain: set of all birds. Parrots(x) is a predicate that is true iff x is a parrot. Fly(x) is a predicate that is true iff x can fly. All parrots can fly: ( x)parrot(x) Fly(x) Definition of injective functions: f : A B, ( x 1 )( x 2 )x 1 x 2 f (x 1 ) f (x 2 ). Expressing There are at exactly 2 real square roots of any natural number n, namely n, n. Define the predicate Sqrt(a, b) : b is a square root of a. Then the statement is (Domain of n is N, y 1, y 2, z is R) n y 1 y 2 Sqrt(n, y 1 ) Sqrt(n, y 2 ) (y 1 y 2 ) ( z)sqrt(n, z) (z = y 1 ) (z = y 2 ) S. Datta (York Univ.) EECS 1028 W 18 7 / 21

Conditionals When to use Conditionals Suppose the domain is the set of all birds. All parrots can fly : ( x)parrot(x) Fly(x) is correct; ( x)parrot(x) Fly(x) is incorrect More tricky: Domain: all York students. CySec(x) is a predicate that is true iff x is a Cybersecurity major. Takes1019(x) is a predicate that is true iff x takes EECS 1019. Some Cybersecurity major at York takes EECS 1019 : xcysec(x) Takes1019(x)? xcysec(x) Takes1019(x)? Related confusing usage: ( x S)P(x) really means ( x)x S P(x) ( x S)P(x) really means ( x)x S P(x) S. Datta (York Univ.) EECS 1028 W 18 8 / 21

Conditionals Mathematical Properties Stated using Conditionals A function is surjective. Consider f : A B. ( x)x B ( y)(y A) (f (y) = x) A set S has a maximum (largest element). Let the domain be S. ( y)( x)x y A set S N is finite. We need to use the following property of the natural numbers: a subset S is finite iff it has a maximum. Let the domain be S. ( y)( x)x y A set S N is infinite. Negate the above (the domain is S): ( y)( x)x > y S. Datta (York Univ.) EECS 1028 W 18 9 / 21

Conditionals Logical Equivalence Logical Equivalence: P Q iff they have same truth value no matter which domain is used and no matter which predicates are assigned to predicate variables S. Datta (York Univ.) EECS 1028 W 18 10 / 21

Conditionals Negating Predicate Logic Statements Examples: There is no student who can... Not all professors are bad There is no Toronto Raptor that can dunk like Vince Carter Rules: xp(x) x P(x) Why? xp(x) x P(x) Why? Careful: The negation of Every Canadian loves Hockey is NOT No Canadian loves Hockey! Many, many students make this mistake! S. Datta (York Univ.) EECS 1028 W 18 11 / 21

Nested Quantifiers Nested Quantifiers Allows simultaneous quantification of many variables E.g. domain Z, x y z(x 2 + y 2 = z 2 ) (Pythagorean triples) n x y z(x n + y n = z n ) (Fermat s Last Theorem implies this is false) Domain R: x y z(x < z < y) (y < z < x) Is this true? x y z(x = y) (x < z < y) (y < z < x) x y z(x y) ((x < z < y) (y < z < x)) S. Datta (York Univ.) EECS 1028 W 18 12 / 21

Nested Quantifiers Nested Quantifiers - Similarities with loops Analogy: An inner quantified variable (inner loop limit) can depend on the outer quantified variable (outer loop index) E.g. in x y(x + y = 0) we chose y = x, so for different x we need different y to satisfy the statement. p jaccept(p, j) (p, j have different domains) does NOT say that there is a j that will accept all p. CAUTION: In general, order MATTERS x y(x < y): there is no maximum integer y x(x < y): there is a maximum integer S. Datta (York Univ.) EECS 1028 W 18 13 / 21

Nested Quantifiers Negation of Nested Quantifiers Use the same rule as before carefully. x y(x + y = 0): x y(x + y = 0) x y(x + y = 0) x y (x + y = 0) x y(x + y 0) x y(x < y) x y(x < y) x y(x < y) x y (x < y) x y(x y) S. Datta (York Univ.) EECS 1028 W 18 14 / 21

Nested Quantifiers Exercises Check that x y(x + y = 0) is not true over the positive integers. x y(x + y = 0) is not true over the integers. x 0 y(y = 1/x) is true over the real numbers. Read 1.4-1.5. Practice: Q2,8,16,30 (pg 65-67) S. Datta (York Univ.) EECS 1028 W 18 15 / 21

Proofs and Counterexamples Proofs vs Counterexamples To prove quantified statements of the form xp(x): an example (or 10) x for which P(x) is true is/are NOT enough; a proof is needed xp(x): an example x for which P(x) is true is enough. To DISPROVE quantified statements of the form xp(x): a COUNTERexample x for which P(x) is false is enough xp(x): an example x for which P(x) is false is NOT enough; a proof is needed Intuition: Disproving ( x)p(x) means proving ( x)p(x) ( x) P(x) S. Datta (York Univ.) EECS 1028 W 18 16 / 21

Inference in Predicate Logic Inference in Predicate Logic Most rules are very intuitive Universal instantiation If xp(x) is true, we infer that P(a) is true for any given a Universal Modus Ponens: xp(x) Q(x) and P(a) imply Q(a) Example: If x is odd then x 2 is odd. a is odd. So a 2 is odd. Many other rules, see page 76. Again, understanding the rules is crucial, memorizing is not. You should be able to see that the rules make sense and correspond to our intuition about formal reasoning. S. Datta (York Univ.) EECS 1028 W 18 17 / 21

Inference in Predicate Logic Inference Rules S. Datta (York Univ.) EECS 1028 W 18 18 / 21

Inference in Predicate Logic Commonly used technique: Universal generalization Examples Prove: If x is even, x + 2 is even Prove: If x 2 is even, x is even [Note that the problem is to prove an implication.] Proof: if x is not even, x is odd. Therefore x 2 is odd. This is the contrapositive of the original assertion. S. Datta (York Univ.) EECS 1028 W 18 19 / 21

Inference in Predicate Logic Aside: Inference and Planning The steps in an inference are useful for planning an action. Example: your professor has assigned reading from an out-of-print book. How do you do it? Example 2: you are participating in the television show Amazing race. How do you play? The steps in an inference are useful for proving assertions from axioms and facts. Q: Why is it important for computers to prove theorems? Proving program-correctness Hardware design Data mining Many more S. Datta (York Univ.) EECS 1028 W 18 20 / 21

Inference in Predicate Logic Aside: Inference and Planning - 2 Sometimes the steps of an inference (proof) are useful. E.g. on Amazon book recommendations are made. You can ask why they recommended a certain book to you (reasoning). S. Datta (York Univ.) EECS 1028 W 18 21 / 21