CPSC 121: Models of Computation

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

CPSC 121: Models of Computation

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

Learning Goals: In-Class. Using Logical Equivalences. Outline. Worked Problem: Even Squares

Predicate Logic. Andreas Klappenecker

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

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

Section Summary. Section 1.5 9/9/2014

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

Math.3336: Discrete Mathematics. Nested Quantifiers/Rules of Inference

Proofs. Example of an axiom in this system: Given two distinct points, there is exactly one line that contains them.

CSE 20 DISCRETE MATH. Fall

Review for Midterm 1. Andreas Klappenecker

Rules Build Arguments Rules Building Arguments

CSE 20 DISCRETE MATH. Winter

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

First order Logic ( Predicate Logic) and Methods of Proof

Logic, Sets, and Proofs

MAT 243 Test 1 SOLUTIONS, FORM A

2. The Logic of Compound Statements Summary. Aaron Tan August 2017

Review. Propositions, propositional operators, truth tables. Logical Equivalences. Tautologies & contradictions

Propositional Logic Not Enough

CPSC 121: Models of Computation. Module 9: Proof Techniques (part 2) Mathematical Induction

Predicate Logic & Quantification

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

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

A. Propositional Logic

MATH 22 INFERENCE & QUANTIFICATION. Lecture F: 9/18/2003

Review. Propositional Logic. Propositions atomic and compound. Operators: negation, and, or, xor, implies, biconditional.

MATH 2001 MIDTERM EXAM 1 SOLUTION

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

Chapter 3. The Logic of Quantified Statements

CSE Discrete Structures

software design & management Gachon University Chulyun Kim

The Logic of Compound Statements cont.

Solutions to Exercises (Sections )

THE LOGIC OF QUANTIFIED STATEMENTS

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.

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

Section 1.2: Propositional Logic

Chapter 2: The Logic of Quantified Statements

What is the decimal (base 10) representation of the binary number ? Show your work and place your final answer in the box.

n logical not (negation) n logical or (disjunction) n logical and (conjunction) n logical exclusive or n logical implication (conditional)

Logic - recap. So far, we have seen that: Logic is a language which can be used to describe:

Steinhardt School of Culture, Education, and Human Development Department of Teaching and Learning. Mathematical Proof and Proving (MPP)

Supplementary Logic Notes CSE 321 Winter 2009

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

THE LOGIC OF QUANTIFIED STATEMENTS. Predicates and Quantified Statements I. Predicates and Quantified Statements I CHAPTER 3 SECTION 3.

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

Review 1. Andreas Klappenecker

CS 2336 Discrete Mathematics

2-4: The Use of Quantifiers

Section 1.1 Propositions

CITS2211 Discrete Structures Proofs

MACM 101 Discrete Mathematics I. Exercises on Propositional Logic. Due: Tuesday, September 29th (at the beginning of the class)

DISCRETE MATH: LECTURE Chapter 3.3 Statements with Multiple Quantifiers If you want to establish the truth of a statement of the form

Predicate Logic. Example. Statements in Predicate Logic. Some statements cannot be expressed in propositional logic, such as: Predicate Logic

Predicates, Quantifiers and Nested Quantifiers

1) Let h = John is healthy, w = John is wealthy and s = John is wise Write the following statement is symbolic form

Discrete Mathematics. Instructor: Sourav Chakraborty. Lecture 4: Propositional Logic and Predicate Lo

DISCRETE MATHEMATICS BA202

CS100: DISCRETE STRUCTURES. Lecture 5: Logic (Ch1)

Chapter 1: The Logic of Compound Statements. January 7, 2008

Thinking of Nested Quantification

Chapter 4, Logic using Propositional Calculus Handout

CSE 20 DISCRETE MATH WINTER

CSE 20 DISCRETE MATH SPRING

Propositional Logic. Spring Propositional Logic Spring / 32

Predicate Calculus lecture 1

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

n Empty Set:, or { }, subset of all sets n Cardinality: V = {a, e, i, o, u}, so V = 5 n Subset: A B, all elements in A are in B

Logic and Proofs. (A brief summary)

Predicate Logic - Deductive Systems

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

CSCE 222 Discrete Structures for Computing. Review for the Final. Hyunyoung Lee

Manual of Logical Style

Mat 243 Exam 1 Review

Propositional Logic. Fall () Propositional Logic Fall / 30

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

CHAPTER 1 - LOGIC OF COMPOUND STATEMENTS

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

CSCI-2200 FOUNDATIONS OF COMPUTER SCIENCE

Notes from How to Prove it: A Structured Approach by Daniel J. Velleman

Announcements. Exam 1 Review

LECTURE NOTES DISCRETE MATHEMATICS. Eusebius Doedel

The Foundations: Logic and Proofs. Chapter 1, Part III: Proofs

Why Learning Logic? Logic. Propositional Logic. Compound Propositions

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

ICS141: Discrete Mathematics for Computer Science I

Test 1 Solutions(COT3100) (1) Prove that the following Absorption Law is correct. I.e, prove this is a tautology:

Propositional and Predicate Logic

Review 3. Andreas Klappenecker

Mathematical Reasoning Rules of Inference & Mathematical Induction. 1. Assign propositional variables to the component propositional argument.

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

Propositional Logic. Jason Filippou UMCP. ason Filippou UMCP) Propositional Logic / 38

Intro to Logic and Proofs

University of Ottawa CSI 2101 Midterm Test Instructor: Lucia Moura. March 1, :00 pm Duration: 1:15 hs

CSE Discrete Structures

Inference and Proofs (1.6 & 1.7)

Class 29 - November 3 Semantics for Predicate Logic

Transcription:

CPSC 121: Models of Computation Unit 6 Rewriting Predicate Logic Statements Based on slides by Patrice Belleville and Steve Wolfman

Coming Up Pre-class quiz #7 is due Wednesday October 25th at 9:00 pm. Assigned reading for the quiz: o Epp, 4th edition: 4.1, 4.6, Theorem 4.4.1 o Epp, 3rd edition: 3.1, 3.6, Theorem 3.4.1. o Rosen, 6th edition: 1.6, 1.7. 3.4 (theorem 2 only). o Rosen 7th edition: 1.7, 1.8, 4.1 (theorem 2 only). Assignment #3 is due Monday October 30th at 4:00 pm. CPSC 121 2016W T1 2

Coming Up Pre-class quiz #8 is tentative due Wednesday November 1st at 9:00 pm. Assigned reading for the quiz: o Epp, 4th edition: 12.2, pages 791 to 795. o Epp, 3rd edition: 12.2, pages 745 to 747, 752 to 754 o Rosen, 6th edition: 12.2 pages 796 to 798, 12.3 o Rosen, 7th edition: 13.2 pages 858 to 861, 13.3 CPSC 121 2016W T1 3

Pre-Class Learning Goals By the start of class, you should be able to: Determine the negation of any quantified statement. Given a quantified statement and an equivalence rule, apply the rule to create an equivalent statement (particularly the De Morgan s and contrapositive rules). Prove and disprove quantified statements using the challenge method (Epp, 4th edition, page 119). Apply universal instantiation, universal modus ponens, and universal modus tollens to predicate logic statements that correspond to the rules premises to infer statements implied by the premises. Unit 6 - Rewriting Predicate Logic Statements 4

Quiz 6 Feedback Overall: Issues: Open-ended question: Unit 6 - Rewriting Predicate Logic Statements 5

Quiz 6 Feedback (cont') How many of the following statements are equivalent to x B y C, P(x) Q(y)? o x B y C, ~Q(y) ~P(x) o ~ ( x B y C, P(x) ^ ~Q(y)) o ~ ( x B y C, ~P(x) v Q(y)) o y B x C, P(y) Q(x) a) None of them b) One of them c) Two of them d) Three of them e) All four of them Unit 6 - Rewriting Predicate Logic Statements 6

In-Class Learning Goals By the end of this unit, you should be able to: Explore alternate forms of predicate logic statements using the logical equivalences you have already learned plus negation of quantifiers (a generalized form of the De Morgan s Law). Prove arguments with quantifiers. Unit 6 - Rewriting Predicate Logic Statements 7

? Related to CPSC 121 Big Questions? How can we convince ourselves that an algorithm does what it's supposed to do? We continue discussing how to prove various types of predicate logic statements that arise when we discuss algorithm correctness. Unit 5 - Predicate Logic 8

Outline Thinking of quantifiers differently. Rules and Transformations The challenge method. Unit 6 - Rewriting Predicate Logic Statements 9

Relation between,,, Suppose D contains values x 1, x 2,..., x n What does x D, P(x) really mean? It's the same as P(x 1 ) ^ P(x 2 ) ^... ^ P(x n ). Similarly, o x D, P(x) P(x 1 ) v P(x 2 ) v... v P(x n ) Thinking of quantifiers this way explains o Negation o Universal instantiation o Universal Modus Ponens, Tollens Unit 6 - Rewriting Predicate Logic Statements 10

Negation ~ x D, P(x) ~(P(x 1 ) ^ P(x 2 ) ^... ^ P(x n )) ~P(x 1 ) v ~P(x 2 ) v... v ~P(x n ) x D, ~P(x) ~ x D, P(x) ~(P(x 1 ) v P(x 2 ) v... v P(x n )) ~P(x 1 ) ^ ~P(x 2 ) ^... ^ ~P(x n ) x D, ~P(x) Unit 6 - Rewriting Predicate Logic Statements 11

Negation What can we do with the negation in: ~ c R + n0 N n N, n n0 f(n) cg(n)? A. It cannot be moved inward. B. It can only move across one quantifier because the generalized De Morgan s law can only handle one quantifier. C. It can only be moved across all three quantifiers because a negation can't appear between quantifiers. D. It could be moved across one, two or all three quantifiers. E. None of the above. Unit 6 - Rewriting Predicate Logic Statements 12

Negation Which of the following are equivalent to: ~ n 0 Z 0, n Z 0, n > n 0 F(a 1, a 2, n). A. n 0 Z 0, ~ n Z 0, n > n 0 F(a 1, a 2, n). B. n 0 Z 0, n Z 0, ~(n > n 0 ) F(a 1, a 2, n). C. n 0 Z 0, n Z 0, ~(n > n 0 F(a 1, a 2, n)). D. n 0 Z 0, n Z 0, ~(n > n 0 F(a 1, a 2, n)). E. n 0 Z 0, n Z 0, n > n 0 ~F(a 1, a 2, n). 13

Exercise Let A be the set of amoebae, and Parent(x, y) be true if amoeba x is amoeba y's parent. Use logical equivalences to show that these two translations of an amoeba has only one parent are logically equivalent: x A, y A, Parent(y, x) ( z A, Parent(z, x) y = z) x A, y A, Parent(y, x) (~ z A, Parent(z, x) y z) Unit 6 - Rewriting Predicate Logic Statements 14

Outline Thinking of quantifiers differently. Rules and Transformations The challenge method. Unit 6 - Rewriting Predicate Logic Statements 15

Universal Instantiation If a is any element of D then: x D, P(x) P(a) Proving it is a valid inference: Suppose x D, P(x) is true. Hence P(x 1 ) P(x 2 )... P(x n ) holds. If a = x i is an element of D, then by specialization we have P(x i ). Therefore P(a) is true. Unit 6 - Rewriting Predicate Logic Statements 16

Is Existential Instantiation a Valid Rule? Consider an existential instantiation rule, where a is any element of D: x D, P(x) P(a) A. This argument is valid: P(a) is true. B. This argument is invalid: P(a) is false. C. This argument is invalid: P(a) might be false. D. This argument is invalid for another reason. Unit 6 - Rewriting Predicate Logic Statements 17

A Valid Rule for Existential Instantiation Consider the existential instantiation rule: x D, P(x) P(w) w is a new name not appearing above the line where w is a new name which does not appear in the proof before (it will represent an element of D for which P(x) is true). Proving it is a valid inference: Suppose x D, P(x) is true. Hence P(x 1 ) v P(x 2 ) v... v P(x n ) holds. At least one P(x i ) is true. Since w represents any of the x i 's for which P(x i ) is true, we can conclude that P(w) is true, even though we don't know which element of D is represented by w. Unit 6 - Rewriting Predicate Logic Statements 18

Existential Generalization If a is any element of D then: P(a) x D, P(x) Proving it is a valid inference: Suppose P(a) is true and a = x i Hence P(x 1 ) v v P(x i ) v... v P(x n ) holds. Therefore x D, P(x) is true. Unit 6 - Rewriting Predicate Logic Statements 19

Universal Generalization If y is a non-specific (arbitrary) element of D then: P(y) for a non-specific y x D, P(x) Proving it is a valid inference: Suppose P(y) is true for a non-specific y D Written: WLOG, consider y D Since y can be anyone of the elements of D, P(x 1 ) P(x n ) holds. Therefore x D, P(x) is true. Unit 6 - Rewriting Predicate Logic Statements 20

Universal Modus Ponens/Tollens If a is an element of D then: x D, P(x) Q(x) P(a) Q(a) Proof: 1. x D, P(x) Q(x) premise 2. P(a) premise 3. P(a) Q(a) 1, universal instantiation 4. Q(a) 2, 3, modus ponens The proof for universal modus tollens is similar. Unit 6 - Rewriting Predicate Logic Statements 21

Is Existential Modus Ponens Valid? Is this rule valid? x D, P(x) Q(x) P(a) Q(a) A. This argument is valid, and Q(a) is true. B. The argument is valid, but the 1st premise can not be true; so Q(a) might be false. C. This argument is invalid because Q(a) is false. D. This argument is invalid because the premises can be true and Q(a) can be false. E. The argument is invalid for another reason. Unit 6 - Rewriting Predicate Logic Statements 22

Quantifier Rules (the only new rules we need) Universal Instantiation For any a D: x D, P(x) P(a) Existential Instantiation For an unspecified new (witness) w D: x D, P(x) P(w) Universal Generalization For any arbitrary x D: P(x) x D, P(x) Existential Generalization For any a D: P(a) x D, P(x) Unit 6 - Rewriting Predicate Logic Statements 23

Logical Equivalences Applying logical equivalences to predicate logic: Suppose we have o x D, P(x) Q(x) and we know that o P(x) Q(x) ~P(x) v Q(x) Can we infer o x D, ~P(x) v Q(x)? Can we infer o ~ x D, P(x) v Q(x)? Unit 6 - Rewriting Predicate Logic Statements 24

Logical Equivalences Which propositional logic equivalences apply to predicate logic? A. Double negation, Identity and De Morgan's ONLY B. ~(P(x) Q(x)) P(x) ~Q(x) C. Commutative, Associative, and the definition of conditional D. All propositional logic equivalences apply to predicate logic, but we have to be sure to carefully line up the parts of the logical equivalence with the parts of the logical statement. E. None of the above. Unit 6 - Rewriting Predicate Logic Statements 25

Applying Rules of Inference Suppose a and b are specific elements of D and we know P(a) x D, P(x) y D, Q(x,y) Can we infer A. Q(a, b)? B. y D, Q(a, y)? What if we have P(a) x D, P(x) y D, Q(x,y) Can we infer A. Q(a, b)? B. y D, Q(a, y)? Unit 6 - Rewriting Predicate Logic Statements 26

Rules of Inference Which rules of inference from propositional logic apply to predicate logic? A. Modus ponens and modus tollens only. B. All rules apply, but only if they follow universal quantifiers, not existential quantifiers. C. All rules apply, but only if they follow existential quantifiers, not universal quantifiers. D. All rules apply, but we have to be sure to match the parts of the rule with correct logical statements. E. None of the above. Unit 6 - Rewriting Predicate Logic Statements 27

Outline Thinking of quantifiers differently. Rules and Transformations The challenge method. Unit 6 - Rewriting Predicate Logic Statements 28

The Challenge Method A predicate logic statement is like a game with two players. you (trying to prove the statement true) your adversary (trying to prove it false). The two of you pick values for the quantified variables working from the left to right (i.e. inwards). You pick the values of existentially quantified variables. Your adversary picks the values of universally quantified variables Unit 6 - Rewriting Predicate Logic Statements 29

The Challenge Method The Challenge method (continued): If there is a strategy that allows you to always win, then the statement is true. If there is a strategy for your adversary that allows him/her to always win, then the statement is false. What does it mean to a winning strategy have at Nim? Unit 6 - Rewriting Predicate Logic Statements 30

The Challenge Method Example 1: x Z, n Z +, 2 x < n How would we say this in English? How would we prove this theorem? Example 2: n N, x N, n < 2 x How would we say this in English? How would we prove this theorem? Unit 6 - Rewriting Predicate Logic Statements 31

The Challenge Method Example 3: x N, n N, n < 2 x How would we say this in English? Is this statement true? How do we prove a statement is false? Unit 6 - Rewriting Predicate Logic Statements 32