Complex measures, minimum separation, the total-variation program and the dual polynomial of super-resolution
DefinitionSuperResolution_BasicObjects of Sections 1–3 and Appendix A of Candès and Fernandez-Granda (2012).
- Circle and measures. with endpoints identified, and , both with their Borel -algebras. A finite complex measure integrates a bounded continuous function as . Its total-variation norm is , where over finite partitions of into disjoint measurable sets (Appendix A). The atomic measure with amplitudes on a finite set is (eq. 1.2).
- Minimum separation (Definition 1.1). For a finite family of points, . On the distance wraps around, and on it is the maximum of the wrap-around distances of the two coordinates (). The infimum is when has fewer than two points.
- Data and the convex program. for , (eq. 1.3), and on , for (eq. 1.7). is the unique solution of subject to (eq. 1.4) if every finite complex measure with the same coefficients has . In two dimensions the competitors are restricted to real measures (Theorem 1.3).
- Low-frequency polynomials (eq. 2.1). .
- Kernel and dual polynomial (eqs. 2.3–2.6). , with where . For spike locations and coefficients indexed by , and . The coefficients interpolate when and for every .
- Discrete model (Sections 1.4–1.6, 3). For : its support and the grid points ; (eq. 1.9); ; the low-pass projection , i.e. ; the super-resolution factor with (eq. 1.12); and , which keeps the entries indexed by and zeroes the others.
Formalization Note The integral against a complex measure and the total variation are Mathlib's VectorMeasure.integral (with complex multiplication as the pairing) and VectorMeasure.variation; the total variation is valued in . The paper defines on with . The formula is used on all of , which for even is the -periodic extension. The dual polynomial is written as a function of a real variable, and distances to spikes are wrap-around distances on .
import Mathlib
/-!
Candès and Fernandez-Granda, *Towards a Mathematical Theory of Super-Resolution*,
arXiv:1203.5871v3 (2012): complex measures on the circle and their total variation (Section 1.2,
Appendix A), low-frequency Fourier data (eqs. (1.3), (1.7)), the minimum separation
(Definition 1.1), the total-variation program (1.4), low-frequency trigonometric polynomials
(eq. (2.1)), the interpolation kernel and dual polynomial of Section 2 (eqs. (2.3)–(2.6)), and the
discrete model of Sections 1.4–1.6 (eqs. (1.9)–(1.15)).
-/
open MeasureTheory
noncomputable section
namespace SuperResolution
section Measures
variable {X : Type*} [MeasurableSpace X]
/-- Integral `∫ f(t) ν(dt)` of a complex function against a complex measure `ν`, as used in
eqs. (1.3), (1.7) and Appendix A. It is Mathlib's integral against a vector measure, with the
pairing `(f, ν) ↦ f · ν` given by complex multiplication. -/
def cIntegral (ν : ComplexMeasure X) (f : X → ℂ) : ℂ :=
VectorMeasure.integral ν f (ContinuousLinearMap.mul ℝ ℂ)
/-- Appendix A: the total-variation norm `‖ν‖_TV = |ν|(𝕋)`, where `|ν|(B)` is the supremum of
`∑ⱼ |ν(Bⱼ)|` over finite partitions of `B` into disjoint measurable sets (Mathlib's
`VectorMeasure.variation`). -/
def tvNorm (ν : ComplexMeasure X) : ENNReal :=
ν.variation Set.univ
/-- Eq. (1.2): the atomic measure `x = ∑ⱼ aⱼ δ_{tⱼ}` with amplitude `a t` at each point `t ∈ T`. -/
def atomicMeasure (T : Finset X) (a : X → ℂ) : ComplexMeasure X :=
∑ t ∈ T, VectorMeasure.dirac t (a t)
end Measures
/-- Definition 1.1, eq. (1.5): the minimum separation `Δ(T) = inf_{t ≠ t'} |t - t'|` of a finite
family of points. On `𝕋 = UnitAddCircle` the distance is the wrap-around distance, and on
`𝕋 × 𝕋` it is the `ℓ∞` (maximum) wrap-around distance. The infimum over an empty family (fewer
than two points) is `+∞`. -/
def minSep {X : Type*} [PseudoMetricSpace X] (T : Finset X) : ENNReal :=
⨅ t ∈ T, ⨅ t' ∈ T, ⨅ (_ : t ≠ t'), ENNReal.ofReal (dist t t')
/-- Eq. (1.3): the Fourier coefficient `y(k) = ∫ e^{-i2πkt} ν(dt)` of a complex measure on the
circle `𝕋 = [0,1)`. -/
def fourierCoeff (ν : ComplexMeasure UnitAddCircle) (k : ℤ) : ℂ :=
cIntegral ν (fun t => fourier (-k) t)
/-- Eq. (1.4): `x` is the unique solution of `min ‖x̃‖_TV` subject to `F_n x̃ = y`, where
`y = F_n x` collects the Fourier coefficients `|k| ≤ f_c` and `x̃` ranges over all finite complex
measures on `𝕋`: every other feasible measure has strictly larger total variation. -/
def IsUniqueTVSolution (fc : ℕ) (x : ComplexMeasure UnitAddCircle) : Prop :=
∀ ν : ComplexMeasure UnitAddCircle,
(∀ k : ℤ, |k| ≤ fc → fourierCoeff ν k = fourierCoeff x k) → ν ≠ x → tvNorm x < tvNorm ν
/-- Eq. (1.7): the two-dimensional Fourier coefficient
`y(k) = ∫ e^{-i2π⟨k,t⟩} ν(dt)`, `k = (k₁, k₂)`, of a complex measure on `𝕋²`. -/
def fourierCoeff2 (ν : ComplexMeasure (UnitAddCircle × UnitAddCircle)) (k : ℤ × ℤ) : ℂ :=
cIntegral ν (fun t => fourier (-k.1) t.1 * fourier (-k.2) t.2)
/-- Theorem 1.3: `x` is the unique minimum total-variation solution among all real measures on
`𝕋²` (complex measures with zero imaginary part) obeying the data constraints (1.7),
`|k₁|, |k₂| ≤ f_c`. -/
def IsUniqueRealTVSolution2D (fc : ℕ) (x : ComplexMeasure (UnitAddCircle × UnitAddCircle)) :
Prop :=
∀ ν : ComplexMeasure (UnitAddCircle × UnitAddCircle), ComplexMeasure.im ν = 0 →
(∀ k : ℤ × ℤ, |k.1| ≤ fc → |k.2| ≤ fc → fourierCoeff2 ν k = fourierCoeff2 x k) →
ν ≠ x → tvNorm x < tvNorm ν
/-- Eq. (2.1): the low-frequency trigonometric polynomial `q(t) = ∑_{k=-f_c}^{f_c} c_k e^{i2πkt}`. -/
def trigPoly (fc : ℕ) (c : ℤ → ℂ) (t : UnitAddCircle) : ℂ :=
∑ k ∈ Finset.Icc (-(fc : ℤ)) fc, c k * fourier k t
/-- Eq. (2.3): the interpolation kernel
`K(t) = [sin((f_c/2+1)πt) / ((f_c/2+1) sin(πt))]⁴` for `0 < t < 1`, with `K(0) = 1`. It is
written on all of `ℝ` by the same formula, with value `1` where `sin(πt) = 0`; for even `f_c` this
is the `1`-periodic extension (the square of the Fejér kernel, normalised to `K(0) = 1`). -/
def kernel (fc : ℕ) (t : ℝ) : ℝ :=
if Real.sin (Real.pi * t) = 0 then 1
else (Real.sin (((fc : ℝ) / 2 + 1) * Real.pi * t) /
(((fc : ℝ) / 2 + 1) * Real.sin (Real.pi * t))) ^ 4
/-- Eq. (2.4): the dual polynomial `q(t) = ∑_{tⱼ ∈ T} αⱼ K(t - tⱼ) + βⱼ K'(t - tⱼ)`, for spike
locations `T ⊂ [0,1)` and coefficient sequences `α, β` indexed by `T`. -/
def dualPoly (fc : ℕ) (T : Finset ℝ) (α β : ℝ → ℂ) (t : ℝ) : ℂ :=
∑ s ∈ T, (α s * ((kernel fc (t - s) : ℝ) : ℂ) +
β s * ((deriv (kernel fc) (t - s) : ℝ) : ℂ))
/-- Eq. (2.6): `q'(t) = ∑_{tⱼ ∈ T} αⱼ K'(t - tⱼ) + βⱼ K''(t - tⱼ)`. -/
def dualPolyDeriv (fc : ℕ) (T : Finset ℝ) (α β : ℝ → ℂ) (t : ℝ) : ℂ :=
∑ s ∈ T, (α s * ((deriv (kernel fc) (t - s) : ℝ) : ℂ) +
β s * ((deriv (deriv (kernel fc)) (t - s) : ℝ) : ℂ))
/-- Eqs. (2.5)–(2.6): the coefficients `α, β` make the dual polynomial interpolate `v` on `T`
with zero derivative there: `q(t_k) = v_k` and `q'(t_k) = 0` for all `t_k ∈ T`. -/
def IsInterpCoeff (fc : ℕ) (T : Finset ℝ) (v α β : ℝ → ℂ) : Prop :=
∀ t ∈ T, dualPoly fc T α β t = v t ∧ dualPolyDeriv fc T α β t = 0
/-- Section 2: spike locations `T ⊂ [0,1)` viewed as points of the circle `𝕋`. -/
def circlePts (T : Finset ℝ) : Finset UnitAddCircle :=
T.image (fun t : ℝ => (t : UnitAddCircle))
/-- Section 1.4: the fine-grid point `t/N ∈ 𝕋` of an index `t ∈ {0, …, N-1}`. -/
def gridPt (N : ℕ) (t : Fin N) : UnitAddCircle :=
(((t : ℕ) : ℝ) / N : ℝ)
open Classical in
/-- Corollary 1.4: the support `T = {t : x_t ≠ 0}` of a discrete signal `x ∈ ℂ^N`. -/
def gridSupport {N : ℕ} (x : Fin N → ℂ) : Finset (Fin N) :=
Finset.univ.filter (fun t => x t ≠ 0)
/-- Eq. (1.9): the low-frequency data `(F_n x)_k = ∑_{t=0}^{N-1} x_t e^{-i2πkt/N}` of a discrete
signal (used for `|k| ≤ f_c`). -/
def partialFourier {N : ℕ} (x : Fin N → ℂ) (k : ℤ) : ℂ :=
∑ t : Fin N, x t * Complex.exp (-(2 * Real.pi * Complex.I * k * ((t : ℕ) : ℂ) / N))
/-- The `ℓ₁` norm `‖x‖₁ = ∑_t |x_t|` of a discrete signal. -/
def l1norm {N : ℕ} (x : Fin N → ℂ) : ℝ :=
∑ t : Fin N, ‖x t‖
/-- Section 1.5: the low-pass projection `P_n = N⁻¹ F_n^* F_n` onto the `n = 2f_c + 1` lowest
Fourier modes: `(P_n x)_t = N⁻¹ ∑_{|k| ≤ f_c} e^{i2πkt/N} (F_n x)_k`. -/
def lowPass (N fc : ℕ) (x : Fin N → ℂ) : Fin N → ℂ :=
fun t => (N : ℂ)⁻¹ * ∑ k ∈ Finset.Icc (-(fc : ℤ)) fc,
Complex.exp (2 * Real.pi * Complex.I * k * ((t : ℕ) : ℂ) / N) * partialFourier x k
/-- Eq. (1.12): the super-resolution factor `SRF = N/n`, `n = 2f_c + 1`. -/
def srf (N fc : ℕ) : ℝ :=
(N : ℝ) / (2 * fc + 1)
/-- Section 3: `P_T`, the orthogonal projector onto vectors supported on `T`:
`(P_T x)_i = x_i` for `i ∈ T` and `0` otherwise. -/
def projT {N : ℕ} (T : Finset (Fin N)) (x : Fin N → ℂ) : Fin N → ℂ :=
fun t => if t ∈ T then x t else 0
end SuperResolution
Read-back
What the Lean code literally says, in plain math · claude-opus-5-5
Complex integral (cIntegral). Let be any set with a σ-algebra. Let be a complex measure on , meaning a countably additive map from measurable sets to . Let be any function. The quantity
is defined to be Mathlib's integral of against the vector measure , where the value is paired with the measure value by ordinary complex multiplication (viewed as a real-bilinear map). No integrability or measurability assumption on is imposed by the definition. For functions that are not integrable, the value is whatever default (junk) value that general construction assigns.
Total-variation norm (tvNorm). For a complex measure on a measurable space ,
Here is the variation of : is the supremum, over all finite partitions of into pairwise disjoint measurable sets , of . The value is taken in the extended non-negative reals , so the type itself allows .
Atomic measure (atomicMeasure). Given a finite set and an arbitrary function , this is the complex measure
which assigns to each measurable set the value .
- Only the values of on matter.
- Points with contribute nothing.
- If , the result is the zero measure.
Minimum separation (minSep). For a finite set in any pseudometric space with distance ,
computed in the extended non-negative reals .
- If has fewer than two points, the infimum is over an empty family and .
- In a pseudometric space, distinct points may have distance , in which case .
- The distance used is whatever distance the space carries. On the circle this is the quotient (wrap-around) distance , which is at most .
- On a product of two circles it is the maximum of the two coordinate distances.
Fourier coefficient on the circle (fourierCoeff). For a complex measure on (with its Borel σ-algebra) and an integer ,
using the integral defined above. This is defined for every .
Unique minimum-TV solution, 1D (IsUniqueTVSolution). Given a natural number and a complex measure on , the statement asserts the following. For every complex measure on , if
and , then
(strict inequality in ).
- No assumption is made on itself: it need not be atomic, and no separation condition appears.
- When , only the single constraint , i.e. , is imposed.
Fourier coefficient on the torus (fourierCoeff2). For a complex measure on (with the product σ-algebra) and ,
Unique minimum-TV solution among real measures, 2D (IsUniqueRealTVSolution2D). Given and a complex measure on , the statement asserts the following. For every complex measure on whose imaginary part is the zero measure (i.e. for all measurable ), if
and , then
- The competitors are required to be real, but itself is not required to be real.
- No assumption is made on being atomic or separated.
Low-frequency trigonometric polynomial (trigPoly). For , an arbitrary coefficient sequence , and ,
Values with are ignored.
Interpolation kernel (kernel). For and real , set , computed in real arithmetic, so is a half-integer when is odd. Then
- The function is defined on all of , not on the circle.
- When is even, is an integer: the formula is -periodic and tends to at every integer.
- When is odd, at odd integers . So the formula is unbounded near odd integers, while is assigned the value at those points.
Dual polynomial (dualPoly). For , a finite set (not required to lie in ), arbitrary functions , and ,
where is the kernel above.
- is the derivative of as a real function, with the convention that at any point where is not differentiable (as happens near odd integers when is odd).
- If , then .
Derivative expression (dualPolyDeriv). With the same data,
where is the derivative of the function , again with value wherever is not differentiable. This expression is defined directly by this formula; it is not defined as the derivative of .
Interpolation condition (IsInterpCoeff). For , a finite , and functions , the condition asserts that for every ,
with and as in the two preceding definitions (built from ).
- Only the values of on matter.
- If , the condition holds trivially.
Spike locations on the circle (circlePts). For a finite set , this is the finite set . Points of differing by an integer become a single point, so the image may have fewer elements than . is not required to lie in .
Grid point (gridPt). For and an index , this is the point of . For there are no indices.
Support of a discrete signal (gridSupport). For (indexed by ), this is the set
Low-frequency data of a discrete signal (partialFourier). For and any integer ,
- This is defined for all ; no restriction appears in the definition.
- For it equals .
norm (l1norm). For ,
Low-pass operator (lowPass). For and , this is the vector in with entries
with as above.
- No relation between and is imposed. If , distinct in the range give identical exponentials on the grid, and each is summed separately.
- For the vector is empty.
Super-resolution factor (srf). For , this is the real number
Coordinate projection (projT). For a subset and , this is the vector with entries
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.