150 likes | 167 Views
Explore set theory, Cartesian products, symmetric difference, set identities, De Morgan's rules, logical equivalences in proving set identities, and functions in discrete mathematics.
E N D
Discrete Mathematics CS 2610 September 7, 2006
Agenda • Last class: Set theory • Subsets (proper subsets) & set equality • Set cardinality • Power sets • n-Tuples & Cartesian product • Set operations • Union, Intersection, Complement, Difference • Venn diagrams • This class • Symmetric difference • Proving properties about sets • Sets as bit-strings • Functions
Symmetric Difference The symmetric difference, A B, is: A B = { x | (x A x B) v (x B x A)} (i.e., x is in one or the other, but not in both) Is it commutative ?
= ( A ) A Set Identities • Identity: • A = A , A U = A • Domination: • A U= U, A = • Idempotent: • A A = A = A A • Double complement: • Commutative: • A B = B A , A B = B A • Associative: • A (B C) = (A B) C , • A (B C) = (A B) C
Set Identities • Absorption: • A (A B) = A • A (A B) = A • Complement: • A A¯= U , • A A¯= • Distributive: • A (B C) = (A B) (A C), • A (B C) = (A B) (A C)
(A UB)= A B (A B)= A U B De Morgan’s Rules • De Morgan’s I • DeMorgan’s II
n U = È È È A A A A i 1 2 n = i 1 Generalized Union The union of a collection of sets contains those elements that belong to at least one set in the collection.
n = Ç Ç Ç A A A A i 1 2 n = i 1 Generalized Intersection The intersection of a collection of sets contains those elements that belong to all the sets in the collection.
Proving Set Identities How would we prove set identities of the form S1 = S2 where the S1 and S2 are sets? • Prove S1S2 andS2S1 separately. • Use previously proven set identities. • Use logical equivalences to prove equivalent set definitions. • Use a membership table.
(A UB)= A B Proof Using Logical Equivalences Prove that Proof: First show (A U B) A B, then the reverse. Let c (A U B) c {x | x A x B} (Def. of union) (c A c B) (Def. of complement) (c A) (c B) (De Morgan’s rule) (c A) (c B) (Def. of ) (c A) (c B) (Def. of complement) c {x | x A x B} (Set builder notation) c A B (Def. of intersection) Therefore, (A U B) A B. Each step above is reversible, therefore A B (A U B).
(A UB)= A B A B A B A B A U B A U B 1 1 0 0 1 0 0 1 0 1 1 0 0 0 1 1 The two columns are the same. Therefore, x (A U B) iff x A B – i.e., the equality holds. Proof Using Membership Table • Using membership tables 1 : means x is in the Set 0 : means x is not in the Set 0 1 0 0 1 0 0 1 0 1 0 1
Sets as Bit-Strings For a finite universal set U = {a1, a2, …,an} • Assign an arbitrary order to the elements of U. • Represent a subset A of U as a string of n bits, B = b1b2…bn Example: U= {a1, a2, …, a5}, A = {a1, a3, a4 } B = 10110
Sets as Bit-Strings Set theoretic operations A 1 0 1 0 1 B 0 0 1 1 0 A B A B A B 1 0 1 1 1 Bit-wise OR 0 0 1 0 0 Bit-wise AND 1 0 0 1 1 Bit-wise XOR
Functions (Section 2.3) Let A and B be nonempty sets. A function f from A to B is an assignment of exactly one element of B to each element of A. We write f(a) = b if b is the unique element of B assigned by the function f to the element a in A. If f is a function from A to B, we write f : A B. Functions are sometimes called mappings.
f John Smith Edward Groth Richard Boon Mike Mario Kim Joe Jill A B Example A = {Mike, Mario, Kim, Joe, Jill} B = {John Smith, Edward Groth, Jim Farrow} Let f:A B where f(a) means father of a. Can grandmother of a be a function ?