Solution (source code)

= Solution

For a <uniform set family> $\mathcal A\subseteq[n]^{(r)}$, the <Local LYM inequality> is
$$
\frac{|\partial\mathcal A|}{\binom n{r-1}}
\geq
\frac{|\mathcal A|}{\binom nr}.
$$
To prove it, count the incident pairs $(B,A)$ with $B\in\partial\mathcal A$, $A\in\mathcal A$, and $B\subset A$. Every $A$ contributes exactly $r$ pairs, whereas every $B$ belongs to at most $n-r+1$ members of $[n]^{(r)}$. Therefore
$$
r|\mathcal A|\leq(n-r+1)|\partial\mathcal A|,
$$
which is the displayed inequality after using the <binomial coefficient> identity $r\binom nr=(n-r+1)\binom n{r-1}$.

The <LYM inequality> says that every <antichain> $\mathcal A\subseteq\mathcal P([n])$ satisfies
$$
\boxed{\displaystyle \sum_{A\in\mathcal A}\binom n{|A|}^{-1}\leq1.}
$$
For the proof from the local inequality, take the lowest occupied level below the middle and replace that level by its <upper shadow>. The result remains an <antichain>: any new containment involving a set in the upper shadow would already give a containment involving the member of $\mathcal A$ immediately below it. The dual form of the <Local LYM inequality> says that this replacement cannot decrease the <Lubell mass>. Repeating upward below the middle, and similarly replacing high levels by their <lower shadows>, eventually puts the whole family in one middle level. Its final Lubell mass is at most one, so the original mass is also at most one.

For the <maximal chain in a Boolean lattice> proof, choose a <Uniformly random maximal chain in a Boolean lattice>. An $h$-element set lies on it with <probability> $1/\binom nh$. Because an <antichain> meets each chain at most once, the <expected value> of the number of its members on the chain is at most one. By <linearity of expectation>, that expected value is precisely the displayed sum.

The <Sperner theorem> follows because $\binom n{|A|}\leq\binom n{\lfloor n/2\rfloor}$ for every $A$. If equality holds in the resulting cardinality bound, every member lies on a largest level. For even $n$ this is the unique middle level. For odd $n$, the two middle levels have equal size; the regular connected inclusion graph between them and equality in <Local LYM inequality> force a chosen portion of the lower level to be either empty or the whole level. Hence the maximum <antichains> are \b[exactly the complete middle level, with either middle level allowed when $n$ is odd].