Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
76
Добавлен:
20.03.2016
Размер:
629.47 Кб
Скачать

Now assume Rm Rn = Rm+n for arbitrary n: Recall (Exercise 12 in Section 3.3 ) that composition of relations is associative.

Rm Rn+1 = Rm (Rn R)

=(Rm Rn) R

=(Rm+n) R ( by ind. hyp. )

=R(m+n)+1

=Rm+n+1

19.(b) Let (x; y); (y; z) 2 R+: Let m1 be an integer such that (x; y) 2 Rm1 : Let m2 be an integer such that (y; z) 2 Rm2 : Then (x; z) 2 Rm1+m2 R+:

19. (c) R S by hypothesis. Let

T = fn 2 N : Rn S and n 1g

(Base step) 1 2 T since R S by hypothesis.

(Inductive step) Now suppose Rn S where n 1 and show n + 1 2 T : Let (x; y) 2 Rn+1: Since Rn+1 = R Rn; there is a z 2 X such that (x; z) 2 Rn and (z; y) 2 R: By inductive hypothesis, (x; z); (z; y) 2 S: Since S is transitive, (x; y) 2 S: Therefore Rn+1 S for each n 1:

3.7 Exercises

1. Identify the equivalence classes of N for the following relations

(a) (mod 4)

(b) (mod 6) 1. (a)

(mod 4)

=

f4k : k 2 Zg

 

[

f4k + 1 : k 2 Zg

 

[

f4k + 2 : k 2 Zg

1. (b)

[

f4k + 3 : k 2 Zg

 

 

(mod 6)

=

f6k : k 2 Zg

 

[

f6k + 1 : k 2 Zg

 

[

f6k + 2 : k 2 Zg

 

[

f6k + 3 : k 2 Zg

 

[

f6k + 4 : k 2 Zg

 

[

f6k + 5 : k 2 Zg

3.Find the elements in the relation \have the same remainder when divided by 8" if the relation is de ned on f1; 2; 3 : : : ; 24; 25g: Also, nd the distinct equivalence classes of this equivalence relation.

3. For the partition shown here: f1; 9; 17; 25g [ f2; 10; 18g [ f3; 11; 19g [

f4; 12; 20g f5; 13; 21g [ f6; 14; 22g [ f7; 15; 23g [ f8; 16; 24g of f 1, 2, . . . , 24, 25g the elements of the relation are just x R y if and only if x and y are in the same element of the partition.

5.De ne a binary relation R on R as f(x; y) 2 R R : x and y are both positive, both negative, or both 0g. Prove that R is an equivalence relation. What are its equivalence classes?

5. (re exive) x is either positive, negative, or zero, so it is equivalent to itself.

(symmetric) Let x y: Either x and y are both positive or both negative or both equal to zero. In any case it is clear that y x:

(transitive) Let x y and y z: There are three cases to consider. If x = y = 0, then z = 0 and x z: If x > 0 and y > 0; then y z implies that z > 0: In this case x z: Similar argument to the last case for x y and x < 0:

The equivalence classes are: fx : x < 0g [ f0g [ fx : x > 0g

7.Let A = fa; b; c; dg: For each of the following partitions of A list all the pairs of elements that form the corresponding equivalence relations.

(a)ffa, b, cg, fdgg

(b)ffag, fbg, fcg, fdgg

(c)ffa, b, c, dgg

7. (a) f(a, b), (a, c), (b, c), (b, a), (c, a), (c, b), (a, a), (b, b), (c, c), (d, d)g

7. (b) f(a, a),(b, b), (c, c), (d, d)g

7.(c) f(a, a), (b, b), (c, c), (d, d), (a, b), (b, a), (a, c), (c, a), (a, d), (d, a), (b, c), (c, b), (b, d), (d, b), (c, d), (d, c)g

9.Prove Theorem 1.

9.Property (a) satis es the condition that the elements of a partition be non-empty sets. Property (c) satis es the condition that every element of X is in one of the subsets. Property (b) satis es the condition that no element is in more than one subset of the partition.

11.(a) Draw a Venn diagram showing the equivalence classes over N of (mod 5), (mod 10), and (mod 15). Which of these equivalence relations re ne another one of these equivalence relations?

(b) Let k; m 2 N: We say k is a factor of m if m = j k for some j such that j 2 N and 0 < j m. What is the relationship between whether(mod k) re nes (mod m) and whether k is a factor of m or m is a factor of k? Prove your answer.

11. (a)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

[0]

[1]

[2]

[3]

[4]

 

 

 

 

0

1

2

3

4

 

N5

:

 

5

6

7

8

9

 

 

10

11

12

13

14

 

 

 

 

 

 

 

 

15

16

17

18

19

 

 

 

 

.

.

.

.

.

 

 

 

 

.

.

.

.

.

 

 

 

 

.

.

.

.

.

 

N10 :

N15 :

N15 :

 

[0

[1]

[2]

[3]

[4]

[5]

[6]

 

[7]

[8]

 

[9]

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0

1

2

3

4

5

6

 

7

8

 

9

 

 

10

11

12

13

14

15

16

 

17

18

 

19

 

 

20

21

22

23

24

25

26

 

27

28

 

29

 

 

30

31

32

33

34

35

36

 

37

38

 

39

 

 

.

.

.

.

.

.

.

 

.

.

 

.

 

 

.

.

.

.

.

.

.

 

.

.

 

.

 

 

.

.

.

.

.

.

.

 

.

.

 

.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

[0]

[1]

[2]

[3]

[4]

[5]

[6]

 

[7]

[8]

 

 

 

 

0

1

2

3

4

5

6

 

7

8

 

 

 

 

15

16

17

18

19

20

21

 

22

23

 

 

 

 

30

31

32

33

34

35

36

 

37

38

 

 

 

 

45

46

47

48

49

50

51

 

52

53

 

 

 

 

.

.

.

.

.

.

.

 

.

 

 

 

 

 

.

.

.

.

.

.

.

 

.

 

 

 

 

 

.

.

.

.

.

.

.

 

.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

[9]

[10]

[11]

[12]

[13]

[14]

 

 

 

 

 

 

 

9

10

11

12

 

13

14

 

 

 

 

 

 

 

24

25

26

27

 

28

29

 

 

 

 

 

 

 

39

40

41

42

 

43

44

 

 

 

 

 

 

 

54

55

56

57

 

58

59

 

 

 

 

 

 

 

.

.

.

.

 

.

.

 

 

 

 

 

 

 

.

.

.

.

 

.

.

 

 

 

 

 

 

 

.

.

.

.

 

.

.

 

 

 

 

 

 

[5i] = [10i] [ [10i+5] for i = 0; 1; 2; 3; 4

[5i] = [15i] [ [15i+5] [ [i + 10] for i = 0; 1; 2; 3; 4 Both N10 and N15 re ne N5:

11. (b) (mod k) re nes (mod m) if and only if m is a divisor of k.

Proof: (() Suppose m is a divisor of k | say k = mn. We need to prove that each mod k equivalence class is contained within a single mod m equivalence class.

So suppose x y(mod k); we need to show that x y(mod m). Since x y(mod k), there is an integer r where x y = kr. It follows that x y = mnr. But that says that x y(mod m).

()) Suppose m is not a divisor of k. We need to show that there are two elements of a single equivalence class (mod k) that are not in the same equivalence class (mod m) | i.e., we need to nd 2 numbers, x and y, that are congruent (mod k) but not congruent (mod m).

Consider k and 0. Trivially, k 0(mod k). But if k were congruent to 0, modulo m, k 0 = k would be a multiple of m, contradicting the assumption.

13.Prove Theorem 4.

13. This result follows immediately from the de nitions of union and re nes. More precisely:

()) Let r2 be an R2 equivalence class, and denote by A the union of the R-equivalence classes of all the elements of r2. In notation, A = [x2r2 [x]1: We claim r2 = A.

Let y 2 r2. Then, y 2 [y]1 A, whence r2 A. Now let y 2 A. Then, there is an element x 2 r2 such that y 2 [x]1. By the de nitions of re nes, [x]1 r2, whence y 2 r2. So, A r2.

(() Let x 2 X. Since [x]2 is a union of R1-equivalence classes, there is an R1-equivalence class, call it r1, such that x 2 r1 [x]2. Then, x 2 [x]1 \r1 whence, by Theorem 2(b)[x]1 = r1. So, [x]1 [x]2.

15.For a relation R on a set X, let R denote the re exive and transitive closure of R.

(a)For any relation R on a set X; de ne a relation on X as follows: x y if and only if x R y and y R x: Prove that is an equivalence relation.

(b)Let x1 x2 and y1 y2: Show that x1 R y1 if and only if x2 R y2: 15. (a) (re exive) Follows because R is re exive.

(symmetric) Follows from de nition.

(transitive) Suppose x y and y z: Then, in particular, xR y and yR z: Since R is transitive, xR z. Similarly, zR x; so x y:

15. (b) Suppose x1R y1. We have x2R x1 (because x1 x2), x1R y1 (by hypothesis), and y1R y2 (because y1 y2). Since R is transitively closed, x2R y2. Switching the roles of x and y gives the converse.

3.9 Exercises

1. (a) Draw the diagram to represent the j (divides) partial order on f1, 2, 3, 4, 5, 6g.

(b) List all the maximal, maximum, minimal, and minimum elements. 1. (a)

4

6

 

2

3

5

 

 

 

1

 

1. (b) maximal: 4, 5, 6

 

 

maximum: none

 

 

minimal: 1

 

 

minimum: 1

 

 

3.(a) Draw a diagram to represent the j (divides) partial order on the set f1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11g.

(b) Identify all minimal, minimum, maximal, and maximum elements in the diagram.

3. (a)

8

 

 

 

 

 

 

 

 

 

 

4

6

9

10

 

 

 

3

5

7

11

 

 

2

 

 

 

 

1

3. (b) maximal: 6, 7, 8, 9, 10, 11

maximum: none

minimal: 1

minimum: 1

5.Prove that Examples 5(a) and (b) are partial orderings. 5. 5(a) Re exive for any x, x x and x x = 0 is even.

(transitive) Let (x; y); (y; z) 2 R: y x and z y so z x: Also, if z y is even and y x is even, then z x = (z y) + (y x) is the sum of two even numbers and hence is even.

(antisymmetric) If (x; y) 2 R and (y; x) 2 R, then in particular y x and x y. It follows that x = y by standard laws of inequalities. So, the antisymmetric property holds.

5(b) (re exive) x j x because x 1 = x:

(transitive) Let x j y and y j z. Then, y = tx and z = sy for some integers s and t. It follows that z = (s t) x: Therefore the relation is transitive.

(antisymmetric) Suppose x j y and y j x: Then since y = t x and x = s y, it follows that y = s t y. If y 6= 0, this implies that s t = 1 so s = 1 and t = 1: But then, x = y. If y = 0, then x = sy = s 0 = 0, so again x = y.

7.(a) Explain why the relation \is older than or the same age" is a partial order.

(b) Explain why the relation \is older than" is not a linear order.

7. The only question is whether the relation is antisymmetric. Since (x; y) 2 R with x 6= y means that x is strictly older than y, the relation is clearly antisymmetric. The law of trichotomy is not guaranteed for the set of all people, because tow di erent people can have the same age.

9.For the set of all people, prove that the relation \weighs no more than" is not a partial order.

9. Two di erent people could weigh the same which would violate the trichotomy law. For this set, such a result is quite likely.

11.(a) For x; y 2 N , de ne x jprN y if, for some z 2 N; z 6= 0; z 6= 1, z x = y: We say x is a proper divisor of y: Is jprN a linear ordering on N ?

(b) In the real numbers R, de ne x jprR y if, for some z 2 R; z 6= 0; z 6= 1, z x = y: Is jprR a linear ordering on R ?

11. (a) Suppose x j y and y j x: Then z x = y and t y = x for some z and t that are neither 1 nor 0. It follows that z t y = y or z t = 1: This is impossible in the natural numbers if neither z nor t can be 1. Therefore, jprN is antisymmetric. The relation is not irre exive because (0; 0) 2 j. Thus j is not a strict partial order on N (being transitive is obvious).

11. (b) Since 3 3 = 9 and 13 9 = 3 the relation is not antisymmetric. Clearly the relation is not irre exive. Thus j is a not strict partial order (being transitive is obvious).

13.For the partial orders shown in Figures 3-11, 3-12, 3-14, and 3-15, identify all minimal, minimum, maximum, and maximal elements.

13.

 

 

 

Maximum

Maximal

Minimum

Minimal

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Fig. 11

 

f0, 1, 2g

 

;

 

 

Fig. 12

 

 

f0, 1, 2g

 

f0g

 

 

 

 

f0, 1, 3g

 

f1g

 

 

 

 

f0, 2, 3g

 

f2g

 

 

 

 

f1, 2, 3g

 

f3g

 

Fig. 14

 

fElaine, Maudeg

 

fGeorge, Elizabethg

 

 

Fig. 15

 

0

 

1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

15.Challenge: Find a partial ordering with exactly one minimal element but where that element is not a minimum element.

15. Let X = Z [ fag with a 62Z: De ne the relation R on X by (x; y) 2 R , x; y 2 Z and x < y. a is a minimal element, but not a minimum element. a is the only minimal element.

3.11 Exercises

1.What operations can you apply to the relations in Section 3.10.1 to get the following relations?

(a)Professors and the departments in which they teach courses.

(b)Students and professors from whom they take courses.

(c)Professors and the chairs of the departments in which they teach courses.

(d)Pairs of departments that currently provide courses with the same number. So, having fEnglish, Mathematicsg in the relation would assert that both departments have courses with a number such as 101.

1. (a) Project Department and Professor from TeachingAssignments.

1. (b) Join Registration and TeachingAssignments over Department, Course, and Section. Project the resulting relation on Student and Professor

1. (c) Join DepartmentChair and TeachingAssignments on Department. Project the resulting relation on Professor and Chair

1. (d) Join the tuples of R with the tuples of R provided the Course is equal in both copies of R. Then project on Department from the rst copy of R and the department eld from the second copy of R.

3.Add to the course scheduling database a relation showing which courses are prerequisites for which other courses. Create some sample entries to illustrate the relations.

3.

CoursePrerequisites

Department

Course

Prerequisite

English

103

101

Mathematics

102

101

Computer Science

111

103

 

 

 

 

 

 

5.What simple operation on relations could you add to make it easy to list the number of students in classes taught by Alan Turing? (Note: This problem asks you to design new types of query. Accordingly, it has no right or wrong answers, but some answers will be simpler than others.)

5. The typical answer is to create an aggregate operation. Here, given a relation R, the query returns the number of tuples in R. So, for this query,rst use the relational algebra to construct the list of courses taught by Turing, and use the new operation to count how many tuples there are in that relation.

Exercises 6 through 12 ask questions about the database shown in the three relations Students, Grades, and Catalog.

Students

 

SocSecNo

Name

Major

ClassYear

 

 

 

 

 

 

 

 

 

247617832

Smith, John

Mathematics

2005

 

 

477677251

Brown, Mae

English

2006

 

 

149867253

Cyr, Pete

Mathematics

2005

 

 

316719842

Williams, Sue

English

2004

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Grades

 

SocSecNo

CourseCode

Grade

 

 

316719842

Math211

A

 

 

247617832

Engl103

B

 

 

149867253

Math214

A

 

 

149867253

Engl103

A

 

 

316719842

Math318

B

 

 

316719842

Engl224

A

 

Catalog

 

CourseCode

Department

Credits

 

 

 

 

 

 

 

Math211

Mathematics

4

 

 

Engl103

English

3

 

 

Math214

Mathematics

3

 

 

Math318

Mathematics

4

 

 

Engl224

English

3

 

 

 

 

 

 

7.Find the join of Students and Grades. 7.

StudentsGrades

 

SocSecNo

Name

Major

ClassYear

SocSecNo.

CourseCode

Grade

 

 

316719842

Williams, Sue

ENGL

2004

316719842

MATH211

A

 

 

247617832

Smith, John

MATH

2005

247617832

ENGL103

B

 

 

149867253

Cyr, Pete

MATH

2005

149867261

MATH214

A

 

 

149867253

Cyr, Pete

MATH

2005

149867261

ENGL103

A

 

 

316719842

Williams, Sue

ENGL

2004

316719842

MATH318

B

 

 

316719842

Williams, Sue

ENGL

2004

316719842

ENGL224

A

 

9.Find all students who received an A in a course.

9. Join Students and Grades on SocSecNum. Project student name and eliminate duplicates.

11.Find all second-year students who received an A.

11. Join Students and Grades on SocSecNum. Project Grade, Class Year, and Name. Select Name and Grade if the grade is an A. Project on Name and eliminate duplicates.

3.12 Chapter Review

Starting to Review

1.Let A = f1, 2, 3, 4g. De ne a relation R of A as R = f(1, 3), (4, 2), (2, 4), (2, 3), (3, 1)g. Which of the following properties does this relation not possess?

(a)Re exive

(b)Symmetric

(c)Transitive

(d)All of the above

1. b

3. Let R be a relation on a set S: R is circular if, for x; y; z 2 S, whenever xRy and yRz it follows that zRx: Which of the properties do a re exive and circular relation possess?

(a)Irre exive

(b)Transitive

(c)Antisymmetric

(d)None of the above 3. b

5.Given the following graph of a partial order R on X = f1, 2, 3, 4, 5g, list all the ordered pairs (x; y) such that x R y.

4

3

5

 

2

1

5.(1, 2), (2, 2), (3, 3), (4, 4), (5, 5), (5, 4), (5, 2), (5, 3), (5, 1), (4, 1), (4, 2), (4, 3), (3, 1), (2, 1)

7.Prove that f(1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6), (1, 5), (2, 4), (2, 6), (4, 6), (6, 4), (6, 2), (4, 2), (5, 1)g is an equivalence relation. Find the distinct equivalence classes for this equivalence relation.

7.f1, 5g, f2, 4, 6g, f3g

9.What are the minimal and maximal elements in the following diagram of a partial order?

a

b

c

f

d

e

9. The minimal elements are d and e. The maximal elements are a, b, and f.

Соседние файлы в папке Student Solutions Manual