Order-ideal board representation (source code)

= Order-ideal board representation
{title2=$B=\{(x,y):0\leq y<h(x)\}$}

A downward-closed subset of a finite product grid can be represented by nonincreasing column heights. Occupancy is $0\leq y<h(x)$; the condition $h(0)\geq\cdots\geq h(N-1)$ is exactly closure toward smaller coordinates. Removing the northeast rectangle anchored at a legal $(x,y)$ truncates each height to its right to $\min(h(i),y)$, preserving closure. This represents a potentially quadratic number of occupied cells using a linear number of boundary values.