34.9 KB · commit a9602da
We often use relations to order some or all of the elements of sets. For instance, we order words using the relation containing pairs of words (x,y), where x comes before y in the dictionary. We schedule projects using the relation consisting of pairs (x,y), where x and y are tasks in a project such that x must be completed before y begins. We order the set of integers using the relation containing the pairs (x,y), where x is less than y. When we add all of the pairs of the form (x,x) to these relations, we obtain a relation that is reflexive, antisymmetric, and transitive. These are properties that characterize relations used to order the elements of sets.
We give examples of posets in Examples 1–3.
Show that the "greater than or equal" relation (≥) is a partial ordering on the set of integers.
Solution: Because a≥a for every integer a, ≥ is reflexive. If a≥b and b≥a, then a=b. Hence, ≥ is antisymmetric. Finally, ≥ is transitive because a≥b and b≥c imply that a≥c. It follows that ≥ is a partial ordering on the set of integers and (Z,≥) is a poset. ◀
The divisibility relation ∣ is a partial ordering on the set of positive integers, because it is reflexive, antisymmetric, and transitive, as was shown in Section 9.1. We see that (Z+,∣) is a poset. Recall that (Z+ denotes the set of positive integers.) ◀
Show that the inclusion relation ⊆ is a partial ordering on the power set of a set S.
Solution: Because A⊆A whenever A is a subset of S, ⊆ is reflexive. It is antisymmetric because A⊆B and B⊆A imply that A=B. Finally, ⊆ is transitive, because A⊆B and B⊆C imply that A⊆C. Hence, ⊆ is a partial ordering on P(S), and (P(S),⊆) is a poset. ◀
Example 4 illustrates a relation that is not a partial ordering.
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: Note that R is antisymmetric because if a person x is older than a person y, then y is not older than x. That is, if xRy, then yRx. The relation R is transitive because if person x is older than person y and y is older than person z, then x is older than z. That is, if xRy and yRz, then xRz. However, R is not reflexive, because no person is older than himself or herself. That is, xRx for all people x. It follows that R is not a partial ordering. ◀
In different posets different symbols such as ≤, ⊆, and ∣, are used for a partial ordering. However, we need a symbol that we can use when we discuss the ordering relation in an arbitrary poset. Customarily, the notation a⪯b is used to denote that (a,b)∈R in an arbitrary poset (S,R). This notation is used because the "less than or equal to" relation on the set of real numbers is the most familiar example of a partial ordering and the symbol ⪯ is similar to the ≤ symbol. (Note that the symbol ⪯ is used to denote the relation in any poset, not just the "less than or equals" relation.) The notation a≺b denotes that a⪯b, but a=b. Also, we say "a is less than b" or "b is greater than a" if a≺b.
When a and b are elements of the poset (S,⪯), it is not necessary that either a⪯b or b⪯a. For instance, in (P(Z),⊆), {1,2} is not related to {1,3}, and vice versa, because neither set is contained within the other. Similarly, in (Z+,∣), 2 is not related to 3 and 3 is not related to 2, because 2∤3 and 3∤2. This leads to Definition 2.
In the poset (Z+,∣), are the integers 3 and 9 comparable? Are 5 and 7 comparable?
Solution: The integers 3 and 9 are comparable, because 3∣9. The integers 5 and 7 are incomparable, because 5∤7 and 7∤5. ◀
The adjective "partial" is used to describe partial orderings because pairs of elements may be incomparable. When every two elements in the set are comparable, the relation is called a total ordering.
The poset (Z,≤) is totally ordered, because a≤b or b≤a whenever a and b are integers. ◀
The poset (Z+,∣) is not totally ordered because it contains elements that are incomparable, such as 5 and 7. ◀
In Chapter 6 we noted that (Z+,≤) is well-ordered, where ≤ is the usual "less than or equal to" relation. We now define well-ordered sets.
The set of ordered pairs of positive integers, Z+×Z+, with (a1,a2)⪯(b1,b2) if a1<b1, or if a1=b1 and a2≤b2 (the lexicographic ordering), is a well-ordered set. The verification of this is left as Exercise 53. The set Z, with the usual ≤ ordering, is not well-ordered because the set of negative integers, which is a subset of Z, has no least element. ◀
At the end of Section 5.3 we showed how to use the principle of well-ordered induction (there called generalized induction) to prove results about a well-ordered set. We now state and prove that this proof technique is valid.
Proof: Suppose it is not the case that P(x) is true for all x∈S. Then there is an element y∈S such that P(y) is false. Consequently, the set A={x∈S∣P(x) is false} is nonempty. Because S is well ordered, A has a least element a. By the choice of a as a least element of A, we know that P(x) is true for all x∈S with x≺a. This implies by the inductive step P(a) is true. This contradiction shows that P(x) must be true for all x∈S. ■
The principle of well-ordered induction is a versatile technique for proving results about well-ordered sets. Even when it is possible to use mathematical induction for the set of positive integers to prove a theorem, it may be simpler to use the principle of well-ordered induction, as we saw in Examples 5 and 6 in Section 6.2, where we proved a result about the well-ordered set (N×N,⪯) where ⪯ is lexicographic ordering on N×N.
The words in a dictionary are listed in alphabetic, or lexicographic, order, which is based on the ordering of the letters in the alphabet. This is a special case of an ordering of strings on a set
constructed from a partial ordering on the set. We will show how this construction works in any poset.
First, we will show how to construct a partial ordering on the Cartesian product of two posets, (A1,⪯1) and (A2,⪯2). The lexicographic ordering ⪯ on A1×A2 is defined by specifying that one pair is less than a second pair if the first entry of the first pair is less than (in A1) the first entry of the second pair, or if the first entries are equal, but the second entry of this pair is less than (in A2) the second entry of the second pair. In other words, (a1,a2) is less than (b1,b2), that is,
(a1,a2)≺(b1,b2),
either if a1≺1b1 or if both a1=b1 and a2≺2b2.
We obtain a partial ordering ⪯ by adding equality to the ordering ≺ on A1×A2. The verification of this is left as an exercise.
Determine whether (3,5)≺(4,8), whether (3,8)≺(4,5), and whether (4,9)≺(4,11) in the poset (Z×Z,⪯), where ⪯ is the lexicographic ordering constructed from the usual ≤ relation on Z.
Solution: Because 3<4, it follows that (3,5)≺(4,8) and that (3,8)≺(4,5). We have (4,9)≺(4,11), because the first entries of (4,9) and (4,11) are the same but 9<11. ◀
In Figure 1 the ordered pairs in Z+×Z+ that are less than (3,4) are highlighted.
A lexicographic ordering can be defined on the Cartesian product of n posets (A1,⪯1),(A2,⪯2),…,(An,⪯n). Define the partial ordering ⪯ on A1×A2×⋯×An by
(a1,a2,…,an)≺(b1,b2,…,bn)
if a1≺1b1, or if there is an integer i>0 such that a1=b1,…,ai=bi, and ai+1≺i+1bi+1.
In other words, one n-tuple is less than a second n-tuple if the entry of the first n-tuple in the first position where the two n-tuples disagree is less than the entry in that position in the second n-tuple.
Figure 1 — The Ordered Pairs Less Than (3,4) in Lexicographic Order.
Note that (1,2,3,5)≺(1,2,4,3), because the entries in the first two positions of these 4-tuples agree, but in the third position the entry in the first 4-tuple, 3, is less than that in the second 4-tuple, 4. (Here the ordering on 4-tuples is the lexicographic ordering that comes from the usual "less than or equals" relation on the set of integers.) ◀
We can now define lexicographic ordering of strings. Consider the strings a1a2…am and b1b2…bn on a partially ordered set S. Suppose these strings are not equal. Let t be the minimum of m and n. The definition of lexicographic ordering is that the string a1a2…am is less than b1b2…bn if and only if
(a1,a2,…,at)≺(b1,b2,…,bt),or
(a1,a2,…,at)=(b1,b2,…,bt)andm<n,
where ≺ in this inequality represents the lexicographic ordering of St. In other words, to determine the ordering of two different strings, the longer string is truncated to the length of the shorter string, namely, to t=min(m,n) terms. Then the t-tuples made up of the first t terms of each string are compared using the lexicographic ordering on St. One string is less than another string if the t-tuple corresponding to the first string is less than the t-tuple of the second string, or if these two t-tuples are the same, but the second string is longer. The verification that this is a partial ordering is left as Exercise 38 for the reader.
Consider the set of strings of lowercase English letters. Using the ordering of letters in the alphabet, a lexicographic ordering on the set of strings can be constructed. A string is less than a second string if the letter in the first string in the first position where the strings differ comes before the letter in the second string in this position, or if the first string and the second string agree in all positions, but the second string has more letters. This ordering is the same as that used in dictionaries. For example,
discreet≺discrete,
because these strings differ first in the seventh position, and e≺t. Also,
discreet≺discreetness,
because the first eight letters agree, but the second string is longer. Furthermore,
discrete≺discretion,
because discrete≺discreti. ◀
Many edges in the directed graph for a finite poset do not have to be shown because they must be present. For instance, consider the directed graph for the partial ordering {(a,b)∣a≤b} on the set {1,2,3,4}, shown in Figure 2(a). Because this relation is a partial ordering, it is reflexive, and its directed graph has loops at all vertices. Consequently, we do not have to show these loops because they must be present; in Figure 2(b) loops are not shown. Because a partial ordering is transitive, we do not have to show those edges that must be present because of transitivity. For example, in Figure 2(c) the edges (1,3),(1,4), and (2,4) are not shown because they must be present. If we assume that all edges are pointed "upward" (as they are drawn in the figure), we do not have to show the directions of the edges; Figure 2(c) does not show directions.
In general, we can represent a finite poset (S,⪯) using this procedure: Start with the directed graph for this relation. Because a partial ordering is reflexive, a loop (a,a) is present at every vertex a. Remove these loops. Next, remove all edges that must be in the partial ordering because of the presence of other edges and transitivity. That is, remove all edges (x,y) for which there is an element z∈S such that x≺z and z≺y. Finally, arrange each edge so that
its initial vertex is below its terminal vertex (as it is drawn on paper). Remove all the arrows on the directed edges, because all edges point "upward" toward their terminal vertex.
Figure 2 — Constructing the Hasse Diagram for ({1,2,3,4},≤).
These steps are well defined, and only a finite number of steps need to be carried out for a finite poset. When all the steps have been taken, the resulting diagram contains sufficient information to find the partial ordering, as we will explain later. The resulting diagram is called the Hasse diagram of (S,⪯), named after the twentieth-century German mathematician Helmut Hasse who made extensive use of them.
Let (S,⪯) be a poset. We say that an element y∈S covers an element x∈S if x≺y and there is no element z∈S such that x≺z≺y. The set of pairs (x,y) such that y covers x is called the covering relation of (S,⪯). From the description of the Hasse diagram of a poset, we see that the edges in the Hasse diagram of (S,⪯) are upwardly pointing edges corresponding to the pairs in the covering relation of (S,⪯). Furthermore, we can recover a poset from its covering relation, because it is the reflexive transitive closure of its covering relation. (Exercise 31 asks for a proof of this fact.) This tells us that we can construct a partial ordering from its Hasse diagram.
Draw the Hasse diagram representing the partial ordering {(a,b)∣a divides b} on {1,2,3,4,6,8,12}.
Solution: Begin with the digraph for this partial order, as shown in Figure 3(a). Remove all loops, as shown in Figure 3(b). Then delete all the edges implied by the transitive property. These are (1,4),(1,6),(1,8),(1,12),(2,8),(2,12), and (3,12). Arrange all edges to point upward, and delete all arrows to obtain the Hasse diagram. The resulting Hasse diagram is shown in Figure 3(c). ◀
Draw the Hasse diagram for the partial ordering {(A,B)∣A⊆B} on the power set P(S) where S={a,b,c}.
Figure 3 — Constructing the Hasse Diagram of ({1,2,3,4,6,8,12},∣).
Solution: The Hasse diagram for this partial ordering is obtained from the associated digraph by deleting all the loops and all the edges that occur from transitivity, namely, (∅,{a,b}),(∅,{a,c}),(∅,{b,c}),(∅,{a,b,c}),({a},{a,b,c}),({b},{a,b,c}), and ({c},{a,b,c}). Finally all edges point upward, and arrows are deleted. The resulting Hasse diagram is illustrated in Figure 4. ◀
Figure 4 — The Hasse Diagram of (P({a,b,c}),⊆).
Elements of posets that have certain extremal properties are important for many applications. An element of a poset is called maximal if it is not less than any element of the poset. That is, a is maximal in the poset (S,⪯) if there is no b∈S such that a≺b. Similarly, an element of a poset is called minimal if it is not greater than any element of the poset. That is, a is minimal if there is no element b∈S such that b≺a. Maximal and minimal elements are easy to spot using a Hasse diagram. They are the "top" and "bottom" elements in the diagram.
Which elements of the poset ({2,4,5,10,12,20,25},∣) are maximal, and which are minimal?
Figure 5 — The Hasse Diagram of a Poset.
Solution: The Hasse diagram in Figure 5 for this poset shows that the maximal elements are 12, 20, and 25, and the minimal elements are 2 and 5. As this example shows, a poset can have more than one maximal element and more than one minimal element. ◀
Sometimes there is an element in a poset that is greater than every other element. Such an element is called the greatest element. That is, a is the greatest element of the poset (S,⪯)
Figure 6 — Hasse Diagrams of Four Posets.
if b⪯a for all b∈S. The greatest element is unique when it exists [see Exercise 40(a)]. Likewise, an element is called the least element if it is less than all the other elements in the poset. That is, a is the least element of (S,⪯) if a⪯b for all b∈S. The least element is unique when it exists [see Exercise 40(b)].
Determine whether the posets represented by each of the Hasse diagrams in Figure 6 have a greatest element and a least element.
Solution: The least element of the poset with Hasse diagram (a) is a. This poset has no greatest element. The poset with Hasse diagram (b) has neither a least nor a greatest element. The poset with Hasse diagram (c) has no least element. Its greatest element is d. The poset with Hasse diagram (d) has least element a and greatest element d. ◀
Let S be a set. Determine whether there is a greatest element and a least element in the poset (P(S),⊆).
Solution: The least element is the empty set, because ∅⊆T for any subset T of S. The set S is the greatest element in this poset, because T⊆S whenever T is a subset of S. ◀
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. ◀
Sometimes it is possible to find an element that is greater than or equal to all the elements in a subset A of a poset (S,⪯). 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. Likewise, there may be an element less than or equal to all the elements in A. If l is an element of S such that l⪯a for all elements a∈A, then l is called a lower bound of A.
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.
Figure 7 — The Hasse Diagram of a Poset.
Solution: The upper bounds of {a,b,c} are e,f,j, and h, and its only lower bound is a. There are no upper bounds of {j,h}, and its lower bounds are a,b,c,d,e, and f. The upper bounds of {a,c,d,f} are f,h, and j, and its lower bound is a. ◀
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. Because there is only one such element, if it exists, it makes sense to call this element the least upper bound [see Exercise 42(a)]. That is, x is the least upper bound of A if a⪯x whenever a∈A, and x⪯z whenever z is an upper bound of A. Similarly, the element y is called the greatest lower bound of A if y is a lower bound of A and z⪯y whenever z is a lower bound of A. The greatest lower bound of A is unique if it exists [see Exercise 42(b)]. The greatest lower bound and least upper bound of a subset A are denoted by glb(A) and lub(A), respectively.
Find the greatest lower bound and the least upper bound of {b,d,g}, if they exist, in the poset shown in Figure 7.
Solution: The upper bounds of {b,d,g} are g and h. Because g≺h, g is the least upper bound. The lower bounds of {b,d,g} are a and b. Because a≺b, b is the greatest lower bound. ◀
Find the greatest lower bound and the least upper bound of the sets {3,9,12} and {1,2,4,5,10}, if they exist, in the poset (Z+,∣).
Solution: An integer is a lower bound of {3,9,12} if 3, 9, and 12 are divisible by this integer. The only such integers are 1 and 3. Because 1∣3, 3 is the greatest lower bound of {3,9,12}. The only lower bound for the set {1,2,4,5,10} with respect to ∣ is the element 1. Hence, 1 is the greatest lower bound for {1,2,4,5,10}.
An integer is an upper bound for {3,9,12} if and only if it is divisible by 3, 9, and 12. The integers with this property are those divisible by the least common multiple of 3, 9, and 12, which is 36. Hence, 36 is the least upper bound of {3,9,12}. A positive integer is an upper bound for the set {1,2,4,5,10} if and only if it is divisible by 1, 2, 4, 5, and 10. The integers with this property are those integers divisible by the least common multiple of these integers, which is 20. Hence, 20 is the least upper bound of {1,2,4,5,10}. ◀
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. Lattices have many special properties. Furthermore, lattices are used in many different applications such as models of information flow and play an important role in Boolean algebra.
Determine whether the posets represented by each of the Hasse diagrams in Figure 8 are lattices.
Figure 8 — Hasse Diagrams of Three Posets.
Solution: The posets represented by the Hasse diagrams in (a) and (c) are both lattices because in each poset every pair of elements has both a least upper bound and a greatest lower bound, as the reader should verify. On the other hand, the poset with the Hasse diagram shown in (b) is not a lattice, because the elements b and c have no least upper bound. To see this, note that each of the elements d,e, and f is an upper bound, but none of these three elements precedes the other two with respect to the ordering of this poset. ◀
Is the poset (Z+,∣) a lattice?
Solution: Let a and b be two positive integers. The least upper bound and greatest lower bound of these two integers are the least common multiple and the greatest common divisor of these integers, respectively, as the reader should verify. It follows that this poset is a lattice. ◀
Determine whether the posets ({1,2,3,4,5},∣) and ({1,2,4,8,16},∣) are lattices.
Solution: Because 2 and 3 have no upper bounds in ({1,2,3,4,5},∣), they certainly do not have a least upper bound. Hence, the first poset is not a lattice.
Every two elements of the second poset have both a least upper bound and a greatest lower bound. The least upper bound of two elements in this poset is the larger of the elements and the greatest lower bound of two elements is the smaller of the elements, as the reader should verify. Hence, this second poset is a lattice. ◀
Determine whether (P(S),⊆) is a lattice where S is a set.
Solution: Let A and B be two subsets of S. The least upper bound and the greatest lower bound of A and B are A∪B and A∩B, respectively, as the reader can show. Hence, (P(S),⊆) is a lattice. ◀
In many settings the flow of information from one person or computer program to another is restricted via security clearances. We can use a lattice model to represent different information flow policies. For example, one common information flow policy is the multilevel security policy used in government and military 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 a specific restricted set of security classes.
The typical authority levels used in the U.S. government are unclassified (0), confidential (1), secret (2), and top secret (3). (Information is said to be classified if it is confidential, secret, or top secret.) Categories used in security classes are the subsets of a set of all compartments relevant to a particular area of interest. Each compartment represents a particular subject area. For example, if the set of compartments is {spies,moles,double agents}, then there are eight different categories, one for each of the eight subsets of the set of compartments, such as {spies,moles}.
We can order security classes by specifying that (A1,C1)⪯(A2,C2) if and only if A1≤A2 and C1⊆C2. Information is permitted to flow from security class (A1,C1) into security class (A2,C2) if and only if (A1,C1)⪯(A2,C2). For example, information is permitted to flow from the security class (secret,{spies,moles}) into the security class (top secret,{spies,moles,double agents}), whereas information is not allowed to flow from the security class (top secret,{spies,moles}) into either of the security classes (secret,{spies,moles,double agents}) or (top secret,{spies}).
We leave it to the reader (see Exercise 48) to show that the set of all security classes with the ordering defined in this example forms a lattice. ◀
Suppose that a project is made up of 20 different tasks. Some tasks can be completed only after others have been finished. How can an order be found for these tasks? To model this problem we set up a partial order on the set of tasks so that a≺b if and only if a and b are tasks where b
cannot be started until a has been completed. To produce a schedule for the project, we need to produce an order for all 20 tasks that is compatible with this partial order. We will show how this can be done.
We begin with a definition. 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.* We will need to use Lemma 1.
Proof: Choose an element a0 of S. If a0 is not minimal, then there is an element a1 with a1≺a0. If a1 is not minimal, there is an element a2 with a2≺a1. Continue this process, so that if an is not minimal, there is an element an+1 with an+1≺an. Because there are only a finite number of elements in the poset, this process must end with a minimal element an. ■
The topological sorting algorithm we will describe works for any finite nonempty poset. To define a total ordering on the poset (A,⪯), first choose a minimal element a1; such an element exists by Lemma 1. Next, note that (A−{a1},⪯) is also a poset, as the reader should verify. (Here by ⪯ we mean the restriction of the original relation ⪯ on A to A−{a1}.) If it is nonempty, choose a minimal element a2 of this poset. Then remove a2 as well, and if there are additional elements left, choose a minimal element a3 in A−{a1,a2}. Continue this process by choosing ak+1 to be a minimal element in A−{a1,a2,…,ak}, as long as elements remain.
Because A is a finite set, this process must terminate. The end product is a sequence of elements a1,a2,…,an. The desired total ordering ⪯t is defined by
a1≺ta2≺t⋯≺tan.
This total ordering is compatible with the original partial ordering. To see this, note that if b≺c in the original partial ordering, c is chosen as the minimal element at a phase of the algorithm where b has already been removed, for otherwise c would not be a minimal element. Pseudocode for this topological sorting algorithm is shown in Algorithm 1.
ALGORITHM 1 Topological Sorting.
procedure topological sort ((S, ≼): finite poset)
k := 1
while S ≠ ∅
ak := a minimal element of S {such an element exists by Lemma 1}
S := S - {ak}
k := k + 1
return a1, a2, ..., an {a1, a2, ..., an is a compatible total ordering of S}
Find a compatible total ordering for the poset ({1,2,4,5,12,20},∣).
* "Topological sorting" is terminology used by computer scientists; mathematicians use the terminology "linearization of a partial ordering" for the same thing. In mathematics, topology is the branch of geometry dealing with properties of geometric figures that hold for all figures that can be transformed into one another by continuous bijections. In computer science, a topology is any arrangement of objects that can be connected with edges.
Figure 9 — A Topological Sort of ({1,2,4,5,12,20},∣).
Solution: The first step is to choose a minimal element. This must be 1, because it is the only minimal element. Next, select a minimal element of ({2,4,5,12,20},∣). There are two minimal elements in this poset, namely, 2 and 5. We select 5. The remaining elements are {2,4,12,20}. The only minimal element at this stage is 2. Next, 4 is chosen because it is the only minimal element of ({4,12,20},∣). Because both 12 and 20 are minimal elements of ({12,20},∣), either can be chosen next. We select 20, which leaves 12 as the last element left. This produces the total ordering
1≺5≺2≺4≺20≺12.
The steps used by this sorting algorithm are displayed in Figure 9. ◀
Topological sorting has an application to the scheduling of projects.
A development project at a computer company requires the completion of seven tasks. Some of these tasks can be started only after other tasks are finished. A partial ordering on tasks is set up by considering task X≺task Y if task Y cannot be started until task X has been completed. The Hasse diagram for the seven tasks, with respect to this partial ordering, is shown in Figure 10. Find an order in which these tasks can be carried out to complete the project.
Figure 10 — The Hasse Diagram for Seven Tasks.
Figure 11 — A Topological Sort of the Tasks.
Solution: An ordering of the seven tasks can be obtained by performing a topological sort. The steps of a sort are illustrated in Figure 11. The result of this sort,
A≺C≺B≺E≺F≺D≺G,
gives one possible order for the tasks. ◀