Informally, a PartialOrder on a set is a way of saying that some things are "bigger than" others, without committing to every pair of items being comparable. For example, given some sets we might say that A is clearly "bigger than" B if A entirely contains B, but that doesn't then say anything about disjoint sets, regardless of their size.
See OrderingDateRanges for a place where knowledge of PartialOrders would be useful.
This material does appear on WikiPedia (http://en.wikipedia.org/wiki/Partial_order) and MathWorld (http://mathworld.wolfram.com/PartialOrder.html), but it is here specifically because so much nonsense was being written about date ranges that it seemed worth having this notion flagged up for reference. Once here, it may as well be precise and specific. This sort of basic, fundamental math is of real use in the programming I do, and from other discussions on this wiki seems sadly lacking. A few pages might well be worth it.
The remainder of this page must be ReadLikeMath ...
Abstractly, a strict partial order is a collection of objects, X, with a relationship R (thought of as "<", "strictly less than") that has the following properties:
Note that these together imply
Note also that not every pair of elements need be related.
Examples:
Examples can be given concerning types and subtypes, but the exact usage varies between authors. Such examples have been omitted to avoid being side-tracked by such issues.
Some formulations of partial orders use the equivalent idea of "<=" rather than "<", but that requires three axioms, not just the two. Such a partial order is called a weak (reflexive) partial order, and is what is usually mean by the term "Partial Order" when used without qualification.
PartialOrders turn up all over the place in computing, and recognising them for what they are can save huge amounts of time and effort.
Say we run a program with three threads, one prints ABCDE, one prints ZYXWV and one prints MNOPQ. Then it's correct for that program to print AZBCMNOYXDPQWEV or ZABCMNOYXDPQWEV, but a bug if it prints BAZCMNOYXDPQWEV. The correct output of the program is defined by a partial order (and a particularly easy one at that, since it is defined by 3 disjoint total orders). -- JohnFarrell
Given a finite set S with a PartialOrder, the PartialOrder can be embedded in a TotalOrder. Call the PartialOrder R as above. Then you can construct a TotalOrder (S, <) such that aRb implies a
For the subsets of {a,b,c,d,e,f} two (of the potentially many) total orders are:
Empty set < {a] < {b} < {c} < ... < {f} < {a,b} < {a, c} < ... < {e, f} < {a, b, c} < ... < {d, e, f} < ...
and
Empty < {a} < {b} < {a, b} < {c} < {a, c} < {b, c} < {a, b, c} < ...
Think binary.
The usual and efficient algorithm is called the TopologicalSort. Look up Section 2.2.3 of TheArtOfComputerProgramming. Hey, everybody has to resort to Knuth sometime. Or try man 1 tsort on any UN*X system.
See LatticeStructure