CMSC 250 Discrete Structures Set Theory Sets Definition of a Set: – NAME = {list or description of elements} – Examples B = {1,2,3} C = {xZ+ | - 4 < x < 4} Axiom of Extension – A set of elements is completely defined by elements, regardless of order and duplicates – Example: {a,b}={b,a}={a,b,a}={a,b,a,b,b,a} 27 June 2016 Set Theory 2 Notation Sets defined by property – C = {xZ+ | - 4 < x < 4} – C = {1,2,3,4} Consider elements: glue, tape, pen – Sets are not equivalent to elements {glue} glue – Sets can be elements of other sets {pen, {glue, tape}} 27 June 2016 Set Theory 3 Subset AB xU, xA xB – A is contained in B – B contains A AB xU, xA xB Relationship between membership and subset: – xU, xA {x} A Definition of set equality: – A = B AB BA 27 June 2016 Set Theory 4 Same Set or Not??? X={xZ | pZ, x = 2p} Y={yZ | qZ, y = 2q-2} A={xZ | iZ, x = 2i+1} B={xZ | iZ, x = 3i+1} C={xZ | iZ, x = 4i+1} 27 June 2016 Set Theory 5 Versus glue {glue, tape, pen} {glue} {glue, tape, pen} {glue} {{glue}, {tape}, pen} {glue} {{glue}, {tape}, pen} 27 June 2016 Set Theory 6 Sets C = {x | x > - 4 and x < 4} C = {xZ+ | x > - 4 and x < 4} – What is the first element? 27 June 2016 Set Theory 7 Set Operations Formal Definitions and Venn Diagrams Union: A B {x U | x A x B} Intersection: A B {x U | x A x B} Complement: c A A' {x U | x A} Difference: 27 June 2016 A B {x U | x A x B} A B A B' Set Theory 8 Procedural Versions of Set Definitions Let X and Y be subsets of a universal set U and suppose x and y are elements of U. 1. 2. 3. 4. 5. x(XY) xX or xY x(XY) xX and xY x(X–Y) xX and xY xXc xX (x,y)(XY) xX and yY 27 June 2016 Set Theory 9 Venn Diagrams A={1,2,5,7}; B= {1,5}; C={3,7} U={1,2,3,4,5,6,7} 2 1 5 A 2 B 1B 5 7 C 3 27 June 2016 BA 4 6 4 6 Set Theory A 7 C 3 10 Venn Diagram for R, Z, Q Z 27 June 2016 Q Set Theory R 11 Ordered n-Tuple Ordered n-tuple – (x1,x2,x3,…,xn) takes order and multiplicity into account – n values – not necessarily distinct – in the order given (x1,x2,x3,…,xn) = (y1,y2,y3,…,yn) iZ1in, xi=yi Examples – {a,b} = {b,a} – {(a,b)} {(b,a)} – Cartesian coordinate system 27 June 2016 Set Theory 12 Cartesian Product A B {(a, b) | a A b B} Example – A = {x,y,z} – B = {5,7} – C = {a,b} A B C (A B) C 27 June 2016 Set Theory 13 Empty Set Properties 1. 2. 3. 4. 5. 6. 7. Ø is a subset of every set. There is only one empty set. The union of any set with Ø is that set. The intersection of any set with its own complement is Ø. The intersection of any set with Ø is Ø. The Cartesian Product of any set with Ø is Ø. The complement of the universal set is Ø and the complement of the empty set is the universal set. 27 June 2016 Set Theory 14 Other Definitions Proper Subset Disjoint Set: A and B are disjoint A B A B A B A and B have no elements in common xU, xAxB ^ xBx A AB = Ø A and B are Disjoint Sets 27 June 2016 Set Theory 15 Partitions of a Set A collection of nonempty sets {A1,A2,…,An} is a partition of the set A If and only if 1. A = A1 A2…An 2. A1,A2,…,An are mutually disjoint 27 June 2016 Set Theory 16 Power Sets Power set of A = P(A) = Set of all subsets of A Example: A={a,b,c} Can also think of as a truth table … Prove that – A,B{sets}, AB P(A) P(B) Prove that (where n(X) means the size of set X) – A{sets}, n(A) = k n(P(A)) = 2k 27 June 2016 Set Theory 17 Edwards-Venn Diagram 27 June 2016 Set Theory 18 Properties of Sets (Theorems 5.2.1 & 5.2.2) A B A A A B A B B B A B Inclusion Transitivity DeMorgan’s for Complement Distribution of union and intersection A BBC AC ( A B)' A' B' ( A B)' A' B' A ( B C ) ( A B) ( A C ) A ( B C ) ( A B) ( A C ) 27 June 2016 Set Theory 19 Element Argument Basic Method for proving that one set is a subset of another Let sets X and Y be given. To prove XY, – Suppose that x is a particular but arbitrarily chosen element of X, – Show that x is an element of Y. 27 June 2016 Set Theory 20 Set Equality Two sets A and B are equal, if and only if, they have the same exact elements. Expressed as: – A=B – A=B – A=B – A=B 27 June 2016 AB and BA (xA, xB) (xB, xA) xU, (xAxB xBxA) (xU, xAxB) (xU, xBxA) Set Theory 21 Prove A=C A={nZ | pZ, n = 2p} C={mZ | qZ, m = 2q-2} 27 June 2016 Set Theory 22 Does A=D A={xZ | pZ, x = 2p} D={yZ | qZ, y = 3q+1} Easy to disprove universal statements! 27 June 2016 Set Theory 23 Prove A – B = A – (A B) LHS: A – B = {xU | xA xB} RHS: A – (A B) = = = = = = = = {xU {xU {xU {xU {xU {xU {xU {xU | | | | | | | | xA x(A B)} xA x(A B)’} xA x(A’ B’)} xA (xA’ xB’)} (xA xA’) (xA xB’)} FALSE (xA xB’)} xA xB’} xA xB} LHS = RHS 27 June 2016 Set Theory 24 Prove A B A sets A,B xU x(A B) xA Choose generic sets A, B and element xU Assume x(A B) – xA xB (by def of intersection “”) – xA (by conjunctive simplification) x(A B) xA (by closing cond. world) sets A,B xU x(A B) xA 27 June 2016 Set Theory 25 Using Venn Diagrams to help find counter example A B C ? A B C A B C ? A B A C A B C ? A B C 27 June 2016 Set Theory 26 Deriving new Properties using rules and Venn diagrams A B and B A are disjoint A B A A B A B A C A B C 27 June 2016 Set Theory 27 Formal Languages = alphabet = a finite set of symbols string over = empty (or null) string denoted as OR ordered n-tuple of elements n = set of strings of length n * = set of all finite length strings L = {s | s=aibiai for iZ≥0} = ? 27 June 2016 Set Theory 28