Permutation descents, Eulerian numbers, and the cd-index
A Rocq / MathComp formalization of Stanley EC1 §1.4 + §1.6

3.2 The cd \(\to \) ab expansion

Definition 3.5 Bit-string expansion of cd-monomials

\(\texttt{expand\_ cde}\, m \in \mathrm{seq}\, (\mathrm{seq}\, \mathrm{bool})\) substitutes \(\mathtt{c} \mapsto a + b\), \(\mathtt{d} \mapsto ab + ba\), \(\mathtt{e} \mapsto 1\) in the cd-monomial \(m\):

\begin{align*} \texttt{expand\_ cde}\, [\, ] & = [\, [\, ]\, ]\\ \texttt{expand\_ cde}\, (\mathtt{C} :: \mathit{rest}) & = [\, \mathtt{false} :: t : t \in \texttt{expand\_ cde}\, \mathit{rest}\, ]\\ & \quad +\! \! +\; [\, \mathtt{true} :: t : t \in \texttt{expand\_ cde}\, \mathit{rest}\, ]\\ \texttt{expand\_ cde}\, (\mathtt{D} :: \mathit{rest}) & = [\, \mathtt{false}::\mathtt{true}::t : t \in \texttt{expand\_ cde}\, \mathit{rest}\, ]\\ & \quad +\! \! +\; [\, \mathtt{true}::\mathtt{false}::t : t \in \texttt{expand\_ cde}\, \mathit{rest}\, ]\\ \texttt{expand\_ cde}\, (\mathtt{E} :: \mathit{rest}) & = \texttt{expand\_ cde}\, \mathit{rest}. \end{align*}

Each element of the result is a bit-string representing a descent pattern; the total length is \(2^{c} \cdot 2^{d}\) where \(c, d\) are the C- and D-counts of \(m\).

Definition 3.6 Sequence-level descent test

For a sequence \(w\) and \(k \in \mathbb {N}\), \(\texttt{is\_ descent\_ seq}(w, k) = (w_{k+1} {\lt} w_k)\) — the sequence-level analogue of the permutation-level 1.1.

Definition 3.7 Characteristic monomial

\(u_{w} \; =\; [\, \texttt{is\_ descent\_ seq}(w, k) : k \in \{ 0, \dots , |w| - 2\} \, ]\) is the bit-vector of descent positions.

For a permutation \(\sigma \), this matches Stanley’s \(u_{S} = e_1 e_2 \cdots e_{n-1}\) (eq. 1.60, p. 58) with \(e_i = a\) if \(i \notin S\) and \(e_i = b\) if \(i \in S\). Our representation uses \(\mathtt{false} \mapsto a\) and \(\mathtt{true} \mapsto b\).