5905064 f3f0e8c f0945ea bca13cf
==============================================================================
ULTRAFLAT REAL LITTLEWOOD POLYNOMIALS
a self-contained account, rewritten for students
==============================================================================

This is a clearer, corrected rewrite of the paper "Ultraflat real
Littlewood polynomials". Every mathematical statement of the original
proof survives here. Two lemmas are genuinely research-level and are
used as black boxes (exactly as before): a matrix discrepancy lemma
from [OpenAILowerEnvelope2026, Lemma 6.2] and a signed interval
packing lemma from [OpenAILowerEnvelope2026, Lemma 3.1]. Everything
else is proved, with the ideas explained in words.

Reading order: sections 1 and 2 state the question and the one number
that drives everything, sqrt(N). Section 4 gives the whole plan in
plain language. Sections 6, 7, 8 are the three construction steps.
Section 9 puts them together. Section 10 lists what stays open.

Notation is ASCII: e(t) = exp(2 pi i t); sum, prod, int, sqrt, pi;
X_hat(k) = int_0^1 X(t) e(-k t) dt; |z| = modulus; "in" = is an
element of. A torus T^m is a product of m unit circles.


==============================================================================
1. THE PROBLEM
==============================================================================

A real Littlewood polynomial of length N is

    P(z) = eps_0 + eps_1 z + ... + eps_{N-1} z^(N-1),

where each eps_k is +1 or -1. These are the simplest polynomials with
no small coefficients: every coefficient has the same size.

We measure P on the unit circle |z| = 1. Write z = e(t) = exp(2 pi i t)
with t a real number taken modulo 1. Then |P(e(t))| is a genuine
positive function of t, periodic with period 1.

THREE quantifiers matter and it is easy to mix them up:

  (i)  the triangle inequality always gives  P(1) = sum eps_k, which is
       between -N and N and equals N when all signs are +1. So the
       maximum can be as large as N, i.e. sqrt(N) times the natural
       scale. That is as far from flat as possible.

  (ii) the "flatness" question asks whether SOME choice of signs keeps
       |P| near its natural scale everywhere on the circle.

  (iii) the theorem below lets the signs depend on N. It does NOT ask
       for one infinite sequence eps_0, eps_1, ... whose partial sums
       are all flat. In fact that stronger demand is impossible; see
       section 10.

Definition. A family of Littlewood polynomials is ultraflat if
|P(z)| / sqrt(N) tends to 1 uniformly in |z| = 1 as the length N tends
to infinity.

MAIN THEOREM. For every epsilon in (0,1) there is an integer N_0 such
that, for every integer N >= N_0, there are signs eps_0, ..., eps_{N-1}
in {-1, +1} with

    (1 - epsilon) sqrt(N)  <=  | eps_0 + eps_1 z + ... + eps_{N-1} z^(N-1) |
                            <=  (1 + epsilon) sqrt(N)
    for every z with |z| = 1.

In words: for any tolerance you name, and every large enough length,
you can choose the signs so that the modulus on the whole unit circle
lies within that tolerance (relative to sqrt(N)) of being perfectly
constant. The signs are chosen separately at each length.


==============================================================================
2. WHY sqrt(N) IS THE RIGHT SCALE
==============================================================================

The key fact is that the average of |P|^2 over the circle is exactly N,
no matter what the signs are. This is orthogonality of the functions
e(k t) = exp(2 pi i k t):

    int_0^1 e(j t) conj(e(k t)) dt  =  1  if j = k,   else 0.

Hence, writing P(e(t)) = sum_k eps_k e(k t) and expanding |P|^2 =

    |P|^2 = sum_{j,k} eps_j eps_k e((j-k) t),

and integrating term by term, only j = k survives:

    int_0^1 |P(e(t))|^2 dt = sum_k eps_k^2 = sum_k 1 = N.

So the MEAN of |P|^2 is exactly N. This is what people call Parseval's
identity in this setting.

Two consequences:

  * The mean of |P| is at most sqrt(mean of |P|^2) = sqrt(N) (concavity
    of the square root, or Jensen's inequality). So the modulus spends
    most of its time at or below sqrt(N).
  * The maximum of |P| is at least sqrt(N). Otherwise |P|^2 would be
    strictly below N everywhere and its mean could not be N.

If |P| happened to be constant in modulus, the constant would be
sqrt(N) and the polynomial would be perfectly flat. "Flat" means the
modulus is close to sqrt(N) everywhere, i.e. min and max both close to
sqrt(N). "Ultraflat" means this closeness improves without bound as
N grows.

This is where the whole problem gets its shape: there is a fixed budget
(average N) and you want to spend it as evenly as possible over the
circle. Pure signs make that hard because they come in discrete steps.


==============================================================================
3. WHAT WAS KNOWN BEFORE, AND WHY THE REAL CASE IS HARD
==============================================================================

Some landmarks.

  * Trivial upper bound: |P(z)| <= N by the triangle inequality.
  * Rudin-Shapiro (1959): at special lengths (powers of 2) one can make
    |P| <= sqrt(2N) everywhere. This gives a constant factor 2 above
    the optimum, but only at those lengths and not with the constant
    tending to 1.
  * Balister, Bollobas, Morris, Sahasrabudhe, Tiba (Annals 2020):
    at every degree >= 2 there are signs with BOTH extrema within fixed
    constant factors of sqrt(N). That is, c sqrt(N) <= |P| <= C sqrt(N)
    with absolute constants c, C > 0. This controls the scale but does
    not force c, C -> 1.
  * Kahane (1980): if coefficients are allowed to be ANY complex
    numbers of modulus one (not just +-1), then ultraflat polynomials
    exist. Bombieri and Bourgain (2009) made the construction
    quantitative.

So ultraflatness was known for "continuous" coefficients but not for
real signs. The reason the real case is harder: with complex unit
coefficients you can spread energy continuously; with +-1 you must
realize everything through a discrepancy / rounding step. Rounding a
nearly-unimodular coefficient down to a sign can shift the whole
polynomial; the problem is to do it so that the shift is uniformly
small on the circle. Section 8 is about exactly that.

There are also genuine obstructions, which is why the quantifiers in the
theorem matter:

  * Erdelyi (2026) shows that the sequence of PARTIAL SUMS of one fixed
    unimodular power series cannot be ultraflat. This does not touch our
    theorem because we choose signs afresh at each length.
  * Erdelyi (2026, another paper) shows a lower bound
    max |P|^2 >= N + (N-1)^(1/3)/38 for real signs. This is compatible
    with a max of (1+o(1)) sqrt(N), so it is no obstacle either.

What our theorem adds: the lower envelope can be pushed all the way up
to its optimal value sqrt(N). The earlier paper [OpenAIMinimal] had
max close to sqrt(N) but a min only of order sqrt(N)/16; the version-2
paper [OpenAILowerEnvelope2026] fixed the "min" at a positive constant.
Here both bounds become 1 + o(1).


==============================================================================
4. THE PLAN IN PLAIN LANGUAGE
==============================================================================

The proof has three sentences.

  (A) Build a smooth function B on the circle that is ALMOST constant in
      modulus (between 1 and 1 + small) and whose first N Fourier
      coefficients are all slightly smaller than 1/sqrt(N), with a
      tiny leftover outside 0 .. N-1.

  (B) Rescale those first N coefficients to numbers Y_k in [-1, 1].
      The near-constancy of |B| forces the average of Y_k^2 to be close
      to 1, and since |Y_k| >= Y_k^2, this forces the total "defect"
      mu = (1/2) sum (1 - |Y_k|) to be small.

  (C) Round each Y_k to a real sign eps_k using a discrepancy lemma that
      keeps the sup-norm error of the resulting difference polynomial
      below C sqrt(mu log(80 N / mu)). A small defect means a small
      error, so the rounded polynomial is uniformly close to B, hence
      its modulus is still close to 1, hence (after the sqrt(N)
      rescaling) close to sqrt(N).

Steps A, B, C are sections 7, 8 (first half), 8 (second half). The
construction of B itself uses an auxiliary real trigonometric
polynomial F on a torus (section 6) whose special "balanced"
coefficients are what let the waves in section 7 lock together
coherently.

Here is the one subtlety that a first-time reader will trip on. To
make the Fourier coefficients of B small, you place short "waves"
on the circle. A wave is (amplitude) times e(N times a phase). The
coefficient of such a wave at a given frequency k is, by stationary
phase, (amplitude)/sqrt(N) times a unit number, whenever the frequency
matches the wave's local phase derivative. This is the "1/sqrt(N)" you
want. But the region between waves, and the endpoints of waves, would
spoil this, because integration by parts does not cancel there unless
the waves join up smoothly. The construction therefore joins waves
across gaps while matching BOTH their values and their leading phase
derivatives. The matched derivatives cancel the boundary terms in the
integration by parts and make the exterior Fourier tail summable.


==============================================================================
5. TOOLS
==============================================================================

5.1 Fourier series. For f periodic and integrable,

    f_hat(k) = int_0^1 f(t) e(-k t) dt,      f(t) ~ sum_k f_hat(k) e(k t).

Parseval: int_0^1 |f|^2 = sum_k |f_hat(k)|^2. If sum_k |f_hat(k)| is
finite, the series converges absolutely and uniformly to a continuous
function equal to f. A torus T^m has the same theory with k replaced by
a multi-index and a·y = a_1 y_1 + ... + a_m y_m.

5.2 Stationary phase (why oscillating integrals localize). Consider

    I = int_R g(y) e(T beta y^2/2 - u y) dy,   beta != 0,  T large.

Complete the square: the exponent is a perfect square in y minus a
constant. The exact Gaussian (Fresnel) integral gives

    int_R e(T beta y^2/2 - u y) dy = e(sign(beta)/8 - u^2/(2 T beta)) / sqrt(T|beta|).

For a general amplitude g, freeze g at the stationary point
y_0 = u/(T beta) and correct by integrating the amplitude's smooth
dependence (dominated convergence against g_hat). The result, uniform
in u, is

 LEMMA 5.2a (uniform quadratic formula).
    int_R g(y) e(T beta y^2/2 - u y) dy
      = e(sign(beta)/8 - u^2/(2 T beta)) / sqrt(T|beta|)
        * [ g(u/(T beta)) + O_{g,beta}(1/T) ].

Proof. Complete the square, insert exp(-pi r (y - y_0)^2) and let
r -> 0; the inner Gaussian has modulus <= (T|beta|)^(-1/2) and
dominated convergence against |g_hat| applies; replacing the quadratic
exponential in g_hat by 1 costs (pi/(T|beta|)) int xi^2 |g_hat(xi)| dxi,
independent of y_0.   [Original Section 2, Lemma quadratic.]

The general case is the same story on any interval where the phase has
a single nondegenerate critical point:

 LEMMA 5.2b (uniform stationary phase). Let I be a compact interval,
 phi smooth with phi'' nowhere zero, f smooth compactly supported in
 the interior of I. Then uniformly in x in [0,1],

    sqrt(N) int_I f(t) e(N(phi(t) - x t)) dt
      = f(t_x)/sqrt(|phi''(t_x)|) * e(N(phi(t_x) - x t_x) + d/8) + o(1),

 where t_x is the point with phi'(t_x) = x if it lies in I, d =
 sign(phi''), and the right side is read as 0 when there is no such
 t_x.

Proof. Near a critical point change variables so the phase becomes
phi(t_x) - x t_x + d y^2/2 (a smooth, monotone change of variable; the
Taylor integral formula and the lower bound on |phi''| give uniform
bounds on all derivatives). Then Lemma 5.2a applies. Away from the
critical point the distance from x to phi'(supp f) is bounded below,
and integration by parts gives O(1/N).   [Original Section 2.]

What this says in words: a fast-oscillating integral with amplitude f
and phase N phi is dominated by the points where the phase stands
still; there the integral is roughly (amplitude)/sqrt(curvature) times
a unit complex number, and everywhere else it cancels.

The next lemma is the cancellation estimate.

 LEMMA 5.2c (bounds with endpoint amplitudes). Let I be compact,
 f in C^1(I), phi real smooth with phi'' = Lambda != 0 on I. For all
 real k,

    | int_I f(t) e(N phi(t) - k t) dt |
      <= C / sqrt(N|Lambda|) * ( sup|f| + int_I |f'| ).

 If N phi' - k is monotone and |N phi' - k| >= N rho > 0 on I, the
 same holds with C/(N rho) in place of C/sqrt(N|Lambda|).

Proof. The primitive of e(+- y^2/2) has bounded differences on any
interval (check (0,1) directly, use one integration by parts on each
halfline outside). Completing the square and rescaling bounds each
subinterval integral by C/sqrt(N|Lambda|). In the monotone case a
single integration by parts bounds each subinterval integral by
C/(N rho), and monotonicity bounds the total variation of
(N phi' - k)^(-1) by 2/(N rho). Integrate against f.   [Original
Section 2.]

5.3 Discrepancy (how to round without accumulating error). Random
signs xi_j in {+-1} have, for any fixed vector v, |sum v_j xi_j| of
order |v| sqrt(log ...) with high probability. Discrepancy theory
makes this simultaneous over many vectors:

 LEMMA 5.3 (real matrix discrepancy; black box). There is an absolute
 constant C such that, for integers 1 <= s <= R and every matrix
 A in [-1,1]^(R x s), there is xi in {-1,+1}^s with

    sup over rows r of | (A xi)_r |  <=  C sqrt( s log(2R/s) ).

This is [OpenAILowerEnvelope2026, Lemma 6.2], a quantitative form of
the Pippenger-Spencer / Spencer / Lovett-Meka discrepancy machinery
(cited there). In words: given any bounded linear measurements, you
can choose signs so that every measured sum is unbalanced by only about
sqrt(s log R) instead of the trivial s.

5.4 Rounding with prescribed phases. Here is the version we will
actually use, which allows complex inputs whose arguments are already
nice.

 LEMMA 5.4 (complex rounding). Let n >= 1 and Z_0, ..., Z_{n-1} in C
 with |Z_j| <= 1. Write Z_j = d_j |Z_j| with |d_j| = 1 (take d_j = 1
 when Z_j = 0), and let

    mu = (1/2) sum_{j=0}^{n-1} (1 - |Z_j|).

 Then there are eta_j in {d_j, -d_j} with

    sup_{t in T} | sum_j (eta_j - Z_j) e(j t) |
      <= C ( 1 + sqrt( mu log(80 n / mu) ) ),

 C absolute; the square-root term is 0 when mu = 0 (then the error can
 be 0). For real inputs the eta_j are real signs. The same bound holds
 on any block of n consecutive integer frequencies.

Proof (sketch, following the original). If mu = 0 take eta_j = Z_j.
Otherwise set p_j = (1 - |Z_j|)/2, so 0 <= p_j <= 1/2 and sum p_j = mu.
Watch the polynomial Q(z) = sum_j (eta_j - Z_j) z^j on a fine grid
t_l = l/(20 n). Its real and imaginary parts are the row sums of the
matrix

    A_{2l,j} = Re( d_j e(j t_l) ),   A_{2l+1,j} = Im( d_j e(j t_l) ),

with entries in [-1,1]. Rounding p to a 0/1 vector p' is done by
"halving" on a binary grid: start from the finest grid, and at each
level pick the coordinates with an odd multiple of the current spacing
and apply Lemma 5.3 to those columns, reversing all signs so the mass
does not increase. Since each active coordinate has mass at least the
current spacing, the active set size s_h obeys s_h <= min(n, 2^h mu),
and the error at level h is at most C 2^(-h) sqrt(s_h log(80n/s_h)).
Summing the geometric series in h gives

    sup_l |Q(e(t_l))| <= 1 + C sqrt( mu log(80 n / mu) ).

Then pass from the (1/(20n))-grid to the circle: by the maximum
principle and Cauchy's estimate, |Q'| <= 2 pi e n sup|Q| on the circle,
every point of the circle is within 1/(40n) of a grid point, and the
resulting self-improving estimate closes with a factor
pi e / 20 < 1. Multiplication by a monomial shifts the frequency
block. Real inputs give real d_j, hence real signs.   [Original
Section 3.]


==============================================================================
6. STEP ONE: A REAL AUXILIARY FUNCTION WITH BALANCED COEFFICIENTS
==============================================================================

This is where the "+-1 rounding" gets its raw material. The waves of
section 7 will have constant modulus m_a near the frequencies a of an
auxiliary function F on a torus. For the waves to sum coherently (so
that their leading contributions add up to a bounded function rather
than piling up), the coefficient sizes of F must match |a · v| for one
fixed vector v. It is not enough for |c_a| to be proportional to
sqrt(|a · v|) approximately; the constant must be uniform over a.

Two elementary building blocks do this. The first builds a real
trigonometric polynomial on a torus with norm <= 1 and energy close to
1 (this is a standard "compression" recursion). The second spreads each
old frequency over a whole box of new frequencies while keeping ALL the
spreading coefficients of equal magnitude, so that after spreading the
squared coefficient over a box is again proportional to a prescribed
weight.

We first record the spreading fact.

 LEMMA 6.1 (spreading with equal coefficient magnitudes). Let
 Bs be a finite subset of R \ {0} closed under negation. For any
 alpha > 0 there is a real g in C_c^infinity((-1/2,1/2)) with 0 <= g <= 1
 such that, for every sufficiently large T and every beta in Bs, the
 trigonometric polynomial

    f_beta(y) = sum_{|u| <= floor(T|beta|/2)} a_{beta,u} e(u y),
    |a_{beta,u}| = L_beta^(-1/2),  L_beta = 2 floor(T|beta|/2) + 1,

 satisfies

    sup_y | f_beta(y) - g(y) e(T beta y^2 / 2) |  <=  alpha,

 with the target extended periodically; and one may take
 f_{-beta} = conj(f_beta).

Proof. Pick 0 < q < 1/4 (later: small), then g with int g^2 >= 1 - q.
For fixed beta, the partial Fourier coefficients of the target are
I_beta(u) = int g(y) e(T beta y^2/2 - u y) dy. Lemma 5.2a gives, with
L_beta/(T|beta|) -> 1, the uniform bound sqrt(L_beta)|I_beta(u)| <= 1+q.
Outside the retained window, integration by parts (the phase derivative
T beta y - u has modulus >= c (T + |u|) on the support of g) gives
|I_beta(u)| <= C (T+|u|)^(-2) and hence sum_{|u| > floor(T|beta|/2)}
|I_beta(u)| = O(T^(-1)). Set Z_u = sqrt(L_beta) I_beta(u)/(1+q), so
|Z_u| <= 1, and compute via Parseval that (1/L_beta) sum |Z_u|^2 >=
(1-2q)/(1+q)^2. The defect mu = (1/2) sum (1 - |Z_u|) then obeys
mu/L_beta <= (4q+q^2)/(2(1+q)^2) <= 2q < 1/2. Apply Lemma 5.4 on this
block of consecutive frequencies, and divide the conclusion by
sqrt(L_beta). What results is a unit-modulus polynomial whose
coefficients are exactly the required magnitudes and whose distance to
(1/(1+q)) sum I_beta(u) e(u ·) is
C(L_beta^(-1/2) + sqrt(q log(80/q))). Combine with the tail bound; pick
q small, then g, then T large. Do this simultaneously over the finite
Bs and set f_{-beta} = conj(f_beta); all constraints are symmetric.

Next, the auxiliary function.

 PROPOSITION 6.2 (balanced coefficients). For every 0 < delta < 1/100
 there are an integer m >= 2, a real trigonometric polynomial F on T^m
 and a vector v in R^m such that the Fourier support

    A = { a in Z^m \ {0} : Fourier coefficient of F at a is nonzero }

 consists of at least two pairs {a, -a}, distinct pairs are nonparallel,
 and, with c_a = F at frequency a, lambda_a = a · v, w_a = |lambda_a|,

     ||F||_inf <= 1 + delta,     w_a > 0,

     1 - C delta <= sum_{a in A} w_a < 1,

     1 <= |c_a| / sqrt(w_a) <= 1 + C delta    for all a in A,

 with an absolute constant C; the coefficient ratios are also <= 2.

In words: F is a real torus polynomial of norm barely above 1 whose
frequencies carry weights |a · v| summing to almost 1, and whose
coefficient at each frequency is almost exactly the square root of its
weight.

Proof of Proposition 6.2.

(a) Build a real polynomial of norm <= 1 and energy near 1. Start
p_0 = 0 and set

    p_j(y_1,...,y_j) = p_{j-1}(y_1,...,y_{j-1})
      + (1/2) (1 - p_{j-1}(...)^2) cos(2 pi y_j).

Each p_j has mean 0 and |p_j| <= 1 because (1 - r^2)/2 <= 1 - |r| for
|r| <= 1. Writing M_j = int p_j^2 and integrating in the new
coordinate,

    M_j - M_{j-1} = (1/8) int (1 - p_{j-1}^2)^2 >= (1/8)(1 - M_{j-1})^2,

so M_j increases to 1 (a limit below 1 would force increments bounded
away from 0). Fix d >= 2 with M_d >= 1 - delta and write
p_d(y) = sum_{s in S} b_s e(s · y), b_s nonzero. Zero is not in S
(mean 0). At each step, old frequencies keep the last coordinate 0 and
new frequencies have last coordinate +-1, so every s in S has last
nonzero coordinate +-1; hence two members of S are parallel exactly
when they are equal up to sign. Choose one representative s_1, ..., s_D
from each sign pair. The first step gives one pair; the second step
introduces another because int (1 - p_1^2) > 0.

(b) Choose box sizes. Pick gamma in R^d off the finitely many
hyperplanes s-perp, and set rho_s = |s · gamma| > 0. The plan is that
the box over s will hold about |b_s|^2 / rho_s frequencies, so equal
spreading makes each squared coefficient about rho_s, matching a weight
coming from a vector proportional to (gamma, 0). Concretely, choose
vectors W_1, ..., W_D in R^d with all projections s · W_j nonzero and
use them as spreading parameters; then the box over s has size
asymptotic to T^D prod_j |s · W_j|, and we want these products to be
about tau |b_s|^2 / rho_s with ONE common tau > 0.

For each j, pick W_j^0 in s_j-perp not orthogonal to any other
representative (possible: d >= 2 and the representatives are pairwise
nonparallel), and choose W_j^1 in R^d with
s_j · W_j^1 = |b_{s_j}|^2 / (rho_{s_j} prod_{l != j} |s_j · W_l^0|).
Set W_j = W_j^0 + tau W_j^1. As tau -> 0, exactly the factor
belonging to the representative of {s, -s} vanishes at tau = 0, so

    (1/tau) prod_j |s · W_j|  -> |b_s|^2 / rho_s  for every s in S.

Fix tau small enough that all factors are nonzero and, with
beta_{s,j} = s · W_j and Delta_s = prod_j |beta_{s,j}|,

    (1 - delta) tau |b_s|^2 / rho_s <= Delta_s
      <= (1 + delta) tau |b_s|^2 / rho_s   for every s in S.

(c) Spread and assemble. Apply Lemma 6.1 to the finite list of nonzero
beta_{s,j}, with alpha small enough that

    ( sum_{s in S} |b_s| )  D alpha (1 + alpha)^(D-1)  <=  delta.

With the resulting common cutoff g and large T define

    F(y, z) = sum_{s in S} b_s e(s · y) prod_{j=1}^D f_{beta_{s,j}}(z_j),
    (y, z) in T^d x T^D.

The conjugation condition on the factors and b_{-s} = conj(b_s) make F
real. If each factor is replaced by its target, the result is

    ( prod_j g(z_j) ) p_d( y + (T/2) sum_j W_j z_j^2 ),

with z_j read in [-1/2, 1/2]. The cutoffs vanish near the endpoints, so
this is well-defined on the torus and has norm <= 1. A telescoping
product estimate bounds its distance from F by the left side of the
displayed inequality, so ||F||_inf <= 1 + delta.

Over each old frequency s the Fourier support of F is the full box
a = (s, u_1, ..., u_D) with |u_j| <= floor(T|beta_{s,j}|/2); it has
n_s = prod_j L_{beta_{s,j}} members each with coefficient magnitude
|b_s|/sqrt(n_s), and distinct old frequencies give disjoint boxes.
Two resulting frequencies are parallel only if their s-coordinates
force the proportionality to be +-1, so parallel means equal or
opposite; there remain >= 2 sign pairs and no zero frequency. Increase
T so that

    (1 - delta) T^D Delta_s <= n_s <= (1 + delta) T^D Delta_s
    for every s in S,

and choose the approximants at this T (Lemma 6.1 allows any large T).
Fix T, put m = d + D, and v = (gamma / (tau T^D (1+delta)^3), 0) in
R^{d+D}. Every frequency a over s then has weight
w_a = rho_s / (tau T^D (1+delta)^3) > 0. Combining the two displays,

    (1-delta)^2/(1+delta)^3 |b_s|^2 <= sum_{a over s} w_a <= |b_s|^2/(1+delta),
    1 + delta <= |c_a|^2 / w_a <= (1+delta)^3/(1-delta)^2.

Finally M_d = sum_s |b_s|^2 lies in [1-delta, 1], so the total weight is
between (1-delta)^3/(1+delta)^3 and 1/(1+delta). The ratio bounds give
1 <= |c_a|/sqrt(w_a) <= 1 + C delta. Choices were made in the order
delta, p_d, gamma, (W_j^0, W_j^1), tau, alpha, g, T: the whole
auxiliary object is fixed before any length N is chosen.


==============================================================================
7. STEP TWO: WAVES OF NEARLY CONSTANT MODULUS ON THE CIRCLE
==============================================================================

Now we build the function B on the circle promised in step (A). The
construction scatters short oscillatory pieces ("waves") over the
circle so that their stationary-phase contributions reproduce values of
F, and joins them across small gaps.

We need one more black box (it is [OpenAILowerEnvelope2026, Lemma
3.1]).

 LEMMA 7.1 (signed interval packing; black box). Let a_1, ..., a_r in
 Z^m \ {0} be pairwise nonparallel with r >= 2, and let w_1, ..., w_r > 0
 with 2 sum_i w_i < 1. There are an integer H >= 1 and points
 theta_1, ..., theta_H in T^m such that the closed arcs centered at
 +- a_i · theta_h, of length w_i/H, are pairwise disjoint as i, h and
 the sign vary.

In words: you can place finitely many small arcs on the circle, in a
reflection-symmetric way, at scales proportional to prescribed weights,
without any overlap, as long as the total weight is under 1/2.

 PROPOSITION 7.2 (waves). There are absolute constants C > 0 and
 delta_0 > 0 with the following property. For every 0 < delta < delta_0
 there are N_0(delta) and K_delta < infinity such that, for every
 integer N >= N_0(delta), there is a continuous B_N : T -> C with

     B_N(-t) = conj(B_N(t)),
     1 <= |B_N(t)| <= 1 + C delta     for all t,
     sqrt(N) | B_N_hat(k) | <= 1 + C sqrt(delta)   for 0 <= k < N,
     sum_{k<0 or k>=N} |B_N_hat(k)| <= K_delta / N,

 with real Fourier coefficients and an absolutely convergent Fourier
 series representing B_N.

Proof. Fix delta and use Proposition 6.2:

    F(y) = sum_{a in A} c_a e(a · y),  lambda_a = a · v,  w_a = |lambda_a|,
    ||F||_inf <= 1 + delta,  1 - C delta <= sum w_a < 1,
    1 <= m_a := |c_a| / sqrt(w_a) <= 1 + C delta <= 2.

There are >= 2 sign pairs, nonparallel representatives, so Lemma 7.1
applies (2 sum over representatives w = sum over all a w_a < 1). All
data below except bounded phase adjustments are fixed before N -> inf.

(a) Packed intervals and inverse curvature. Lemma 7.1 gives disjoint
closed arcs centered at -a · theta_h of length w_a/H for all a in A and
1 <= h <= H. Each arc is disjoint from its reflection and avoids 0 and
1/2; regard arcs as intervals in (-1/2, 1/2) with centers t*_{a,h}
satisfying t*_{a,h} = -a · theta_h (mod 1) and t*_{-a,h} = -t*_{a,h}.

The variable x will be k/N (normalized Fourier index, 0 <= x < 1).
Choose for each h a closed interval J_h inside ((h-1)/H, h/H) symmetric
about x_h* = (h-1/2)/H, and a smooth function chi_h symmetric about
x_h* with sigma <= chi_h <= 1, chi_h = sigma near both endpoints and

    int_{J_h} chi_h(x)^2 dx >= (1 - delta)/H.

(First choose |J_h| > (1 - delta/2)/H, then make chi_h = 1 off small
endpoint neighborhoods, with smooth transitions to sigma.) Requiring
|dt/dx| = w_a chi_h(x)^2 makes the stationary-phase factor equal to
sqrt(w_a) chi_h(x), so a wave of modulus m_a has scaled leading
coefficient magnitude |c_a| chi_h(x). Thus chi_h can suppress endpoint
Fourier contributions without lowering the modulus.

Choose smooth real Q_h with Q_h'' = chi_h^2, Q_h'(x_h*) = 0, smoothly
extended near J_h, and define

    T_{a,h}(x) = t*_{a,h} - lambda_a Q_h'(x),   x in J_h.

This is a diffeomorphism onto a closed interval I_{a,h}. Symmetry and
chi_h <= 1 give |Q_h'| <= |J_h|/2 < 1/(2H), so I_{a,h} sits strictly
inside its packed arc. Let X_{a,h} be the inverse map and set

    psi_{a,h}(t) = (t - t*_{a,h}) X_{a,h}(t) + lambda_a Q_h(X_{a,h}(t)),
    psi_{a,h}'(t) = X_{a,h}(t),
    psi_{a,h}''(t) = -1 / (lambda_a chi_h(X_{a,h}(t))^2).

On I_{a,h} define

    B_N(t) = ( c_a / sqrt(w_a) ) e( sign(lambda_a)/8 + N psi_{a,h}(t) ).

The modulus is the constant m_a. The relations
T_{-a,h}(x) = -T_{a,h}(x) and psi_{-a,h}(-t) = -psi_{a,h}(t), plus
c_{-a} = conj(c_a), give conjugate symmetry on the main intervals.
Their total length is

    sum_{a,h} |I_{a,h}| = sum_{a,h} w_a int chi_h^2 >= (1 - delta) sum w_a >= 1 - C delta.

(b) Coherent stationary contributions. Choose G_h in
C_c^infinity(interior J_h), 0 <= G_h <= 1, with 1 - G_h supported in
the two endpoint intervals where chi_h = sigma and monotone there. Split
each integral over I_{a,h} with the cutoff G_h(X_{a,h}(t)). On the
endpoint parts the phase has constant second derivative of modulus
1/(w_a sigma^2), and the cutoff has bounded total variation, so Lemma
5.2c bounds the scaled contribution by C m_a sqrt(w_a) sigma =
C |c_a| sigma. Choose sigma small, before fixing chi_h, so these sum to
<= delta. On the cutoff part apply Lemma 5.2b with x = k/N: the leading
term is 0 when x is not in J_h, and when x is in J_h its value at the
stationary point t = T_{a,h}(x) is

    c_a G_h(x) chi_h(x) e( -k t*_{a,h} + N lambda_a Q_h(x) ),

because psi_{a,h}(T_{a,h}(x)) - x T_{a,h}(x)
= -x t*_{a,h} + lambda_a Q_h(x) and the sign(psi'')/8 correction
cancels the sign(lambda_a)/8 in B_N. Errors are o(1) uniformly in
0 <= k < N. At most one J_h contains x; summing over a for that h gives

    G_h(x) chi_h(x) F( k theta_h + N v Q_h(x) ).

Since 0 <= G_h chi_h <= 1, the norm bound of F and the endpoint
estimates give

    sqrt(N) | sum_{a,h} int_{I_{a,h}} B_N(t) e(-k t) dt | <= 1 + 2 delta + o(1),
      for 0 <= k < N.

(c) Joining the waves through the gaps. Work on [0,1/2] first. Let
[u_j, v_j] be the closures of the gaps between main intervals
(including gaps at 0 and 1/2), with lengths l_j > 0 and total
L = sum l_j <= C delta (from strict containment and the coverage). At
an endpoint z adjoining a main interval prescribe the derivative
x_z = psi_{a,h}'(z) in (0,1); at 0 and 1/2 prescribe 1/8.

For each gap choose a closed interval [P_j, R_j] inside (1/4, 3/4) of
length l_j/(4L), pairwise disjoint and avoiding the finitely many
prescribed x_z. This is possible: total length 1/4, so they fit with
positive spaces inside an interval of length < 1/2, and a small common
translation avoids the forbidden points. Call [P_j, R_j] the derivative
interval assigned to gap j.

Divide gap j into three pieces. On them take phi_j' to be linear,
interpolating

    x_{u_j} -> P_j -> R_j -> x_{v_j}.

So phi_j is C^1 and piecewise quadratic. Make both outer pieces shorter
than l_j/4; their nonzero slopes Lambda = phi_j'' can be made
arbitrarily large in absolute value because P_j != x_{u_j} and
R_j != x_{v_j}. Choose their lengths so that

    sum over outer pieces in [0,1/2] of |Lambda|^(-1/2) <= sqrt(delta).

The middle piece has length at most l_j, so its positive slope
Lambda >= (R_j - P_j)/l_j = 1/(4L). All leading phase derivatives lie
in a fixed compact subset of (0,1).

Let m_j interpolate linearly between the endpoint moduli (value 1 at 0
and 1/2). Define on gap j

    B_N(t) = m_j(t) e( N phi_j(t) + gamma_{j,N}(t) ),

with gamma_{j,N} affine. Choose its two endpoint values to give the
exact phase factors required by the adjoining main waves, and phase
factor 1 at 0 and 1/2. Each endpoint requires just one congruence mod 1,
so this is always possible, with int |gamma'| <= 1 and |gamma'| <=
l_j^(-1) (constant independent of N). Extend to the negative
half-circle by B_N(-t) = conj(B_N(t)). Because B_N(0) = B_N(1/2) = 1,
this is a continuous function on T satisfying the modulus bound. On
reflected gaps use leading phase -phi_j(-t); its derivative is
phi_j'(-t), so leading phase derivatives match across every join,
including 0 and the identified endpoints +-1/2. Matching full
derivatives is unnecessary; matching the leading phase derivative is
what cancels the boundary terms below.

(d) Fourier cost of the gaps. In the gap formula write
B_N = f_N e(N phi_j) with f_N = m_j e(gamma_{j,N}). On each piece
sup|f_N| + int|f_N'| is bounded by an absolute constant (m_j monotone
between values in [1,2]; total variation of gamma_{j,N} <= 1). Lemma
5.2c and the outer-slope sum show that all outer pieces and their
reflections contribute at most C sqrt(delta) to sqrt(N) B_N_hat(k).
Pick rho > 0 so the closed rho-neighborhoods of the finitely many
[P_j, R_j] are disjoint. At most one of these intervals is within rho
of x = k/N; the quadratic estimate with the middle-slope bound
Lambda >= 1/(4L) bounds that piece and its reflection by C sqrt(L).
Every other middle piece has monotone phi_j' - x of modulus >= rho, so
Lemma 5.2c bounds it by C/(rho sqrt(N)); these sum to o(1) since their
number and rho are fixed. Adding up:

    sqrt(N)|B_N_hat(k)| <= 1 + 2 delta + C sqrt(delta) + C sqrt(L) + o(1)
                        <= 1 + C sqrt(delta) + o(1),   0 <= k < N.

Increasing N_0(delta) absorbs the last error into sqrt(delta); neither
the number of gaps nor their separation contributes to the constant.

(e) Cancellation at the joins and the exterior tail. For the projection
step we need more than a pointwise bound on each exterior coefficient:
we need the sum of their absolute values to go to 0. This is where the
matched leading derivatives enter. Partition [-1/2, 1/2] into all main
intervals and the three pieces of every gap and reflected gap, and on
each piece write B_N = f_N e(N phi). There f_N, f_N', f_N'' are bounded
independently of N; phi is fixed, its first three derivatives are
bounded, and all values of phi' lie in a fixed compact subinterval of
(0,1). For k < 0 or k >= N put D = N + |k| and V = N phi' - k; then

    |V| >= c D,    |V'| + |V''| <= C_* N

on every piece, with fixed c > 0, C_* < infinity. The first integration
by parts contributes boundary terms

    f_N(t) e(N phi(t) - k t) / (2 pi i V(t))
      = B_N(t) e(-k t) / (2 pi i (N phi'(t) - k)).

These cancel at every internal join, because B_N is continuous and the
leading phase derivatives agree. They also cancel at -1/2 and 1/2:
there B_N = 1, phi' = 1/8, and e(-k/2) = e(k/2) for integer k. After
the cancellation, a second integration by parts involves

    A = (f_N/V)' / V = f_N'/V^2 - f_N V'/V^3,

    A' = f_N''/V^2 - 3 f_N' V'/V^3 - f_N V''/V^3 + 3 f_N (V')^2 / V^4.

Since N <= D, the bounds above give |A| + |A'| <= C_data D^(-2). Both
the second boundary terms and the remaining integrals therefore have
this bound on each piece; finitely many pieces give

    |B_N_hat(k)| <= C_data (N + |k|)^(-2),   k < 0 or k >= N.

Summing over those integers proves the exterior bound, because
sum_{k in Z} (N + |k|)^(-2) = O(1/N). The finitely many interior
coefficients and this summable exterior bound make the full Fourier
series converge absolutely; its sum equals B_N by continuity. Finally,
conjugate symmetry makes every B_N_hat(k) real.


==============================================================================
8. STEP THREE: PROJECTION AND ROUNDING TO REAL SIGNS
==============================================================================

Now we finish. The function B_N already has almost constant modulus.
Its Fourier coefficients are real and, after multiplication by
sqrt(N), lie in an almost unit cube. Their large L^2 norm forces most
of them to be close to signs; Lemma 5.4 rounds them with a small
uniform error.

Fix a small delta > 0 and let B_N be supplied by Proposition 7.2.
Choose an absolute C_1 so that

    S_delta = 1 + C_1 sqrt(delta),
    Y_k = ( sqrt(N) / S_delta ) B_N_hat(k),   0 <= k < N,

satisfy Y_k in [-1,1] for every sufficiently large N. (This is exactly
the coefficient bound of Proposition 7.2.) The symmetry
B_N(-t) = conj(B_N(t)) makes every B_N_hat(k) real, so every Y_k is
real. Set

    U_Y(t) = (1/sqrt(N)) sum_{k=0}^{N-1} Y_k e(k t).

The absolute Fourier representation and the exterior-tail estimate of
Proposition 7.2 give

    U_Y = B_N / S_delta + O_delta(1/N),    uniformly on T.

Parseval and |B_N| >= 1 consequently imply

    (1/N) sum_{k=0}^{N-1} Y_k^2 >= S_delta^(-2) - o(1).

Since |Y_k| >= Y_k^2, the defect obeys

    mu/N := (1/(2N)) sum_{k=0}^{N-1} (1 - |Y_k|) <= (1/2)(1 - S_delta^(-2)) + o(1).

Put q_delta = (1/2)(1 - S_delta^(-2)) + delta. Then q_delta -> 0 as
delta -> 0, and for all sufficiently large N we have mu/N <= q_delta <
1/2.

Now apply Lemma 5.4 to these real inputs: it produces signs
eps_k in {-1,+1} such that

    U_eps(t) = (1/sqrt(N)) sum_{k=0}^{N-1} eps_k e(k t)

 satisfies

    || U_eps - U_Y ||_inf <= C ( N^(-1/2) + sqrt( q_delta log(80/q_delta) ) ).

(We used monotonicity of q log(80/q) on (0,1/2]; the zero-defect case
changes nothing.) Let E_delta = C sqrt(q_delta log(80/q_delta)). The
two-sided modulus bound of Proposition 7.2 and the projection identity
give, uniformly in t,

    S_delta^(-1) - E_delta - o(1)
      <= |U_eps(t)|
      <= (1 + C delta)/S_delta + E_delta + o(1).

For fixed delta the o(1) terms vanish as N -> infinity, and both
limiting bounds tend to 1 as delta -> 0. Given the epsilon of the main
theorem, choose delta so that the limiting bounds lie strictly between
1 - epsilon and 1 + epsilon, then take N large enough to absorb the
displayed errors. The construction has imposed no divisibility
condition on N: all torus dimensions, packing parameters, intervals and
leading phases were fixed before N was chosen, and the phase identities
use only that k is an integer. Hence the conclusion holds for every
sufficiently large integer length.


==============================================================================
9. ASSEMBLING THE THEOREM
==============================================================================

Combine the pieces.

# ^C interrupted by user!