ICS-252 Discrete Structure II
Lecture 8
Salah Omer
Assistant Professor Department of Computer Science & Assistant Professor, Department of Computer Science &
Engineering, University of Hail, KSA.
Email: s.hagahmoodi@uoh.edu.sa
ICS‐252 Dr.Salah Omer, Assistant
Professor, CSSE, University of Hail.
Outlines
•
Properties of relations (522-524)
•
Properties of relations (522-524)
•
Closures of relations (544-550)
•
Equivalence relations only (555-557)
•
Partial orderings (566-576)
•
Hasse diagram
Properties of Relations
There are several properties that are used to classify relations on a set.
Reflexive: A relation R on a set A is called Reflexive if (a,a) אR
for every element a אA.
Example:Consider the following relations on A= {1 2 3 4}:
Example:Consider the following relations on A= {1,2,3,4}: R1={(1,1),(1,2),(2,1),(2,2),(3,4),(4,1),(4,4)},
R2={(1,1),(1,2),(2,1)},
R3={(1,1),(1,2),(1,4),(2,1), (2,2),(3,3),(4,1), (4,4)},
R4={(2,1),(3,1),(3,2),(4,1),(4,2),(4,3)},
R5={(1,1),(1,2), (1,3),(1,4), (2,2),(2,3),(2,4),(3,3),(3,4),(4,4)}, R6={(3,4)}
3
ICS‐252 Dr.Salah Omer, Assistant Professor, CSSE, University of Hail.
Properties of Relations
Which of those are reflexive?
Solution: The relations R3 and R5are reflexive because they both contain all pairs of form (a,a), namely, (1,1), (2,2), (3,3),(4,4). The other relations are not reflexive because they do not contain all these ordered pairs.
Symmetric: The relation R on a set A is called symmetric of (b,a) אR whenever (a,b) אR for all a,bאA. 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 anti-symmetric.
Example:Which of the relations form above example are
Example: Which of the relations form above example are symmetric and anti-symmetric?
4
Properties of Relations
Solution:The relations R2 and R3are symmetric, because in each case (b,a) belongs to relation whenever (a,b) does. For R2the only thing to check is that both (2,1) and (1,2) are in the relation. For R3 ,it necessary to check that both (1 2) and (2 1) belong to the relation and (1 4) (4 1) belong (1,2) and (2,1) belong to the relation, and (1,4) ,(4,1) belong to the relation. R1, R4 ,R5and R6are all anti-symmetrical For each of these relations there are no pair of elements a,b with a≠b such that both (a,b) and (b,a) does not belong to relation.
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 whenever (a,b) א R and (b,c) אR then (a,c) אR for all a,b,c
אA.
Example:Which of the relations are transitive in the above example?
5
ICS‐252 Dr.Salah Omer, Assistant Professor, CSSE, University of Hail.
Properties of Relations
Solution: The relations R4 , R5and R6are transitive,
because in each case it can be verify that if (a,b) and (b,c) belongs to relation, then (a,c) also does. For instance R4is transitive because (3,2) and (2,1), (4,2) and (2,1),(4,3) and (3,1), (4,3) and (3,2) are only such set of pairs, and
( , ), ( , ) ( , ) y p ,
Closure of Relations
Closure of relations:Let R be a relation on a set A. R may or may not have some property of P (reflexivity, symmetry, or transitivity). If there is a relation S with property P
containing R such that S is a subset of every relation with property P containing R, then S is called the closure of R with respect to P
with respect to P
Reflexive closure:The relation R={(1,1), (1,2), (2,1), (3,2)} on the set A= {1, 2, 3} is not reflexive. We can make it reflexive by adding (2,2) and (3,3) to R. Because these are the only pairs of the form (a,a) that are not in R. This new relation is called reflexive closure. We can write
where
Symmetric closure:The relation R={(1,1), (1,2), (2,2), (2,3), (3,1), (3,2)} on the set A= {1, 2, 3} is not symmetric. We can make it symmetric by adding (2,1) and (1,3) to R.
7
Because these are the only pairs of the form (b,a) with
that are not in R. This new relation is called symmetric closure of R.
Mathematically we can write;
R b a, )∈
(
Transitive closure:The relation R={(2,1), (3,2), (4,2), (4,3)} on the set A= {1, 2, 3, 4} is not Transitive. We can make it transitive by adding (3,1) and (4,1) to R. This new relation is called transitive closure.
Equivalence Relation
Equivalence relation:A relation on a set A is called an equivalence relation if it is reflexive, symmetric and transitive. Two elements a and b that are related by
equivalence relation are called equivalent. the notation a ~ b is often used to denote that a and b are equivalent elements with respect to a particular equivalence relation elements with respect to a particular equivalence relation.
Example: Congruence Modulo m: Let m be a positive integer with m > 1. Show that the relation
R={(a,a) | a ≡ b (mod m)}
is the equivalence relation on set of integers.
Solution: We know that a ≡ b (mod m) if and only if m divided a - b. Also a – a = 0 is divisible by m, because
0 = 0.m. Hence a ≡ a (mod m), so congruence modulo m is reflexive.
9
ICS‐252 Dr.Salah Omer, Assistant Professor, CSSE, University of Hail.
Equivalence Relation
Now suppose a ≡ b (mod m). Then a - b is divisible by m. So a – b = km, where k is an integer. It follows that
b – a = (-k)m, so b ≡ a (mod m). Hence congruence modulo m is symmetric.
Partial Orderings
Partial Ordering:A relation R on a set S is called a partial ordering or partial order if it is reflexive, anti-symmetric
and transitive. A set S together with a partial ordering R is
called a partially ordered set or poset, and is denoted by (S,R). Members of S are called elements of poset.
Example 1: Show that the “greater than or equal” relation
(≥)is a partial ordering on Z a set of integers.
Solution:Because a ≥ a for every integer a, therefore ≥ is
reflexive. If a ≥ b and b ≥ a, then it means a = b. But a>b, then b can not be > a Hence ≥ is anti-symmetric. Finally, ≥ is transitive because a ≥ b and b ≥ c imply that a ≥ c. It follows that ≥ is a partial ordering on a set of integers and (Z, ≥) is poset.
Example 3:Show that the inclusion relation كis a partial
ordering on the power set of a set S.
Example:Let R be the relation on the set of people such that
xRy if x and y are people and x is older than y. Show that R is not a partial ordering.
Solution:R is anti-symmetric because if a person x is older
than a person y, then y is not older than x. That is if xRy, then y℟x is not possible. The relation R is transitive
because if a person x is older than person y and y is older then person z, then x is older then z. that is , xRy and yRz, then xRz. However, R is not reflexive, because no person is older than himself or herself. That is, x℟x for all people x. it follows that R is not a partial ordering and poset.
12
Partial Orderings
z A symbol is required when we discuss the ordering
relation in an arbitrary posets. The notation a ع b is used to denote (a,b) א R in an arbitrary posets (S,R). This notation is used because ' less than or equal to' on a set of
real numbers is a most familiar example of a partial
ordering and the symbol عis similar to≤symbol.
13
ICS‐252 Dr.Salah Omer, Assistant Professor, CSSE, University of Hail.
Hasse Diagrams
Constructing a Hasse Diagram:To construct the Hasse
diagram complete the following steps;
1) Because a partial ordering is reflexive, a loop is present at every vertex. Remove all loops
2) Remove all edges that must be in the partial ordering because of the presence of other edges and transitivity. For example, if (a,b) and (b,c) are in the partial ordering then remove (a,c), because it must be present also.
3) Finally remove all arrows on the directed edges, because all edges point upward toward their terminal vertex. g p p
Hasse Diagrams
Example: Consider the figure 2 (a) at (page DMA-571). Apply all 3 steps to obtain the Hasse diagram as shown in figure 2 (c).
Greatest element:An element in a poset that is greater than every other
Greatest element:An element in a poset that is greater than every other element is called greatest element. That is a greatest element of the poset (S, ع) if b عa for all b אS. The greatest element is unique when it exist.
Least element:An element in a poset that is less than every other element is called least element. That is a is a least element of the poset (S, ع) if a عb for all b אS. The least element is unique when it exist.
15
ICS‐252 Dr.Salah Omer, Assistant Professor, CSSE, University of Hail.
4 4
4 4
page DMA-571
2 3
2 3
2 3
2 3
ICS‐252 Dr.Salah Omer, Assistant
1 1
1 1
a
d c
Hasse Diagrams
Example:Determine whether the posets represented in each
of the Hasse diagram in figure 6 (page DMA-573) have a greatest element and a least element.
Solution: Solution:
a) The least element of the poset with Hasse diagram is a.
The poset has no greatest element.
b)The poset with Hasse diagram has neither a least or nor greatest element.
)Th i h H di h l l I
c)The poset with Hasse diagram has no least element. Its the greatest element is d.
d)The poset with Hasse diagram has least element a and greatest element d.
17
ICS‐252 Dr.Salah Omer, Assistant Professor, CSSE, University of Hail.
Hasse Diagrams
Upper bound:If U is an element of S such that a عu for all elements a א A, then u is called an Upper bound of A.
Lower bound:If L is an element of S such that L عa for all elements a א A, then L is called an Lower bound of A.
Example 18:Find the lower and upper bounds of the
Example 18:Find the lower and upper bounds of the subsets {a,b,c}, {j,h}, and {a,c,d,f} in the poset with the Hasse diagram shown in figure 7 (at page 574).
Solution:
1) The upper bounds of {a,b,c} are e,f,j, and h and its lower bound is a.
Hasse Diagrams
Least upper bound: x is called the least upper bound of A if a عx whenever a אA, and x عz whenever z is an upper bound of A.
Greatest lower bound: y is called the greatest lower bound of A if y is lower bound of A and z ع y whenever z is lower bound of A.
Example 19:Find the greatest lower bound and the least upper bounds of {b,d,g}, if they exist in the poset shown in figure 7 (at page 574).
Solution:
1) The upper bounds of {b,d,g} are g and h because g < h therefore g is the least upper bound.
2) The lower bounds of {b,d,g} are a and b. Because a<b, therefore b is the greatest lower bound.
19
ICS‐252 Dr.Salah Omer, Assistant Professor, CSSE, University of Hail.
Lattices
Lattices: A poset (partially ordered set) in which every pair of elements has both a least upper bound and a greatest lower bound is called a Lattices. It has many special
properties. It is used in many different applications such as models of information flow; and play an important role in models of information flow; and play an important role in Boolean algebra.
Lattices model of information flow:In many settings the flow of information from one person or computer to another is restricted via security clearances. We can use a lattice model to represent different information flow polices. For example, one common information flow policy is the multilevel security policy used in government and military
t E h i f i f ti i i d t it l systems. Each piece of information is assigned to a security class, and each security class is represented by a pair (A,C) where A is an authority level and C is a category. People and computer programs are then allowed access to information from specific restricted set of security classes.
20
Lattices
Example 21:Determine whether the poset represented by each of the Hasse diagram in figure 8 (at page DMA-575) are lattices.
Solution:
a) i) The upper bounds of {b d e} are e and f a) i) The upper bounds of {b,d,e} are e and f ,
because e < f , therefore e is the least upper bound.
The lower bounds of {b,d,e} are a and b ,
because a < b , therefore b is the greatest lower bound.
ii) The upper bounds of {b,c,e} are e and f , ) { }
because e < f , therefore e is the least upper bound.
The lower bounds of {b,c,e} are a and b ,
because a < b , therefore b is the greatest lower bound.
Hence it is a Lattice. 21
ICS‐252 Dr.Salah Omer, Assistant Professor, CSSE, University of Hail.
Lattices
b) It is not a lattice, because the element b and c have no least upper bound. Note that b and c have d, e, and f upper bounds.
c) i) The upper bounds of {d,g} are g and h ,
because g < h therefore g is the least upper bound because g < h , therefore g is the least upper bound.
The lower bounds of {d,g} are a and d ,
because a < d , therefore d is the greatest lower bound.
ii) The upper bounds of {b,e} are e and h ,
because e < h , therefore e is the least upper bound.
Home Work
Question 1: For each of these relations on the set {1,2,3,4}, decide whether it is reflexive, symmetric, anti-symmetric and transitive.
R1= {(2,2), (2,3), (2,4), (3,2), (3,3), (3,4)}
R2= {(1,1), (1,2), (2,1), (2,2), (3,3), (4,4)}
R3= {(2,4), (4,2)}
R4= {(1,2), (2,3), (3,4)}
R5= {(1,1), (2,2), (3,3), (4,4)}
R6= {(1 3) (1 4) (2 3) (2 4) (3 1) (3 4)} R6= {(1,3), (1,4), (2,3), (2,4), (3,1), (3,4)}
Question 2: Determine whether the relation R on the set of all integers is reflexive, symmetric, anti-symmetric and/or transitive. Where (x,y) אR if and only if
a) x ≠ y b) xy >= 1 c) x ≡ y (mod 7)
23
ICS‐252 Dr.Salah Omer, Assistant Professor, CSSE, University of Hail.
Home Work
Question 3: Let R be the relation on the set {0,1,2,3} containing the ordered pairs (0,1),(1,1),(1,2),(2,0),(2,2), and (3,0). Find the
a) Reflexive closure of R b) Symmetric closure of R
Q ti 4 if A {1 2 3 4} th fi d th t iti l f
Question 4: if A= {1,2,3,4}, then find the transitive closures of the following relations;
R1= {(1,2), (2,1), (2,3), (3,4), (4,1)}
R2= {(2,1), (2,3), (3,1), (3,4), (4,1), (4,3)}
R3= {(1,2), (1,3), (1,4), (2,3), (2,4), (3,4)}
R4= {(1,1), (1,4), (2,1), (2,3), (3,1), (3,2), (3,4), (4,2)}
Question 5: Which of these relations on A= {0,1,2,3} are equivalence relations?
R1={(0,0), (1,1), (2,2), (3,3)}
24
Home Work
R2={(0,0), (0,2), (2,0), (2,2), (2,3), (3,2), (3,3)}
R3={(0,0), (1,1), (1,2), (2,1), (2,2), (3,3)}
R4={(0,0), (1,1), (1,3), (2,2), (2,3), (3,1), (3,2), (3,3)}
R5={(0,0), (0,1), (0,2), (1,0), (1,1), (1,2), (2,0), (2,2), (3,3)}
Question 6: Draw the Hasse diagram representing the partial odering {(a,b)|a divides b} on {1,2,3,4,6,8,12} as shown in figure 3 (a) at page 572.
Question 7: Determine whether the posets with these Hasse diagrams (see at page 580) are lattices
diagrams (see at page 580) are lattices.
25