Presentation is loading. Please wait.

Presentation is loading. Please wait.

Week 7 - Monday CS322.

Similar presentations


Presentation on theme: "Week 7 - Monday CS322."— Presentation transcript:

1 Week 7 - Monday CS322

2 Last time What did we talk about last time? Sets

3 Questions?

4 Logical warmup A man offers you a bet He shows you three cards
One is red on both sides One is green on both sides One is red on one side and green on the other He will put one of the cards, at random, on the table If you can guess the color on the other side, you win If you bet $100 You gain $25 on a win You lose your $100 on a loss Should you take the bet? Why or why not?

5 Set Theory

6 Set operations We usually discuss sets within some superset U called the universe of discourse Assume that A and B are subsets of U The union of A and B, written A  B is the set of all elements of U that are in either A or B The intersection of A and B, written A  B is the set of all elements of U that are in A and B The difference of B minus A, written B – A, is the set of all elements of U that are in B and not in A The complement of A, written Ac is the set of all elements of U that are not in A

7 The empty set There is a set with no elements in it called the empty set We can write the empty set { } or  It comes up very often For example, {1, 3, 5}  {2, 4, 6} =  The empty set is a subset of every other set (including the empty set)

8 Disjoint sets and partitions
Two sets A and B are considered disjoint if A  B =  Sets A1, A2, … An are mutually disjoint (or nonoverlapping) if Ai  Aj =  for all i  j A collection of nonempty sets {A1, A2, … An} is a partition of set A iff: A = A1  A2  …  An A1, A2, … An are mutually disjoint

9 Power set Given a set A, the power set of A, written P(A) or 2A is the set of all subsets of A Example: B = {1, 3, 6} P(B) = {, {1}, {3}, {6}, {1,3}, {1,6}, {3,6}, {1,3,6}} Let n be the number of elements in A, called the cardinality of A Then, the cardinality of P(A) is 2n

10 Cartesian product An ordered n-tuple (x1, x2, … xn) is an ordered sequence of n elements, not necessarily from the same set The Cartesian product of sets A and B, written A x B is the set of all ordered 2-tuples of the form (a, b), a  A, b  B Thus, (x, y) points are elements of the Cartesian product R x R (sometimes written R2)

11 Subset Relations

12 Basic subset relations
Inclusion of Intersection: For all sets A and B A  B  A A  B  B Inclusion in Union: A  A  B B  A  B Transitive Property of Subsets: If A  B and B  C, then A  C

13 Element argument The basic way to prove that X is a subset of Y
Suppose that x is a particular but arbitrarily chosen element of X Show that x is an element of Y If every element in X must be in Y, by definition, X is a subset of Y

14 Procedural versions We want to leverage the techniques we've already used in logic and proofs The following definitions help with this goal: x  X  Y  x  X  x  Y x  X  Y  x  X  x  Y x  X – Y  x  X  x  Y x  Xc  x  X (x, y)  X  Y  x  X  y  Y

15 Example proof Theorem: For all sets A and B, A  B  A Proof:
Let x be some element in A  B x  A  x  B x  A Thus, all elements in A  B are in A A  B  A QED Premise Definition of intersection Specialization By generalization Definition of subset

16 Laying down the law (again)
Name Law Dual Commutative A  B = B  A A  B = B  A Associative (A  B)  C = A  (B  C) (A  B)  C = A  (B  C) Distributive A  (B  C) = (A  B)  (A  C) A  (B  C) = (A  B)  (A  C) Identity A   = A A  U = A Complement A  Ac = U A  Ac =  Double Complement (Ac)c = A Idempotent A  A = A A  A = A Universal Bound A  U = U A   =  De Morgan’s (A  B)c = Ac  Bc (A  B)c = Ac  Bc Absorption A  (A  B) = A A  (A  B) = A Complements of U and  Uc =  c = U Set Difference A – B = A  Bc

17 Proving set equivalence
To prove that X = Y Prove that X  Y and Prove that Y  X

18 Example proof of equivalence
Theorem: For all sets A,B, and C, A  (B  C) = (A  B)  (A  C) Proof: Let x be some element in A  (B  C) x  A  x  (B  C) Case 1: Let x  A x  A  x  B x  A  B x  A  x  C x  A  C x  A  B  x  A  C x  (A  B)  (A  C) Case 2: Let x  B  C x  B  x  C x  B x  A  x  B x  A  B x  C x  A  x  C x  A  C x  A  B  x  A  C x  (A  B)  (A  C) In all possible cases, x  (A  B)  (A  C), thus A  (B  C)  (A  B)  (A  C)

19 Proof of equivalence continued
Let x be some element in (A  B)  (A  C) x  (A  B)  x  (A  C) Case 1: Let x  A x  A  x  B  C x  A  (B  C) Case 2: Let x  A x  A  B x  A  x  B x  B x  A  C x  A  x  C x  C x  B  x  C x  B  C x  A  x  B  C x  A  (B  C) In all possible cases, x  A  (B  C), thus (A  B)  (A  C)  A  (B  C) Since both A  (B  C)  (A  B)  (A  C) and (A  B)  (A  C)  A  (B  C), A  (B  C) = (A  B)  (A  C) QED

20 Proof example Prove that, for any set A, A   = 
Hint: Use a proof by contradiction

21 Disproofs and Algebraic Proofs

22 Disproving a set property
Like any disproof for a universal statement, you must find a counterexample to disprove a set property For set properties, the counterexample must be a specific examples of sets for each set in the claim

23 Counterexample example
Claim: For all sets A, B, and C, (A – B)  (B – C) = A – C Find a counterexample

24 Algebraic set identities
We can use the laws of set identities given before to prove a statement of set theory Be extremely careful (even more careful than with propositional logic) to use the law exactly as stated

25 Algebraic set identity example
Theorem: A – (A  B) = A – B Proof: A – (A  B) = A  (A  B) c = A  (Ac  B c) = (A  Ac)  (A  B c) =   (A  B c) = A  B c = A – B QED

26 Prove or disprove For all sets A, B, and C, if A  B and B  C, then A  C

27 Prove or disprove For all sets A and B, ((Ac  Bc) – A)c = A

28 Upcoming

29 Next time… Russell's paradox Halting program Functions
Composition of functions Cardinality

30 Reminders Homework 5 is due Friday Read Chapter 7


Download ppt "Week 7 - Monday CS322."

Similar presentations


Ads by Google