CmSc 365 Theory of Computation

advertisement
CmSc 365 Theory of Computation
Homework 02 due 01/29 SOLUTIONS
1. Let R1 and R2 be any two relations of equivalence on a set A.
a) Prove that R1  R2 is a relation of equivalence
Reflexivity.
R1 and R2 are reflexive relations. Therefore a  A, (a,a)  R1 and (a,a) R2.
Therefore a  A, (a,a)  R1 R2. Therefore R1 R2 is a reflexive relation
Symmetry
R1 and R2 are symmetrical relations.
Let (a,b)  R1 R2
(a,b)  R1, therefore (b,a)  R1
(a,b)  R2, therefore (b,a)  R2
Therefore (b,a)  R1 R2
Therefore R1 R2 is a symmetric relation
Transitivity
R1 and R2 are transitive relations.
Let (a,b)  R1 R2, (b,c)  R1 R2
(a,b)  R1, (b,c)  R1, therefore (a,c)  R1
(a,b)  R2, (b,c)  R2, therefore (a,c)  R2
Therefore (a,c)  R1 R2, therefore R1 R2 is a transitive relation
Therefore R1 R2 is a relation of equivalence.
b) Prove or disprove: R1  R2 is a relation of equivalence
R1  R2 is not necessarily a relation of equivalence
Let A = {1,2,3}, R1 = {(1,1),(2,2), (3,3), (1,2), (2,1)}
R2 = {(1,1),(2,2), (3,3), (3,2), (2,3)}
R1  R2 = {(1,1),(2,2), (3,3), (1,2), (2,1), (3,2), (2,3)}
This relation is not transitive, because there are two pairs (1,2), (2,3) , but there is no pair
(1,3).
1
2. Prove that if S is any collection of sets, then RS = {(A,B): A, B  S and A  B} is
a partial order
Reflexivity:
Let A S
By definition of subsets, A  A,
Therefore (A,A)  RS
Anti-symmetric:
Let (A,B) RS and A≠ B
By def of Rs, A B.
Since A  B, B  A, therefore (B,A)  RS
Transitivity:
Let (A,B) RS and (B,C) RS
By definition of RS, A B , and B  C
Therefore A  C (by definition of subsets)
Therefore (A,C) RS
3. Show that the set of all finite subsets of N is countable.
Let S be the set of all finite subsets of N. We can define a partition on S by the
number of elements in each subset. The union of these partitions gives S.
In order to show that S is countable, we have to show
a) Each partition is countable
Let
P1 – the partition that contains subsets of length 1
P2 – the partition that contains subsets of length 2,
…..
Pk – the partition that contains subsets of length k
….
Represent each subset in Pk as a binary string. Note that the length of the binary
strings will vary, but since each string is finite, strings can be ordered
lexicographically.
Another way to show that each Pk is countably infinite:
There is a one-to-one function from Pk to the Cartesian product Nk
f({a1, a2, … ak}) = (a1, a2, … ak)
Let Ak = {( a1, a2, … ak) : f({a1, a2, … ak }) = (a1, a2, … ak)}
2
Ak is a subset of Nk
It can be proved easily that Nk is countably infinite, using the
dovetailing technique and induction on k.
Therefore Ak is countably infinite, therefore Pk is countably infinite.
b) The set of all partitions is countable
The partitions can be ordered by the number of elements in the subsets
c) Apply the dovetailing technique to enumerate the elements of S
Let
P1 = {a11, a12, a13, …}
P2 = {a21, a22, a23, …}
…
Pk = {ak1, ak2, ak3, ….}
…
In the first step we visit a11.
In the second step we visit a12 and a21
In the third step we visit a13, a22, a31
…
In the k-th step we visit a1k, a2 k-1, a3 k-2, …, ak1
…
This shows that the set of all finite subsets of N is countable
Note: Instead of applying the dovetailing technique directly to P1, P2, …
We can prove by indiction on k that the union of infinitely many countably
infinite sets is countably infinite (again, the dovetailing technique is used in the
proof).
4. Prove that for any two sets A and B, 2 A  B = 2 A  2 B
Let S is any element of 2 A  B . Therefore S is a subset of A  B
Therefore S is a subset of A and S is a subset of B.
Therefore S  2 A and S  2B .
Therefore S  2 A  2 B
Therefore 2 A  B  2 A  2 B
Let S is any element of 2 A  2 B Therefore S 2 A and S  2B .
Therefore S  A and S  B
Therefore S  A  B and S  2 A  B
3
Therefore 2 A  2 B  2 A  B
Therefore 2 A  B = 2 A  2 B
5. Prove that the difference of an uncountable set and a countable set is uncountable
Let A be an uncountable set, and B be a countable set.
A = (A – B)  (A  B )
We have shown that the subset of any countable set is also countable.
(A  B )  B, therefore A  B is countable.
Let's assume that A – B is countable.
We have shown that the union of two countable sets is countable, therefore A must be
countable. This contradicts the givens in the problem, namely that A is uncountable.
Therefore A – B is uncountable.
6. Let S be any set, and let P be the set of all partitions of S. Let R be the binary
relation on P such that (1, 2)  R iff for every S1  1 there is an S2  2
such that S1 S2; if (1, 2)  R, we say that 1 refines 2.
For example, let S = {1,2,3}, 1= {{1}, {2}, {3}}, 2= {{1,2}, {3}}.
(1, 2)  R, 1 refines 2.
Show that R is a partial order on P.
Reflexivity:
Let   P,
Let S is any element of 
S S, therefore (, ) R
Anti-symmetric
Let (1, 2)  R This means that each set in 1 is a subset of some set in 2.
Let 1  2. We shall show that (2, 1)  R
Let X1  1 and X1  2. (this is possible because the partitions are different)
There is a set X2  2, such that X1  X2 . X2  X1, hence X2 is not a subset of
X1.
Assume now that (2, 1)  R . This means that there must be a set X in 1
such that X2  X. However, since X1  X2, we obtain that X1  X.
This is not possible because 1 is a partition and all its sets are disjoint.
Therefore
(2, 1)  R
4
Transitivity
Let (1, 2)  R and Let (2, 3)  R
Let S is a set in 1. There exists a set X in 2 such that S  X.
Also, there exists a set Y in 3 such that X  Y.
By the definition of subsets we have S  Y
Thus, for any set S in 1 there is a set Y in 3 so that S  Y
Therefore (1, 3)  R, i.e. the relation is transitive.
Therefore R is a partial order.
(Problem 6 is worth 20 pts, each of the other problems is worth 16 pts)
5
Download