Proposition 3.1 (corrected): unbiasedness of the Random Fourier Rotation estimator
ProvedClockRoPE.rfr_estimator_unbiased_v2This is Proposition 3.1 (Unbiasedness of the Random Fourier Rotation Estimator) of Chen et al., ClockRoPE: Random Fourier Rotations for Temporal Routine Modeling (arXiv:2607.26369), §3.1, corrected against IsPositiveDefiniteKernel (Definitions.Def_PositiveDefiniteKernel) and superseding ClockRoPE.rfr_estimator_unbiased (theorem_id 621e5396-400a-4df9-8f94-e3e13fae6e77, now deprecated), which used the under-hypothesized IsPosDefKernel: that predicate only constrained the real part of the associated Hermitian quadratic form, which is not enough to force the kernel to be even, a property the Fourier-inversion argument below genuinely needs.
Let be a continuous, Lebesgue-integrable, positive-definite kernel with , and let be its Fourier transform. For a query and key at positions , sample i.i.d. frequencies and form the Random Fourier Rotation estimator by rotating each feature pair of and by the angle (respectively ) and summing the pairwise dot products of the rotated pairs. The theorem asserts
i.e. is an unbiased estimator of the modulated inner product . This is the feasibility half of the paper's random-features construction: any continuous, integrable, normalized positive-definite profile can be realized in expectation by this per-token, pairwise-iteration-free rotation scheme.
Formalization Note The expectation is formalized as integration against the -fold product measure of MeasureTheory.Measure.withDensity copies of . The hypothesis Integrable f is added explicitly (beyond what the source states in prose) so that is a genuine probability density rather than Lean's junk value.
import Mathlib import Definitions.Def_PositiveDefiniteKernel import Definitions.Def_RandomFourierRotation
namespace ClockRoPE
open MeasureTheory Complex
/-- **Proposition 3.1 (Random Fourier Rotation Estimator)** — corrected against
`IsPositiveDefiniteKernel`, superseding `ClockRoPE.rfr_estimator_unbiased`, which used the
under-hypothesized `IsPosDefKernel`.
Let `f : ℝ → ℝ` be a continuous, Lebesgue-integrable, positive-definite kernel with `f 0 = 1`,
and let `τ` be its Fourier transform. For query `q_m ∈ ℝ^{2n}` and key `k_n ∈ ℝ^{2n}` at
positions `p_m, p_n ∈ ℝ`, sample `n` i.i.d. frequencies `ξ_0, …, ξ_{n-1} ∼ τ` and form the
Random Fourier Rotation estimator `ĝ(q_m, k_n, p_m, p_n)` by rotating each feature pair of
`q_m`/`k_n` by the angle `2πξ_j p_m`/`2πξ_j p_n` and summing the pairwise dot products. Then
`ĝ` is an unbiased estimator of `q_m^⊤ k_n · f(p_m - p_n)`. -/
theorem rfr_estimator_unbiased_v2
(f : ℝ → ℝ) (hf_cont : Continuous f) (hf_int : Integrable f (volume : Measure ℝ))
(hf_pd : IsPositiveDefiniteKernel f) (hf0 : f 0 = 1)
(n : ℕ) (q k : Fin (2 * n) → ℝ) (pm pn : ℝ) :
∫ ξ : Fin n → ℝ, rfrEstimator n q k pm pn ξ
∂(Measure.pi fun _ : Fin n =>
(volume : Measure ℝ).withDensity fun x => ENNReal.ofReal (fourierTransform f x))
= dotProduct q k * f (pm - pn) := by
sorry
end ClockRoPE