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 scalar from 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}$.
Move a scalar initial accumulator out of a left fold that only adds terms.
This is bookkeeping for converting TorchLean's list-fold tensor semantics into Mathlib finite sums.
Convert the List.finRange fold used in matVecMulSpec into a Finset.univ sum.
vectorN is the dependent-tensor vector constructor expanded pointwise.
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
Fold lemma matching the scalar tensor accumulator used in matVecMulSpec.
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.
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.