% Appendix B. Computations: what is computed, by which method, with which certificate, and where it is used. \section{Computations}\label{app:computations} This appendix lists the computations of the paper. Each is reproducible from the scripts in the folder \code{compute/} of the deposit, in exact arithmetic unless it is marked as numerical. Python scripts use Python~3 with \code{sympy} and \code{numpy}; the PARI/GP scripts use PARI/GP~2.17.4 \cite{PARI2025}. The scripts are run from the folder \code{compute/}, in which they find each other and the data. \subsection{The periodic Temperley--Lieb Gram matrix}\label{ss:app-tl} \emph{Script} \code{python/tl\_gram.py}. The periodic semi-meanders with $d$ nodes and $d/2$ arcs are enumerated as the lists $(a_1,\dots,a_d)$ of \cref{ex:meanders4}; the loops of $D(a,b)$ are traced by alternately following the arcs of $a$ and of $b$, and a loop is non-contractible exactly when its total displacement is nonzero. The enumeration gives $2,6,20,70,252$ semi-meanders for $d=2,4,6,8,10$, and the Gram matrix $G(T)$ of \eqref{eq:gram}. \emph{Used in} \cref{ex:d4,tab:num-det,tab:num-min,tab:num-off,sec:d6}. \subsection{The spin-chain identity}\label{ss:app-spin} \emph{Script} \code{python/spin\_exact.py}. For every pair $(a,b)$ of semi-meanders with $d\le14$ nodes, the inner product $\langle v_a(z),v_b(z)\rangle$ of \cref{def:spin-vector} is computed as a Laurent polynomial in $z$ with integer coefficients, with $\bar z=z^{-1}$, and compared with $(-1)^{d/2}(-2)^{m_0(a,b)}(z+z^{-1})^{m_T(a,b)}$. All pairs agree; for $d=14$ there are $3432$ semi-meanders and $3432^2$ pairs. \emph{Certificate}: the Lean kernel certificates \code{SpinCert.spin\_gram\_g4} and \code{spin\_gram\_g6} (\cref{app:formal}) for $d=4,6$. The script \code{python/spin\_d4\_worked.py} prints the six vectors of \cref{tab:se-d4} and checks the identity for $d=4$ symbolically without any change of sign. \emph{Used in} \cref{thm:spin,ss:spin-verify,sec:spin-examples}. \subsection{Determinants and inertia}\label{ss:app-det} \begin{itemize}[leftmargin=2em] \item \emph{The determinant of the link vectors} (\cref{prop:se-det}): the matrix $V(z)$ of the link vectors in the basis of words of the weight-zero space, for $d=4,6$, and its determinant as a rational function of $z$, by fraction-free elimination in \code{sympy}; numerically for $d=8,10$ at three values of $z$. \item \emph{The characteristic polynomial for $d=6$} (\cref{ss:spin-certificates}): the characteristic polynomial of $-G(T)$, of size $20$, as a polynomial in $\lambda$ and $T$, and its factorisation over $\Q(T)$; the signs of the coefficients of the factors on $(-2,2)$ and on $\abs T>2$, by exact real root isolation of the coefficients as polynomials in $T$. \item \emph{Inertia off the interval} (\cref{thm:bey}): script \code{python/inertia\_exact.py}. The integer matrices $(-1)^{d/2}G(\pm3)$ for $d\le10$ are reduced by symmetric Gaussian elimination over $\Q$; at every step a nonzero diagonal pivot was available, so no $2\times2$ pivot was needed, and the signs of the pivots give the inertia $(\tfrac12\binom d{d/2},\tfrac12\binom d{d/2})$. The computation for $d=10$, with a matrix of size $252$, takes a few seconds. \item \emph{Rotation orbits for $d=6$} (\cref{sec:d6}): the orbits of the rotation on $\mathcal B_6$ and the multiplicities of the characters, from the enumeration; numerical eigenvalues of $-G(T)$. \end{itemize} \subsection{The unitary family}\label{ss:app-unitary} \begin{itemize}[leftmargin=2em] \item \emph{The Bezout identity} (\cref{prop:u-bezout}): script \code{python/htx\_gram.py}, symbolic in the elementary symmetric functions for $n\le7$. \item \emph{The Gram identity} (\cref{thm:u-gram}) and the hermitian property: numerical, with random parameters on the circle and with random pairs off it, $3\le n\le6$, errors below $10^{-13}$. \emph{Certificate}: Lean for $n=3$ (\code{RamanujanHodge.H3\_eq\_gram}). \item \emph{The moment identity} (\cref{thm:moment}): numerical for $n\le6$, errors below $10^{-10}$. \item \emph{Small ranks} (\cref{sec:unitary-small}): scripts \code{python/htx\_small.py} and \code{python/htx\_small2.py}; the matrices $s_nM$ for $n=2,\dots,5$ symbolically, the exact examples at rational points of the circle, and the margin test with $3000$ random parameter sets for each $2\le n\le7$. \item \emph{The reproducing kernel, the Pontryagin index and Cohn's criterion} (\cref{sec:kernel}): script \code{python/kernel\_check.py}, numerical, $200$ parameter sets for each $2\le n\le7$ and each number of pairs off the circle. \end{itemize} \subsection{The fourfold}\label{ss:app-fourfold} \begin{itemize}[leftmargin=2em] \item \emph{The field} (\cref{lem:B-field,lem:torsion-free}): \code{gp/s5\_field.gp}, output in \code{data/s5-field.txt}. The discriminant $2048$, the class number $1$ and the trivial narrow class group of $F=\Q[y]/(y^4-4y^2+2)$; the sign vectors of $-1$ and of a system of fundamental units, whose sign matrix has rank four over $\F_2$; the decomposition of the primes $2,3,5,7,17,31,47$; the splitting of the primes above $7$ in $F(i)$ and $F(\sqrt{-3})$, each into two primes; and $\zeta_F(-1)=\tfrac56$. \item \emph{The algebra} (\cref{ss:B-algebra}): the script \code{gp/s5\_alg.gp} constructs the quaternion algebra ramified at $\qq_1\mid7$ and $\qq_2\mid2$ and checks its ramification with the function \code{algramifiedplaces} of PARI/GP. \item \emph{The Brandt module} (\cref{prop:brandt}): \code{gp/s5\_brandt\_lib.gp} and \code{gp/s5\_brandt.gp}, method described in the proof of \cref{prop:brandt}. Output in \code{data/s5-brandt.txt}: the class number $5$, the orders of the unit groups, the mass, and the Brandt matrices of $(3)$, $(5)$ and of a prime above $17$ with their totally positive generators. \emph{Certificate}: Eichler's mass formula (\cref{prop:bg-mass}), the row sums $\Nm\mm+1$, the commutation of the matrices, and the Lean certificates \code{S5.T3\_symm}, \code{T3\_diag}, \code{P\_det}, \code{T3\_rowsum}. \item \emph{Eigenspaces and further primes} (\cref{ss:B-more,sec:hecke}): \code{gp/s5\_eig.gp} and \code{gp/s5\_bc.gp}; the Brandt matrices of the four primes above each of $17$, $31$ and $47$, their restrictions to the eigenspaces of $T_3$, and the action of $\Gal(F/\Q)$ on the primes. Output in \code{data/s5-basechange.txt}. \item \emph{Further inert primes} (\cref{prob:inert}): \code{gp/s5\_more.gp} computes the Brandt matrices at the inert primes $11$, $13$, $19$, $29$. The computation did not finish within the time available, and its results are not used. \item \emph{Layer I invariants} (\cref{tab:Bn-layer1,prop:Bn-twin}): \code{python/layer1\_fourfold.py}; pivots of $G(T)$ over $\Q$, discriminants, Hasse invariants at every prime dividing a pivot and at $2$, and the product formula. \item \emph{Eigenvalues and point counts} (\cref{tab:Bn-eigen,prop:Bn-points}): from the closed form of \cref{prop:G4-eigen} and the formula of \cref{prop:Bn-points}, in exact integer arithmetic for the counts. \end{itemize} \subsection{The non-abelian motives}\label{ss:app-C} \emph{Script} \code{python/c2\_signs.py}: the signs of the $\SL_2$-invariant form on $\Sym^2$ of the standard representation on the compact real form and on the split real form, used in the second proof of \cref{prop:C-negative}. \subsection{The fourth datum of the first paper}\label{ss:app-world3} The characteristic polynomials of Frobenius for the fourth rank-seven datum of the first paper at $q=151$ and $q=211$ (\cref{prop:ahm1-world3}) were computed with the exact algorithm of the first paper's companion, from the first three power sums and the functional equation; the data, with the candidate polynomials that fit them, are in \code{data/world3-q151.json} and \code{data/world3-q211.json}. The script \code{python/r0\_spin\_test.py} records two further structural checks on the rank-seven data that the paper does not use. \subsection{What is numerical}\label{ss:app-numerical} The following statements of the paper rest on floating-point computations and are marked as such where they occur: the tables of smallest eigenvalues (\cref{tab:num-min}) and of eigenvalues for the fourfold (\cref{tab:Bn-eigen}), the signatures of \cref{tab:num-off} for $d\ge6$ beyond the exact computation at $T=\pm3$ (which is all that \cref{thm:bey} uses), the numerical checks of the unitary identities for $n\ge4$, of the reproducing kernel and of Cohn's criterion, and the determinant of the link vectors for $d=8,10$. No theorem of the paper depends on a floating-point computation.