## Partial Orders

# Basics

A _partial order_ on a set $X$ is a binary relation $<=$ which is
    ***) reflexive ($x=y => x<=y$)
    ** transitive (if $x<=y$ and $y<=z$ then $x<=z$)
    ** antisymmetric (if $x<=y$ and $y<=x$ then $x=y$).
    *e)*

A set $X$ equipped with a partial order $<=$, denoted $(X;<=)$, is called a
_partially ordered set_ or a _poset_.

"$x>=y$" means "$y<=x$".
"$x<y$" means "$x<=y$ and $x!=y$".

Examples:
    **(i) The usual order $<=$ on the integers.
    ** The relation of divisibility is a partial order on the natural numbers;
	$(\|N;|)$ is the corresponding poset.
    ** If $A$ is a set, the set of subsets of $A$ is partially ordered by
	inclusion, $(=$.
    *ee*

Hasse diagrams:
    $x$ _covers_ $y$ if $x > y$ and there is no $z$ such that $x > z > y$.

    The _Hasse diagram_ of a finite poset $(X,<=)$ consists of points for the
    elements of $X$ and a line drawn upwards from $y$ to $x$ whenever $x$
    covers $y$.

    (We will see below that every finite poset has a Hasse diagram.)

$x$ is _minimal_ if $x>y$ for no $y$.
$x$ is _maximal_ if $x<y$ for no $y$.

Lemma:
    $<$ is transitive: if $x<y$ and $y<z$ then $x<z$.
Proof:
    $x<=z$ by transitivity of $<=$.
    Suppose $x=z$.
    Then $y <= x$ and $x <= y$, so $x=y$ by antisymmetry, contradicting $x<y$.
    So $x!=z$. \qed

Lemma:
    Any finite poset has at least one minimal element, and at least one
    maximal element.
Proof:
    Suppose $(X;<=)$ has no minimal element.
    Then there exist arbitrarily long chains $x_1 > x_2 > x_3 > ... > x_n$.
    By transitivity of $>$, the $x_i$ are distinct, so we contradict
    finiteness. \qed

A partial order $<=$ on a set $X$ is _total_ (aka _linear_) if
    for all $x$ and $y$ in $X$, either $x<=y$ or $y<=x$.

Lemma:
    Any finite total order $(X;<=)$ can be enumerated as $X=\{x_1,...,x_n\}$
    with $x_i <= x_j$ iff $i <= j$.

    (i.e. $(X;<=)$ is isomorphic to $\{1,...,n\}$ with the usual order.)
Proof:
    If $x$ is minimal in a total order, then $x<=y$ for any $y$.

    Let $x_1$ be minimal in $X$, then let $x_2$ be minimal in $X \\ \{x_1\}$,
    and so on.

    Then $x_i <= x_j$ for $i <= j$.
    By antisymmetry, $x_i </= x_j$ for $i </= j$. \qed

Lemma:
    Any finite poset $(X;<=)$ can be linearised,
    i.e. there exists a total order $<='$ such that $x<=y => x<='y$.
Proof:
    Let $x_1,...,x_n$ be the minimal elements of $(X;<=)$.
    Let $X' := X \\ \{x_1,...,x_n\}$.
    By induction, $(X';<=)$ can be linearised, say to $<='$.
    Extend $<='$ to $X$ by defining
	***) $x_i <=' x_j$ iff $i <= j$
	** $x_i <=' y$ for any $y (- X'$
	*e)*
    This is total. \qed

Consequence:
    Any finite poset has a Hasse diagram:
	draw the points with heights ordered according to a linearisation of
	the partial order,
	then draw a line whenever $x$ covers $y$, which implies that $x$ is
	above $y$.
	(Nudge the points horizontally if there are any overlapping lines). 

# Chains and antichains

Definition:
    Let $(X;<=)$ be a poset.

    ${} != C (= X$ is a _chain_ if $(C;<=)$ is a total order.

    ${} != A (= X$ is an _antichain_ if $a_1 <= a_2 => a_1 = a_2$
    for $a_i (- A$.
    
    A _chain partition_ is a partition $X = C_1 \cup ... \cup C_n$ by disjoint
    chains. 

    An _antichain partition_ is a partition $X = A_1 \cup ... \cup A_n$ by
    disjoint antichains. 

Theorem:
    In a finite poset $(X;<=)$,
    **(i) The maximal size of a chain is equal to the minimal size of an
	antichain partition.
    ** {[}Dilworth's theorem{]}
	The maximal size of an antichain is equal to the minimal size of a
	chain partition.
    *ee*
Proof:
    First observe that a chain and an antichain can have no more than 1 point
    in common,
    :	$| C \cap A | <= 1$.

    So given an antichain partition and a chain,
    each element of the chain is in precisely one of the antichains,
    and no two elements of the chain are in the same antichain,
    so
    :	size of any chain $<=$ size of any antichain partition
    so
    :	maximal size of a chain $<=$ minimal size of an antichain partition.

    Similarly for (ii): given a chain partition, each element of an antichain
    is in exactly one of the chains in the partition,
    and no two elements of the antichain are in the same chain, so
    :	maximal size of an antichain $<=$ minimal size of a chain partition.

    So it remains to see
    **(i) There exists an antichain partition of size the maximal size of a chain;
    ** There exists a chain partition of size the maximal size of an antichain.
    *ee*

    These require separate arguments.

    **(i) Let $C$ be a chain of maximal length.
	Say $C = \{c_1,...,c_n\}$ with $c_i <= c_j$ iff $i <= j$.

	For $i=1,...,n$, recursively define
	:   $A_i :=$ the set of minimal elements of $X \\ (A_1 \cup ... \cup A_{i-1})$.

	Then $A_i$ is an antichain,
	and $c_i (- A_i$ so no $A_i$ is empty.

	If $x (- X \\ \cup_i A_i$ then $x >= c_i$ for all $i$,
	so we could extend $C$ to a larger chain by adjoining $x$,
	contradicting maximality of $C$.
	So $X = \cup_i A_i$.
	
	So the $A_i$ form an antichain partition of size $n=|C|$ as required.

    ** By induction on the size of $X$.

	First, suppose some antichain $A$ of maximal size $m$
	is not the set of maximal elements and
	is not the set of minimal elements.

	Let
	:   $A^+ := \bigcup_{a\in A} \{x | x >= a\}$
	:   $A^- := \bigcup_{a\in A} \{x | x <= a\}$.
	
	Then $A^+ \cup A^- = X$ by maximality of $A$,
	and $A^+ \cap A^- = A$.

	Now $A$ is a maximal-size antichain in $A^+$,
	and $A^+ != X$ since $A$ is not the set of maximal elements,
	so by induction, $A^+$ has a chain partition of size $|A|$.

	Similarly, we have a chain partition of $A^-$. 

	For each element $a \in A$, $a$ is in one of the chains of $A^+$ and one
	of the chains of $A^-$, and the union of these two chains is a chain
	$C_a$ in $X$.

	Then $\{ C_a | a \in A\}$ is a chain partition of $X$ of size $m=|A|$.

	For the remaining case,
	suppose every maximal-size antichain is either
	the set of maximal elements or
	the set of minimal elements.

	Let $x$ be minimal and $y$ be maximal, with $x<=y$.

	(To see that such that such $x$ and $y$ exist:
	we proved above that maximal and minimal elements always exist,
	so we only need to see that some minimal element is comparable with
	(and hence $<=$) some maximal element.
	Otherwise, the minimal elements and the maximal elements
	together form an antichain,
	which contradicts our assumption unless the set of minimal elements is
	equal to the set of maximal elements,
	in which case we can take $x=y$.)

	Then $X \\ \{x,y\}$ has no antichains of size $m$ but has an antichain
	of size $m-1$,
	so by induction it has a chain partition of size $m-1$.
	Adjoining the chain $\{x,y\}$, we obtain a chain partition of $X$ of size $m$.
    *ee*
    \qed

# Bonus: Sperner's Theorem

\newcommand{\flrhn}{\lfloor\frac{n}{2}\rfloor}
Example:
    Inductively define "symmetric" chain partitions $S_n$ of the set of subsets of
    $\{1,...,n\}$:

	Let $S_1$ be the partition with only one chain,
	:   ${} (/= \{1\}$.

	Given a chain partition $S_n$ of $\{1,...,n\}$,
	let $S_{n+1}$ have, for each chain $A_1 (/= ... (/= A_k$ of $S_n$,
	***) the chain $A_1 (/= ... (/= A_k (/= A_k \cup \{n+1\}$,
	**   and, if $k>1$, the chain $A_1\cup\{n+1\} (/= ... (/= A_{k-1} \cup \{n+1\}$.
	*e)*

    Each chain $A_1 (/= ... (/= A_k$ in $S_n$
    has subsequent elements differing in size by one,
    and $|A_1| + |A_k| = n$.

    Hence each chain contains a subset of size $\flrhn$,
    so $|S_n| = {n \choose \flrhn}$.

    ($\flrhn = n/2$ "rounded down")

    So by Dilworth, we obtain "Sperner's Theorem":
    The set of subsets of $\{1,...,n\}$ of size $\flrhn$ is a maximal-size
    antichain.
