Вы находитесь на странице: 1из 9

Relations

Dr. Khair Eddin Sabri

Relations

Dr. Khair Eddin Sabri

Department of Computer Science, University of Jordan

Dr. Khair Eddin Sabri Relations
Dr. Khair Eddin Sabri
Relations

(Introduction)

Relations

Dr. Khair Eddin Sabri

Let A and B be sets. A binary relation from A to B is a subset of A × B.

Relations are a generalization of functions.

A relation on the set A is a relation from A to A.

Example, Let A be the set {1, 2, 3, 4}. Which ordered pairs are in the relation R = {(a, b)|a divides b}?

Dr. Khair Eddin Sabri Relations
Dr. Khair Eddin Sabri
Relations

(Properties of relations)

Reflexive: A relation R on a set A is called reflexive if (a, a) R for every element a A.

Relations

Dr. Khair Eddin Sabri

Symmetric: A relation R on a set A is called symmetric if (b, a) R whenever (a, b) R, for all a, b A.

Antisymmetric: A relation R on a set A such that for all a, b A, if (a, b) R and (b, a) R, then a = b is called antisymmetric.

Transitive: A relation R on a set A is called transitive if whenever (a, b) R and (b, c) R, then (a, c) R, for all a, b, c A.

Dr. Khair Eddin Sabri Relations
Dr. Khair Eddin Sabri
Relations

(Operations on relations)

Identity relation

Complement of a relation

R 1

R 1 R 2

Dr. Khair Eddin Sabri Relations
Dr. Khair Eddin Sabri
Relations

Relations

Dr. Khair Eddin Sabri

(Operations on relations)

R

R

1 R 2

1 R 2

R

1 R 2

n , note a relation is transitive if R n R for

R

n = 1, 2, 3 ···

Dr. Khair Eddin Sabri Relations
Dr. Khair Eddin Sabri
Relations

Relations

Dr. Khair Eddin Sabri

(n-ary relations)

Let A 1 , A 2 , · · · , An be sets. An n-ary relation on these

sets

is a subset of A 1 × A 2 × ··· × A n .

Relations

Dr. Khair Eddin Sabri

The sets A 1 , A 2 , ··· , A n are called the domains of the relation

n is called its degree

Dr. Khair Eddin Sabri Relations
Dr. Khair Eddin Sabri
Relations

(Representation of relations)

Zero-one matrix

Directed graph

Dr. Khair Eddin Sabri Relations
Dr. Khair Eddin Sabri
Relations

Relations

Dr. Khair Eddin Sabri

(Closure of a relation)

Reflexive closure

Symmetric closure

Transitive closure

Dr. Khair Eddin Sabri Relations
Dr. Khair Eddin Sabri
Relations

Relations

Dr. Khair Eddin Sabri

(Equivalence Relations)

Relations

Dr. Khair Eddin Sabri

A

relation on a set A is called equivalence relation if it

is

reflexive, symmetric, and transitive.

Example: Let R be the relation on the set of integers such that a R b if and only if a = b or a = b.

Dr. Khair Eddin Sabri Relations
Dr. Khair Eddin Sabri
Relations