all paths $\sigma\in{\mathcal{P}}_L$ such that there exist indices $1\le i_1<i_2<\cdots<i_j\le L$ such that $\sigma_{i_1},\sigma_{i_3},\sigma_{i_5},\ldots$ are less than one and $\sigma_{i_2},\sigma_{i_4},\sigma_{i_6},\ldots$ are greater than four. By inclusion-exclusion we have $${\overline{\mathcal{P}}}_L=\Bigl({\mathcal{P}}_L \cup \bigcup_{j\ge 1} (
{\mathcal{P}}_L^{\uparrow,2j} \cup {\mathcal{P}}_L^{\downarrow,2j}) \Bigr) \setminus
\bigcup_{j\ge 1} ({\mathcal{P}}_L^{\uparrow,2j-1} \cup {\mathcal{P}}_L^{\downarrow,2j-1}).$$

Now define the energy function $E$ for $\sigma\in{\mathcal{P}}_L$ as $$E(\sigma)=\sum_{i=1}^{L-1} i\cdot h(\sigma_{i-1},\sigma_i,\sigma_{i+1})$$ where $h$ is the local energy function given by $$h(\sigma_{i-1},\sigma_i,\sigma_{i+1})=
\begin{cases} 1 & \text{if $\sigma_{i-1}=\sigma_i-1=\sigma_{i+1}$ and
 $\sigma_i>3$,}\\
 & \text{or $\sigma_{i-1}=\sigma_i+1=\sigma_{i+1}$ and
 $\sigma_i<2$,}\\
0&\text{else.}
\end{cases}$$ The term $q^{\frac{j}{2}(5j+1)}{\genfrac{[}{]}{0pt}{}{L}{\lfloor \frac{L-5j}{2} \rfloor}}$ in can then be interpreted as the generating function of ${\mathcal{P}}_L^{\downarrow,j}$ given by $\sum_{\sigma\in{\mathcal{P}}_L^{\downarrow,j}}
q^{E(\sigma)}$ if $j>0$ and the generating function of ${\mathcal{P}}_L^{\uparrow,j}$ given by $\sum_{\sigma\in{\mathcal{P}}_L^{\uparrow,j}} q^{E(\sigma)}$ if $j<0$. The term $j=0$ in is the generating function of ${\mathcal{P}}_L$.

In section \[sec:bose\] we will encounter more general inclusion-exclusion arguments in terms of operations on crystals.

Identities
----------

Equations and yield the following polynomial identity $$\sum_{n=0}^\infty q^{n^2} {\genfrac{[}{]}{0pt}{}{L-n}{n}}=
\sum_{j=-\infty}^\infty (-1)^j q^{\frac{j}{2}(5j+1)}
 {\genfrac{[}{]}{0pt}{}{L}{\lfloor \frac{L-5j}{2}\rfloor}}.$$ Using $\lim_{L\to\infty} {{\textstyle\genfrac{[}{]}{0pt}{}{L}{m}}}=\frac{1}{(q)_m}$ this identity implies in the limit $L\to\infty$.

All discussion so far focused on . The second Rogers–Ramanujan identity can in fact be treated in a very similar fashion. Define the set ${\mathcal{D}}'_L$ analogous to ${\mathcal{D}}_L$ with the only difference that now 