Discrete Structures & Algorithms Basics of Set Theory EECE 320 — UBC.

Slides:



Advertisements
Similar presentations
Set Operations. When sets are equal A equals B iff for all x, x is in A iff x is in B or … and this is what we do to prove sets equal.
Advertisements

Prof. Johnnie Baker Module Basic Structures: Sets
Discrete Mathematics Lecture 5 Alexander Bukharovich New York University.
Basic Structures: Sets, Functions, Sequences, Sums, and Matrices
CS 173: Discrete Mathematical Structures Cinda Heeren Rm 2213 Siebel Center Office Hours: M 12:30-2:30p.
Instructor: Hayk Melikya
(CSC 102) Discrete Structures Lecture 14.
Basic Structures: Sets, Functions, Sequences, Sums, and Matrices
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.
1 Section 1.7 Set Operations. 2 Union The union of 2 sets A and B is the set containing elements found either in A, or in B, or in both The denotation.
Sets Sections 2.1 and 2.2 of Rosen Fall 2008 CSCE 235 Introduction to Discrete Structures Course web-page: cse.unl.edu/~cse235 Questions:
Discrete Structures Chapter 3 Set Theory Nurul Amelina Nasharuddin Multimedia Department.
Copyright © Zeph Grunschlag, Set Operations Zeph Grunschlag.
Sets 1.
Sets 1.
1 Set Theory. Notation S={a, b, c} refers to the set whose elements are a, b and c. a  S means “a is an element of set S”. d  S means “d is not an element.
1 Discussion #21 Discussion #21 Sets & Set Operations; Tuples & Relations.
Rosen 1.6. Approaches to Proofs Membership tables (similar to truth tables) Convert to a problem in propositional logic, prove, then convert back Use.
Sets.
Basic Structures: Sets, Functions, Sequences, Sums, and Matrices
Sets Set Operations Functions. 1. Sets 1.1 Introduction and Notation 1.2 Cardinality 1.3 Power Set 1.4 Cartesian Products.
Set, Combinatorics, Probability & Number Theory Mathematical Structures for Computer Science Chapter 3 Copyright © 2006 W.H. Freeman & Co.MSCS Slides Set,
Sets Defined A set is an object defined as a collection of other distinct objects, known as elements of the set The elements of a set can be anything:
CS 103 Discrete Structures Lecture 10 Basic Structures: Sets (1)
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.
Lecture 2.2: Set Theory* CS 250, Discrete Structures, Fall 2011 Nitesh Saxena *Adopted from previous lectures by Cinda Heeren.
CS201: Data Structures and Discrete Mathematics I
1. 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 of A” A = {a 1, a 2,
CompSci 102 Discrete Math for Computer Science
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.
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.
Lecture 2.1: Sets and Set Operations CS 250, Discrete Structures, Fall 2014 Nitesh Saxena Adopted from previous lectures by Cinda Heeren.
Chapter 2 With Question/Answer Animations. Section 2.1.
Rosen 1.6, 1.7. Basic Definitions Set - Collection of objects, usually denoted by capital letter Member, element - Object in a set, usually denoted by.
Discrete Mathematics SETS. What is a set? ^A set is a unordered collection of “objects”  People in a class: {A yşe, B arış, C anan }  Cities in Turkey.
Discrete Mathematics. Set Theory - Definitions and notation A set is an unordered collection of elements. Some examples: {1, 2, 3} is the set containing.
Based on slides by Patrice Belleville and Steve Wolfman CPSC 121: Models of Computation Unit 11: Sets.
Lecture 2.2: Set Theory CS 250, Discrete Structures, Fall 2015 Nitesh Saxena Adopted from previous lectures by Cinda Heeren.
Discrete Mathematics CS 2610 January 27, part 2.
Discrete Mathematics Set.
Based on slides by Patrice Belleville and Steve Wolfman CPSC 121: Models of Computation Unit 11: Sets.
1 Topic Sets (5.1, 5.2, 5.3). 2 Original author of the slides: Vadim Bulitko University of Alberta Modified by.
Module #3 - Sets 3/2/2016(c) , Michael P. Frank 2. Sets and Set Operations.
Set Operations Section 2.2.
1 Set Theory Second Part. 2 Disjoint Set let A and B be a set. the two sets are called disjoint if their intersection is an empty set. Intersection of.
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.
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.
Week 8 - Wednesday.  What did we talk about last time?  Relations  Properties of relations  Reflexive  Symmetric  Transitive.
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)
Applied Discrete Mathematics Week 1: Logic and Sets
Discrete Structures – CNS 2300
Discrete Mathematical The Set Theory
Set, Combinatorics, Probability & Number Theory
COT 3100, Spring 2001 Applications of Discrete Structures
Sets Section 2.1.
Taibah University College of Computer Science & Engineering Course Title: Discrete Mathematics Code: CS 103 Chapter 2 Sets Slides are adopted from “Discrete.
Introduction to Set Theory
Exercises Show that (P  Q)  (P)  (Q)
CS100: Discrete structures
Set Theory Rosen 6th ed., §
Set Operations Section 2.2.
Discrete Mathematics CS 2610
Lecture 2.1: Sets and Set Operations*
CS 250, Discrete Structures, Fall 2013
Lecture Sets 2.2 Set Operations.
Sets & 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.
CSC102 - Discrete Structures (Discrete Mathematics) Set Operations
Presentation transcript:

Discrete Structures & Algorithms Basics of Set Theory EECE 320 — UBC

2 Set Theory: Definitions and notation A set is an unordered collection of elements. Some examples {1, 2, 3} is the set containing “1” and “2” and “3.” {1, 1, 2, 3, 3} = {1, 2, 3} since repetition is irrelevant. {1, 2, 3} = {3, 2, 1} since sets are unordered. {1, 2, 3, …} is a way we denote an infinite set (in this case, the natural numbers).  = {} is the empty set, or the set containing no elements. Note:   {  }

3 Definitions and notation x  S means “x is an element of set S.” x  S means “x is not an element of set S.” A  B means “A is a subset of B.” Venn Diagram or, “B contains A.” or, “every element of A is also in B.” or,  x ((x  A)  (x  B)). A B

4 Definitions and notation A  B means “A is a subset of B.” A  B means “A is a superset of B.” A = B if and only if A and B have exactly the same elements. iff, A  B and B  A iff, A  B and A  B iff,  x ((x  A)  (x  B)). So to show equality of sets A and B, show: A  B B  A

5 Definitions and notation A  B means “A is a proper subset of B.” –A  B, and A  B. –  x ((x  A)  (x  B))   x ((x  B)  (x  A)) –  x ((x  A)  (x  B))   x  (  (x  B) v (x  A)) –  x ((x  A)  (x  B))   x ((x  B)   (x  A)) –  x ((x  A)  (x  B))   x ((x  B)  (x  A)) A B

6 Definitions and notation Quick examples: {1,2,3}  {1,2,3,4,5} {1,2,3}  {1,2,3,4,5} Is   {1,2,3}? Yes!  x (x   )  (x  {1,2,3}) holds, because (x   ) is false. Is   {1,2,3}? No! Is   { ,1,2,3}? Yes! Vacuously

7 Definitions and notation Quiz Time Is {x}  {x}? Is {x}  {x,{x}}? Is {x}  {x,{x}}? Is {x}  {x}? Yes No

8 How to specify sets Explicitly: {John, Paul, George, Ringo} Implicitly: {1,2,3,…}, or {2,3,5,7,11,13,17,…} Set builder: { x : x is prime }, { x | x is odd }. In general { x : P(x) is true }, where P(x) is some description of the set. Example: Let D(x,y) denote “x is divisible by y.” Give another name for { x :  y ((y > 1)  (y < x))   D(x,y) }. Can we use any predicate P to define a set S = { x : P(x) }? : and | are read “such that” or “where” Primes

9 Predicates for defining sets Can we use any predicate P to define a set S = { x : P(x) }? Define S = { x : x is a set where x  x } Then, if S  S, then by the definition of S, S  S. So S must not be in S, right? Doh! But, if S  S, then by the definition of S, S  S. No! There is a town with a barber who shaves all the people (and only the people) who do not shave themselves. Who shaves the barber?

10 Cardinality of sets If S is finite, then the cardinality of S, |S|, is the number of distinct elements in S. If S = {1,2,3}, |S| = 3. If S = {3,3,3,3,3}, If S = , If S = { , {  }, { ,{  }} }, |S| = 1. |S| = 0. |S| = 3. If S = {0,1,2,3,…}, |S| is infinite. (more on this later)

11 Power sets If S is a set, then the power set of S is 2 S = { x : x  S }. If S = {a}, or P(S) If S = {a,b}, If S = , If S = { ,{  }}, We say, “P(S) is the set of all subsets of S.” 2 S = { , {a}}. 2 S = { , {a}, {b}, {a,b}}. 2 S = {  }. 2 S = { , {  }, {{  }}, { ,{  }}}. Fact: if S is finite, |2 S | = 2 |S|. (If |S| = n, |2 S | = 2 n. )

12 Cartesian product The Cartesian product of two sets A and B is: A x B = { : a  A  b  B} If A = {Charlie, Lucy, Linus}, and B = {Brown, VanPelt}, then A,B finite  |AxB| = ? A 1 x A 2 x … x A n = { : a 1  A 1, a 2  A 2, …, a n  A n } A x B = {,,,,, } We’ll use these special sets soon! a)AxB b)|A|+|B| c)|A+B| d)|A||B|

13 Operators The union of two sets A and B is: A  B = { x : x  A v x  B} If A = {Charlie, Lucy, Linus}, and B = {Lucy, Desi}, then A  B = {Charlie, Lucy, Linus, Desi} A B

14 Operators The intersection of two sets A and B is: A  B = { x : x  A  x  B} If A = {Charlie, Lucy, Linus}, and B = {Lucy, Desi}, then A  B = {Lucy} A B

15 Operators The intersection of two sets A and B is: A  B = { x : x  A  x  B} If A = {x : x is a US president}, and B = {x : x is deceased}, then A  B = {x : x is a deceased US president} A B

16 Operators The intersection of two sets A and B is: A  B = { x : x  A  x  B} If A = {x : x is a US president}, and B = {x : x is in this room}, then A  B = {x : x is a US president in this room} =  A B Sets whose intersection is empty are called disjoint sets

17 Operators The complement of a set A is A c = { x : x  A} If A = {x : x is bored}, then A = {x : x is not bored} A =   c = U and U c =  U

18 Operators The set difference, A - B, is: A U B A - B = { x : x  A  x  B } A - B = A  B c

19 Operators The symmetric difference, A  B, is: A  B = { x : (x  A  x  B) v (x  B  x  A)} = (A - B) U (B - A) like “exclusive or” A U B

20 Operators A  B = { x : (x  A  x  B) v (x  B  x  A)} = (A - B) U (B - A) Proof: { x : (x  A  x  B) v (x  B  x  A)} = { x : (x  A - B) v (x  B - A)} = { x : x  ((A - B) U (B - A))} = (A - B) U (B - A)

21 Famous identities Two pages of (almost) obvious equivalences. One page of HS algebra. Some new material? Don’t memorize them, understand them! They’re in Rosen, Sec. 2.2

22 Identities Identity Domination Idempotent A  U = A A U  = A A U U = U A   =  A U A = A A  A = A

23 Identities Excluded middle Uniqueness Double complement A U A = U A  A =  A = A

24 Identities Commutativity Associativity Distributivity A U B = (A U B) U C = A  B = B U A B  A (A  B)  C = A U (B U C) A  (B  C) A U (B  C) = A  (B U C) = (A U B)  (A U C) (A  B) U (A  C)

25 Identities DeMorgan’s Law I DeMorgan’s Law II pq Hand waving is good for intuition, but we aim for a more formal proof. (A U B) c = A c  B c (A  B) c = A c U B c

26 Proving identities Show that A  B and that A  B. Use a membership table. Use previously proven identities. Use logical equivalences to prove equivalent set definitions. New & importantLike truth tables Like  Not hard, a little tedious

27 Proving identities (1) Prove that 1.(  ) (x  (A U B) c )  (x  A U B)  (x  A and x  B)  (x  A c  B c ) 2.(  ) (x  A c  B c )  (x  A and x  B)  (x  A U B)  (x  (A U B) c ) (A U B) c = A c  B c

28 Proving identities (2) Prove that (A U B) c = A c  B c using a membership table. 0 : x is not in the specified set 1 : otherwise ABAB A  B A U B Have we not seen this before?

29 Proving identities (3) Prove that (A U B) c = A c  B c using identities. (A U B) = A U B = A  B

30 Proving identities (4) Prove that (A U B) c = A c  B c using logically equivalent set definitions. (A U B) c = {x :  (x  A v x  B)} = {x :  (x  A)   (x  B)} = A c  B c = {x : (x  A c )  (x  B c )}

31 A proof to do X  (Y - Z) = (X  Y) - (X  Z). True or False? Prove your response. = (X  Y)  (X’ U Z’) = (X  Y  X’) U (X  Y  Z’) =  U (X  Y  Z’) = (X  Y  Z’) (X  Y) - (X  Z) = (X  Y)  (X  Z)’

32 Suppose to the contrary, that A  B  , and that x  A  B. Another proof to do Prove that if (A - B) U (B - A) = (A U B) then ______ Then x cannot be in A-B and x cannot be in B-A. Do you see the contradiction yet? But x is in A U B since (A  B)  (A U B). A  B =  Thus, A  B = . a)A U B =  b)A = B c)A  B =  d)A-B = B-A =  Then x is not in (A - B) U (B - A). DeMorgan’s Law Trying to prove p  q Assume p and not q, and find a contradiction. Our contradiction was that sets were not equal.

33 Wrap up Sets are an essential structure for all mathematics. We covered the basic definitions and identities that will allow us to reason about sets.