CmSc 365 Theory of Computation Homework 01 SOLUTION 1. Problem 1.1.3 (a), p.9: Prove the equality A (B C) = (A B) ( A C) (a) Prove A (B C) = (A B) (A C) 1. We shall show that A (B C) (A B) (A C) Let x A (B C) Two cases are to be considered: a. x A By def of union and (1) we have: x A B By def of union and (1) we have: x A C From (2) and (3) => x (A B) (A C) b. x (B C) (1) (2) (3) (4) (5) By def of intersection and (5) => x B By def of union and (6) => x A B By def of intersection and (5) => x C By def of union and (8) => x A C From (7) and (9) => x (A B) (A C) (6) (7) (8) (9) (10) From (4) and (10): A (B C) (A B) (A C) (11) 2. We shall show that (A B) (A C) A (B C) Let x (A B) (A C) (12) By def of intersection we have x (A B) x (A C) (13) (14) Let x A By def of union and (15) => x A (B C) Consider now the case when x A Then from (13) x B From (14) x C (15) (16) (17) (18) 1 From (18) and (17) x B C From (19) and def of union x A (B C) (19) (20) From (20) (A B) (A C) A (B C) (21) From (21) and (11) we have (A B) (A C) = A (B C) 2. Problem 1.2.2, p.13: Let R = {(a,b),(a,c),(c,d),(a,a),(b,a)}. What is R R, the composition of R with itself? What is R-1, the inverse of R? Is R, R R, or R-1 a function? R is not a function R R = {(a,a),(a,d),(a,b),(a,c),(b,b),(b,c),(b,a)} R-1 = {(b,a),(c,a),(d,c),(a,a),(a,b)} not a function not a function In all relations there is an element that has two images in the relation, and therefore they are not functions. 3. Problem 1.3.6, p.19. Let R A x A be a binary relation as defined below. In which cases R is a partial order? A total order? Prove your answers by examining the properties of the relations a. A = the positive integers; (a,b) R iff b is divisible by a Week partial order: reflexive, anti-symmetrical, transitive a. reflexivity: Let a is any positive integer. a is divisible by a (property of positive integers) therefore (a,a) R b. anti-symmetrical Let (a,b) R and a b a is divisible by b, therefore b is not divisible by a, therefore (b,a) R c. transitive Let (a,b) R and (b,c) R. a is divisible by b, and b is divisible by c. Therefore a is divisible by c (property of positive integers) Therefore (a,c) R 2 Therefore R is partial order. It is not a total order, because there are elements of A that are not in the relation R, e.g. (3,7) and (7,3) are not in R b. A = N; (a,b) R iff b = a or b = a+1 Not a partial order because it is not transitive. Let (a,b) R and (b,c) R, and let b = a+1, and c = b+1 Consider (a,c): c = b + 1 = a + 2, therefore (a,c) R c. A is the set of all English words; (a,b) R iff a is the same as b or occurs more frequently than b in our textbook. Partial order Reflexive: (a,a) R by the definition of R Anti-symmetric: Let (a,b) R, and a b. Therefore a occurs more frequently than b, therefore b does not occur more frequently than a, therefore (b,a) is not in the relation. Transitivity: Let (a,b) R and (b,c) R A occurs more frequently than b, and b occurs more frequently than c, therefore a occurs more frequently than c, therefore (a,c) R Not a total order, because different words that occur with same frequency cannot be ordered. 4. Problem 1.3.8 (a), p.20 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 3 Transitivity: Let (A,B) RS and (B,C) RS A B , and B C Therefore A C (by definition of subsets) Therefore (A,C) RS 5. Prove that the set of all finite strings of the letter a is countable. Hint: show how the elements can be ordered, i.e. find a bijection that maps elements to N Let w be a finite string consisting of the letter “a”. Consider the function F(w) = k, where k is the number of the letters in the string. This function is a bijection to the set N, therefore the set of all finite strings of the letter “a” is countable. 4