Announcements ICS 6B � Quiz schedule online * ● Will allow you to drop 1 quiz Boolean Algebra & Logic ● Next Quiz is on Thursday ● * Subject to change � Homework is online Lecture Notes for Summer Quarter, 2008 Michele Rousseau Set 3 – Ch. 1.4, 2.1, 2.2 Lecture Set 3 - Chpts 1.4, 2.1, 2.2 2 Today’s Lecture � Chapter 1 �Section 1.4 � ● Nested Quantifiers�1.4� Chapter 1: Section 1.4 � Chapter 2 �Sections 2.1 & 2.2 � ● Sets�2.1� ● Set Operations �2.2� Nested Quantifiers 3 Lecture Set 3 - Chpts 1.4, 2.1, 2.2 What are Nested quantifiers? Translating to English Translate: If one quantifier is within the scope of the U: R other. ∀ x ∀ y��x�0� � �y�0� � �xy�0� � Eg. “For every real number x and every real U:R number y, if x � 0 and y �0, then xy � 0 number y if x � 0 and y �0 then xy � 0” ∀ x ∃ y�x � y�0� This is the same as ∀ x Q�x�, where Q�x� is ∃ y P�x, y�, where P�x, y� is �x � y � 0� Lecture Set 3 - Chpts 1.4, 2.1, 2.2 5 Lecture Set 3 - Chpts 1.4, 2.1, 2.2 6 1
Thinking of Quantification as Loops Switching order To prove or disprove nested quantifications � If the quantifiers are the same switching � think in terms of nested loops order doesn’t matter ● �ie. All ∀ ’s or all ∃ ’s� ∀ x ∀ y P�x, y� ● ∀ x ∀ y P�x,y� � ∀ y ∀ x P�x,y� Loop through x values Loop through x values ● ∃ x ∃ y P�x,y� � ∃ y ∃ x P�x,y� For each x value loop through the y values If we find that P�x, y� is true for all values of y � If the quantifiers are different then order for every x, matters then ∀ x ∀ y P�x, y� is True If we find one y for any x such that P�x,y� is False ● ∀ x ∃ y P�x,y� � ∃ y ∀ x P�x,y� then ∀ x ∀ y P�x, y� is False NOT Equivalent 7 Lecture Set 3 - Chpts 1.4, 2.1, 2.2 8 Lecture Set 3 - Chpts 1.4, 2.1, 2.2 Thinking of Quant. as Loops (2) Thinking of Quant. as Loops (3) ∀ x ∃ y P�x, y� ∃ x ∃ y P�x, y� Loop through x values Loop through x values For each x value loop through the y values For each x value loop through the y values If we find one y for each x such that P�x, y� is true If we find one y for one x such that P�x, y� is true then ∀ x ∃ y P�x, y� is True then ∃ x ∃ y P�x, y� is True If for any one x we can’t find a y such that P�x,y� is true If we can t fine one x and one y such that P�x,y� is true If we can’t fine one x and one y such that P�x y� is true then ∀ x ∃ y P�x, y� is False th ∀ ∃ P� � i F l then ∃ x ∃ y P�x, y� is False ∃ x ∀ y P�x, y� Loop through x values For each x value loop through the y values If we find an x such P�x, y� is true for all y’s then ∃ x ∀ y P�x, y� is True If we can’t find such an x then ∃ x ∀ y P�x, y� is False Lecture Set 3 - Chpts 1.4, 2.1, 2.2 9 10 Translating from English to Quantification of Two Variables Nested Quantifiers State- When True? When False? ment “The product of two positive numbers is positive.” P(x, y) is true for There is an x, y pair for ∀ x ∀ y every x, y pair which P(x,y) is false For every x For every x, There is an x such that There is an x such that ∀ x ∃ y there is at least one y P(x, y) is false for which P(x, y) is true for every y Note: These are not equivalent There is an x for which For every x ∃ x ∀ y P(x, y) is true for there is at least one y every y for which P(x,y) is false There is at least one x, y P(x, y) is false ∃ x ∃ y pair for which for every x, y pair P(x, y) is true 11 Lecture Set 3 - Chpts 1.4, 2.1, 2.2 12 2
Translating from English to Homework for Section 1.4 Nested Quantifiers (2) “Given a number, there is a number greater � 3�b,f� than it.” � 5�b,f� � 9�b,d,h,j� � 11�b,f,h� � , , � � 15�b,d,f� � Feel free to do more if you need the practice Lecture Set 3 - Chpts 1.4, 2.1, 2.2 13 Lecture Set 3 - Chpts 1.4, 2.1, 2.2 14 What is a Set? � Set : An unordered collection of objects ● The point � to group objects together Chapter 2: Section 2.1 ● Often objects have some similar properties � Objects : elements or members of the set ● A set is said to contain its element Universal Set U Universal Set U U Objects, Sets 1 Set A Elements, or 5 10 A Members 15 8 2 Venn Diagram 16 Lecture Set 3 - Chpts 1.4, 2.1, 2.2 Some Notations Describing sets � � � denote all the elements in the set a � A � a is an element of the set A Eg. V��a,e,i,o,u� b � A � a is not an element of the set A Set V Set V elements elements U Sets can also have unrelated objects a b A O��26, Paul, Pot, a� … ‐ ellipses denote a pattern I��2,4,6,…,98� Lecture Set 3 - Chpts 1.4, 2.1, 2.2 17 Lecture Set 3 - Chpts 1.4, 2.1, 2.2 18 3
Set Builders (describing sets) Common Universal Sets � You can also use set builders so that you N � �0,1,2,3,…�, the set of natural numbers don’t have to name every element Z � �…,‐2,‐1,0,1,2,…�, the set of integers ● Just state the properties Z � � �1,2,3,…�, the set of positive integers I�� x | x is a positive even integer less than 100� Q Q � �p/q | p � Z , q � Z, and q � 0�, the set �p/q | p , q , q �, Or Or of rational numbers I��x � Z � | x is even and x�100� R, the set of real numbers All integers All positive � You can also use Predicates Note: Sometimes 0 is not considered a part of the set of natural numbers. I��x | P�x�� I contains all elements from U which make P true 19 Lecture Set 3 - Chpts 1.4, 2.1, 2.2 20 Lecture Set 3 - Chpts 1.4, 2.1, 2.2 Special Sets Subsets � The empty set , void set ,or null set A is a subset of B iff every element of A is ● A set with no elements also an element of B. ● Notation: Ø or � � � In other words A is a subset of B iff ● The assertion x� Ø is always false ∀ x �x � A � x � B�. � The singleton set ● A set with one element � Notation U A � B Is this the empty set? �Ø� A Example: B No! It is the singleton set with the empty set as its element A ��2,4,6� Think of the empty set as an empty folder Think of this �Ø� as a folder with only an empty folder in it B��1,2,3,4,5,6,7,8� A � B 21 22 Lecture Set 3 - Chpts 1.4, 2.1, 2.2 Lecture Set 3 - Chpts 1.4, 2.1, 2.2 Theorem 1 Proper Subsets For every set S, � A proper subset is a subset in which A � B ( 1 ) Ø � S and (2) S � S � In other words A is a proper subset of B iff Proof ● ∀ x �x � A � x � B� � ∃ x �x � B � x � A� Let S be a set ● Notation: A � B To show that Ø � S we must show that ∀ x �x � Ø � x � S� is true � � Eg. Eg A��1,2,3� Because Ø contains no elements, B��0,1,2,3,4,5,6� it follows that x � Ø is always false. A � B because B has more elements than A It follows that x � Ø � x � S is always true, because its If A��0,1,2,3,4,5,6� hypothesis is always false and a conditional statement with a false hypothesis is always true. then A � B, but A � B What if A��1,2,9�? Therefore ∀ x �x � Ø � x � S� is true Lecture Set 3 - Chpts 1.4, 2.1, 2.2 23 24 4
Equal Sets Equal Sets (2) Two sets are equal iff they have the same elements. We can prove 2 sets �A & B� are equal if we � In other words A and B are equal iff can show: ∀ x �x � A � x � B�. A � B and B � A � Notation A�B Remember : Eg. A � B is the same as ∀ x �x � A � x � B� and B � A is the same as ∀ x �x � B � x � A� A��x, y, z� Which is the same as saying ∀ x �x � A � x � B� B��z, x, y� C��z,z,z,z,z,y,y,y,y,y,y,y,y,x� A�B�C 25 Lecture Set 3 - Chpts 1.4, 2.1, 2.2 26 Sets as Elements/Members Cardinality, Finite & Infinite Sets � Sets may have other sets as elements Let S be a set. If there is exactly n distinct elements in S Like with the empty set … where n is a nonnegative integer , A��Ø, �a�, �b�, �a,b�� we say that S is a finite set and that Is a � A? N is the cardinality of S. � Notation for cardinality: |S| � Notation for cardinality: |S| Eg. Is �a� � A? Let V be the set of vowels in the alphabet |V| � 5 Is B��x | x is a subset of the set �a,b�� equivalent to A? A set is infinite if it is not finite. 27 28 Lecture Set 3 - Chpts 1.4, 2.1, 2.2 Lecture Set 3 - Chpts 1.4, 2.1, 2.2 The Power Set Ordered n-tuples Given a set S, � Sometimes order matters the power set is the set of all subsets of S. ● Sets are unordered � Notation ● We use ordered n‐tuples P�S� The ordered n‐tuple �a 1 , a 2 ,…, a n � is the ordered Eg Eg. collection that has a 1 as its first element, a 2 as its 2 nd element ,…, and a n as its nth element. Let S��a,b,c� What is P�S�? ● They are equal iff each corresponding pair of elements is equal. ● �a 1 , a 2 ,…, a n � � �b 1 , b 2 ,…, b n � iff a i � b i How many elements does P�S� have if |S| is 6? Lecture Set 3 - Chpts 1.4, 2.1, 2.2 29 Lecture Set 3 - Chpts 1.4, 2.1, 2.2 30 5
Recommend
More recommend