Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

PINN loss, gradient flow, neural tangent kernel and the one-hidden-layer model problem

Definition
PINNNeuralTangent_Basic

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

gaussian-processesgradient-flowinfinite-width-limitneural-tangent-kernelphysics-informed-neural-networks

Objects of Sections 2-4 and Appendices C-D of Wang, Yu and Perdikaris (2020).

  1. Parameters and partial derivatives. The parameters of a network form a finite family θ=(θp)p∈P\theta=(\theta_p)_{p\in P}θ=(θp​)p∈P​. For a function FFF of the parameters, ∂F/∂θp\partial F/\partial\theta_p∂F/∂θp​ is the derivative of s↦F(θ with θp replaced by s)s\mapsto F(\theta \text{ with } \theta_p \text{ replaced by } s)s↦F(θ with θp​ replaced by s) at s=θps=\theta_ps=θp​. ∥v∥2=(∑ivi2)1/2\|v\|_2=(\sum_i v_i^2)^{1/2}∥v∥2​=(∑i​vi2​)1/2, and ∥A∥2=sup⁡∥v∥2≤1∥Av∥2\|A\|_2=\sup_{\|v\|_2\le1}\|Av\|_2∥A∥2​=sup∥v∥2​≤1​∥Av∥2​ is the spectral norm.
  2. PINN loss and gradient flow (eqs. 3.3-3.7). For a network u(x,θ)u(x,\theta)u(x,θ) on Rd\mathbb R^dRd, a differential operator L\mathcal LL, boundary points xb1,…,xbNbx_b^1,\dots,x_b^{N_b}xb1​,…,xbNb​​ and collocation points xr1,…,xrNrx_r^1,\dots,x_r^{N_r}xr1​,…,xrNr​​,
L(θ)=12∑i=1Nb∣u(xbi,θ)−g(xbi)∣2+12∑j=1Nr∣Lu(xrj,θ)−f(xrj)∣2.\mathcal L(\theta)=\tfrac12\sum_{i=1}^{N_b}|u(x_b^i,\theta)-g(x_b^i)|^2+\tfrac12\sum_{j=1}^{N_r}|\mathcal Lu(x_r^j,\theta)-f(x_r^j)|^2 .L(θ)=21​i=1∑Nb​​∣u(xbi​,θ)−g(xbi​)∣2+21​j=1∑Nr​​∣Lu(xrj​,θ)−f(xrj​)∣2.

A curve θ(t)\theta(t)θ(t), t∈[0,T]t\in[0,T]t∈[0,T], is a gradient flow if θ′(t)=−∇L(θ(t))\theta'(t)=-\nabla\mathcal L(\theta(t))θ′(t)=−∇L(θ(t)), with one-sided derivatives at the endpoints. 3. NTK of a PINN (eq. 3.9). (Kuu)ij=⟨∂θu(xbi,θ),∂θu(xbj,θ)⟩(K_{uu})_{ij}=\langle\partial_\theta u(x_b^i,\theta),\partial_\theta u(x_b^j,\theta)\rangle(Kuu​)ij​=⟨∂θ​u(xbi​,θ),∂θ​u(xbj​,θ)⟩, (Kur)ij=⟨∂θu(xbi,θ),∂θLu(xrj,θ)⟩(K_{ur})_{ij}=\langle\partial_\theta u(x_b^i,\theta),\partial_\theta\mathcal Lu(x_r^j,\theta)\rangle(Kur​)ij​=⟨∂θ​u(xbi​,θ),∂θ​Lu(xrj​,θ)⟩, (Kru)ij=⟨∂θLu(xri,θ),∂θu(xbj,θ)⟩(K_{ru})_{ij}=\langle\partial_\theta \mathcal Lu(x_r^i,\theta),\partial_\theta u(x_b^j,\theta)\rangle(Kru​)ij​=⟨∂θ​Lu(xri​,θ),∂θ​u(xbj​,θ)⟩, (Krr)ij=⟨∂θLu(xri,θ),∂θLu(xrj,θ)⟩(K_{rr})_{ij}=\langle\partial_\theta\mathcal Lu(x_r^i,\theta),\partial_\theta\mathcal Lu(x_r^j,\theta)\rangle(Krr​)ij​=⟨∂θ​Lu(xri​,θ),∂θ​Lu(xrj​,θ)⟩, where ⟨⋅,⋅⟩\langle\cdot,\cdot\rangle⟨⋅,⋅⟩ sums over all parameters. K=[KuuKurKruKrr]K=\begin{bmatrix}K_{uu}&K_{ur}\\K_{ru}&K_{rr}\end{bmatrix}K=[Kuu​Kru​​Kur​Krr​​]. 4. One-hidden-layer network (eqs. 4.2-4.3). For width NNN the parameters are W(0),W(1),b(0)∈RNW^{(0)},W^{(1)},b^{(0)}\in\mathbb R^NW(0),W(1),b(0)∈RN and b(1)∈Rb^{(1)}\in\mathbb Rb(1)∈R, and

u(x,θ)=1N∑k=1NWk(1)σ(Wk(0)x+bk(0))+b(1),uxx(x,θ)=∂x2u(x,θ).u(x,\theta)=\frac1{\sqrt N}\sum_{k=1}^NW^{(1)}_k\sigma(W^{(0)}_kx+b^{(0)}_k)+b^{(1)},\qquad u_{xx}(x,\theta)=\partial_x^2u(x,\theta).u(x,θ)=N​1​k=1∑N​Wk(1)​σ(Wk(0)​x+bk(0)​)+b(1),uxx​(x,θ)=∂x2​u(x,θ).

At initialization all 3N+13N+13N+1 parameters are independent N(0,1)\mathcal N(0,1)N(0,1). 5. Model problem (eq. 4.1). uxx=fu_{xx}=fuxx​=f on Ω=(a,b)\Omega=(a,b)Ω=(a,b), u=gu=gu=g on ∂Ω={a,b}\partial\Omega=\{a,b\}∂Ω={a,b}, with a<ba<ba<b, xbi∈{a,b}x_b^i\in\{a,b\}xbi​∈{a,b}, xrj∈(a,b)x_r^j\in(a,b)xrj​∈(a,b). Its loss and NTK are those of items 2-3 with Lu=uxx\mathcal Lu=u_{xx}Lu=uxx​. 6. Gaussian-process kernels (eqs. 2.4, 2.5, 4.6). With w,bw,bw,b independent standard Gaussians, Σ(1)(x,x′)=E[σ(wx+b)σ(wx′+b)]+1\Sigma^{(1)}(x,x')=E[\sigma(wx+b)\sigma(wx'+b)]+1Σ(1)(x,x′)=E[σ(wx+b)σ(wx′+b)]+1, Σ˙(1)(x,x′)=E[σ˙(wx+b)σ˙(wx′+b)]\dot\Sigma^{(1)}(x,x')=E[\dot\sigma(wx+b)\dot\sigma(wx'+b)]Σ˙(1)(x,x′)=E[σ˙(wx+b)σ˙(wx′+b)], Σxx(1)(x,x′)=E[w4σ¨(wx+b)σ¨(wx′+b)]\Sigma^{(1)}_{xx}(x,x')=E[w^4\ddot\sigma(wx+b)\ddot\sigma(wx'+b)]Σxx(1)​(x,x′)=E[w4σ¨(wx+b)σ¨(wx′+b)]. A probability measure γ\gammaγ on Rn\mathbb R^nRn is N(0,C)\mathcal N(0,C)N(0,C) if ∫ei⟨t,y⟩dγ(y)=e−t⊤Ct/2\int e^{i\langle t,y\rangle}d\gamma(y)=e^{-t^\top Ct/2}∫ei⟨t,y⟩dγ(y)=e−t⊤Ct/2 for all ttt. 7. Limiting NTK (Appendix C). Writing σ(k)\sigma^{(k)}σ(k) for σ(k)(wx+b)\sigma^{(k)}(wx+b)σ(k)(wx+b) and σ′(k)\sigma'^{(k)}σ′(k) for σ(k)(wx′+b)\sigma^{(k)}(wx'+b)σ(k)(wx′+b):

Θuu(x,x′)=Σ˙(1)(x,x′) xx′+E[σσ′]+Σ˙(1)(x,x′)+1,\Theta_{uu}(x,x')=\dot\Sigma^{(1)}(x,x')\,xx'+E[\sigma\sigma']+\dot\Sigma^{(1)}(x,x')+1,Θuu​(x,x′)=Σ˙(1)(x,x′)xx′+E[σσ′]+Σ˙(1)(x,x′)+1, Θur(x,x′)=E[w2σ(1)σ′(3)]xx′+2E[wσ(1)σ′(2)]x+E[w2σ σ′(2)]+E[w2σ(1)σ′(3)],\Theta_{ur}(x,x')=E[w^2\sigma^{(1)}\sigma'^{(3)}]xx'+2E[w\sigma^{(1)}\sigma'^{(2)}]x+E[w^2\sigma\,\sigma'^{(2)}]+E[w^2\sigma^{(1)}\sigma'^{(3)}],Θur​(x,x′)=E[w2σ(1)σ′(3)]xx′+2E[wσ(1)σ′(2)]x+E[w2σσ′(2)]+E[w2σ(1)σ′(3)], Θrr(x,x′)=E[w4σ(3)σ′(3)]xx′+2E[w3σ(3)σ′(2)]x+2E[w3σ′(3)σ(2)]x′+4E[w2σ(2)σ′(2)]+E[w4σ(2)σ′(2)]+E[w4σ(3)σ′(3)],\Theta_{rr}(x,x')=E[w^4\sigma^{(3)}\sigma'^{(3)}]xx'+2E[w^3\sigma^{(3)}\sigma'^{(2)}]x+2E[w^3\sigma'^{(3)}\sigma^{(2)}]x'+4E[w^2\sigma^{(2)}\sigma'^{(2)}]+E[w^4\sigma^{(2)}\sigma'^{(2)}]+E[w^4\sigma^{(3)}\sigma'^{(3)}],Θrr​(x,x′)=E[w4σ(3)σ′(3)]xx′+2E[w3σ(3)σ′(2)]x+2E[w3σ′(3)σ(2)]x′+4E[w2σ(2)σ′(2)]+E[w4σ(2)σ′(2)]+E[w4σ(3)σ′(3)],

and K∗=[Θuu(xbi,xbj)Θur(xbi,xrj)Θur(xbj,xri)Θrr(xri,xrj)]K^*=\begin{bmatrix}\Theta_{uu}(x_b^i,x_b^j)&\Theta_{ur}(x_b^i,x_r^j)\\\Theta_{ur}(x_b^j,x_r^i)&\Theta_{rr}(x_r^i,x_r^j)\end{bmatrix}K∗=[Θuu​(xbi​,xbj​)Θur​(xbj​,xri​)​Θur​(xbi​,xrj​)Θrr​(xri​,xrj​)​]. 8. Hypotheses of Theorem 4.4. A family of trajectories θN(t)\theta_N(t)θN​(t), one for each width NNN, satisfies (i) if ∣θN(t)p∣≤C|\theta_N(t)_p|\le C∣θN​(t)p​∣≤C for all NNN, t∈[0,T]t\in[0,T]t∈[0,T] and parameters ppp. It satisfies (ii) as printed if ∫0T∣∑i(u(xbi,θN(τ))−g(xbi))∣ dτ≤C\int_0^T|\sum_i(u(x_b^i,\theta_N(\tau))-g(x_b^i))|\,d\tau\le C∫0T​∣∑i​(u(xbi​,θN​(τ))−g(xbi​))∣dτ≤C and ∫0T∣∑j(uxx(xrj,θN(τ))−f(xrj))∣ dτ≤C\int_0^T|\sum_j(u_{xx}(x_r^j,\theta_N(\tau))-f(x_r^j))|\,d\tau\le C∫0T​∣∑j​(uxx​(xrj​,θN​(τ))−f(xrj​))∣dτ≤C for all NNN. It satisfies (ii) in the form the proof uses if the same bounds hold with the absolute value inside the sums. The activation satisfies (iii) if σ\sigmaσ is smooth and ∣σ(k)∣≤C|\sigma^{(k)}|\le C∣σ(k)∣≤C for k=0,…,4k=0,\dots,4k=0,…,4. In each case CCC does not depend on NNN.

Formalization Note Σ(1)\Sigma^{(1)}Σ(1) and Σ˙(1)\dot\Sigma^{(1)}Σ˙(1) are written as expectations over (wx+b,wx′+b)(wx+b,wx'+b)(wx+b,wx′+b), which has the covariance Λ(1)\Lambda^{(1)}Λ(1) of eq. (2.4). The limits Θ\ThetaΘ are the expectations that the law-of-large-numbers steps of Appendix C produce. Several of the closed forms printed there are wrong, and these definitions replace them; see the notes on Theorem 4.3. Condition (ii) is recorded in both forms: the printed form is used only in Lemma D.1, which does not depend on it.

Definition code
import Mathlib

/-!
Wang, Yu and Perdikaris, *When and why PINNs fail to train: A neural tangent kernel perspective*,
arXiv:2007.14527v1 (2020): the PINN loss, gradient flow and neural tangent kernel of Section 3
(eqs. (3.3)-(3.9)), the one-hidden-layer network of the model problem of Section 4
(eqs. (4.1)-(4.3)), the Gaussian-process and limiting kernels of Sections 2 and 4 and Appendix C,
and the hypotheses (i)-(iii) of Theorem 4.4.
-/

open MeasureTheory ProbabilityTheory
open scoped ContDiff

noncomputable section

namespace PINNNeuralTangent

section General

variable {P : Type*} [Fintype P] [DecidableEq P]

/-- Remark 3.2: the partial derivative `∂F/∂θ_p` of a function of the network parameters
`θ = (θ_p)_{p ∈ P}` with respect to the single parameter `θ_p`. -/
def pd (F : (P → ℝ) → ℝ) (θ : P → ℝ) (p : P) : ℝ :=
  deriv (fun s : ℝ => F (Function.update θ p s)) (θ p)

/-- Euclidean norm `‖v‖₂ = (∑ᵢ vᵢ²)^{1/2}` of a finite vector. -/
def l2norm {ι : Type*} [Fintype ι] (v : ι → ℝ) : ℝ := Real.sqrt (∑ i, v i ^ 2)

/-- Spectral norm `‖A‖₂ = sup_{‖v‖₂ ≤ 1} ‖Av‖₂` of a real square matrix (Theorem 4.4). -/
def specNorm {ι : Type*} [Fintype ι] (A : Matrix ι ι ℝ) : ℝ :=
  sSup ((fun v : ι → ℝ => l2norm (A.mulVec v)) '' {v | l2norm v ≤ 1})

/-- Eq. (3.9) and Remark 3.2: a block of the NTK of a PINN,
`(K_{FG})_{ij}(θ) = ⟨∂F_i/∂θ, ∂G_j/∂θ⟩ = ∑_p ∂F_i/∂θ_p · ∂G_j/∂θ_p`, for two families of network
outputs `F_i, G_j` viewed as functions of the parameters. -/
def ntkBlock {I J : Type*} (F : I → (P → ℝ) → ℝ) (G : J → (P → ℝ) → ℝ) (θ : P → ℝ) :
    Matrix I J ℝ :=
  fun i j => ∑ p, pd (F i) θ p * pd (G j) θ p

/-- Lemma 3.1 and Remark 3.3: the NTK of a PINN, `K = [[K_uu, K_ur], [K_ru, K_rr]]`, built from the
boundary outputs `U_i(θ) = u(x_b^i, θ)` and the operator outputs `R_j(θ) = 𝓛u(x_r^j, θ)`. -/
def pinnNTK {Nb Nr : ℕ} (U : Fin Nb → (P → ℝ) → ℝ) (R : Fin Nr → (P → ℝ) → ℝ) (θ : P → ℝ) :
    Matrix (Fin Nb ⊕ Fin Nr) (Fin Nb ⊕ Fin Nr) ℝ :=
  Matrix.fromBlocks (ntkBlock U U θ) (ntkBlock U R θ) (ntkBlock R U θ) (ntkBlock R R θ)

/-- Eqs. (3.4)-(3.6): the PINN loss `L(θ) = ½ ∑ᵢ |U_i(θ) - g_i|² + ½ ∑ⱼ |R_j(θ) - f_j|²`, where
`U_i(θ) = u(x_b^i, θ)`, `R_j(θ) = 𝓛u(x_r^j, θ)`, `g_i = g(x_b^i)` and `f_j = f(x_r^j)`. -/
def pinnLoss {Nb Nr : ℕ} (U : Fin Nb → (P → ℝ) → ℝ) (R : Fin Nr → (P → ℝ) → ℝ)
    (gb : Fin Nb → ℝ) (fr : Fin Nr → ℝ) (θ : P → ℝ) : ℝ :=
  (1 / 2) * ∑ i, (U i θ - gb i) ^ 2 + (1 / 2) * ∑ j, (R j θ - fr j) ^ 2

/-- Eq. (3.7): `θ(t)` solves the gradient flow `dθ/dt = -∇L(θ)` on the time interval `[0, T]`. -/
def IsGradFlow (L : (P → ℝ) → ℝ) (θ : ℝ → P → ℝ) (T : ℝ) : Prop :=
  ∀ t ∈ Set.Icc 0 T, HasDerivWithinAt θ (fun p => -pd L (θ t) p) (Set.Icc 0 T) t

/-- Section 3: the network output on the boundary points, `θ ↦ u(x_b^i, θ)`, for a network
`u(x, θ)` on `ℝ^d`. -/
def bdryOutputs {d Nb : ℕ} (u : (Fin d → ℝ) → (P → ℝ) → ℝ) (xb : Fin Nb → Fin d → ℝ) :
    Fin Nb → (P → ℝ) → ℝ :=
  fun i θ => u (xb i) θ

/-- Eq. (3.3): `𝓛u(x, θ)`, the differential operator `𝓛` applied to the network `x ↦ u(x, θ)`
and evaluated at `x`. -/
def opOutput {d : ℕ} (Lop : ((Fin d → ℝ) → ℝ) → (Fin d → ℝ) → ℝ)
    (u : (Fin d → ℝ) → (P → ℝ) → ℝ) (x : Fin d → ℝ) (θ : P → ℝ) : ℝ :=
  Lop (fun y => u y θ) x

/-- Section 3: the operator output on the collocation points, `θ ↦ 𝓛u(x_r^j, θ)`. -/
def opOutputs {d Nr : ℕ} (Lop : ((Fin d → ℝ) → ℝ) → (Fin d → ℝ) → ℝ)
    (u : (Fin d → ℝ) → (P → ℝ) → ℝ) (xr : Fin Nr → Fin d → ℝ) : Fin Nr → (P → ℝ) → ℝ :=
  fun j θ => opOutput Lop u (xr j) θ

end General

/-! ### The one-hidden-layer network of Section 4 -/

/-- Section 4, eq. (4.2): index set of the parameters `θ = (W^(0), W^(1), b^(0), b^(1))` of a
network of width `N`: `(0, k) ↦ W^(0)_k`, `(1, k) ↦ W^(1)_k`, `(2, k) ↦ b^(0)_k`, and the single
output bias `b^(1)`. -/
abbrev PIdx (N : ℕ) := (Fin 3 × Fin N) ⊕ Unit

/-- Index of the first-layer weight `W^(0)_k`. -/
def idxW0 {N : ℕ} (k : Fin N) : PIdx N := Sum.inl (0, k)

/-- Index of the output weight `W^(1)_k`. -/
def idxW1 {N : ℕ} (k : Fin N) : PIdx N := Sum.inl (1, k)

/-- Index of the hidden bias `b^(0)_k`. -/
def idxB0 {N : ℕ} (k : Fin N) : PIdx N := Sum.inl (2, k)

/-- Index of the output bias `b^(1)`. -/
def idxB1 {N : ℕ} : PIdx N := Sum.inr ()

/-- Eq. (4.2): the one-hidden-layer network in NTK parameterization,
`u(x, θ) = N^{-1/2} ∑_k W^(1)_k σ(W^(0)_k x + b^(0)_k) + b^(1)`. -/
def netU (σ : ℝ → ℝ) {N : ℕ} (θ : PIdx N → ℝ) (x : ℝ) : ℝ :=
  (1 / Real.sqrt N) * ∑ k, θ (idxW1 k) * σ (θ (idxW0 k) * x + θ (idxB0 k)) + θ idxB1

/-- Eq. (4.3): `u_xx(x, θ)`, the second derivative in `x` of the network `x ↦ u(x, θ)`. -/
def netUxx (σ : ℝ → ℝ) {N : ℕ} (θ : PIdx N → ℝ) (x : ℝ) : ℝ :=
  deriv (deriv (fun y => netU σ θ y)) x

/-- Section 4: the initialization, all weights and biases i.i.d. `𝒩(0, 1)`. -/
def initMeasure (N : ℕ) : Measure (PIdx N → ℝ) :=
  Measure.pi (fun _ : PIdx N => gaussianReal 0 1)

/-- `E_{w, b ∼ 𝒩(0,1)} F(w, b)` for independent standard Gaussians `w, b`. -/
def gaussE (F : ℝ → ℝ → ℝ) : ℝ :=
  ∫ z : ℝ × ℝ, F z.1 z.2 ∂((gaussianReal 0 1).prod (gaussianReal 0 1))

/-- Eq. (2.4) with `h = 1`: `Σ^(1)(x, x') = E_{(u,v) ∼ 𝒩(0, Λ^(1))}[σ(u)σ(v)] + 1`, where `Λ^(1)` is
built from `Σ^(0)(x, x') = x x' + 1`. Here `(u, v) = (w x + b, w x' + b)` with `w, b ∼ 𝒩(0,1)`
independent, which has covariance `Λ^(1)`. -/
def sigma1 (σ : ℝ → ℝ) (x x' : ℝ) : ℝ :=
  gaussE (fun w b => σ (w * x + b) * σ (w * x' + b)) + 1

/-- Eq. (2.5) with `h = 1`: `Σ̇^(1)(x, x') = E_{(u,v) ∼ 𝒩(0, Λ^(1))}[σ̇(u)σ̇(v)]`, written with
`(u, v) = (w x + b, w x' + b)`. -/
def sigmaDot1 (σ : ℝ → ℝ) (x x' : ℝ) : ℝ :=
  gaussE (fun w b => deriv σ (w * x + b) * deriv σ (w * x' + b))

/-- Theorem 4.1, eq. (4.6): `Σ_xx^(1)(x, x') = E_{u,v ∼ 𝒩(0,1)}[u⁴ σ̈(ux + v) σ̈(ux' + v)]`. -/
def sigmaXX (σ : ℝ → ℝ) (x x' : ℝ) : ℝ :=
  gaussE (fun u v => u ^ 4 * iteratedDeriv 2 σ (u * x + v) * iteratedDeriv 2 σ (u * x' + v))

/-- Appendix C: the limit `Θ_uu^(1)(x, x')` of `K_uu(0)`, as the law-of-large-numbers steps of the
proof give it: `Σ̇^(1)(x,x') x x' + E[σ(wx+b)σ(wx'+b)] + Σ̇^(1)(x,x') + 1`. -/
def thetaUU (σ : ℝ → ℝ) (x x' : ℝ) : ℝ :=
  sigmaDot1 σ x x' * (x * x') + gaussE (fun w b => σ (w * x + b) * σ (w * x' + b)) +
    sigmaDot1 σ x x' + 1

/-- Appendix C: the limit `Θ_ur^(1)(x, x') = A_ur + B_ur + C_ur` of `K_ur(0)` between a boundary
input `x` and a collocation input `x'`, with the expectations the law of large numbers gives
(`w, b ∼ 𝒩(0,1)`, `σ^(k)` evaluated at `w x + b` or `w x' + b`). -/
def thetaUR (σ : ℝ → ℝ) (x x' : ℝ) : ℝ :=
  gaussE (fun w b => w ^ 2 * deriv σ (w * x + b) * iteratedDeriv 3 σ (w * x' + b)) * (x * x') +
    2 * gaussE (fun w b => w * deriv σ (w * x + b) * iteratedDeriv 2 σ (w * x' + b)) * x +
    gaussE (fun w b => w ^ 2 * σ (w * x + b) * iteratedDeriv 2 σ (w * x' + b)) +
    gaussE (fun w b => w ^ 2 * deriv σ (w * x + b) * iteratedDeriv 3 σ (w * x' + b))

/-- Appendix C: the limit `Θ_rr^(1)(x, x') = A_rr + B_rr + C_rr` of `K_rr(0)`, with the
expectations the law of large numbers gives. -/
def thetaRR (σ : ℝ → ℝ) (x x' : ℝ) : ℝ :=
  gaussE (fun w b => w ^ 4 * iteratedDeriv 3 σ (w * x + b) * iteratedDeriv 3 σ (w * x' + b)) *
      (x * x') +
    2 * gaussE (fun w b => w ^ 3 * iteratedDeriv 3 σ (w * x + b) *
      iteratedDeriv 2 σ (w * x' + b)) * x +
    2 * gaussE (fun w b => w ^ 3 * iteratedDeriv 3 σ (w * x' + b) *
      iteratedDeriv 2 σ (w * x + b)) * x' +
    4 * gaussE (fun w b => w ^ 2 * iteratedDeriv 2 σ (w * x + b) *
      iteratedDeriv 2 σ (w * x' + b)) +
    gaussE (fun w b => w ^ 4 * iteratedDeriv 2 σ (w * x + b) * iteratedDeriv 2 σ (w * x' + b)) +
    gaussE (fun w b => w ^ 4 * iteratedDeriv 3 σ (w * x + b) * iteratedDeriv 3 σ (w * x' + b))

/-- Section 4, eq. (4.1): training data of the model problem `u_xx = f` on `Ω = (a, b)`,
`u = g` on `∂Ω = {a, b}`: boundary points `x_b^i ∈ ∂Ω` and collocation points `x_r^j ∈ Ω`. -/
def IsModelData {Nb Nr : ℕ} (a b : ℝ) (xb : Fin Nb → ℝ) (xr : Fin Nr → ℝ) : Prop :=
  a < b ∧ (∀ i, xb i = a ∨ xb i = b) ∧ ∀ j, xr j ∈ Set.Ioo a b

/-- Section 4: the boundary outputs `θ ↦ u(x_b^i, θ)` of the one-hidden-layer network. -/
def modelU (σ : ℝ → ℝ) {N Nb : ℕ} (xb : Fin Nb → ℝ) : Fin Nb → (PIdx N → ℝ) → ℝ :=
  fun i θ => netU σ θ (xb i)

/-- Section 4: the residual outputs `θ ↦ u_xx(x_r^j, θ)` of the one-hidden-layer network. -/
def modelR (σ : ℝ → ℝ) {N Nr : ℕ} (xr : Fin Nr → ℝ) : Fin Nr → (PIdx N → ℝ) → ℝ :=
  fun j θ => netUxx σ θ (xr j)

/-- Eq. (3.4) for the model problem (4.1):
`L(θ) = ½ ∑ᵢ |u(x_b^i, θ) - g(x_b^i)|² + ½ ∑ⱼ |u_xx(x_r^j, θ) - f(x_r^j)|²`. -/
def modelLoss (σ : ℝ → ℝ) {N Nb Nr : ℕ} (xb : Fin Nb → ℝ) (xr : Fin Nr → ℝ) (g f : ℝ → ℝ) :
    (PIdx N → ℝ) → ℝ :=
  pinnLoss (modelU σ xb) (modelR σ xr) (fun i => g (xb i)) (fun j => f (xr j))

/-- Theorem 4.3: the NTK `K(θ)` of the one-hidden-layer PINN for the model problem (eq. (3.9)). -/
def modelNTK (σ : ℝ → ℝ) {N Nb Nr : ℕ} (xb : Fin Nb → ℝ) (xr : Fin Nr → ℝ) (θ : PIdx N → ℝ) :
    Matrix (Fin Nb ⊕ Fin Nr) (Fin Nb ⊕ Fin Nr) ℝ :=
  pinnNTK (modelU σ xb) (modelR σ xr) θ

/-- Theorem 4.3 and Appendix C: the limiting kernel
`K* = [[Θ_uu, Θ_ur], [Θ_ru, Θ_rr]]` on the training data, with `Θ_ru(x, x') = Θ_ur(x', x)`. -/
def limitNTK (σ : ℝ → ℝ) {Nb Nr : ℕ} (xb : Fin Nb → ℝ) (xr : Fin Nr → ℝ) :
    Matrix (Fin Nb ⊕ Fin Nr) (Fin Nb ⊕ Fin Nr) ℝ :=
  Matrix.fromBlocks (Matrix.of fun i j => thetaUU σ (xb i) (xb j))
    (Matrix.of fun i j => thetaUR σ (xb i) (xr j))
    (Matrix.of fun i j => thetaUR σ (xb j) (xr i))
    (Matrix.of fun i j => thetaRR σ (xr i) (xr j))

/-- Theorem 4.1: `γ` is the centred Gaussian law `𝒩(0, C)` on `ℝⁿ`, characterised by its
characteristic function `∫ e^{i⟨t, y⟩} dγ(y) = e^{-tᵀ C t / 2}`. -/
def IsCenteredGaussian {n : ℕ} (γ : Measure (Fin n → ℝ)) (C : Matrix (Fin n) (Fin n) ℝ) : Prop :=
  IsProbabilityMeasure γ ∧
    ∀ t : Fin n → ℝ, ∫ y, Complex.exp (Complex.I * ((∑ i, t i * y i : ℝ) : ℂ)) ∂γ =
      Complex.exp (-(1 / 2 : ℂ) * ((∑ i, ∑ j, t i * t j * C i j : ℝ) : ℂ))

/-- Theorem 4.4 (iii): `σ` is smooth and `|σ^(k)| ≤ C` for `k = 0, 1, 2, 3, 4`. -/
def ActivationBounded4 (σ : ℝ → ℝ) : Prop :=
  ContDiff ℝ ∞ σ ∧ ∃ C > 0, ∀ k ≤ 4, ∀ z, |iteratedDeriv k σ z| ≤ C

/-- Theorem 4.4 (i): for a family of training trajectories `θ_N(t)`, one per width `N`, all
parameters are bounded on `[0, T]`, `sup_{t ∈ [0,T]} ‖θ_N(t)‖_∞ ≤ C`, with `C` independent of `N`. -/
def ParamsUnifBounded (T : ℝ) (θ : (N : ℕ) → ℝ → PIdx N → ℝ) : Prop :=
  ∃ C > 0, ∀ N, ∀ t ∈ Set.Icc 0 T, ∀ p, |θ N t p| ≤ C

/-- Theorem 4.4 (ii), as printed: `∫_0^T |∑ᵢ (u(x_b^i, θ(τ)) - g(x_b^i))| dτ ≤ C` and
`∫_0^T |∑ⱼ (u_xx(x_r^j, θ(τ)) - f(x_r^j))| dτ ≤ C`, with `C` independent of `N`. -/
def ResidualSumBound (σ : ℝ → ℝ) {Nb Nr : ℕ} (xb : Fin Nb → ℝ) (xr : Fin Nr → ℝ) (g f : ℝ → ℝ)
    (T : ℝ) (θ : (N : ℕ) → ℝ → PIdx N → ℝ) : Prop :=
  ∃ C > 0, ∀ N,
    (∫ τ in (0 : ℝ)..T, |∑ i, (netU σ (θ N τ) (xb i) - g (xb i))|) ≤ C ∧
    (∫ τ in (0 : ℝ)..T, |∑ j, (netUxx σ (θ N τ) (xr j) - f (xr j))|) ≤ C

/-- Theorem 4.4 (ii) in the form its proof (Lemma D.2) uses: the absolute value is inside the sum,
`∫_0^T ∑ᵢ |u(x_b^i, θ(τ)) - g(x_b^i)| dτ ≤ C` and `∫_0^T ∑ⱼ |u_xx(x_r^j, θ(τ)) - f(x_r^j)| dτ ≤ C`,
with `C` independent of `N`. -/
def ResidualAbsSumBound (σ : ℝ → ℝ) {Nb Nr : ℕ} (xb : Fin Nb → ℝ) (xr : Fin Nr → ℝ)
    (g f : ℝ → ℝ) (T : ℝ) (θ : (N : ℕ) → ℝ → PIdx N → ℝ) : Prop :=
  ∃ C > 0, ∀ N,
    (∫ τ in (0 : ℝ)..T, ∑ i, |netU σ (θ N τ) (xb i) - g (xb i)|) ≤ C ∧
    (∫ τ in (0 : ℝ)..T, ∑ j, |netUxx σ (θ N τ) (xr j) - f (xr j)|) ≤ C

end PINNNeuralTangent
Source
Wang, Yu and Perdikaris, When and why PINNs fail to train: A neural tangent kernel perspective, arXiv:2007.14527v1 (2020), Sections 2-4 (eqs. (2.4), (2.5), (3.3)-(3.9), (4.1)-(4.3), (4.6)), Theorem 4.4 hypotheses (i)-(iii) p. 6, Appendix C pp. 20-23
Read-back

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

Partial derivative ∂F/∂θp\partial F/\partial\theta_p∂F/∂θp​ (pd). Let PPP be a finite index set with decidable equality. For a real-valued function FFF of a parameter vector θ=(θq)q∈P∈RP\theta=(\theta_q)_{q\in P}\in\mathbb R^Pθ=(θq​)q∈P​∈RP, a point θ\thetaθ, and an index p∈Pp\in Pp∈P, this is the ordinary one-variable derivative, at s=θps=\theta_ps=θp​, of the map obtained by replacing only the ppp-th coordinate of θ\thetaθ by sss:

∂pF(θ)  =  dds∣s=θpF(θ1,…,θp−1,s,θp+1,… ).\partial_p F(\theta) \;=\; \frac{d}{ds}\Big|_{s=\theta_p} F(\theta_1,\dots,\theta_{p-1},s,\theta_{p+1},\dots).∂p​F(θ)=dsd​​s=θp​​F(θ1​,…,θp−1​,s,θp+1​,…).

If that one-variable map is not differentiable at θp\theta_pθp​, the value is defined to be 000. No differentiability of FFF is assumed.

Euclidean norm (l2norm). For a vector vvv indexed by a finite set ι\iotaι, ∥v∥2=∑i∈ιvi2\|v\|_2=\sqrt{\sum_{i\in\iota}v_i^2}∥v∥2​=∑i∈ι​vi2​​. When ι\iotaι is empty this is 000.

Spectral norm (specNorm). For a real square matrix AAA indexed by a finite set ι\iotaι,

∥A∥2  =  sup⁡{ ∥Av∥2:v∈Rι, ∥v∥2≤1 },\|A\|_2 \;=\; \sup\{\,\|Av\|_2 : v\in\mathbb R^\iota,\ \|v\|_2\le 1\,\},∥A∥2​=sup{∥Av∥2​:v∈Rι, ∥v∥2​≤1},

with ∥⋅∥2\|\cdot\|_2∥⋅∥2​ the Euclidean norm above. The supremum is taken in R\mathbb RR using the convention that the supremum of an empty or unbounded set is 000. This set is nonempty because it contains v=0v=0v=0, and it is bounded because ι\iotaι is finite. When ι\iotaι is empty the value is 000.

NTK block (ntkBlock). Take index sets I,JI,JI,J with no finiteness assumed, two families of functions of the parameters Fi,Gj:RP→RF_i,G_j:\mathbb R^P\to\mathbb RFi​,Gj​:RP→R, and a parameter θ\thetaθ. The block is the I×JI\times JI×J matrix

(KFG(θ))ij  =  ∑p∈P∂pFi(θ) ∂pGj(θ),(K_{FG}(\theta))_{ij} \;=\; \sum_{p\in P}\partial_pF_i(\theta)\,\partial_pG_j(\theta),(KFG​(θ))ij​=p∈P∑​∂p​Fi​(θ)∂p​Gj​(θ),

where ∂p\partial_p∂p​ is the coordinate derivative pd above, which is 000 wherever the coordinate-wise derivative does not exist.

PINN NTK (pinnNTK). Take natural numbers Nb,NrN_b,N_rNb​,Nr​, possibly 000, "boundary outputs" Ui:RP→RU_i:\mathbb R^P\to\mathbb RUi​:RP→R for i<Nbi<N_bi<Nb​, "operator outputs" Rj:RP→RR_j:\mathbb R^P\to\mathbb RRj​:RP→R for j<Nrj<N_rj<Nr​, and a parameter θ\thetaθ. This is the square block matrix indexed by the disjoint union {0,…,Nb−1}⊔{0,…,Nr−1}\{0,\dots,N_b-1\}\sqcup\{0,\dots,N_r-1\}{0,…,Nb​−1}⊔{0,…,Nr​−1}:

K(θ)=(KUU(θ)KUR(θ)KRU(θ)KRR(θ)),K(\theta)=\begin{pmatrix}K_{UU}(\theta)&K_{UR}(\theta)\\ K_{RU}(\theta)&K_{RR}(\theta)\end{pmatrix},K(θ)=(KUU​(θ)KRU​(θ)​KUR​(θ)KRR​(θ)​),

where each block is the NTK block above for the indicated pair of families.

PINN loss (pinnLoss). With UiU_iUi​, RjR_jRj​ as above and real targets gig_igi​ for i<Nbi<N_bi<Nb​ and fjf_jfj​ for j<Nrj<N_rj<Nr​,

L(θ)=12∑i<Nb(Ui(θ)−gi)2+12∑j<Nr(Rj(θ)−fj)2.L(\theta)=\tfrac12\sum_{i<N_b}\big(U_i(\theta)-g_i\big)^2+\tfrac12\sum_{j<N_r}\big(R_j(\theta)-f_j\big)^2.L(θ)=21​i<Nb​∑​(Ui​(θ)−gi​)2+21​j<Nr​∑​(Rj​(θ)−fj​)2.

Empty sums are 000.

Gradient flow (IsGradFlow). Take a function L:RP→RL:\mathbb R^P\to\mathbb RL:RP→R, a curve t↦θ(t)∈RPt\mapsto\theta(t)\in\mathbb R^Pt↦θ(t)∈RP defined for all real ttt, and a real number TTT. The predicate says that at every t∈[0,T]t\in[0,T]t∈[0,T] the curve has a derivative relative to the set [0,T][0,T][0,T], which is one-sided at the endpoints, and that this derivative equals

θ˙(t)=−(∂pL(θ(t)))p∈P.\dot\theta(t)=-\big(\partial_pL(\theta(t))\big)_{p\in P}.θ˙(t)=−(∂p​L(θ(t)))p∈P​.

Here ∂pL\partial_p L∂p​L is the coordinate-wise derivative pd, which is 000 wherever that derivative does not exist. No differentiability of LLL is assumed. The behaviour of θ\thetaθ outside [0,T][0,T][0,T] is unconstrained.

  • If T<0T<0T<0, the interval is empty and the condition holds vacuously for every curve.
  • If T=0T=0T=0, the condition reduces to a derivative relative to the single point {0}\{0\}{0}, which every curve satisfies.

Boundary outputs (bdryOutputs). Take a function u:Rd×RP→Ru:\mathbb R^d\times\mathbb R^P\to\mathbb Ru:Rd×RP→R, written u(x,θ)u(x,\theta)u(x,θ), and points xb1,…,xbNb∈Rdx_b^1,\dots,x_b^{N_b}\in\mathbb R^dxb1​,…,xbNb​​∈Rd. The iii-th output is the function θ↦u(xbi,θ)\theta\mapsto u(x_b^i,\theta)θ↦u(xbi​,θ).

Operator output (opOutput). Let L\mathcal LL be an arbitrary map sending a function Rd→R\mathbb R^d\to\mathbb RRd→R to a function Rd→R\mathbb R^d\to\mathbb RRd→R. No linearity, locality, or differential-operator structure is assumed. Then

Lu(x,θ)=(L[ y↦u(y,θ) ])(x).\mathcal Lu(x,\theta)=\big(\mathcal L[\,y\mapsto u(y,\theta)\,]\big)(x).Lu(x,θ)=(L[y↦u(y,θ)])(x).

Operator outputs (opOutputs). For points xr1,…,xrNr∈Rdx_r^1,\dots,x_r^{N_r}\in\mathbb R^dxr1​,…,xrNr​​∈Rd, the jjj-th output is the function θ↦Lu(xrj,θ)\theta\mapsto\mathcal Lu(x_r^j,\theta)θ↦Lu(xrj​,θ), with L\mathcal LL the arbitrary map from opOutput.

Parameter index set (PIdx, idxW0, idxW1, idxB0, idxB1). For a width N∈NN\in\mathbb NN∈N, possibly 000, the parameter index set is the disjoint union of {0,1,2}×{0,…,N−1}\{0,1,2\}\times\{0,\dots,N-1\}{0,1,2}×{0,…,N−1} with a single extra point, so it has 3N+13N+13N+1 elements. The names are:

  • Wk(0)W^{(0)}_kWk(0)​ is the index (0,k)(0,k)(0,k);
  • Wk(1)W^{(1)}_kWk(1)​ is the index (1,k)(1,k)(1,k);
  • bk(0)b^{(0)}_kbk(0)​ is the index (2,k)(2,k)(2,k);
  • b(1)b^{(1)}b(1) is the extra point.

A parameter θ\thetaθ is a real-valued function on this set.

One-hidden-layer network (netU). For a function σ:R→R\sigma:\mathbb R\to\mathbb Rσ:R→R, a parameter θ\thetaθ, and x∈Rx\in\mathbb Rx∈R,

u(x,θ)=1N∑k<NWk(1) σ(Wk(0)x+bk(0))+b(1).u(x,\theta)=\frac{1}{\sqrt N}\sum_{k<N}W^{(1)}_k\,\sigma\big(W^{(0)}_kx+b^{(0)}_k\big)+b^{(1)}.u(x,θ)=N​1​k<N∑​Wk(1)​σ(Wk(0)​x+bk(0)​)+b(1).

When N=0N=0N=0, the factor 1/01/\sqrt01/0​ is taken to be 000 and the sum is empty, so u(x,θ)=b(1)u(x,\theta)=b^{(1)}u(x,θ)=b(1).

Second derivative of the network (netUxx). Define uxx(x,θ)u_{xx}(x,\theta)uxx​(x,θ) as the derivative at xxx of the function y↦ddyu(y,θ)y\mapsto\frac{d}{dy}u(y,\theta)y↦dyd​u(y,θ). Each derivative is taken to be 000 at any point where it does not exist. No regularity of σ\sigmaσ is assumed.

Initialization (initMeasure). This is the product probability measure on R3N+1\mathbb R^{3N+1}R3N+1 under which all 3N+13N+13N+1 coordinates are independent standard normals N(0,1)\mathcal N(0,1)N(0,1).

Gaussian expectation (gaussE). For F:R2→RF:\mathbb R^2\to\mathbb RF:R2→R,

E F=∫F(w,b) d(γ⊗γ)(w,b),\mathbb E\,F=\int F(w,b)\,d(\gamma\otimes\gamma)(w,b),EF=∫F(w,b)d(γ⊗γ)(w,b),

where γ=N(0,1)\gamma=\mathcal N(0,1)γ=N(0,1) and the integral is a Lebesgue (Bochner) integral. If FFF is not integrable, the value is defined to be 000.

First-layer GP kernel (sigma1). For independent w,b∼N(0,1)w,b\sim\mathcal N(0,1)w,b∼N(0,1),

Σ(1)(x,x′)=E[σ(wx+b) σ(wx′+b)]+1,\Sigma^{(1)}(x,x')=\mathbb E\big[\sigma(wx+b)\,\sigma(wx'+b)\big]+1,Σ(1)(x,x′)=E[σ(wx+b)σ(wx′+b)]+1,

using the Gaussian expectation above, which is 000 if the integrand is not integrable.

Derivative kernel (sigmaDot1). For independent w,b∼N(0,1)w,b\sim\mathcal N(0,1)w,b∼N(0,1),

Σ˙(1)(x,x′)=E[σ′(wx+b) σ′(wx′+b)].\dot\Sigma^{(1)}(x,x')=\mathbb E\big[\sigma'(wx+b)\,\sigma'(wx'+b)\big].Σ˙(1)(x,x′)=E[σ′(wx+b)σ′(wx′+b)].

Here σ′(z)\sigma'(z)σ′(z) is taken to be 000 wherever σ\sigmaσ is not differentiable, and the expectation is 000 if the integrand is not integrable.

Second-derivative kernel (sigmaXX). For independent u,v∼N(0,1)u,v\sim\mathcal N(0,1)u,v∼N(0,1),

Σxx(1)(x,x′)=E[u4 σ′′(ux+v) σ′′(ux′+v)].\Sigma^{(1)}_{xx}(x,x')=\mathbb E\big[u^4\,\sigma''(ux+v)\,\sigma''(ux'+v)\big].Σxx(1)​(x,x′)=E[u4σ′′(ux+v)σ′′(ux′+v)].

Here σ′′\sigma''σ′′ is the iterated second derivative, which is 000 where it does not exist, and the expectation is 000 if the integrand is not integrable.

Limit kernel Θuu\Theta_{uu}Θuu​ (thetaUU). For x,x′∈Rx,x'\in\mathbb Rx,x′∈R, with Σ˙(1)\dot\Sigma^{(1)}Σ˙(1) as above and w,b∼N(0,1)w,b\sim\mathcal N(0,1)w,b∼N(0,1) independent,

Θuu(x,x′)=Σ˙(1)(x,x′) xx′+E[σ(wx+b)σ(wx′+b)]+Σ˙(1)(x,x′)+1.\Theta_{uu}(x,x')=\dot\Sigma^{(1)}(x,x')\,xx'+\mathbb E\big[\sigma(wx+b)\sigma(wx'+b)\big]+\dot\Sigma^{(1)}(x,x')+1.Θuu​(x,x′)=Σ˙(1)(x,x′)xx′+E[σ(wx+b)σ(wx′+b)]+Σ˙(1)(x,x′)+1.

Limit kernel Θur\Theta_{ur}Θur​ (thetaUR). For x,x′∈Rx,x'\in\mathbb Rx,x′∈R and independent w,b∼N(0,1)w,b\sim\mathcal N(0,1)w,b∼N(0,1), write z=wx+bz=wx+bz=wx+b and z′=wx′+bz'=wx'+bz′=wx′+b. Then

Θur(x,x′)=E[w2σ′(z)σ′′′(z′)] xx′+2 E[w σ′(z)σ′′(z′)] x+E[w2σ(z)σ′′(z′)]+E[w2σ′(z)σ′′′(z′)].\begin{aligned} \Theta_{ur}(x,x')={}&\mathbb E\big[w^2\sigma'(z)\sigma'''(z')\big]\,xx'+2\,\mathbb E\big[w\,\sigma'(z)\sigma''(z')\big]\,x\\ &+\mathbb E\big[w^2\sigma(z)\sigma''(z')\big]+\mathbb E\big[w^2\sigma'(z)\sigma'''(z')\big]. \end{aligned}Θur​(x,x′)=​E[w2σ′(z)σ′′′(z′)]xx′+2E[wσ′(z)σ′′(z′)]x+E[w2σ(z)σ′′(z′)]+E[w2σ′(z)σ′′′(z′)].​

Derivatives are 000 where they do not exist, and each expectation is 000 if its integrand is not integrable.

  • The first and last expectations are the same quantity.
  • The second term is multiplied by xxx, not x′x'x′.

Limit kernel Θrr\Theta_{rr}Θrr​ (thetaRR). With the same notation,

Θrr(x,x′)=E[w4σ′′′(z)σ′′′(z′)] xx′+2 E[w3σ′′′(z)σ′′(z′)] x+2 E[w3σ′′′(z′)σ′′(z)] x′+4 E[w2σ′′(z)σ′′(z′)]+E[w4σ′′(z)σ′′(z′)]+E[w4σ′′′(z)σ′′′(z′)].\begin{aligned} \Theta_{rr}(x,x')={}&\mathbb E\big[w^4\sigma'''(z)\sigma'''(z')\big]\,xx'+2\,\mathbb E\big[w^3\sigma'''(z)\sigma''(z')\big]\,x+2\,\mathbb E\big[w^3\sigma'''(z')\sigma''(z)\big]\,x'\\ &+4\,\mathbb E\big[w^2\sigma''(z)\sigma''(z')\big]+\mathbb E\big[w^4\sigma''(z)\sigma''(z')\big]+\mathbb E\big[w^4\sigma'''(z)\sigma'''(z')\big]. \end{aligned}Θrr​(x,x′)=​E[w4σ′′′(z)σ′′′(z′)]xx′+2E[w3σ′′′(z)σ′′(z′)]x+2E[w3σ′′′(z′)σ′′(z)]x′+4E[w2σ′′(z)σ′′(z′)]+E[w4σ′′(z)σ′′(z′)]+E[w4σ′′′(z)σ′′′(z′)].​

The same conventions for missing derivatives and non-integrable integrands apply. The first and last expectations are the same quantity.

Model data (IsModelData). For reals a,ba,ba,b, boundary points xb1,…,xbNb∈Rx_b^1,\dots,x_b^{N_b}\in\mathbb Rxb1​,…,xbNb​​∈R, and collocation points xr1,…,xrNr∈Rx_r^1,\dots,x_r^{N_r}\in\mathbb Rxr1​,…,xrNr​​∈R, the predicate says:

  • a<ba<ba<b;
  • every xbix_b^ixbi​ equals aaa or bbb;
  • every xrjx_r^jxrj​ lies in the open interval (a,b)(a,b)(a,b).

It does not require both endpoints to appear, the points to be distinct, or Nb,Nr>0N_b,N_r>0Nb​,Nr​>0. With Nb=Nr=0N_b=N_r=0Nb​=Nr​=0, the condition reduces to a<ba<ba<b.

Model outputs (modelU, modelR). For the network uuu of netU with width NNN and activation σ\sigmaσ, the iii-th boundary output is θ↦u(xbi,θ)\theta\mapsto u(x_b^i,\theta)θ↦u(xbi​,θ). The jjj-th residual output is θ↦uxx(xrj,θ)\theta\mapsto u_{xx}(x_r^j,\theta)θ↦uxx​(xrj​,θ), with uxxu_{xx}uxx​ as in netUxx.

Model loss (modelLoss). For functions g,f:R→Rg,f:\mathbb R\to\mathbb Rg,f:R→R,

L(θ)=12∑i<Nb(u(xbi,θ)−g(xbi))2+12∑j<Nr(uxx(xrj,θ)−f(xrj))2.L(\theta)=\tfrac12\sum_{i<N_b}\big(u(x_b^i,\theta)-g(x_b^i)\big)^2+\tfrac12\sum_{j<N_r}\big(u_{xx}(x_r^j,\theta)-f(x_r^j)\big)^2.L(θ)=21​i<Nb​∑​(u(xbi​,θ)−g(xbi​))2+21​j<Nr​∑​(uxx​(xrj​,θ)−f(xrj​))2.

Model NTK (modelNTK). This is the PINN NTK block matrix K(θ)K(\theta)K(θ) of pinnNTK, built from the model boundary outputs θ↦u(xbi,θ)\theta\mapsto u(x_b^i,\theta)θ↦u(xbi​,θ) and the residual outputs θ↦uxx(xrj,θ)\theta\mapsto u_{xx}(x_r^j,\theta)θ↦uxx​(xrj​,θ). Entries are sums over all 3N+13N+13N+1 parameters of products of coordinate-wise derivatives, which are 000 where they do not exist.

Limit NTK (limitNTK). This is the block matrix indexed by {0,…,Nb−1}⊔{0,…,Nr−1}\{0,\dots,N_b-1\}\sqcup\{0,\dots,N_r-1\}{0,…,Nb​−1}⊔{0,…,Nr​−1}:

K∗=((Θuu(xbi,xbj))i,j(Θur(xbi,xrj))i,j(Θur(xbj,xri))i,j(Θrr(xri,xrj))i,j).K^*=\begin{pmatrix}\big(\Theta_{uu}(x_b^i,x_b^j)\big)_{i,j}&\big(\Theta_{ur}(x_b^i,x_r^j)\big)_{i,j}\\[2pt]\big(\Theta_{ur}(x_b^j,x_r^i)\big)_{i,j}&\big(\Theta_{rr}(x_r^i,x_r^j)\big)_{i,j}\end{pmatrix}.K∗=((Θuu​(xbi​,xbj​))i,j​(Θur​(xbj​,xri​))i,j​​(Θur​(xbi​,xrj​))i,j​(Θrr​(xri​,xrj​))i,j​​).

The lower-left block is the transpose of the upper-right block. Its (i,j)(i,j)(i,j) entry, for i<Nri<N_ri<Nr​ and j<Nbj<N_bj<Nb​, is Θur(xbj,xri)\Theta_{ur}(x_b^j,x_r^i)Θur​(xbj​,xri​).

Centred Gaussian (IsCenteredGaussian). For a measure γ\gammaγ on Rn\mathbb R^nRn and an arbitrary real n×nn\times nn×n matrix CCC, the predicate says that γ\gammaγ is a probability measure and that, for every t∈Rnt\in\mathbb R^nt∈Rn,

∫e i∑ktkyk dγ(y)=exp⁡(−12∑k,ltktlCkl).\int e^{\,i\sum_k t_ky_k}\,d\gamma(y)=\exp\Big(-\tfrac12\sum_{k,l}t_kt_lC_{kl}\Big).∫ei∑k​tk​yk​dγ(y)=exp(−21​k,l∑​tk​tl​Ckl​).

CCC is not assumed symmetric or positive semidefinite, and only its symmetric part affects the condition. If that symmetric part is not positive semidefinite, no measure satisfies the predicate.

Bounded activation (ActivationBounded4). The predicate says that σ:R→R\sigma:\mathbb R\to\mathbb Rσ:R→R is infinitely differentiable and that there is a constant C>0C>0C>0 such that, for every k∈{0,1,2,3,4}k\in\{0,1,2,3,4\}k∈{0,1,2,3,4} and every z∈Rz\in\mathbb Rz∈R,

∣σ(k)(z)∣≤C.|\sigma^{(k)}(z)|\le C.∣σ(k)(z)∣≤C.

Uniformly bounded parameters (ParamsUnifBounded). Take a real TTT and, for each width N∈NN\in\mathbb NN∈N (including N=0N=0N=0), a curve t↦θN(t)∈R3N+1t\mapsto\theta_N(t)\in\mathbb R^{3N+1}t↦θN​(t)∈R3N+1. The predicate says there is a constant C>0C>0C>0, the same for all NNN, such that for every NNN, every t∈[0,T]t\in[0,T]t∈[0,T], and every parameter index ppp,

∣θN(t)p∣≤C.|\theta_N(t)_p|\le C.∣θN​(t)p​∣≤C.

The curves are not required to be gradient flows or related to any loss. If T<0T<0T<0, the condition holds trivially.

Residual-sum bound (ResidualSumBound). The predicate says there is a constant C>0C>0C>0, the same for all widths N∈NN\in\mathbb NN∈N, such that for every NNN both

∫0T∣∑i<Nb(u(xbi,θN(τ))−g(xbi))∣ dτ≤Cand∫0T∣∑j<Nr(uxx(xrj,θN(τ))−f(xrj))∣ dτ≤C.\int_0^T\Big|\sum_{i<N_b}\big(u(x_b^i,\theta_N(\tau))-g(x_b^i)\big)\Big|\,d\tau\le C \quad\text{and}\quad \int_0^T\Big|\sum_{j<N_r}\big(u_{xx}(x_r^j,\theta_N(\tau))-f(x_r^j)\big)\Big|\,d\tau\le C.∫0T​​i<Nb​∑​(u(xbi​,θN​(τ))−g(xbi​))​dτ≤Cand∫0T​​j<Nr​∑​(uxx​(xrj​,θN​(τ))−f(xrj​))​dτ≤C.

Here uuu is the width-NNN network, and g,f:R→Rg,f:\mathbb R\to\mathbb Rg,f:R→R are arbitrary.

  • The absolute value is taken of the signed sum.
  • An integral whose integrand is not integrable is taken to be 000.
  • If T<0T<0T<0, each integral is the negative of the integral over [T,0][T,0][T,0].

Absolute-residual-sum bound (ResidualAbsSumBound). This is the same as the residual-sum bound, except that the absolute value is inside the sum. There is a constant C>0C>0C>0, independent of NNN, with, for every NNN,

∫0T∑i<Nb∣u(xbi,θN(τ))−g(xbi)∣ dτ≤Cand∫0T∑j<Nr∣uxx(xrj,θN(τ))−f(xrj)∣ dτ≤C.\int_0^T\sum_{i<N_b}\big|u(x_b^i,\theta_N(\tau))-g(x_b^i)\big|\,d\tau\le C \quad\text{and}\quad \int_0^T\sum_{j<N_r}\big|u_{xx}(x_r^j,\theta_N(\tau))-f(x_r^j)\big|\,d\tau\le C.∫0T​i<Nb​∑​​u(xbi​,θN​(τ))−g(xbi​)​dτ≤Cand∫0T​j<Nr​∑​​uxx​(xrj​,θN​(τ))−f(xrj​)​dτ≤C.

The same conventions apply: non-integrable integrands give the value 000, and T<0T<0T<0 reverses orientation.

Human review
  • Endorsed by Shuze Chen · Nov 24, 2026

    Confirmed by the moderator at approval.

  • Endorsed by Xeroth · Nov 24, 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