Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (1.81 MB, 220 trang )
5. Sets, Subsets, and Predicates
69
14) { b ∈ B | 2b ∈ A } =
15) { a ∈ A | a2 ∈ B } =
16) { a ∈ A | a2 < 0 } =
NOTATION 5.29. When talking about sets or using predicates, we usually assume that a
“universe of discourse” U has been agreed on. This means that all the elements of all of the
sets under discussion are assumed to be members of U . Then
{ x | P (x) }
can be used as an abbreviation for { x ∈ U | P (x) }.
The universe of discourse is sometimes assumed to be understood from the context, but it
is an important concept, and it is best to specify it so that there is no room for confusion. For
example, if we say “Everyone is happy,” who is included in this everyone? We usually do not
mean everyone now alive on the Earth. We certainly do not mean everyone who was ever alive
or who will ever live. We mean something more modest: perhaps we mean everyone in the
building, or everyone in the class, or maybe we mean everyone in the room.
Specifying a universe of discourse eliminates this ambiguity. The U is the set of things that
we are talking about. So if we want to talk about people in Lethbridge, we define U to be the
set of all people in Lethbridge. We write this at the beginning of our symbolization key, like
this:
U : the set of all people in Lethbridge
Everything that follows ranges over the universe of discourse. Given this U , “everyone” means
“everyone in Lethbridge” and “someone” means “someone in Lethbridge.”
Each constant names some member of U , so, if U is the set of people in Lethbridge, then
constants Donald, Gregor, and Marybeth can only be used if these three people are all in
Lethbridge. If we want to talk about people in places besides Lethbridge, then we need to
specify a different universe of discourse.
EXAMPLE 5.30. If
U is the set of all Canadian provinces, then
{ x | the English name of x has three syllables }
= {Alberta, New Brunswick, Newfoundland}.
Remark 5.31. There is a very close relationship between sets and unary predicates. In general:
• From any unary predicate P (x), we can define the set
{x | P (x)}.
• Conversely, from any set A, we can define a unary predicate P (x) to be “x is a member
of A.”
Because of this, sets are more-or-less interchangeable with unary predicates. For example, the
predicate “x is a dog” can be symbolized in two quite different ways:
• Our symbolization key could state that D(x) means “x is a dog.”
• Alternatively, our symbolization key could let D be the set of all dogs. Then “x is a
dog” would be translated as “x ∈ D.”
In most of mathematics and computer science we make use of sets, rather than unary predicates.
We will see that this makes it simpler to translate statements from English into First-Order
Logic when quantifiers are involved.
70
5. Sets, Subsets, and Predicates
SUMMARY:
• Important definitions:
◦ set
◦ element, member
◦ ordered pair
◦ subset, proper subset
◦ predicate
• A set is unordered and without repetition.
• ∅ and A are subsets of A.
• A = B if and only if we have both A ⊂ B and B ⊂ A.
• For our purposes, predicates usually have only one or two variables.
• If a predicate has two variables, the order of the variables is important.
• Notation:
◦{
}
◦ ∈, ∈
/
◦ ∅ (empty set)
◦ A ⊂ B, A ⊂ B, A ⊃ B
/
◦ #A
◦ P (x), x Q y
(predicates)
◦ { a ∈ A | P (a) }
◦ U (universe of discourse)
◦ (x, y) (ordered pair)
◦ N, N+ , Z, Q, R
Chapter 6
Operations on Sets
While I am interested both in economics and in philosophy, the union of my
interests in the two fields far exceeds their intersection.
Amartya Sen (b. 1933), Nobel prize-winning economist
Autobiography on nobelprize.org
There are several important ways that a new set can be made from sets that you already have.
Any method of doing this is called a set operation.
6A. Union and intersection
Two of the most basic operations are union and intersection. Let us first discuss them in
informal terms. Suppose:
• Alice and Bob are going to have a party, and need to decide who should be invited,
• Alice made a list of all the people that she would like to invite, and
• Bob made a list of all the people that he would like to invite.
Here are two of the many possible decisions they could make.
1) One solution would be to invite everyone that is on either of the lists. That is, they
could begin their invitation list by writing down all of the names on Alice’s list, and
then add all of the names from Bob’s list (or, more precisely, the names from Bob’s
list that are not already included in Alice’s list). This is the union of the lists.
2) A much more conservative solution would be to invite only the people that appear on
both of the lists. That is, they could go through Alice’s list, and cross off everyone
that does not appear on Bob’s list. (They would get the same result by going through
Bob’s list, and crossing off everyone that does not appear on Alice’s list.) This is the
intersection of the lists.
DEFINITION 6.1. Suppose A and B are sets.
1) The union of A and B is the set
A ∪ B = { x | x ∈ A or x ∈ B }.
2) The intersection of A and B is the set
A ∩ B = { x | x ∈ A and x ∈ B }.
Remark 6.2. By drawing the sets A and B as overlapping circles, the union and intersection
can be represented as follows:
71
72
6. Operations on Sets
A
B
A
A ∪ B is shaded
B
A ∩ B is shaded
Pictures like these are called Venn diagrams.
Remark 6.3.
1) In ordinary English, the word “intersection” refers to where two things meet. For
example, the intersection of two streets is where the two streets come together. We
can think of this area as being part of both streets, so this is consistent with the way
the term is used in mathematics.
2) In ordinary English, the word “union” refers to joining things together. For example,
a marriage is the union of two people — it joins the two people into a single married
couple. This is consistent with the way the term is used in mathematics — we could
form the union of Alice’s list and Bob’s list by gluing Bob’s list to the end of Alice’s
list.
EXAMPLE 6.4.
1) {1, 3, 5, 7, 9} ∪ {1, 4, 7, 10} = {1, 3, 4, 5, 7, 9, 10}
2) {1, 3, 5, 7, 9} ∩ {1, 4, 7, 10} = {1, 7}
EXERCISES 6.5. Specify each set by listing its elements.
1) {1, 2, 3, 4} ∪ {3, 4, 5, 6, 7} =
2) {1, 2, 3, 4} ∩ {3, 4, 5, 6, 7} =
3) {p, r, o, n, g} ∩ {h, o, r, n, s} =
4) {p, r, o, n, g} ∪ {h, o, r, n, s} =
5) {1, 3, 5} ∪ {2, 3, 4} ∩ {2, 4, 6} =
6) {1, 3, 5} ∩ {2, 3, 4} ∪ {2, 4, 6} =
Remark 6.6.
1) It is not difficult to see that ∪ and ∩ are commutative. That is, for all sets A and B,
we have
A∪B =B∪A
and
A ∩ B = B ∩ A.
2) It is not difficult to see that ∪ and ∩ are associative. That is, for all sets A, B, and C,
we have
(A ∪ B) ∪ C = A ∪ (B ∪ C)
and
(A ∩ B) ∩ C = A ∩ (B ∩ C).
So there is no need for parenthesis when writing A ∪ B ∪ C or A ∩ B ∩ C.
EXAMPLE 6.7. A Venn diagram can include more than two sets. For example, here are Venn
diagrams of A ∩ B ∩ C and A ∩ (B ∪ C).
6. Operations on Sets
A
B
73
A
C
B
A ∩ B ∩ C is shaded
C
A ∩ (B ∪ C) is shaded
EXERCISE 6.8. Draw Venn diagrams of the indicated sets.
1) A ∪ B ∪ C
2) A ∪ (B ∩ C)
3) (A ∪ B) ∩ C
4) (A ∩ C) ∪ (B ∩ C)
6B. Set difference and complement
The “set difference” is another fundamental operation. (The “complement” is an important
special case.)
EXAMPLE 6.9. If there is a list of people that Alice would like to invite to the party, and also
a list of people that Bob refuses to allow to come to the party (the “veto list”), then it would
be reasonable to invite the people that are on Alice’s list, but not on the veto list. That is,
they could start with Alice’s list, and remove all of the names that are on the veto list. This is
the [ set!difference]set difference of Alice’s list and the veto list.
DEFINITION 6.10. Suppose A and B are sets.
1) The set difference of A and B is the set
A
B = { x ∈ A | x ∈ B } = { x | (x ∈ A) & (x ∈ B) }.
/
/
(Some authors denote this A−B, but that can cause confusion with the usual arithmetic
operation of subtraction.)
2) The complement of B is the set
B=U
B = { x | x ∈ B },
/
where U is the universal set, as usual. (As an alternative, the complement is sometimes
denoted B c , instead of B.)
Remark 6.11. Here are Venn diagrams.
B
A
A
B is shaded
A
A is shaded
B
B
A
B
A
A is shaded
B
B is shaded
74
6. Operations on Sets
EXAMPLE 6.12. Suppose U = PEOPLE is the set of all people.
1) CHILDREN = ADULTS, because adults are the people who are not children.
2) FEMALES
CHILDREN is the set of all adult women.
EXERCISES 6.13. Assume U = {1, 2, 3, . . . , 10}.
Specify each set by listing its elements.
1) {1, 3, 5, 7, 9} {4, 5, 6, 7} =
2) {4, 5, 6, 7}
{1, 3, 5, 7, 9} =
3) {1, 3, 5, 7, 9} =
4) {4, 5, 6, 7} =
EXERCISE 6.14. Draw a Venn diagram of each set.
1) A ∪ B
2) A ∩ B
3) (A
4) A
B)
(B
5) (A ∪ B)
(A
C)
C)
C
6C. Cartesian product
The Cartesian product is another important set operation. Before introducing it, let us recall
the notation for an ordered pair.
NOTATION 6.15. For any objects x and y, mathematicians use (x, y) to denote the ordered
pair whose first coordinate is x and whose second coordinate is y. We have
(x1 , y1 ) = (x2 , y2 ) iff x1 = x2 and y1 = y2 .
EXAMPLE 6.16. A special case of the Cartesian product is familiar to all algebra students:
recall that
(6.17)
R2 = { (x, y) | x ∈ R, y ∈ R }
is the set of all ordered pairs of real numbers. This is the “coordinate plane” (or “xy-plane”)
that is used for graphing functions.
The only functions considered in elementary algebra are from R to R, but this course
considers functions from any set A to any set B. Therefore, it is important to generalize the
above example by replacing the two symbols R in the right-hand side of eq. (6.17) with arbitrary
sets A and B:
DEFINITION 6.18. For any sets A and B, we let
A × B = { (a, b) | a ∈ A, b ∈ B }.
This notation means, for all x, that
x ∈ A × B iff ∃a ∈ A, ∃b ∈ B, x = (a, b).
The set A × B is called the Cartesian product of A and B.