Bridging 1D ReLU MLPs to Tensor inputs (ridge functions) #
This file is a first “bridge step” between:
- the constructive 1D ReLU approximation theorem in
universal_approximation.lean, and - nD Tensor inputs
Tensor ℝ (.dim n .scalar)used throughout TorchLean.
What is proved here (fully proved):
- Exact representability of affine maps $x\mapsto w\mathbin{\cdot}x+b$ by a two-layer ReLU MLP of width $2$, using $\operatorname{ReLU}(u)-\operatorname{ReLU}(-u)=u$.
- Ridge lifting: any 1D 2-layer ReLU MLP can be lifted to an nD Tensor input via $u=w\mathbin{\cdot}x+c$, by scaling each first-layer weight by $w$ and adjusting biases accordingly.
What is not proved here: the full classical nD universal approximation theorem for ReLU MLPs. That requires substantially more formalization (e.g. piecewise-linear approximation machinery or a functional-analytic Cybenko/Leshno style proof).
Tensor ℝ (.dim n .scalar) viewed as an $n$-vector of real scalars.
Instances For
Rewrapping a vector by Tensor.dim preserves the underlying coordinate function toVec.
Evaluate a single-hidden-layer ReLU MLP on a tensor input and return the scalar output.
Instances For
The identity $\operatorname{ReLU}(u)-\operatorname{ReLU}(-u)=u$, used to represent affine maps exactly with ReLU.
Unfold mlp_forward as
$\operatorname{linear}\circ\operatorname{ReLU}\circ\operatorname{linear}$.
This lemma is used as the standard normalization step in “network algebra” proofs.
Extract the unique entry from row i of an (m×1) tensor interpreted as a matrix.
Instances For
Extract the i-th entry of a vector-shaped tensor.
Instances For
Specialized matrix-vector multiplication when the input is a scalar (dimension 1).
General matrix-vector multiplication for matrixMN and a vector written as Tensor.dim.
This generalizes the 1-row dot-product lemma from universal_approximation.lean to arbitrary m.
First layer for exact affine representability.
Given an affine form $u(x)=w\mathbin{\cdot}x+b$, this layer outputs $[u(x),-u(x)]$.
Instances For
Second layer for exact affine representability.
With hidden activations $[\operatorname{ReLU}(u),\operatorname{ReLU}(-u)]$, this output layer computes $\operatorname{ReLU}(u)-\operatorname{ReLU}(-u)=u$.
Instances For
Exact representability of coordinate projections $x\mapsto x_i$ by a width-$2$ ReLU MLP.
Ridge lifting #
Given a one-dimensional MLP (l1,l2) and an affine scalar map
$u=w\mathbin{\cdot}x+c$, we build an $n$-dimensional MLP whose pre-activations match the
one-dimensional pre-activations at $u$. This lets you reuse any one-dimensional approximation
result for functions of one affine form (“ridge functions”).
Lift a 1D first-layer spec to an nD first-layer spec along a ridge direction.
Given a scalar one-dimensional first layer that expects an input $u\in\mathbb{R}$, this constructs an $n$-dimensional first layer that feeds $u=w\mathbin{\cdot}x+c$.
Instances For
Lifting lemma: the lifted $n$-dimensional MLP agrees with the one-dimensional MLP evaluated at $w\mathbin{\cdot}x+c$.