Overcoming a Learning Bottleneck in Impartial Games:
A Circuit Complexity Approach
Abstract
Why can neural networks struggle to learn optimal play in a game with a simple, efficient solution algorithm? Motivated by empirical difficulties with parity in impartial games, we use NIM to study a representational bottleneck and three ways around it. We show that a restricted model of shallow, fixed-scale quantised networks lies in , a circuit class unable to compute parity on arbitrarily large inputs. This prevents optimal single-position play across all board sizes within the model. The obstruction also guides architectural design: two-frame inputs allow restoration from a known zero-nim-sum position; complementary rollout policies reveal the missing invariant; and persistent recurrence accumulates it row by row. Each route retains shallow network components while supplying additional information or processing time. Supervised experiments illustrate the benefits of two-frame restoration and multiple rollout heads; recurrence is a theoretical construction. These results establish representational possibilities, not guarantees of successful training: does not characterise practical learnability. Core mathematical results and constructions have been checked in Lean, with classical complexity results as explicit external inputs. The interactive edition and complete Lean sources are available online (Riis, 2026a,b).
Keywords: Impartial games; NIM; circuit complexity; quantised inference; learning bottlenecks.
1 Introduction
Game play has historically served as the “Formula 1” of artificial intelligence: a high-speed, controlled proving ground where engineering limits are tested and new paradigms are born. From Deep Blue in chess to AlphaGo in Go, games have repeatedly driven advances in search, planning, and reinforcement learning (Silver et al., 2016, 2017, 2018; Schrittwieser et al., 2020). Minsky and Papert’s analysis of perceptron limitations illustrates how representational restrictions can motivate architectural changes (Minsky and Papert, 1969).
In NIM, two players take turns removing any positive number of tokens from a single heap; the player taking the last token wins. It belongs to the broad class of impartial games: both players have the same legal moves from a given position. Many such board games can be thought of as games with shared pieces, whereas in partisan games, such as chess, legal moves depend on which player is to move. NIM is central to impartial-game theory because every finite terminating impartial position under the last-move-wins convention is equivalent, in sums of games, to a single NIM heap (Section 4).
NIM poses a particularly revealing challenge: optimal moves can be found by a simple, efficient algorithm, yet learning that algorithm can be difficult. The puzzle is the gap between the ease of computing the solution once the rule is known and the difficulty of discovering it through training. Friedman’s 2017 AI challenge asked whether a system could discover perfect NIM play without being given the winning strategy (Friedman, 2017a).
Our earlier work with Bei Zhou provides the empirical starting point. In Impartial Games: A Challenge for Reinforcement Learning, Zhou and Riis found that AlphaZero-style learning deteriorated as NIM boards grew (Zhou and Riis, 2026). Subsequent parity experiments examined how noisy labels can obstruct curriculum learning (Zhou and Riis, 2023); see also Zhou’s thesis (Zhou, 2024). These findings make parity a useful test of the gap between learning familiar patterns and discovering an exact rule that works across positions.
Here we turn that difficulty into a question about computation. The class consists of polynomial-size Boolean circuits built from AND, OR and NOT gates, with a number of layers that remains fixed as the input grows. Such circuits can combine many local tests, but cannot compute global parity: whether the total number of input 1s is odd or even. This is the feature that makes the class useful here: it provides a precise model with a provable version of the parity limitation seen in the experiments. We establish the connection for an explicitly restricted neural model, rather than assuming that all neural networks lie in .
The value of identifying a bottleneck is that it tells us what an architectural change must supply. Instead of asking a shallow network to rediscover a global invariant from every board, we can expose a useful transition, obtain complementary information from rollouts, or accumulate the invariant over time. Our contribution is this barrier-to-bypass approach: a computational obstruction guides three concrete constructions. Representability in is a necessary condition for a fixed-latency computation in our restricted model; it is neither sufficient for successful training nor a universal condition on what neural networks can learn.
NIM itself does not depend on game history: the current position completely determines its legal moves and optimal play. History can nevertheless supply useful computational context to a restricted network. The first and third bypasses use such context in different ways: an earlier board exposes a local change, while recurrent memory retains information accumulated during row processing and across positions.
The central observation is that while the state can be hard to process, the transition can be easy: under the promise that the preceding position has nim-sum zero, short history converts winning-move selection into local difference computation and restoration. A second route uses distinct rollout policies to extract complementary bits of the invariant. A third route processes each position sequentially, retaining recurrent state as rows and then successive positions arrive. Here a sequence of simple updates computes the global invariant, and memory connects the new position to the preceding one. These mechanisms use different resources: explicit transition information, multiple rollout channels, or a growing recurrent computation horizon. The distinction between a shallow component and the complete computation is essential. Two-frame restoration is a shallow map on a promised pair of boards. In the other two constructions, each policy step or recurrent update is shallow, but generating the information needed for a decision takes a sequence of such steps. Thus the bypasses preserve simple network components while changing the input information or total processing time. The complete sequential computation need not itself lie in . Figure 1 summarises the three routes for NIM.
1.1 Contributions
The results follow a single question: what must be added to a shallow learner to make the required strategy representable? We first identify the obstruction, then show how each bypass supplies a different missing resource.
containment for fixed-scale quantised inference. We formalise a fixed-grid Boolean literal-threshold model and its bounded-unrolling recurrent extension. Both are simulable by circuits (Theorem 2.4). An attention-style extension is covered only if its scoring, selection and aggregation operations can each be implemented by the permitted Boolean threshold gates. This is a restriction on the computation, not a requirement that every game have the same board size. Within a play sequence we use a fixed layout of heap rows and bits per heap, retaining empty heaps as zero rows. The asymptotic statements concern families of networks for growing input lengths .
Single-frame impossibility for strong mastery. Under this model, no single-frame policy/value network can strongly master NIM in the worst case (Theorem 5.2).
Two-frame bypass via local differences and restoration. With two consecutive frames, the agent can compute in (Lemma 5.4). When has nim-sum zero, an move selector restores zero after the opponent’s move (Proposition 5.5). This is conditional restoration mastery, not an arbitrary-start verifier.
Planning analysis and the single-policy bottleneck. We analyse a restricted measurement interface inspired by rollouts, rather than a general model of MCTS. With structured policies one can recover all nim-sum bits (Proposition 5.9). Root and one-heap-modification queries to one fixed member of that family expose only one unknown linear functional (Proposition 5.10). With an explicitly bounded readout, this yields the distributional bound in Theorem 5.12.
Persistent recurrence via sequential row updates. A constant-depth recurrent update accumulates the nim-sum over heap rows and retains a summary across position separators (Proposition 5.13). With a replay of the current board or stored heap rows, this supports optimal move selection. The construction relaxes fixed total latency, not fixed-scale quantisation (Section 5.5).
Controlled empirical comparison and learnability discussion. On 20-heap, 4-bit NIM with supervised restoration examples, a one-frame model has low restoration accuracy while a two-frame model learns restoration (Section 7.2). In a complementary single-frame experiment, multi-head FSM-controlled shootouts achieve perfect win/loss position classification while the single-head baseline remains bottlenecked by one-bit information (Section 7.3). We also discuss why is a useful abstraction for what is robustly feasible under fixed-scale quantised inference (Section 6.3).
1.2 Scope and limitations
Our theorems are worst-case representational statements about what can be computed under explicit architectural constraints. They are not training-complexity results, and they intentionally abstract away from several practical details, such as continuous-valued activations, floating-point arithmetic, normalisation layers and the dynamics of optimisation.
Fixed-scale quantisation / fixed latency. The simulation (Theorem 2.4) assumes constant depth and a fixed-scale, bounded-range quantisation regime: weights/thresholds lie on a fixed grid whose range/resolution do not scale with the input length (cf. Remark 2.2). Architectures that rely on fan-in dependent re-normalisation, biases/thresholds growing with dimension, or depth growing with fall outside this abstraction. In particular, a fixed recurrent update rule need not have fixed total latency: the third bypass deliberately allows successive row updates per position.
Formal model vs. experimental networks. The formal units have nonnegative weights on Boolean literals and bounded thresholds. The experiments instead use ordinary floating-point signed linear layers, ReLU and LayerNorm, with Log-Softmax in the loss. They test the benefit of transition information under the reported training protocol, not the asymptotic lower bound or the deployment behaviour of quantised networks.
Stylised planning interface. The single-channel lower bound permits only root and one-heap-modification queries to a fixed structured policy, and requires a polynomial-size, constant-depth final readout. It is not a bound on arbitrary rollout policies, unrestricted query transformations, or an unbounded adaptive MCTS controller.
No guarantee of learnability. The multi-policy-head and recurrent constructions concern existence of suitable computations; we do not claim that self-play efficiently discovers the structured heads or an exact recurrent accumulator. Our experiments use controlled supervised restoration and policy imitation; self-play discovery is left for a separate study.
1.3 Paper organisation
Section 2 introduces the fixed-scale quantised inference model and the simulation theorem. Section 3 situates our contribution in circuit complexity, modern sequence models, and reinforcement learning for combinatorial games. Section 4 recalls NIM and the nim-sum characterisation. Section 5 presents the main impossibility and bypass results: two-frame restoration, rollout channels (Section 5.4), and persistent recurrence (Section 5.5). Section 6 discusses modelling choices and learnability considerations. Section 7 reports experiments. Appendices contain formal model definitions and proofs.
2 Theoretical framework and neural network models
2.1 Fixed-scale quantised inference and simulation
We consider neural inference models that are (i) bounded depth, (ii) polynomial size, and (iii) operate in a fixed-scale quantised regime: all weights and thresholds lie on a fixed quantisation grid of bounded dynamic range that does not change with the input length. The fixed scale is motivated by limits on the effective precision of neural computation, including sensitivity to noise: distinctions that can be used reliably may be much coarser than the rounding resolution of 32-bit floating-point arithmetic. Noise motivates this abstraction; it does not by itself imply the gate and threshold assumptions below.
Our Boolean threshold gates sum nonnegative weights on inputs that may be negated. Negation allows inhibitory as well as excitatory effects: for a Boolean input , the identity replaces a negative coefficient by a positive weight on the negated input, with an adjustment to the threshold. The substantive restriction is that the resulting weights and thresholds remain on the fixed, bounded grid; this is not a model of arbitrary signed-weight or INT8/fixed-point inference.
Concretely, we fix constants:
a quantisation resolution parameter captured by a fixed denominator (grid step ),
a dynamic-range bound (maximum magnitude ),
and (for recurrent/attention models) a finite time window .
We define a finite set independent of input length. The threshold bound applies after choosing the literal representation. Replacing a signed term by raises the threshold by . With many such terms, the adjusted threshold may grow with the input length. What matters is the amount of evidence needed to activate a gate: our model bounds the number of satisfied input literals that suffice, whereas an unrestricted majority gate needs a number that grows with its inputs. Negative coefficients themselves are not the obstruction; the bound on the adjusted threshold is essential to the simulation.
Each neuron computes a thresholded weighted sum of Boolean inputs. Formal definitions for , and are in Appendix A.
Definition 2.1 (Quantised inference) A network in this class has constant depth and polynomially many threshold neurons, with weights and thresholds in . Analogously, fixed-scale quantised and models have constant depth and polynomial size per time step and operate within a fixed time window . For the simulation theorem, bounds the entire unrolled computation from an input-independent initial state, including any computation used to form a retained state.
A bound on the number of preceding states consulted by one update is insufficient: even can accumulate parity over an arbitrarily long stream. Section 5.5 exploits precisely this distinction by allowing the number of recurrent updates to grow with the number of rows.
Why fixed-scale quantisation suggests an abstraction. The key structural property is fixed scale: the smallest nonzero weight is and the largest threshold is , with independent of the input length. Consequently, whenever a threshold unit outputs , there is a satisfying witness consisting of at most input literals whose contributions already cross the threshold. This yields a constant-width DNF expansion for each unit (Lemma B.1), and composing a constant number of layers yields an simulation (Theorem 2.4).
We emphasise that this is not a statement about floating-point arithmetic per se. The abstraction intentionally excludes scale-adaptive regimes where thresholds/biases grow with fan-in or where weights shrink with dimension (e.g. or normalisations), which move the analysis toward threshold-circuit classes such as . This class allows constant-depth, polynomial-size circuits with general threshold gates, including majority gates; unlike , it can compute parity.
Remark 2.2 (Scope of the abstraction) Theorem 2.4 formalises a fixed-latency fixed-scale quantised regime in which each unit uses parameters drawn from a bounded-range grid with independent of the input length. This yields the constant-witness property exploited in Lemma B.1.
The abstraction is deliberately conservative: it does not model architectures that rely on fan-in dependent re-scaling, numerically large signed biases/thresholds that grow with dimension, or deep computations whose depth scales with . Allowing such scale-adaptive behaviour leads naturally to richer threshold-circuit models (e.g. ), in which parity-like computations can become representable.
Remark 2.3 (Local vs. global parity) When we say “parity is hard” we mean global parity across the full Boolean input of length . In contrast, parity on bits is trivial in (hardwire the truth table), and more generally XOR of a constant number of -bit blocks is -computable. This local/global separation underlies both the two-frame bypass via the nimber difference and the recurrent bypass, which composes local XOR updates over a growing number of steps.
| Property of deployed inference | Captured here | Not captured here |
|---|---|---|
| Fixed latency / bounded depth | constant depth (and window ) | depth growing with |
| Fixed-scale quantisation (bounded range) | weights/thresholds in fixed grid | fan-in dependent scaling or thresholds growing with |
| Parallel bit operations | unbounded fan-in AND/OR/NOT | exact global counting / exact parity on unbounded inputs |
| Signed effects | via input negations (Lemma B.1) | large signed dot-product accumulation |
Notation convention (input length). We write for the number of heaps and (or in experiments) for the bit-width used to encode each heap size. The resulting Boolean input length is . When we discuss circuit size/depth, always refers to this Boolean input length.
Circuit complexity primer. is the class of Boolean functions computable by constant-depth, polynomial-size circuits with unbounded fan-in AND/OR/NOT gates. A classical result is that . In contrast, augments with unbounded fan-in threshold gates and can compute parity. Our focus here is a fixed-scale quantised regime in which thresholds do not scale with fan-in; in that regime, each threshold unit admits a constant-witness DNF expansion and the overall computation collapses to (Theorem 2.4).
2.2 Simulation by circuits
We state the simulation theorem for the literal-threshold model and its explicitly gate-realised extensions.
Theorem 2.4 (Simulation by ) Fix constants and a time window . Let be any family of models of type , (with window ), or (with window ) such that:
(1) (Polynomial size) the number of neurons/units in is at most .
(2) (Constant depth) the number of layers is a fixed constant (independent of ); for the entire unrolled computation uses at most time steps from an input-independent initial state.
(3) (Permitted primitives) every operation is realised by the Boolean literal-threshold gates of Definition A.1; all weights and thresholds lie in . For the attention-style extension this includes score computation, coefficient selection and aggregation.
Then the Boolean function computed by can be computed by an circuit family of polynomial size and constant depth (depending only on ).
3 Related Work
Circuit complexity and neural networks. Parity is outside (Furst et al., 1984; Håstad, 1986), while constant-depth threshold circuits () can compute it. Attention results depend on the precise model: Hao, Angluin and Frank analyse hard-attention variants, including restrictions for unique hard attention (Hao et al., 2022). Merrill and Sabharwal study the additional power of intermediate decoding over a baseline (Merrill and Sabharwal, 2024); that containment does not rule out parity. Their sequential-computation perspective is relevant to our recurrent bypass, although the architectures and formal assumptions differ. Our contribution applies these distinctions to NIM policies and a restricted rollout-measurement interface.
Quantised inference and deployment constraints. Low-bit inference motivates studying bounded numerical resources (Jacob et al., 2018; Dettmers et al., 2022). Our constant-witness proof additionally requires nonnegative literal weights, bounded thresholds and Boolean intermediate states. These are explicit mathematical assumptions, not properties inferred merely from a quantisation format. Standard signed linear layers and scale-adaptive normalisation are outside the theorem unless separately reduced to the permitted gates.
Reinforcement learning in combinatorial games. While RL has mastered domains such as Go and chess, impartial games remain a useful stress test because optimality is governed by exact algebraic invariants rather than approximate pattern matching. Zhou and Riis (Zhou and Riis, 2026, 2023) studied reinforcement-learning difficulties in impartial games. Our lower bound identifies a representational obstruction in a restricted model; determining which mechanisms explain failures in ordinary neural training requires separate experiments.
History and memory in RL. Using short history windows is standard in partially observable settings, where stacked frames recover hidden variables such as velocity (Mnih et al., 2015). Our point is different and perhaps surprising: even in Markovian, fully observable games—where the current state is informationally sufficient and the past is theoretically irrelevant—history can reduce computational complexity by exposing local differences that would otherwise require expensive search or unbounded-depth inference to extract from the current state alone. In our restoration setting, the previous frame carries a promise established by an earlier successful move: its nim-sum is zero. That promise makes a local difference sufficient for the next response. Establishing the promise initially remains a separate computational task.
4 Impartial games and NIM
We briefly recall standard definitions; see (Berlekamp et al., 2001–2004) for extensive background.
4.1 Impartial games
Definition 4.1 (Impartial game) A finite terminating impartial game is a pair where is a nonempty set of positions and is the (finite) set of legal moves from , with the property that the move relation does not depend on which player is to play (symmetry). We assume the move relation is acyclic and play terminates. We use the last-move-wins convention, usually called normal play: a player with no legal move loses.
A position with no legal moves is terminal.
The last-move-wins convention also provides a convenient encoding of other decisive endings. A move that wins by capturing a designated piece or creating a specified configuration can simply lead to a position with no further legal moves. If instead reaching a special position loses for the player who made the move, give the opponent one forced move to a new terminal position. These encodings preserve the winner of the individual play; they must retain player-independent move rules to remain impartial. The theory below concerns the resulting normal-play game.
4.2 NIM
Definition 4.2 (NIM) A NIM position consists of heaps with sizes . A legal move reduces exactly one heap: choose with and replace by some .
4.3 Sprague–Grundy theory and nim-sum
The breadth of impartial games makes the Sprague–Grundy theorem remarkable: every finite terminating impartial position under normal play is equivalent to a single NIM heap of some size, called its nimber or Grundy value. Equivalence here means that replacing the position by that heap preserves the winning or losing status of its sum with any other such game. In a disjunctive sum, a move is made in exactly one component. The nimber of a sum is the bitwise XOR of the component nimbers; in particular, the nimber of a NIM board is the XOR of its heap sizes.
Definition 4.3 (Nim-sum) For heap sizes , define where denotes bitwise XOR.
Theorem 4.4 (Classical NIM characterisation) A NIM position is losing for the player to move iff . Moreover, from any winning position (nim-sum ) there is a move to a losing position (nim-sum ).
Why NIM is a useful barrier example. For a disjunctive sum of independent impartial components, the Grundy value is the XOR of the component nimbers. If these nimbers can vary independently so that their aggregation contains an unbounded parity subproblem, NIM isolates the resulting aggregation obstruction. Learning NIM would therefore address a fundamental component of impartial-game play, but would not by itself solve self-play learning for the wider class: determining component nimbers can be computationally difficult (Section 8.3). Nor does every impartial game contain a hard parity aggregation task. Our unconditional lower bound concerns NIM; extensions require an explicit encoding and reduction.
5 Main results: impossibility and possibility
We first establish the single-frame barrier under fixed total latency, then develop three bypasses: recent-history inputs, multiple rollout channels, and persistent row-wise recurrence.
5.1 Mastery notions
We distinguish three notions of mastery:
Definition 5.1 (Strong, weak, and restoration mastery) An agent achieves strong mastery of NIM if it chooses a winning move at every -position where it is to move, including positions reached by arbitrary legal play by both players. Reachability is relative to the specified initial positions and player role; unrestricted strong mastery allows every initial position.
It achieves weak mastery relative to an initial position and a designated player role if, whenever that role has a winning strategy from , its own strategy wins against every opponent strategy. The guarantee concerns histories consistent with its own preceding actions, not every position reachable under arbitrary actions by both players. For asymptotic claims, the initial positions form a specified family. Strategies may depend on the complete history. Opponent moves are legal; a missing or illegal agent move counts as a loss. On an initially losing position the weak-mastery condition imposes no requirement.
It achieves restoration mastery if, whenever the opponent moves from a -position with to a position , the agent responds with a move such that .
We use standard impartial-game terminology: a -position is losing for the player to move, and an -position is winning. For NIM, Theorem 4.4 says that -positions are exactly the positions with nim-sum . Equivalently, weak mastery requires the agent to move to a -position at every one of its decision histories consistent with its own earlier actions, starting from an initial position winnable in its designated role. This distinction allows a simple strategy to master a family without solving positions it never encounters under its own play; Appendix D gives examples.
5.2 Single-frame impossibility results
In a single-frame representation, the network sees only the current position. To play optimally, it must in effect determine whether the nim-sum is zero and, if not, find a move producing nim-sum zero. The core obstacle is that global nim-sum computation requires parity-like behaviour across many bits, and parity is not in (Furst et al., 1984; Håstad, 1986; Smolensky, 1987; Razborov, 1987).
Theorem 5.2 (Single-frame parity barrier) Consider the restricted family of NIM positions where . Any single-frame agent that achieves strong mastery must compute the parity . Since , no polynomial-size, constant-depth fixed-scale quantised network can strongly master NIM.
Proof. Since each , these positions have nimber , which is either or . A winning move must change the first heap: changing any other heap leaves the leading binary digit of the nim-sum unchanged. To obtain nimber zero, the first heap must be reduced to . Thus the unique winning move removes two tokens when this parity is zero and one when it is one. Encoding each heap in two bits uses only constants and wiring, and the low bit of the replacement heap is the input parity. This gives a constant-depth, polynomial-size reduction to winning-move selection, although every encoded position is winning.
5.3 First bypass: two-frame restoration
The fundamental idea is to avoid computing the global nim-sum from scratch. Instead, we exploit that each move changes only one heap, so the nimber difference between consecutive positions is locally computable.
Definition 5.3 (Nimber difference) Given consecutive positions and in a play sequence, define the nimber difference
In NIM, if is obtained from by changing heap from to , then a purely local computation on the changed heap.
Lemma 5.4 (Bounded-change differences) Fix a constant . Let and be NIM positions whose heap vectors differ in at most heaps. Then can be computed by an circuit of polynomial size (in the input length).
Proof. See Appendix E.
Membership in does not guarantee a small or readily learnable network. For the complete two-frame move selector built on this difference computation, our modular construction gives an upper bound of 42 threshold layers; one shootout-controller step has a bound of 70 (Appendix C). These are constructive bounds, not necessary depths. Any Boolean function has a depth-two AND–OR representation with negated inputs, but its size can be exponential; requires polynomial size as the input grows. We have not optimised this depth–size trade-off. Removing the expressivity obstruction therefore leaves practical network design, training procedures and hyperparameter choices open. The layer bounds do not establish the cause of the experimental learning plateaus.
5.3.1 Two-frame local restoration rule
The next observation is that if, after our move, we make the opponent face a zero nim-sum position, then the opponent’s next move produces some nimber difference . If we respond with a move that produces the same nimber difference , we restore nim-sum zero.
Proposition 5.5 (Local restoration principle) Suppose the opponent moves from a position with to a position (so it is now our turn). Let denote the nimber difference caused by the opponent’s move. If we respond with a move such that then .
Proof. By definition, . Since (by hypothesis), we have . The player’s move creates a new position with . Substituting the condition : Thus, matching the opponent’s difference restores the invariant.
Moreover, a concrete restoration move can be selected in from by computing and then choosing (with a fixed tie-break rule) a heap such that (Appendix C).
Interpretation (“mirror the delta”). Once we have made the opponent face a -position, we do not need to recompute from scratch. We only need to mirror the observed change in our response move. Figure 2 illustrates this mechanism on a concrete three-heap instance.
Proposition 5.5 is structural: it describes a response pattern that keeps returning the game to nim-sum zero, provided the player can (i) compute from the last two frames and (ii) choose a legal move that realises the same . In NIM, when the opponent changes exactly one heap, is simply , and testing whether a candidate response move realises is a local check on the heap being changed.
The significance for learnability is representational. A two-frame policy network can condition its response on and hence on the locally computable , while a single-frame policy must reconstruct the relevant global information from alone. The experiments in Section 7 examine this contrast through supervised restoration learning and imitation-trained rollout policies. The reported networks are policy-only; these results do not establish that self-play discovers the constructions.
5.3.2 Implementation overview
An implementation of the two-frame delta and restoration components can be organised into:
a binary encoding scheme for heap vectors (Appendix C),
a constant-depth detection of which heaps changed between frames,
an circuit computing on those changed heaps (Lemma 5.4),
an selection mechanism for a response move realising a target .
5.4 Second bypass: structured rollout policies
Theorem 5.2 shows that no circuit can evaluate the nim-sum in a single forward pass. A natural follow-up is whether planning—testing candidate moves and simulating play, as in Monte-Carlo Tree Search (MCTS)—can compensate.
We analyse a stylised rollout interface: a planning algorithm queries a rollout policy by simulating a complete game in which both players follow from a start position, and it observes only the terminal win/loss bit. This abstraction isolates the information that a weak policy can expose through repeated simulation; it is not a claim about the optimisation dynamics of AlphaZero-style training (cf. Section 1.2).
Definition 5.6 (Rollout policy and rollout outcome) A deterministic rollout policy maps a nonterminal -bit NIM position to a legal move, encoded by a heap index and its new value; on the terminal position it outputs a halt symbol. It is -bounded when this map has polynomial-size, constant-depth circuits. A rollout has both players follow that policy until termination. Its outcome is 1 if the first player wins and 0 otherwise, including at a terminal start. The interface returns only this terminal bit, not a trajectory or move count.
Definition 5.7 (Restricted rollout measurements and readout) Fix a root position . An admissible query starts at or a position obtained by changing one heap of ; the changed index and old/new values are known to the readout. A legal one-move successor is an admissible query. Arbitrary transformations of the whole root are excluded. For the single-channel lower bound, one fixes a policy from Proposition 5.9, independently of . Writing , the agent’s final move must have the form , where is a polynomial-size, constant-depth Boolean circuit family. Any value head, query corrections or other processing must be included in this readout bound. The number of queries alone does not impose that bound. A multi-channel construction may query distinct members of the same structured policy family and apply a polynomial-size, constant-depth readout to and their outcome bits. A policy head means a rollout policy, not simply a parallel output neuron. We count simulated game moves separately from the circuit work per move.
Allowing arbitrary start positions would defeat the single-channel restriction: querying on heaps consisting of the th bits of returns . Likewise, an unrestricted sequential controller could compute the nim-sum itself. The lower bound therefore concerns the stated measurement/readout model, not general MCTS or all single-policy algorithms.
Remark 5.8 (Why multiple heads are not redundant) Since is closed under parallel composition, one could compute all policies simultaneously as a single circuit. The distinction is not about computational power at the circuit level but about the rollout interface: each rollout query simulates a complete game under one policy, and at each game step only that policy determines the next move. A single rollout trajectory under a fixed policy produces one outcome bit; merging circuits into a single circuit does not change the fact that any one rollout follows a single deterministic rule, yielding a single bit of information. Multiple heads are useful because the agent can issue separate rollout queries under different policies , producing different game trajectories that reveal independent linear functionals of the nim-sum (cf. Propositions 5.9 and 5.10).
Finite-state shootout controller (FSM over policy heads). The multi-channel classifier can stop early after a nonzero channel outcome, without changing its Boolean decision rule (the OR of all channel bits). This limited scheduling optimisation does not give the single-channel readout an unrestricted sequential controller. To make this adaptivity explicit (without changing the constraints on each head), it is convenient to view head-selection as a small finite-state controller that sits outside the heads and only sees the terminal win/loss bit of each rollout.
Formally, fix rollout heads . A finite-state shootout controller is a tuple where is a finite set of controller states, is the initial state, selects which head to use for the next rollout query, updates the controller state after observing a rollout outcome bit , and is a set of halting states associated with an output decision. (When , the controller simply runs for a fixed number of queries and outputs a decision at the end.)
This viewpoint does not increase the per-step computational power of the rollout heads: each remains -bounded. Instead, the controller organises which head is iterated in a shootout and when to stop querying. Figure 3 depicts a particularly simple controller that turns the structured rollout heads from Proposition 5.9 into a sequential “bit-query” procedure for deciding whether is zero (and hence whether is a -position).
The checked implementation includes the outer controller: it selects a head, executes its rollout, records the outcome and either reloads the original board for the next head or halts. For classification it stops at the first outcome 1. For move selection our implementation runs all heads, since an early classification decision need not supply the invariant bits required by the move readout. Each controller tick is itself an map. The original board remains available as a read-only input throughout; it is not an oracle for its nim-sum. Appendix C specifies the storage and update costs.
Integration (channels vs. protocol). It is helpful to reinterpret Part (ii) of Theorem 5.12 in an “information-channel” language: each policy head defines a distinct rollout measurement channel which, when iterated to termination, returns a single bit that depends on the hidden -bit invariant (cf. the identities in Proposition 5.9). With a single head, repeated deterministic root rollouts return the same linear functional ; admissible one-heap modifications give its known affine corrections (Proposition 5.10). These measurements supply no further unknown invariant bit. With multiple heads, the agent has access to linearly independent invariant measurements and can reconstruct from their outcomes (Proposition 5.9). The finite-state shootout controller introduced above is the natural generalisation of this idea: it does not change what any head can compute, but organises the heads into an adaptive querying protocol—the controller decides which channel to query next (and when to stop, or when to re-query for robustness) based on previously observed rollout outcomes. In this view, multi-head provides the channels, while the FSM provides the sequential control that turns those channels into a practical evaluation procedure.
Depth amplification. Although a single circuit cannot compute parity, iterating an policy for game steps yields an effective depth computation, which can reveal parity information. The next proposition makes this explicit by exhibiting simple rollout heads whose outcomes recover all bits of the nim-sum.
Proposition 5.9 (Structured rollout sufficiency) The structured rollout policies below, followed by an move selector, achieve strong mastery of NIM on heaps of bit-width . They use root rollouts and simulated game moves per decision. Each policy update and the final readout have polynomial circuit size in . For the resulting bit work is polynomial in .
Proof outline. For each define a deterministic rollout policy that repeatedly subtracts from the leftmost heap of size at least (and otherwise subtracts from the leftmost nonzero heap). Both simulated players follow this policy; the actual opponent may choose any legal move. A rollout under has a well-defined total number of moves whose parity is where and denotes its th bit. The search controller first queries to obtain , then queries each () to obtain , and recovers ; thus rollouts under distinct heads recover all bits of . Given , select the first heap with and reduce it to . If , take any legal move, or halt at the terminal position. No successor enumeration is needed. A complete proof is in Appendix G.
A single policy head yields only one bit. The preceding result relies on having multiple rollout channels. For one fixed member of this structured policy family, admissible queries reveal known affine functions of the same invariant bit. This statement does not concern arbitrary rollout policies.
Proposition 5.10 (Single-policy information bound) Fix and the rollout policy from the proof outline of Proposition 5.9. For any position , the rollout outcome is a fixed linear functional of the nim-sum bits (indeed, and for ). Moreover, if is obtained from by modifying one heap (as when evaluating candidate moves), then where the correction bit is computable from the known heap values and the chosen modification. Hence root and one-heap-modification queries to this fixed head reveal only known affine functions of .
Proof. The linearity claim follows from the explicit formulas above. If differs from by changing one heap from to , then and , where is known from the candidate move.
Remark 5.11 (An illustrative independent outcome-flip model) Suppose an ideal terminal bit is corrupted as , where the are independent Bernoulli variables of parameter . Then The formula follows by multiplying the expectations of . With fresh independent flips for each repetition, the least number of observations needed to distinguish the two possible ideal bits with worst-case error at most grows as , where . Appendix F states and proves explicit bounds over real parameters. Repeating one corrupted observation with the same randomness supplies no additional information. At and , agreement is approximately , so this example is not yet close to a fair coin. This is a channel-noise illustration, not a theorem about erroneous game moves: a move error need not flip the terminal bit, and can change later states and rollout length. Correlated flips can cancel in pairs, eliminating the claimed decay. Exact structured rollouts have no such noise.
The initialisation boundary for restoration. Matching two successive differences yields , whether or not that value is zero. Thus Proposition 5.5 does not supply a classifier for an arbitrary starting position. For example, complete a matching-delta policy by subtracting one from the first nonempty heap whenever no matching response exists or no previous frame is available. Starting from , it plays and the first player loses, although is winning. The fallback after the first move is needed because its delta is , which cannot be realised from . This counterexample does not rule out every possible verifier construction; it shows that conditional restoration and an unspecified fallback do not establish one. We make no universal-verifier claim. Initial winning-move selection can instead use the multi-channel construction above or the growing recurrent scan in Section 5.5.
| Resource | What stays in | Additional information or time |
|---|---|---|
| One structured channel | Policy step and final readout | One complete rollout; one invariant bit |
| structured channels | Each policy step; reconstruction and move selection | complete rollouts supply all invariant bits |
| Two-frame transition | Local difference and binary move selection | Previous zero-nim-sum board and a legal transition |
| Persistent row scan | One state update and its output bits | Two scans per decision; state bits |
Theorem 5.12 (Restricted bound and bypasses) The following statements hold under Definition 5.7.
(i) For each fixed , let be uniform on conditional on . For one fixed structured head and an readout , winning-move success is at most Here , and a negligible error is a nonnegative sequence smaller than every inverse polynomial for sufficiently large , with circuit depth, polynomial size exponent and fixed. More precisely, a uniform parity-correlation bound for the fixed-bit readout indicators gives the finite upper bound ; the indicators and correlation premise are specified in Appendix H. The leading constant is asymptotically attainable by guessing one nonzero nim-sum in each channel fibre.
(ii) For any , the structured heads and an readout select an optimal move using rollout steps, as in Proposition 5.9.
(iii) Given a legal transition from a known zero-nim-sum predecessor, a two-frame selector restores zero. Once a player has established that invariant, it maintains it against every legal opponent response. This statement does not supply the initial winning move from an arbitrary position.
Proof outline. For part (i), fixing the observed bit leaves an move selector. The selected heap’s old and new values determine a proposed nim-sum. Expanding each exact nim-sum event into its finitely many parity characters and applying the parity-correlation bound gives the displayed estimate; Appendix H gives the full reduction and conditional-probability calculation. Parts (ii) and (iii) follow from Propositions 5.9 and 5.5, with the selector described in Appendix C.
5.5 Third bypass: persistent row-wise recurrence
The two-frame construction supplies the relevant history explicitly, while the multi-head construction obtains additional information through complete rollouts. A third possibility is to let the agent build and retain its own state by processing the board sequentially. The recurrent update remains simple, but the number of updates is allowed to grow with the input. The construction uses the elementary running-XOR algorithm. In correspondence reproduced by Friedman (Friedman, 2017b), John Schulman proposed feeding NIM heaps one at a time to a recurrent network and reported preliminary supervised nim-sum experiments. Here we make the shallow updates, separator and state protocols, and move-selection constructions explicit, distinguishing their representational guarantees from learning through self-play.
Serialising positions and retaining state. Write position , with each heap represented by one -bit row. Feed successive positions as the stream Each row arrives as a block of bits together with a row/separator tag. A separator marks the end of a complete position; the agent chooses a move only after that position has been read. The next observed position is then appended to the stream. For comparisons of individual heaps, indices remain aligned across positions, including rows for empty heaps. A scan of the current board suffices for nim-sum evaluation without earlier game positions; cross-position memory additionally supports the comparisons below. The hidden state is carried across rows and position boundaries. A separator resets the accumulator for the next scan while preserving selected information about the completed position; it does not reset the entire memory.
Proposition 5.13 (Sequential nim-sum accumulation) There is a recurrent Boolean update of constant depth and size , implementable with fixed-scale quantised threshold gates, that computes the nim-sum of an -heap position after row updates. With state bits, it can also retain the previous completed nim-sum and report the XOR difference between consecutive completed positions.
Proof. Initialise a -bit accumulator to zero and update it by Induction on gives , so the final accumulator is . Each output bit of an update is the XOR of two bits, which has a constant-size, constant-depth AND/OR/NOT implementation. These gates can be realised with fixed-scale threshold gates and input negations, with constants independent of and . The summary state is : two -bit registers and one validity bit, initialised to . A row updates it to . At a separator, output and, when , the difference ; then update the state to . The first separator therefore produces a summary but no previous-position difference. Induction over completed positions shows that stores exactly the preceding summary and is the XOR of the rows since the last separator. The summary mechanism uses state bits; a reset between games restores . All assignments have constant depth and size .
From a summary to a move. Computing does not by itself retain the heap rows needed to choose a move. One implementation replays the current position after the first scan. If , select the first row for which Such a row exists: choose a heap containing the highest set bit of . Replacing that heap by leaves nim-sum zero. XOR, binary comparison and conditional selection are constant-depth operations; the replay uses state bits to retain the summary, a selected move and its row index. The explicit protocol is The first separator stores the summary and switches to replay; the second emits the move and returns to scan mode. This takes exactly updates, with one additional reset token at the start of a game. If , choose the first nonempty heap and decrement it, or report termination when all heaps are empty. Lean verifies the complete replay controller, including its binary move output and its fixed-scale threshold implementation. With an -bit counter satisfying , its state uses bits. The strict inequality allows the counter to hold the end value , whereas an output index alone only needs . Alternatively, store the current board in bits during the initial scan and use a constant-depth selector at the separator, as in Appendix C. This avoids replay at the cost of board-sized memory. The distinction matters for a stream in which each position is supplied only once. Both variants have checked bit-level circuits, fixed-scale network implementations and winning-play guarantees. The board-storage variant uses state bits and updates per decision, with , plus a reset update when initialising the controller.
Connecting recurrence to the history bypass. The retained summaries allow the agent to compare consecutive positions through When one heap changes from to , this equals . If the preceding position has nim-sum zero, the difference is exactly the invariant that the restoration rule must cancel. Storing the preceding board additionally permits direct row-by-row comparison as the new board arrives. A summary of bits preserves the invariant, rather than the full game history; arbitrary access to old positions requires additional storage or replay. The difference always refers to consecutive completed boards actually supplied to the controller. If these are only the boards at the player’s decision times, they usually span two game moves. Comparing just the opponent’s move instead requires the player’s own post-move board as the preceding frame. The initial scan also computes the invariant from an arbitrary starting position, without assuming an earlier zero-nim-sum frame. Thus memory across row updates is sufficient for this route; an earlier game position is useful for transition comparisons but is not required to compute the current nim-sum. This initialisation uses the growing recurrent horizon and is therefore an additional resource beyond the fixed-latency two-frame construction.
Why the lower bound is respected. Unrolling constant-depth updates gives a computation of depth , so Proposition 5.13 lies outside the fixed- premise of Theorem 2.4. A one-step recurrent dependency can nevertheless carry information accumulated over the whole stream. Merely appending positions and separators to a fixed-depth input does not supply this growing computation horizon. The bypass comes from sequential computation with retained state, not from the delimiter itself. For growing heap bit-width, the accumulator also needs bits; a fixed-width hidden state is not claimed to store arbitrary-size invariants or histories. The construction establishes representational sufficiency for NIM, but does not establish that training a recurrent network will discover the update or preserve it reliably over long games. We do not report recurrent training experiments here.
5.6 What the three bypasses establish
Proposition 5.14 (Shallow components and complete strategies) For heaps of bits, the following constructions use polynomial-size, constant-depth Boolean components, realisable by literal-threshold networks with weights and thresholds in .
(i) The two-frame selector maps a legal transition from to a legal binary-encoded response restoring zero. Retaining the response board as the next predecessor gives a winning strategy from this established invariant, with the opponent to move.
(ii) Each structured rollout policy and the readout from the board and its outcome bits are shallow. Executing the rollouts and then the readout gives a winning strategy from any nonzero nim-sum board, using at most simulated game moves per decision.
(iii) The recurrent state update is shallow. Iterating it over the replay protocol gives a winning strategy from any nonzero nim-sum board, with memory and updates per decision.
Here “winning strategy” quantifies over every legal opponent response. Polynomial size and constant depth refer to the indicated component, with depth independent of and ; they do not bound the number of sequential component evaluations.
Proof outline. Appendix C gives explicit candidate tests, first-index encoding and a fixed-scale implementation. The two-frame circuit computes the changed heap’s XOR difference, which equals the current nim-sum under the stated promise. The multi-head readout reconstructs that same invariant from the executed rollout outcomes. The recurrent controller obtains it by accumulation and uses the stored result during replay. In each case the selected move restores zero; every legal opponent move makes the nim-sum nonzero, and every move decreases the total number of stones. This proves termination and the winning guarantee. For the two-frame strategy, the newly restored board is precisely the frame retained for the next response. For recurrence, the finite controller state persists between decisions. The rollout and recurrent step bounds are those proved above.
These are three ways around the same restricted inference problem, not three shallow algorithms for unrestricted parity. The two-frame construction changes the input and imposes a promise. The other constructions allow processing time to grow. Their complete board-to-winning-move maps cannot themselves form an family: otherwise applying either to would contradict Theorem 5.2. Parallel output heads alone do not supply the rollout computation, and separators alone do not supply a recurrent scan. Appendix C illustrates the explicit network constructions and explains their conservative depth and layer bounds.
6 Learning impartial games with neural networks
The results above are primarily representational: they identify what information a bounded-depth, fixed-scale quantised model can or cannot compute from its input, and how history, multiple rollout heads, or a growing recurrent horizon can supply the missing information. This section connects the theory to the training protocols used in Section 7 and highlights the main modelling choice ( vs. ).
6.1 Practical takeaways
Single-frame is brittle to parity. In the worst case, fixed-scale quantised bounded-depth inference cannot reliably represent the nim-sum or a winning move selector (Section 5.2).
Three bypasses with different resources. A two-frame input exposes the transition signal and supports restoration (Section 5.3.1); multiple rollout heads recover the missing nim-sum bits through depth amplification (Section 5.4); persistent recurrence accumulates the invariant over sequential row updates and retains summaries across positions (Section 5.5). The last route trades fixed total latency for a growing processing horizon.
Optimisation remains nontrivial. Even when a solution is expressible in , discovering it from sparse win/loss rewards can be difficult; our experiments therefore isolate a dense restoration supervision signal and separately report rollout-based classification.
6.2 Teacher-guided data as a controlled source of transitions
Let denote an optimal NIM policy (move to nim-sum whenever possible). For a noise parameter , define a noisy teacher that plays according to with probability and otherwise chooses a uniformly random legal move. Occasional random moves broaden state coverage and, crucially for two-frame agents, generate diverse transition pairs from which the local difference signal can be inferred.
6.3 Approximate majority, parity, and the abstraction
One might object that modern networks can implement majority-like decisions, suggesting (threshold circuits) as the “right” complexity class. Indeed, if one allows scale-adaptive thresholds/biases or fan-in dependent re-scaling, constant-depth threshold models can represent parity-type computations.
Our focus is a restricted literal-threshold regime: fixed total depth, nonnegative weights on Boolean literals, and thresholds bounded in units of the smallest nonzero weight. In this regime, each gate has a constant-size witness and collapses to a constant-width DNF, yielding an abstraction (Theorem 2.4). Constant-depth circuits can implement approximate counting (Ajtai, 1993), yet they have exponentially small correlation with parity (Furst et al., 1984; Håstad, 1986; Smolensky, 1987; Razborov, 1987). Learning parity depends on the architecture and training setting; both difficulties and positive results have been studied (Thornton, 1996b,a; Daniely and Malach, 2020). The representational lower bound here applies only to the explicit gate model. Section 6.4 gives a complementary Fourier/spectral interpretation of this local-versus-global parity separation.
6.4 A spectral viewpoint: low-degree Fourier mass vs. parity
A useful complementary lens is Fourier analysis on the Boolean hypercube. Let and define the Walsh–Hadamard characters The set is an orthonormal basis with respect to the uniform distribution on . The Fourier coefficients are We refer to as the Fourier degree (or “frequency”) of the coefficient .
Definition 6.1 (Fourier tail / spectral bandwidth) For , define the degree- Fourier tail For , we say is -spectrally band-limited if .
Parity is a pure high-frequency character. For any nonempty , the parity function has Fourier expansion supported on a single set: and for . Thus its spectral “frequency” is exactly . More generally, if is -spectrally band-limited and , then (6.1) This elementary inequality is the link between concentration at low degree and small correlation with a high-degree parity.
has little high-frequency mass. A seminal theorem of Linial–Mansour–Nisan shows that functions have almost all Fourier mass on low degrees: for computed by an circuit of size , the tail above degree decays rapidly with (see (Linial et al., 1993), and sharper bounds in (Tal, 2015)). For fixed depth and polynomial size, correlation with full parity under the uniform distribution is negligible in . Applying this statement to other subsets requires specifying their size relative to circuit depth and size, and it does not automatically apply under a nonuniform training distribution.
Local vs. global parity in NIM. In our encoding, the th bit of the nim-sum is the parity of the th bits across all heaps, hence a degree- character. Conditional on a specified changed heap , the sign encoding of the th delta bit is the two-coordinate character . When the changed index is unknown, the delta bit is specified on pairs of boards differing in at most one heap. A shallow extension to all pairs is (6.2) On the promised domain this is the required delta bit. For , its sign encoding is not a single character, even up to sign; for it is exactly a degree-two character. Thus local computability does not mean that the full unknown-index map has degree two. It follows from the explicit construction in Lemma 5.4.
Connection to optimisation (informal). Fourier degree also aligns with a common empirical observation in deep learning: gradient-based training tends to fit low-frequency components before high-frequency ones (“spectral bias” / “frequency principle”) (Rahaman et al., 2019; Xu et al., 2019). This suggests a possible analogy for parity learning, but continuous-domain spectral-bias observations do not prove how SGD learns Boolean parity or restoration under our nonuniform data distribution. We treat that connection as a hypothesis requiring separate measurements.
6.5 From global invariants to local checks
The core representational point is that the global invariant is hard to compute from a single frame, whereas the transition quantity is locally computable from two frames (Lemma 5.4). Section 7.2 isolates this effect by training one-frame and two-frame models on the same restoration targets.
7 Experiments
The stronger experimental goal would be to show that an AlphaZero-style learner discovers effective play through self-play once a bypass is available. We do not establish that here. The theoretical barrier concerns what the restricted network can represent, independently of training; removing it leaves open whether the required computation can be learned, with what data and under which training regime.
We take a controlled intermediate step: supervised restoration learning from teacher–random transitions (Section 7.2) and a complementary single-frame multi-head shootout evaluation with imitated policy heads (Section 7.3). These experiments supply guidance that outcome-only self-play would have to generate for itself. They test whether the proposed information and computation can be useful in training, while also exposing difficulties that remain after the input has been enriched. Unless otherwise stated, both one-frame (1F) and two-frame (2F) agents share the same action parameterisation and network architecture (Section 7.1).
7.1 Neural architecture and training objective
7.1.1 State and action representation
We use a fixed-width binary encoding of heap sizes with bits per heap. The single-frame input is the encoding of the current heap vector. The two-frame input concatenates the encodings of the previous and current heap vectors. When a previous frame is unavailable (e.g. on the first move of a game), we set the previous frame equal to the current position so that the input dimension is constant and the 2F policy remains well-defined.
The action space is parameterised as “set heap to value ” for and , giving logits. The saved restoration evaluation takes an unmasked argmax over all logits; illegal predictions count as incorrect. Legality masking is used in the separate game-playing and FSM rollout routines. These are distinct evaluation conventions.
7.1.2 Network architecture
Both restoration agents use a policy-only MLP with two hidden layers and output logits. There is no value head in the saved implementation. The two-frame input has dimension ; the single-frame input has dimension . The template and hidden width are shared, but parameter counts differ: the two-frame first layer adds parameters in the reported setting. All layers use ordinary floating-point arithmetic; these networks are not literal implementations of the FSQI gate model.
| Component | Type | Dimensions | Activation/Normalisation |
|---|---|---|---|
| Input | State representation | Two-frame: bits (1F: ) | None |
| Hidden 1 | Fully Connected | 1F: ; 2F: | LayerNorm + ReLU |
| Hidden 2 | Fully Connected | ReLU | |
| Policy Head | Linear Output | Raw logits; Log-Softmax in loss |
7.1.3 Training targets and loss
For each training input (single-frame state or two-frame state-pair), the target is a soft distribution over optimal restoration moves. The policy head is trained with cross-entropy to this target. The soft-target cross-entropy also uses unmasked logits. No value loss is used in this supervised restoration experiment.
7.1.4 Evaluation criteria in this version
In this version we report two task-level notions of performance rather than full game-level Elo tournaments. Move-level restoration performance is measured by functional correctness: on a test position with nonzero nim-sum, a move is counted as correct if it produces a successor state with nim-sum zero. Positions with zero nim-sum have no winning move (Theorem 4.4); when reporting functional correctness we therefore condition on nonzero nim-sum positions. Position-level evaluation performance is measured by classification accuracy and -position recall in FSM-controlled shootouts (Section 7.3).
7.2 Supervised restoration learning from teacher–random transitions
This experiment isolates the restoration response as a supervised learning problem. In normal-play impartial games, a restoration response is the move that returns play to a losing (-)position after the opponent departs from it. In Nim, this is equivalent to selecting an optimal (winning) move from the post-opponent position: if the previous position had nim-sum , then after any opponent move the position is winning, and any optimal reply restores nim-sum .
Motivated by Sections 5.2–5.3, the experiment asks a separate empirical question under a fixed supervised training protocol: does access to the transition (two frames) enable successful restoration learning under this protocol, even when the one-frame model fails? This benchmark builds on the observation that parity-type invariants pose a challenge for reinforcement learning in impartial games (Zhou and Riis, 2026, 2023), while explicitly providing the transition information needed by Proposition 5.5.
7.2.1 Game and representations
We consider Nim with heaps. Each heap size is represented with bits (little-endian), so heap values lie in . Moves are represented in a fixed action space of size : an action chooses a heap index and a new heap value . Legality requires ; the reported unmasked metric counts violations as errors.
A 1-frame (1F) policy receives only the current position (80-bit input), while a 2-frame (2F) policy receives the concatenation of the previous and current positions (160-bit input). Both agents use the shared MLP architecture described in Section 7.1 (two hidden layers of width ).
7.2.2 Dataset generation (teacher–random–teacher)
We generate a dataset of size examples of the form where is a soft target distribution over optimal moves from .
Each example is generated as follows:
1. Sample a random winning Nim position (nim-sum ).
2. Apply an optimal teacher move from to obtain . For optimal play in Nim, has nim-sum (a -position for the next player).
3. Apply a uniformly random legal move from to obtain .
4. Define the label as the uniform distribution over all optimal (winning) moves from .
This construction ensures that each training input corresponds to the canonical restoration setting: is a -position, the random move produces a winning position , and the label is the set of restoration moves back to a -position.
Why teacher–random–teacher? We do not sample arbitrary triples uniformly at random, because the restoration claim is about a specific interaction regime: the opponent departs a -position and the agent must restore it. The teacher step ensures is a genuine -position reachable under optimal play, the random move injects diversity in the departure , and the final teacher move provides a correct restoration label for .
Compared to earlier empirical studies of impartial games (Zhou and Riis, 2026, 2023), we “help” the learner in two ways: (i) we represent heap sizes in binary rather than as raw integers, and (ii) we train on perfectly labelled restoration targets (the full set of optimal moves), rather than requiring the agent to infer these targets from sparse win/loss outcomes.
We split the dataset into 80% train / 10% validation / 10% test using a seeded permutation (seed 0), shared by the two representations. The teacher uses the first winning heap; this induces a particular, nonuniform distribution of predecessor positions. The results do not establish invariance to heap permutations, unseen board sizes, or arbitrary self-play histories.
7.2.3 Training and checkpoints
We train each model with supervised learning using cross-entropy to the soft target distribution. We use Adam with learning rate and batch size 512 for 200 epochs. To study performance as a function of training, we save checkpoints per model at epochs
7.2.4 Evaluation metrics
We evaluate restoration performance on held-out data:
Restoration accuracy (validation/test). Given a held-out example, the saved evaluation takes the argmax over all action logits and counts it as correct if it lies in the support of . Illegal predictions therefore count as incorrect, and every legal optimal move is accepted. The saved implementation averages batch accuracies equally, including the shorter final batch, rather than weighting them by batch size. The reported decimals are those saved batch means, not exact correct-example counts divided by 100,000. The same convention applies to the displayed validation curve.
7.2.5 Results
One-frame does not learn restoration; two-frame eventually does. Figure 5 shows validation restoration accuracy as a function of epoch. The 1F model has low test restoration accuracy throughout training, approximately 0.075–0.081 across saved checkpoints. We do not identify this range with a measured random-legal-move baseline, which is not supplied in the reported evaluation. In contrast, the 2F model learns the restoration mapping and reaches essentially perfect accuracy with enough training. On the test set (Figure 6), the 2F checkpoints achieve 0.209 at epoch 1, 0.538 at epoch 23, 0.876 at epoch 45, 0.989 at epoch 67, and 0.99998 by epoch 178 (remaining at epoch 200).
Learning in stages: the plateau and subsequent improvement. The plateau near and later rise in Figures 5–6 suggest a temporary learning bottleneck even with two-frame input. The learner makes substantial progress, remains at an intermediate level, and then improves sharply. This is evidence about training dynamics within the saved run, rather than a further circuit lower bound.
A diagnostic of the saved checkpoints makes the remaining difficulty more concrete. For a predicted move setting heap to , compare its proposed change with the required nim-sum of . On the reconstructed and independently verified 100,000-position test set, the epoch-23 model makes only legal moves and gets the upper three bits of this change jointly correct on 99.998% of examples. Of its 46,206 failed moves, 46,204 differ from the correct change only in the lowest bit. At epoch 45 all 12,437 errors are confined to that bit; at epoch 178 only two errors remain, both of the same kind. These diagnostic counts weight examples equally, unlike the saved batch-mean accuracies plotted above.
Thus the later improvement is accounted for at the output level by learning to select moves with the correct lowest bit while retaining the already accurate upper bits. This supports staged acquisition of the restoration behaviour. It does not identify an internal representation or explain why optimisation follows this order. Nor does the plateau’s proximity to establish a random-bit guessing mechanism: that baseline assumes a particular distribution and prediction rule. Internal probes, interventions and independent training runs are needed to explain the transition and test its reproducibility.
Scope and provenance of the reported result. This controlled supervised run shows a large advantage for transition information at , , and seed 0. It does not prove worst-case mastery, efficient self-play learning, or the asymptotic circuit lower bound. The checkpoint CSV is identified by run suffix 20260214_120801_cd18fc9f; the architecture and evaluation convention above follow its associated saved notebook. We report this documented configuration and do not make an unsupported claim of robustness across a hyperparameter or board-size sweep. Multiple independent seeds, matched-parameter controls and out-of-distribution evaluations remain useful follow-up experiments.
7.3 Single-frame evaluation via FSM-controlled shootouts (multi-head)
Purpose. We complement the two-frame restoration study (Section 7.2) with an experiment targeting the single-frame bypass from Proposition 5.9: learned approximations to the structured rollout policies combined with a finite-state shootout controller (Figure 3). The trained floating-point networks are not claimed to satisfy the formal gate restrictions. The goal is to test the rollout interface itself (how much information can be extracted by controlled shootouts), not to claim that self-play discovers the structured heads without additional inductive bias.
Setup. We consider NIM with heaps and bit-width (so heads), matching the encoding of Section 7.1.1. We evaluate on a balanced test set of 2000 positions with -positions () and -positions ().
Training the rollout heads. We train a shared-trunk network with policy heads by imitation learning against the structured policies from Proposition 5.9. Each head subtracts from the leftmost heap of size at least (falling back to subtracting 1 from the leftmost nonzero heap). When multiple heaps qualify for the same phase of (e.g. several heaps have ), any choice among them produces a rollout with the same total move count and hence the same parity outcome. We therefore train with soft targets: for each position and head , the label is uniform over all equivalent actions, and the loss is cross-entropy against this soft distribution. This avoids penalising the model for an arbitrary tie-breaking choice among equally valid heaps.
The network uses the same shared-trunk architecture as Table 1 (two hidden layers of width with LayerNorm), with independent linear output heads each producing action logits. Training uses Adam (learning rate , batch size 1024) for 12 epochs on imitation examples, with a separate 20,000-example validation set and seed 7 in the saved notebook.
Rollout evaluation. Each rollout is deterministic: both players follow the same greedy policy head (argmax over legal actions) until termination. The rollout outcome is 1 if the first player wins (makes the last move) and 0 otherwise. Since rollouts are deterministic, a single rollout per (position, head) pair suffices.
The per-head accuracy metric is whether the model’s rollout outcome matches the teacher’s rollout outcome—the correct channel bit—not whether it matches the label directly. Each exact teacher head computes a specified linear functional (; for ). The learned heads can make channel errors. The FSM uses an OR of the queried outcomes for classification, which is a different task from reconstructing every nim-sum bit.
FSM-controlled shootout evaluation. Given a test position , the evaluator runs the controller of Figure 3: it queries head first; if it immediately declares (N-position). Otherwise it queries heads sequentially, declaring N-position as soon as any , or declaring P-position if all bits are 0. Early stopping reduces the average number of rollouts below on N-positions. We report (i) overall evaluation accuracy and (ii) mean number of shootouts used.
Results. Table 2 reports the results.
Multi-head FSM achieves perfect classification. The saved output reports correct classification on all 2,000 test positions, matching the teacher’s final decisions. However, the saved per-head channel accuracies are , , and , respectively: , , and . Consequently, this result does not establish exact channel recovery or recovery of the full invariant by the learned model. Early stopping leaves some channels unqueried, and even queried channel errors need not change the final OR decision. These are transcribed saved outputs, not a fresh checkpoint evaluation; reached-head error counts and a reproducible end-to-end rerun are needed for a stronger claim.
Single-head baseline. The single-head baseline achieves 0.768 overall accuracy and 0.536 N-position recall. These numbers have an exact theoretical explanation. With bits, an N-position has nim-sum . Of these 15 values, exactly 8 are odd (: the values ) and 7 are even (). Head detects an N-position only when , so the theoretical N-position recall is (observed: 0.536 on the finite test set). All P-positions are correctly classified (since implies ), so on a balanced test set the overall accuracy is (observed: 0.768). This calculation describes the particular classifier that declares an N-position exactly when . It is not the winning-move success bound of Theorem 5.12(i), and does not establish a limit on arbitrary classifiers or rollout policies.
Different metrics. The recall measures the fraction of nonzero nim-sums detected by the exact least-significant-bit channel. Restoration accuracy instead measures whether a complete selected move cancels the full nim-sum. A resemblance between the recall and a training plateau is not evidence that the same learned mechanism produces both.
Early stopping. The average number of shootouts is 2.87 rather than the worst-case 4, because any N-position with is caught at head 0 (one rollout); only those with require further heads. Scope. We report the saved seed-7 configuration above. Perfect classification on this finite test set does not establish all-position correctness, robustness across seeds, or successful self-play discovery. We make no broader sweep claim without corresponding run records.
| Method | Heads | Rollouts | Accuracy | Recall |
|---|---|---|---|---|
| Single head (model) | 1 | 1.00 | 0.768 | 0.536 |
| Multi-head + FSM (model) | 4 | 2.87 | 1.000 | 1.000 |
| Single head (teacher) | 1 | 1.00 | 0.768 | 0.536 |
| Multi-head + FSM (teacher) | 4 | 2.87 | 1.000 | 1.000 |
Reproducibility status. The restoration notebook, checkpoint-accuracy CSV and FSM notebook are retained with the local review materials. The public repository previously named for this work does not currently provide a reproducibility package; we therefore do not claim that code and data for all configurations are publicly available. The numerical results above remain tied to the saved runs and their stated limitations. A public versioned package and independently repeated evaluation are future work.
8 Discussion and broader implications
The three bypasses identify different resources for handling a global invariant: multi-frame inputs expose local transition information, multiple rollout heads provide complementary channels, and persistent recurrence accumulates the invariant through sequential updates. In the recurrent route, memory connects successive positions while the growing processing horizon supplies the depth needed for parity. The common design principle is to match the information and computation available to the agent to the invariant it must maintain. We briefly discuss directions beyond the specific NIM setting.
8.1 Theoretical idealisation vs. practical architecture
The simulation theorem concerns Boolean literal-threshold gates with nonnegative weights and bounded thresholds, including their permitted compositions. The experiments use floating-point signed linear layers and ReLU as well as LayerNorm and a Log-Softmax loss. Their difference from the theorem therefore extends beyond normalisation layers. A failure at one finite board size does not establish an asymptotic representational impossibility; success on a finite dataset does not establish strong mastery. The controlled comparison supports a narrower empirical conclusion: the reported transition representation is much easier to learn under this supervised protocol.
8.2 Local information in combinatorial search
Exposing local invariants may also help guide combinatorial search. Our work on large Condorcet domains used structural constructions and local restrictions (Karpov et al., 2023; Zhou et al., 2024; Zhou, 2024). This is a motivating analogy, not an reduction or a demonstrated parity lower bound for that search problem. Transferring the present argument requires a precisely encoded computational task.
8.3 Beyond NIM: harder impartial games as benchmarks
By Sprague–Grundy theory, every finite impartial game position has a nimber. However, the computational complexity of determining nimbers varies widely. Some impartial games have PSPACE-complete winner problems, such as directed vertex Geography (Schaefer, 1978). Unless , no polynomial-time algorithm solves all such instances. Having a nimber does not supply an efficient way to compute it.
NIM is therefore a diagnostic starting point: its efficient optimal strategy lets us separate a representational obstruction from the difficulty of discovering a strategy. The longer-term benchmark is self-play on impartial games whose strategic structure is only partly understood or whose exact analysis becomes impractical as positions grow. Three candidates illustrate different challenges:
Sprouts. Players join spots by noncrossing curves, add a spot on each new curve, and keep every spot’s degree at most three. The normal-play outcome conjecture for the standard -spot opening remains open despite substantial progress with exact solvers (Čížek et al., 2026). Learning to exploit the evolving region structure, and to choose winning moves in intermediate positions, would be a stronger test than predicting opening outcomes from alone.
Chomp. A move removes a chosen square and all squares above and to its right; taking the distinguished corner loses. Strategy stealing establishes a first-player win on every nontrivial rectangle, but does not supply the winning moves (Berlekamp et al., 2001–2004). Larger boards and their irregular intermediate positions offer a challenge beyond solved special families; the analysis of Chomp continues to pose open problems (Nowakowski, 2025). The benchmark should test move selection and generalisation across shapes, not just the known opening winner.
Grundy’s game. A move splits one heap into two nonempty unequal heaps. Whether its nim-value sequence is eventually periodic remains an open problem (Nowakowski, 2025). This offers a test of whether self-play discovers useful structure in component values and how they combine. Testing unseen heap sizes and sums of heaps can distinguish such progress from memorising a finite table.
These are proposed learning challenges, not consequences of the present lower bound. An unresolved structural question is not itself a complexity lower bound, and worst-case hardness need not make a chosen instance distribution difficult. A useful evaluation would reserve unseen sizes and positions, report both training and decision-time computation, and compare play with exact solvers where feasible and strong search baselines elsewhere. Beyond the range of exact verification, improved win rates are evidence of stronger play rather than a solution of an open mathematical problem. The central question is whether self-play discovers reusable strategic structure that extends the range of positions it can handle under a fixed computation budget.
8.4 What the rollout separation establishes
Theorem 5.12(i) bounds winning-move selection for fixed bit-width, a specified family of root/one-heap measurements and a polynomial-size, constant-depth readout. It does not bound general single-policy search. Within that interface, the structured channels reconstruct the invariant and permit direct move selection. The extra computational resource is the sequential rollout, not the number of neural output coordinates alone. Repeated deterministic measurements of the same affine channel cannot create additional channel bits, but changing the permitted query transformations or controller computation changes the model and can remove that restriction.
8.5 Learning bottlenecks after the representational barrier
The constructions establish that the required computations can be expressed using the stated resources: a shallow restoration rule, structured rollout policies, or a shallow recurrent update iterated over the board. This removes one obstacle before training begins. It does not determine whether gradient descent will find those computations, whether sparse game rewards provide enough guidance, or whether the resulting behaviour generalises.
The restoration experiment makes this distinction tangible. Even with transition information and correct supervision, learning passes through an intermediate plateau before reaching near-perfect measured accuracy. The checkpoint diagnostic in Section 7.2 associates the later improvement with the lowest bit of the selected move’s XOR change. We therefore have empirical evidence of a remaining learning bottleneck that is largely overcome in this run, alongside a theorem about a different, representational obstruction. The data do not establish how many distinct learning mechanisms produce the stages or why the transitions occur.
The immediate experimental question is whether AlphaZero-style self-play can discover the restoration rule, complementary rollout policies or recurrent accumulator without their supervised targets. A follow-up should compare outcome-only training with curricula and auxiliary supervision, and examine the learned computations as well as win rates. For recurrence, this includes accurate accumulation and reliable state retention across separators. These controlled NIM tests would establish a basis for the harder benchmarks in Section 8.3; efficient self-play learning and the training regimes needed to achieve it remain open.
8.6 Significance and impact
Our results suggest several broader implications.
For learning theory: representational sufficiency and learnability are separate questions. A promised predecessor state, complementary measurements, or sequential computation can each alter the resources available for an invariant-based decision.
For neural architecture: short history windows (or difference features) can be a principled way to bypass parity-like barriers without scaling depth/width. When history is unavailable, multiple rollout heads offer an alternative within a single-frame architecture. When growing processing time is available, persistent recurrence offers a third route, building the invariant sequentially and retaining it across positions.
For practice: circuit complexity can help formulate architectural hypotheses, provided the implemented model satisfies the mathematical assumptions. Tests of those hypotheses should distinguish representation, training dynamics, task distribution and computation budget.
9 Conclusion
A fixed-depth Boolean literal-threshold model with nonnegative fixed-grid weights and bounded thresholds is simulable in . The NIM parity reduction then rules out strong single-frame mastery in that model.
Three constructions identify resources beyond that restricted inference problem. Two-frame access supports constant-depth restoration when the preceding position has nim-sum zero. Distinct structured rollout policies reveal complementary invariant bits; a single-channel limitation holds only under our explicit query and readout restrictions. Persistent recurrence implements running XOR over heap rows, exchanging fixed total latency for a growing sequence of simple updates. Cross-position memory additionally supports comparisons, while replay or board storage supplies the heaps needed for move selection.
The saved floating-point experiments show a large supervised two-frame restoration advantage and perfect finite-test classification by a learned multi-head controller. The latter coexists with imperfect individual channel recovery. The restoration plateaus and checkpoint diagnostics also show that learning can proceed in stages after transition information is supplied. These observations do not certify the formal gate assumptions, worst-case mastery, or self-play discovery.
The contribution is a separation of the information and computation needed for a decision from the training process that must discover it. Establishing when self-play learns the restoration rule, complementary rollout policies or recurrent accumulator remains a distinct experimental question.
10 Development, verification and author responsibility
The earlier version of this paper was developed solely by the author, with editorial feedback from AI assistants. The present version was developed interactively with the AI assistants Astra and Claude. Extensive feedback from the Lean formalisation and its audits helped to improve the presentation, clarify definitions and hypotheses, and make the scope of the claims more precise. The author takes sole responsibility for the paper, including its arguments, interpretation and use of AI assistance.
The accompanying Lean development (Riis, 2026b) connects the mathematical results to explicit Boolean circuits, fixed-scale networks and complete game strategies. It checks the parity reduction, the finite probability bound and its attainability, move selection with binary outputs, the rollout executors and both shootout schedules, and the recurrent protocols with replay or board storage. The general weak-mastery definition, Fourier expansion and the real-parameter noise calculation are also formalised. An independent rebuild checks 1,588 theorem and lemma declarations across 38 local Lean files, comprising 24,493 source lines; these counts include auxiliary results and exclude Lean and Mathlib themselves.
The boundary of this verification is explicit. Classical complexity results, notably Håstad’s parity hardness and correlation bounds and the Linial–Mansour–Nisan/Tal spectral bounds, remain external inputs (Håstad, 1986, 2014; Linial et al., 1993; Tal, 2015). The single-channel result is checked conditional on a stated negligible parity-correlation theorem, including its application to the readout and its probability calculation. The spectral discussion uses a separate Fourier-tail premise; its connection to the exact conventions of a published tail theorem is not part of the checked development. The conditional implication from a tail bound to small parity correlation is checked. Empirical measurements and training runs are supported by experimental code and saved results, rather than by Lean proofs.
The author’s review of the formalisation focused on the interface between the paper and Lean: whether the formal definitions, hypotheses and conclusions express the intended mathematical claims. The author did not manually inspect every theorem or lemma declaration or every line of Lean source. Mechanical checking verifies the formal proofs relative to their definitions and stated hypotheses; it does not independently certify the correspondence with the prose, the suitability of the modelling assumptions, or the experimental results.
The accompanying interactive edition (Riis, 2026a) reproduces the paper text and links individual statements to their definitions, hypotheses and proofs, with optional explanations alongside them. The paper’s arguments remain self-contained at the level of its stated classical inputs; the interactive material supplies further detail rather than replacing a proof needed to understand a claim. Stable statement labels and a versioned correspondence record identify the formal results and any external assumptions. The edition includes the complete local Lean sources, pinned dependency information and reproducible build instructions. Claude generated the interactive edition and its link structure, which underwent a detailed, extensive audit by Astra. The author extensively cross-checked the edition but did not inspect every internal link and asset reference individually. An automated audit of this version verified the targets of 50,970 such references, including repeated occurrences. These navigation checks do not by themselves establish that each link provides the intended explanation or proof.
Neither the mathematical verification nor the experiments establish that gradient descent or self-play will discover the constructions in general.
Acknowledgments and Disclosure of Funding
The author received no dedicated funding for this work.
Appendix A. Formal definitions of fixed-scale quantised neural models
This appendix provides formal definitions of the fixed-scale quantised neural models used throughout the paper.
A.1 Preliminaries: fixed-scale quantisation and representable parameters
Fix constants . Define the fixed finite set of representable parameters In particular, the set of allowable weights/thresholds does not depend on input length . This models fixed-scale quantisation with bounded range: values lie on a fixed grid (step ) and saturate at magnitude , independent of the input length . It is a restricted Boolean gate abstraction; neither floating-point nor general signed fixed-point networks automatically satisfy it. In particular, mere finiteness of a floating-point format is not what drives our containment; the key is that the effective range/scale of thresholds does not grow with fan-in as increases.
We will allow negations on wires (equivalently, has NOT gates). This is standard in circuit complexity and avoids conflating two independent issues: (i) parity hardness vs (ii) monotonicity restrictions.
A.2 Feedforward model
Definition A.1 (Literal-threshold network) A fixed-scale quantised of depth on Boolean inputs is specified by:
Layer widths , , where .
For each layer and unit :
weights for ,
a threshold ,
an optional negation bit indicating whether input is negated before weighting.
The computation proceeds as follows. Let . For , where if and otherwise. The network output is (or a designated subset of its coordinates).
A.3 Recurrent model (finite window)
Definition A.2 (Bounded-unrolling recurrence) Fix a time window . A fixed-scale quantised consists of:
input bits at time ,
a hidden state for some ,
an output for ,
fixed-scale quantised parameters (weights/thresholds in and optional input negations) shared across time,
such that each update and is computed by a depth- fixed-scale quantised threshold network over the current input and earlier states within the window. Each inference starts from an input-independent initial state, and the entire computation producing its output contains at most recurrent updates. No boundary state may carry additional input-dependent computation from before that window. Unrolling this bounded computation yields a feedforward computation of depth . A bound only on the lag between connected states does not imply this bound on total unrolling; the persistent model in Section 5.5 deliberately allows more than updates.
A.4 Attention-style model (finite window)
Definition A.3 (Gate-realised attention-style model) Fix a time window . A fixed-scale quantised model processes a sequence by:
computing short-term and long-term attention scores using fixed-scale quantised parameters in ,
combining attended summaries through a constant number of layers of fixed-scale quantised threshold computations,
producing outputs .
Every score computation, input-dependent coefficient selection, encoding and value aggregation is required to have a polynomial-size, constant-depth implementation in the Boolean literal-threshold gates of Definition A.1. Intermediate state is Boolean, and total unrolling is bounded as in Definition A.2. Under these explicit implementation assumptions, the simulation theorem applies by composition. Merely requiring parameters or coefficients to lie in a finite set is insufficient. This extension makes no claim about standard softmax attention without such a reduction.
Remark A.4 (Scope of the simulation) Theorem 2.4 applies because are constants and each unit’s parameters come from a finite set independent of . Appendix B gives an explicit circuit construction.
Appendix B. An construction for simulating fixed-scale quantised networks
This appendix gives a clean circuit construction proving Theorem 2.4.
B.1 One threshold unit is in under fixed-scale quantisation
We first show that a single fixed-scale quantised threshold unit (as in Definition A.1) is computed by a depth-2 circuit of polynomial size.
Lemma B.1 (Fixed-scale quantised threshold gate ) Fix constants . Let be Boolean inputs, and let . Consider the Boolean function Then is computable by a depth-2 circuit of size , where is a constant (depending only on ).
Proof. Multiply the inequality by to clear denominators. Write and with and . Then If the function is identically . Assume .
Because each is a nonnegative integer and each active input contributes at least to the left-hand side whenever , any satisfying assignment contains a subset of at most active variables whose coefficients already sum to at least . More formally: if , let . Choose any multiset-free subset by greedily adding indices until the partial sum reaches . Since each added index increases the sum by at least , this process stops after at most steps. Because , we get .
Therefore, This is a depth-2 DNF: an OR of ANDs. Here depth counts AND/OR layers; counting input negations as gates adds at most one layer, as in the implementation bounds below. The number of terms is at most , polynomial since is constant. Unbounded fan-in AND/OR gates give an circuit of depth and size .
Remark B.2 (Negations) If some inputs are negated before weighting, i.e. , this simply replaces by either or in each conjunction term. Since allows NOT gates, Lemma B.1 still applies.
B.2 From one unit to a full network
Lemma B.3 (One layer of fixed-scale quantised units is in ) Fix and let a layer consist of threshold units whose inputs are outputs of a previous layer of width , with . Then the layer can be simulated by an circuit of constant depth and polynomial size.
Proof. Apply Lemma B.1 independently to each unit. Each unit yields a depth-2 circuit of size . Combine these circuits in parallel; the total size is and depth remains .
Proof of Theorem 2.4. For a feedforward of constant depth , repeatedly replace each layer by the circuit from Lemma B.3, wiring outputs of layer circuits as inputs to layer circuits. Depth multiplies by a constant factor: overall depth is (constant), and size remains polynomial as a composition of polynomial-size layers.
For and with time window , unroll the computation for steps (constant) to obtain a feedforward computation of depth (still constant). Apply the same layer-by-layer replacement.
Appendix C. Implementation details: shallow circuits and fixed-scale networks
The constructions share a small collection of Boolean operations. Each heap is a -bit block, and a move is a validity bit, a binary heap index, and a -bit replacement value. The circuits below have polynomial size in their supplied input length. Their depth does not grow with the number of heaps or bits. All XORs described as shallow here combine two bits, or a fixed number under a bounded-change promise; an XOR of arbitrarily many heap rows is never treated as a primitive gate.
From a game rule to a network. The networks in this appendix are constructed explicitly from the game rules: their connections and weights are specified by an algorithm, rather than found by training. To see what the construction computes, revisit Figure 2. The preceding board has nim-sum zero; after the opponent changes to , the current board is . Comparing the frames gives . In parallel, the circuit proposes replacements and tests which decrease their heaps. Only passes, so the output selects heap index with replacement value , giving with nim-sum zero. For and a two-bit index, the output fields are validity , index , and value .
The same move-selection operations are reused when rollout outcomes supply the target nim-sum. In the recurrent construction the target is accumulated over rows, and replay supplies the rows again for candidate testing. These interfaces explain how the constructions avoid asking one shallow network to extract parity from an arbitrary single board. More heaps require more parallel circuitry; executing a rollout or a recurrent scan still requires repeated evaluations.
Local differences and candidate moves. On a legal transition only one heap changes. Consequently, bit of the delta is The single-change promise makes OR equal to the required XOR across changed rows. For a target supplied as input bits, form in parallel. The test is shallow: OR over the possible highest differing bit, requiring equality at every higher bit and at that bit. Each test has size polynomial in . When no cancelling candidate exists, use the first nonzero heap and subtract one. Bit of that decrement is XOR the conjunction saying that all lower bits are zero. The validity bit is false exactly when the board is terminal. In restoration, the target comes from the two-frame delta; in the multi-head readout it comes from reconstruction of the rollout outcomes.
A binary index is part of the circuit. Let be the candidate flags after choosing between cancellation and fallback. More than one may be true. Define The flags select the first candidate; the wires give its binary index. Masking the candidate replacement bits by and taking OR gives the value output. Combining validity with handles the absence of candidates. This uses constant additional depth and polynomial size, rather than an uncosted external search for the first true flag. The Lean priority encoder proves agreement for every flag pattern, including invalid outputs, no candidates, and the cases and . A move index uses bits with ; the replay counter also stores and therefore requires .
The recurrent update. Scan mode updates the accumulator by two-bit XORs. Replay mode tests the current row against the stored summary, retains the first cancelling candidate and a fallback, and increments the row counter. Counter bit changes exactly when all lower bits are one, so increment also has a shallow circuit. Mode, validity and reset flags select the appropriate register updates. Induction over well-formed token streams proves that every reachable register fits its allotted width and that the output move uses the summary from the same board’s first scan. The input protocol supplies the repeated rows; the controller does not secretly store the board.
Realisation with fixed-scale threshold gates. An OR gate uses weights and threshold ; a negated literal supplies NOT. Implement AND by De Morgan, as an OR of negated inputs followed by negation. This keeps the threshold bound fixed even when fan-in grows. Constants use no inputs and threshold or . Thus all these circuits can use the fixed grid . More precisely, for output formulas of depth at most , total formula size , and input support below , the checked compiler constructs one network of at most layers, at most gates, and layer widths and fan-ins at most . Identity buffers align layers; every output is proved equal to its source formula on the same finite input. Size counts duplicated formula nodes, and depth counts NOT gates, so these are conservative bounds.
| Component | Boolean depth | Threshold layers |
|---|---|---|
| Two-frame binary move selector | ||
| Multi-head binary readout, given outcomes | ||
| One structured policy’s binary move output | ||
| One recurrent state update and output | ||
| One shootout controller tick |
These explicit Lean-checked bounds are not optimised. Together with the polynomial size bounds, they certify the components’ resource requirements. They apply to one evaluation, not to an entire rollout or row scan. The whole-game proofs connect the resulting network outputs to the corresponding game moves and state updates; the time needed to repeat those evaluations remains part of the algorithm.
Where the layer counts come from. For the two-frame selector, the compositional Boolean-depth bound is : at most four levels extract the frame difference, four handle candidate tests and replacement bits, nine are allowed by the general selection construction (including fallback and output handling), and three encode the selected heap’s binary index. These are bounds on composed subcircuits, not necessarily the exact number of levels on a shortest implementation. The compiler then gives at most threshold layers. Similarly, Boolean depths , , and give the other entries in the table.
The factor of two allows every Boolean level the cost of an AND gate, even though OR and NOT need only one threshold layer. The two additional stages copy inputs into the construction and arrange the output wires; identity gates retain values until they are needed. This uniform construction makes correctness and resource accounting straightforward, but is not a depth optimisation. The table proves that networks within these bounds exist, not that these depths are necessary or that training will discover their weights. A more economical implementation may use fewer layers; establishing sharper bounds would require a separate construction and proof.
Outer-controller storage and time. For and , the shootout controller uses state bits: a working board, control flags, a head index and the collected outcomes. Its input also contains the original -bit board, held fixed throughout the decision. This external storage is additional to the state count. The circuit handles head selection, board reload, outcome collection, increment and halt; the depth bound in the table applies to either the early-exit classifier or the all-head schedule.
Let be the total number of simulated legal moves in the all-head schedule. The implementation uses component evaluations: move updates, terminal tests, outcome-consumption updates, one initial reset and one final move readout. Since , this agrees with the rollout-time bound in the main text while making the control overhead explicit. These are circuit evaluations, not measured processor time. The early-exit schedule uses only the visited heads and gives the same classification as the OR of all outcomes. These certificates concern the two specified schedules; the abstract definition of a finite-state controller does not certify arbitrary scheduling logic.
Appendix D. Weak mastery examples
Example 1 (Pairing strategy) Consider positions consisting of pairs of equal heaps. The second player can mirror the first player’s move on the matching heap, maintaining the paired structure until termination, hence winning. The checked binary selector finds the first unequal pair and reduces its larger heap to match its partner. It has constant depth and polynomial size, and wins against every legal opponent from the paired family when playing second. For the first-player role every paired initial board is losing, so weak mastery there would be vacuous.
The distinction from strong mastery is substantive. From the single heap , a strategy that takes all three stones wins immediately, irrespective of what it would do elsewhere. It therefore weakly masters that initial position as first player. If it has no prescribed move at , however, it fails strong mastery: arbitrary legal play can reach with the first player to move. That history is excluded by its own initial action. The general definition and this separation are checked in Lean.
Appendix E. Proof of Lemma 5.4
We provide an explicit construction for computing nimber differences between positions differing in at most heaps.
Proof of Lemma 5.4. Let positions be encoded as blocks of length bits (heap sizes in binary), so total input length is .
Step 1: identify changed heaps. For each heap and bit position , compute . Then indicates whether heap changed. This is depth two after flattening the OR of the two-bit XOR DNFs, ignoring input negations in the usual convention.
Step 2: assume at most changes. By promise, with constant.
Step 3: compute per-changed-heap XOR values. For each heap , define the block XOR value (bitwise XOR across the bits). Each output bit is XOR of two bits, hence .
Step 4: XOR the at-most- nonzero blocks. Since at most heaps changed, is XOR of at most -bit numbers. The locations of the changed blocks must also be selected. For each with , form an indicator that is exactly the changed set: . Conjoin it with the constant-size truth table for the parity of , and OR over all such . There are choices, each using at most wires plus a constant-size parity table. This gives polynomial size and constant depth. On the single-change promise, each delta bit simplifies to .
The overall circuit has constant depth and polynomial size in .
Appendix F. Independent noise and repetition
Remark 5.11 concerns a symmetric observation channel for an unknown bit . Each observation agrees with with probability , where , and observations are independent conditional on . A possibly randomised decision rule assigns a probability of outputting 1 to each observed bit vector. Let be the least sample count for which such a rule has error at most for each possible value of .
Proposition F.1 (Repetitions needed for a weakly informative bit) The minimum exists and satisfies Majority voting, with ties declared 0, achieves the middle upper bound.
Proof outline. Under either value of , the sum of correctness indicators has mean and variance at most . The second-moment bound gives majority error at most , so suffices. This also proves that a least sufficient natural number exists. For necessity, the likelihood ratio between the two product laws has chi-square divergence If , use and for , , to bound this divergence strictly below 1. Cauchy–Schwarz then bounds total variation strictly below . A rule whose two errors are at most would distinguish the laws with acceptance probabilities differing by at least , a contradiction. This applies to randomised rules as well. Finally, bounds the ceiling by .
For the flip model, . Fresh independent blocks of flips produce exactly the product observation law used above. When , the small-bias condition holds for every ; one elementary bound is . If or , one observation is exact. If , no number of observations permits error below for both ideal bits. Reusing the same corrupted bit leaves the information content unchanged. The finite product laws, real-parameter bounds, minimum sample count and these boundary cases are checked in Lean.
Appendix G. Additional proofs for the rollout analysis
Proof of Proposition 5.9. Fix a position with heap sizes and let . For each define the deterministic rollout policy :
“Subtract from the leftmost heap of size at least ; if none exists, subtract from the leftmost nonzero heap.”
Each is -computable because it performs constant-depth comparisons to the threshold and selects the leftmost qualifying heap.
Consider a rollout under from . While some heap is at least , every move subtracts exactly from some heap, so the number of such moves is . After this phase all heaps satisfy , and falls back to subtracting until termination, for a further moves. Thus the total number of moves is , and (normal play) the first player wins iff is odd, i.e. iff .
For each , the parity of equals the th bit of , denoted , so . For , , so . For , every remainder is zero and . Hence and for . From these outcomes the agent recovers .
When , let be its highest set bit. Some heap has bit set; XOR with changes that bit to zero and leaves every higher bit unchanged, so a decreasing replacement exists. Choose the first such heap and set . The new nim-sum is . Comparisons, XOR and first-index selection are . When , output any legal move, or halt if every heap is zero.
This selector gives a winning strategy against every legal opponent response from a nonzero starting position. After the selected move, any opponent move changes one heap by a nonzero XOR difference and therefore makes the nim-sum nonzero again. The selector can restore zero on its next turn. Every legal move strictly decreases the total number of stones, so play terminates; since a nonterminal zero-nim-sum position cannot move directly to the terminal position, the selector makes the last move. The opponent need not follow any rollout policy.
Compute and retain each of the root outcomes once per decision. Each rollout has at most moves, so their total is at most . This counts simulated game moves, rather than elementary bit operations or elapsed time. Multiplying by the polynomial gate work per policy update gives a bit-work bound; it is polynomial in when , and the displayed step bound is exponential in unrestricted binary heap width.
Appendix H. Proof of Theorem 5.12
Proof. Part (i). Fix , and put . Let be the uniform distribution on all independent -bit heaps, before conditioning on a nonzero nim-sum. For any fixed values of heaps and any target nim-sum, exactly one value of the remaining heap gives that target. Thus is exactly uniform on , and . Let be the nonzero linear functional returned by the fixed structured head, and let .
For each fixed , decode as a proposed move . On legal outputs define , and set on invalid outputs. Selecting an indexed input block, checking legality and taking its XOR with the output use polynomial-size, constant-depth circuits. Thus for each , the indicator is in . On , a legal move wins exactly when ; invalid outputs cannot satisfy that equality.
For , write . First consider the finite probability calculation under the explicit assumption that some satisfies for every , and nonzero . This is a two-sided correlation bound under the unconditioned distribution ; it does not assume independence between the readout and the nim-sum. Expanding the exact-value indicator gives so For each fixed , the events are disjoint. Therefore Dividing by gives the finite bound (H.1)
It remains to supply the correlation estimate for the circuit class. For , is parity on times the number of nonzero coordinates of , hence on at least input bits. Fix all coordinates outside this support. The restricted indicator remains a polynomial-size, fixed-depth circuit, so the standard parity-correlation bound applies uniformly to every such restriction; averaging over the fixed coordinates preserves the bound (Håstad, 1986, 2014). Taking the maximum over the finitely many gives a nonnegative negligible . Since , the circuit depth and the polynomial size exponent are fixed, is also negligible. This yields the asserted asymptotic bound. The fixed- assumption is essential to this stated asymptotic conclusion.
For attainability of the leading constant, choose a nonzero from each fibre , possible because . After observing , try to cancel using the first heap with , with any legal fallback if none exists. This is an readout and wins whenever or , an event of conditional probability . Any additional success is at most negligible by the upper bound. For and , the choices give exactly : the case is assigned a legal delta-1 move and cannot win.
Part (ii). The root rollout bits reconstruct . If it is nonzero, a heap containing its highest set bit can be decreased to , leaving zero nim-sum. An first-qualifying-heap selector implements this choice. With zero nim-sum, any legal move is optimal in the game-theoretic sense that no winning move exists. Each root rollout has at most moves. Hence rollouts use simulated moves, each with polynomial circuit work; no successor enumeration or unrestricted controller is used.
Part (iii). If the predecessor has nim-sum zero and the opponent legally reaches , then . Select a decreasing heap as above. The two-frame difference and move selector are , and the response returns nim-sum zero. Repeating this response after the player’s own successful moves wins from the established invariant. No assertion about establishing it from an arbitrary start is used.
References
- Miklós Ajtai. Approximate counting with uniform constant-depth circuits. In Advances in Computational Complexity Theory, DIMACS Series in Discrete Mathematics and Theoretical Computer Science, vol. 13, pages 1–20, 1993.
- Elwyn R. Berlekamp, John H. Conway, and Richard K. Guy. Winning Ways for Your Mathematical Plays, Vols. 1–4. AK Peters/CRC Press, 2001–2004.
- Tomáš Čížek, Martin Balko, and Martin Schmid. Massively parallel proof-number search for impartial games and beyond. Proceedings of the AAAI Conference on Artificial Intelligence, 40(43):36838–36846, 2026. https://doi.org/10.1609/aaai.v40i43.41010.
- Amit Daniely and Eran Malach. Learning parities with neural networks. In Advances in Neural Information Processing Systems, 33, 2020.
- Tim Dettmers, Mike Lewis, Younes Belkada, and Luke Zettlemoyer. LLM.int8(): 8-bit matrix multiplication for transformers at scale. arXiv preprint arXiv:2208.07339, 2022.
- Harvey Friedman. AI Challenge. FOM mailing list, September 28, 2017. https://fomarchive.ugent.be/2017-September/020612.html.
- Harvey Friedman. NIM/Deep Learning. FOM mailing list, October 15, 2017. Includes correspondence from John Schulman, October 14–15, 2017. https://fomarchive.ugent.be/2017-October/020642.html.
- Merrick Furst, James B. Saxe, and Michael Sipser. Parity, circuits, and the polynomial-time hierarchy. Mathematical Systems Theory, 17(1):13–27, 1984.
- Yiding Hao, Dana Angluin, and Robert Frank. Formal language recognition by hard attention transformers: perspectives from circuit complexity. Transactions of the Association for Computational Linguistics, 10:800–810, 2022.
- Johan Håstad. Computational Limitations for Small Depth Circuits. PhD thesis, MIT, 1986.
- Johan Håstad. On the correlation of parity and small-depth circuits. SIAM Journal on Computing, 43(5):1699–1708, 2014. doi:10.1137/120897432.
- Benoit Jacob, Skirmantas Kligys, Bo Chen, Menglong Zhu, Matthew Tang, Andrew Howard, Hartwig Adam, and Dmitry Kalenichenko. Quantization and training of neural networks for efficient integer-arithmetic-only inference. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 2704–2713, 2018.
- Alexander Karpov, Klas Markström, Søren Riis, and Bei Zhou. Set-alternating schemes: A new class of large Condorcet domains. arXiv preprint arXiv:2308.02817, 2023.
- Nathan Linial, Yishay Mansour, and Noam Nisan. Constant depth circuits, Fourier transform, and learnability. Journal of the ACM, 40(3):607–620, 1993.
- William Merrill and Ashish Sabharwal. The expressive power of transformers with chain of thought. In International Conference on Learning Representations, 2024. https://arxiv.org/abs/2310.07923.
- Marvin Minsky and Seymour Papert. Perceptrons: An Introduction to Computational Geometry. MIT Press, 1969.
- Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A. Rusu, Joel Veness, Marc G. Bellemare, Alex Graves, Martin Riedmiller, Andreas K. Fidjeland, Georg Ostrovski, et al. Human-level control through deep reinforcement learning. Nature, 518(7540):529–533, 2015.
- Yurii Nesterov. A method of solving a convex programming problem with convergence rate . Soviet Mathematics Doklady, 27(2):372–376, 1983.
- Hung Q. Ngo, Ely Porat, Christopher Ré, and Atri Rudra. Worst-case optimal join algorithms. Journal of the ACM, 65(3):16:1–16:40, 2018.
- Richard J. Nowakowski. Unsolved problems in combinatorial games. In Games of No Chance 6, MSRI Publications, vol. 71, pages 55–98, 2025. https://library.slmath.org/books/Book71/files/GONC6-04.pdf.
- Nasim Rahaman, Aristide Baratin, Devansh Arpit, et al. On the spectral bias of neural networks. In Proceedings of the 36th International Conference on Machine Learning (ICML), pages 5301–5310, 2019.
- Alexander A. Razborov. Lower bounds on the size of bounded depth circuits over a complete basis with logical addition. Mat. Zametki, 41(4):598–607, 1987.
- Søren Riis. Overcoming a learning bottleneck in impartial games: Interactive edition. 2026a. https://sr123.github.io/impartial-games-learning-lean/.
- Søren Riis. Overcoming a learning bottleneck in impartial games: Lean formalisation and archived interactive edition. Version 1.0.0, Zenodo, 2026b. https://doi.org/10.5281/zenodo.23289503. Lean sources: https://github.com/SR123/impartial-games-learning-lean/tree/main/lean.
- Thomas J. Schaefer. On the complexity of some two-person perfect-information games. Journal of Computer and System Sciences, 16(2):185–225, 1978.
- Julian Schrittwieser, Ioannis Antonoglou, Thomas Hubert, Karen Simonyan, Laurent Sifre, Simon Schmitt, Arthur Guez, Edward Lockhart, Demis Hassabis, Thore Graepel, et al. Mastering atari, go, chess and shogi by planning with a learned model. Nature, 588(7839):604–609, 2020.
- David Silver, Aja Huang, Chris J. Maddison, Arthur Guez, Laurent Sifre, George Van Den Driessche, Julian Schrittwieser, Ioannis Antonoglou, Veda Panneershelvam, Marc Lanctot, et al. Mastering the game of go with deep neural networks and tree search. Nature, 529(7587):484–489, 2016.
- David Silver, Julian Schrittwieser, Karen Simonyan, Ioannis Antonoglou, Aja Huang, Arthur Guez, Thomas Hubert, Lucas Baker, Matthew Lai, Adrian Bolton, et al. Mastering the game of go without human knowledge. Nature, 550(7676):354–359, 2017.
- David Silver, Thomas Hubert, Julian Schrittwieser, Ioannis Antonoglou, Matthew Lai, Arthur Guez, Marc Lanctot, Laurent Sifre, Dharshan Kumaran, Thore Graepel, et al. A general reinforcement learning algorithm that masters chess, shogi, and go through self-play. Science, 362(6419):1140–1144, 2018.
- Roman Smolensky. Algebraic methods in the theory of lower bounds for boolean circuit complexity. In Proceedings of the 19th Annual ACM Symposium on Theory of Computing, pages 77–82, 1987.
- Avishay Tal. Tight bounds on the Fourier spectrum of . Electronic Colloquium on Computational Complexity (ECCC), TR14-174, 2015.
- Christopher James Thornton. Backpropagation can’t do parity generalisation. University of Sussex, School of Cognitive and Computing Science, 1996.
- Chris Thornton. Parity: the problem that won’t go away. In Conference of the Canadian Society for Computational Studies of Intelligence, pages 362–374. Springer, 1996.
- Zhi-Qin John Xu, Yaoyu Zhang, and Yanyang Xiao. Frequency principle: Fourier analysis sheds light on deep neural networks. arXiv preprint arXiv:1901.06523, 2019.
- Bei Zhou. Reinforcement Learning for Impartial Games and Complex Combinatorial Optimisation Problems. PhD thesis, Queen Mary University of London, 2024.
- Bei Zhou, Klas Markström, and Søren Riis. CDL: A fast and flexible library for the study of permutation sets with structural restrictions. SoftwareX, 28:101951, 2024.
- Bei Zhou and Søren Riis. Exploring parity challenges in reinforcement learning through curriculum learning with noisy labels. arXiv preprint arXiv:2312.05379, 2023.
- Bei Zhou and Søren Riis. Impartial games: A challenge for reinforcement learning. Machine Learning, 115:54, 2026. First preprint 2022. https://doi.org/10.1007/s10994-026-06996-1.