Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Primary fields, planar surface plasmon polaritons, Rayleigh-equation matrix elements, specular kernels and speckle correlation functions for one-dimensional rough surfaces

Definition
CondMat0408017_Basic

by Xeroth · Nov 25, 2026 · Mathlib 0df444a (Lean v4.33.1)

reduced-rayleigh-equationrough-surface-scatteringsmall-amplitude-perturbation-theoryspeckle-correlationssurface-plasmon-polaritons

Objects used in the derivations of Sections II-IV of Simonsen (2004), a review of wave scattering from one-dimensional rough surfaces x3=ζ(x1)x_3=\zeta(x_1)x3​=ζ(x1​) with harmonic time dependence e−iωte^{-i\omega t}e−iωt.

  1. Primary field and boundary conditions (Sec. II.C). For ppp polarization the primary field is Φp=H2\Phi_p=H_2Φp​=H2​, and E=(−iωε∂3Φ,0,iωε∂1Φ)E=(-\frac{i}{\omega\varepsilon}\partial_3\Phi,0,\frac{i}{\omega\varepsilon}\partial_1\Phi)E=(−ωεi​∂3​Φ,0,ωεi​∂1​Φ), H=(0,Φ,0)H=(0,\Phi,0)H=(0,Φ,0). For sss polarization Φs=E2\Phi_s=E_2Φs​=E2​, E=(0,Φ,0)E=(0,\Phi,0)E=(0,Φ,0), H=(iωμ∂3Φ,0,−iωμ∂1Φ)H=(\frac{i}{\omega\mu}\partial_3\Phi,0,-\frac{i}{\omega\mu}\partial_1\Phi)H=(ωμi​∂3​Φ,0,−ωμi​∂1​Φ). Write κ=ε\kappa=\varepsilonκ=ε for ppp and κ=μ\kappa=\muκ=μ for sss. The unit normal into medium +++ is n=(−ζ′,0,1)/1+ζ′2n=(-\zeta',0,1)/\sqrt{1+\zeta'^2}n=(−ζ′,0,1)/1+ζ′2​, and ∂n=(−ζ′∂1+∂3)/1+ζ′2\partial_n=(-\zeta'\partial_1+\partial_3)/\sqrt{1+\zeta'^2}∂n​=(−ζ′∂1​+∂3​)/1+ζ′2​.

  2. Planar SPPs (Sec. II.D). For real dielectric constants ε±\varepsilon_\pmε±​ the decay constants are β±=k2−ε±ω2/c2\beta_\pm=\sqrt{k^2-\varepsilon_\pm\omega^2/c^2}β±​=k2−ε±​ω2/c2​. The localized fields are Φ+=A+e−β+x3eikx1\Phi^+=A^+e^{-\beta_+x_3}e^{ikx_1}Φ+=A+e−β+​x3​eikx1​ (x3>0x_3>0x3​>0) and Φ−=A−eβ−x3eikx1\Phi^-=A^-e^{\beta_-x_3}e^{ikx_1}Φ−=A−eβ−​x3​eikx1​ (x3<0x_3<0x3​<0). The flat-interface boundary conditions are Φ+=Φ−\Phi^+=\Phi^-Φ+=Φ− and 1κ+∂3Φ+=1κ−∂3Φ−\frac1{\kappa^+}\partial_3\Phi^+=\frac1{\kappa^-}\partial_3\Phi^-κ+1​∂3​Φ+=κ−1​∂3​Φ− at x3=0x_3=0x3​=0 for every x1x_1x1​. A ppp-polarized SPP at (k,ω)(k,\omega)(k,ω) exists if β±\beta_\pmβ±​ are real and positive and these conditions with κ±=ε±\kappa^\pm=\varepsilon_\pmκ±=ε±​ have a non-zero solution. The free-electron dielectric function is ε(ω)=ε∞(1−ωp2/ω2)\varepsilon(\omega)=\varepsilon_\infty(1-\omega_p^2/\omega^2)ε(ω)=ε∞​(1−ωp2​/ω2), and ωsp(k)\omega_{sp}(k)ωsp​(k) is the expression (21).

  3. Rms height difference (Sec. II.G). For a random profile ζ(x1,⋅)\zeta(x_1,\cdot)ζ(x1​,⋅) on a probability space, σ(Δx1)=⟨(ζ(Δx1)−ζ(0))2⟩1/2\sigma(\Delta x_1)=\langle(\zeta(\Delta x_1)-\zeta(0))^2\rangle^{1/2}σ(Δx1​)=⟨(ζ(Δx1​)−ζ(0))2⟩1/2.

  4. Mean DRC and S-matrix (Sec. III.C-D). With k=ωcsin⁡θ0k=\frac\omega c\sin\theta_0k=cω​sinθ0​, q=ωcsin⁡θsq=\frac\omega c\sin\theta_sq=cω​sinθs​, the mean DRC is ⟨∂R/∂θs⟩=1L1ω2πccos⁡2θscos⁡θ0⟨∣R(q∣k)∣2⟩\langle\partial R/\partial\theta_s\rangle=\frac1{L_1}\frac{\omega}{2\pi c}\frac{\cos^2\theta_s}{\cos\theta_0}\langle|R(q|k)|^2\rangle⟨∂R/∂θs​⟩=L1​1​2πcω​cosθ0​cos2θs​​⟨∣R(q∣k)∣2⟩, and its incoherent part has ⟨∣R∣2⟩−∣⟨R⟩∣2\langle|R|^2\rangle-|\langle R\rangle|^2⟨∣R∣2⟩−∣⟨R⟩∣2 in place of ⟨∣R∣2⟩\langle|R|^2\rangle⟨∣R∣2⟩. In the radiative region α0(q)=ω2/c2−q2\alpha_0(q)=\sqrt{\omega^2/c^2-q^2}α0​(q)=ω2/c2−q2​ and S(q∣k)=α0(q)/α0(k) R(q∣k)S(q|k)=\sqrt{\alpha_0(q)/\alpha_0(k)}\,R(q|k)S(q∣k)=α0​(q)/α0​(k)​R(q∣k).

  5. Kernels with a specular part (Sec. III). A kernel K(q∣k)=2πδ(q−k) d(k)+r(q,k)K(q|k)=2\pi\delta(q-k)\,d(k)+r(q,k)K(q∣k)=2πδ(q−k)d(k)+r(q,k) is the pair (d,r)(d,r)(d,r). For an ordinary function NNN, ∫dq2πN(p∣q)K(q∣k)=N(p∣k)d(k)+∫dq2πN(p∣q)r(q,k)\int\frac{dq}{2\pi}N(p|q)K(q|k)=N(p|k)d(k)+\int\frac{dq}{2\pi}N(p|q)r(q,k)∫2πdq​N(p∣q)K(q∣k)=N(p∣k)d(k)+∫2πdq​N(p∣q)r(q,k).

  6. RRE matrix elements (Sec. III.E-F). With α(p)2=εω2/c2−p2\alpha(p)^2=\varepsilon\omega^2/c^2-p^2α(p)2=εω2/c2−p2, α0(q)2=ω2/c2−q2\alpha_0(q)^2=\omega^2/c^2-q^2α0​(q)2=ω2/c2−q2 and I(γ∣Q)=∫dx1 e−iγζ(x1)−iQx1I(\gamma|Q)=\int dx_1\,e^{-i\gamma\zeta(x_1)-iQx_1}I(γ∣Q)=∫dx1​e−iγζ(x1​)−iQx1​:

    • Mν±(p∣q)=±[(p+κq)(p−q)α(p)∓α0(q)+α(p)±κα0(q)]I(α(p)∓α0(q)∣p−q)M^\pm_\nu(p|q)=\pm\big[\frac{(p+\kappa q)(p-q)}{\alpha(p)\mp\alpha_0(q)}+\alpha(p)\pm\kappa\alpha_0(q)\big]I(\alpha(p)\mp\alpha_0(q)|p-q)Mν±​(p∣q)=±[α(p)∓α0​(q)(p+κq)(p−q)​+α(p)±κα0​(q)]I(α(p)∓α0​(q)∣p−q), with κ=ε\kappa=\varepsilonκ=ε for ppp and κ=1\kappa=1κ=1 for sss;
    • Np±(p∣q)=±pq±α(p)α0(q)α(p)∓α0(q)I(⋅∣p−q)N^\pm_p(p|q)=\pm\frac{pq\pm\alpha(p)\alpha_0(q)}{\alpha(p)\mp\alpha_0(q)}I(\cdot|p-q)Np±​(p∣q)=±α(p)∓α0​(q)pq±α(p)α0​(q)​I(⋅∣p−q) and Ns±(p∣q)=±1α(p)∓α0(q)I(⋅∣p−q)N^\pm_s(p|q)=\pm\frac{1}{\alpha(p)\mp\alpha_0(q)}I(\cdot|p-q)Ns±​(p∣q)=±α(p)∓α0​(q)1​I(⋅∣p−q).

    On a surface of length LLL, III and ζ~(n)(Q)=∫dx1 ζne−iQx1\tilde\zeta^{(n)}(Q)=\int dx_1\,\zeta^ne^{-iQx_1}ζ~​(n)(Q)=∫dx1​ζne−iQx1​ are integrals over (−L/2,L/2)(-L/2,L/2)(−L/2,L/2). The coefficients of the expansion of Nν±N^\pm_\nuNν±​ are Nν±(0)\mathcal N^{\pm(0)}_\nuNν±(0)​, the n=0n=0n=0 term, and for n≥1n\ge1n≥1 Np±(n)=(−i)n[±pq+α(p)α0(q)][α(p)∓α0(q)]n−1\mathcal N^{\pm(n)}_p=(-i)^n[\pm pq+\alpha(p)\alpha_0(q)][\alpha(p)\mp\alpha_0(q)]^{n-1}Np±(n)​=(−i)n[±pq+α(p)α0​(q)][α(p)∓α0​(q)]n−1 and Ns±(n)=±(−i)n[α(p)∓α0(q)]n−1\mathcal N^{\pm(n)}_s=\pm(-i)^n[\alpha(p)\mp\alpha_0(q)]^{n-1}Ns±(n)​=±(−i)n[α(p)∓α0​(q)]n−1. The Fresnel coefficients are Rp(0)=εα0−αεα0+αR^{(0)}_p=\frac{\varepsilon\alpha_0-\alpha}{\varepsilon\alpha_0+\alpha}Rp(0)​=εα0​+αεα0​−α​ and Rs(0)=α0−αα0+αR^{(0)}_s=\frac{\alpha_0-\alpha}{\alpha_0+\alpha}Rs(0)​=α0​+αα0​−α​.

  7. Lippmann-Schwinger equation and scattering potentials (Sec. III.G-H). G(q∣k)=2πδ(q−k)G(0)(k)+G(0)(q)∫dp2πV(q∣p)G(p∣k)G(q|k)=2\pi\delta(q-k)G^{(0)}(k)+G^{(0)}(q)\int\frac{dp}{2\pi}V(q|p)G(p|k)G(q∣k)=2πδ(q−k)G(0)(k)+G(0)(q)∫2πdp​V(q∣p)G(p∣k). Vν(1)V^{(1)}_\nuVν(1)​ and Vν(2)V^{(2)}_\nuVν(2)​ are the expressions (97), with arbitrary functions in place of ζ~(1),ζ~(2)\tilde\zeta^{(1)},\tilde\zeta^{(2)}ζ~​(1),ζ~​(2).

  8. Double-scattering paths (Sec. IV.A.3). In a medium of dielectric constant ε0\varepsilon_0ε0​, k0=ε0ωc(sin⁡θ0,−cos⁡θ0)k_0=\sqrt{\varepsilon_0}\frac\omega c(\sin\theta_0,-\cos\theta_0)k0​=ε0​​cω​(sinθ0​,−cosθ0​) and ks=ε0ωc(sin⁡θs,cos⁡θs)k_s=\sqrt{\varepsilon_0}\frac\omega c(\sin\theta_s,\cos\theta_s)ks​=ε0​​cω​(sinθs​,cosθs​). A path that enters at rinr_{in}rin​, travels to routr_{out}rout​ in a mode of wave number qqq and leaves along ksk_sks​ has phase k0⋅rin+q∣rout−rin∣−ks⋅routk_0\cdot r_{in}+q|r_{out}-r_{in}|-k_s\cdot r_{out}k0​⋅rin​+q∣rout​−rin​∣−ks​⋅rout​. Δϕnm\Delta\phi_{nm}Δϕnm​ is the phase of the path C→BC\to BC→B in mode nnn minus that of the path B→CB\to CB→C in mode mmm.

  9. Localization (Sec. IV.B). The West-O'Donnell spectrum (139) allows momentum transfers 2k1−Δk≤∣Q∣≤2k1+Δk2k_1-\Delta k\le|Q|\le2k_1+\Delta k2k1​−Δk≤∣Q∣≤2k1​+Δk. The ohmic mean free path is ℓε=1/(2k2)\ell_\varepsilon=1/(2k_2)ℓε​=1/(2k2​). The least-squares slope of points (xi,yi)(x_i,y_i)(xi​,yi​) is ∑(xi−xˉ)(yi−yˉ)/∑(xi−xˉ)2\sum(x_i-\bar x)(y_i-\bar y)/\sum(x_i-\bar x)^2∑(xi​−xˉ)(yi​−yˉ​)/∑(xi​−xˉ)2.

  10. Correlation functions (Sec. IV.C). δS=S−⟨S⟩\delta S=S-\langle S\rangleδS=S−⟨S⟩, and the fourth-order joint cumulant is {abcd}=⟨a′b′c′d′⟩−⟨a′b′⟩⟨c′d′⟩−⟨a′c′⟩⟨b′d′⟩−⟨a′d′⟩⟨b′c′⟩\{abcd\}=\langle a'b'c'd'\rangle-\langle a'b'\rangle\langle c'd'\rangle-\langle a'c'\rangle\langle b'd'\rangle-\langle a'd'\rangle\langle b'c'\rangle{abcd}=⟨a′b′c′d′⟩−⟨a′b′⟩⟨c′d′⟩−⟨a′c′⟩⟨b′d′⟩−⟨a′d′⟩⟨b′c′⟩ with x′=x−⟨x⟩x'=x-\langle x\ranglex′=x−⟨x⟩. The intensity correlation is C=ε0L12ω2c2[⟨∣S1∣2∣S2∣2⟩−⟨∣S1∣2⟩⟨∣S2∣2⟩]C=\frac{\varepsilon_0}{L_1^2}\frac{\omega^2}{c^2}[\langle|S_1|^2|S_2|^2\rangle-\langle|S_1|^2\rangle\langle|S_2|^2\rangle]C=L12​ε0​​c2ω2​[⟨∣S1​∣2∣S2​∣2⟩−⟨∣S1​∣2⟩⟨∣S2​∣2⟩]. Under the memory-effect condition a feature at θs\theta_sθs​ for incidence θ0\theta_0θ0​ moves, at incidence θ\thetaθ, to arcsin⁡(sin⁡θ+sin⁡θs−sin⁡θ0)\arcsin(\sin\theta+\sin\theta_s-\sin\theta_0)arcsin(sinθ+sinθs​−sinθ0​).

Formalization Note The paper's amplitudes for an infinite rough surface are distributions in qqq. Only their specular δ\deltaδ-part and regular part enter here, through item 5. I(γ∣q)I(\gamma|q)I(γ∣q) and ζ~(n)\tilde\zeta^{(n)}ζ~​(n) are taken over a surface of finite length LLL, the setting of the paper's numerics, where they are ordinary integrals. Where only α(q)2=εω2/c2−q2\alpha(q)^2=\varepsilon\omega^2/c^2-q^2α(q)2=εω2/c2−q2 and α0(q)2=ω2/c2−q2\alpha_0(q)^2=\omega^2/c^2-q^2α0​(q)2=ω2/c2−q2 are used, α,α0\alpha,\alpha_0α,α0​ are arbitrary complex functions satisfying these relations, not a fixed branch of the square root. The paper's printed normal vector (ζ′e1+e3)/1+ζ′2(\zeta'e_1+e_3)/\sqrt{1+\zeta'^2}(ζ′e1​+e3​)/1+ζ′2​ has a sign slip. The normal used here is (−ζ′,0,1)/1+ζ′2(-\zeta',0,1)/\sqrt{1+\zeta'^2}(−ζ′,0,1)/1+ζ′2​, the one for which n⋅∇n\cdot\nablan⋅∇ is the paper's ∂n\partial_n∂n​.

Definition code
import Mathlib

/-!
I. Simonsen, *A random walk through surface scattering phenomena: Theory and phenomenology*,
arXiv:cond-mat/0408017v1 (2004): the objects used in the derivations of Sections II-IV.

* Sec. II.C-D: the primary field `Φ_ν` (`H₂` for `p`, `E₂` for `s`) and the fields it
  determines, the normal vector and normal derivative on `x₃ = ζ(x₁)`, the planar surface
  plasmon polariton (SPP) ansatz and the free-electron dielectric function.
* Sec. II.G: the rms height difference of a random profile.
* Sec. III: kernels of the form `2πδ(q-k) d(k) + r(q,k)`, the mean differential reflection
  coefficient (DRC), the S-matrix in the radiative region, the matrix elements of the reduced
  Rayleigh equation (RRE), their small-amplitude expansion, the Fresnel coefficients, the
  Lippmann-Schwinger equation and the first two orders of the scattering potential.
* Sec. IV: the phases of double-scattering paths, the support of the West-O'Donnell power
  spectrum, the least-squares slope, and the angular intensity correlation function.

Coordinates `(x₁, x₂, x₃)` of vectors in `Fin 3 → ℂ` are the indices `0, 1, 2`. `α(q)` and
`α₀(q)` denote the vertical wave numbers in the lower medium and in vacuum,
`α(q)² = ε (ω/c)² - q²` and `α₀(q)² = (ω/c)² - q²`; where only these relations are used, they
are hypotheses on arbitrary complex numbers rather than a fixed branch of the square root.
-/

open MeasureTheory Complex

noncomputable section

namespace CondMat0408017

/-! ### Sec. II.C: boundary conditions for the primary field -/

/-- The two linear polarizations `ν = p, s` (Sec. II.C.1). -/
inductive Polarization
  | p
  | s

/-- The unit normal `n = (-ζ', 0, 1)/√(1 + ζ'²)` to the interface `x₃ = ζ(x₁)` at a point where
`ζ'(x₁) = dζ`, directed into medium `+` (Sec. II.C.1; it is the vector for which
`n · ∇ = ∂_n` of eq. (Elmag:normal-derivative)). -/
def surfaceNormal (dζ : ℝ) : Fin 3 → ℂ :=
  ((Real.sqrt (1 + dζ ^ 2))⁻¹ : ℂ) • ![-(dζ : ℂ), 0, 1]

/-- The normal derivative `∂_n Φ = (-ζ' ∂_{x₁}Φ + ∂_{x₃}Φ)/√(1 + ζ'²)` of eq.
(Elmag:normal-derivative), from the partial derivatives `d1 = ∂_{x₁}Φ`, `d3 = ∂_{x₃}Φ`. -/
def normalDeriv (dζ : ℝ) (d1 d3 : ℂ) : ℂ :=
  (-(dζ : ℂ) * d1 + d3) / (Real.sqrt (1 + dζ ^ 2) : ℂ)

/-- The fields `(E, H)` at a point, determined by the value `Φ` of the primary field and its
partial derivatives `d1 = ∂_{x₁}Φ`, `d3 = ∂_{x₃}Φ` (eqs. (Elmag:Primary-fields),
(Elmag:BS:p-pol), (Elmag:BS:s-pol)). For `p`: `H = (0, Φ, 0)`,
`E = (-(i/ωε) ∂₃Φ, 0, (i/ωε) ∂₁Φ)`. For `s`: `E = (0, Φ, 0)`,
`H = ((i/ωμ) ∂₃Φ, 0, -(i/ωμ) ∂₁Φ)`. Here `κ = ε` for `p` and `κ = μ` for `s`. -/
def emFields (ν : Polarization) (ω : ℝ) (κ Φ d1 d3 : ℂ) : (Fin 3 → ℂ) × (Fin 3 → ℂ) :=
  match ν with
  | .p => (![-(I / ((ω : ℂ) * κ)) * d3, 0, (I / ((ω : ℂ) * κ)) * d1], ![0, Φ, 0])
  | .s => (![0, Φ, 0], ![(I / ((ω : ℂ) * κ)) * d3, 0, -(I / ((ω : ℂ) * κ)) * d1])

/-! ### Sec. II.D: surface plasmon polaritons at a planar interface -/

/-- The decay constant `β(ω) = √(k² - ε (ω/c)²)` of eq. (Elmag:beta-def), for a real dielectric
constant `ε`. -/
def decayConst (eps k ω c : ℝ) : ℝ :=
  Real.sqrt (k ^ 2 - eps * (ω / c) ^ 2)

/-- The surface-localized field above the planar interface (`x₃ > 0`),
`Φ⁺(x₁, x₃) = A⁺ e^{-β₊ x₃} e^{ikx₁}` (eq. (Elmag:SPP-fields)). -/
def planarModeUpper (A : ℂ) (β k : ℝ) (x1 x3 : ℝ) : ℂ :=
  A * cexp (-(β : ℂ) * x3) * cexp (I * k * x1)

/-- The surface-localized field below the planar interface (`x₃ < 0`),
`Φ⁻(x₁, x₃) = A⁻ e^{β₋ x₃} e^{ikx₁}` (eq. (Elmag:SPP-fields)). -/
def planarModeLower (A : ℂ) (β k : ℝ) (x1 x3 : ℝ) : ℂ :=
  A * cexp ((β : ℂ) * x3) * cexp (I * k * x1)

/-- The boundary conditions (Elmag:BCSa), (Elmag:BCSb) on the planar interface `x₃ = 0`, where
`∂_n = ∂_{x₃}`: `Φ⁺ = Φ⁻` and `(1/κ⁺) ∂_{x₃}Φ⁺ = (1/κ⁻) ∂_{x₃}Φ⁻` at every point `x₁`. -/
def FlatInterfaceBC (κP κM : ℂ) (ΦP ΦM : ℝ → ℝ → ℂ) : Prop :=
  ∀ x1 : ℝ, ΦP x1 0 = ΦM x1 0 ∧ deriv (ΦP x1) 0 / κP = deriv (ΦM x1) 0 / κM

/-- A `p`-polarized surface plasmon polariton of wave number `k` and frequency `ω` exists at the
planar interface between media of real dielectric constants `ε₊` (above) and `ε₋` (below)
(Sec. II.D.1): both decay constants are real and positive, and the boundary conditions with
`κ^± = ε_±` have a non-zero solution of the form (Elmag:SPP-fields). -/
def IsPlanarSPP (epsP epsM k ω c : ℝ) : Prop :=
  0 < k ^ 2 - epsP * (ω / c) ^ 2 ∧ 0 < k ^ 2 - epsM * (ω / c) ^ 2 ∧
    ∃ AP AM : ℂ, (AP ≠ 0 ∨ AM ≠ 0) ∧
      FlatInterfaceBC epsP epsM (planarModeUpper AP (decayConst epsP k ω c) k)
        (planarModeLower AM (decayConst epsM k ω c) k)

/-- The dielectric function of a free-electron metal, `ε(ω) = ε_∞ (1 - ω_p²/ω²)`
(eq. (Elmag:eps-free-electron-metal)), with background dielectric constant `ε_∞` and plasma
frequency `ω_p`. -/
def freeElectronEps (epsInf ωp ω : ℝ) : ℝ :=
  epsInf * (1 - ωp ^ 2 / ω ^ 2)

/-- The SPP frequency of eq. (Elmag:SPP-free-metal),
`ω_sp(k) = [½(k²c²(1+ε_∞)/ε_∞ + ω_p²) - ½√((k²c²(1+ε_∞)/ε_∞ + ω_p²)² - 4k²c²ω_p²)]^{1/2}`. -/
def omegaSP (epsInf ωp c k : ℝ) : ℝ :=
  Real.sqrt (1 / 2 * (k ^ 2 * c ^ 2 / epsInf * (1 + epsInf) + ωp ^ 2) -
    1 / 2 * Real.sqrt ((k ^ 2 * c ^ 2 / epsInf * (1 + epsInf) + ωp ^ 2) ^ 2 -
      4 * k ^ 2 * c ^ 2 * ωp ^ 2))

/-! ### Sec. II.G: self-affine surfaces -/

/-- The rms height difference `σ(Δx₁) = ⟨(ζ(x₁ + Δx₁) - ζ(x₁))²⟩^{1/2}` of eq.
(Eq:CHAR:rms-top) for a random profile `ζ(x₁, ·)` on a probability space, evaluated at the base
point `x₁ = 0`; for a profile with stationary increments it does not depend on the base point. -/
def rmsHeightDiff {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) (ζ : ℝ → Ω → ℝ) (Δ : ℝ) : ℝ :=
  Real.sqrt (∫ w, (ζ Δ w - ζ 0 w) ^ 2 ∂P)

/-! ### Sec. III.C-D: mean differential reflection coefficient, S-matrix -/

/-- The mean differential reflection coefficient of eq. (Theory:meanDRC-total),
`⟨∂R/∂θ_s⟩ = (1/L₁)(ω/2πc)(cos²θ_s/cos θ₀) ⟨|R(q|k)|²⟩`, where `Rq` is the random amplitude
`R(q|k)` at `k = (ω/c) sin θ₀`, `q = (ω/c) sin θ_s`. -/
def meanDRC {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) (L1 ω c θ0 θs : ℝ) (Rq : Ω → ℂ) : ℝ :=
  1 / L1 * (ω / (2 * Real.pi * c)) * (Real.cos θs ^ 2 / Real.cos θ0) * ∫ w, ‖Rq w‖ ^ 2 ∂P

/-- The incoherent part of the mean DRC, eq. (Theory:meanDRC-incohr):
`(1/L₁)(ω/2πc)(cos²θ_s/cos θ₀) [⟨|R(q|k)|²⟩ - |⟨R(q|k)⟩|²]`. -/
def incoherentMeanDRC {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) (L1 ω c θ0 θs : ℝ)
    (Rq : Ω → ℂ) : ℝ :=
  1 / L1 * (ω / (2 * Real.pi * c)) * (Real.cos θs ^ 2 / Real.cos θ0) *
    ((∫ w, ‖Rq w‖ ^ 2 ∂P) - ‖∫ w, Rq w ∂P‖ ^ 2)

/-- `α₀(q) = √((ω/c)² - q²)` in the radiative region `|q| ≤ ω/c`, with `wv = ω/c`
(eq. (47)). -/
def alpha0Rad (wv q : ℝ) : ℝ :=
  Real.sqrt (wv ^ 2 - q ^ 2)

/-- The scattering matrix `S(q|k) = √(α₀(q)/α₀(k)) R(q|k)` of eq. (Theory:Eq:S-matrix-def), for
`|q|, |k| < ω/c`, `wv = ω/c`; `R` is the function `q ↦ R(q|k)`. -/
def sMatrixRad (wv k : ℝ) (R : ℝ → ℂ) (q : ℝ) : ℂ :=
  (Real.sqrt (alpha0Rad wv q / alpha0Rad wv k) : ℂ) * R q

/-! ### Sec. III: kernels with a specular part -/

/-- A kernel `K(q|k) = 2π δ(q - k) d(k) + r(q, k)`: the specular (δ-function) part with
coefficient `d = diag` and the regular part `r = reg`. Scattering amplitudes, Green's functions
and their zeroth-order terms in Sec. III have this form (eqs. (86a), (91), (100a)). -/
structure DKernel where
  diag : ℝ → ℂ
  reg : ℝ → ℝ → ℂ

/-- `∫ dq/2π N(p|q) K(q|k)` for an ordinary function `N` and a kernel `K` with specular part:
the δ-function contributes `N(p|k) d(k)`, the regular part `∫ dq/2π N(p|q) r(q, k)`. -/
def DKernel.applyLeft (N : ℝ → ℝ → ℂ) (K : DKernel) (p k : ℝ) : ℂ :=
  N p k * K.diag k + ∫ q, N p q * K.reg q k / (2 * Real.pi)

/-! ### Sec. III.E-F: reduced Rayleigh equation and small-amplitude perturbation theory -/

/-- The prefactor of `M^±_ν(p|q)` in eq. (Theory:RRE-matrix-elements),
`±[(p + κ q)(p - q)/(α(p) ∓ α₀(q)) + α(p) ± κ α₀(q)]`, with `sgn = ±1`, `a = α(p)`,
`a0 = α₀(q)`. The full matrix element is this times `I(α(p) ∓ α₀(q) | p - q)`. -/
def rreM (κ sgn : ℂ) (p q : ℝ) (a a0 : ℂ) : ℂ :=
  sgn * (((p : ℂ) + κ * q) * ((p : ℂ) - q) / (a - sgn * a0) + a + sgn * κ * a0)

/-- The prefactor of `N^±_p(p|q)` in eq. (Theory:RRE-p-b),
`±(pq ± α(p)α₀(q))/(α(p) ∓ α₀(q))`, with `sgn = ±1`, `a = α(p)`, `a0 = α₀(q)`. -/
def rreNp (sgn : ℂ) (p q : ℝ) (a a0 : ℂ) : ℂ :=
  sgn * ((p : ℂ) * q + sgn * a * a0) / (a - sgn * a0)

/-- The prefactor of `N^±_s(p|q)` in eq. (Theory:RRE-s-b), `±1/(α(p) ∓ α₀(q))`. -/
def rreNs (sgn : ℂ) (a a0 : ℂ) : ℂ :=
  sgn / (a - sgn * a0)

/-- `I(γ|Q) = ∫ dx₁ e^{-iγζ(x₁)} e^{-iQx₁}` (eq. (Theory:zeta-int)) for a surface of length `L`,
`-L/2 < x₁ < L/2`. -/
def zetaIntL (ζ : ℝ → ℝ) (L : ℝ) (γ : ℂ) (Q : ℝ) : ℂ :=
  ∫ x in (-(L / 2))..(L / 2), cexp (-I * γ * ζ x - I * Q * x)

/-- `ζ̃^{(n)}(Q) = ∫ dx₁ ζ(x₁)ⁿ e^{-iQx₁}` (eq. (Theory:int-expansion)) for a surface of length
`L`. -/
def zetaPowFT (ζ : ℝ → ℝ) (L : ℝ) (n : ℕ) (Q : ℝ) : ℂ :=
  ∫ x in (-(L / 2))..(L / 2), (ζ x : ℂ) ^ n * cexp (-I * Q * x)

/-- The expansion coefficients `𝒩^{±(n)}_p(p|q)` of eq. (Eq:Theorey:SMPT:N-expansion):
for `n ≥ 1`, `(-i)ⁿ [±pq + α(p)α₀(q)] [α(p) ∓ α₀(q)]^{n-1}`; for `n = 0`, the `n = 0` term of the
expansion of `N^±_p`, `±(pq ± α(p)α₀(q))/(α(p) ∓ α₀(q))`. -/
def rreNpCoeff (sgn : ℂ) (n : ℕ) (p q : ℝ) (a a0 : ℂ) : ℂ :=
  if n = 0 then rreNp sgn p q a a0
  else (-I) ^ n * (sgn * p * q + a * a0) * (a - sgn * a0) ^ (n - 1)

/-- The expansion coefficients `𝒩^{±(n)}_s(p|q)` of eq. (Eq:Theorey:SMPT:N-expansion):
for `n ≥ 1`, `±(-i)ⁿ [α(p) ∓ α₀(q)]^{n-1}`; for `n = 0`, `±1/(α(p) ∓ α₀(q))`. -/
def rreNsCoeff (sgn : ℂ) (n : ℕ) (a a0 : ℂ) : ℂ :=
  if n = 0 then rreNs sgn a a0 else sgn * (-I) ^ n * (a - sgn * a0) ^ (n - 1)

/-- The Fresnel coefficient for `p` polarization with vacuum above (`ε₀ = 1`),
`(ε α₀(k) - α(k))/(ε α₀(k) + α(k))` (eq. (Theory:Fresnel)). -/
def fresnelP (eps a a0 : ℂ) : ℂ :=
  (eps * a0 - a) / (eps * a0 + a)

/-- The Fresnel coefficient for `s` polarization, `(α₀(k) - α(k))/(α₀(k) + α(k))`
(eq. (Theory:Fresnel)). -/
def fresnelS (a a0 : ℂ) : ℂ :=
  (a0 - a) / (a0 + a)

/-! ### Sec. III.G-H: transition matrix, scattering potential, renormalized Green's function -/

/-- The Lippmann-Schwinger equation (Theory:Rough-green-a) for the renormalized Green's function,
`G(q|k) = 2πδ(q - k) G⁰(k) + G⁰(q) ∫ dp/2π V(q|p) G(p|k)`, for `G` with a specular part and a
regular scattering potential `V`: its specular part is `G⁰`, and its regular part satisfies
`r(q, k) = G⁰(q) [V(q|k) d(k) + ∫ dp/2π V(q|p) r(p, k)]`. -/
def IsLippmannSchwinger (G0 : ℝ → ℂ) (V : ℝ → ℝ → ℂ) (G : DKernel) : Prop :=
  (∀ k, G.diag k = G0 k) ∧ ∀ q k, G.reg q k = G0 q * DKernel.applyLeft V G q k

/-- The first-order scattering potential `V^{(1)}_ν(q|k)` of eq. (Eq:Scattering-pot), quoted from
Maradudin and Méndez (1993): `i (ε-1)/ε² [ε qk - α(q)α(k)] ζ̃⁽¹⁾(q-k)` for `p` and
`i (ω/c)² (ε-1) ζ̃⁽¹⁾(q-k)` for `s`; `wv = ω/c`, `ζ1 = ζ̃⁽¹⁾`. -/
def scatPotV1 (ν : Polarization) (eps : ℂ) (wv : ℝ) (α : ℝ → ℂ) (ζ1 : ℝ → ℂ) (q k : ℝ) : ℂ :=
  match ν with
  | .p => I * (eps - 1) / eps ^ 2 * (eps * q * k - α q * α k) * ζ1 (q - k)
  | .s => I * (wv : ℂ) ^ 2 * (eps - 1) * ζ1 (q - k)

/-- The second-order scattering potential `V^{(2)}_ν(q|k)` of eq. (Eq:Scattering-pot):
for `p`, `i (ε-1)/ε² [α(q)+α(k)][qk - α(q)α(k)] ζ̃⁽²⁾(q-k)
+ 2i (ε-1)²/ε³ α(q) ∫ dp/2π ζ̃⁽¹⁾(q-p) α(p) ζ̃⁽¹⁾(p-k) α(k)`; for `s`,
`i (ω/c)² (ε-1) [α(q)+α(k)] ζ̃⁽²⁾(q-k)`; `ζ1 = ζ̃⁽¹⁾`, `ζ2 = ζ̃⁽²⁾`. -/
def scatPotV2 (ν : Polarization) (eps : ℂ) (wv : ℝ) (α : ℝ → ℂ) (ζ1 ζ2 : ℝ → ℂ) (q k : ℝ) : ℂ :=
  match ν with
  | .p => I * (eps - 1) / eps ^ 2 * (α q + α k) * ((q : ℂ) * k - α q * α k) * ζ2 (q - k) +
      2 * I * (eps - 1) ^ 2 / eps ^ 3 * α q *
        (∫ p, ζ1 (q - p) * α p * ζ1 (p - k) / (2 * Real.pi)) * α k
  | .s => I * (wv : ℂ) ^ 2 * (eps - 1) * (α q + α k) * ζ2 (q - k)

/-! ### Sec. IV.A: phases of double-scattering paths -/

/-- The wave vector `k₀ = √ε₀ (ω/c) (sin θ₀, -cos θ₀)` of the incident wave in the `(x₁, x₃)`
plane (incident medium of dielectric constant `ε₀`). -/
def incWaveVec (eps0 ω c θ0 : ℝ) : ℝ × ℝ :=
  (Real.sqrt eps0 * (ω / c) * Real.sin θ0, -(Real.sqrt eps0 * (ω / c) * Real.cos θ0))

/-- The wave vector `k_s = √ε₀ (ω/c) (sin θ_s, cos θ_s)` of the scattered wave. -/
def scatWaveVec (eps0 ω c θs : ℝ) : ℝ × ℝ :=
  (Real.sqrt eps0 * (ω / c) * Real.sin θs, Real.sqrt eps0 * (ω / c) * Real.cos θs)

/-- The Euclidean dot product on `ℝ × ℝ`. -/
def dot2 (u v : ℝ × ℝ) : ℝ :=
  u.1 * v.1 + u.2 * v.2

/-- The Euclidean length on `ℝ × ℝ`. -/
def eucl (u : ℝ × ℝ) : ℝ :=
  Real.sqrt (u.1 ^ 2 + u.2 ^ 2)

/-- The phase of a double-scattering path (Fig. (Fig:Phen:scat-path)) that enters at the
scattering centre `rIn`, travels to the centre `rOut` in a guided (or surface) mode of wave number
`q`, and leaves in the direction of `k_s`: `k₀ · rIn + q |rOut - rIn| - k_s · rOut`. -/
def pathPhase (k0 ks : ℝ × ℝ) (q : ℝ) (rIn rOut : ℝ × ℝ) : ℝ :=
  dot2 k0 rIn + q * eucl (rOut - rIn) - dot2 ks rOut

/-- The phase difference `Δφ_{nm}` between the double-scattering path `ĀCBD̄`, which visits `C`
then `B` through mode `n` of wave number `qn`, and the path `ABCD`, which visits `B` then `C`
through mode `m` of wave number `qm` (Sec. IV.A.3); the incident and scattered directions are
`θ₀` and `θ_s` in a medium of dielectric constant `ε₀`. -/
def doublePathPhaseDiff (eps0 ω c θ0 θs qn qm : ℝ) (rB rC : ℝ × ℝ) : ℝ :=
  pathPhase (incWaveVec eps0 ω c θ0) (scatWaveVec eps0 ω c θs) qn rC rB -
    pathPhase (incWaveVec eps0 ω c θ0) (scatWaveVec eps0 ω c θs) qm rB rC

/-! ### Sec. IV.C: memory effect -/

/-- The scattering angle `θ'_s = arcsin(sin θ + sin θ_s - sin θ₀)` to which a speckle feature at
`θ_s` for incidence `θ₀` moves when the angle of incidence becomes `θ`, under the condition of
equal momentum transfer `q' - k' = q - k` (eq. (PHEN:Eq:C1_condition)), with
`k = √ε₀ (ω/c) sin θ₀`, `q = √ε₀ (ω/c) sin θ_s` (eq. (151)). -/
def memoryShiftAngle (θ0 θs θ : ℝ) : ℝ :=
  Real.arcsin (Real.sin θ + (Real.sin θs - Real.sin θ0))

/-! ### Sec. IV.B: localization of surface plasmon polaritons -/

/-- The momentum transfers allowed by the West-O'Donnell power spectrum (Eq:Loc:power) of width
`2Δk` centred at `±2k₁`: `k₋ ≤ |Q| ≤ k₊` with `k_± = 2k₁ ± Δk`. -/
def westODonnellSupport (k1 Δk : ℝ) : Set ℝ :=
  {Q | 2 * k1 - Δk ≤ |Q| ∧ |Q| ≤ 2 * k1 + Δk}

/-- The ohmic mean free path `ℓ_ε(ω) = 1/(2k₂(ω))` of an SPP with `Im k_sp = k₂`
(Sec. IV.B.3). -/
def ohmicMeanFreePath (k2 : ℝ) : ℝ :=
  1 / (2 * k2)

/-- The slope of the least-squares straight line through the points `(x i, y i)`. -/
def olsSlope {m : ℕ} (x y : Fin m → ℝ) : ℝ :=
  (∑ i, (x i - (∑ j, x j) / m) * (y i - (∑ j, y j) / m)) / ∑ i, (x i - (∑ j, x j) / m) ^ 2

/-! ### Sec. IV.C: angular intensity correlation functions -/

/-- The incoherent component `δS = S - ⟨S⟩` of a random amplitude. -/
def fluct {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) (S : Ω → ℂ) : Ω → ℂ :=
  fun w => S w - ∫ v, S v ∂P

/-- The fourth-order joint cumulant
`{abcd} = ⟨a'b'c'd'⟩ - ⟨a'b'⟩⟨c'd'⟩ - ⟨a'c'⟩⟨b'd'⟩ - ⟨a'd'⟩⟨b'c'⟩` of complex random variables,
where `x' = x - ⟨x⟩`. -/
def cumulant4 {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) (a b c d : Ω → ℂ) : ℂ :=
  let a' := fluct P a
  let b' := fluct P b
  let c' := fluct P c
  let d' := fluct P d
  (∫ w, a' w * b' w * c' w * d' w ∂P) - (∫ w, a' w * b' w ∂P) * (∫ w, c' w * d' w ∂P) -
    (∫ w, a' w * c' w ∂P) * (∫ w, b' w * d' w ∂P) - (∫ w, a' w * d' w ∂P) * (∫ w, b' w * c' w ∂P)

/-- The angular intensity correlation function of eq. (Eq:Phen:Rewritten),
`C(q,k|q',k') = (ε₀/L₁²)(ω/c)² [⟨|S(q|k)|² |S(q'|k')|²⟩ - ⟨|S(q|k)|²⟩⟨|S(q'|k')|²⟩]`, with
`S1 = S(q|k)`, `S2 = S(q'|k')` and `wv = ω/c`. -/
def intensityCorrelation {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) (eps0 L1 wv : ℝ)
    (S1 S2 : Ω → ℂ) : ℝ :=
  eps0 / L1 ^ 2 * wv ^ 2 *
    ((∫ w, ‖S1 w‖ ^ 2 * ‖S2 w‖ ^ 2 ∂P) - (∫ w, ‖S1 w‖ ^ 2 ∂P) * ∫ w, ‖S2 w‖ ^ 2 ∂P)

end CondMat0408017
Source
I. Simonsen, A random walk through surface scattering phenomena: Theory and phenomenology, arXiv:cond-mat/0408017v1 (2004), Sec. II.C-D eqs. (Elmag:BS), (17)-(21); Sec. II.G eqs. (35)-(37); Sec. III.C-H eqs. (58)-(60), (63), (78)-(84), (86), (91)-(93), (97), (100a); Sec. IV.A-C eqs. (135), (139), (142)-(145), (Eq:Phen:Rewritten)-(PHEN:Eq:CN), (151)
Read-back

What the Lean code literally says, in plain math · claude-opus-5-5

Polarization is a type with exactly two distinct elements, named ppp and sss. No further structure is attached to them.


surfaceNormal takes a real number ddd (called dζd\zetadζ) and returns the complex 3-vector

n(d)=11+d2 (−d, 0, 1)∈C3.n(d) = \frac{1}{\sqrt{1+d^2}}\,\bigl(-d,\ 0,\ 1\bigr) \in \mathbb{C}^3 .n(d)=1+d2​1​(−d, 0, 1)∈C3.

The components are indexed 0,1,20,1,20,1,2. The square root is the real square root of 1+d2≥11+d^2 \ge 11+d2≥1, so the prefactor is always a well-defined positive real, viewed as a complex number. Nothing ties ddd to any surface profile; it is an arbitrary real input.


normalDeriv takes a real number ddd and complex numbers d1,d3d_1, d_3d1​,d3​, and returns

−d d1+d31+d2∈C.\frac{-d\,d_1 + d_3}{\sqrt{1+d^2}} \in \mathbb{C}.1+d2​−dd1​+d3​​∈C.

The denominator is the real square root of 1+d21+d^21+d2, which is never zero. The inputs d1,d3d_1, d_3d1​,d3​ are arbitrary complex numbers. They are not required to be partial derivatives of anything.


emFields takes a polarization ν∈{p,s}\nu\in\{p,s\}ν∈{p,s}, a real number ω\omegaω, and complex numbers κ,Φ,d1,d3\kappa, \Phi, d_1, d_3κ,Φ,d1​,d3​. It returns a pair (E,H)(E,H)(E,H) of complex 3-vectors (components indexed 0,1,20,1,20,1,2). Write c0=iωκc_0 = \dfrac{i}{\omega\kappa}c0​=ωκi​.

  • For ν=p\nu = pν=p:
E=(−c0 d3, 0, c0 d1),H=(0, Φ, 0).E = \bigl(-c_0\, d_3,\ 0,\ c_0\, d_1\bigr), \qquad H = (0,\ \Phi,\ 0).E=(−c0​d3​, 0, c0​d1​),H=(0, Φ, 0).
  • For ν=s\nu = sν=s:
E=(0, Φ, 0),H=(c0 d3, 0, −c0 d1).E = (0,\ \Phi,\ 0), \qquad H = \bigl(c_0\, d_3,\ 0,\ -c_0\, d_1\bigr).E=(0, Φ, 0),H=(c0​d3​, 0, −c0​d1​).

The same single parameter κ\kappaκ appears in both cases. If ω=0\omega = 0ω=0 or κ=0\kappa = 0κ=0, division by zero is evaluated as 000: then c0=0c_0 = 0c0​=0 and the corresponding components vanish. The inputs Φ,d1,d3\Phi, d_1, d_3Φ,d1​,d3​ are arbitrary complex numbers.


decayConst takes real numbers ε,k,ω,c\varepsilon, k, \omega, cε,k,ω,c and returns the real number

β=k2−ε (ω/c)2.\beta = \sqrt{k^2 - \varepsilon\,(\omega/c)^2}.β=k2−ε(ω/c)2​.

Three edge cases apply:

  • The real square root returns 000 when its argument is negative, so β=0\beta = 0β=0 whenever k2<ε(ω/c)2k^2 < \varepsilon(\omega/c)^2k2<ε(ω/c)2.
  • If c=0c = 0c=0, then ω/c\omega/cω/c is evaluated as 000 and β=∣k∣\beta = |k|β=∣k∣.
  • The result is always ≥0\ge 0≥0.

planarModeUpper takes A∈CA\in\mathbb{C}A∈C, real numbers β,k\beta, kβ,k, and real coordinates x1,x3x_1, x_3x1​,x3​. It returns

Φ+(x1,x3)=A e−βx3 eikx1.\Phi^+(x_1,x_3) = A\, e^{-\beta x_3}\, e^{i k x_1}.Φ+(x1​,x3​)=Ae−βx3​eikx1​.

It is defined for all real x3x_3x3​, not only x3>0x_3>0x3​>0.


planarModeLower takes A∈CA\in\mathbb{C}A∈C, real numbers β,k\beta, kβ,k, and real coordinates x1,x3x_1, x_3x1​,x3​. It returns

Φ−(x1,x3)=A eβx3 eikx1.\Phi^-(x_1,x_3) = A\, e^{\beta x_3}\, e^{i k x_1}.Φ−(x1​,x3​)=Aeβx3​eikx1​.

It is defined for all real x3x_3x3​, not only x3<0x_3<0x3​<0.


FlatInterfaceBC takes complex numbers κ+,κ−\kappa^+, \kappa^-κ+,κ− and two functions Φ+,Φ−:R×R→C\Phi^+, \Phi^- : \mathbb{R}\times\mathbb{R}\to\mathbb{C}Φ+,Φ−:R×R→C, whose arguments are written (x1,x3)(x_1,x_3)(x1​,x3​). It is the proposition that for every real x1x_1x1​ both of the following hold:

Φ+(x1,0)=Φ−(x1,0)and1κ+ ∂x3Φ+(x1,x3)∣x3=0=1κ− ∂x3Φ−(x1,x3)∣x3=0.\Phi^+(x_1,0) = \Phi^-(x_1,0) \qquad\text{and}\qquad \frac{1}{\kappa^+}\,\partial_{x_3}\Phi^+(x_1,x_3)\big|_{x_3=0} = \frac{1}{\kappa^-}\,\partial_{x_3}\Phi^-(x_1,x_3)\big|_{x_3=0}.Φ+(x1​,0)=Φ−(x1​,0)andκ+1​∂x3​​Φ+(x1​,x3​)​x3​=0​=κ−1​∂x3​​Φ−(x1​,x3​)​x3​=0​.

Here ∂x3\partial_{x_3}∂x3​​ is the ordinary derivative in the second argument with x1x_1x1​ held fixed. Two junk-value conventions apply:

  • If that derivative does not exist at 000, it is taken to be 000.
  • If κ±=0\kappa^\pm = 0κ±=0, the corresponding quotient is 000.

IsPlanarSPP takes real numbers ε+,ε−,k,ω,c\varepsilon_+, \varepsilon_-, k, \omega, cε+​,ε−​,k,ω,c. It is the proposition that all three of the following hold:

  1. 0<k2−ε+(ω/c)20 < k^2 - \varepsilon_+(\omega/c)^20<k2−ε+​(ω/c)2;
  2. 0<k2−ε−(ω/c)20 < k^2 - \varepsilon_-(\omega/c)^20<k2−ε−​(ω/c)2;
  3. there exist complex numbers A+,A−A^+, A^-A+,A−, not both zero, such that the interface condition above holds. The condition uses κ+=ε+\kappa^+ = \varepsilon_+κ+=ε+​ and κ−=ε−\kappa^- = \varepsilon_-κ−=ε−​ (viewed as complex numbers), with
Φ+(x1,x3)=A+e−β+x3eikx1,Φ−(x1,x3)=A−eβ−x3eikx1.\Phi^+(x_1,x_3) = A^+ e^{-\beta_+ x_3} e^{ikx_1}, \qquad \Phi^-(x_1,x_3) = A^- e^{\beta_- x_3} e^{ikx_1}.Φ+(x1​,x3​)=A+e−β+​x3​eikx1​,Φ−(x1​,x3​)=A−eβ−​x3​eikx1​.

The decay constants are β±=k2−ε±(ω/c)2\beta_\pm = \sqrt{k^2-\varepsilon_\pm(\omega/c)^2}β±​=k2−ε±​(ω/c)2​ (real square root). By conditions 1–2 they are strictly positive. Concretely, condition 3 asks that for every x1x_1x1​:

  • A+eikx1=A−eikx1A^+ e^{ikx_1} = A^- e^{ikx_1}A+eikx1​=A−eikx1​;
  • the x3x_3x3​-derivatives at 000, divided by ε+\varepsilon_+ε+​ and ε−\varepsilon_-ε−​ respectively, agree.

Edge cases:

  • If c=0c=0c=0, then ω/c\omega/cω/c is treated as 000.
  • If ε+\varepsilon_+ε+​ or ε−\varepsilon_-ε−​ is 000, the corresponding quotient is 000.
  • No sign condition is imposed on ε±\varepsilon_\pmε±​, ω\omegaω, or ccc.

freeElectronEps takes real numbers ε∞,ωp,ω\varepsilon_\infty, \omega_p, \omegaε∞​,ωp​,ω and returns

ε(ω)=ε∞(1−ωp2ω2).\varepsilon(\omega) = \varepsilon_\infty\left(1 - \frac{\omega_p^2}{\omega^2}\right).ε(ω)=ε∞​(1−ω2ωp2​​).

At ω=0\omega = 0ω=0 the quotient is evaluated as 000, so the value is ε∞\varepsilon_\inftyε∞​.


omegaSP takes real numbers ε∞,ωp,c,k\varepsilon_\infty, \omega_p, c, kε∞​,ωp​,c,k. Set

X=k2c2ε∞(1+ε∞)+ωp2.X = \frac{k^2c^2}{\varepsilon_\infty}(1+\varepsilon_\infty) + \omega_p^2 .X=ε∞​k2c2​(1+ε∞​)+ωp2​.

The function returns the real number

ωsp=12X−12X2−4k2c2ωp2.\omega_{sp} = \sqrt{\tfrac12 X - \tfrac12\sqrt{X^2 - 4k^2c^2\omega_p^2}} .ωsp​=21​X−21​X2−4k2c2ωp2​​​.

Both square roots are real square roots that return 000 for negative arguments. If ε∞=0\varepsilon_\infty = 0ε∞​=0, the quotient k2c2/ε∞k^2c^2/\varepsilon_\inftyk2c2/ε∞​ is evaluated as 000, giving X=ωp2X = \omega_p^2X=ωp2​.


rmsHeightDiff takes a measure PPP on a measurable space Ω\OmegaΩ, a function ζ:R×Ω→R\zeta:\mathbb{R}\times\Omega\to\mathbb{R}ζ:R×Ω→R, and a real number Δ\DeltaΔ. It returns

σ(Δ)=∫Ω(ζ(Δ,w)−ζ(0,w))2 dP(w).\sigma(\Delta) = \sqrt{\int_\Omega \bigl(\zeta(\Delta,w)-\zeta(0,w)\bigr)^2\, dP(w)} .σ(Δ)=∫Ω​(ζ(Δ,w)−ζ(0,w))2dP(w)​.

The base point is fixed at 000. The following are not assumed:

  • that PPP is a probability (or even finite) measure;
  • that ζ\zetaζ is measurable;
  • that ζ\zetaζ has stationary increments.

If the integrand is not integrable, the integral is taken to be 000, giving σ=0\sigma = 0σ=0.


meanDRC takes a measure PPP on Ω\OmegaΩ, real numbers L1,ω,c,θ0,θsL_1, \omega, c, \theta_0, \theta_sL1​,ω,c,θ0​,θs​, and a function R:Ω→CR:\Omega\to\mathbb{C}R:Ω→C. It returns

1L1⋅ω2πc⋅cos⁡2θscos⁡θ0⋅∫Ω∣R(w)∣2 dP(w).\frac{1}{L_1}\cdot\frac{\omega}{2\pi c}\cdot\frac{\cos^2\theta_s}{\cos\theta_0}\cdot\int_\Omega |R(w)|^2\, dP(w).L1​1​⋅2πcω​⋅cosθ0​cos2θs​​⋅∫Ω​∣R(w)∣2dP(w).

Nothing links RRR to the angles, to ω\omegaω, or to ccc; RRR is an arbitrary function. The following junk values apply:

  • Any division by zero (L1=0L_1=0L1​=0, c=0c=0c=0, cos⁡θ0=0\cos\theta_0=0cosθ0​=0) makes that factor 000.
  • A non-integrable ∣R∣2|R|^2∣R∣2 gives integral 000.
  • PPP is an arbitrary measure.

incoherentMeanDRC has the same inputs as meanDRC and returns

1L1⋅ω2πc⋅cos⁡2θscos⁡θ0⋅(∫Ω∣R∣2 dP−∣∫ΩR dP∣2).\frac{1}{L_1}\cdot\frac{\omega}{2\pi c}\cdot\frac{\cos^2\theta_s}{\cos\theta_0}\cdot\left(\int_\Omega |R|^2\, dP - \left|\int_\Omega R\, dP\right|^2\right).L1​1​⋅2πcω​⋅cosθ0​cos2θs​​⋅(∫Ω​∣R∣2dP−​∫Ω​RdP​2).

The same conventions apply: division by zero gives 000, non-integrable integrands have integral 000, and PPP is an arbitrary measure. No complex conjugation or normalization of PPP is involved.


alpha0Rad takes real numbers www (called wvwvwv) and qqq and returns

α0(q)=w2−q2∈R.\alpha_0(q) = \sqrt{w^2 - q^2} \in \mathbb{R}.α0​(q)=w2−q2​∈R.

This is the real square root, so it is 000 whenever ∣q∣≥∣w∣|q| \ge |w|∣q∣≥∣w∣. It is defined for all qqq, not only ∣q∣≤w|q|\le w∣q∣≤w.


sMatrixRad takes real numbers w,kw, kw,k, a function R:R→CR:\mathbb{R}\to\mathbb{C}R:R→C, and a real number qqq. It returns

S(q)=α0(q)α0(k)  R(q),α0(x)=w2−x2.S(q) = \sqrt{\frac{\alpha_0(q)}{\alpha_0(k)}}\; R(q), \qquad \alpha_0(x) = \sqrt{w^2-x^2}.S(q)=α0​(k)α0​(q)​​R(q),α0​(x)=w2−x2​.

All square roots are real square roots that return 000 for negative arguments. No restriction ∣q∣,∣k∣<w|q|,|k|<w∣q∣,∣k∣<w is imposed. If ∣k∣≥∣w∣|k|\ge|w|∣k∣≥∣w∣ then α0(k)=0\alpha_0(k)=0α0​(k)=0, the quotient is 000, and S(q)=0S(q)=0S(q)=0. The parameter kkk enters only through α0(k)\alpha_0(k)α0​(k), not through RRR.


DKernel is a pair K=(d,r)K = (d, r)K=(d,r) consisting of:

  • an arbitrary function d:R→Cd:\mathbb{R}\to\mathbb{C}d:R→C (the "diagonal" part);
  • an arbitrary function r:R×R→Cr:\mathbb{R}\times\mathbb{R}\to\mathbb{C}r:R×R→C (the "regular" part).

No delta function or distribution appears; it is just these two functions.


DKernel.applyLeft takes N:R×R→CN:\mathbb{R}\times\mathbb{R}\to\mathbb{C}N:R×R→C, a kernel K=(d,r)K=(d,r)K=(d,r), and real numbers p,kp,kp,k. It returns

N(p,k) d(k)+∫RN(p,q) r(q,k)2π dq.N(p,k)\,d(k) + \int_{\mathbb{R}} \frac{N(p,q)\,r(q,k)}{2\pi}\, dq .N(p,k)d(k)+∫R​2πN(p,q)r(q,k)​dq.

The integral is the Lebesgue integral over all of R\mathbb{R}R. It is taken to be 000 if the integrand is not integrable.


rreM takes complex numbers κ,σ\kappa, \sigmaκ,σ (called sgnsgnsgn), real numbers p,qp, qp,q, and complex numbers a,a0a, a_0a,a0​. It returns

σ[(p+κq)(p−q)a−σa0+a+σκa0].\sigma\left[\frac{(p+\kappa q)(p-q)}{a - \sigma a_0} + a + \sigma\kappa a_0\right].σ[a−σa0​(p+κq)(p−q)​+a+σκa0​].

The parameter σ\sigmaσ is an arbitrary complex number, not restricted to ±1\pm1±1. The numbers a,a0a, a_0a,a0​ are arbitrary and not tied to p,qp, qp,q. If a=σa0a = \sigma a_0a=σa0​, the fraction is 000.


rreNp takes complex σ\sigmaσ, real p,qp, qp,q, and complex a,a0a, a_0a,a0​. It returns

σ (pq+σaa0)a−σa0.\frac{\sigma\,(pq + \sigma a a_0)}{a - \sigma a_0}.a−σa0​σ(pq+σaa0​)​.

The parameter σ\sigmaσ is an arbitrary complex number. The value is 000 when a=σa0a = \sigma a_0a=σa0​.


rreNs takes complex numbers σ,a,a0\sigma, a, a_0σ,a,a0​ and returns

σa−σa0,\frac{\sigma}{a - \sigma a_0},a−σa0​σ​,

which is 000 when a=σa0a = \sigma a_0a=σa0​. The parameter σ\sigmaσ is an arbitrary complex number.


zetaIntL takes a function ζ:R→R\zeta:\mathbb{R}\to\mathbb{R}ζ:R→R, a real LLL, a complex γ\gammaγ, and a real QQQ. It returns

I(γ ∣ Q)=∫−L/2L/2e−iγζ(x)−iQx dx.I(\gamma\,|\,Q) = \int_{-L/2}^{L/2} e^{-i\gamma\zeta(x) - iQx}\, dx .I(γ∣Q)=∫−L/2L/2​e−iγζ(x)−iQxdx.

This is an oriented interval integral:

  • for L<0L<0L<0 it is the negative of the integral over [L/2,−L/2][L/2,-L/2][L/2,−L/2];
  • for L=0L=0L=0 it is 000;
  • it is 000 if the integrand is not integrable.

zetaPowFT takes a function ζ:R→R\zeta:\mathbb{R}\to\mathbb{R}ζ:R→R, a real LLL, a natural number nnn, and a real QQQ. It returns

ζ~(n)(Q)=∫−L/2L/2ζ(x)n e−iQx dx.\tilde\zeta^{(n)}(Q) = \int_{-L/2}^{L/2} \zeta(x)^n\, e^{-iQx}\, dx .ζ~​(n)(Q)=∫−L/2L/2​ζ(x)ne−iQxdx.

The same oriented-integral conventions apply as for zetaIntL. For n=0n=0n=0 the integrand is e−iQxe^{-iQx}e−iQx.


rreNpCoeff takes complex σ\sigmaσ, a natural number nnn, real p,qp,qp,q, and complex a,a0a, a_0a,a0​. It returns:

  • for n=0n = 0n=0:
σ (pq+σaa0)a−σa0,\frac{\sigma\,(pq + \sigma a a_0)}{a-\sigma a_0},a−σa0​σ(pq+σaa0​)​,

which is 000 if a=σa0a=\sigma a_0a=σa0​;

  • for n≥1n\ge1n≥1:
(−i)n (σpq+aa0) (a−σa0) n−1.(-i)^n\,(\sigma pq + a a_0)\,(a-\sigma a_0)^{\,n-1}.(−i)n(σpq+aa0​)(a−σa0​)n−1.

The parameter σ\sigmaσ is an arbitrary complex number.


rreNsCoeff takes complex σ\sigmaσ, a natural number nnn, and complex a,a0a, a_0a,a0​. It returns:

  • for n=0n=0n=0:
σa−σa0,\frac{\sigma}{a-\sigma a_0},a−σa0​σ​,

which is 000 if a=σa0a = \sigma a_0a=σa0​;

  • for n≥1n \ge 1n≥1:
σ (−i)n (a−σa0) n−1.\sigma\,(-i)^n\,(a-\sigma a_0)^{\,n-1}.σ(−i)n(a−σa0​)n−1.

fresnelP takes complex numbers ε,a,a0\varepsilon, a, a_0ε,a,a0​ and returns

εa0−aεa0+a.\frac{\varepsilon a_0 - a}{\varepsilon a_0 + a}.εa0​+aεa0​−a​.

The value is 000 if εa0+a=0\varepsilon a_0 + a = 0εa0​+a=0. The numbers a,a0a, a_0a,a0​ are arbitrary.


fresnelS takes complex numbers a,a0a, a_0a,a0​ and returns

a0−aa0+a.\frac{a_0 - a}{a_0 + a}.a0​+aa0​−a​.

The value is 000 if a0+a=0a_0 + a = 0a0​+a=0.


IsLippmannSchwinger takes G0:R→CG^0:\mathbb{R}\to\mathbb{C}G0:R→C, V:R×R→CV:\mathbb{R}\times\mathbb{R}\to\mathbb{C}V:R×R→C, and a kernel G=(d,r)G=(d,r)G=(d,r) (as in DKernel). It is the proposition that both of the following hold:

  • d(k)=G0(k)d(k) = G^0(k)d(k)=G0(k) for every real kkk;
  • for all real q,kq,kq,k,
r(q,k)=G0(q)[V(q,k) d(k)+∫RV(q,p) r(p,k)2π dp].r(q,k) = G^0(q)\left[V(q,k)\,d(k) + \int_{\mathbb{R}}\frac{V(q,p)\,r(p,k)}{2\pi}\,dp\right].r(q,k)=G0(q)[V(q,k)d(k)+∫R​2πV(q,p)r(p,k)​dp].

If the integrand p↦V(q,p) r(p,k)p\mapsto V(q,p)\,r(p,k)p↦V(q,p)r(p,k) is not integrable, the integral counts as 000, and the equation then reads r(q,k)=G0(q)V(q,k)d(k)r(q,k) = G^0(q)V(q,k)d(k)r(q,k)=G0(q)V(q,k)d(k).


scatPotV1 takes a polarization ν\nuν, a complex ε\varepsilonε, a real www, functions α:R→C\alpha:\mathbb{R}\to\mathbb{C}α:R→C and ζ1:R→C\zeta_1:\mathbb{R}\to\mathbb{C}ζ1​:R→C, and real q,kq, kq,k. It returns:

  • for ν=p\nu=pν=p:
i(ε−1)ε2 (εqk−α(q)α(k)) ζ1(q−k);\frac{i(\varepsilon-1)}{\varepsilon^2}\,\bigl(\varepsilon qk - \alpha(q)\alpha(k)\bigr)\,\zeta_1(q-k);ε2i(ε−1)​(εqk−α(q)α(k))ζ1​(q−k);
  • for ν=s\nu = sν=s:
i w2(ε−1) ζ1(q−k).i\,w^2(\varepsilon-1)\,\zeta_1(q-k).iw2(ε−1)ζ1​(q−k).

The functions α\alphaα and ζ1\zeta_1ζ1​ are arbitrary. The sss case does not involve α\alphaα. For ε=0\varepsilon = 0ε=0 the ppp value is 000, because division by zero gives 000.


scatPotV2 takes the same inputs as scatPotV1 plus a further arbitrary function ζ2:R→C\zeta_2:\mathbb{R}\to\mathbb{C}ζ2​:R→C. It returns:

  • for ν=p\nu=pν=p:
i(ε−1)ε2(α(q)+α(k))(qk−α(q)α(k))ζ2(q−k)  +  2i(ε−1)2ε3 α(q)[∫Rζ1(q−p) α(p) ζ1(p−k)2π dp]α(k);\frac{i(\varepsilon-1)}{\varepsilon^2}\bigl(\alpha(q)+\alpha(k)\bigr)\bigl(qk-\alpha(q)\alpha(k)\bigr)\zeta_2(q-k) \;+\; \frac{2i(\varepsilon-1)^2}{\varepsilon^3}\,\alpha(q)\left[\int_{\mathbb{R}}\frac{\zeta_1(q-p)\,\alpha(p)\,\zeta_1(p-k)}{2\pi}\,dp\right]\alpha(k);ε2i(ε−1)​(α(q)+α(k))(qk−α(q)α(k))ζ2​(q−k)+ε32i(ε−1)2​α(q)[∫R​2πζ1​(q−p)α(p)ζ1​(p−k)​dp]α(k);
  • for ν=s\nu=sν=s:
i w2(ε−1)(α(q)+α(k))ζ2(q−k).i\,w^2(\varepsilon-1)\bigl(\alpha(q)+\alpha(k)\bigr)\zeta_2(q-k).iw2(ε−1)(α(q)+α(k))ζ2​(q−k).

Edge cases:

  • The integral is over all of R\mathbb{R}R and is 000 if the integrand is not integrable.
  • For ε=0\varepsilon=0ε=0 both ppp-terms are 000.
  • The sss case does not use ζ1\zeta_1ζ1​.

incWaveVec takes real numbers ε0,ω,c,θ0\varepsilon_0, \omega, c, \theta_0ε0​,ω,c,θ0​ and returns the real 2-vector

k0=(ε0 ωcsin⁡θ0, −ε0 ωccos⁡θ0).\mathbf{k}_0 = \Bigl(\sqrt{\varepsilon_0}\,\tfrac{\omega}{c}\sin\theta_0,\ -\sqrt{\varepsilon_0}\,\tfrac{\omega}{c}\cos\theta_0\Bigr).k0​=(ε0​​cω​sinθ0​, −ε0​​cω​cosθ0​).

The square root is the real square root, which is 000 for ε0<0\varepsilon_0<0ε0​<0. If c=0c=0c=0, then ω/c\omega/cω/c is 000.


scatWaveVec takes real numbers ε0,ω,c,θs\varepsilon_0, \omega, c, \theta_sε0​,ω,c,θs​ and returns

ks=(ε0 ωcsin⁡θs, ε0 ωccos⁡θs).\mathbf{k}_s = \Bigl(\sqrt{\varepsilon_0}\,\tfrac{\omega}{c}\sin\theta_s,\ \sqrt{\varepsilon_0}\,\tfrac{\omega}{c}\cos\theta_s\Bigr).ks​=(ε0​​cω​sinθs​, ε0​​cω​cosθs​).

The same conventions apply: the square root is 000 for ε0<0\varepsilon_0<0ε0​<0, and ω/c\omega/cω/c is 000 if c=0c=0c=0.


dot2 takes two real 2-vectors u,vu, vu,v and returns

u⋅v=u1v1+u2v2.u\cdot v = u_1v_1 + u_2v_2 .u⋅v=u1​v1​+u2​v2​.

eucl takes a real 2-vector uuu and returns

∣u∣=u12+u22.|u| = \sqrt{u_1^2+u_2^2} .∣u∣=u12​+u22​​.

pathPhase takes real 2-vectors k0,ks\mathbf{k}_0, \mathbf{k}_sk0​,ks​, a real number qqq, and real 2-vectors rin,rout\mathbf{r}_{in}, \mathbf{r}_{out}rin​,rout​. It returns

k0⋅rin+q ∣rout−rin∣−ks⋅rout.\mathbf{k}_0\cdot\mathbf{r}_{in} + q\,|\mathbf{r}_{out}-\mathbf{r}_{in}| - \mathbf{k}_s\cdot\mathbf{r}_{out}.k0​⋅rin​+q∣rout​−rin​∣−ks​⋅rout​.

doublePathPhaseDiff takes real numbers ε0,ω,c,θ0,θs,qn,qm\varepsilon_0, \omega, c, \theta_0, \theta_s, q_n, q_mε0​,ω,c,θ0​,θs​,qn​,qm​ and real 2-vectors rB,rC\mathbf{r}_B, \mathbf{r}_CrB​,rC​. Let k0\mathbf{k}_0k0​ and ks\mathbf{k}_sks​ be the vectors of incWaveVec and scatWaveVec built from (ε0,ω,c,θ0)(\varepsilon_0,\omega,c,\theta_0)(ε0​,ω,c,θ0​) and (ε0,ω,c,θs)(\varepsilon_0,\omega,c,\theta_s)(ε0​,ω,c,θs​). The function returns

[k0⋅rC+qn∣rB−rC∣−ks⋅rB]−[k0⋅rB+qm∣rC−rB∣−ks⋅rC].\Bigl[\mathbf{k}_0\cdot\mathbf{r}_C + q_n|\mathbf{r}_B-\mathbf{r}_C| - \mathbf{k}_s\cdot\mathbf{r}_B\Bigr] - \Bigl[\mathbf{k}_0\cdot\mathbf{r}_B + q_m|\mathbf{r}_C-\mathbf{r}_B| - \mathbf{k}_s\cdot\mathbf{r}_C\Bigr].[k0​⋅rC​+qn​∣rB​−rC​∣−ks​⋅rB​]−[k0​⋅rB​+qm​∣rC​−rB​∣−ks​⋅rC​].

Equivalently:

(k0+ks)⋅(rC−rB)+(qn−qm) ∣rB−rC∣.(\mathbf{k}_0+\mathbf{k}_s)\cdot(\mathbf{r}_C-\mathbf{r}_B) + (q_n-q_m)\,|\mathbf{r}_B-\mathbf{r}_C| .(k0​+ks​)⋅(rC​−rB​)+(qn​−qm​)∣rB​−rC​∣.

memoryShiftAngle takes real numbers θ0,θs,θ\theta_0, \theta_s, \thetaθ0​,θs​,θ and returns

arcsin⁡(sin⁡θ+sin⁡θs−sin⁡θ0).\arcsin\bigl(\sin\theta + \sin\theta_s - \sin\theta_0\bigr).arcsin(sinθ+sinθs​−sinθ0​).

The arcsine is extended to all reals by clamping: arguments >1>1>1 give π/2\pi/2π/2, and arguments <−1<-1<−1 give −π/2-\pi/2−π/2. The result does not involve ε0\varepsilon_0ε0​, ω\omegaω, or ccc.


westODonnellSupport takes real numbers k1,Δkk_1, \Delta kk1​,Δk and returns the set

{ Q∈R:2k1−Δk≤∣Q∣≤2k1+Δk }.\{\,Q\in\mathbb{R} : 2k_1 - \Delta k \le |Q| \le 2k_1 + \Delta k\,\}.{Q∈R:2k1​−Δk≤∣Q∣≤2k1​+Δk}.

The set has the following edge cases:

  • It is empty if Δk<0\Delta k < 0Δk<0, and also if 2k1+Δk<02k_1+\Delta k<02k1​+Δk<0.
  • It contains Q=0Q=0Q=0 whenever 2k1−Δk≤0≤2k1+Δk2k_1-\Delta k \le 0 \le 2k_1+\Delta k2k1​−Δk≤0≤2k1​+Δk.
  • No sign condition is imposed on k1k_1k1​ or Δk\Delta kΔk.

ohmicMeanFreePath takes a real number k2k_2k2​ and returns

12k2.\frac{1}{2k_2}.2k2​1​.

The value is 000 when k2=0k_2 = 0k2​=0 and negative when k2<0k_2<0k2​<0.


olsSlope takes a natural number mmm and two real sequences x1,…,xmx_1,\dots,x_mx1​,…,xm​ and y1,…,ymy_1,\dots,y_my1​,…,ym​. Write xˉ=1m∑jxj\bar x = \frac1m\sum_j x_jxˉ=m1​∑j​xj​ and yˉ=1m∑jyj\bar y = \frac1m\sum_j y_jyˉ​=m1​∑j​yj​. The function returns

∑i=1m(xi−xˉ)(yi−yˉ)∑i=1m(xi−xˉ)2.\frac{\sum_{i=1}^m (x_i-\bar x)(y_i-\bar y)}{\sum_{i=1}^m (x_i-\bar x)^2}.∑i=1m​(xi​−xˉ)2∑i=1m​(xi​−xˉ)(yi​−yˉ​)​.

Division by zero gives 000. Hence:

  • for m=0m=0m=0 the means are 000, the sums are empty, and the result is 000;
  • if all xix_ixi​ are equal (including m=1m=1m=1), the result is 000.

fluct takes a measure PPP on Ω\OmegaΩ and a function S:Ω→CS:\Omega\to\mathbb{C}S:Ω→C. It returns the function

δS(w)=S(w)−∫ΩS dP.\delta S(w) = S(w) - \int_\Omega S\, dP .δS(w)=S(w)−∫Ω​SdP.

The measure PPP is arbitrary, not necessarily a probability measure. The integral is 000 if SSS is not integrable, in which case δS=S\delta S = SδS=S.


cumulant4 takes a measure PPP on Ω\OmegaΩ and functions a,b,c,d:Ω→Ca,b,c,d:\Omega\to\mathbb{C}a,b,c,d:Ω→C. Let a′=a−∫a dPa' = a - \int a\,dPa′=a−∫adP, and define b′,c′,d′b', c', d'b′,c′,d′ likewise. The function returns

∫a′b′c′d′ dP−∫a′b′ dP∫c′d′ dP−∫a′c′ dP∫b′d′ dP−∫a′d′ dP∫b′c′ dP.\int a'b'c'd'\,dP - \int a'b'\,dP\int c'd'\,dP - \int a'c'\,dP\int b'd'\,dP - \int a'd'\,dP\int b'c'\,dP .∫a′b′c′d′dP−∫a′b′dP∫c′d′dP−∫a′c′dP∫b′d′dP−∫a′d′dP∫b′c′dP.

The products are plain products, with no complex conjugation. PPP is an arbitrary measure. Every non-integrable integrand contributes 000.


intensityCorrelation takes a measure PPP on Ω\OmegaΩ, real numbers ε0,L1,w\varepsilon_0, L_1, wε0​,L1​,w, and functions S1,S2:Ω→CS_1, S_2:\Omega\to\mathbb{C}S1​,S2​:Ω→C. It returns

ε0L12 w2[∫Ω∣S1∣2∣S2∣2 dP−∫Ω∣S1∣2 dP∫Ω∣S2∣2 dP].\frac{\varepsilon_0}{L_1^2}\,w^2\left[\int_\Omega |S_1|^2|S_2|^2\,dP - \int_\Omega |S_1|^2\,dP\int_\Omega |S_2|^2\,dP\right].L12​ε0​​w2[∫Ω​∣S1​∣2∣S2​∣2dP−∫Ω​∣S1​∣2dP∫Ω​∣S2​∣2dP].

S1S_1S1​ and S2S_2S2​ are arbitrary functions and are not tied to any scattering setup. The following conventions apply:

  • The value is 000 if L1=0L_1=0L1​=0.
  • Non-integrable integrands contribute 000.
  • PPP is an arbitrary measure.
Human review
  • Endorsed by Shuze Chen · Nov 26, 2026

    Confirmed by the moderator at approval.

  • Endorsed by Xeroth · Nov 26, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me