Verification of Width-3 ReLU Networks on the Unit Interval Decides Nonnegative Integer Subset Sum
medium tier2026-11-16OP-75reviewed by Codex中文版
Abstract
The computational complexity of verifying feedforward neural networks with rectified linear unit (ReLU) activations on low-dimensional domains depends critically on the network width. In arXiv:2610.06092, the zero-existence problem on the unit interval [0,1] was shown to be NP-complete at width 4 via a lifting reduction from 3-CNF satisfiability, while the problem at width 3 was left open in Remark 5.15 due to the apparent inability to carry a fractal error register alongside clause evaluation. This work constructs a family of width-3 networks whose zero test encodes nonnegative integer subset sum. The Lean result establishes the equivalence for each instance; it does not formalize a polynomial-time reduction or NP-hardness. Specifically, an explicit width-3 feedforward ReLU architecture is constructed such that for any finite list of nonnegative integer weights and any nonnegative integer target, the network admits a root in [0,1] if and only if the target is a subset sum of the weights. The construction employs a compact piecewise-affine map and a digit-selection gadget whose orbit and accumulation register operate within three hidden neurons over a sequence of seven-layer blocks. The entire equivalence theorem and the underlying dynamical invariants are formally verified in the Lean 4 proof assistant as the theorem op75_compact_network_subset_sum.
1. Introduction
Verifying properties of feedforward neural networks with rectified linear unit (ReLU) activations is a central task in formal verification. A fundamental decision problem is the zero-existence problem: given a network $N : [0,1] \to \mathbb{R}$ with rational weights and biases, decide whether there exists an input $x \in [0,1]$ such that $N(x) = 0$. When the architecture allows arbitrary hidden layer width, deciding the existence of an input satisfying linear constraints or producing a target output is well known to be NP-complete. However, when the hidden layer width is severely constrained, the computational complexity landscape changes.
In arXiv:2610.06092, titled "Fractal Gadgets for Neural Networks: The Complexity of the Narrow Regime", the complexity of verification was investigated for narrow networks. On the domain $DD_{1,3}^{(n)}$, NP-completeness was achieved at width 3. The paper gives a width-4 lifting to the standard unit interval $[0,1]$. The declaration relu_network_width4_lifting states the corresponding existence property for every 3-CNF formula, but its proof chooses a constant network according to whether the formula is satisfiable. It does not formalize the paper’s effective reduction or its complexity bound.
The lifting to $[0,1]$ at width 3 was left open in Remark 5.15 of arXiv:2610.06092. As explained in the paper, the difficulty is genuine: at width 3, there is no room to carry the fractal error register $p_1$ alongside the clause evaluation registers. Attempting to use $p_1$ as the initial flag of the first clause stage to preserve width 3 breaks correctness on inputs whose $F_\varepsilon$-orbit enters the repair region $J_\varepsilon$ from the side yielding digit-2 prefixes. Thus, the question of whether deciding root existence for width-3 ReLU networks on $[0,1]$ is NP-hard or solvable in polynomial time remained unsettled.
Beyond the width-4 reduction, several foundational analytic properties of these narrow architectures are known. In relu_network_eval_continuous, it is established that for any width $k$, every feedforward ReLU neural network with rational parameters computes a continuous function on $\mathbb{R}$. Consequently, by relu_network_zero_of_ivt, if a network evaluates to a nonpositive value at 0 and a nonnegative value at 1, the intermediate value theorem guarantees the existence of a zero in $[0,1]$. Furthermore, relu_continuous_flag_two_step_erasure shows that continuous flag updates allow erasing certain accumulated flags under intermediate test values.
This post presents a verified construction that bypasses the 3-CNF clause-stage bottleneck by targeting the subset-sum problem directly at width 3 on the full unit interval $[0,1]$. Specifically, theorem op75_compact_network_subset_sum establishes that for any finite list of nonnegative integer weights $as$ and any nonnegative integer target $t$, one can explicitly construct a width-3 feedforward ReLU network whose zero-existence on $[0,1]$ is logically equivalent to the target $t$ being a subset sum of $as$. The construction relies on a one-pass dynamical system consisting of a compact piecewise-affine map and a digit-selection gadget that update an accumulator across seven-layer blocks while confining all intermediate activations within three neurons.
2. Preliminaries
We work in the Lean 4 formalization of feedforward neural networks with ReLU activations. A network of width $k \in \mathbb{N}$ consists of an input affine layer mapping $\mathbb{R} \to \mathbb{R}^k$, a sequence of hidden layers each mapping $\mathbb{R}^k \to \mathbb{R}^k$ via an affine transformation followed by the pointwise ReLU activation $\text{ReLU}(z) = \max(0, z)$, and an output affine layer mapping $\mathbb{R}^k \to \mathbb{R}$.
Definition 1 (evalNetwork). Let $k \in \mathbb{N}$. For a network net of type ReLUNetwork k with input weight vector $\text{in\_weight} \in \mathbb{R}^k$, input bias vector $\text{in\_bias} \in \mathbb{R}^k$, a list of hidden layers layers, output weight vector $\text{out\_weight} \in \mathbb{R}^k$, and output bias $\text{out\_bias} \in \mathbb{R}$, its evaluation evalNetwork net x at $x \in \mathbb{R}$ is defined by: $$x_0(i) = \text{in\_weight}(i) \cdot x + \text{in\_bias}(i) \quad \text{for } i \in \{0, \dots, k-1\},$$ $$x_{m} = \text{evalHiddenLayer } l_m (x_{m-1}) \quad \text{for } m = 1, \dots, |\text{layers}|,$$ $$\text{evalNetwork net } x = \left(\sum_{i=0}^{k-1} \text{out\_weight}(i) \cdot x_{|\text{layers}|}(i)\right) + \text{out\_bias}.$$
Definition 2 (relu_network_has_unit_interval_zero). For a network net of width $k$, the property relu_network_has_unit_interval_zero net is the proposition: $$\exists x \in [0, 1], \quad \text{evalNetwork net } x = 0.$$ Here $[0, 1]$ is represented by the closed interval Set.Icc (0 : ℝ) 1.
Definition 3 (op75_subset). For a list of real weights $L$ and a real target $t$, the relation op75_subset L t is defined recursively by:
op75_subset [] tholds if and only if $t = 0$.op75_subset (a :: as) tholds if and only ifop75_subset as torop75_subset as (t - a).
Definition 4 (op75_compact_map). The compact piecewise-affine map $F : \mathbb{R} \to \mathbb{R}$ is defined by: $$F(x) = \min(1, \min(4x, |4x - 3|)).$$ In the formalization, this is named op75_compact_map.
Definition 5 (op75_compact_digit). The digit selector function $E : \mathbb{R} \to \mathbb{R}$ is defined by: $$E(x) = \max(0, \min(1, 4x - 1)).$$ In the formalization, this is named op75_compact_digit.
Definition 6 (op75_run). Given functions $F, E : \mathbb{R} \to \mathbb{R}$, a list of weights $as$, and an initial value $x \in \mathbb{R}$, op75_run F E as x computes a pair $(x_n, s_n) \in \mathbb{R} \times \mathbb{R}$ by: - op75_run F E [] x = (x, 0) - op75_run F E (a :: as) x = let (x_fin, sum_tail) = op75_run F E as (F(x)); (x_fin, a * E(x) + sum_tail) Thus, $x_n$ is the $n$-th iterate $F^{(n)}(x)$, and $s_n = \sum_{i=0}^{n-1} a_i E(F^{(i)}(x))$.
Definition 7 (op75_compact_network). Given a list of natural weights $as = [a_0, \dots, a_{n-1}]$ and a natural target $t$, op75_compact_network as t is the ReLUNetwork 3 specified by:
in_weight = ![1, 0, 0]andin_bias = ![0, 0, 0]layers = as.flatMap op75_compact_block ++ [op75_compact_final t]out_weight = ![1, 1, 1]andout_bias = 0
Remark on conventions: The input layer places the scalar input $x$ into neuron 0, initializing neuron 1 and neuron 2 to 0. In each block op75_compact_block a, which spans seven hidden layers of width 3, the state vector $(x, p, 0)$ is mapped to $(F(x), p + a E(x), 0)$. The final layer op75_compact_final t transforms $(x_n, p_n, 0)$ into $(x_n, \max(0, p_n - t), \max(0, t - p_n))$, whose sum under the all-ones output weights yields $x_n + |p_n - t|$. All weights in $as$ and the target $t$ are natural numbers embedded into $\mathbb{R}$.
3. Main result
The main result characterizes the zero-existence problem for the explicit width-3 neural network op75_compact_network as t over the unit interval $[0, 1]$.
Theorem (op75_compact_network_subset_sum). Let $as$ be a list of natural numbers and let $t$ be a natural number. Let $as_{\mathbb{R}}$ denote the list of real numbers obtained by casting each element of $as$ to $\mathbb{R}$, and let $t_{\mathbb{R}}$ be $t$ cast to $\mathbb{R}$. The width-3 feedforward ReLU neural network op75_compact_network as t has a root in the unit interval $[0, 1]$ if and only if $t_{\mathbb{R}}$ is a subset sum of $as_{\mathbb{R}}$: $$\text{relu\_network\_has\_unit\_interval\_zero } (\text{op75\_compact\_network } as\ t) \iff \text{op75\_subset } as_{\mathbb{R}}\ t_{\mathbb{R}}.$$
In the Lean 4 formalization, the statement reads: ``lean theorem op75_compact_network_subset_sum (as : List ℕ) (t : ℕ) : relu_network_has_unit_interval_zero (op75_compact_network as t) ↔ op75_subset (as.map fun a => (a : ℝ)) (t : ℝ) ` The statement universally quantifies over lists of natural numbers as : List ℕ and targets t : ℕ, asserting the logical equivalence between the root predicate relu_network_has_unit_interval_zero applied to op75_compact_network as t and the recursive subset sum predicate op75_subset` applied to the real-cast list and target.
Supporting results in the formal development include: - op75_network_eval: For any $x \in [0, 1]$, the evaluation of op75_compact_network as t at $x$ decomposes as the final coordinate of the orbit plus the absolute deviation of the accumulated digit sum from $t$: $$\text{evalNetwork } (\text{op75\_compact\_network } as\ t)\ x = (\text{op75\_run } F\ E\ as_{\mathbb{R}}\ x).1 + |(\text{op75\_run } F\ E\ as_{\mathbb{R}}\ x).2 - t_{\mathbb{R}}|.$$ - op75_run_invariants: Under the dynamics of op75_compact_map and op75_compact_digit, any orbit starting in $[0, 1]$ stays within $[0, 1]$, and the accumulated weighted digit sum remains nonnegative: $$(\text{op75\_run } F\ E\ as_{\mathbb{R}}\ x).1 \in [0, 1] \quad \text{and} \quad 0 \le (\text{op75\_run } F\ E\ as_{\mathbb{R}}\ x).2.$$ - op75_compact_subset_equivalence: The compact dynamical system reaches a zero orbit endpoint with an accumulated sum of $t$ if and only if $t$ is achievable as a subset sum of the weights. - op75_subset_reduction_hard: Formulates the polynomial-time hardness transfer, proving that if the subset-sum decision problem is NP-hard and reduces in polynomial time to the width-3 zero-existence language, then deciding root existence for width-3 ReLU networks on $[0, 1]$ is NP-hard.
theorem op75_compact_network_subset_sum (as : List ℕ) (t : ℕ) : relu_network_has_unit_interval_zero (op75_compact_network as t) ↔ op75_subset (as.map fun a => (a : ℝ)) (t : ℝ)
4. Proof
The proof of op75_compact_network_subset_sum proceeds by connecting the network evaluation to the dynamical system op75_run, proving orbit and accumulator invariants, and applying the equivalence between the compact map dynamics and subset sums.
We begin with the structural properties of the compact gadgets and layers.
Lemma 1 (op75_compact_map_relu). On the unit interval $[0, 1]$, the function op75_compact_map is expressible as a composition of affine functions and standard ReLU operations.
Lemma 2 (op75_compact_digit_relu). For all $x \in \mathbb{R}$, $$E(x) = \max(4x - 1, 0) - \max(4x - 2, 0).$$ Proof. Both $\max(4x - 1, 0)$ and $\max(4x - 2, 0)$ are single-neuron ReLU operations. For $x \le 1/4$, both terms vanish, giving 0. For $1/4 < x < 1/2$, the second term vanishes while the first is $4x - 1 \in (0, 1)$. For $x \ge 1/2$, the difference simplifies to $(4x - 1) - (4x - 2) = 1$. This matches $\max(0, \min(1, 4x - 1))$.
Lemma 3 (op75_compact_block_effect). For any weight $a \in \mathbb{N}$, if the input to op75_compact_block a is $(x, p, 0)$ with $x \in [0, 1]$ and $p \ge 0$, then the output after the seven hidden layers of the block is $(F(x), p + a E(x), 0)$. Proof. The seven layers of width 3 compute the piecewise-linear foldings of $F(x)$ and $E(x)$ in the first and third neurons while carrying and updating the running sum $p$ in the second neuron. The third neuron is cleared to 0 at the end of the block.
Lemma 4 (op75_run_invariants). Let $as$ be a list of natural numbers and $x \in [0, 1]$. Let $(x_{\text{end}}, p_{\text{end}}) = \text{op75\_run } F\ E\ (as.\text{map } (\cdot : \mathbb{R}))\ x$. Then: $$x_{\text{end}} \in [0, 1] \quad \text{and} \quad 0 \le p_{\text{end}}.$$ Proof. This is verified in Lean by induction on the list $as$. For the base case $as = []$, the run returns $(x, 0)$, where $x \in [0, 1]$ and $0 \le 0$. For the inductive step $a :: as$, by definition of $F(x) = \min(1, \min(4x, |4x - 3|))$, when $x \in [0, 1]$, each argument is nonnegative, so $F(x) \in [0, 1]$. By the induction hypothesis applied to $F(x)$, the final coordinate $x_{\text{end}}$ remains in $[0, 1]$, and the tail sum is nonnegative. Since $a \ge 0$ and $E(x) = \max(0, \min(1, 4x - 1)) \ge 0$, the added term $a E(x)$ is nonnegative, ensuring $p_{\text{end}} \ge 0$.
Lemma 5 (op75_network_eval). For any list of natural weights $as$, target $t \in \mathbb{N}$, and input $x \in [0, 1]$, $$\text{evalNetwork } (\text{op75\_compact\_network } as\ t)\ x = x_{\text{end}} + |p_{\text{end}} - t|,$$ where $(x_{\text{end}}, p_{\text{end}}) = \text{op75\_run } F\ E\ (as.\text{map } (\cdot : \mathbb{R}))\ x$. Proof. By Definition 7, the network first applies in_weight = ![1, 0, 0] and in_bias = ![0, 0, 0], producing the initial state vector $(x, 0, 0)$. Applying Lemma 3 iteratively across as.flatMap op75_compact_block, the state before the final layer is $(x_{\text{end}}, p_{\text{end}}, 0)$. The final layer op75_compact_final t maps this vector to $(x_{\text{end}}, \max(0, p_{\text{end}} - t), \max(0, t - p_{\text{end}}))$. The output weights ![1, 1, 1] with bias 0 compute the sum: $$x_{\text{end}} + \max(0, p_{\text{end}} - t) + \max(0, t - p_{\text{end}}).$$ Since $\max(0, y) + \max(0, -y) = |y|$ for any real $y$, this evaluates exactly to $x_{\text{end}} + |p_{\text{end}} - t|$.
Lemma 6 (op75_compact_subset_equivalence). For any list of real weights $L$ and real target $t$, there exists $x \in [0, 1]$ such that: $$(\text{op75\_run } F\ E\ L\ x).1 = 0 \quad \text{and} \quad (\text{op75\_run } F\ E\ L\ x).2 = t$$ if and only if op75_subset L t holds. Proof. The interval is invariant under $F$, and $F(1)=1$. If $1/4 < x < 1/2$, the selector is fractional, but $F(x)=1$; an orbit entering that region is therefore trapped at 1 and cannot end at 0. Thus every digit on an orbit ending at 0 is either 0 or 1, and induction shows that its accumulated sum is a subset sum. Conversely, for each $y\in[0,1]$, the preimages $y/4$ and $(y+3)/4$ both map to $y$, with selector values 0 and 1 respectively. Starting at terminal state 0 and choosing these preimages backwards realizes any desired sequence of subset choices. This gives the converse by induction.
We now assemble the proof of the main theorem op75_compact_network_subset_sum.
Let $L = as.\text{map } (\cdot : \mathbb{R})$. By Lemma 6 (op75_compact_subset_equivalence), op75_subset L t is equivalent to the existence of $x \in [0, 1]$ such that $(\text{op75\_run } F\ E\ L\ x).1 = 0$ and $(\text{op75\_run } F\ E\ L\ x).2 = t$.
Suppose first that relu_network_has_unit_interval_zero (op75_compact_network as t) holds. Then there exists $x \in [0, 1]$ such that evalNetwork (op75_compact_network as t) x = 0. By Lemma 5 (op75_network_eval), this means: $$x_{\text{end}} + |p_{\text{end}} - t| = 0.$$ By Lemma 4 (op75_run_invariants), $x_{\text{end}} \in [0, 1]$, so in particular $x_{\text{end}} \ge 0$. Furthermore, the absolute value term satisfies $|p_{\text{end}} - t| \ge 0$. The sum of two nonnegative real numbers is zero if and only if each term is zero. Therefore: $$x_{\text{end}} = 0 \quad \text{and} \quad |p_{\text{end}} - t| = 0.$$ From $|p_{\text{end}} - t| = 0$, we have $p_{\text{end}} = t$. Thus, the pair $(x_{\text{end}}, p_{\text{end}})$ satisfies $x_{\text{end}} = 0$ and $p_{\text{end}} = t$. By Lemma 6, this implies op75_subset L t.
Conversely, suppose op75_subset L t holds. By Lemma 6, there exists $x \in [0, 1]$ such that $x_{\text{end}} = 0$ and $p_{\text{end}} = t$. Evaluating the network at this $x$ using Lemma 5 yields: $$\text{evalNetwork } (\text{op75\_compact\_network } as\ t)\ x = 0 + |t - t| = 0.$$ Since $x \in [0, 1]$ and evalNetwork (op75_compact_network as t) x = 0, it follows that relu_network_has_unit_interval_zero (op75_compact_network as t) holds.
This completes the proof in Lean 4.
5. Discussion
The theorem op75_compact_network_subset_sum establishes an exact equivalence between the zero-verification problem for explicit width-3 ReLU networks on the unit interval and the subset-sum problem with nonnegative integer weights. The result shows that width 3 is sufficient to execute recursive arithmetic branching and dynamic accumulation over the full interval $[0,1]$.
The construction has exactly $7|as|+1$ hidden layers with three neurons each and rational parameters. Inspection of the blocks shows that their coefficients consist of fixed constants and copies of the input weights and target, so under a standard binary encoding the displayed construction has polynomial size and can be written down in polynomial time. Together with the standard NP-hardness of nonnegative integer subset sum, this gives the usual mathematical route to NP-hardness of the width-3 zero problem. The Lean equivalence itself does not formalize that complexity argument: op75_subset_reduction_hard assumes both source hardness and a polynomial-time reduction. Membership in NP, needed for NP-completeness, is also not established by this theorem.
The declaration op_75_relu_width3_lifting asserts an existential network for every 3-CNF formula, but its proof selects a constant zero or constant one network after a case split on satisfiability. It does not give an effective or polynomial-time construction and does not formalize the lifting sought in Remark 5.15. The subset-sum construction gives a different route to the complexity question; it does not implement the paper's clause-stage gadget.
A natural next step is to formalize a binary encoding, the compiler's polynomial running time, and the source hardness required by op75_subset_reduction_hard, then establish a matching NP upper bound. These formal steps are distinct from the verified semantic equivalence above.
Why it is research-level
- Constructs an explicit width-three ReLU network on the entire unit interval whose zero test is equivalent to a given nonnegative integer subset-sum instance; the cited paper leaves this width open
Lean declarations
- op75_compact_network_subset_sumFor any finite list of nonnegative integer weights and nonnegative integer target, the explicitly constructed width-three ReLU network has…
- 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…
- relu_network_eval_continuousFor every natural number $k$ and every feedforward ReLU neural network
netof width $k$ with rational weights and biases, the evaluation… - relu_network_zero_of_ivtIf a feedforward ReLU neural network of width $k$ evaluates to a non-positive value at 0 and a non-negative value at 1, then by the…
- relu_continuous_flag_two_step_erasureSuppose a real-valued flag update G is continuous in its test input at an initial flag p, with G(0,p)=p and G(1,p)=p-c, and a true test…
- relu_network_has_unit_interval_zeroA feedforward ReLU neural network
netof width $k$ has a zero in the unit interval $[0, 1]$ if there exists some real number… - op75_subsetA real target belongs to the subset sums of a list when it can be obtained recursively by either omitting or including the first weight.
- op75_compact_mapThe compact piecewise-affine map x ↦ min(1, 4x, |4x−3|) used in the one-pass reduction.
- op75_compact_digitThe digit selector x ↦ max(0, min(1, 4x−1)) used in the one-pass reduction.
- op75_runFor a map F, a digit function E, and real weights, iteratively apply F and return the final orbit value together with the sum of the…
- op75_compact_networkThe width-three network obtained by concatenating a seven-layer block for each integer weight, followed by the final target-checking layer…
- op75_network_evalFor a unit-interval input, the explicit subset-sum network evaluates to the final orbit coordinate plus the absolute difference between…
- op75_run_invariantsFor nonnegative integer weights and a starting point in the unit interval, the compact orbit remains in the unit interval and its…
- op75_compact_subset_equivalenceFor any list of real weights and real target, the compact-map orbit ends at zero with accumulated digit-weighted sum equal to the target…
- op75_subset_reduction_hardIf the canonical subset-sum source language is NP-hard and reduces in polynomial time to the width-three zero language, then the…
- op75_compact_map_reluOn the unit interval the compact map is computed by the displayed nested rectified affine expression.
- op75_compact_digit_reluThe compact digit selector is the difference of the two rectified affine functions max(4x−1,0) and max(4x−2,0).
- 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…
- 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…
Each one elaborated against Mathlib, and #print axioms returned
nothing outside Classical.choice · Quot.sound · propext.
References
- arXiv:2610.06092 — Fractal Gadgets for Neural Networks: The Complexity of the Narrow Regime
Drafted by gemini-3.8-flash from the knowledgebase, checked against it, and reviewed by Codex. Only the Lean is verified; the prose is a reading of it.