Visibilities, gains, imaging and self-calibration objectives (Ikeda et al. 2024)
DefinitionArxiv2412_03183_BasicObjects of Sections 2-3 and Appendix 1 of Ikeda, Nakazato, Tsukagoshi, Takeuchi and Yamaguchi (2024).
- Stations and gains. A finite set of stations . Station has complex gains , one per integration in which it observes, at strictly increasing times . A gain vector is .
- Observation setup (eqs. (1)-(4)). There are observed visibilities . Visibility corresponds to a time and an ordered pair of distinct stations, through the gains and taken at that time. The map is one-to-one. Each visibility has a noise standard deviation and a u-v point .
- Image and Fourier transform. An image is . Pixel sits at sky position , and . The feasible images are those with .
- Data term (eq. (8)). .
- Image regulariser (eq. (11)). , where and . A difference is included only when the neighbouring pixel exists.
- Gain regulariser and constraint (eqs. (12)-(13)). with . The constraint is for every station .
- Objectives. The imaging objective (eq. (10)) is . The gain objective (eq. (12)) is . The joint objective (eq. (14)) is . The real coordinates of are .
- Extended functions and subproblem (eqs. (A1)-(A3)). , and is as in eq. (A2), summed over . The subproblem objective is .
- Closed form (eqs. (A4)-(A5)). is the set of visibilities whose first gain is ; for such , is the second gain. With the coefficients are as printed in eq. (A5), and . A setup is conjugate-duplicated if every visibility also appears as some with , and .
Formalization Note The paper does not give explicitly. It is written as the Fourier sum above, with the pixel positions and u-v points as free data. The sign convention of the exponent does not matter, because the statements quantify over all u-v points. Terms of eqs. (11), (13), (A2) and (A5) that involve a non-existent neighbour (pixel or , gain or ) are omitted; the paper does not say how it treats them. , which the paper never defines, is taken as . A gain index is the position of the gain among station 's own gains, which is what allows to differ between stations.
import Mathlib
/-!
Ikeda, Nakazato, Tsukagoshi, Takeuchi and Yamaguchi, *Solving Self-calibration of ALMA Data with an
Optimization Method*, arXiv:2412.03183v1 (2024): the observation model of Section 2 (eqs. (1)-(9)),
the imaging, gain-correction and joint problems of Section 3 (eqs. (10)-(14)), and the extended
functions, subproblem and closed-form update of Appendix 1 (eqs. (A1)-(A5)).
-/
open Finset
noncomputable section
namespace Arxiv2412_03183
/-- Section 2.1, eq. (3) and the sentence before eq. (4): station `α` has `N α` gains
`g_{α 0}, …, g_{α (N α - 1)}`, one per integration in which it observes. A gain is indexed by the
pair `(α, l)`. -/
abbrev GainIdx {S : Type*} (N : S → ℕ) := Σ α : S, Fin (N α)
/-- Section 2.1: a collection of complex gains `g = {g_{α l}}`. -/
abbrev Gains {S : Type*} (N : S → ℕ) := GainIdx N → ℂ
/-- Section 2.1, before eq. (3): an `N_x × N_y` pixelated (Stokes I) image `x = (x_{ij})`. -/
abbrev Image (Nx Ny : ℕ) := Fin Nx → Fin Ny → ℝ
/-- Section 2.1, eqs. (1)-(4), and eq. (8): the observation setup. `M` visibilities `ṽ_k`;
visibility `k` belongs to the integration time `t_l` and the ordered pair of distinct stations
`(α, β)` (eq. (3)), recorded as the gain `first k = (α, l)` and the gain `second k = (β, l)` taken
at that same time; the correspondence `k ↦ (t_l, α, β)` is one-to-one. `time (α, l)` is the time
`t_l` of the gain `g_{α l}`, increasing in `l` for each station. `σ_k > 0` is the noise standard
deviation of visibility `k` (eq. (8)); `(u_k, v_k)` is its u-v point and `(pixX i, pixY j)` the sky
position of pixel `(i, j)`, which define the Fourier transform `F_k` of eq. (1). -/
structure ObsSetup (S : Type*) (N : S → ℕ) (M Nx Ny : ℕ) where
time : GainIdx N → ℝ
time_lt : ∀ (α : S) (i j : Fin (N α)), i < j → time ⟨α, i⟩ < time ⟨α, j⟩
first : Fin M → GainIdx N
second : Fin M → GainIdx N
first_ne_second : ∀ k, (first k).1 ≠ (second k).1
same_time : ∀ k, time (first k) = time (second k)
injective : Function.Injective fun k => (time (first k), (first k).1, (second k).1)
vobs : Fin M → ℂ
sigma : Fin M → ℝ
sigma_pos : ∀ k, 0 < sigma k
u : Fin M → ℝ
v : Fin M → ℝ
pixX : Fin Nx → ℝ
pixY : Fin Ny → ℝ
variable {S : Type*} [Fintype S] [DecidableEq S] {N : S → ℕ} {M Nx Ny : ℕ}
/-- Eqs. (1) and (4): `F_k(x)`, the two-dimensional Fourier transform of the pixelated image `x`
at the u-v point of visibility `k`. -/
def visFT (D : ObsSetup S N M Nx Ny) (x : Image Nx Ny) (k : Fin M) : ℂ :=
∑ i, ∑ j, (x i j : ℂ) *
Complex.exp (-(2 * Real.pi * Complex.I) * ((D.u k * D.pixX i + D.v k * D.pixY j : ℝ) : ℂ))
/-- Eq. (8): the weighted squared error
`L_ṽ(x, g) = ∑_k |ṽ_k g_{α l} g*_{β l} - F_k(x)|² / (2 σ_k²)`. -/
def dataLoss (D : ObsSetup S N M Nx Ny) (x : Image Nx Ny) (g : Gains N) : ℝ :=
∑ k, ‖D.vobs k * g (D.first k) * starRingEnd ℂ (g (D.second k)) - visFT D x k‖ ^ 2 /
(2 * D.sigma k ^ 2)
/-- Section 3.1, after eq. (10): `‖x‖₁ = ∑_{ij} |x_{ij}|`. -/
def l1Norm (x : Image Nx Ny) : ℝ := ∑ i, ∑ j, |x i j|
/-- Section 3.1, after eq. (10): `TSV(x) = ∑_{ij} (x_{ij} - x_{i-1 j})² + (x_{ij} - x_{i j-1})²`,
a difference being present when the neighbouring pixel `(i-1, j)`, resp. `(i, j-1)`, exists. -/
def tsv (x : Image Nx Ny) : ℝ :=
∑ i : Fin Nx, ∑ j : Fin Ny,
((if 0 < i.val then (x i j - x ⟨i.val - 1, lt_of_le_of_lt (Nat.sub_le _ _) i.isLt⟩ j) ^ 2 else 0) +
(if 0 < j.val then (x i j - x i ⟨j.val - 1, lt_of_le_of_lt (Nat.sub_le _ _) j.isLt⟩) ^ 2 else 0))
/-- Eq. (11): `R_{λ₁,λ₂}(x) = λ₁ ‖x‖₁ + λ₂ TSV(x)`. -/
def imgReg (lam1 lam2 : ℝ) (x : Image Nx Ny) : ℝ := lam1 * l1Norm x + lam2 * tsv x
/-- Eq. (10) and Section 2.1 ("`x` is non-negative"): the feasible images `x ≥ 0`. -/
def nonnegImages : Set (Image Nx Ny) := {x | ∀ i j, 0 ≤ x i j}
/-- Eq. (10): the imaging objective `L_ṽ(x, ĝ) + R_{λ₁,λ₂}(x)` for fixed gains `ĝ`. -/
def imagingObjective (D : ObsSetup S N M Nx Ny) (lam1 lam2 : ℝ) (g : Gains N)
(x : Image Nx Ny) : ℝ :=
dataLoss D x g + imgReg lam1 lam2 x
/-- Eq. (13): the previous gain `(α, l-1)` of station `α`, for `l ≥ 1`. -/
def predIdx (p : GainIdx N) (_h : 0 < p.2.val) : GainIdx N := ⟨p.1, ⟨p.2.val - 1, lt_of_le_of_lt (Nat.sub_le _ _) p.2.isLt⟩⟩
/-- Eq. (A5): the next gain `(α, l+1)` of station `α`, when it exists. -/
def succIdx (p : GainIdx N) (h : p.2.val + 1 < N p.1) : GainIdx N := ⟨p.1, ⟨p.2.val + 1, h⟩⟩
/-- Eq. (13): `w_{α l} = 1 / (t_l - t_{l-1})`, for `l ≥ 1`. -/
def stepWeight (D : ObsSetup S N M Nx Ny) (p : GainIdx N) (h : 0 < p.2.val) : ℝ :=
1 / (D.time p - D.time (predIdx p h))
/-- Eq. (12): the gain-correction constraint `∑_l |g_{α l}| = N_α` for every station `α`. -/
def gainFeasible (N : S → ℕ) : Set (Gains N) :=
{g | ∀ α : S, ∑ i : Fin (N α), ‖g ⟨α, i⟩‖ = (N α : ℝ)}
/-- Eq. (13): `S_{μ₁,μ₂}(g) = μ₁ ∑_{α,l} w_{α l} |g_{α l} - g_{α l-1}|²
+ μ₂ ∑_{α,l} w_{α l} (|g_{α l}| - |g_{α l-1}|)²`, the sums running over `l ≥ 1`. -/
def gainReg (D : ObsSetup S N M Nx Ny) (mu1 mu2 : ℝ) (g : Gains N) : ℝ :=
∑ p : GainIdx N, if h : 0 < p.2.val then
stepWeight D p h * (mu1 * ‖g p - g (predIdx p h)‖ ^ 2 +
mu2 * (‖g p‖ - ‖g (predIdx p h)‖) ^ 2) else 0
/-- Eq. (12): the gain-correction objective `L_ṽ(x̂, g) + S_{μ₁,μ₂}(g)` for a fixed image `x̂`. -/
def gainObjective (D : ObsSetup S N M Nx Ny) (x : Image Nx Ny) (mu1 mu2 : ℝ) (g : Gains N) : ℝ :=
dataLoss D x g + gainReg D mu1 mu2 g
/-- Eq. (14): the joint objective `L_ṽ(x, g) + R_{λ₁,λ₂}(x) + S_{μ₁,μ₂}(g)`. -/
def jointObjective (D : ObsSetup S N M Nx Ny) (lam1 lam2 mu1 mu2 : ℝ)
(xg : Image Nx Ny × Gains N) : ℝ :=
dataLoss D xg.1 xg.2 + imgReg lam1 lam2 xg.1 + gainReg D mu1 mu2 xg.2
/-- Section 3.2 ("quartic ... w.r.t. `g`"): the real coordinates of the gains, `(Re g_{α l})` for
the index `0` and `(Im g_{α l})` for the index `1`. -/
def gainCoords (g : Gains N) (q : GainIdx N × Fin 2) : ℝ :=
if q.2 = 0 then (g q.1).re else (g q.1).im
/-- Eq. (A1): `𝓛_ṽ(x, g, h) = ∑_k (1 / (4 σ_k²)) [|ṽ_k g_{α l} h*_{β l} - F_k(x)|²
+ |ṽ_k h_{α l} g*_{β l} - F_k(x)|²]`. -/
def extDataLoss (D : ObsSetup S N M Nx Ny) (x : Image Nx Ny) (g h : Gains N) : ℝ :=
∑ k, (1 / (4 * D.sigma k ^ 2)) *
(‖D.vobs k * g (D.first k) * starRingEnd ℂ (h (D.second k)) - visFT D x k‖ ^ 2 +
‖D.vobs k * h (D.first k) * starRingEnd ℂ (g (D.second k)) - visFT D x k‖ ^ 2)
/-- Eq. (A2): `𝒮_{μ₁,μ₂}(g, h) = (μ₁/2) ∑_{α,l} w_{α l} [|g_{α l} - h_{α l-1}|² + |h_{α l} - g_{α l-1}|²]
+ (μ₂/2) ∑_{α,l} w_{α l} [(|g_{α l}| - |h_{α l-1}|)² + (|h_{α l}| - |g_{α l-1}|)²]`, over `l ≥ 1`. -/
def extGainReg (D : ObsSetup S N M Nx Ny) (mu1 mu2 : ℝ) (g h : Gains N) : ℝ :=
∑ p : GainIdx N, if hp : 0 < p.2.val then
stepWeight D p hp *
(mu1 / 2 * (‖g p - h (predIdx p hp)‖ ^ 2 + ‖h p - g (predIdx p hp)‖ ^ 2) +
mu2 / 2 * ((‖g p‖ - ‖h (predIdx p hp)‖) ^ 2 + (‖h p‖ - ‖g (predIdx p hp)‖) ^ 2)) else 0
/-- Eq. (A3): the subproblem objective
`𝓛_ṽ(x, g, ĥ) + 𝒮_{μ₁,μ₂}(g, ĥ) + (ρ/2) ∑_{α,l} |g_{α l} - ĥ_{α l}|²`, minimised over `g` subject
to the constraint of eq. (12). -/
def subproblemObjective (D : ObsSetup S N M Nx Ny) (x : Image Nx Ny) (mu1 mu2 rho : ℝ)
(h g : Gains N) : ℝ :=
extDataLoss D x g h + extGainReg D mu1 mu2 g h + rho / 2 * ∑ p, ‖g p - h p‖ ^ 2
/-- Eq. (A5): `w_{α l}`, taken as `0` when `l = 0` (no previous gain). -/
def prevWeight (D : ObsSetup S N M Nx Ny) (p : GainIdx N) : ℝ :=
if h : 0 < p.2.val then stepWeight D p h else 0
/-- Eq. (A5): `w_{α l+1}`, taken as `0` when `l` is the last gain of station `α`. -/
def nextWeight (D : ObsSetup S N M Nx Ny) (p : GainIdx N) : ℝ :=
if h : p.2.val + 1 < N p.1 then stepWeight D (succIdx p h) (Nat.succ_pos _) else 0
/-- Eq. (A5): `h_{α l-1}`, taken as `0` when `l = 0`. -/
def prevVal (h : Gains N) (p : GainIdx N) : ℂ :=
if hp : 0 < p.2.val then h (predIdx p hp) else 0
/-- Eq. (A5): `h_{α l+1}`, taken as `0` when `l` is the last gain of station `α`. -/
def nextVal (h : Gains N) (p : GainIdx N) : ℂ :=
if hp : p.2.val + 1 < N p.1 then h (succIdx p hp) else 0
/-- Appendix 1, after eq. (A5): `𝒩(α l)`, the visibilities `k ↔ (t_l, α, β)` containing the gain
`g_{α l}` (as the first factor of eq. (4)); for such `k`, `β` is the station of `second k`. -/
def visOf (D : ObsSetup S N M Nx Ny) (p : GainIdx N) : Finset (Fin M) :=
univ.filter fun k => D.first k = p
/-- Eq. (A5): `a_{α l} = ∑_{k ∈ 𝒩(α l)} |ṽ_k|² |h_{β l}|² / σ_k² + ρ + (μ₁ + μ₂)(w_{α l} + w_{α l+1})`. -/
def coefA (D : ObsSetup S N M Nx Ny) (mu1 mu2 rho : ℝ) (h : Gains N) (p : GainIdx N) : ℝ :=
(∑ k ∈ visOf D p, ‖D.vobs k‖ ^ 2 * ‖h (D.second k)‖ ^ 2 / D.sigma k ^ 2) + rho +
(mu1 + mu2) * (prevWeight D p + nextWeight D p)
/-- Eq. (A5): `b_{α l} = ∑_{k ∈ 𝒩(α l)} y_k ṽ*_k h_{β l} / σ_k² + ρ h_{α l}
+ μ₁ (w_{α l} h_{α l-1} + w_{α l+1} h_{α l+1})`, with `y_k = F_k(x)` the model visibility. -/
def coefB (D : ObsSetup S N M Nx Ny) (x : Image Nx Ny) (mu1 rho : ℝ) (h : Gains N)
(p : GainIdx N) : ℂ :=
(∑ k ∈ visOf D p, visFT D x k * starRingEnd ℂ (D.vobs k) * h (D.second k) /
((D.sigma k ^ 2 : ℝ) : ℂ)) + (rho : ℂ) * h p +
(mu1 : ℂ) * ((prevWeight D p : ℂ) * prevVal h p + (nextWeight D p : ℂ) * nextVal h p)
/-- Eq. (A5): `c_{α l} = μ₂ (w_{α l} |h_{α l-1}| + w_{α l+1} |h_{α l+1}|)`. -/
def coefC (D : ObsSetup S N M Nx Ny) (mu2 : ℝ) (h : Gains N) (p : GainIdx N) : ℝ :=
mu2 * (prevWeight D p * ‖prevVal h p‖ + nextWeight D p * ‖nextVal h p‖)
/-- Eq. (A5): the Lagrange multiplier
`η_α = (∑_l (|b_{α l}| + c_{α l}) / a_{α l} - N_α) / ∑_l 1 / a_{α l}`. -/
def etaMult (D : ObsSetup S N M Nx Ny) (x : Image Nx Ny) (mu1 mu2 rho : ℝ) (h : Gains N)
(α : S) : ℝ :=
((∑ i : Fin (N α), (‖coefB D x mu1 rho h ⟨α, i⟩‖ + coefC D mu2 h ⟨α, i⟩) /
coefA D mu1 mu2 rho h ⟨α, i⟩) - N α) /
∑ i : Fin (N α), 1 / coefA D mu1 mu2 rho h ⟨α, i⟩
/-- Eq. (A5): `r_{α l} = (|b_{α l}| + c_{α l} - η_α) / a_{α l}`. -/
def coefR (D : ObsSetup S N M Nx Ny) (x : Image Nx Ny) (mu1 mu2 rho : ℝ) (h : Gains N)
(p : GainIdx N) : ℝ :=
(‖coefB D x mu1 rho h p‖ + coefC D mu2 h p - etaMult D x mu1 mu2 rho h p.1) /
coefA D mu1 mu2 rho h p
/-- Eq. (A4): the closed-form update `ĝ_{α l} = r_{α l} b_{α l} / |b_{α l}|`. -/
def closedFormGain (D : ObsSetup S N M Nx Ny) (x : Image Nx Ny) (mu1 mu2 rho : ℝ) (h : Gains N)
(p : GainIdx N) : ℂ :=
(coefR D x mu1 mu2 rho h p : ℂ) * (coefB D x mu1 rho h p / (‖coefB D x mu1 rho h p‖ : ℂ))
/-- Eqs. (3) and (A5), the convention under which `𝒩(α l)` collects every visibility containing
`g_{α l}`: each visibility `k ↔ (t_l, α, β)` is also recorded as `k' ↔ (t_l, β, α)` with
`ṽ_{k'} = ṽ_k*`, `σ_{k'} = σ_k` and u-v point `(-u_k, -v_k)` (Hermitian symmetry of
visibilities). -/
def IsConjDuplicated (D : ObsSetup S N M Nx Ny) : Prop :=
∃ dup : Fin M → Fin M, ∀ k, D.first (dup k) = D.second k ∧ D.second (dup k) = D.first k ∧
D.vobs (dup k) = starRingEnd ℂ (D.vobs k) ∧ D.sigma (dup k) = D.sigma k ∧
D.u (dup k) = -D.u k ∧ D.v (dup k) = -D.v k
end Arxiv2412_03183
Read-back
What the Lean code literally says, in plain math · claude-opus-5-5
Throughout, is a finite type of "stations" with decidable equality, assigns to each station a natural number (possibly ), and are arbitrary natural numbers (possibly ). All indices below start at . All sums over empty index sets equal . Division by zero is defined to return , for both real and complex numbers.
Gain index set (GainIdx). A gain index is a pair , where and . If , station contributes no indices. If is empty, or every , the index set is empty. Write for this set.
Gains (Gains). A gain collection is an arbitrary function , written . No constraint is imposed.
Images (Image). An image is an arbitrary real array with and . Entries may be negative. If or , there is exactly one (empty) image.
Observation setup (ObsSetup). An observation setup consists of the following data:
- a time function with whenever , for each station (strictly increasing within each station);
- two maps , required to satisfy, for every :
- the stations of and differ;
- . Only the times must agree; the integer positions in the two stations' lists need not be equal;
- the injectivity condition that the map
is injective;
- complex numbers ;
- real numbers with for every ;
- real numbers for each ;
- real numbers for and for .
No further relations are imposed. In particular, is allowed, and nothing links to one another.
Fourier transform (visFT). For a setup , an image , and ,
Data loss (dataLoss). For an image and gains , writing and ,
Here the bar denotes complex conjugation. The value is when .
norm (l1Norm).
Total squared variation (tsv).
A bracketed term counts only when its condition holds and is otherwise. There are no wrap-around or other boundary terms.
Image regulariser (imgReg). For arbitrary real (not required to be nonnegative),
Nonnegative images (nonnegImages). This is the set of images with for all .
Imaging objective (imagingObjective). For fixed gains , this is the function of
It is defined on all images. The nonnegativity set is not built into it.
Previous index (predIdx). For with , it returns .
Next index (succIdx). For with , it returns .
Step weight (stepWeight). For with ,
By the strict monotonicity of , the denominator is strictly positive.
Gain feasibility set (gainFeasible). This is the set of gains such that, for every station ,
For a station with , the condition reads .
Gain regulariser (gainReg). For arbitrary real ,
Gain objective (gainObjective). For a fixed image , this is the function of
It is defined on all gains. The feasibility constraint is not built into it.
Joint objective (jointObjective). On pairs ,
No constraints on or are built into it.
Real gain coordinates (gainCoords). This maps to the real function on given by and .
Extended data loss (extDataLoss). For an image and two gain collections , with and ,
Extended gain regulariser (extGainReg).
Subproblem objective (subproblemObjective). For arbitrary real and a fixed , this is the function of
It is only a function. No minimisation and no constraint are part of the definition.
Previous weight (prevWeight). For , if , and if .
Next weight (nextWeight). For , if , and otherwise.
Previous value (prevVal). For , if , and otherwise.
Next value (nextVal). For , if , and otherwise.
Visibilities containing a gain (visOf). For ,
This is the set of visibilities whose first gain index is exactly , matching both the station and the position . Visibilities in which appears as the second index are not included.
Coefficient (coefA). For , writing for the second index of ,
This is a real number. Because are arbitrary, it may be zero or negative.
Coefficient (coefB).
This is a complex number. It does not involve .
Coefficient (coefC).
Multiplier (etaMult). For a station ,
Under the division-by-zero convention:
- any term with contributes to both sums;
- if the denominator sum is , which happens for example when , then .
Coefficient (coefR).
where is the station of . If , then .
Closed-form gain (closedFormGain).
If , the quotient is , so . No claim is made that minimises anything or satisfies the feasibility constraint.
Conjugate duplication property (IsConjDuplicated). A setup has this property if there exists a map such that every satisfies all of the following:
- ;
- ;
- ;
- ;
- and .
It is not stated explicitly that is an involution or a bijection. The property is satisfied trivially when .
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.