Document

advertisement
Relations (3)
Rosen 6th ed., ch. 8
Partial ordering
• A relation R is a partial ordering if it is reflexive,
antisymmetric, and transitive.
• Example
– ‘greater than or equal to’
– ‘is a subset of’
1
1
• Greater than or equal to, on {1,2,3}
2
3
T
T

T
2
F
T
T
3
F
F 
T 
Example (Partial ordering)
• Is subset of
• A ={ a, b, c}
P(A) = { {}, {a}, {b}, {c}, {a,b}, {a,c}, {b,c}, {a,b,c} }
• Partial ordering :
– 부분적으로 순서화, {a,b}와 {b,c} 사이에는 is-subset-of로 순서화 할 수 없다.
{a,b,c}
{a.b}
{a,c}
{b,c}
{a}
{b}
{c}
{}

Example (Partial ordering)
• EXAMPLE 2: The divisibility relation | is a partial
ordering on the set of positive integers, because it is
reflexive, antisymmetric, and transitive.
• EXAMPLE 4: 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: No person is older than himself of herself.
So this R is not reflective.
Comparability
• The elements a and b of a poset (S, ≤) are called
comparable if either a ≤ b or b ≤ a. When a and b
are elements of S such that neither a ≤ b nor b ≤ a
are called incomparable.
• EXAMPLE 5: In the poset (Z+, |), are the integers 3
and 9 comparable? Are 5 and 7 comparable?
Solution: Yes for 3 and 9, No for 5 and 7.
Totally Ordered Relation
• If (S, ≤) is a poset and every two elements of S are
comparable, S is called a totally ordered or
linearly ordered set, and ≤ is called total order or
a linear order. A totally ordered set is also called a
chain.
• EXAMPLE 6: The poset (Z+, ≤) is totally ordered
because a ≤ b or b ≤ a whenever a and b are
integers.
• EXAMPLE 7: The poset (Z+, |) is not totally
ordered because it contains elements that are
incomparable, such as 5 and 7.
Lexicographical order
A  {(a1, a2 ,...,ai ,...)| a1  A1 , a2  A2 ,...,ai  Ai ,...}
a linear orderingRi on each Ai
T hesequence x  ( x1 , x2 ,...,xk ,...) precedesthesequence y  ( y1 , y2 ,..., yk ,...)
in lexicographicalorder if and onlyif
for thesmallest integerk such thatxk  yk , xk Rk yk
Example : 사전의 단어 순서
" relative"precedes" relex"in lexicographicalorder ,
x  (r , e, l , a, t , i, v, e),
y  (r , e, l , e, x)
k  4, xk  a, yk  e, xk  yk
a  e, (a precedese alphabetically)
" discreet"" discreetness"
Hasse Diagrams
• Start with the directed graph of a relation.
– Remove loops.
– Remove all edges that must be in the partial
ordering because of the presence of other
edges and transitivity.
– Remove all the arrows. All edges point “upward”
toward their terminal vertex.
• See Figure 2 of page 571.
Hasse Diagrams
• EXAMPLE 12: Draw the Hasse diagram
representing the partial ordering {(a, b) | a
divides b} on {1, 2, 3, 4, 6, 8, 12}
=> see FIGURE 3 of page 572.
• EXAMPLE 13: Draw the Hasse diagram
representing the partial ordering {(A, B) | A  B}
on the power set P(S) where S = {a, b, c}
=> see FIGURE 4 of page 573.
Maximal and Minimal Elements
• An element of a poset is called maximal if it is not
less than any element of the poset. Similary, an
element of a poset is called minimal if it is not
greater than any element of the poset.
• EXAMPLE 14: Which elements of the poset ({2, 4,
5, 10, 12, 20, 25}, |) are maximal, and which are
minimal?
Solution: 12, 20, and 25 are maximal and 2 and 5
are minimal.
Greatest and Least Elements
• An element of a poset is called greatest element
if it is greater than all the other elements in the
poset. Similary, an element of a poset is called
least element if it is less than all the other
elements in the poset.
• EXAMPLE 17: Is there a greatest element and a
least element in the poset (Z+, |) ?
Solution: The integer 1 is the least element
because 1|n whenever n is a positive integer.
Because there is no integer that is divisible by all
positive integers, there is no greatest element.
Example
• EXAMPLE 15: Determine whether the posets
represented by following Hasse diagrams have
greatest element and a least element.
b
c
d
c
c
a
a
d
d
e
d
b
a
c
b
b
g: a, l: x g: x, l: x g: d, l: x
a
g: d, l: a
Upper Bound and Lower Bound
• If u is an element of a poset (S, ≤) such that a ≤ u
for all elements a  A(A  S), then u is called an
upper bound of A. Likewise, if l is element of a
poset (S, ≤) such that l ≤ a for all elements a  A(A
 S), then l is called an lower bound of A.
• 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.
Example
Solution:
{a, b, c}:
u-b is e, f, j, and h. l-b is a.
{j, h}:
no u-b. l-b is a, b, c, d, e, and f.
{a, c, d, f}:
u-b is f, h, and j. l-b is a.
h
j
g
f
d
e
b
c
a
Fig. 7.
Upper Bound and Lower Bound Cont.
• The element x is called the least upper bound of
the subset A if x is an upper bound that is less
than every other upper bound of A. Similarly, the
element y is called the greatest lower bound of
the subset A if y is a lower bound that is greater
than every other lower bound of A.
• EXAMPLE 19: Find the greatest lower bound and
the least upper upper bound of {b, d, g}, if they
exist, in the poset shown in Fig. 7.
Solution: g and b.
Lattices
• A partially ordered set in which every pair of
elements has both a least upper bound and a
greatest lower bound is called a lattice.
• EXAMPLE 22: Is the poset (Z+, |) a lattice?
Solution: a와 b를 두 정수라 하자. 이 두 정수의
최소공배수와 최대공약수가 각각 최소상한계
와 최대하한계이므로, 이 poset은 격자이다.
Example
• EXAMPLE 21: 아래 하세 도표들로 표현되는 부분 순서
집합들이 격자(lattice)인지 판별하시오.
f
f
e
e
e
b
c
b
f
g
d
c
b
a
(a)
d
h
(b)
a
c
d
(c) a
– (a), (c)는 격자, (b)는 b와 c가 최소상한계를 가지지
않으므로 격자가 아니다. d, e, f가 이들의 상한계이
지만, 이들 중 어느 것도 나머지 둘 보다 모두 작지는
않다. (Information flow에 활용)
– Study EXAMPLE 23.
Topological Sorting
• A total ordering is said to be compatible with the
partial ordering R if a ≤ b whenever aRb.
Constructing a compatible total ordering from a
partial ordering is called topological sorting.
• EXAMPLE 26: Find a compatible total ordering for
the poset ({1, 2, 4, 5, 12, 20}, |).
Solution: 1 < 5 < 2 < 4 < 20 < 12.
• Study EXAMPLE 27.
Algorithm for Topological Sorting
ALGORITHM Topological Sorting
Procedure topological sort((s, ≤): finite poset)
k := 1
while S ≠ Ф
begin
ak := a minimal element of S
S := S – {ak}
k := k + 1
end {a1, a2, …, an is a compatible total ordering of S}
Download