# Independent checks of the defining integral for T565

Run `sage -python checks.py` beside `generate.py`. The checking functions use
exact rational arithmetic and angular Fourier moments. They call no Gamma
function and no arithmetic helper from the generator. The comparison harness
imports the generator only after defining the independent computations.

Known controls run first: a 2 by 2 determinant with value -1; 4 by 4
Pfaffians with values 28 and -6, the latter requiring a pivot interchange;
the scalar integrals Z(1,1,0)=1 and Z(1,1,1)=4/pi; the mean chord integral
Z(1,2,0)=4/pi; Z(1,3,0)=6/pi; Z(2,2,0)=2 and Z(4,2,0)=6.
Arguments here and in code are (beta,n,k).

## beta=2

The Fourier moments of |1+z|^(2k) are binomial(2k,k+j), with moments outside
that range zero. Expanding the Vandermonde and integrating, or applying
Andréief's identity, gives

    Z(2,n,k) = n! det[binomial(2k,k+i-j)] for i,j=0,...,n-1.

This computes all 50 unitary rows, using rational Gaussian elimination.
Andréief's formula is stated and proved in Forrester,
https://arxiv.org/html/1806.10411, (1.7) and section 2.2.

## beta=4

Write z=exp(i theta), and use the confluent Vandermonde with paired columns
z^i and i*z^(i-1), for i=0,...,2n-1. Its determinant is the fourth power of
the ordinary Vandermonde. On the circle, divide each paired column contribution
by z^(2n-2) to obtain the absolute fourth power. Pairing the column permutations
and integrating gives

    Z(4,n,k) = n! Pf[(j-i) binomial(4k,2k+i+j-(2n-1))].

The Fourier moments are coefficients of (1+z)^(2k)(1+z^(-1))^(2k).
The Pfaffian expansion follows directly by grouping the determinant's paired
columns. Skew Gaussian elimination evaluates the 2n by 2n rational matrix.
This checks all 50 symplectic rows.

## beta=1

On ordered angles theta_1<...<theta_n, the determinant of
exp(i*(j-(n-1)/2)*theta_l), j=0,...,n-1, is
`i^(n(n-1)/2)` times the absolute Vandermonde. Since cos(theta/2)>=0 on the
integration interval, incorporate the charge by multiplying each column by

    (2*cos(theta/2))^k = sum_{t=0}^k binomial(k,t)*exp(i*(k/2-t)*theta).

Thus row j has frequencies a=j-(n-1)/2+k/2-t. All frequencies in a given
matrix lie on the same integer or half-integer lattice. Define

    K(a,b) = integral integral sign(y-x)*exp(i*a*x+i*b*y) dx dy,

with both integrals over [-pi,pi]. Direct elementary integration yields
K(a,b)=i*pi*R(a,b), where

    R(a,-a) = -4/a                         if a != 0,
    R(0,b)  = -4*(-1)^b/b                  for nonzero integer b,
    R(a,0)  =  4*(-1)^a/a                  for nonzero integer a,
    R(a,b)  =  0                           otherwise.

This follows by integrating exp(i*b*y) from x to pi and antisymmetrizing.
The common real terms cancel for half-integer frequencies. The zero-frequency
cases are obtained by integrating pi-x, rather than dividing by zero.

de Bruijn's ordered-integral identity gives the Pfaffian of these skew moments.
For odd n, border it with B(a)=integral exp(i*a*x) dx. For integer a this is
2*pi if a=0 and zero otherwise. For half-integer a it is 2*sin(pi*a)/a.
The identity and its odd-dimensional extension are described in Forrester,
https://arxiv.org/html/1806.10411, section 3.1, equation (3.1).

The code strips i*pi from each pair moment and, for odd n with even k, pi
from the border. With m=floor(n/2) and d=1 for odd n and even k, and d=0
otherwise, the result is

    n!/2^n * Pf(R with border) * pi^(m+d-n)

multiplied by (-1)^m when n is odd. The phase is 1 when n is even.
The factor n! restores the labelled Cartesian domain from the ordered chamber.
This checks all 50 orthogonal rows exactly as rational multiples of pi powers.

## Identities and intervals

All 150 rational-coefficient/pi-power pairs agree with the Gamma-product
reduction. The k=1 rotational-invariance relation Z(beta,n,1)=Z(beta,n+1,0)
is checked at every selected n and beta, including n=10 via an independent
n=11 uncharged evaluation. Every beta=2 row agrees with the Barnes G quotient,
using G(m)=product_{j=1}^{m-2} j! at positive integer m, and every beta=2,k=1
row equals (n+1)!.

The generator computes irrational rows in 429-bit real balls; the minimum
retained relative accuracy measured was 424 bits. Each printed decimal is
interpreted as its center plus or minus one last-place unit, with exact
rational endpoints. Independent 640-bit balls made from the Fourier-matrix
answers lie strictly inside all 47 printed intervals; each checking ball is
finite and has at least 620 relative bits. Exact rows are compared as rationals.
The stored-readback mode applies the same containment check to every database
row and runs the package's full verify().

The run's instruction hashes are in the attached skill-manifest.json and the
archive `agents/runs/20261027T233828Z-build-skills/manifest.json`.
