



























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




























necessary to describe relationships between objects e.g.
can be described using simple mathematical objects called relations.
Definition: If X and Y are two non-empty sets, then
X Y = {x : X, y : Y • (x, y)}
Example: If X = {a, b}, Y = {0,1} Then
X Y = {(a, 0), (a, 1), (b, 0), (b, 1)}
Definition: A subset of X Y is a relation over X
Y
Example: Compute all relations over X Y
R 1 = , R 2 = {(a, 0)}, R 3 = {(a, 1)} R 4 = {(b, 0)}, R 4 = {(b, 1)}, R 5 = {(a, 0), (b, 0)},...
There will be 2^4 = 16 number of relations docsity.com
Example 7.2 : The relation drives is used to record which makes of car are driven by the members of a small group of people.
Notations:
Drivers == {helen, indra, jim, kate} and cars Cars == {alfa, beetle, cortina, deloreang}
drives Drivers Cars, and the Kate drives cortina = kate cortina drives
Example 7.3 : The relation drives could be defined by
drives : Drivers Cars
drives = {helen beetle, indra alfa, jim beetle, kate cortina}
R = {a 1, b 2, c 1, c 3} dom R = {a, b, c}, ran R = {1, 2, 3} Domain Restriction = A R = {a 1, b 2} Range Restriction = R B = {b 2, c 3}
a
b
c
d
1
2
3
a
b
A 2
3
B
Domain Subtraction = A R = {c 1, c 3, d 2} Range Subtraction = R B = {a 1, c 1} Relational Image = R A = ran (A R) = {1, 2}
a
b
c
d
1
2
3
a
b
A 2
3
B
Domain Subtraction of A from R:
A R = {x: X; y: Y | x y R x A • x y }
Range Subtraction of B from R:
R B = {x: X; y: Y | x y R y B • x y }
Relational Image of A under R:
R A = ran (A R) = {x: X; y: Y | x y R x A • y }
Identity Relation:
id X = {x: X • x x }
Homogeneous Relation : If the source and target of a relation have the same type, then we say that the relation is homogeneous Heterogeneous Relation : If the source and target of a relation are different, then we say that the relation is heterogeneous Example 7.10 :
Identity Relation
id X = {x: X • x x }
Symmetric Relation
Symmetric [X] = ={R: XX | x, y : X • x y R y x R }
Example 7.12 : At a business meeting, we might use a relation to record the fact that one person shook hands with another. This relation will be symmetric, this is because
Definition: A homogeneous relation may be anti-symmetric. In this case, it is impossible for two different elements to be related in both directions.
Anti-symmetric [X] == {R: XX | ( x, y : X •
x y R y x R x = y) }
Example 7.13 : The subset relation is
anti-symmetric. For any two sets s and t, if s
t and t s, then s = t. This fact is often
used to show that two sets are equal.