Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Abstract PDEs, quadrature rules, neural networks and PINN residuals and errors

Definition
PINNGeneralization_Basic

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

energy-estimatesgeneralization-errorpde-stabilityphysics-informed-neural-networksquadrature

Objects of Sections 2-4 of Mishra and Molinaro (arXiv:2006.16144v3).

  1. Abstract PDE (Section 2.1). A measurable domain D⊆Rdˉ\mathbb D\subseteq\mathbb R^{\bar d}D⊆Rdˉ, an exponent 1≤p<∞1\le p<\infty1≤p<∞, Y=Lp(D;Rm)Y=L^p(\mathbb D;\mathbb R^m)Y=Lp(D;Rm), a separable Banach space XXX with a closed subspace X∗X^*X∗, a subspace Y∗⊆Lp(D)Y^*\subseteq L^p(\mathbb D)Y∗⊆Lp(D) closed in LpL^pLp, an operator D:X∗→Y∗\mathcal D:X^*\to Y^*D:X∗→Y∗ whose values are functions on D\mathbb DD, and an input f∈Y∗f\in Y^*f∈Y∗, such that for every g∈Y∗g\in Y^*g∈Y∗ there is a unique v∈X∗v\in X^*v∈X∗ with D(v)=g\mathcal D(v)=gD(v)=g in YYY ((H1), (H2), eq. (2.2)). A solution is u∈X∗u\in X^*u∈X∗ with D(u)=f\mathcal D(u)=fD(u)=f a.e. on D\mathbb DD. The residual is R(v)=D(v)−f\mathcal R(v)=\mathcal D(v)-fR(v)=D(v)−f (eq. 2.12).
  2. Stability (H3), Assumption 2.1, eq. (2.3). Z⊆X∗Z\subseteq X^*Z⊆X∗ is a closed subspace with a norm ∥⋅∥Z\|\cdot\|_Z∥⋅∥Z​, Cpde(a,b)>0C_{pde}(a,b)>0Cpde​(a,b)>0, and ∥u−v∥X≤Cpde(∥u∥Z,∥v∥Z) ∥D(u)−D(v)∥Lp(D)\|u-v\|_X\le C_{pde}(\|u\|_Z,\|v\|_Z)\,\|\mathcal D(u)-\mathcal D(v)\|_{L^p(\mathbb D)}∥u−v∥X​≤Cpde​(∥u∥Z​,∥v∥Z​)∥D(u)−D(v)∥Lp(D)​ for all u,v∈Zu,v\in Zu,v∈Z.
  3. Quadrature (Section 2.2). A rule has points y1,…,yNy_1,\dots,y_Ny1​,…,yN​ in a set SSS and weights wi≥0w_i\ge0wi​≥0; gˉN=∑iwig(yi)\bar g_N=\sum_iw_ig(y_i)gˉ​N​=∑i​wi​g(yi​). The error bound (2.7) for a class GGG with a norm ∥⋅∥\|\cdot\|∥⋅∥ says: every g∈Gg\in Gg∈G is integrable on SSS and ∣∫Sg−gˉN∣≤Cquad(∥g∥)N−α|\int_Sg-\bar g_N|\le C_{quad}(\|g\|)N^{-\alpha}∣∫S​g−gˉ​N​∣≤Cquad​(∥g∥)N−α. The training error is ET=(∑nwn∣R(yn)∣p)1/p\mathcal E_T=(\sum_nw_n|\mathcal R(y_n)|^p)^{1/p}ET​=(∑n​wn​∣R(yn​)∣p)1/p (eq. 2.21); in Sections 3-4 its components are (∑nwnR(yn)2)1/2(\sum_nw_n\mathcal R(y_n)^2)^{1/2}(∑n​wn​R(yn​)2)1/2. ∥g∥Ck(S)=max⁡j≤ksup⁡y∈S∥Djg(y)∥\|g\|_{C^k(S)}=\max_{j\le k}\sup_{y\in S}\|D^jg(y)\|∥g∥Ck(S)​=maxj≤k​supy∈S​∥Djg(y)∥.
  4. Neural networks (eqs. 2.8-2.9). g=CK∘σ∘CK−1∘⋯∘σ∘C1g=C_K\circ\sigma\circ C_{K-1}\circ\cdots\circ\sigma\circ C_1g=CK​∘σ∘CK−1​∘⋯∘σ∘C1​ with K>1K>1K>1 affine maps Ckz=Wkz+bkC_kz=W_kz+b_kCk​z=Wk​z+bk​ and the activation σ\sigmaσ applied componentwise.
  5. Random training points (Section 2.4.1). D=[0,1]dˉ\mathbb D=[0,1]^{\bar d}D=[0,1]dˉ; a training set S=(y1,…,yN)\mathbb S=(y_1,\dots,y_N)S=(y1​,…,yN​) has law dS=dy⊗Nd\mathbb S=dy^{\otimes N}dS=dy⊗N. With R(S)(y)\mathcal R(\mathbb S)(y)R(S)(y) the residual at yyy of the network trained on S\mathbb SS: EˉG=∫∥u−u∗(S)∥XdS\bar{\mathcal E}_G=\int\|u-u^*(\mathbb S)\|_Xd\mathbb SEˉG​=∫∥u−u∗(S)∥X​dS, EˉT=∫1N∑n∣R(S)(yn)∣dS\bar{\mathcal E}_T=\int\frac1N\sum_n|\mathcal R(\mathbb S)(y_n)|d\mathbb SEˉT​=∫N1​∑n​∣R(S)(yn​)∣dS, EˉV=1N∫∑j∣R(S)(zj)∣dS\bar{\mathcal E}_V=\frac1N\int\sum_j|\mathcal R(\mathbb S)(z_j)|d\mathbb SEˉV​=N1​∫∑j​∣R(S)(zj​)∣dS for validation points zjz_jzj​, ETV=E∣EˉT−EˉV∣\mathcal E_{TV}=\mathbb E|\bar{\mathcal E}_T-\bar{\mathcal E}_V|ETV​=E∣EˉT​−EˉV​∣, and std(∣R∣)2=∫D(ϕ(z)−∫Dϕ)2dz\mathrm{std}(|\mathcal R|)^2=\int_{\mathbb D}\big(\phi(z)-\int_{\mathbb D}\phi\big)^2dzstd(∣R∣)2=∫D​(ϕ(z)−∫D​ϕ)2dz with ϕ(z)=∫∣R(S)(z)∣dS\phi(z)=\int|\mathcal R(\mathbb S)(z)|d\mathbb Sϕ(z)=∫∣R(S)(z)∣dS (eqs. 2.24-2.30).
  6. Semilinear parabolic equation (Section 3). D⊆RdD\subseteq\mathbb R^dD⊆Rd, d=n+1d=n+1d=n+1, is open, connected, bounded, with CkC^kCk boundary (locally, after an orthogonal change of coordinates, the region above the graph of a CkC^kCk function). dsdsds is the (d−1)(d-1)(d−1)-dimensional Hausdorff measure normalised to surface area. A classical solution satisfies ut=Δu+f(u)u_t=\Delta u+f(u)ut​=Δu+f(u) in D×(0,T)D\times(0,T)D×(0,T), u(⋅,0)=uˉu(\cdot,0)=\bar uu(⋅,0)=uˉ in DDD, u=0u=0u=0 on ∂D×(0,T)\partial D\times(0,T)∂D×(0,T) (eq. 3.1). The residuals are Rint=∂tuθ−Δuθ−f(uθ)\mathcal R_{int}=\partial_tu_\theta-\Delta u_\theta-f(u_\theta)Rint​=∂t​uθ​−Δuθ​−f(uθ​), Rsb=uθ\mathcal R_{sb}=u_\thetaRsb​=uθ​ on ∂D\partial D∂D, Rtb=uθ(⋅,0)−uˉ\mathcal R_{tb}=u_\theta(\cdot,0)-\bar uRtb​=uθ​(⋅,0)−uˉ (eqs. 3.3-3.5). EG=(∫0T∫D∣u−u∗∣2)1/2\mathcal E_G=(\int_0^T\int_D|u-u^*|^2)^{1/2}EG​=(∫0T​∫D​∣u−u∗∣2)1/2 (eq. 3.7). ∥v∥C1([0,T]×∂D)=sup⁡∣v∣+sup⁡∣∂tv∣+sup⁡∣∇xv∣\|v\|_{C^1([0,T]\times\partial D)}=\sup|v|+\sup|\partial_tv|+\sup|\nabla_xv|∥v∥C1([0,T]×∂D)​=sup∣v∣+sup∣∂t​v∣+sup∣∇x​v∣ over ∂D×[0,T]\partial D\times[0,T]∂D×[0,T]; C1=(T+(1+2Cf)T2e(1+2Cf)T)1/2C_1=(T+(1+2C_f)T^2e^{(1+2C_f)T})^{1/2}C1​=(T+(1+2Cf​)T2e(1+2Cf​)T)1/2 and C∂D=∣∂D∣1/2(∥u∥C1([0,T]×∂D)+∥u∗∥C1([0,T]×∂D))C_{\partial D}=|\partial D|^{1/2}(\|u\|_{C^1([0,T]\times\partial D)}+\|u^*\|_{C^1([0,T]\times\partial D)})C∂D​=∣∂D∣1/2(∥u∥C1([0,T]×∂D)​+∥u∗∥C1([0,T]×∂D)​) (eq. 3.13).
  7. Viscous scalar conservation law (Section 4). A classical solution satisfies ut+f(u)x=νuxxu_t+f(u)_x=\nu u_{xx}ut​+f(u)x​=νuxx​ in (0,1)×(0,T)(0,1)\times(0,T)(0,1)×(0,T), u(⋅,0)=uˉu(\cdot,0)=\bar uu(⋅,0)=uˉ in (0,1)(0,1)(0,1), u(0,t)=u(1,t)=0u(0,t)=u(1,t)=0u(0,t)=u(1,t)=0 (eq. 4.1). Rint=∂tuθ+∂xf(uθ)−ν∂xxuθ\mathcal R_{int}=\partial_tu_\theta+\partial_xf(u_\theta)-\nu\partial_{xx}u_\thetaRint​=∂t​uθ​+∂x​f(uθ​)−ν∂xx​uθ​, Rsb,0=uθ(0,⋅)\mathcal R_{sb,0}=u_\theta(0,\cdot)Rsb,0​=uθ​(0,⋅), Rsb,1=uθ(1,⋅)\mathcal R_{sb,1}=u_\theta(1,\cdot)Rsb,1​=uθ​(1,⋅), Rtb=uθ(⋅,0)−uˉ\mathcal R_{tb}=u_\theta(\cdot,0)-\bar uRtb​=uθ​(⋅,0)−uˉ (eqs. 4.2-4.4). With sup norms over [0,1]×[0,T][0,1]\times[0,T][0,1]×[0,T] and M=max⁡(∥u∥∞,∥u∗∥∞)M=\max(\|u\|_\infty,\|u^*\|_\infty)M=max(∥u∥∞​,∥u∗∥∞​): Cf,u,u∗=max⁡∣s∣≤M∣f′′(s)∣ ∥ux∥∞C_{f,u,u^*}=\max_{|s|\le M}|f''(s)|\,\|u_x\|_\inftyCf,u,u∗​=max∣s∣≤M​∣f′′(s)∣∥ux​∥∞​, Cb=∥ux∥∞+∥ux∗∥∞\mathbf C_b=\|u_x\|_\infty+\|u^*_x\|_\inftyCb​=∥ux​∥∞​+∥ux∗​∥∞​, Cˉb=max⁡∣s∣≤∥u∗∥∞∣f′(s)∣\bar{\mathbf C}_b=\max_{|s|\le\|u^*\|_\infty}|f'(s)|Cˉb​=max∣s∣≤∥u∗∥∞​​∣f′(s)∣.

Formalization Note Points of Rdˉ\mathbb R^{\bar d}Rdˉ are EuclideanSpace ℝ (Fin n). The paper's Y∗Y^*Y∗ and X∗X^*X∗ norms are not used and are not modelled separately. The sets ZZZ and Z∗Z^*Z∗ carry arbitrary functions required to be norms on them. The constants Cf,u,u∗C_{f,u,u^*}Cf,u,u∗​ and Cˉb\bar{\mathbf C}_bCˉb​ are the values that the proof of Theorem 4.1 establishes; the printed definitions are discussed in the statements that use them.

Definition code
import Mathlib

/-!
Mishra and Molinaro, *Estimates on the generalization error of Physics Informed Neural Networks
(PINNs) for approximating PDEs*, arXiv:2006.16144v3 (2023): the abstract PDE, quadrature rules,
neural networks, residuals and errors of Section 2, the semilinear parabolic equation of Section 3
and the viscous scalar conservation law of Section 4.
-/

open MeasureTheory

noncomputable section

namespace PINNGeneralization

/-- Points of `ℝ^n` with the Euclidean norm. -/
abbrev Pt (n : ℕ) := EuclideanSpace ℝ (Fin n)

/-- `sup_{y ∈ S} g(y)` (used only for continuous `g` on compact nonempty `S`). -/
def supOn {α : Type*} (S : Set α) (g : α → ℝ) : ℝ := sSup (g '' S)

/-! ### Section 2.3: neural networks -/

/-- Eqs. (2.8)-(2.9): `g = C_K ∘ σ ∘ C_{K-1} ∘ ⋯ ∘ σ ∘ C_1` with `1 < K` affine maps
`C_k z = W_k z + b_k` (layer widths `w 0 = din, w 1, …, w K = dout`; written with `0`-based
layers) and the scalar activation `σ` applied componentwise between them. -/
def IsNeuralNet (σ : ℝ → ℝ) {din dout : ℕ} (g : (Fin din → ℝ) → (Fin dout → ℝ)) : Prop :=
  ∃ (K : ℕ) (w : ℕ → ℕ) (W : ∀ k, Matrix (Fin (w (k + 1))) (Fin (w k)) ℝ)
    (b : ∀ k, Fin (w (k + 1)) → ℝ) (h0 : w 0 = din) (hK : w K = dout)
    (z : ∀ k, (Fin din → ℝ) → (Fin (w k) → ℝ)),
    1 < K ∧ (∀ y, z 0 y = fun i => y (Fin.cast h0 i)) ∧
    (∀ k, k + 1 < K → ∀ y, z (k + 1) y = fun i => σ ((W k).mulVec (z k y) i + b k i)) ∧
    (∀ k, k + 1 = K → ∀ y, z (k + 1) y = (W k).mulVec (z k y) + b k) ∧
    ∀ y, g y = fun i => z K y (Fin.cast hK.symm i)

/-! ### Section 2.1: the abstract PDE -/

/-- The `Y = L^p(𝔻; ℝ^m)` norm `‖g‖_{L^p(𝔻)}` (Section 2.1). -/
def lpNorm {n m : ℕ} (dom : Set (Pt n)) (p : ℝ) (g : Pt n → Pt m) : ℝ :=
  (eLpNorm g (ENNReal.ofReal p) (volume.restrict dom)).toReal

/-- Section 2.1: `nrm` is a norm on the subspace `S` (used for `‖·‖_Z` and `‖·‖_{Z*}`). -/
def IsNormOn {V : Type*} [AddCommGroup V] [Module ℝ V] (S : Submodule ℝ V) (nrm : V → ℝ) :
    Prop :=
  (∀ v ∈ S, 0 ≤ nrm v) ∧ (∀ v ∈ S, nrm v = 0 → v = 0) ∧
    (∀ (a : ℝ), ∀ v ∈ S, nrm (a • v) = |a| * nrm v) ∧
    ∀ v ∈ S, ∀ v' ∈ S, nrm (v + v') ≤ nrm v + nrm v'

/-- Section 2.1: the subspace `S ⊆ L^p(𝔻)` of functions is closed in `L^p(𝔻)`: an `L^p` limit of
elements of `S` agrees a.e. with an element of `S`. -/
def IsLpClosed {n m : ℕ} (dom : Set (Pt n)) (p : ℝ) (S : Submodule ℝ (Pt n → Pt m)) : Prop :=
  ∀ (g : ℕ → Pt n → Pt m) (h : Pt n → Pt m), (∀ j, g j ∈ S) →
    MemLp h (ENNReal.ofReal p) (volume.restrict dom) →
    Filter.Tendsto (fun j => eLpNorm (g j - h) (ENNReal.ofReal p) (volume.restrict dom))
      Filter.atTop (nhds 0) →
    ∃ h' ∈ S, h' =ᵐ[volume.restrict dom] h

/-- Section 2.1, eq. (2.1): the data of the abstract PDE `D(u) = f`: the domain `𝔻 ⊆ ℝ^{d̄}`, the
exponent `p` of `Y = L^p(𝔻; ℝ^m)`, the closed subspaces `X* ⊆ X` and `Y* ⊆ Y`, the differential
operator `D : X* → Y*` (its values are functions, evaluated pointwise as in (2.15)) and the input
`f ∈ Y*`. -/
structure AbstractPDE (n m : ℕ) (X : Type*) [NormedAddCommGroup X] [NormedSpace ℝ X] where
  /-- the domain `𝔻 ⊆ ℝ^{d̄}` -/
  dom : Set (Pt n)
  /-- the exponent `p` of `Y = L^p(𝔻)` -/
  p : ℝ
  /-- the closed subspace `X* ⊆ X` -/
  Xs : Submodule ℝ X
  /-- the closed subspace `Y* ⊆ Y` -/
  Ys : Submodule ℝ (Pt n → Pt m)
  /-- the differential operator `D` -/
  D : X → Pt n → Pt m
  /-- the input `f` -/
  f : Pt n → Pt m

namespace AbstractPDE

variable {n m : ℕ} {X : Type*} [NormedAddCommGroup X] [NormedSpace ℝ X]

/-- Section 2.1, (H1)-(H2) of eq. (2.2) and well-posedness: `𝔻` is measurable, `1 ≤ p < ∞`,
`X*` is closed, `Y* ⊆ L^p(𝔻)` is closed, `D` maps `X*` into `Y*`, `f ∈ Y*`, and for every
`g ∈ Y*` there is a unique `v ∈ X*` with `D(v) = g` in `Y`. -/
def Hyp (P : AbstractPDE n m X) : Prop :=
  MeasurableSet P.dom ∧ 1 ≤ P.p ∧ IsClosed (P.Xs : Set X) ∧
    (∀ g ∈ P.Ys, MemLp g (ENNReal.ofReal P.p) (volume.restrict P.dom)) ∧
    IsLpClosed P.dom P.p P.Ys ∧ (∀ v ∈ P.Xs, P.D v ∈ P.Ys) ∧ P.f ∈ P.Ys ∧
    ∀ g ∈ P.Ys, ∃! v, v ∈ P.Xs ∧ P.D v =ᵐ[volume.restrict P.dom] g

/-- `u ∈ X*` solves eq. (2.1), `D(u) = f` in `Y`. -/
def IsSolution (P : AbstractPDE n m X) (u : X) : Prop :=
  u ∈ P.Xs ∧ P.D u =ᵐ[volume.restrict P.dom] P.f

/-- Eq. (2.12): the residual `R(v) = D(v) - f`. -/
def residual (P : AbstractPDE n m X) (v : X) : Pt n → Pt m := fun y => P.D v y - P.f y

/-- Assumption (H3), eq. (2.3): `Z ⊆ X*` is a closed subspace with norm `‖·‖_Z`, `C_pde > 0`, and
`‖u - v‖_X ≤ C_pde(‖u‖_Z, ‖v‖_Z) ‖D(u) - D(v)‖_Y` for all `u, v ∈ Z`. -/
def IsStable (P : AbstractPDE n m X) (Z : Submodule ℝ X) (zNorm : X → ℝ)
    (Cpde : ℝ → ℝ → ℝ) : Prop :=
  IsClosed (Z : Set X) ∧ Z ≤ P.Xs ∧ IsNormOn Z zNorm ∧ (∀ a b, 0 < Cpde a b) ∧
    ∀ v ∈ Z, ∀ w ∈ Z, ‖v - w‖ ≤ Cpde (zNorm v) (zNorm w) * lpNorm P.dom P.p (P.D v - P.D w)

end AbstractPDE

/-! ### Section 2.2: quadrature rules -/

/-- Eq. (2.6): a quadrature rule with `N` points `y_i` and weights `w_i`. -/
structure QuadRule (α : Type*) where
  /-- the number of points -/
  N : ℕ
  /-- the quadrature (training) points -/
  pts : Fin N → α
  /-- the weights -/
  wts : Fin N → ℝ

/-- Section 2.2: the points lie in `S` and the weights are nonnegative (`w_i ∈ ℝ_+`). -/
def QuadRule.IsOn {α : Type*} (Q : QuadRule α) (S : Set α) : Prop :=
  (∀ i, Q.pts i ∈ S) ∧ ∀ i, 0 ≤ Q.wts i

/-- Eq. (2.6): `ḡ_N = ∑_i w_i g(y_i)`. -/
def QuadRule.sum {α : Type*} (Q : QuadRule α) (g : α → ℝ) : ℝ := ∑ i, Q.wts i * g (Q.pts i)

/-- Eq. (2.7) (and (3.9)-(3.11)): for every `g` in the class `G`, `g` is integrable on `S` and
`|∫_S g - ḡ_N| ≤ C_quad(‖g‖) N^{-α}`. -/
def QuadErrorBound {α : Type*} [MeasurableSpace α] (μ : Measure α) (S : Set α)
    (G : Set (α → ℝ)) (nrm : (α → ℝ) → ℝ) (Cquad : ℝ → ℝ) (a : ℝ) (Q : QuadRule α) : Prop :=
  ∀ g ∈ G, IntegrableOn g S μ ∧ |∫ y in S, g y ∂μ - Q.sum g| ≤ Cquad (nrm g) * (Q.N : ℝ) ^ (-a)

/-- Eq. (2.21): the training error `E_T = (∑_n w_n |R(y_n)|^p)^{1/p}`. -/
def trainingError {n m : ℕ} (Q : QuadRule (Pt n)) (p : ℝ) (R : Pt n → Pt m) : ℝ :=
  (Q.sum fun y => ‖R y‖ ^ p) ^ (1 / p)

/-- Eqs. (3.8), (4.7): a component `(∑_n w_n |R(y_n)|²)^{1/2}` of the training error. -/
def quadL2 {α : Type*} (Q : QuadRule α) (R : α → ℝ) : ℝ := Real.sqrt (Q.sum fun y => R y ^ 2)

/-- Sections 3.3 and 4.3: the `C^k` norm `‖g‖_{C^k(S)} = max_{j ≤ k} sup_{y ∈ S} ‖D^j g(y)‖`. -/
def ckNorm {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] (k : ℕ) (S : Set E)
    (g : E → ℝ) : ℝ :=
  sSup {r | ∃ j ≤ k, ∃ y ∈ S, r = ‖iteratedFDeriv ℝ j g y‖}

/-! ### Section 2.4.1: random training points -/

/-- Section 2.4.1: the unit cube `𝔻 = [0,1]^{d̄}`. -/
def unitCube (n : ℕ) : Set (Pt n) := {y | ∀ i, y i ∈ Set.Icc (0 : ℝ) 1}

/-- Section 2.4.1: the law `d𝕊 = dy ⊗ ⋯ ⊗ dy` of a training set `𝕊 = [y_1, …, y_N] ∈ 𝔻^N` of i.i.d.
uniform points. -/
def trainLaw (n N : ℕ) : Measure (Fin N → Pt n) :=
  Measure.pi fun _ => volume.restrict (unitCube n)

/-- Eq. (2.24): the cumulative generalization error `Ē_G = ∫ ‖u - u*(𝕊)‖_X d𝕊`. -/
def cumGenError {n N : ℕ} {X : Type*} [NormedAddCommGroup X] (u : X)
    (ustar : (Fin N → Pt n) → X) : ℝ :=
  ∫ S, ‖u - ustar S‖ ∂trainLaw n N

/-- Eq. (2.25): the cumulative training error `Ē_T = ∫ (1/N) ∑_n |R(y_n; 𝕊)| d𝕊`, where
`R 𝕊 y` is the residual at `y` of the PINN trained on `𝕊`. -/
def cumTrainError {n m N : ℕ} (R : (Fin N → Pt n) → Pt n → Pt m) : ℝ :=
  ∫ S, (1 / (N : ℝ)) * ∑ j, ‖R S (S j)‖ ∂trainLaw n N

/-- Eq. (2.27): the cumulative validation error `Ē_V = (1/N) ∫ ∑_j |R(z_j; 𝕊)| d𝕊` for the
validation points `z_1, …, z_N`. -/
def cumValError {n m N : ℕ} (R : (Fin N → Pt n) → Pt n → Pt m) (z : Fin N → Pt n) : ℝ :=
  (1 / (N : ℝ)) * ∫ S, ∑ j, ‖R S (z j)‖ ∂trainLaw n N

/-- Eq. (2.28): the validation gap `E_TV = 𝔼 |Ē_T - Ē_V|` over the random validation set. -/
def validationGap {n m N : ℕ} {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω)
    (R : (Fin N → Pt n) → Pt n → Pt m) (zval : Fin N → Ω → Pt n) : ℝ :=
  ∫ ω, |cumTrainError R - cumValError R (fun j => zval j ω)| ∂P

/-- Eq. (2.30): `std(|R|) = (𝔼 (∫ |R(z, 𝕊)| d𝕊 - ∫_𝔻 ∫ |R(z, 𝕊)| d𝕊 dz)²)^{1/2}` for `z` uniform on
`𝔻`, written as an integral over `𝔻`. -/
def residualStd {n m N : ℕ} (R : (Fin N → Pt n) → Pt n → Pt m) : ℝ :=
  Real.sqrt (∫ z in unitCube n,
    (∫ S, ‖R S z‖ ∂trainLaw n N - ∫ y in unitCube n, ∫ S, ‖R S y‖ ∂trainLaw n N) ^ 2)

/-! ### Section 3: semilinear parabolic equations on `D ⊆ ℝ^d`, `d = n + 1` -/

/-- Section 3.1: `D ⊆ ℝ^{n+1}` has a `C^k` boundary: near each boundary point, after an orthogonal
change of coordinates, `D` is the region above the graph of a `C^k` function of the first `n`
coordinates. -/
def HasCkBoundary (k : ℕ) {n : ℕ} (D : Set (Pt (n + 1))) : Prop :=
  ∀ x₀ ∈ frontier D, ∃ r > 0, ∃ A : Pt (n + 1) ≃ₗᵢ[ℝ] Pt (n + 1), ∃ γ : (Fin n → ℝ) → ℝ,
    ContDiff ℝ k γ ∧
      D ∩ Metric.ball x₀ r =
        {x | x ∈ Metric.ball x₀ r ∧ γ (fun i => A x (Fin.castSucc i)) < A x (Fin.last n)}

/-- Section 3.1: a domain, i.e. an open connected bounded set, with `C^k` boundary. -/
def IsCkDomain (k : ℕ) {n : ℕ} (D : Set (Pt (n + 1))) : Prop :=
  IsOpen D ∧ IsConnected D ∧ Bornology.IsBounded D ∧ HasCkBoundary k D

/-- The surface measure `ds` on hypersurfaces of `ℝ^{n+1}`: the `n`-dimensional Hausdorff
measure, normalised by `ω_n / 2^n` so that it agrees with `n`-dimensional area. -/
def surfaceMeasure (n : ℕ) : Measure (Pt (n + 1)) :=
  ENNReal.ofReal ((volume (Metric.ball (0 : Pt n) 1)).toReal / 2 ^ n) • μH[(n : ℝ)]

/-- The measure `ds(x) dt` on `∂D × [0, T]`. -/
def bdryTimeMeasure {n : ℕ} (D : Set (Pt (n + 1))) (T : ℝ) : Measure (Pt (n + 1) × ℝ) :=
  ((surfaceMeasure n).restrict (frontier D)).prod (volume.restrict (Set.Icc 0 T))

/-- The partial derivative `∂_{x_i} g(x)`. -/
def pd {n : ℕ} (i : Fin n) (g : Pt n → ℝ) (x : Pt n) : ℝ :=
  deriv (fun r : ℝ => g (x + r • EuclideanSpace.single i 1)) 0

/-- The Laplacian `Δg = ∑_i ∂²_{x_i} g`. -/
def lap {n : ℕ} (g : Pt n → ℝ) (x : Pt n) : ℝ := ∑ i, pd i (pd i g) x

/-- The Euclidean length `|∇_x u(x, t)|` of the spatial gradient. -/
def gradNorm {n : ℕ} (u : Pt n → ℝ → ℝ) (x : Pt n) (t : ℝ) : ℝ :=
  Real.sqrt (∑ i, pd i (fun y => u y t) x ^ 2)

/-- Eq. (3.13): `‖u‖_{C^1([0,T] × ∂D)} = sup |u| + sup |∂_t u| + sup |∇_x u|` over
`∂D × [0, T]`. -/
def c1NormBdry {n : ℕ} (D : Set (Pt (n + 1))) (T : ℝ) (u : Pt (n + 1) → ℝ → ℝ) : ℝ :=
  supOn (frontier D ×ˢ Set.Icc 0 T) (fun q => |u q.1 q.2|) +
    supOn (frontier D ×ˢ Set.Icc 0 T) (fun q => |deriv (u q.1) q.2|) +
      supOn (frontier D ×ˢ Set.Icc 0 T) (fun q => gradNorm u q.1 q.2)

/-- Eq. (3.1): `u` is a classical solution of `u_t = Δu + f(u)` in `D × (0, T)`,
`u(x, 0) = ū(x)` in `D`, `u = 0` on `∂D × (0, T)`. -/
def IsHeatSolution {n : ℕ} (D : Set (Pt (n + 1))) (T : ℝ) (f : ℝ → ℝ)
    (ubar : Pt (n + 1) → ℝ) (u : Pt (n + 1) → ℝ → ℝ) : Prop :=
  (∀ x ∈ D, ∀ t ∈ Set.Ioo 0 T, deriv (u x) t = lap (fun y => u y t) x + f (u x t)) ∧
    (∀ x ∈ D, u x 0 = ubar x) ∧ ∀ x ∈ frontier D, ∀ t ∈ Set.Ioo 0 T, u x t = 0

/-- Section 3.2: `u*` is (the realization of) a neural network (2.8) of the space-time variable
`(x, t) ∈ ℝ^{n+2}` with scalar output. -/
def IsPINN {n : ℕ} (σ : ℝ → ℝ) (ustar : Pt (n + 1) → ℝ → ℝ) : Prop :=
  ∃ g : (Fin (n + 1 + 1) → ℝ) → (Fin 1 → ℝ), IsNeuralNet σ g ∧
    ∀ x t, ustar x t = g (Fin.snoc (α := fun _ => ℝ) (fun i => x i) t) 0

/-- Eq. (3.3): the interior residual `∂_t u_θ - Δu_θ - f(u_θ)`. -/
def heatResInt {n : ℕ} (f : ℝ → ℝ) (v : Pt (n + 1) → ℝ → ℝ) (x : Pt (n + 1)) (t : ℝ) : ℝ :=
  deriv (v x) t - lap (fun y => v y t) x - f (v x t)

/-- Eq. (3.5): the temporal boundary residual `u_θ(x, 0) - ū(x)`. -/
def heatResTb {n : ℕ} (ubar : Pt (n + 1) → ℝ) (v : Pt (n + 1) → ℝ → ℝ) (x : Pt (n + 1)) : ℝ :=
  v x 0 - ubar x

/-- Eq. (3.7) (also (4.6)): the generalization error `(∫_0^T ∫_D |u - u*|² dx dt)^{1/2}`. -/
def genErrorL2 {E : Type*} [MeasureSpace E] (D : Set E) (T : ℝ) (u ustar : E → ℝ → ℝ) : ℝ :=
  Real.sqrt (∫ t in Set.Ioo 0 T, ∫ x in D, (u x t - ustar x t) ^ 2)

/-- Eq. (3.13): `C_1 = (T + (1 + 2C_f) T² e^{(1 + 2C_f)T})^{1/2}`. -/
def heatC1 (T Cf : ℝ) : ℝ :=
  Real.sqrt (T + (1 + 2 * Cf) * T ^ 2 * Real.exp ((1 + 2 * Cf) * T))

/-- Eq. (3.13): `C_{∂D}(u, u*) = |∂D|^{1/2} (‖u‖_{C^1([0,T]×∂D)} + ‖u*‖_{C^1([0,T]×∂D)})`. -/
def heatCbdry {n : ℕ} (D : Set (Pt (n + 1))) (T : ℝ) (u ustar : Pt (n + 1) → ℝ → ℝ) : ℝ :=
  Real.sqrt ((surfaceMeasure n (frontier D)).toReal) * (c1NormBdry D T u + c1NormBdry D T ustar)

/-! ### Section 4: viscous scalar conservation laws on `(0, 1)` -/

/-- The closed space-time rectangle `[0, 1] × [0, T]`. -/
def rect (T : ℝ) : Set (ℝ × ℝ) := Set.Icc 0 1 ×ˢ Set.Icc 0 T

/-- `∂_x v(x, t)`. -/
def dx (v : ℝ → ℝ → ℝ) (x t : ℝ) : ℝ := deriv (fun y => v y t) x

/-- Eq. (4.1): `u` is a classical solution of `u_t + f(u)_x = ν u_xx` in `(0, 1) × (0, T)`,
`u(x, 0) = ū(x)` in `(0, 1)`, `u(0, t) = u(1, t) = 0` for `t ∈ [0, T]`. -/
def IsVSCLSolution (T ν : ℝ) (f ubar : ℝ → ℝ) (u : ℝ → ℝ → ℝ) : Prop :=
  (∀ x ∈ Set.Ioo (0 : ℝ) 1, ∀ t ∈ Set.Ioo 0 T,
      deriv (u x) t + deriv (fun y => f (u y t)) x = ν * deriv (fun y => dx u y t) x) ∧
    (∀ x ∈ Set.Ioo (0 : ℝ) 1, u x 0 = ubar x) ∧ ∀ t ∈ Set.Icc 0 T, u 0 t = 0 ∧ u 1 t = 0

/-- Section 4.2: `u*` is (the realization of) a neural network (2.8) of `(x, t) ∈ ℝ²` with
scalar output. -/
def IsPINN1D (σ : ℝ → ℝ) (ustar : ℝ → ℝ → ℝ) : Prop :=
  ∃ g : (Fin 2 → ℝ) → (Fin 1 → ℝ), IsNeuralNet σ g ∧ ∀ x t, ustar x t = g ![x, t] 0

/-- Eq. (4.2): the interior residual `∂_t u_θ + ∂_x f(u_θ) - ν ∂_xx u_θ`. -/
def vsclResInt (ν : ℝ) (f : ℝ → ℝ) (v : ℝ → ℝ → ℝ) (x t : ℝ) : ℝ :=
  deriv (v x) t + deriv (fun y => f (v y t)) x - ν * deriv (fun y => dx v y t) x

/-- Eq. (4.4): the temporal boundary residual `u_θ(x, 0) - ū(x)`. -/
def vsclResTb (ubar : ℝ → ℝ) (v : ℝ → ℝ → ℝ) (x : ℝ) : ℝ := v x 0 - ubar x

/-- Eq. (4.9), as used in the proof ((4.14)-(4.15)): `C_{f,u,u*} = max_{|s| ≤ M} |f''(s)| ‖u_x‖_∞`
with `M = max(‖u‖_∞, ‖u*‖_∞)`, all norms over `[0,1] × [0,T]`. -/
def vsclCf (T : ℝ) (f : ℝ → ℝ) (u ustar : ℝ → ℝ → ℝ) : ℝ :=
  supOn (Set.Icc (-max (supOn (rect T) (fun q => |u q.1 q.2|))
      (supOn (rect T) (fun q => |ustar q.1 q.2|)))
      (max (supOn (rect T) (fun q => |u q.1 q.2|)) (supOn (rect T) (fun q => |ustar q.1 q.2|))))
    (fun s => |deriv (deriv f) s|) *
  supOn (rect T) (fun q => |dx u q.1 q.2|)

/-- Eq. (4.9): `𝐂_b = ‖u_x‖_{C([0,1]×[0,T])} + ‖u*_x‖_{C([0,1]×[0,T])}`. -/
def vsclCb (T : ℝ) (u ustar : ℝ → ℝ → ℝ) : ℝ :=
  supOn (rect T) (fun q => |dx u q.1 q.2|) + supOn (rect T) (fun q => |dx ustar q.1 q.2|)

/-- Theorem 4.1, as used in its proof: `𝐂̄_b = max_{|s| ≤ ‖u*‖_{C^0([0,1]×[0,T])}} |f'(s)|`. -/
def vsclCbarb (T : ℝ) (f : ℝ → ℝ) (ustar : ℝ → ℝ → ℝ) : ℝ :=
  supOn (Set.Icc (-supOn (rect T) (fun q => |ustar q.1 q.2|))
      (supOn (rect T) (fun q => |ustar q.1 q.2|)))
    (fun s => |deriv f s|)

end PINNGeneralization
Source
Mishra and Molinaro, Estimates on the generalization error of Physics Informed Neural Networks (PINNs) for approximating PDEs, arXiv:2006.16144v3 (2023), Sections 2.1-2.4, 3.1-3.3 and 4.1-4.3
Read-back

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

Common conventions used throughout.

  • Rn\mathbb R^nRn denotes nnn-tuples of reals with the Euclidean norm ∣⋅∣|\cdot|∣⋅∣.
  • λ\lambdaλ denotes Lebesgue measure. On Rn\mathbb R^nRn it is normalized so that the unit cube has measure 111.
  • A derivative of a function at a point where it is not differentiable is taken to be 000.
  • A Bochner integral of a non-integrable function is taken to be 000.
  • A real supremum of an empty set or of a set not bounded above is taken to be 000.
  • x=0\sqrt{x}=0x​=0 for x<0x<0x<0, and 1/0=01/0=01/0=0.
  • Real powers xyx^yxy use the convention 0y=00^y=00y=0 for y≠0y\neq 0y=0 and 00=10^0=100=1. For negative bases they take an unspecified real value.
  • When an extended-real quantity is converted to a real number, the value +∞+\infty+∞ becomes 000.

None of the definitions below assume anything beyond what is listed for them.

Pt(n)\mathrm{Pt}(n)Pt(n). This is the Euclidean space Rn\mathbb R^nRn (real nnn-tuples with the Euclidean norm and Lebesgue measure). n=0n=0n=0 is allowed, in which case it is a single point.

supOn(S,g)\mathrm{supOn}(S,g)supOn(S,g). For any set SSS and any real-valued ggg on it, this is

sup⁡Sg:=sup⁡{g(y):y∈S}.\sup_S g := \sup\{g(y) : y\in S\}.Ssup​g:=sup{g(y):y∈S}.

No continuity or compactness is required. If S=∅S=\emptysetS=∅, or if g(S)g(S)g(S) is unbounded above, the value is 000.

Neural network (IsNeuralNet(σ,g)\mathrm{IsNeuralNet}(\sigma,g)IsNeuralNet(σ,g)). Let σ:R→R\sigma:\mathbb R\to\mathbb Rσ:R→R be an arbitrary function (no regularity assumed). A map g:Rdin→Rdoutg:\mathbb R^{d_{\rm in}}\to\mathbb R^{d_{\rm out}}g:Rdin​→Rdout​ is a network if there exist the following:

  • a natural number K>1K>1K>1;
  • widths w0,w1,w2,⋯∈Nw_0,w_1,w_2,\dots\in\mathbb Nw0​,w1​,w2​,⋯∈N with w0=dinw_0=d_{\rm in}w0​=din​ and wK=doutw_K=d_{\rm out}wK​=dout​;
  • real matrices Wk∈Rwk+1×wkW_k\in\mathbb R^{w_{k+1}\times w_k}Wk​∈Rwk+1​×wk​ and vectors bk∈Rwk+1b_k\in\mathbb R^{w_{k+1}}bk​∈Rwk+1​ for every k≥0k\ge 0k≥0;
  • maps zk:Rdin→Rwkz_k:\mathbb R^{d_{\rm in}}\to\mathbb R^{w_k}zk​:Rdin​→Rwk​.

These must satisfy, for every input yyy:

z0(y)=y,zk+1(y)=σ(Wkzk(y)+bk) (componentwise) for k+1<K,zK(y)=WK−1zK−1(y)+bK−1,z_0(y)=y,\qquad z_{k+1}(y)=\sigma\big(W_k z_k(y)+b_k\big)\ \text{(componentwise) for } k+1<K,\qquad z_K(y)=W_{K-1}z_{K-1}(y)+b_{K-1},z0​(y)=y,zk+1​(y)=σ(Wk​zk​(y)+bk​) (componentwise) for k+1<K,zK​(y)=WK−1​zK−1​(y)+bK−1​,

and g(y)=zK(y)g(y)=z_K(y)g(y)=zK​(y).

Some consequences of this definition:

  • There are at least two affine layers, so at least one application of σ\sigmaσ.
  • The last layer has no activation.
  • Intermediate widths may be 000, in which case ggg is constant.
  • Matrices, biases and maps with index beyond KKK are unconstrained and play no role.

LpL^pLp norm (lpNorm(D,p,g)\mathrm{lpNorm}(\mathbb D,p,g)lpNorm(D,p,g)). For D⊆Rn\mathbb D\subseteq\mathbb R^nD⊆Rn, p∈Rp\in\mathbb Rp∈R and g:Rn→Rmg:\mathbb R^n\to\mathbb R^mg:Rn→Rm, this is the real number obtained from the extended-real quantity

∥g∥Lp(D)=(∫D∣g(y)∣p dy)1/p.\|g\|_{L^p(\mathbb D)}=\Big(\int_{\mathbb D}|g(y)|^p\,dy\Big)^{1/p}.∥g∥Lp(D)​=(∫D​∣g(y)∣pdy)1/p.
  • The exponent used is max⁡(p,0)\max(p,0)max(p,0).
  • If p≤0p\le 0p≤0, the value is 000.
  • If 0<p<10<p<10<p<1, it is the above quasi-norm expression.
  • If the integral is +∞+\infty+∞, the value is 000.

Norm on a subspace (IsNormOn(S,ν)\mathrm{IsNormOn}(S,\nu)IsNormOn(S,ν)). Here SSS is a real linear subspace of a real vector space VVV and ν:V→R\nu:V\to\mathbb Rν:V→R. The condition requires, for all v,v′∈Sv,v'\in Sv,v′∈S and a∈Ra\in\mathbb Ra∈R:

  • ν(v)≥0\nu(v)\ge0ν(v)≥0;
  • ν(v)=0⇒v=0\nu(v)=0\Rightarrow v=0ν(v)=0⇒v=0;
  • ν(av)=∣a∣ ν(v)\nu(av)=|a|\,\nu(v)ν(av)=∣a∣ν(v);
  • ν(v+v′)≤ν(v)+ν(v′)\nu(v+v')\le\nu(v)+\nu(v')ν(v+v′)≤ν(v)+ν(v′).

Values of ν\nuν outside SSS are unconstrained.

LpL^pLp-closedness (IsLpClosed(D,p,S)\mathrm{IsLpClosed}(\mathbb D,p,S)IsLpClosed(D,p,S)). Here SSS is a linear subspace of the space of all functions Rn→Rm\mathbb R^n\to\mathbb R^mRn→Rm. The condition is as follows. Take any sequence gj∈Sg_j\in Sgj​∈S and any hhh that is a.e.-strongly measurable on D\mathbb DD with ∥h∥Lp(D)<∞\|h\|_{L^{p}(\mathbb D)}<\infty∥h∥Lp(D)​<∞ (exponent max⁡(p,0)\max(p,0)max(p,0)). Suppose that, in the extended reals,

∥gj−h∥Lp(D)→0.\|g_j-h\|_{L^p(\mathbb D)}\to 0.∥gj​−h∥Lp(D)​→0.

Then there exists h′∈Sh'\in Sh′∈S with h′=hh'=hh′=h λ\lambdaλ-a.e. on D\mathbb DD.

If p≤0p\le 0p≤0, the convergence holds trivially. Since 0∈S0\in S0∈S, the condition then says that every a.e.-strongly measurable hhh agrees a.e. on D\mathbb DD with an element of SSS.

Abstract PDE data (AbstractPDE(n,m,X)\mathrm{AbstractPDE}(n,m,X)AbstractPDE(n,m,X)). Here XXX is a real normed space. The data is a tuple consisting of:

  • a set D⊆Rn\mathbb D\subseteq\mathbb R^nD⊆Rn;
  • a real number ppp;
  • a linear subspace X∗⊆XX^*\subseteq XX∗⊆X;
  • a linear subspace Y∗Y^*Y∗ of the space of all functions Rn→Rm\mathbb R^n\to\mathbb R^mRn→Rm;
  • an arbitrary map D:X→(Rn→Rm)\mathcal D:X\to(\mathbb R^n\to\mathbb R^m)D:X→(Rn→Rm), defined on all of XXX, with no linearity or continuity;
  • an arbitrary function f:Rn→Rmf:\mathbb R^n\to\mathbb R^mf:Rn→Rm.

No conditions are imposed by the structure itself.

Hypotheses (Hyp\mathrm{Hyp}Hyp). For such data, the hypotheses are:

  1. D\mathbb DD is Lebesgue measurable.
  2. 1≤p1\le p1≤p, with ppp a finite real number.
  3. X∗X^*X∗ is topologically closed in XXX.
  4. Every g∈Y∗g\in Y^*g∈Y∗ is a.e.-strongly measurable on D\mathbb DD with ∥g∥Lp(D)<∞\|g\|_{L^p(\mathbb D)}<\infty∥g∥Lp(D)​<∞.
  5. Y∗Y^*Y∗ is LpL^pLp-closed in the above sense.
  6. D(v)∈Y∗\mathcal D(v)\in Y^*D(v)∈Y∗ for every v∈X∗v\in X^*v∈X∗.
  7. f∈Y∗f\in Y^*f∈Y∗.
  8. For every g∈Y∗g\in Y^*g∈Y∗ there exists exactly one v∈Xv\in Xv∈X such that v∈X∗v\in X^*v∈X∗ and D(v)=g\mathcal D(v)=gD(v)=g λ\lambdaλ-a.e. on D\mathbb DD. Uniqueness is as an element of XXX.

Solution (IsSolution(u)\mathrm{IsSolution}(u)IsSolution(u)). This means u∈X∗u\in X^*u∈X∗ and D(u)=f\mathcal D(u)=fD(u)=f λ\lambdaλ-a.e. on D\mathbb DD.

Residual. The residual is R(v):Rn→Rm\mathcal R(v):\mathbb R^n\to\mathbb R^mR(v):Rn→Rm, given by R(v)(y)=D(v)(y)−f(y)\mathcal R(v)(y)=\mathcal D(v)(y)-f(y)R(v)(y)=D(v)(y)−f(y) for every y∈Rny\in\mathbb R^ny∈Rn, not only for y∈Dy\in\mathbb Dy∈D.

Stability (IsStable(Z,∥⋅∥Z,Cpde)\mathrm{IsStable}(Z,\|\cdot\|_Z,C_{pde})IsStable(Z,∥⋅∥Z​,Cpde​)). The conditions are:

  • ZZZ is a closed linear subspace of XXX with Z⊆X∗Z\subseteq X^*Z⊆X∗.
  • ∥⋅∥Z\|\cdot\|_Z∥⋅∥Z​ is a norm on ZZZ in the above sense.
  • Cpde:R×R→RC_{pde}:\mathbb R\times\mathbb R\to\mathbb RCpde​:R×R→R satisfies Cpde(a,b)>0C_{pde}(a,b)>0Cpde​(a,b)>0 for all real a,ba,ba,b. No monotonicity is required.
  • For all v,w∈Zv,w\in Zv,w∈Z,
∥v−w∥X≤Cpde(∥v∥Z,∥w∥Z) ∥D(v)−D(w)∥Lp(D),\|v-w\|_X\le C_{pde}\big(\|v\|_Z,\|w\|_Z\big)\,\|\mathcal D(v)-\mathcal D(w)\|_{L^p(\mathbb D)},∥v−w∥X​≤Cpde​(∥v∥Z​,∥w∥Z​)∥D(v)−D(w)∥Lp(D)​,

with the right-hand norm as in lpNorm\mathrm{lpNorm}lpNorm.

If D(v)−D(w)\mathcal D(v)-\mathcal D(w)D(v)−D(w) has infinite LpL^pLp norm, or if p≤0p\le0p≤0, the right side is 000, and the condition forces v=wv=wv=w. The hypotheses Hyp\mathrm{Hyp}Hyp are not included here.

Quadrature rule. A quadrature rule on a set α\alphaα consists of a number N∈NN\in\mathbb NN∈N (N=0N=0N=0 allowed), points y1,…,yN∈αy_1,\dots,y_N\in\alphay1​,…,yN​∈α, and real weights w1,…,wNw_1,\dots,w_Nw1​,…,wN​. No sign condition is imposed on the weights.

IsOn(S)\mathrm{IsOn}(S)IsOn(S). This means every yi∈Sy_i\in Syi​∈S and every wi≥0w_i\ge0wi​≥0.

Quadrature sum. For g:α→Rg:\alpha\to\mathbb Rg:α→R, the quadrature sum is gˉN=∑i=1Nwi g(yi)\bar g_N=\sum_{i=1}^N w_i\,g(y_i)gˉ​N​=∑i=1N​wi​g(yi​). It equals 000 when N=0N=0N=0.

Quadrature error bound (QuadErrorBound(μ,S,G,∥⋅∥,Cquad,a,Q)\mathrm{QuadErrorBound}(\mu,S,G,\|\cdot\|,C_{quad},a,Q)QuadErrorBound(μ,S,G,∥⋅∥,Cquad​,a,Q)). Let μ\muμ be any measure, SSS any set, GGG a class of real functions, ∥⋅∥\|\cdot\|∥⋅∥ any real-valued functional on functions, Cquad:R→RC_{quad}:\mathbb R\to\mathbb RCquad​:R→R arbitrary, and a∈Ra\in\mathbb Ra∈R arbitrary. The condition requires, for every g∈Gg\in Gg∈G, that ggg is μ\muμ-integrable on SSS and

∣∫Sg dμ−gˉN∣≤Cquad(∥g∥) N−a.\Big|\int_S g\,d\mu-\bar g_N\Big|\le C_{quad}(\|g\|)\,N^{-a}.​∫S​gdμ−gˉ​N​​≤Cquad​(∥g∥)N−a.
  • The points of QQQ are not required to lie in SSS.
  • If N=0N=0N=0 and a≠0a\neq0a=0, then N−a=0N^{-a}=0N−a=0, and the condition forces ∫Sg dμ=0\int_S g\,d\mu=0∫S​gdμ=0 exactly.

Training error. For a rule QQQ, p∈Rp\in\mathbb Rp∈R and R:Rn→RmR:\mathbb R^n\to\mathbb R^mR:Rn→Rm, the training error is

ET=(∑i=1Nwi ∣R(yi)∣p)1/p.\mathcal E_T=\Big(\sum_{i=1}^N w_i\,|R(y_i)|^p\Big)^{1/p}.ET​=(i=1∑N​wi​∣R(yi​)∣p)1/p.

It uses real powers with their junk conventions. For example, p=0p=0p=0 gives the value 111, and a negative inner sum (possible with negative weights) gives an unspecified value.

quadL2(Q,R)\mathrm{quadL2}(Q,R)quadL2(Q,R). For real-valued RRR, this is ∑iwiR(yi)2\sqrt{\sum_i w_i R(y_i)^2}∑i​wi​R(yi​)2​. It equals 000 if the sum is negative.

CkC^kCk norm (ckNorm(k,S,g)\mathrm{ckNorm}(k,S,g)ckNorm(k,S,g)). For g:E→Rg:E\to\mathbb Rg:E→R on a real normed space EEE, this is

sup⁡{∥Djg(y)∥:0≤j≤k, y∈S},\sup\big\{\|D^jg(y)\| : 0\le j\le k,\ y\in S\big\},sup{∥Djg(y)∥:0≤j≤k, y∈S},

where DjgD^jgDjg is the jjj-th iterated Fréchet derivative on the whole space (not within SSS) with its operator norm.

  • DjgD^jgDjg is taken as 000 wherever ggg is not differentiable enough.
  • The value is 000 if S=∅S=\emptysetS=∅ or the set is unbounded.

Unit cube. This is [0,1]n={y∈Rn:0≤yi≤1 ∀i}[0,1]^n=\{y\in\mathbb R^n:0\le y_i\le1\ \forall i\}[0,1]n={y∈Rn:0≤yi​≤1 ∀i}. For n=0n=0n=0 it is the single point.

Training law. This is the product measure on (Rn)N(\mathbb R^n)^N(Rn)N of NNN copies of Lebesgue measure restricted to [0,1]n[0,1]^n[0,1]n, i.e. the law of NNN i.i.d. uniform points S=(y1,…,yN)\mathbb S=(y_1,\dots,y_N)S=(y1​,…,yN​). For N=0N=0N=0 it is the unit mass on the empty tuple.

Cumulative generalization error. For u∈Xu\in Xu∈X (a normed group) and u∗:(Rn)N→Xu^*:(\mathbb R^n)^N\to Xu∗:(Rn)N→X, it is

EˉG=∫∥u−u∗(S)∥X dS,\bar{\mathcal E}_G=\int\|u-u^*(\mathbb S)\|_X\,d\mathbb S,EˉG​=∫∥u−u∗(S)∥X​dS,

taken w.r.t. the training law. It is 000 if the integrand is not integrable.

Cumulative training error. For R:(Rn)N→(Rn→Rm)R:(\mathbb R^n)^N\to(\mathbb R^n\to\mathbb R^m)R:(Rn)N→(Rn→Rm), write RSR_{\mathbb S}RS​ for the residual attached to the training set S\mathbb SS. The cumulative training error is

EˉT=∫1N∑j=1N∣RS(yj)∣ dS,\bar{\mathcal E}_T=\int \frac1N\sum_{j=1}^N|R_{\mathbb S}(y_j)|\,d\mathbb S,EˉT​=∫N1​j=1∑N​∣RS​(yj​)∣dS,

where yjy_jyj​ are the points of S\mathbb SS. It equals 000 when N=0N=0N=0 or the integrand is not integrable.

Cumulative validation error. For fixed points z1,…,zN∈Rnz_1,\dots,z_N\in\mathbb R^nz1​,…,zN​∈Rn, it is

EˉV=1N∫∑j=1N∣RS(zj)∣ dS.\bar{\mathcal E}_V=\frac1N\int\sum_{j=1}^N|R_{\mathbb S}(z_j)|\,d\mathbb S.EˉV​=N1​∫j=1∑N​∣RS​(zj​)∣dS.

The same junk conventions apply.

Validation gap. Let (Ω,P)(\Omega,P)(Ω,P) be an arbitrary measure space. PPP need not be a probability measure and is not tied to the uniform law. Let zj:Ω→Rnz_j:\Omega\to\mathbb R^nzj​:Ω→Rn be arbitrary maps, with no independence or distribution assumptions. The validation gap is

ETV=∫Ω∣EˉT−EˉV(z1(ω),…,zN(ω))∣ dP(ω).\mathcal E_{TV}=\int_\Omega\big|\bar{\mathcal E}_T-\bar{\mathcal E}_V(z_1(\omega),\dots,z_N(\omega))\big|\,dP(\omega).ETV​=∫Ω​​EˉT​−EˉV​(z1​(ω),…,zN​(ω))​dP(ω).

Residual standard deviation (residualStd(R)\mathrm{residualStd}(R)residualStd(R)). Write ρ(z)=∫∣RS(z)∣ dS\rho(z)=\int|R_{\mathbb S}(z)|\,d\mathbb Sρ(z)=∫∣RS​(z)∣dS (w.r.t. the training law). Then

std(∣R∣)=(∫[0,1]n(ρ(z)−∫[0,1]nρ(y) dy)2dz)1/2.\mathrm{std}(|R|)=\Big(\int_{[0,1]^n}\Big(\rho(z)-\int_{[0,1]^n}\rho(y)\,dy\Big)^2dz\Big)^{1/2}.std(∣R∣)=(∫[0,1]n​(ρ(z)−∫[0,1]n​ρ(y)dy)2dz)1/2.

All integrals carry the junk-zero convention.

CkC^kCk boundary (HasCk Boundary(k,D)\mathrm{HasCk\,Boundary}(k,D)HasCkBoundary(k,D)). For k∈Nk\in\mathbb Nk∈N (finite) and D⊆Rn+1D\subseteq\mathbb R^{n+1}D⊆Rn+1, the condition is as follows. For every point x0x_0x0​ of the topological boundary ∂D\partial D∂D, there exist:

  • r>0r>0r>0;
  • a linear isometric bijection AAA of Rn+1\mathbb R^{n+1}Rn+1 (an orthogonal map, no translation);
  • a kkk-times continuously differentiable γ:Rn→R\gamma:\mathbb R^n\to\mathbb Rγ:Rn→R;

such that

D∩B(x0,r)={x∈B(x0,r): γ((Ax)1,…,(Ax)n)<(Ax)n+1}.D\cap B(x_0,r)=\{x\in B(x_0,r):\ \gamma\big((Ax)_1,\dots,(Ax)_n\big)<(Ax)_{n+1}\}.D∩B(x0​,r)={x∈B(x0​,r): γ((Ax)1​,…,(Ax)n​)<(Ax)n+1​}.

If ∂D=∅\partial D=\emptyset∂D=∅, the condition holds vacuously.

CkC^kCk domain (IsCkDomain(k,D)\mathrm{IsCkDomain}(k,D)IsCkDomain(k,D)). This means D⊆Rn+1D\subseteq\mathbb R^{n+1}D⊆Rn+1 is open, connected (in particular nonempty), bounded, and has CkC^kCk boundary as above.

Surface measure. On Rn+1\mathbb R^{n+1}Rn+1, the surface measure is

ds=λ(BRn(0,1))2n Hn,ds=\frac{\lambda(B_{\mathbb R^n}(0,1))}{2^n}\,\mathcal H^n,ds=2nλ(BRn​(0,1))​Hn,

where Hn\mathcal H^nHn is the nnn-dimensional Hausdorff measure built from diamn\mathrm{diam}^ndiamn with no normalizing constant. For n=0n=0n=0 the factor is 111.

Boundary–time measure. This is the product measure ds∣∂D⊗λ∣[0,T]ds|_{\partial D}\otimes\lambda|_{[0,T]}ds∣∂D​⊗λ∣[0,T]​ on Rn+1×R\mathbb R^{n+1}\times\mathbb RRn+1×R. It is zero if T<0T<0T<0.

Partial derivative. For g:Rn→Rg:\mathbb R^n\to\mathbb Rg:Rn→R, the partial derivative is ∂xig(x)=ddr∣r=0g(x+rei)\partial_{x_i}g(x)=\frac{d}{dr}\big|_{r=0}g(x+re_i)∂xi​​g(x)=drd​​r=0​g(x+rei​), where eie_iei​ is the iii-th standard basis vector. It equals 000 where this derivative does not exist.

Laplacian. It is Δg(x)=∑i=1n∂xi(∂xig)(x)\Delta g(x)=\sum_{i=1}^n\partial_{x_i}\big(\partial_{x_i}g\big)(x)Δg(x)=∑i=1n​∂xi​​(∂xi​​g)(x), where the inner ∂xig\partial_{x_i}g∂xi​​g is the everywhere-defined function above (including its junk zeros).

Spatial gradient length. For u:Rn×R→Ru:\mathbb R^n\times\mathbb R\to\mathbb Ru:Rn×R→R, it is ∣∇xu(x,t)∣=(∑i(∂xiu(⋅,t)(x))2)1/2|\nabla_xu(x,t)|=\big(\sum_i(\partial_{x_i}u(\cdot,t)(x))^2\big)^{1/2}∣∇x​u(x,t)∣=(∑i​(∂xi​​u(⋅,t)(x))2)1/2.

Boundary C1C^1C1 norm (c1NormBdry(D,T,u)\mathrm{c1NormBdry}(D,T,u)c1NormBdry(D,T,u)). This is

sup⁡∂D×[0,T]∣u∣+sup⁡∂D×[0,T]∣∂tu∣+sup⁡∂D×[0,T]∣∇xu∣,\sup_{\partial D\times[0,T]}|u|+\sup_{\partial D\times[0,T]}|\partial_tu|+\sup_{\partial D\times[0,T]}|\nabla_xu|,∂D×[0,T]sup​∣u∣+∂D×[0,T]sup​∣∂t​u∣+∂D×[0,T]sup​∣∇x​u∣,

with each supremum following the supOn\mathrm{supOn}supOn convention (value 000 if empty or unbounded).

  • ∂tu(x,t)\partial_tu(x,t)∂t​u(x,t) is the ordinary two-sided derivative of t↦u(x,t)t\mapsto u(x,t)t↦u(x,t), also at t=0t=0t=0 and t=Tt=Tt=T.
  • It is 000 where that derivative does not exist.

Heat-type solution (IsHeatSolution(D,T,f,uˉ,u)\mathrm{IsHeatSolution}(D,T,f,\bar u,u)IsHeatSolution(D,T,f,uˉ,u)). Here D⊆Rn+1D\subseteq\mathbb R^{n+1}D⊆Rn+1 is arbitrary (not required to be a domain), T∈RT\in\mathbb RT∈R, and f,uˉf,\bar uf,uˉ are arbitrary. A function u:Rn+1×R→Ru:\mathbb R^{n+1}\times\mathbb R\to\mathbb Ru:Rn+1×R→R is a solution if:

  1. For all x∈Dx\in Dx∈D and t∈(0,T)t\in(0,T)t∈(0,T):
∂tu(x,t)=Δxu(⋅,t)(x)+f(u(x,t)).\partial_tu(x,t)=\Delta_xu(\cdot,t)(x)+f(u(x,t)).∂t​u(x,t)=Δx​u(⋅,t)(x)+f(u(x,t)).
  1. u(x,0)=uˉ(x)u(x,0)=\bar u(x)u(x,0)=uˉ(x) for all x∈Dx\in Dx∈D.
  2. u(x,t)=0u(x,t)=0u(x,t)=0 for all x∈∂Dx\in\partial Dx∈∂D and t∈(0,T)t\in(0,T)t∈(0,T).

No differentiability or continuity is required. Derivatives are the everywhere-defined ones with junk value 000 at points of non-differentiability, so equation 1 may hold at points where uuu is not differentiable. If T≤0T\le0T≤0, conditions 1 and 3 are vacuous.

PINN in space–time (IsPINN(σ,u∗)\mathrm{IsPINN}(\sigma,u^*)IsPINN(σ,u∗)). There is a network g:Rn+2→R1g:\mathbb R^{n+2}\to\mathbb R^1g:Rn+2→R1 in the above sense (with activation σ\sigmaσ) such that u∗(x,t)=g(x1,…,xn+1,t)u^*(x,t)=g(x_1,\dots,x_{n+1},t)u∗(x,t)=g(x1​,…,xn+1​,t) for all x∈Rn+1x\in\mathbb R^{n+1}x∈Rn+1 and t∈Rt\in\mathbb Rt∈R.

Interior residual (heat). It is Rint(x,t)=∂tv(x,t)−Δxv(⋅,t)(x)−f(v(x,t))\mathcal R_{int}(x,t)=\partial_tv(x,t)-\Delta_xv(\cdot,t)(x)-f(v(x,t))Rint​(x,t)=∂t​v(x,t)−Δx​v(⋅,t)(x)−f(v(x,t)), with the junk-derivative conventions above.

Temporal residual (heat). It is Rtb(x)=v(x,0)−uˉ(x)\mathcal R_{tb}(x)=v(x,0)-\bar u(x)Rtb​(x)=v(x,0)−uˉ(x).

L2L^2L2 generalization error (genErrorL2(D,T,u,u∗)\mathrm{genErrorL2}(D,T,u,u^*)genErrorL2(D,T,u,u∗)). On a measure space EEE with its default measure, it is

(∫(0,T)∫D(u(x,t)−u∗(x,t))2 dx dt)1/2.\Big(\int_{(0,T)}\int_D\big(u(x,t)-u^*(x,t)\big)^2\,dx\,dt\Big)^{1/2}.(∫(0,T)​∫D​(u(x,t)−u∗(x,t))2dxdt)1/2.

An inner or outer integral is 000 if its integrand is not integrable.

Constant C1C_1C1​. It is C1=(T+(1+2Cf)T2e(1+2Cf)T)1/2C_1=\big(T+(1+2C_f)T^2e^{(1+2C_f)T}\big)^{1/2}C1​=(T+(1+2Cf​)T2e(1+2Cf​)T)1/2, for arbitrary real T,CfT,C_fT,Cf​. It is 000 if the radicand is negative.

Boundary constant C∂DC_{\partial D}C∂D​. It is

C∂D=∣∂D∣1/2(∥u∥C1(∂D×[0,T])+∥u∗∥C1(∂D×[0,T])),C_{\partial D}=|\partial D|^{1/2}\big(\|u\|_{C^1(\partial D\times[0,T])}+\|u^*\|_{C^1(\partial D\times[0,T])}\big),C∂D​=∣∂D∣1/2(∥u∥C1(∂D×[0,T])​+∥u∗∥C1(∂D×[0,T])​),

where ∣∂D∣|\partial D|∣∂D∣ is the surface measure of ∂D\partial D∂D (replaced by 000 if infinite) and the norms are the boundary C1C^1C1 norm above.

Rectangle. It is [0,1]×[0,T]⊆R2[0,1]\times[0,T]\subseteq\mathbb R^2[0,1]×[0,T]⊆R2. It is empty if T<0T<0T<0.

∂x\partial_x∂x​. For v:R×R→Rv:\mathbb R\times\mathbb R\to\mathbb Rv:R×R→R, it is ∂xv(x,t)=ddy∣y=xv(y,t)\partial_xv(x,t)=\frac{d}{dy}\big|_{y=x}v(y,t)∂x​v(x,t)=dyd​​y=x​v(y,t), with value 000 if this does not exist.

Viscous conservation-law solution (IsVSCLSolution(T,ν,f,uˉ,u)\mathrm{IsVSCLSolution}(T,\nu,f,\bar u,u)IsVSCLSolution(T,ν,f,uˉ,u)). Here ν∈R\nu\in\mathbb Rν∈R is arbitrary, with no positivity required. A function u:R×R→Ru:\mathbb R\times\mathbb R\to\mathbb Ru:R×R→R is a solution if:

  1. For all x∈(0,1)x\in(0,1)x∈(0,1) and t∈(0,T)t\in(0,T)t∈(0,T):
∂tu(x,t)+∂x[f(u(⋅,t))](x)=ν ∂x(∂xu)(x,t).\partial_tu(x,t)+\partial_x\big[f(u(\cdot,t))\big](x)=\nu\,\partial_x\big(\partial_xu\big)(x,t).∂t​u(x,t)+∂x​[f(u(⋅,t))](x)=ν∂x​(∂x​u)(x,t).
  1. u(x,0)=uˉ(x)u(x,0)=\bar u(x)u(x,0)=uˉ(x) for x∈(0,1)x\in(0,1)x∈(0,1).
  2. u(0,t)=u(1,t)=0u(0,t)=u(1,t)=0u(0,t)=u(1,t)=0 for every t∈[0,T]t\in[0,T]t∈[0,T].

All derivatives use the junk-zero convention, and no regularity is assumed.

1D PINN (IsPINN1D(σ,u∗)\mathrm{IsPINN1D}(\sigma,u^*)IsPINN1D(σ,u∗)). There is a network g:R2→R1g:\mathbb R^2\to\mathbb R^1g:R2→R1 with activation σ\sigmaσ such that u∗(x,t)=g(x,t)u^*(x,t)=g(x,t)u∗(x,t)=g(x,t) for all real x,tx,tx,t.

Interior residual (VSCL). It is ∂tv+∂x[f(v)]−ν ∂x∂xv\partial_tv+\partial_x[f(v)]-\nu\,\partial_x\partial_xv∂t​v+∂x​[f(v)]−ν∂x​∂x​v, evaluated at (x,t)(x,t)(x,t).

Temporal residual (VSCL). It is v(x,0)−uˉ(x)v(x,0)-\bar u(x)v(x,0)−uˉ(x).

Constant Cf,u,u∗C_{f,u,u^*}Cf,u,u∗​. Let

M=max⁡(sup⁡[0,1]×[0,T]∣u∣, sup⁡[0,1]×[0,T]∣u∗∣).M=\max\Big(\sup_{[0,1]\times[0,T]}|u|,\ \sup_{[0,1]\times[0,T]}|u^*|\Big).M=max([0,1]×[0,T]sup​∣u∣, [0,1]×[0,T]sup​∣u∗∣).

Then

Cf,u,u∗=(sup⁡s∈[−M,M]∣f′′(s)∣)⋅sup⁡[0,1]×[0,T]∣∂xu∣.C_{f,u,u^*}=\Big(\sup_{s\in[-M,M]}|f''(s)|\Big)\cdot\sup_{[0,1]\times[0,T]}|\partial_xu|.Cf,u,u∗​=(s∈[−M,M]sup​∣f′′(s)∣)⋅[0,1]×[0,T]sup​∣∂x​u∣.

Here f′′f''f′′ is the derivative of the everywhere-defined f′f'f′, with junk zeros. All suprema follow the supOn\mathrm{supOn}supOn convention.

Constant Cb\mathbf C_bCb​. It is

Cb=sup⁡[0,1]×[0,T]∣∂xu∣+sup⁡[0,1]×[0,T]∣∂xu∗∣.\mathbf C_b=\sup_{[0,1]\times[0,T]}|\partial_xu|+\sup_{[0,1]\times[0,T]}|\partial_xu^*|.Cb​=[0,1]×[0,T]sup​∣∂x​u∣+[0,1]×[0,T]sup​∣∂x​u∗∣.

Constant Cˉb\bar{\mathbf C}_bCˉb​. Let M∗=sup⁡[0,1]×[0,T]∣u∗∣M^*=\sup_{[0,1]\times[0,T]}|u^*|M∗=sup[0,1]×[0,T]​∣u∗∣. Then

Cˉb=sup⁡s∈[−M∗,M∗]∣f′(s)∣,\bar{\mathbf C}_b=\sup_{s\in[-M^*,M^*]}|f'(s)|,Cˉb​=s∈[−M∗,M∗]sup​∣f′(s)∣,

with the junk-zero conventions for f′f'f′ and the suprema.

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