Interferometric retrievals, random windowing and moving-source model
DefinitionArxiv2105_07250_BasicObjects of Sections 2-4 and Appendices A-B of Ayala-Garcia, Curtis and Branicki (2021). The straight source boundary is parametrised by arc length , and frequency-domain quantities are taken at one fixed angular frequency , which is suppressed: , , .
- Retrievals (eqs. 1-3). ; for recordings , .
- Stacking (eqs. 6-8). The stacking-average kernel is over noise realisations. For a kernel given as a measure on , the stacked retrieval is . The delta kernel is times the image of Lebesgue measure under .
- Random windowing (eqs. 20-24, 27-28). For a window density (a probability density vanishing outside a bounded interval), . With , the windowed recording is , the windowed retrieval applies (2) to two windowed recordings, , and . The uniform density is . for and otherwise; the boxcar of width is ; the tent of eq. (28) is .
- Moving source (Appendix A). In the plane, , and . and are the Bessel functions of order zero given by their standard series (DLMF 10.2.2, 10.8.2), and . The potential (A12) is , and the pressure (A14) is the printed expression in and .
- Doppler (eqs. 5, A21). ; ; .
- Broadband source (eq. A27, Appendix B). ; is times Lebesgue measure on ; the band grid is , .
Formalization Note The boundary is the straight line of the paper's simulations, parametrised by arc length as on p. 12. The paper does not define the Bessel and Hankel functions; the standard series and the identity (DLMF 10.6.2) are used. Eqs. (A12) and (A14) are encoded as printed, including the prefactor that REPORT.md shows to be inconsistent with (A7).
import Mathlib
/-!
D. Ayala-Garcia, A. Curtis and M. Branicki, *Seismic Interferometry from Correlated Noise Sources*,
arXiv:2105.07250v2 (2021): the interferometric retrievals of Sections 2 and 3, the random-windowing
quantities of Section 4, the moving point-source model and its Doppler phase in Appendix A, and the
random-phase source signature of Appendices A.2 and B.
Conventions. The straight source boundary `S` is parametrised by arc length, `x' = (x', 0)`
(Section 3, p. 12), so integrals over `S` are Lebesgue integrals over `ℝ`. Frequency-domain
quantities are taken at one fixed angular frequency `ω`, which is suppressed from the arguments:
`G x'` stands for `Ĝ(x, x', ω)` at a fixed receiver `x`, and `F x'` for `F̂(x', ω)`. Points of the
plane (Appendix A) are elements of `EuclideanSpace ℝ (Fin 2)`.
-/
open MeasureTheory
noncomputable section
namespace Arxiv2105_07250
/-- The plane `ℝ²` of Appendix A, with the Euclidean norm `|·|` and inner product `x · v`. -/
abbrev Plane : Type := EuclideanSpace ℝ (Fin 2)
/-! ### Sections 2 and 3: retrievals and stacking -/
/-- Eq. (1), Section 2, p. 4: the retrieval from individually recorded impulsive sources,
`ĝ(x_A,x_B,ω) = (2/(ρc)) ∫_S Ĝ*(x_A,x',ω) Ĝ(x_B,x',ω) dx'`, with `GA x' = Ĝ(x_A,x',ω)` and
`GB x' = Ĝ(x_B,x',ω)`. -/
def directRetrieval (ρ c : ℝ) (GA GB : ℝ → ℂ) : ℂ :=
((2 / (ρ * c) : ℝ) : ℂ) * ∫ x', starRingEnd ℂ (GA x') * GB x'
/-- Eq. (2), Section 2, p. 5: the ambient-noise retrieval
`ĥ(x_A,x_B,ω) = (2/(ρc)) p̂*(x_A,ω) p̂(x_B,ω)` from the recordings `pA = p̂(x_A,ω)`,
`pB = p̂(x_B,ω)`. -/
def ambientRetrieval (ρ c : ℝ) (pA pB : ℂ) : ℂ :=
((2 / (ρ * c) : ℝ) : ℂ) * (starRingEnd ℂ pA * pB)
/-- Eq. (7), Section 3, p. 10: the stacking-average kernel
`⟨F̂*F̂⟩(x',x'',ω) = ⟨F̂*(x',ω) F̂(x'',ω)⟩`, where the stacking average `⟨·⟩` is the expectation over
the noise realisations `r ∼ P` and `F r x' = F̂(x',ω)` in realisation `r`. -/
def stackKernel {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) (F : Ω → ℝ → ℂ)
(x' x'' : ℝ) : ℂ :=
∫ r, starRingEnd ℂ (F r x') * F r x'' ∂P
/-- Eq. (6), Section 3, p. 10, for a stacking-average kernel given as a measure `κ` on `S × S`
(the measure `⟨F̂*F̂⟩(x',x'',ω) dx' dx''`; this is the form in which the δ-kernel of eq. (8) is a
kernel): `⟨ĥ(x_A,x_B,ω)⟩ = (2/(ρc)) ∫∫ Ĝ*(x_A,x',ω) Ĝ(x_B,x'',ω) κ(dx',dx'')`. -/
def stackedRetrievalOfKernel (ρ c : ℝ) (κ : Measure (ℝ × ℝ)) (GA GB : ℝ → ℂ) : ℂ :=
((2 / (ρ * c) : ℝ) : ℂ) * ∫ q, starRingEnd ℂ (GA q.1) * GB q.2 ∂κ
/-- Eq. (8), Section 3, p. 10: the delta-correlated kernel `δ(x' - x'') |ŝ(ω)|²` on `S × S`, i.e.
`|ŝ(ω)|²` times the image of arc length under the diagonal map `x' ↦ (x', x')`. -/
def deltaKernel (s : ℂ) : Measure (ℝ × ℝ) :=
ENNReal.ofReal (Complex.normSq s) • (volume : Measure ℝ).map (fun x => (x, x))
/-! ### Section 4: random windowing -/
/-- Eq. (22), Section 4.1, p. 19: the random-windowing average `⟨γ⟩_T = ∫_ℝ γ(τ) f_T(τ) dτ` of a
function `γ` of the window centre, for the density `f_T` of the window centres. -/
def windowAvg {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] (fT : ℝ → ℝ) (γ : ℝ → E) : E :=
∫ τ, fT τ • γ τ
/-- Eq. (22) and Section 4.3, step (i), pp. 19 and 23: `f_T` is a probability density on `ℝ`
(measurable, non-negative, total mass one) that is non-zero only on a bounded interval. -/
def IsWindowDensity (fT : ℝ → ℝ) : Prop :=
Measurable fT ∧ (∀ τ, 0 ≤ fT τ) ∧ (∫ τ, fT τ) = 1 ∧ ∃ a b : ℝ, ∀ τ, τ ∉ Set.Icc a b → fT τ = 0
/-- Eq. (20), Section 4.1, p. 19: the windowed recording
`p̂(x,ω;T,t_n) = ∫_S F̂(x',ω) Ĝ(x,x',ω) χ_{|x'-x_n| ≤ T|v|}(x') dx'`, with spatial window centre
`x_n = |v| t_n` (p. 19); `vabs = |v|`. -/
def windowedRecording (F G : ℝ → ℂ) (vabs T tn : ℝ) : ℂ :=
∫ x', Set.indicator {y : ℝ | |y - vabs * tn| ≤ T * vabs} (fun y => F y * G y) x'
/-- Eq. (21), Section 4.1, p. 19: the windowed retrieval
`ĥ(x_A,x_B,ω;T,t_n) = (2/(ρc)) p̂*(x_A,ω;T,t_n) p̂(x_B,ω;T,t_n)`. -/
def windowedRetrieval (ρ c : ℝ) (F GA GB : ℝ → ℂ) (vabs T tn : ℝ) : ℂ :=
ambientRetrieval ρ c (windowedRecording F GA vabs T tn) (windowedRecording F GB vabs T tn)
/-- Eq. (23), Section 4.1, p. 20: the averaged retrieval for a time window of duration `T`,
`ĥ_T(x_A,x_B,ω) = ⟨ĥ(x_A,x_B,ω;T,·)⟩_T`. -/
def averagedRetrieval (ρ c : ℝ) (fT : ℝ → ℝ) (F GA GB : ℝ → ℂ) (vabs T : ℝ) : ℂ :=
windowAvg fT (fun τ => windowedRetrieval ρ c F GA GB vabs T τ)
/-- Eq. (24), Section 4.1, p. 20: the random-windowing averaging kernel
`⟨χχ⟩_T(x',x'') = ⟨χ_{|x'-x_n| ≤ T|v|}(x') χ_{|x''-x_n| ≤ T|v|}(x'')⟩_T`, `x_n = |v| t_n`. -/
def windowKernel (fT : ℝ → ℝ) (vabs T x' x'' : ℝ) : ℝ :=
windowAvg fT (fun τ => (if |x' - vabs * τ| ≤ T * vabs then (1 : ℝ) else 0) *
(if |x'' - vabs * τ| ≤ T * vabs then (1 : ℝ) else 0))
/-- Eq. (27), Section 4.2, p. 21: the density `f_T = 1/(2T)` of window centres `t_n` uniformly
distributed on `D = [t₀ - T, t₀ + T]` (and `0` outside `D`). -/
def uniformWindowDensity (t0 T : ℝ) (τ : ℝ) : ℝ :=
Set.indicator (Set.Icc (t0 - T) (t0 + T)) (fun _ => 1 / (2 * T)) τ
/-- The Heaviside function `Θ` of eqs. (28) and (A10): `Θ(s) = 1` for `s ≥ 0` and `0` for `s < 0`
(the convention of eq. (A10), p. 33). -/
def heaviside (s : ℝ) : ℝ := if 0 ≤ s then 1 else 0
/-- Section 4.2, p. 21: the boxcar function of height one and width `w`, centred at `0`. -/
def boxcar (w y : ℝ) : ℝ := Set.indicator (Set.Icc (-(w / 2)) (w / 2)) (fun _ => (1 : ℝ)) y
/-- The right-hand side of eq. (28), Section 4.2, p. 21, as a function of `L = T|v|` and of the
discrepancy `d = |x' - x''|`: `(d + L) Θ(d + L) + (d - L) Θ(d - L) - 2 d Θ(d)`. -/
def tentKernel (L d : ℝ) : ℝ :=
(d + L) * heaviside (d + L) + (d - L) * heaviside (d - L) - 2 * d * heaviside d
/-! ### Appendix A: moving point source -/
/-- Eq. (A8), Appendix A, p. 33: `q₁(t,x,v) = (c² t - x·v)/(c² - |v|²)`. -/
def q1 (c t : ℝ) (x v : Plane) : ℝ := (c ^ 2 * t - inner ℝ x v) / (c ^ 2 - ‖v‖ ^ 2)
/-- Eq. (A9), Appendix A, p. 33: `q₂(t,x,v) = q₁(t,x,v)² - (c² t² - |x|²)/(c² - |v|²)`. -/
def q2 (c t : ℝ) (x v : Plane) : ℝ := q1 c t x v ^ 2 - (c ^ 2 * t ^ 2 - ‖x‖ ^ 2) / (c ^ 2 - ‖v‖ ^ 2)
/-- Eq. (A11), Appendix A, p. 33: the emission time `t̊ = q₁(t,x,v) - √q₂(t,x,v)` of the wave
recorded at `x` at time `t`, for a source at position `v t'` at time `t'`. -/
def emissionTime (c t : ℝ) (x v : Plane) : ℝ := q1 c t x v - Real.sqrt (q2 c t x v)
/-- The Bessel function of the first kind of order zero,
`J₀(z) = ∑_{k ≥ 0} (-1)^k (z/2)^{2k} / (k!)²` (DLMF 10.2.2). The paper uses it through the Hankel
function `𝓗₀⁽¹⁾` of eq. (A12), p. 33, without defining it. -/
def besselJ0 (z : ℝ) : ℝ :=
∑' k : ℕ, (-1 : ℝ) ^ k * (z / 2) ^ (2 * k) / ((Nat.factorial k : ℝ) ^ 2)
/-- The Bessel function of the second kind of order zero, for `z > 0`,
`Y₀(z) = (2/π)(ln(z/2) + γ) J₀(z) + (2/π) ∑_{k ≥ 1} (-1)^{k+1} H_k (z²/4)^k / (k!)²`, with `H_k` the
harmonic numbers and `γ` the Euler–Mascheroni constant (DLMF 10.8.2). Used through eq. (A12). -/
def besselY0 (z : ℝ) : ℝ :=
2 / Real.pi * (Real.log (z / 2) + Real.eulerMascheroniConstant) * besselJ0 z +
2 / Real.pi * ∑' k : ℕ, (-1 : ℝ) ^ k * (harmonic (k + 1) : ℝ) * (z ^ 2 / 4) ^ (k + 1) /
((Nat.factorial (k + 1) : ℝ) ^ 2)
/-- The Hankel function of the first kind of order zero, `𝓗₀⁽¹⁾(z) = J₀(z) + i Y₀(z)` for real
`z > 0` (DLMF 10.4.3), as in eq. (A12), Appendix A, p. 33. -/
def hankel1Zero (z : ℝ) : ℂ := (besselJ0 z : ℂ) + Complex.I * (besselY0 z : ℂ)
/-- The Hankel function of the first kind of order one, `𝓗₁⁽¹⁾ = -(𝓗₀⁽¹⁾)'` (DLMF 10.6.2), as in
eq. (A14), Appendix A, p. 34. -/
def hankel1One (z : ℝ) : ℂ := -deriv hankel1Zero z
/-- Eq. (A12), Appendix A, p. 33, as printed: the complex potential of a monochromatic point source
of angular frequency `ω̃` moving with velocity `v`,
`φ(t,x,v) = i e^{-i ω̃ q₁(t,x,v)} 𝓗₀⁽¹⁾(ω̃ √q₂(t,x,v)) / (4 c √(c² - |v|²))`. -/
def potentialA12 (c wt t : ℝ) (x v : Plane) : ℂ :=
Complex.I * Complex.exp (-(Complex.I * ((wt * q1 c t x v : ℝ) : ℂ))) /
((4 * c * Real.sqrt (c ^ 2 - ‖v‖ ^ 2) : ℝ) : ℂ) *
hankel1Zero (wt * Real.sqrt (q2 c t x v))
/-- Eq. (A14), Appendix A, p. 34, as printed, with `M = |v|/c` and `t_x = |x|/c` (eq. (A13)):
`p(t,x,M) = Re{ -(i ρ ω̃)/(4 c² (1-M²)^{3/2}) e^{-i ω̃ t/(1-M²)}
[ M² t/R 𝓗₁⁽¹⁾(ω̃ R/(1-M²)) + i 𝓗₀⁽¹⁾(ω̃ R/(1-M²)) ] }`, `R = √(M² t² + (1-M²) t_x²)`. -/
def pressureA14 (ρ c wt M tx t : ℝ) : ℝ :=
let R := Real.sqrt (M ^ 2 * t ^ 2 + (1 - M ^ 2) * tx ^ 2)
(-(Complex.I * ((ρ * wt / (4 * c ^ 2 * (1 - M ^ 2) ^ ((3 : ℝ) / 2)) : ℝ) : ℂ)) *
Complex.exp (-(Complex.I * ((wt / (1 - M ^ 2) * t : ℝ) : ℂ))) *
(((M ^ 2 * t / R : ℝ) : ℂ) * hankel1One (wt / (1 - M ^ 2) * R) +
Complex.I * hankel1Zero (wt / (1 - M ^ 2) * R))).re
/-- Eq. (A21), Appendix A.1, p. 36: the instantaneous phase
`ph_x(t') = (ω + ω̃) t' + (ω/c) |x - v t'| - π/4` of the integrand of eq. (A20). -/
def dopplerPhase (c ω wt : ℝ) (x v : Plane) (t' : ℝ) : ℝ :=
(ω + wt) * t' + ω / c * ‖x - t' • v‖ - Real.pi / 4
/-- Eq. (5), Section 2, p. 7, and eq. (A23): `cos θ_x(t')`, where `θ_x(t')` is the angle between
the line from the instantaneous source position `v t'` to the receiver `x` and the source line `S`,
oriented by the direction of motion `v` (as in eq. (A22): `(x - v t')/|x - v t'| · v = |v| cos θ`). -/
def cosTheta (x v : Plane) (t' : ℝ) : ℝ := inner ℝ (x - t' • v) v / (‖x - t' • v‖ * ‖v‖)
/-- Eq. (5), Section 2, p. 7 (= eq. (A23), p. 36): the recorded instantaneous frequency
`ω̆(x,t') = ω̃ / (1 - (|v|/c) cos θ_x(t'))`. -/
def recordedFrequency (c wt : ℝ) (x v : Plane) (t' : ℝ) : ℝ :=
wt / (1 - ‖v‖ / c * cosTheta x v t')
/-! ### Appendices A.2 and B: random-phase broadband source -/
/-- Eq. (A27), Appendix A.2, p. 37: the source signature
`F(t'; θ) = ∑_{ω̃ ∈ Ω̃} c_ω̃ cos(ω̃ t' + θ_ω̃)` of a broadband source emitting the frequencies
`w i` with coefficients `a i` and phases `θ i`. -/
def sourceSignature {ι : Type*} [Fintype ι] (w a θ : ι → ℝ) (t : ℝ) : ℝ :=
∑ i, a i * Real.cos (w i * t + θ i)
/-- Section 3, p. 12, and Appendix B, p. 38: the law `Unif(0, 2π)` of a random phase. -/
def uniformPhase : Measure ℝ :=
ENNReal.ofReal (1 / (2 * Real.pi)) • volume.restrict (Set.Ico 0 (2 * Real.pi))
/-- Appendix B, p. 38: the regular partition `Ω̃ = {ω̃_j}_{j=1}^{N}` of the band
`[ω̃_min, ω̃_max]` with spacing `Δ_ω̃ = (ω̃_max - ω̃_min)/N`, `ω̃_j = ω̃_min + j Δ_ω̃` (here
`j = 0, …, N-1` stands for the paper's `j = 1, …, N`). -/
def bandGrid (wmin wmax : ℝ) (N : ℕ) (j : Fin N) : ℝ :=
wmin + ((j : ℕ) + 1 : ℝ) * (wmax - wmin) / N
end Arxiv2105_07250
Read-back
What the Lean code literally says, in plain math · claude-opus-5-5
Plane. denotes the Euclidean plane , with the standard inner product and Euclidean norm .
Direct retrieval. For real numbers and functions , the value is
with the integral taken against Lebesgue measure on . No sign or nonzero condition is placed on or . If , the prefactor is taken to be , so the whole value is . If the integrand is not Lebesgue-integrable, the integral is taken to be . No measurability or integrability of is assumed.
Ambient retrieval. For real and complex numbers , the value is
If , the prefactor is and so is the value.
Stacking kernel. The inputs are:
- an arbitrary measurable space ;
- an arbitrary measure on , which is not required to be a probability measure or finite;
- a function , written .
For real the kernel is
The integral is whenever is not -integrable. No measurability of in is assumed.
Stacked retrieval from a kernel measure. For real , an arbitrary measure on , and , the value is
The prefactor is if . The integral is if the integrand is not -integrable. The measure is not required to be finite, symmetric, or related to any random model.
Delta kernel. For a complex number , is the measure on given by
where:
- is Lebesgue measure on ;
- is its image under the diagonal map .
Thus for suitable . When it is the zero measure.
Window average. Let be a real normed vector space, which is not assumed complete. For any and ,
(Lebesgue measure). The value is if is not integrable, and also if is not complete. No condition on is imposed here: it need not be nonnegative, integrable, or of total mass one.
Window density predicate. A function satisfies this predicate exactly when all of the following hold:
- is Borel measurable;
- for every ;
- , where a non-integrable function would have integral , so this forces integrability;
- there exist reals with for every .
Windowed recording. Take and real numbers (the argument named "vabs"), and . None of these is constrained: may be negative, and may be negative or zero. The value is
Edge cases:
- If , the indicator set is empty and the value is .
- If , the set is the single point , which is Lebesgue-null, so the value is .
- A non-integrable integrand also gives .
Windowed retrieval. For real and , the value is
Here is the windowed recording above, . The prefactor is when .
Averaged retrieval. For real , any , and , the value is
In words, weights the windowed retrieval with window centre . The integral is if the integrand is not integrable. is not required to be a window density.
Window kernel. For any and reals , the real number is
The value is if the integrand is not integrable, and identically if .
Uniform window density. For reals , the value is
Edge cases:
- If , the interval is but is taken to be , so the function is identically .
- If , the interval is empty and the function is identically .
Heaviside function. For real , if and if . In particular .
Boxcar. For reals , if and otherwise. The interval is closed. If it is the indicator of ; if it is identically .
Tent kernel. For arbitrary reals , with no sign restriction on either:
with the Heaviside function above ().
. For reals and points :
If , the division by zero yields , so .
. For reals and :
If , both terms are and . may be negative.
Emission time. For reals and :
The square root is the real square root with for . So when , . No condition such as is imposed.
. For real :
This is an unconditional infinite sum, taken to be by convention if the family of terms is not summable.
. For every real , including :
where:
- is the Euler–Mascheroni constant;
- is the -th harmonic number;
- the infinite sum is if not summable;
- the logarithm is the real logarithm with for and .
Consequently , and for the formula uses .
Hankel function . For every real , , with as above, including their values at .
Hankel function . For real , . This is the derivative of the map above. At any point where that map is not differentiable, the derivative is taken to be , so there.
Potential (A12). For reals and :
with as above and the real square root for . Edge cases:
- If or (so ), the denominator is , division by yields , and .
- If , the Hankel argument is , giving .
Pressure (A14). Take reals . These are independent parameters: and are not tied to any velocity or position. Set
(real square root, for negative arguments). Then
Here is the real power when , which equals . Edge cases:
- If or , the prefactor's denominator is , the prefactor is , and .
- If , the term is .
Doppler phase. For reals and :
If , the middle term is .
. For and real :
If or , the denominator is and the value is .
Recorded frequency. For reals and :
with as above (and equal to when or ). Edge cases:
- If , then and .
- If the denominator vanishes, .
No condition is imposed.
Source signature. Take a finite index set , possibly empty, and real families , , indexed by . The frequencies need not be distinct or positive. For real :
If is empty, .
Uniform phase law. This is the measure on equal to times Lebesgue measure restricted to the half-open interval . It has total mass .
Band grid. For reals and a natural number , the grid has one point for each index :
The points run from up to ; itself is excluded. If , there are no grid points. No ordering is assumed: if the points decrease, and if they are equal all points coincide.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.