Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 5, Set Theory 1.

Similar presentations


Presentation on theme: "Chapter 5, Set Theory 1."— Presentation transcript:

1 Chapter 5, Set Theory 1

2 Set definitions Definition of a set:
name of set = {list of elements, or a description of the elements} Examples: A = {1,2,3} or B = {x  Z | 4 < x < 4} or C = {x  Z+ | 4 < x < 4} A set is completely defined by its elements, i.e., {a,b} = {b,a} = {a,b,a} = {a,a,a,b,b,b}

3 Discrete Structures CMSC 250 Lecture 28
April 7, 2008 3

4 More set concepts The universal set (U) is the set consisting of all possible elements in some particular situation under consideration A set can be finite or can be infinite For a set S, n(S) or |S| are used to refer to the cardinality of S, which is the number of elements in S The symbol  means "is an element of" The symbol  means "is not an element of" The symbol  means "vacation on a tropical island", but has nothing to do with sets…

5 Subset A  B  (x  U)[x  A  x  B] A is contained in B
B contains A A  B  (x  U)[x  A  x  B] Relationship between membership and subset: (x  U)[x  A  {x}  A] Definition of set equality: A = B  A  B  B  A

6 Do these represent the same sets or not?
X = {x  Z | (p  Z)[x = 2p]} Y = {y  Z | (q  Z)[y = 2q  2]} A = {x  Z | (i  Z)[x = 2i + 1]} B = {x  Z | (i  Z)[x = 3i + 1]} C = {x  Z | (i  Z)[x = 4i + 1]}

7 Formal definitions of set operations
Union: Intersection: Complement: Difference: Complement only makes sense when you have a well-defined universe of discourse. Ask: what is the complement of the evens? You can get along without that for the other operations.

8 Venn diagrams Sets are represented as regions (usually circles) in the plane in order to graphically illustrate relationships between them. On the board illustrate union, intersection, difference, complement, and subset relationships. Also do a Venn diagram with three sets.

9 The empty set and its properties
The empty set  has no elements, so  = {}. ( sets X)[  X] There is only one empty set. ( sets X)[X   = X] ( sets X)[X  X' = ] ( sets X)[X   = ] U' =  ' = U prove 1 and 2 1 implication of definition of subset always has a false antecedent 2 assume there are two (each is a subset of the other) therefore they must be equal

10 Discrete Structures CMSC 250 Lecture 29
April 9, 2008 10

11 Ordered n-tuples An ordered n-tuple takes order and multiplicity into account The tuple (x1,x2,x3,…,xn) has n values which are not necessarily distinct and which appear in the order listed (x1,x2,x3,…,xn) = (y1,y2,y3,…,yn)  (i 1  i  n)[xi = yi ] 2-tuples are called pairs, and 3-tuples are called triples

12 The Cartesian product The Cartesian product of sets A and B is defined as n(A  B) = n(A)  n(B)

13 Proper subset

14 A and B have no elements in common
Disjoint sets A and B are disjoint A and B have no elements in common (x  U)[x  A  x  B  x  B  x  A] A  B =   A and B are disjoint sets Prove A-B and B-A are disjoint by definitions by cases Prove that if A and B are disjoint n(A) + n(B) = n(A  B)

15 P (A) = the set of all subsets of A
Power set P (A) = the set of all subsets of A Examples- what are P ({a})? P ({a,b,c})? P ()? P ({})? P ({,{}})? Example for powerset A = {0,1} P(A) = {empty set, {0},{1},{0,1}}

16 Properties of sets in Theorem 5.2.1
Inclusion Transitivity Mention the similarity to , , . Prove the inclusion and the transitivity (many of the others are given in the text)

17 Discrete Structures CMSC 250 Lecture 30
April 11, 2008 17

18 Properties of sets in Theorem 5.2.2
DeMorgan’s for complement Distribution of union and intersection There are a number of others as well; see the text or the handout of logical rules and equivalences for the full list Mention the similarity to , , . Prove the inclusion and the transitivity (many of the others are given in the text)

19 Using Venn diagrams to help find counterexamples
Describe Venn diagrams. A region of a Venn diagram is equivalent to a row of a truth table. Same counterexample for both A={1}, B={1,2}, C={1,2}.

20 Deriving new properties using rules and Venn diagrams
Mention blue sheet and rules. apply meaning of difference apply demorgan’s apply distribution of union and intersection apply definition of difference apply def of difference union with empty set intersection with complement distribution DeMorgan’s def of diff

21 Discrete Structures CMSC 250 Lecture 32
April 16, 2008 21

22 Partitions of a set A collection of nonempty sets {A1,A2,…,An} is a partition of the set A if and only if A = A1  A2 … An A1,A2,…,An are mutually disjoint An infinite set can be partitioned. The partitions can be infinite, or can be finite.

23 Proofs about power sets
Prove that ( sets A,B)[A  B  P(A)  P(B)] ( sets A)[n(A) = k  n(P(A)) = 2k ] Ask the students how the second one can be proved? One way is by induction (there are other ways, such as combinatorics, which we haven't discussed yet). Prove that ( sets A,B) [P(A  B) = P(A)  P(B)] As a corollary to this, prove that X is a subset of A intersect B = X is a subset of A and X is a subset of B another example for power set A = empty set, P(A) = {empty set}, P(P(A)) = {empty set, {empty set}}

24 Russell’s paradox A set can be an element or member of itself.
Consider the set S = {A | A is a set and A  A} Is S an element of itself? An example of a set containing itself as a member or element- the set of all topics discussed in this course. Now that I mentioned it, it’s a topic discussed in this course, so it’s an element the set of all topics discussed in this course.

25 The halting problem Is there a computer program (suppose it’s called Halt) which will read as input any program pgm (plus some input for that program), and be able to determine whether pgm will eventually halt or loop infinitely when run on that input? What if we write a program which just runs another program on some input and sees whether it halts, and prints the result? The ‘really smart guy’ problem. Mention the barber problem?

26 Discrete Structures CMSC 250 Lecture 33
April 18, 2008 26

27 Proof for the halting problem
Suppose there is a program Halt(pgm, input) which can determine whether any program pgm will halt when run on the input data input, or loop infinitely. Create a new program Test (which also reads another program as input) as follows: void Test(pgm) { if Halt(pgm, pgm) prints that pgm halts then while (true) ; // infinite loop- never quit else // Halt(pgm, pgm) prints that pgm // loops infinitely on input exit }

28 What if Test is run on itself?
Now run Test(Test): if Test(Test) halts then Halt(Test, Test) will print that Test will halt, in which case Test(Test) loops forever if Test(Test) loops forever then Halt(Test, Test) will print that Test will loop infinitely, in which case Test(Test) quits This is a contradiction, therefore there can be no such program Halt.


Download ppt "Chapter 5, Set Theory 1."

Similar presentations


Ads by Google