GridRayCrossingIndex #
Adapted from Wesley Pegden’s Apache-2.0 Trellis formalization of Levine–Pegden–Smart. Changes: pool module paths, public exports, project namespace and current Mathlib compatibility.
Let $q$ be a lattice cell and let $p=[z_0,\ldots,z_{n-1}]$ be a list of lattice vertices. For an ordered pair $(a,b)$ of lattice vertices, set $$ c_q(a,b)= \begin{cases} 1,&b=a+i,\quad \operatorname{Im}(a)=\operatorname{Im}(q), \quad \operatorname{Re}(a)\leq \operatorname{Re}(q),\\ -1,&b=a-i,\quad \operatorname{Im}(b)=\operatorname{Im}(q), \quad \operatorname{Re}(a)\leq \operatorname{Re}(q),\\ 0,&\text{otherwise.} \end{cases} $$ If $p$ is nonempty, close it cyclically by the ordered pair $(z_{n-1},z_0)$ and define the signed grid-ray crossing index by $$ \operatorname{gind}_q(p) =\sum_{0\leq j<n-1}c_q(z_j,z_{j+1})+c_q(z_{n-1},z_0). $$ For the empty list, define $\operatorname{gind}_q(p)=0$. Thus upward unit vertical pairs contribute $1$, downward unit vertical pairs contribute $-1$, and every other consecutive or closing pair contributes $0$. For a nonempty $p$, if every consecutive pair and the closing pair are four-neighbor adjacent (that is, each displacement is one of $\pm1,\pm i$), then this sum is equivalently the signed number of crossings of the leftward horizontal ray starting at the center of $q$.
Equations
- One or more equations did not get rendered due to their size.