Universal approximation (1D, constructive) #
On a compact interval $I=[a,b]$, any Lipschitz function $f:\mathbb{R}\to\mathbb{R}$ can be uniformly approximated by a single-hidden-layer ReLU network (a 2-layer MLP).
This file formalizes the classic constructive proof strategy:
- approximate $f$ by a polygonal function on a uniform grid,
- express that polygonal function as an affine term plus a finite sum of hinges $\operatorname{ReLU}(x-t_i)$,
- package the hinge representation as TorchLean's spec-level 2-layer MLP (
NN.Spec.Models.Mlp).
Main result #
relu_universal_approximation_Icc: existence of a 2-layer ReLU MLP approximator onSet.Icc a b.
References #
- Leshno, Lin, Pinkus, Schocken (1993), Multilayer feedforward networks with a nonpolynomial activation function can approximate any function.
- Yarotsky (2017), Error bounds for approximations with deep ReLU networks.
- Pinkus (1999), Approximation theory of the MLP model in neural networks.
Shorthand for relu in this development, using TorchLean’s spec semantics.
Instances For
Extract the unique entry of a length-1 tensor.
Instances For
Evaluate a 2-layer ReLU MLP on a scalar input.
Instances For
TorchLean's MLP forward pass is exactly $\operatorname{linear}\circ\operatorname{ReLU}\circ\operatorname{linear}$.
First real hinge layer: hidden unit $i$ computes $x-t_i$ before ReLU.
Instances For
Second real hinge layer: sum hidden activations with coefficients $c_i$ and bias $b$.
Instances For
Matrix-vector multiply for a one-row matrix is the expected finite dot product.
Matrix-vector multiply by the all-ones column extracts the scalar input into every hidden unit.
The explicit two-layer network built from hingeLayer1 and hingeLayer2 computes hingeFun.
This is the main semantic bridge from the approximation-theory hinge representation to TorchLean's spec-level MLP model.
The uniform grid with left endpoint a and spacing δ.
Instances For
The uniform grid starts at its left endpoint.
Summing the slope differences recovers the slope of the last segment.
The finite-index hinge network and the range-sum interpolant have the same value.
A uniform mesh with N cells gives a width-N hinge approximation whenever
2 * L * ((b - a) / N) is below the requested error. The same interpolant serves both the
qualitative existence theorem and the theorem with an explicit width.
Explicit hidden width for the 1D Lipschitz ReLU approximation construction.
Instances For
The explicit ReLU approximation width is always positive.
The chosen width makes the mesh-size error term smaller than the target accuracy.
This is the arithmetic heart of the explicit-rate theorem: the ceiling construction ensures $N>2L(b-a)/\varepsilon$, hence $2L(b-a)/N<\varepsilon$.
1D Universal Approximation (ReLU, one hidden layer).
This is the classic constructive proof: Lipschitz continuity on $[a,b]$, a uniform partition, and piecewise-linear interpolation, then represent the interpolant as a finite linear combination of hinges $\operatorname{ReLU}(x-t_i)$.
1D Universal Approximation (ReLU, one hidden layer), stated as an existence theorem for a 2-layer MLP.
This is a wrapper around relu_universal_approximation_Icc_hinge that instantiates the linear
layers as the explicit hinge construction.