-exponential, -Gaussian, -objective function and influence function
DefinitionArxiv2405_15536_BasicObjects of Sections 2.1 and 2.2 of da Silva and Kaniadakis (2024).
- κ-exponential (eq. 9). For and , ; the base is always positive. In the classical case .
- κ-Gaussian (eqs. 6-8). , where, writing ,
for , and , , so that is the standard Gaussian density of eq. (10). 3. κ-likelihood (eq. 11). For finitely many errors , . 4. Objective functions (eqs. 1 and 12). For a single residual value, the κ-loss is . For residual traces over finitely many sources and receivers and times ,
- Influence function (eq. 13). is the derivative with respect to of the κ-loss of a single residual.
- Robustness (Hampel). An objective is robust if its influence function satisfies as , and non-robust if as .
Formalization Note At the quantities , , are set to the values the paper gives for the classical limit; all limit statements are taken over with , so they concern the printed formulas. The residual traces are taken as given real functions of time; the acoustic wave equation (2) that produces them is not modelled, since no stated result depends on it. The integrals are Lebesgue integrals over . "Non-robust" is read with matched signs: as and as .
import Mathlib
/-!
da Silva and Kaniadakis, *A graph-space optimal transport FWI approach based on
κ-generalized Gaussian distribution*, arXiv:2405.15536v1 (2024): the κ-exponential, the
κ-Gaussian distribution, the least-squares and κ-objective functions, the influence function
and Hampel's robustness criterion of Sections 2.1 and 2.2.
Conventions. At `κ = 0` the κ-quantities are given the values the paper assigns to them in its
classical limit (Sec. 2.2, text after eq. (10)): `exp_0 = exp`, `β_0 = 1/2`, `Z_0 = √(2π)`.
For `κ ≠ 0` they are the printed formulas (7)-(9), which the paper states for `|κ| < 2/3`.
Residual traces `ε_{s,r}(t) = Γ_{s,r} u_s(m,t) - d_{s,r}(t)` are taken as given real functions
of time, indexed by finite sets of sources and receivers.
-/
open MeasureTheory Filter
noncomputable section
namespace Arxiv2405_15536
/-- Eq. (9), Sec. 2.2, p. 3: the Kaniadakis κ-exponential
`exp_κ(y) = (√(1 + κ² y²) + κ y)^(1/κ)` for `κ ≠ 0` (the base is always positive), and
`exp_0 = exp` (Sec. 2.2, text after eq. (10)). -/
def expKappa (κ y : ℝ) : ℝ :=
if κ = 0 then Real.exp y else (Real.sqrt (1 + κ ^ 2 * y ^ 2) + κ * y) ^ (1 / κ)
/-- Eq. (8), Sec. 2.2, p. 3: the factor
`β_κ = (|2κ|⁻¹/2) · (1 + |κ|/2)/(1 + 3|κ|/2) · Γ(1/|2κ| - 3/4) Γ(1/|2κ| + 1/4) /
(Γ(1/|2κ| + 3/4) Γ(1/|2κ| - 1/4))` for `κ ≠ 0` (stated for `|κ| < 2/3`), and `β_0 = 1/2`
(text after eq. (10)). -/
def betaKappa (κ : ℝ) : ℝ :=
if κ = 0 then 1 / 2 else
(|2 * κ|⁻¹ / 2) * ((1 + |κ| / 2) / (1 + 3 / 2 * |κ|)) *
(Real.Gamma (1 / |2 * κ| - 3 / 4) * Real.Gamma (1 / |2 * κ| + 1 / 4)) /
(Real.Gamma (1 / |2 * κ| + 3 / 4) * Real.Gamma (1 / |2 * κ| - 1 / 4))
/-- Eq. (7), Sec. 2.2, p. 3: the normalization constant
`Z_κ = √(π/β_κ) · |2κ|^(-1/2)/(1 + |κ|/2) · Γ(1/|2κ| - 1/4)/Γ(1/|2κ| + 1/4)` for `κ ≠ 0`
(stated for `|κ| < 2/3`), and `Z_0 = √(2π)` (text after eq. (10)). -/
def zKappa (κ : ℝ) : ℝ :=
if κ = 0 then Real.sqrt (2 * Real.pi) else
Real.sqrt (Real.pi / betaKappa κ) * (|2 * κ| ^ (-(1 / 2 : ℝ)) / (1 + |κ| / 2)) *
(Real.Gamma (1 / |2 * κ| - 1 / 4) / Real.Gamma (1 / |2 * κ| + 1 / 4))
/-- Eq. (6), Sec. 2.2, p. 3: the κ-Gaussian density `p_κ(ε) = exp_κ(-β_κ ε²) / Z_κ`. -/
def kappaGaussian (κ ε : ℝ) : ℝ :=
expKappa κ (-betaKappa κ * ε ^ 2) / zKappa κ
/-- Eq. (11), Sec. 2.2, p. 4: the κ-likelihood `L_κ = ∏_{i=1}^N p_κ(ε_i)` of a finite family of
independent errors `ε_i`, indexed by a finite type of samples. -/
def kappaLikelihood {I : Type*} [Fintype I] (κ : ℝ) (ε : I → ℝ) : ℝ :=
∏ i, kappaGaussian κ (ε i)
/-- Eq. (12), Sec. 2.2, p. 4: the κ-objective of a single residual value,
`-ln exp_κ(-β_κ ε²)` (the integrand of eq. (12), plotted in Fig. 1(c)). -/
def lossKappa (κ ε : ℝ) : ℝ :=
-Real.log (expKappa κ (-betaKappa κ * ε ^ 2))
/-- Eq. (12), Sec. 2.2, p. 4: the κ-objective function
`φ_κ = -∑_{s,r} ∫_0^T ln[exp_κ(-β_κ ε_{s,r}(t)²)] dt` of residual traces `e s r t`
(`s` a source, `r` a receiver, `t ∈ [0, T]` time). -/
def phiKappa {S R : Type*} [Fintype S] [Fintype R] (κ T : ℝ) (e : S → R → ℝ → ℝ) : ℝ :=
∑ s, ∑ r, ∫ t in Set.Icc 0 T, lossKappa κ (e s r t)
/-- Eq. (1), Sec. 2.1, p. 2: the least-squares objective
`φ_0 = (1/2) ∑_{s,r} ∫_0^T ε_{s,r}(t)² dt` of residual traces
`ε_{s,r}(t) = Γ_{s,r} u_s(m,t) - d_{s,r}(t)`. -/
def phi0 {S R : Type*} [Fintype S] [Fintype R] (T : ℝ) (e : S → R → ℝ → ℝ) : ℝ :=
(1 / 2) * ∑ s, ∑ r, ∫ t in Set.Icc 0 T, e s r t ^ 2
/-- Eq. (13), Sec. 2.2, p. 4: the influence function `Υ_κ(ε) = ∂φ_κ/∂ε` of the κ-objective
with respect to a single residual `ε` (for a fixed model), i.e. the derivative of
`ε ↦ -ln exp_κ(-β_κ ε²)`. -/
def influence (κ ε : ℝ) : ℝ :=
deriv (lossKappa κ) ε
/-- Sec. 2.2, p. 4 (after eq. (13)), following Hampel et al.: an objective whose influence
function `Υ` satisfies `Υ(ε) → 0` as `ε → ±∞` is called robust. -/
def IsRobust (f : ℝ → ℝ) : Prop :=
Tendsto f atTop (nhds 0) ∧ Tendsto f atBot (nhds 0)
/-- Sec. 2.2, p. 4 (after eq. (13)), following Hampel et al.: an objective whose influence
function `Υ` satisfies `Υ(ε) → ±∞` as `ε → ±∞` is called non-robust. -/
def IsNonRobust (f : ℝ → ℝ) : Prop :=
Tendsto f atTop atTop ∧ Tendsto f atBot atBot
end Arxiv2405_15536
Read-back
What the Lean code literally says, in plain math · claude-opus-5-5
(the κ-exponential). For real numbers and , with no restriction on either, the value is defined by cases:
The power is the real power with real exponent . The base is always strictly positive, because . So the power is the ordinary positive one, and for all . The case is a separate definition by fiat, not a limit taken inside the definition. Every nonzero real is allowed, including .
(the β-factor). For any real , set by definition. For , write and define
Here is the real Gamma function extended to all real arguments. It takes the value at its poles . Division by zero is taken to yield . The formula is applied to every nonzero with no restriction . When , the argument is and the Gamma function there is evaluated by this extension. In particular, may be or negative for such .
(the normalization constant). For any real , set by definition. For , again with , define
The same conventions apply: Gamma is extended with value at poles, and . The square root is the real square root, which returns for negative inputs. Consequently, if , the first factor is and . Nothing in the definition asserts that normalizes anything.
(the κ-Gaussian). For real and , define
with , and as above. If , this is by the division-by-zero convention. This is only a real-valued function of . No statement is made that it is nonnegative, integrable, or integrates to .
(the κ-likelihood). Let be any finite index set and any real family. Define
If is empty, the product is . No probabilistic independence or distributional assumption appears; this is just a finite product of the values .
(the pointwise κ-loss). For real and , define
Since is always positive, this is the ordinary natural logarithm. At it equals , because and .
(the κ-objective). Let (sources) and (receivers) be finite index sets, and let be arbitrary reals. Let assign to each and an arbitrary function from to . Define
The integral is the Lebesgue integral over the closed interval . The minus sign of the logarithm is already inside , and no further sign is applied. Degenerate cases:
- No measurability or integrability is assumed. Any non-integrable term contributes by convention.
- If , the interval is empty and every integral is .
- If or is empty, .
(the least-squares objective). With , , and as above, define
The same conventions apply: non-integrable terms count as , the value is for , and it is for empty or . This is a separate definition and is not defined as at .
(the influence function). For real and , define
This is the ordinary derivative of the one-variable function at the point . If that function is not differentiable at , the value is by convention. It is a derivative with respect to a single real residual value. It is not a derivative of with respect to the traces .
Robust. A function (any function, not necessarily an influence function) is called robust when
Non-robust. A function is called non-robust when
That is, tends to at and to at , with these specific signs. This is not the negation of "robust": a function can satisfy neither property, for example one tending to a nonzero constant, or one tending to in both directions.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.