-1- CS 205 Introduction to Discrete Structures Lecture 9 Naive Set Theory ! Definition 1.6.1 A set is an unordered collection of objects or things. ! Definition 1.6.2 The objects or things in a set are also called the elements, or members of the set. A set is said to contain its elements. We may denote the proposition “x is an element of set S” by x 0 S And the proposition “x is not an element of set S” by x ó S or by ¬( x 0 S) ! Definition 1.6.3 Two sets are equal iff they have the same exact elements. We may denote the proposition “A and B are equal sets” by A = B. Using predicate logic, A = B x( x 0 A x 0B ) ] : ! There are several ways to describe a set. " In common English, e.g. Let S be the set that contains the integers from 1 to 10. " By inclosing a list of the elements with braces, e.g. S = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 } " Using ellipses when the general pattern of the elements is obvious, e.g. S = { 1, 2, 3, ÿ , 10 } " Using set builder (set theoretic) notation, e.g. S = {x | x0 Z + v x < 11} ( or {x | x0Z +, x < 11} ) - We shall revisit set builder notation following the next note. ! The Empty and Universal Sets " A set that contains no elements is called the empty set, or null set, and is denoted by i or { }. For any element x, x0i is false, i.e. x0 i ] F. " The set that contains all the elements in our universe of discourse is called the universal set and is denoted by U. For any element x, x0U is true, i.e. x0 U ] T. ! Venn Diagrams (pg 79, etc.) -2- CS 205 Introduction to Discrete Structures Lecture 9 Naive Set Theory ! Set Builder Notation Revisited S = { x | P(x) } { x | P(x) } or { f(x) | P(x) } (e.g. {2x | x 0 Z + } Note that we will not use functions in Formal Predicate Logic ] x( x0S : P(x) ) or more formally, S = { x | P(x) } ] x0U( x0S : P(x) ) Sometimes we may need to say that S = { x | x0 S }. ! Definition 1.6.4 The set A is the subset of B iff every element of A is also contained in B. We use the notation A B to indicate that A is a subset of the set B. ! Theorem 1.6.1 For any set S, f Formally, A f B ] x( x 0 A 6 x 0 B ) Proof of i. S if Proof of ii. S S f i. if S and ii. S ] x( x 0 i6 x 0S ) ] x( F 6 x 0S ) ] x( T ) ]T ] x( x 0 S 6 x 0S ) ] x( x ó S w x 0S ) ] x( T ) ]T fS def f implied by def i def 6 (3 rules if using our formal rules) x has no effect on T def f imp taut. -3- CS 205 Introduction to Discrete Structures Lecture 9 Naive Set Theory ! Definition 1.6.4b A is a proper subset of set B iff A is a subset of B, but not equal to B. We use A to denote this. Formally, A d B ] A f B v A B. dB ! Definition 1.6.5 If there are exactly n distinct elements in a set S where n0N, we say that S is a finite set and that n is the cardinality of S. The cardinality of S is denoted by |S|. ! Definition 1.6.6 A set is said to be infinite if it is not finite. ! Definition 1.6.7 The power set of a set S is the set of all subsets of the set S. The power set of S is denoted by P (S). ! Definition 1.6.8 The ordered n-tuple (a 1, a 2, ÿ, a n) is the ordered collection that has a 1 as its first element, a 2 as its second element, up to a n as its nth element. If n = 2, it is customary to call (a 1, a 2) an ordered pair. ! Definition 1.6.9 The Cartesian product of sets A and B, denoted by A × B, is the set of all ordered pairs (a, b) where a 0A and b 0B. Hence, A × B = { (a, b) | a 0 A v b 0 B }. ! Definition 1.7.1 The union of the sets A and B, Denoted by A c B, is the set that contains those elements that are either in A or in B, or in both. Thus A c B = { x | x0 A w x0 B }. ! Definition 1.7.2 The intersection of the sets A and B, Denoted by A 1 B, is the set that contains those elements that are in both A and B. Thus A 1 B = { x | x0 A v x0 B }. ! Definition 1.7.3 Two sets are called disjoint if their intersection is the empty set. ! The Principle of Inclusion-Exclusion |A c B| = |A| + |B| ! |A 1 B| -4- CS 205 Introduction to Discrete Structures Lecture 9 Naive Set Theory ! Definition 1.7.4 The difference of sets A and B, denoted by A ! B, is the set containing those elements that are in A but not in B. The difference of A and B is also called the complement of B with respect to A. Thus A ! B = { x | x0 A v xó B } ! Definition 1.7.4b The symmetric difference of A and B, denoted by A r B, is the set containing those elements in either A or B, but not in both A and B. Formally we may say: A r B = { x | x0 A r x0 B } or A r B = { x | (x0 A w x0 B) v ¬(x0 A v x0 B) } ! Definition 1.7.5 Let U be the universal set. The complement of the set A, denoted by complement of A with respect to U. That is , is the = U ! A = { x | x0 U v xó A }. When the identity of the universal set is implied, we will often say = { x | xó A } Be will use the following equivalences: ¬(x0 A) ] xó A ] x0 ! It is common for beginners to be confused about which expressions are sets, which are logical statements and which evaluate to an integer value. The following table summarizes these distinctions, using arbitrary sets A and B. Sets Logical Expressions i A, B, U, , P (S), A×B A B, A B, A ! B, A r B 1 c x0A A=B A B f Ad B Natural Number Values |A|, |B|, |i|, |U|, |P (S)|, |A × B| |A B|, |A B|, |A ! B|, |A r B| 1 c -5- CS 205 Introduction to Discrete Structures Lecture 9 Naive Set Theory ! Proving Set Relationships Between Arbitrary Sets. " The “Choose Method” (w/o set identities) For the following proofs it is assumed that A, B, and C are arbitrarily chosen sets, x and y are arbitrarily chosen elements and that U . i - fAcB Prove A Let Y ] - x0A A.P. add cB def c A fAcB A 1BfA A c 1 f Prove A B A Let x0(A 1 B) ] Y - x0A x0A w x0B Prove A c A.P. x0A v x0B def 1 x0A simp i=A ci) Let x0(A ] ] ] x0A w x0 i A.P. def c i x0A w F def x0A ident i = A, since only ] rules used -6- CS 205 Introduction to Discrete Structures Lecture 9 Naive Set Theory - Prove A c U = U Let x0(A ] ] ] ] - - Prove c U) A.P. x0A w x0U def c x0A w T def U T dom x0U def U A c U = U, since only ] rules used =A Let x0 ] ] ] ¬(x0 Prove A A.P. ) def ¬¬(x0A) def (x0A) D.N. c = A, since only ] rules used =U c Let x0(A ] ] ] x0A w x0 def T taut x0U def U ) A.P. c Ac = U, since only ] rules used -7- CS 205 Introduction to Discrete Structures Lecture 9 Naive Set Theory - Prove = Let x0 ] ] ] ] xó(A x0 def c Let x0 A.P. ] ] ] ] ] ¬(x0(A A.P. c B) def xóA w xóB def c x0 def w x0 c B) ) def c xóA v xóB DeM, def ó x0 def x0 = = def ¬(x0A w x0B) v x0 def 1 WOOPS! -8- CS 205 Introduction to Discrete Structures Lecture 9 Naive Set Theory - 1 2 3 - fB then (A 1 C) f(B 1 C) Let A f B A.P. ] x( x0A 6 B) def f Prove that if A 1 C) Let x0(A ] Y Y Y Y ] x0A v x0C def 1 x0A simp x0B 1, U.I., MP x0C 2, simp x0B v x0C 3, conj A ! (B 1 C) x0(B A.P. 1 C) def 1 A fB Y (A 1 C) f(B 1 C) ?=? (A !B) 1 (A !C) f Prove (A !B) 1 (A !C) A ! (B 1 C) Let x0(A !B) 1 (A !C) x0(A !B) v x0(A !C) x0(A !B) x0A v xóB (x0A v xóB) w (x0A v xóC) x0A v (xóB w xóC) x0A v ¬(x0B v x0C) x0A v ¬(x0B 1 C ) x0A v xó(B 1 C) x0(A ! (B 1 C)) A.P. def 1 simp def ! add dist DeM def 1 def ó def ! (A !B) 1 (A !C) f A ! (B 1 C) -9- CS 205 Introduction to Discrete Structures Lecture 9 Naive Set Theory - Prove that (A × B) (B × A) when A and B are nonempty sets, unless A = B. First note that if A = Ø or B = Ø then (A × B) = (B × A), wether or not A = B. Next, how do we represent p unless q? Either ¬q p or ¬p q will do. 6 6 So we want to prove that if A and B are nonempty sets the [(A × B) = (B × A)] Y (A = B) i. Let (A × B) = (B × A) A.P. ii. Let A =\ B A.P. proof by contradiction iii. From i. it follows that for all ordered pairs (x, y), (x, y) 0 (A × B) iff (x, y) 0 (B × A) . From ii. it follows that there must exist an element x s.t. either of the following cases must be true. Case I: x 0 A and x ó B Case II: x ó A and x 0 B If case I is true then there must exist an ordered pair (x,y) s.t. (x,y) 0 (A × B) , x 0 A , y 0 B , x ó B since A Ø and B Ø. Thus (x, y) ó (B × A) since x ó B. So clearly (x, y) is an element of (A × B) but not of (B × A). But this contradicts iii, thus A = B by contradiction. The proof for case II is symmetrical to the proof for case I, thus [(A × B) = (B × A)] Y (A = B). -10- CS 205 Introduction to Discrete Structures Lecture 9 Naive Set Theory ! Proving Set Relationships Between Arbitrary Sets. " The “Choose Method” (with set identities pg 89) " Deduction applied to Set Builder Notation (ex 11, pg 90) " Membership Tables (pg 91) ! Generalized Unions and Intersections (pg 91-93) ! Computer Representations of Sets (93-94) ! Russell’s Paradox Let S be the set that contains a set x if the set does not belong to itself, so that S = { x | xóx }. Show that the asumption that S is a member of S leads to a contradiction. If S 0S then by the definition of S, S óS which is a contradiction. Show that the asumption that Sis not a member of S leads to a contradiction. If S óS, then by the definition of S, S should be a member of S, i.e. S 0S, which again is a contradiction. It turns out that we can avoid these types of paradoxes if we build set theory axiomatically.