AFTD Auto-Formalizing Theoretical Domains

evalHiddenLayer

def

Evaluation of a hidden layer of width $k$ on an input vector $x \in \mathbb{R}^k$, computing for each neuron $i$ the rectified linear unit of the affine combination: the sum over $j$ of the weight matrix entry times $x_j$, plus the bias of neuron $i$.

Statement

def evalHiddenLayer {k : ℕ} (layer : ReLUHiddenLayer k) (x : Fin k → ℝ) : Fin k → ℝ
Defined in
arXiv:2610.06092 Section 2.1
Verified
25 Oct 2026
Axioms
none listed
Built on 2
  • ReLUHiddenLayerA hidden layer of width k consists of a k-by-k rational weight matrix and a rational bias vector of length k.
  • reluThe rectified linear unit (ReLU) activation function maps each real number x to max(x, 0).
Used by 7
  • op75_compact_block_effectFor an input in the unit interval and a nonnegative accumulator, the seven-layer block for a nonnegative integer weight transforms the…
  • op75_network_evalFor a unit-interval input, the explicit subset-sum network evaluates to the final orbit coordinate plus the absolute difference between…
  • relu_network_width4_liftingWidth-4 lifting theorem (Theorem 5.8 of arXiv:2610.06092): For every 3-CNF formula $f$ with variable indices in $\mathbb{N}$, there exists…
  • evalNetworkEvaluation of a feedforward ReLU neural network of hidden layer width $k$ on a real input $x$, which forms an initial width-$k$ vector by…
  • op75_fold_blocksFor a nonnegative initial accumulator and an initial point in the unit interval, folding the seven-layer blocks gives the final orbit…
  • relu_network_eval_continuousFor every natural number $k$ and every feedforward ReLU neural network net of width $k$ with rational weights and biases, the evaluation…
  • op_75_relu_width3_liftingOpen Problem OP-75 (arXiv:2610.06092, Remark 5.15): For every 3-CNF formula $f$ with variable indices in $\mathbb{N}$, there exists a…

Read back from the Lean

Given a natural number k, a layer layer : ReLUHiddenLayer k (consisting of a rational weight matrix weight : Fin k → Fin k → ℚ and a rational bias vector bias : Fin k → ℚ), and an input vector x : Fin k → ℝ, evalHiddenLayer defines the function returning the vector in Fin k → ℝ whose i-th coordinate is relu ((∑ j : Fin k, (layer.weight i j : ℝ) * x j) + (layer.bias i : ℝ)).

Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.

Lean source view module on GitHub

/-- Evaluate a single ReLU hidden layer on an input vector. -/
def evalHiddenLayer {k : ℕ} (layer : ReLUHiddenLayer k) (x : Fin k → ℝ) : Fin k → ℝ := fun i => relu ((∑ j, (layer.weight i j : ℝ) * x j) + (layer.bias i : ℝ))
See it in the graphDiscuss this resultChallenge it