Lecture 4: Predicates and Quantifiers; Sets.

Slides:



Advertisements
Similar presentations
22 March 2009Instructor: Tasneem Darwish1 University of Palestine Faculty of Applied Engineering and Urban Planning Software Engineering Department Introduction.
Advertisements

Basic Structures: Sets, Functions, Sequences, Sums, and Matrices
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Chapter 1: (Part 2): The Foundations: Logic and Proofs.
Basic Structures: Sets, Functions, Sequences, Sums, and Matrices
L41 Lecture 2: Predicates and Quantifiers.. L42 Agenda Predicates and Quantifiers –Existential Quantifier  –Universal Quantifier 
Section 1.6: Sets Sets are the most basic of discrete structures and also the most general. Several of the discrete structures we will study are built.
Lecture 4: Predicates and Quantifiers; Sets.
2.1 Sets. DEFINITION 1 A set is an unordered collection of objects. DEFINITION 2 The objects in a set are called the elements, or members, of the set.
Denoting the beginning
Analytical Methods in CS (CIS 505)
Copyright © Zeph Grunschlag, Set Operations Zeph Grunschlag.
Sets 1.
CSE115/ENGR160 Discrete Mathematics 02/10/11 Ming-Hsuan Yang UC Merced 1.
Sets 1.
Sets. Copyright © Peter Cappello Definition Visualize a dictionary as a directed graph. Nodes represent words If word w is defined in terms of word.
CSE115/ENGR160 Discrete Mathematics 01/20/11 Ming-Hsuan Yang UC Merced 1.
Discrete Math 6A Max Welling. Recap 1. Proposition: statement that is true or false. 2. Logical operators: NOT, AND, OR, XOR, ,  3. Compound proposition:
Sets.
Predicates and Quantifiers
Section 1.3: Predicates and Quantifiers
Set theory Sets: Powerful tool in computer science to solve real world problems. A set is a collection of distinct objects called elements. Traditionally,
CSci 2011 Discrete Mathematics Lecture 3 CSci 2011.
CS 173, Lecture B August 27, 2015 Tandy Warnow. Proofs You want to prove that some statement A is true. You can try to prove it directly, or you can prove.
Set, Combinatorics, Probability & Number Theory Mathematical Structures for Computer Science Chapter 3 Copyright © 2006 W.H. Freeman & Co.MSCS Slides Set,
Chapter 1, Part II: Predicate Logic With Question/Answer Animations.
CS 103 Discrete Structures Lecture 10 Basic Structures: Sets (1)
P.1 Real Numbers. 2 What You Should Learn Represent and classify real numbers. Order real numbers and use inequalities. Find the absolute values of real.
Copyright © Cengage Learning. All rights reserved. CHAPTER 3 THE LOGIC OF QUANTIFIED STATEMENTS THE LOGIC OF QUANTIFIED STATEMENTS.
Chapter 1, Part II: Predicate Logic With Question/Answer Animations.
Copyright © 2014 Curt Hill Sets Introduction to Set Theory.
Discrete Structure Sets. 2 Set Theory Set: Collection of objects (“elements”) a  A “a is an element of A” “a is a member of A” a  A “a is not an element.
Copyright © Curt Hill Quantifiers. Copyright © Curt Hill Introduction What we have seen is called propositional logic It includes.
Mathematical Proofs. Chapter 1 Sets 1.1 Describing a Set 1.2 Subsets 1.3 Set Operations 1.4 Indexed Collections of Sets 1.5 Partitions of Sets.
CS201: Data Structures and Discrete Mathematics I
Chapter 2: Basic Structures: Sets, Functions, Sequences, and Sums (1)
January 30, 2002Applied Discrete Mathematics Week 1: Logic and Sets 1 Let’s Talk About Logic Logic is a system based on propositions.Logic is a system.
Hazırlayan DISCRETE COMPUTATIONAL STRUCTURES Propositional Logic PROF. DR. YUSUF OYSAL.
CompSci 102 Discrete Math for Computer Science
College Algebra Sixth Edition James Stewart Lothar Redlin Saleem Watson.
Predicates and Quantified Statements
Copyright © Cengage Learning. All rights reserved.
Section 2.1. Section Summary Definition of sets Describing Sets Roster Method Set-Builder Notation Some Important Sets in Mathematics Empty Set and Universal.
Week 6 - Friday.  What did we talk about last time?  Solving recurrence relations.
Naïve Set Theory. Basic Definitions Naïve set theory is the non-axiomatic treatment of set theory. In the axiomatic treatment, which we will only allude.
Sets Goal: Introduce the basic terminology of set theory.
2.1 Sets 2.2 Set Operations –Set Operations –Venn Diagrams –Set Identities –Union and Intersection of Indexed Collections 2.3 Functions 2.4 Sequences and.
1 Introduction to Abstract Mathematics Predicate Logic Instructor: Hayk Melikya Purpose of Section: To introduce predicate logic (or.
CS 285- Discrete Mathematics Lecture 4. Section 1.3 Predicate logic Predicate logic is an extension of propositional logic that permits concisely reasoning.
Chapter 2 With Question/Answer Animations. Section 2.1.
Discrete Mathematics Lecture # 10. Set Theory  A well defined collection of {distinct} objects is called a set.  The objects are called the elements.
Predicate Logic One step stronger than propositional logic Copyright © Curt Hill.
Module #3 - Sets 3/2/2016(c) , Michael P. Frank 2. Sets and Set Operations.
PREDICATES AND QUANTIFIERS COSC-1321 Discrete Structures 1.
Discrete Mathematics CS 2610 August 31, Agenda Set Theory Set Builder Notation Universal Set Power Set and Cardinality Set Operations Set Identities.
Section 2.1. Sets A set is an unordered collection of objects. the students in this class the chairs in this room The objects in a set are called the.
Section 1.4. Propositional Functions Propositional functions become propositions (and have truth values) when their variables are each replaced by a value.
1 Section 7.1 First-Order Predicate Calculus Predicate calculus studies the internal structure of sentences where subjects are applied to predicates existentially.
Chapter 2 1. Chapter Summary Sets (This Slide) The Language of Sets - Sec 2.1 – Lecture 8 Set Operations and Set Identities - Sec 2.2 – Lecture 9 Functions.
Introduction to Set Theory (§1.6) A set is a new type of structure, representing an unordered collection (group, plurality) of zero or more distinct (different)
Sequences Lecture 11. L62 Sequences Sequences are a way of ordering lists of objects. Java arrays are a type of sequence of finite size. Usually, mathematical.
Sets, Permutations, and Combinations. Lecture 4-1: Sets Sets: Powerful tool in computer science to solve real world problems. A set is a collection of.
Set, Combinatorics, Probability & Number Theory
COT 3100, Spring 2001 Applications of Discrete Structures
Chapter 1 Logic and Proofs Homework 2 Given the statement “A valid password is necessary for you to log on to the campus server.” Express the statement.
Discrete Structure II: Introduction
Discrete Mathematics CS 2610
Lecture 4: Predicates and Quantifiers; Sets.
Discrete Mathematics CMP-200 Propositional Equivalences, Predicates & Quantifiers, Negating Quantified Statements Abdul Hameed
Lecture Sets 2.2 Set Operations.
Logic Logic is a discipline that studies the principles and methods used to construct valid arguments. An argument is a related sequence of statements.
Presentation transcript:

Lecture 4: Predicates and Quantifiers; Sets.

Agenda Predicates and Quantifiers Sets Existential Quantifier  Universal Quantifier  Sets Curly brace notation “{ … }” Cardinality “| … |” Element containment  Subset containment  Empty set { } =  Power set P(S ) = 2S N-tuples “( … )” and Cartesian product  L4

If the Lion is an octopus then the Lion has 8 limbs. Motivating example Consider the compound proposition: If the Lion is an octopus then the Lion has 8 limbs. Q1: What are the atomic propositions. Q2: Is the proposition true or false? Q3: Why? Question: why is the last a contingency? L4

Motivating example A1: Let p = “The Lion is an octopus” and q = “the Lion has 8 limbs”. The compound proposition is represented by p q. A2: True! A3: Conditional always true when p is false! Q: How can we represent: it exists an animal such that it has 8 limbs? Question: why is the last a contingency? L4

Motivating example Logical Quantifiers help to fix this problem. In our case the fix would look like: For all x, if x is an octopus then x has 8 limbs. Then as a special case of x = Zeph, we would be able to conclude that pq is indeed true in the way hoped for. L4

“For all x, if x is an octopus then x has 8 limbs.” Motivating example The quantifiers are used to bind the variables and create a proposition with embedded semantics. For example: “For all x, if x is an octopus then x has 8 limbs.” there are two atomic propositional functions P (x) = “x is an octopus” Q (x) = “x has 8 limbs” whose conditional P (x) Q (x) is formed and is bound by “For all x ”. Question: why is the last a contingency? L4

Semantics In order to add to propositions with meaning, we need to have a universe of discourse, i.e. a collection of subjects (or nouns) about which the propositions relate. L4

Predicates If we have a statement involving some variables, such as x>3 or x=y+2 or x+y=z These statements are consist of some variables x,y and z and a predicate (such as greater than or equal) which gives the statement some truth value in the universe of discourse where x,y and z exist . L4

Predicates…… continue A predicate is a property or description of subjects in the universe of discourse. The following predicates are all italicized : Johnny is tall. The bridge is structurally sound. 7 is a prime number L4

Propositional Functions By taking a variable subject denoted by symbols such as x, y, z, and applying a predicate one obtains a propositional function (or formula). When an object from the universe is plugged in for x, y, etc. a truth value results: x is tall. …e.g. plug in x = Johnny n is a prime number. …e.g. plug in n = 111

Quantifiers There are two quantifiers Existential Quantifier “” reads “there exists” Universal Quantifier “” reads “for all” Each is placed in front of a propositional function and binds it to obtain a proposition with semantic value. Mnemonics:  -- reverse E signifies “there Exists”  -- upside-down A signifies “for All” L4

Existential Quantifier “x P (x)” is true when an instance can be found which when plugged in for x makes P (x) true Like disjunction over entire universe x P (x )  P (x1) P (x2) P (x3)  … L4

Existential Quantifier. Example Consider a universe consisting of Leo: a lion Jan: an octopus with all 8 tentacles Bill: an octopus with only 7 tentacles And recall the propositional functions P (x) = “x is an octopus” Q (x) = “x has 8 limbs” x ( P (x) Q (x) ) Q: Is the proposition true or false? L4

Existential Quantifier. Example A: True. Proposition is equivalent to (P (Leo)Q (Leo) )(P (Jan) Q (Jan) )(P(Bill)Q (Bill) ) P (Leo) is false because Leo is a Lion, not an octopus, therefore the conditional P (Leo) Q (Leo) is true, and the disjunction is true. Leo is called a positive example. L4

The Universal Quantifier “x P (x)” true when every instance of x makes P (x) true when plugged in Like conjunctioning over entire universe x P (x )  P (x1) P (x2)  P (x3)  … L4

Universal Quantifier. Example Consider the same universe and propositional functions as before.  x ( P (x) Q (x ) ) Q: Is the proposition true or false? L4

Universal Quantifier. Example A: False. The proposition is equivalent to (P (Leo)Q (Leo))(P (Jan)Q (Jan))(P (Bill)Q (Bill)) Bill is the counter-example, i.e. a value making an instance –and therefore the whole universal quantification– false. P (Bill) is true because Bill is an octopus, while Q (Bill) is false because Bill only has 7 tentacles, not 8. Thus the conditional P (Bill)Q (Bill) is false since TF gives F, and the conjunction is false. L4

Multivariate Quantification Quantification involving only one variable is fairly straightforward. Just a bunch of OR’s or a bunch of AND’s. When two or more variables are involved each of which is bound by a quantifier, the order of the binding is important and the meaning often requires some thought. L4

Parsing Multivariate Quantification When evaluating an expression such as x y z P (x,y,z ) translate the proposition in the same order to English: There is an x such that for all y there is a z such that P (x,y,z) holds. L4

There is an x such that for all y there is a z such that y - x ≥ z. Parsing Example P (x,y,z ) = “y - x ≥ z ” There is an x such that for all y there is a z such that y - x ≥ z. There is some number x which when subtracted from any number y results in a number bigger than some number z. Q: If the universe of discourse for x, y, and z is the natural numbers {0,1,2,3,4,5,6,7,…} what’s the truth value of xy z P (x,y,z )? L4

Parsing Example A: True. For any “exists” we need to find a positive instance. Since x is the first variable in the expression and is “existential”, we need a number that works for all other y, z. Set x = 0 (want to ensure that y -x is not too small). Now for each y we need to find a positive instance z such that y - x ≥ z holds. Plugging in x = 0 we need to satisfy y ≥ z so set z := y. Q: Did we have to set z := y and that y - x > z ? “:=” means that we are assigning the value of y to z (like the assignment symbol “=” in Java) L4

Parsing Example A: No. Could also have used the constant z := 0. Many other valid solutions. L4

Order matters Set the universe of discourse to be all natural numbers {0, 1, 2, 3, … }. Let R (x,y ) = “x < y”. Q1: What does x y R (x,y ) mean? Q2: What does y x R (x,y ) mean? L4

Order matters R (x,y ) = “x < y” A1: x y R (x,y ): “All numbers x admit a bigger number y ” A2: y x R (x,y ): “Some number y is bigger than all x” Q: What’s the true value of each expression? L4

Order matters A: 1 is true and 2 is false. x y R (x,y ): “All numbers x admit a bigger number y ” --just set y = x + 1 y x R (x,y ): “Some number y is bigger than all numbers x” --y is never bigger than itself, so setting x = y is a counterexample Q: What if we have two quantifiers of the same kind? Does order still matter? L4

Order matters –but not always A: No! If we have two quantifiers of the same kind order is irrelevent. x y is the same as y x because these are both interpreted as “for every combination of x and y…” x y is the same as y x because these are both interpreted as “there is a pair x , y…” Try to see why this is with some Java code (nested forAll’s and nested exist’s) L4

Logical Equivalence with Formulas DEF: Two logical expressions possibly involving propositional formulas and quantifiers are said to be logically equivalent if no-matter what universe and what particular propositional formulas are plugged in, the expressions always have the same truth value. EG: x y Q (x,y ) and y x Q (y,x ) are equivalent –names of variables don’t matter. EG: x y Q (x,y ) and y x Q (x,y ) are not! L4

DeMorgan Revisited Recall DeMorgan’s identities: Conjunctional negation: (p1p2…pn)  (p1p2…pn) Disjunctional negation: (p1p2…pn)  (p1p2…pn) Since the quantifiers are the same as taking a bunch of AND’s () or OR’s () we have: Universal negation:  x P(x )  x P(x ) Existential negation:  x P(x )  x P(x ) L4

x y ( x 2  y )  x y x 2 > y Negation Example Compute:  x y x2  y In English, we are trying to find the opposite of “every x admits a y greater or equal to x’s square”. The opposite is that “some x does not admit a y greater or equal to x’s square” Algebraically, one just flips all quantifiers from  to  and vice versa, and negates the interior propositional function. In our case we get: x y ( x 2  y )  x y x 2 > y Note that  x y x2  y is the same as  ( x y x2  y ) L4

Blackboard Exercises Section 1.3 1.3.42) Show that the following are logically equivalent: (x A(x ))(x B(x )) x,y A(x )B(y ) Hint: To get started it’s useful to plug in examples for A and B. E.g. could try letting A(x) = “x likes Christina Aguilera” and B(x) = “x likes Britney Spears” L4

Blackboard Exercises Section 1.3 Need to show that (x A(x ))(x B(x ))x,y A(x )B(y ) is a tautology, so LHS and RHS must always have same truth values. Hint: To get started it’s useful to plug in examples for A and B. E.g. could try letting A(x) = “x likes Christina Aguilera” and B(x) = “x likes Britney Spears” L4

Blackboard Exercises Section 1 Blackboard Exercises Section 1.3 (x A(x ))(x B(x ))x,y A(x )B(y ) CASE I) Assuming LHS true show RHS true. Either x A(x ) true OR x B(x ) true Case I.A) For all x, A(x ) true. As (T  anything) = T, we can set anything = B(y) and obtain For all x and y, A(x )B(y ) –the RHS! Case I.B) For all x, B(x ) true… similar to case (I.A) Hint: To get started it’s useful to plug in examples for A and B. E.g. could try letting A(x) = “x likes Christina Aguilera” and B(x) = “x likes Britney Spears” L4

Blackboard Exercises Section 1 Blackboard Exercises Section 1.3 (x A(x ))(x B(x ))x,y A(x )B(y ) CASE II) Assume LHS false, show RHS false. Both x A(x ) false AND x B(x ) false. Thus x  A(x ) true AND x  B(x ) true. Thus there is an example x1 for which A(x1) is false and an example x2 for which B(x2) is false. As F  F = F, we have A(x1)B(x2) false. Setting x = x1 and y = x2 gives a counterexample to x,y A(x )B(y ) showing the RHS false. //QED Hint: To get started it’s useful to plug in examples for A and B. E.g. could try letting A(x) = “x likes Christina Aguilera” and B(x) = “x likes Britney Spears” L4

Section 1.4: Sets DEF: A set is a collection of elements. This is another example where mathematics must start at the level of intuition. Sets are the basic data structure out of which most mathematical theories are built. L4

Sets Curly braces “{“ and “}” are used to denote sets. EG: { 11, 12, 13 } { , , } { , , , 11, Leo } L4

Sets A set is defined only by the elements which it contains. Thus repeating an element, or changing the ordering of elements in the description of the set, does not change the set itself: { 11, 11, 11, 12, 13 } = { 11, 12, 13 } { , , } = { , , } L4

Standard Numerical Sets The natural numbers: N = { 0, 1, 2, 3, 4, … } The integers: Z = { … -3, -2, -1, 0, 1, 2, 3, … } The positive integers: Z+ = {1, 2, 3, 4, 5, … } The real numbers: R --contains any decimal number of arbitrary precision The rational numbers: Q --these are decimal numbers whose decimal expansion repeats Q: Give examples of numbers in R but not Q. L4

Standard Numerical Sets

-Notation The Greek letter “” (epsilon) is used to denote that an object is an element of a set. When crossed out “” denotes that the object is not an element.” EG: 3  S reads: “3 is an element of the set S ”. Q: Which of the following are true: 3  R -3  N -3  R 0  Z+ x xR  x2=-5 L4

-Notation A: 1, 3 and 4 3  R. True: 3 is a real number. -3  N. False: natural numbers don’t contain negatives. -3  R. True: -3 is a real number. 0  Z+. True: 0 isn’t positive. x xR  x2=-5 . False: square of a real number is non-neg., so can’t be -5. L4

-Notation DEF: A set S is said to be a subset of the set T iff every element of S is also an element of T. This situation is denoted by S  T A synonym of “subset” is “contained by”. Definitions are often just a means of establishing a logical equivalence which aids in notation. The definition above says that: S  T  x (xS )  (xT ) We already had all the necessary concepts, but the “” notation saves work. Note that we don’t need to parenthesize x (xS )  (xT ) as x [(xS )  (xT )] because no other interpretation would result in a valid proposition. E.g. isn’t [x (xS )]  (xT ) valid because x remains an unbound variable. On the other hand x [ [ x (xS ) ]  (x T )] is a valid formula, though very confusing. L4

-Notation When “” is used instead of “”, proper containment is meant. A subset S of T is said to be a proper subset if S is not equal to T. Notationally: S  T  S T  x (x  S  xT ) Q: What algebraic symbol is  reminiscent of? L4

-Notation A:  is to , as < is to . L4

The Empty Set The empty set is the set containing no elements. This set is also called the null set and is denoted by: {}  L4

Subset Examples Q: Which of the following are true: N  R Z  N -3  R       L4

Subset Examples A: 1, 4 and 5 N  R. All natural numbers are real. Z  N. Negative numbers aren’t natural. -3  R. Nonsensical. -3 is not a subset but an element! (This could have made sense if we viewed -3 as a set –which in principle is the case– in this case the proposition is false). {1,2}  Z+. This actually makes sense. The set {1,2} is an object in its own right, so could be an element of some set; however, {1,2} is not a number, therefore is not an element of Z.   . Any set contains itself.   . No set can contain itself properly. L4

Cardinality The cardinality of a set is the number of distinct elements in the set. |S | denotes the cardinality of S. Q: Compute each cardinality. |{1, -13, 4, -13, 1}| |{3, {1,2,3,4}, }| |{}| |{ {}, {{}}, {{{}}} }| L4

Cardinality Hint: After eliminating the redundancies just look at the number of top level commas and add 1 (except for the empty set). A: |{1, -13, 4, -13, 1}| = |{1, -13, 4}| = 3 |{3, {1,2,3,4}, }| = 3. To see this, set S = {1,2,3,4}. Compute the cardinality of {3,S, } |{}| = || = 0 |{ {}, {{}}, {{{}}} }| = |{ , {}, {{}}| = 3 L4

Cardinality DEF: The set S is said to be finite if its cardinality is a nonnegative integer. Otherwise, S is said to be infinite. EG: N, Z, Z+, R, Q are each infinite. Note: We’ll see later that not all infinities are the same. In fact, R will end up having a bigger infinity-type than N, but surprisingly, N has same infinity-type as Z, Z+, and Q. L4

Power Set DEF: The power set of S is the set of all subsets of S. Denote the power set by P (S ) or by 2s . The latter weird notation comes from the following. Lemma: | 2s | = 2|s| We’ll prove this lemma later. L4

Power Set –Example To understand the previous fact consider Enumerate all the subsets of S : 0-element sets: {} 1 1-element sets: {1}, {2}, {3} +3 2-element sets: {1,2}, {1,3}, {2,3} +3 3-element sets: {1,2,3} +1 Therefore: | 2s | = 8 = 23 = 2|s| Why is this not a proof of the lemma on previous page? L4

Ordered n-tuples Notationally, n-tuples look like sets except that curly braces are replaced by parentheses: ( 11, 12 ) –a 2-tuple aka ordered pair ( , , ) –a 3-tuple ( , , , 11, Leo ) –a 5-tuple L4

Ordered n-tuples As opposed to sets, repetition and ordering do matter with n-tuples. (11, 11, 11, 12, 13)  ( 11, 12, 13 ) ( , , )  ( , , ) L4

Cartesian Product The most famous example of 2-tuples are points in the Cartesian plane R2. Here ordered pairs (x,y) of elements of R describe the coordinates of each point. We can think of the first coordinate as the value on the x-axis and the second coordinate as the value on the y-axis. DEF: The Cartesian product of two sets A and B –denoted by A B– is the set of all ordered pairs (a, b) where aA and bB . Q: Describe R2 as the Cartesian product of two sets. L4

Cartesian Product A: R2 = RR. I.e., the Cartesian plane is formed by taking the Cartesian product of the x-axis with the y-axis. One can generalize the Cartesian product to several sets simultaneously. Q: If A = {1,2}, B = {3,4}, C = {5,6,7} what is A B C ? L4

| A1  A2  … An | = |A1||A2| … |An| Cartesian Product A: A = {1,2}, B = {3,4}, C = {5,6,7} A B C = { (1,3,5), (1,3,6), (1,3,7), (1,4,5), (1,4,6), (1,4,7), (2,3,5), (2,3,6), (2,3,7), (2,4,5), (2,4,6), (2,4,7) } Lemma: The cardinality of the Cartesian product is the product of the cardinalities: | A1  A2  … An | = |A1||A2| … |An| Q: What does S equal? L4

Cartesian Product A: From the lemma: |S | = |||S | = 0|S | = 0 There is only one set with no elements –the empty set– therefore, S must be the empty set . One can also check this directly from the definition of the Cartesian product. L4