



























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
This lecture was delivered by Sharman Munjha Jadeja at Birla Institute of Technology and Science for Formal Specification Methods in Software Development course. It includes: Relations, Introduction, Homogeneous, Heterogeneous, Binary, Cartesian, Product, Definition
Typology: Slides
1 / 35
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: X๏ชX | ๏ 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: X๏ชX | (๏ 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.