3.2 The cd \(\to \) ab expansion
\(\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\):
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\).
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.
\(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\).