diff --git a/research/direct-circulant-fourier/CARTESIAN.md b/research/direct-circulant-fourier/CARTESIAN.md new file mode 100644 index 0000000000..ea18fccdce --- /dev/null +++ b/research/direct-circulant-fourier/CARTESIAN.md @@ -0,0 +1,39 @@ +# Two physical roots from a Cartesian multiplier list + +The input is an explicit list of r≥1 nonzero Gaussian-rational multipliers λₖ and a positive target h. A value such as 3/5+4i/5 can occur without an angle description. The output is a dyadic first column c, an exact rational unit g, and a certified positive rational margin μ for C=circ(c). They satisfy + + (C+C*)/2 > μ I, + ||gC²−U||₂ < 2^(−h), + +where U is the circulant with that input Fourier multiplier list. Identity padding preserves arbitrary values on the other wires. The source compiler from [the padded circuit proof](ROOT-CIRCUIT.md) applies to C with the returned μ. Its issued gate error is additional to the error displayed here. The computation uses only fixed input coefficients on its private tapes. [Producer](cartesian_spectrum.py) · [Physical check](check_cartesian.py) + +Set b=min(1, minₖ max(|Re λₖ|,|Im λₖ|)) and B=max(1, maxₖ(|Re λₖ|+|Im λₖ|)). For every k, b≤√|λₖ|≤B. Define + + a = b/(6r), + τ = min(2^(−h)/(2B+1), a/4)/(4r). + +Use the source unit-phase routine with error at most min(1/(32r),τ/B). Each returned phase is exactly unit and Gaussian rational. [Phase routine and proof](https://github.com/CrocSwap/integer-mult-bounds/blob/e54523517d0f03e58352e647c403a5af3e525a57/research/rational-unitary-fft/PROOF.md) + +## An exact cut without angle comparisons + +Generate the 4r candidate cuts with this routine at angles 2πj/(4r). Distinct true grid values have distance at least 2 sin(π/(4r))≥1/r. The rational candidates therefore have pairwise distance at least 15/(16r). Each true phase λₖ/|λₖ| can exclude at most one rational candidate at distance less than d=1/(3r). At least one candidate c* survives all r exclusions. + +There is an exact rational test for survival. Write v=Re(λₖ conj(c*)). The squared distance of the two unit values is 2−2v/|λₖ|. When v≤0 it is at least d². Otherwise compare v² and (1−d²/2)² |λₖ|². Both sides of the unsquared comparison are positive. Take the first c* with distance at least d for every k. Put γ=−conj(c*) and g=conj(γ). These scalars have exactly unit modulus. The principal square root sₖ of γλₖ has + + Re sₖ = √|λₖ| · |1+γλₖ/|λₖ|| / 2 ≥ a. + +The algorithm has a single-valued branch on every selected multiplier. Repeated input phases, negative real multipliers and candidates at a test boundary are permitted. The correction g is exact. It acts only on the logical block. + +## Rational square roots and a certified column + +For each w=γλₖ, set p=ceil(log₂(32B²/(τa³))) and u=2^(−p). Integer square root gives a dyadic lower approximation to √q with absolute error less than u for any nonnegative rational q. The formula is floor(sqrt(floor(2^(2p)q)))/2^p. Apply it first to |w|², obtaining ℓ≤|w|. Apply it again to max(0,(ℓ+Re w)/2), obtaining x. Round Im(w)/(2x) to the p-grid for y. The code checks x≥a/2 and |(x+iy)²−w|≤aτ. + +To prove these checks always hold, let s=A+iD be the exact principal square root. We have a≤A≤B, |D|≤B, and A²=(|w|+Re w)/2. The first lower approximation changes the argument of the second square root by at most u/2. Taking the positive square root changes its value by at most u/(2A), from the difference of squares. Its final rounding contributes at most u. Thus 0≤A−x≤2u/a and x≥a/2. The imaginary error is at most u/2+|D|(A−x)/x≤u/2+4Bu/a². It follows that |x+iy−s|≤7Bu/a²≤1. Multiplication by |x+iy+s|≤2B+1≤3B gives a residual at most 21B²u/a²≤aτ. Conversely, the checked residual proves that the stored root is within τ of s, since |x+iy+s|≥A≥a. + +For column j average the r stored roots against the certified phases at angles 2πjk/r. Their unit moduli keep the root error per summand below τ, while the phase error contributes at most B(τ/B). Round this average once to a dyadic grid with step at most τ. The Euclidean error per column entry is at most 3τ. If R is the true root circulant, the row and column sums give + + e = ||C−R||₂ ≤ 3rτ < min(2^(−h)/(2B+1), a/4). + +It follows that Re C ≥ (a−e)I > (a/2)I, and the adapter checks this last strict inequality over the actual dyadic column at μ=a/2. The unit correction and the two products give ||gC²−U||₂≤(2B+e)e<2^(−h). These bounds control every input vector by multiplication by its norm. All width choices in the coefficient construction are O(h+log r+log B+log(1/b)). Finite sums of r rational terms can require O(r) times this width. The comparison and synthesis loops use O(r²) rational operations, in addition to the retained phase computations. Exact Hermitian elimination uses O(r³) rational operations and polynomial-bit Schur minors. Private preparation, bit cost and tape storage are polynomial in r, h and the total input description. A rational λₖ can have a large denominator with small numerical magnitude. Its input height and the time to read it are included here. + +The physical replay compiles the Cartesian list (1,−1,−2,3/5+4i/5) on four of eight wires. The selected rotation has both components nonzero. It applies two issued gate programs and the exact logical-block correction, then compares against a separate Gaussian-rational four-point Fourier reference. A control omits the rotation correction. Two scalar tests cover a near-zero nonreal multiplier and a negative real multiplier. Inputs with a zero symbol or an empty table are rejected. diff --git a/research/direct-circulant-fourier/COMPOSITE-OUTER.md b/research/direct-circulant-fourier/COMPOSITE-OUTER.md new file mode 100644 index 0000000000..32587da2cc --- /dev/null +++ b/research/direct-circulant-fourier/COMPOSITE-OUTER.md @@ -0,0 +1,107 @@ +# Composite outer geometry and complete caller + +## Statement and physical addresses + +Let the binary input lengths be at most n. Let b = ceil(log₂ n), B = 2ᵇ and p = 6b. Let T be the unique power of two in [4n/b,8n/b). Write L = log₂ T and V = Tp. Thus 24n ≤ V < 48n. All asymptotic statements concern n beyond a fixed finite cutoff. Handle the finite initial range by elementary binary multiplication. The fast branch uses radix-B digits and the original CRT permutation from the complete mixed-rank caller. Its new outer transform acts on the true physical coordinates of each axis. + +The local circuit to which this proof applies has the following explicit requirements. Each true odd side rᵢ sits inside a dyadic side tᵢ = 2^ℓᵢ. For either sign, the exact target is the true Fourier mean on [0,rᵢ) extended by the identity. The generated rational gate word approximates this target on arbitrary signals with operator error ≤ 2^(−P) tᵢ^O(1). It uses a polynomial in ℓᵢ matching layers. Each pair map and its inverse have 2-norm bounded by a fixed power of tᵢ. At complete matching-layer boundaries the norm of every prefix and its inverse are bounded by a fixed power of tᵢ. Tables, routings, control words and dyadic coefficients to P fractional bits can be constructed in poly(tᵢ,P) time and space on sequential tapes. Constants and polynomial degrees are uniform in i,n. A single-axis table must include dummy rows. The direct spectral-root construction in this package supplies these requirements for the original-coordinate Fourier transform. They also describe other circuits that can use the same multidimensional tensor executor. Only circuits that realize the stated Fourier mean give the integer-product conclusion here. + +## Construct a family of odd square sides + +Set s = ceil(log₂(p+2)), w = 2¹⁶s³ and let d be the greatest power of two ≤ L/w. Start with widths floor(L/d) or ceil(L/d), placing the larger widths first. Write h₀ = floor(L/d), a = floor(h₀/8) and H = d/2 for d ≥ 2. For i = 0,…,H−1 transfer eᵢ = a−(i mod (a+1)) actual address bits from axis H+i to axis i. Call the resulting declared widths ℓᵢ. The sum is still L. Axis zero has maximum width; the minimum is at least 7h₀/8 and the maximum at most 9h₀/8+1. Thus max ℓᵢ ≤ 2 min ℓᵢ, d = Θ(p/s³), and every ℓᵢ = Θ(s³). Eventually H ≥ a+1. The widths of the first a+1 axes are strictly decreasing because their initial widths are nonincreasing and their respective transfers decrease by one. Hence there are Θ(s³) distinct binary widths. The difference between the first and its paired target is at least 2a−1, so their padded *side lengths* can differ by a factor at least 2^(2a−1). For d = 1 retain its unique width. [Executable controller](square_geometry.py) + +For each target tᵢ choose an odd square rᵢ = xᵢ² in its own relative-deficit interval. For an even i use + + 1/(8d) ≤ 1 − rᵢ/tᵢ ≤ 1/(4d). + +For an odd i use + + 1/(32d) ≤ 1 − rᵢ/tᵢ ≤ 1/(16d). + +In increasing i order, scan the corresponding consecutive possible x ≥ 3. Choose the first odd x coprime to twice the product of the previously chosen bases. Use integer square roots, exact divisions with specified floor or ceiling, and the Euclidean algorithm. The controller code makes each choice deterministic. Its bounds depend only on operand length. + +Here is an elementary count that proves every scan succeeds eventually, uniformly over the previous choices. Put M = 2∏_{j m. The finite Bonferroni inequalities put A between Aₖ = Σ_{v≤k}(−1)ᵛ Eᵥ and Aₖ+Eₖ₊₁. One way to see the signs is to select independent Bernoulli coordinates with probabilities 1/qⱼ. On an outcome with h ≥ 1 selected coordinates the truncated alternating binomial sum is (−1)ᵏ binom(h−1,k). For h = 0 the sum is 1. Also + + Eₖ₊₁ ≤ μ^(k+1)/(k+1)! ≤ (e μ/(k+1))^(k+1) ≤ 2^(−k−1). + +The first inequality counts tuples with distinct indices in the full expansion. The second follows by integrating log x on [1,k+1]. The last follows from μ ≤ s ln 2 and e ln 2 < 4. Hence Aₖ ≥ 1/(2(m+1)). In X consecutive integers the count divisible by any square-free product of these primes differs from X divided by that product by less than one. The number of terms through degree k is at most (m+1)^k, by padding the increasing tuple of indices with null symbols. Apply the same odd binomial bound to each integer. The count coprime to M is at least + + X/(2(m+1)) − (m+1)^k. + +It is positive for X > 2(m+1)^(k+1). The narrower square band has real base width at least √tᵢ/(64d), by taking the difference of the square roots and bounding the sum of their roots by 2√tᵢ. Rounding the two endpoints loses at most two. More explicitly, m+1 ≤ p+2 ≤ 2ˢ, d ≤ 2ˢ and ℓᵢ ≥ 2¹⁵s³. The required X is at most 2^(1+s(8s+2)); the available count is at least 2^(2¹⁴s³−6−s)−2, which is larger for every s ≥ 1. Thus a square is available whenever the nonempty width rule and the stated size bounds hold. Establishing the count requires no result on the distribution of primes in intervals. + +The chosen sides are pairwise coprime composites. Put S = ∏ᵢ rᵢ. The product inequality ∏(1−δᵢ) ≥ 1−Σδᵢ for 0 ≤ δᵢ ≤ 1 gives S ≥ 3T/4. Each individual tᵢ/rᵢ ≤ 1/(1−1/(4d)) and the full storage expansion T/S is at most 4/3. Each operand has at most l = ceil(n/b) digits. Thus 2l−2 < 2n/b ≤ T/2 < S. Also S < T ≤ B for b ≥ 8. Each cyclic coefficient equals its linear coefficient and is less than B³. For this controller every axis lies outside the previous upper-deficit bound 1/(2p²) eventually. Adjacent even and odd fields lie in disjoint relative-gap bands. The same complete executor below works for *any* pairwise coprime odd rᵢ strictly within its matching dyadic bounds, with ∏rᵢ ≥ 3T/4, axis zero widest, all ℓᵢ = Θ(s³) and max ℓᵢ ≤ 2 min ℓᵢ. The square scan realizes these conditions from every large input length. + +Generate all one-axis tables and the full list of square sides once in d·2^O(max ℓᵢ) poly(p) = 2^O(s³) = o(n) bit operations. This allows a bounded-degree polynomial in tᵢ and P. The same bound covers the largest interval ever visited on the private tapes, including erasure. These table sizes may exceed a polynomial in p. No full tensor is used at this private precision. + +## Tensor stages on a complete field + +Run one width class at a time. There are O(s³) classes. Within a class all axes use the same significance at each stage. Complete shorter local programs with identity pairs. For any invertible two-coordinate gate G exchange rows and columns to place its largest entry by modulus in the leading pivot. Its modulus is at least 1/(√2 ‖G⁻¹‖₂), both triangular shear ratios have modulus at most one, and the reciprocal of the second pivot is an entry of the inverse of the permuted matrix. The emitted fixed word uses two optional two-H exchanges, two six-H shears and the pivot diagonal, with exactly sixteen H factors. It therefore also covers the stored rational numerical FFT butterflies that need not factor as H times a diagonal. The forward and reverse Beneš programs for the matching each use 2(2ℓᵢ−1) H factors. The total per layer is 8ℓᵢ+12. Thus O(ℓᵢ⁴) matching depth costs O(ℓᵢ⁵) H calls per class, before pack division. All private controls and coefficient tables are generated in polynomial time in tᵢ and P, with both permutations included. [Tensor compiler and fixed words](https://github.com/CrocSwap/integer-mult-bounds/blob/e54523517d0f03e58352e647c403a5af3e525a57/research/unconditional-batched-crt/vendor/TENSOR-COMPILER.md) · [Gate lowering used by the executable word](root_gate_plan.py) + +Each such H acts on one bit of each active axis across the *complete padded tensor*, including all spectators and holes. Take P = C p for fixed sufficiently large C. Let s' = ceil(log₂(P+2)), G = 4s'+6 and K = 128G. For significance j on a width-ℓᵢ axis take common offset ρ = min(j,K−1) and start the K-bit window at j−ρ. Its highest index is < ℓᵢ because ℓᵢ ≥ K eventually. This includes the most significant bit, which a window that always starts at j would miss. + +Split a class into packs of at most max(1,floor(d/s)) bits. There are O(s) packs within any class and O(s³+s) packs summed over classes for a common local depth. The corresponding tensor factors commute and leave every other bit a spectator. For h bits of a pack, gathering and restoring the real neighborhoods moves k ≤ 2hK = O(hs) positions. The complete short-record suffix of (s')² untouched bits exists away from these moves because + + (k+1)(s')² = O_F((d/s)s³ + s²) = O_F(p/s) = o(L). + +Reserve and place the suffix first. Take the additional three O(kG)-bit reservoirs in its complement. Their sizes satisfy kG = o(L) as well. The source re-computes the control positions and colors after physical placement and removes the suffix after inverse exposure. A coarse-label-dependent diagonal is applied only when the full original stream has returned. Such a suffix on a fixed-label subarray would not give the same resource. + +For clarity, the row bound in this application is the proved stock for the actual fixed mixed-rank frames. The logarithms of all simultaneous ordinary and complex row stocks add. Their product requires at most O_F(log(h+1) + h^(1/250)(s')³ + 1) further complete chunks. The two front fields and the back field use at most 3h/128+O(1) chunks. For h larger than a fixed multiple of (1+s')⁵, the sum is ≤ h/16, since 5(1−1/250)>3. Defer the selected bits in these chunks. Execute the current native word on every other selected bit, restore every dirty borrowed coordinate, remove temporary whole-row padding, then process the deferred bits. The positive powers of the shrinking widths have a convergent geometric sum. Below this threshold perform each selected kernel separately in O(V polylog p). The exact common dyadic grid for a complete pack has fractional precision P+O(h), magnitude exponent O(p)+O(h), and O(p) temporary width. Converting the normalized H to raw H costs a full shift scan by 2ʰ. Every intervening displacement, row encoding, materialization, return and cleanup is priced. The proof uses h ≤ d and the displayed physical-space inequalities directly. A power saving h = O(p^(1−ε)) with a fixed ε > 0 would fail for this controller. [Complete mixed-rank Hadamard price and stock](https://github.com/CrocSwap/integer-mult-bounds/blob/343f7b1817e26ad3f89d2ddad313b12741d53602/research/mixed-rank-uniform-composition/COMPLEX-LAYER.md) · [Whole-field placement and suffix proof](https://github.com/CrocSwap/integer-mult-bounds/blob/e54523517d0f03e58352e647c403a5af3e525a57/research/capped-phase-fusion/SUPPLIER-SUPPORT-AUDIT.md) · [Active-packet widths and physical retirement](https://github.com/CrocSwap/integer-mult-bounds/blob/343f7b1817e26ad3f89d2ddad313b12741d53602/research/mixed-rank-uniform-composition/FRAMES.md) + +Stream each complete tensor diagonal, with a value 1 for inactive axes. Store all axis tables in physical order. Maintain suffix products in a mixed-radix odometer, taking axis zero fastest. A carry through at least k axes occurs at most T/(t₀⋯tₖ₋₁) times for k ≥ 1. It takes O(k) coefficient operations to rebuild affected suffixes and O(kt₀) records to move the coefficient head out and back, because t₀ is the largest side. Since t₀⋯tₖ₋₁ ≥ t₀·2^(k−1), all carry travel is at most O(T Σ_{k≥1} k/2^(k−1)) = O(T). The arithmetic and normal head movement add O(T) more records per diagonal. The first table load of O(d t₀) records fits the private budget. This covers the large ratio between dyadic side lengths in the constructed family. Each cached product comes from at most d factors in the current index, including at the first coordinates after a carry. Thus the number of tensor records scanned does not increase multiplicative error through a reused ratio. The exact and rounded suffixes remain bounded by products of the same local factor bounds. [Predecessor odometer for equal side lengths](https://github.com/CrocSwap/integer-mult-bounds/blob/e54523517d0f03e58352e647c403a5af3e525a57/research/unconditional-batched-crt/vendor/TENSOR-COMPILER.md#L112-L133) + +## Original-coordinate recovery and uniform error + +The physical address of cyclic index j is Φ(j)ᵢ = μᵢj mod rᵢ, where μᵢ = (∏_{k