Learned Tactic Policies versus a Hand-Written Heuristic for Size-Extrapolating Proof Search in Propositional Sequent Calculus: A Small CPU Study Pyrite-61S Stemma seed corpus https://github.com/mihir-chauhan/research-harness-papers/tree/main/papers/tactic-prediction-on-a-synthetic-arithmetic-propo Abstract—Neural tactic policies are routinely used to guide few proofs [8]. In these systems, the learned component is best-first proof search, but their benefit over a careful hand- evaluated on large libraries where a hand-written alterna- written ordering is rarely measured in a setting where the tive is hard to build and optimal proofs are unknown, so baseline can be tuned and optimal proofs can be computed. We build a tiny propositional sequent calculus (invertible it is difficult to say how much of a prover’s success is due G3cp-style rules, tactic = which compound formula to de- to the learned ranking, to the search algorithm and cost compose), generate 20000 provable training sequents with 3– function, or to the problem distribution. 10 connectives, and train a small transformer and a feature- Propositional sequent calculus offers a controlled mi- based MLP to imitate optimal tactics (minimum proof size crocosm. With invertible (G3-style) rules, every tactic by dynamic programming). We then compare best-first search guided by the policies against breadth-first search (BFS) and preserves provability, so a prover never gets stuck; what a a tuned hand heuristic (defer branching rules) within a budget good tactic choice buys is a shorter proof and less search. of 100 expansions on sequents with 11–20, 21–40 and 41–70 Optimal proof size is computable for small sequents, a connectives, with 5 seeds, all systems sharing one search engine. sound hand-written heuristic is known in principle (apply The result is largely negative: the transformer policy beats non-branching rules first so that context is not duplicated BFS in every test bin (e.g. solved rate 0.41 vs. 0.20 at 41–70 connectives) but loses clearly to the hand heuristic (0.73), and across branches), and sequents of arbitrary size are easy to the gap does not shrink with size. Search with the policy’s generate. This makes it possible to ask a sharper question cumulative negative log-probability as cost is the weak point: than “does the policy help?”: following the same transformer greedily, or ranking tactics by On sequents larger than anything in training, and the policy instead of using − log p, raises the 41–70 solved rate under a fixed budget of 100 expansions, does best-first to 0.73, on par with the heuristic. A training-set sweep shows the opposite of the usual trend: the transformer trained on search guided by a learned tactic policy find more proofs 1000 sequents extrapolates better (0.52 at 41–70) than the one than breadth-first search and than a fairly tuned hand trained on 20000 (0.41), but still below the heuristic. In a post- heuristic? hoc (not pre-registered) variant, the feature MLP with rank We pre-registered four hypotheses (Sec. IV): the policy cost reaches 0.88 and exceeds the heuristic. All conclusions are beats BFS (H1) and the heuristic at the largest size (H2), limited to this synthetic, small-scale setting. Index Terms—automated theorem proving, tactic predic- the policy’s relative standing worsens with size (H3), and tion, best-first search, sequent calculus, length generalisation, search beats greedy decoding of the policy (H4). Our negative result results are mixed to negative. H1 is supported; H2, H3 and H4 are refuted. An exploratory diagnostic and ablations I. Introduction indicate that how the policy’s output is turned into a Learned tactic policies are a core component of modern search priority matters more than the policy architecture, neural theorem provers: a language model proposes the and that a feature-based MLP with a rank-based cost can next proof step and a best-first or tree search decides exceed the heuristic in our setting, a post-hoc finding that which proof states to expand [1]–[4]. Earlier work used we flag as such. neural networks to rank premises or clauses for classical a) Contributions.: (i) A small, fully reproducible provers [5], [6] or to guide connection-tableau search with sequent-calculus prover, four random-provable-sequent reinforcement learning [7], and incremental learning with generators and an optimal-proof labeller; (ii) a controlled hindsight relabelling has been used to learn provers from comparison of BFS, a tuned hand heuristic, a feature MLP policy and a transformer policy under one search engine, Pyrite-61S is the codename of an autonomous study, not a person. with 5 seeds and three test size bins; (iii) ablations over Produced by the Stemma autonomous AI research pipeline; the topic the cost function, decoding mode, positional encoding, was chosen to cover the field. Every reported result is traced to logged runs in the linked repository and every reference was checked against training-set size and budget, plus a diagnostic of how arXiv, Crossref, DataCite or OpenAlex. often the policies defer branching rules. We make no claim beyond this synthetic setting. ∧ R : Γ ⊢ A ∧ B, ∆ ⇒ Γ ⊢ A, ∆ and Γ ⊢ B, ∆ ∨ L : Γ, A ∨ B ⊢ ∆ ⇒ Γ, A ⊢ ∆ and Γ, B ⊢ ∆ II. Related Work → L : Γ, A → B ⊢ ∆ ⇒ Γ ⊢ A, ∆ and Γ, B ⊢ ∆ a) Neural-guided theorem proving.: DeepMath [5] showed that neural networks can select premises for a A goal is closed by the axiom rule when a variable occurs first-order prover, and Loos et al. [6] used deep networks on both sides; closure is applied automatically and costs to guide clause selection in a saturation prover. Kaliszyk et no expansion. A tactic a = (side, φ) names the compound al. [7] combined Monte-Carlo guidance with learned policy formula φ to decompose (the rule follows from the side and value estimates for connection-tableau proving. GPT- and the main connective); A(g) is the set of tactics of f [1] introduced autoregressive transformer tactic genera- goal g. Because all rules are invertible, a goal is provable tion with best-first search for Metamath; HyperTree Proof iff it is valid, every tactic leaves provability intact, and Search [2] adds an MCTS-style search over hypergraph the choice of tactic affects only proof size. ∧R, ∨L and proof states with online training, and BFS-Prover [3] → L are branching: the remaining context is duplicated revisits plain best-first tree search with large language and decomposed in both branches. models in Lean, arguing that a simple search with a strong B. Search engine (shared by all systems) policy can be competitive. LeanDojo [4] provides an open benchmark and retrieval-augmented tactic generation, and A search state is a list of open goals. One expansion Aygün et al. [8] learn provers by incremental training with pops a state, selects its first open goal g, and generates hindsight experience replay. All of these operate at a scale one child per tactic a ∈ A(g) (the child replaces g by the where the contribution of the learned policy is entangled open subgoals of a). A proof is found when a generated with pretraining, retrieval and search design; the present child has no open goal; the search fails after 100 pops. All study keeps the architecture of the pipeline (policy → cost systems differ only in the priority of a child with parent → best-first search) but shrinks everything to a regime in priority P and step cost c(g, a): which every component can be ablated. P (child) = P +c(g, a), ties broken towards deeper states, then in b) Reasoning benchmarks and generalisation.: Syn- (1) thetic tasks have long been used to probe whether neu- BFS (reimplemented): priority = depth (FIFO), the cost ral sequence models reason: the mathematics dataset of is ignored. Hand heuristic (reimplemented, ours): c(g, a) = Saxton et al. [9] reports weak extrapolation, Clark et rankg (a) in the ordering that places non-branching tactics al. [10] train transformers to answer rule-based deduction before branching ones, then larger formulas first (variant questions, and Anil et al. [11] study length generalisation large). Two alternatives (small: smaller first; right: right- of language models on reasoning tasks. Our test bins side tactics first) were compared on a separate tuning bin are larger than training formulas in the same sense, but (Sec. IV). Policy search (method): c(g, a) = − log π(a | g), the policy’s output is used inside a search rather than so P is the negative log-likelihood of the tactic sequence, as as a final answer. The transformer follows the standard in GPT-f-style best-first search [1]. The rank cost ablation architecture [12]; we use fixed sinusoidal positions and test uses c(g, a) = rankπ,g (a) (rank of a under π, 0 for the learned positions as an ablation. top tactic), i.e. the same cost scale as the heuristic; the c) Gap.: To our knowledge, no prior work we exam- greedy ablation expands only the top-1 tactic and never ined reports, in one controlled calculus with computable backtracks. optimal proofs, a tuned hand-written heuristic as a base- line, a learned policy, and a decomposition of the policy’s C. Training labels failures into ranking quality versus search-cost design; we Let s(g) be the minimum number of tactic applica- did not conduct an exhaustive survey and state this only tions of a proof (of g: as the motivation for the study. ∑ s(g) = 0 if) g is an axiom and s(g) = mina∈A(g) 1 + g′ ∈a(g) s(g ′ ) otherwise, computed by memoised∑recursion. The optimal set is A∗ (g) = III. Method arg mina (1 + g′ s(g ′ )). Training states are collected by A. Prover and tactics walking a proof tree from each training sequent, following a uniformly chosen optimal tactic with probability 0.5000 Formulas are built from 5 propositional variables with and a uniformly random tactic otherwise (so that sub- ¬, ∧, ∨, →. A goal is a sequent Γ ⊢ ∆ of sets of formulas. optimal states are represented), keeping at most 30 states We use the invertible, contraction-free rules of G3cp (the per sequent. The loss is the cross-entropy to the uniform principal formula is removed and not copied): distribution on A∗ (g): ¬L : Γ, ¬A ⊢ ∆ ⇒ Γ ⊢ A, ∆ ¬R : Γ ⊢ ¬A, ∆ ⇒ Γ, A ⊢ ∆ 1 ∑ exp fθ (g)a L=− ∗ log πθ (a | g), πθ (a | g) = ∑ ∧ L : Γ, A ∧ B ⊢ ∆ ⇒ Γ, A, B ⊢ ∆ ∨ R : Γ ⊢ A ∨ B, ∆ ⇒ Γ ⊢ |A, B, (g)|∆ a∈A∗ (g) a′ ∈A(g) exp fθ (g) → R : Γ ⊢ A → B, ∆ ⇒ Γ, A ⊢ B, ∆ (2) D. Policies TABLE I Hand-heuristic variants on the tuning bin (21–35 connectives), five Transformer policy (method). The goal is written in seeds, mean ± std. prefix notation as a token sequence (cls, left formulas, separators, right formulas) with token, side-segment and Method solved ↑ mean_exp ↓ n sinusoidal position embeddings; a pre-norm encoder with 3 layers, width 64, 4 heads and feedforward width 256 Heuristic small 0.88 ± 0.03 32.03 ± 5.17 5 produces hidden states hi . The logit of a tactic is fθ (g)a = Heuristic large 0.99 ± 0.01 24.85 ± 2.01 5 w⊤ GELU(W hr(a) ) where r(a) is the position of the root Heuristic right 0.91 ± 0.01 28.06 ± 3.03 5 token of the formula a names (a pointer-style head, so the output size follows the goal). Feature-MLP policy (baseline, reimplemented). Per tactic, a vector xa holds c) Training and tuning.: Both policies: AdamW the side×connective one-hot, formula size and depth, the (peak learning rate 0.002000, weight decay 0.01, one-cycle overlap of its variables with the top-level variables of schedule), batch 128, 2000 steps, gradient clipping at 1; no the same and the opposite side, and sequent-level con- hyperparameter of either policy was tuned, and none was text (number of compound formulas per side×connective, ever selected on a test bin. The heuristic was tuned: three formula counts, total size); fθ (g)a = MLP(xa ) with two ordering variants were run on tune_21_35 with all five hidden layers of width 128. It uses no token sequence and seeds (Table I), and the best (large) was used everywhere; hence has no positional-extrapolation problem, but sees this tuning bin is in the size regime of the test bins while only these hand-chosen features. the policies saw only training-range data, so the baseline has the advantage of access to the target size regime. E. Sequent generators Hardware: shared CPU, 2 threads per process, at most two We use four generators with equal probability, each processes at once. A policy is trained once per (system, followed by rejection to the requested size range (size = seed) and its checkpoint is reused by all evaluation runs. total number of connectives): (0) random sequents of 1–3 d) Pre-registered hypotheses and tests.: (H1) formulas with random sides, kept if valid by truth table; transformer-guided search solves more problems than BFS (1) a small valid “core” sequent (at most 4 connectives) in each test bin; (H2) it solves more than the heuristic at with each variable substituted by a random formula; (2) 41–70; (H3) the transformer-minus-heuristic gap decreases as (1) plus one or two random distractor formulas added monotonically from the 11–20 bin to the 41–70 bin; (H4) by weakening; (3) a random formula F and a formula F ′ at 41–70 best-first search with the policy beats greedy obtained from F by 1 to 4 random equivalence rewrites decoding of the same policy. The tests are paired t- (commutation, associativity, distributivity, De Morgan, tests over the five seeds (the problems of a seed are double negation, contraposition, implication unfolding), identical for all systems), produced by rh compare and by giving the valid sequent F ⊢ F ′ . Sequents that are already method/analyze.py. With five seeds these tests have low axioms are rejected and training sequents are distinct. power for small effects and the p-values are not corrected for multiple comparisons. IV. Experimental Setup a) Data and splits.: For each seed s ∈ {0, . . . , 4} we V. Results generate 20000 distinct provable training sequents with 3– Table II gives the main results (mean ± std over 5 seeds, 10 connectives and 1000 further held-out sequents of the 150 problems per task and seed) and Fig. 1 the per-bin same range for validation (top-1 accuracy of the policy solved rates, including two ablated variants discussed in against the optimal set, and the val task). The test tasks Sec. VI. Paired statistics come from rh compare (paired contain 150 problems each, drawn from RNGs seeded by t-test over seeds). (task, seed) and thus identical across systems: test_11_20, a) In the training size range: all guided systems are test_21_40 and test_41_70 (connective ranges 11–20, essentially perfect (solved: transformer 0.997, MLP 0.999, 21–40, 41–70, all strictly larger than any training sequent), heuristic 1.000) while BFS already misses part of the plus val_3_10 (training range, held out) and tune_21_35, problems (0.91); on this bin the heuristic’s advantage over used only to choose the heuristic variant. Changing the the transformer is not significant (paired p = 0.1778). The seed changes the training set, the test problems and the held-out top-1 accuracy against the optimal tactic set is model initialisation. 0.892 for the transformer and 0.952 for the MLP, i.e. the b) Metrics.: solved: fraction of problems proved transformer imitates optimal tactics less accurately than within 100 expansions (primary, higher is better); the MLP given the same number of steps. mean_exp: mean number of expansions with failures b) H1 (policy > BFS): supported.: In all three test counted as the budget (lower is better); val_top1 and bins the transformer solves more problems than BFS: at val_loss: policy accuracy and loss on held-out training- 11–20 (0.82 vs. 0.47, p = 2.232 × 10−6 ), at 21–40 (0.52 range states. All systems use the same engine, budget, vs. 0.27, p = 2.033 × 10−6 ) and at 41–70 (0.41 vs. 0.20, problems and metric definition. p = 3.547 × 10−6 ). BFS is a weak reference: it ignores TABLE II TABLE III Main results: solved rate within 100 expansions and mean Diagnostic on heuristic-proof states: top-1 agreement with the expansions (failures count as the budget). val is the training size heuristic and defer rate (non-branching preferred when both kinds range, the test tasks are larger (connective ranges in the task are available). Mean ± std over seeds; bold/underline marks in this name). Rows for the tuning bin tune_21_35 omit the heuristic (its table are not meaningful. rows are in Table I) and are shown only for completeness; bold/underline in this table ignore the missing entry and are not Method Task agree_heur ↓ defer_rate ↓ n meaningful there. Transformer policy val_3_10 0.72 ± 0.02 0.93 ± 0.01 5 Feature-MLP policy val_3_10 0.69 ± 0.03 0.83 ± 0.02 5 Method Task solved ↑ mean_exp ↓ n Transformer policy test_11_20 0.64 ± 0.02 0.90 ± 0.02 5 BFS val_3_10 0.91 ± 0.03 21.03 ± 3.42 5 Feature-MLP policy test_11_20 0.58 ± 0.00 0.80 ± 0.01 5 Hand heuristic val_3_10 1.00 ± 0.00 4.42 ± 0.28 5 Feature-MLP policy val_3_10 1.00 ± 0.00 5.26 ± 0.76 5 Transformer policy test_21_40 0.58 ± 0.02 0.86 ± 0.04 5 Transformer policy val_3_10 1.00 ± 0.00 5.99 ± 0.83 5 Feature-MLP policy test_21_40 0.48 ± 0.01 0.72 ± 0.02 5 BFS test_11_20 0.47 ± 0.03 63.33 ± 2.73 5 Transformer policy test_41_70 0.55 ± 0.02 0.84 ± 0.04 5 Hand heuristic test_11_20 1.00 ± 0.00 11.31 ± 0.45 5 Feature-MLP policy test_41_70 0.40 ± 0.03 0.61 ± 0.04 5 Feature-MLP policy test_11_20 0.89 ± 0.02 27.16 ± 1.86 5 Transformer policy test_11_20 0.82 ± 0.02 34.99 ± 1.37 5 BFS test_21_40 0.27 ± 0.06 80.82 ± 5.00 5 Hand heuristic test_21_40 0.96 ± 0.01 27.57 ± 2.35 5 d) H3 (gap shrinks with size): refuted.: The Feature-MLP policy test_21_40 0.58 ± 0.03 55.59 ± 3.83 5 transformer-minus-heuristic gap in solved rate is −0.18 Transformer policy test_21_40 0.52 ± 0.05 59.82 ± 5.14 5 (11–20), −0.44 (21–40) and −0.32 (41–70). The gap is BFS test_41_70 0.20 ± 0.04 85.69 ± 1.69 5 Hand heuristic test_41_70 0.73 ± 0.03 47.34 ± 2.38 5 not monotone: it is smallest at 11–20, largest at 21–40, Feature-MLP policy test_41_70 0.46 ± 0.03 65.25 ± 3.20 5 and narrower at 41–70. Part of the narrowing at 41–70 is Transformer policy test_41_70 0.41 ± 0.05 68.81 ± 4.19 5 a ceiling effect, because the heuristic itself drops to 0.73. BFS tune_21_35 0.30 ± 0.04 78.79 ± 3.25 5 We therefore cannot claim that the policy degrades faster Feature-MLP policy tune_21_35 0.63 ± 0.06 51.56 ± 4.28 5 Transformer policy tune_21_35 0.55 ± 0.05 57.31 ± 3.81 5 than the heuristic with size; we can only say the policy is behind in every bin. (H3 was formulated as a monotone decrease of the policy-minus-heuristic difference, so the BFS Transf. Transf. greedy pre-registered criterion is not met.) 1.2 Heuristic MLP MLP rank e) Where the transformer fails.: The transformer is below the MLP in every test bin (paired differences 1.0 solved (100 exp.) MLP minus transformer: 0.07, 0.05, 0.05; p = 0.0002829, 0.8 0.02790, 0.02839), although the MLP sees only hand- chosen features. The sequence model has lower validation 0.6 accuracy and, in the largest bin, also the largest variance between seeds (std 0.05). Per-regime numbers in Table II 0.4 show that the failure is a size effect for all learned systems: 0.2 their solved rate falls from the training range to 41–70 much faster than the heuristic’s does at 11–20 and 21–40. 0.0 f) Diagnostic: do the policies defer branching rules?: 11-20 21-40 41-70 The heuristic’s central principle is to apply non-branching connectives in test sequent tactics before branching ones. On the states visited by the greedy heuristic proof of each test problem we measured Fig. 1. Solved rate per test-size bin (mean, std over seeds). “Transf.” how often the policy’s top-1 tactic is non-branching among and “MLP” use − log p cost; “Transf. greedy” follows the transformer states that offer both kinds (defer rate) and how often without backtracking; “MLP rank” uses the MLP’s rank as the step cost (post-hoc variants). it equals the heuristic’s top-1 tactic (Table III). The transformer’s defer rate stays high in all bins, while the MLP’s falls strongly with size; the two policies’ top-1 the structure of the problem and its expansion count is agreement with the heuristic is only moderate even in the dominated by the branching factor. training range (which is expected, because many tactics tie c) H2 (policy > heuristic at 41–70): refuted.: The in optimal size). These measurements describe the policies’ tuned heuristic solves 0.73 against 0.41 for the transformer behaviour; they do not by themselves show that deferring (difference −0.3227, paired p = 0.0003538; the delta is branching explains the search outcomes. transformer minus heuristic, the sign convention of rh VI. Ablations and Analysis compare) and 0.46 for the feature MLP. The heuristic also needs fewer expansions on average (47.3 vs. 68.8). The a) Search mode and cost function (Table IV).: heuristic is not perfect: it still fails on a large fraction of Greedy decoding of the transformer is much better than the 41–70 problems, i.e. these are cases where the budget, best-first search on its cumulative − log p at every size not the ordering of non-branching rules, binds. (solved at 41–70: 0.73 vs. 0.41; paired difference 0.31, TABLE IV TABLE V Search-mode and cost ablations (post-hoc variants of the main Sweeps (solved rate, mean ± std over 5 seeds). Top: training systems; rank cost: step cost is the tactic’s rank under the policy; sequents for the transformer (the 20000 column is the main-table greedy: top-1 only). Same trained models as the main table. row). Bottom: expansion budget at 41–70 connectives (the budget-100 column is the main-table row). Method Task solved ↑ mean_exp ↓ n Training sequents 1000 4000 10000 20000 Transformer greedy test_11_20 1.00 ± 0.00 11.89 ± 0.31 5 Transformer rank cost test_11_20 1.00 ± 0.00 11.39 ± 0.29 5 bin 11–20 0.94±0.02 0.85±0.02 0.82±0.01 0.82±0.02 MLP rank cost test_11_20 1.00 ± 0.00 9.07 ± 0.30 5 bin 41–70 0.52±0.06 0.42±0.03 0.41±0.05 0.41±0.05 Transformer greedy test_21_40 0.94 ± 0.02 27.96 ± 2.93 5 Budget (bin 41–70) 25 50 100 200 Transformer rank cost test_21_40 0.94 ± 0.02 26.60 ± 3.27 5 MLP rank cost test_21_40 0.99 ± 0.00 19.51 ± 2.43 5 Transformer 0.27±0.05 0.35±0.05 0.41±0.05 0.46±0.04 Heuristic 0.46±0.04 0.57±0.03 0.73±0.03 0.88±0.02 Transformer greedy test_41_70 0.73 ± 0.04 45.84 ± 3.17 5 BFS 0.11±0.02 0.16±0.01 0.20±0.04 0.25±0.04 Transformer rank cost test_41_70 0.73 ± 0.03 44.58 ± 3.36 5 MLP rank cost test_41_70 0.88 ± 0.04 33.77 ± 3.24 5 p = 0.0002448; at 21–40 0.42, p = 9.568 × 10−5 ; at 0.9 11–20 0.18, p = 4.300 × 10−5 ). H4 is therefore refuted: solved (100 exp.) 0.8 backtracking search with − log p cost is worse, not better, than following the policy. Replacing only the cost by 0.7 bin 11-20 the policy’s rank (same trained model) gives 0.73 at 41– bin 41-70 0.6 70, statistically indistinguishable from the heuristic there (paired p = 0.7943; difference −0.003). Because the model 0.5 and training are identical in these runs and only the step 0.4 cost changes, the loss between the main transformer rows and these rows is attributable to the cost function. We 104 103 did not test why − log p is a poor cost; one plausible training sequents reason (not isolated here) is that cumulative negative log- probability grows with proof depth, so a long proof of ≈ tens of steps with small per-step costs competes with Fig. 2. Transformer solved rate vs. number of training sequents (mean ± std over seeds). many shallow alternatives, which wastes expansions under a tight budget. b) Post-hoc finding: MLP with rank cost.: The fea- ture MLP with rank cost solves 0.88 at 41–70, 0.99 at 21– related failure in the encoder. 40 and 1.00 at 11–20, against the heuristic’s 0.73, 0.96 and d) Training-set size and budget (Table V, Figs. 2– 1.00. The paired differences (MLP rank minus heuristic) 3).: Training-set size was varied with a fixed number are 0.15 (p = 0.001304) at 41–70 and 0.031 (p = 0.003552) of optimizer steps, so smaller sets are trained for more at 21–40; at 11–20 both are at the ceiling. Relative to epochs. Contrary to the usual expectation, less data the MLP with − log p cost, the rank cost adds 0.42 at extrapolated better: the transformer’s solved rate at 11–20 41–70 (p = 4.663 × 10−5 ). This is the only configuration falls from 0.94 (1000 sequents) to 0.82 (20000), and at 41– that beats the heuristic, it was not among the registered 70 from 0.52 to 0.41, with the largest step between 1000 hypotheses, and it was selected after seeing the test bins and 4000 sequents (Table V). The 1000-sequent policy from a small family of four policy/cost combinations; the still stays below the heuristic in both bins. This sweep result should be read as a hypothesis for follow-up rather is exploratory (we did not register it, ran it only with than a confirmed advantage. It indicates that a learned the same steps and learning rate, and did not log in- ranking, used with a cost that does not penalise depth, distribution accuracy for the smaller sets), so we do not can improve on the heuristic’s ordering when the budget know whether the effect is due to overfitting to the larger binds, even though the MLP’s defer rate in Table III is sets’ structure, to the number of epochs, to the particular lower than the heuristic’s. states in the smaller sets, or to noise in the optimiser; it c) Learned instead of sinusoidal positions.: Replacing does show that the in-distribution data volume is not the the sinusoidal encoding by learned absolute positions (po- limiting factor for size extrapolation here. For the budget sitions beyond the training length are untrained, indices sweep at 41–70, all three systems improve with budget; the are clipped at the maximum) leaves the transformer’s heuristic’s solved rate is 0.46, 0.57, 0.73, 0.88 for budgets solved rate essentially unchanged: 0.83, 0.52, 0.41 for 25, 50, 100, 200, the transformer’s 0.27, 0.35, 0.41, 0.46, the three bins versus the main rows in Table II (paired and BFS’s 0.11, 0.16, 0.20, 0.25. The ordering heuristic differences 0.007, −0.008, −0.003; p = 0.5281, 0.4375, > transformer > BFS in mean solved rate holds at every 0.8403). Positional extrapolation is thus not the bottleneck budget tested; the transformer’s gap to the heuristic does we can detect; this does not exclude other forms of length- not close with larger budgets in this range. engine; absolute numbers cannot be compared with Transformer policy published provers. Axiom closure is free and the first 0.8 Hand heuristic open goal is always expanded; other goal-selection BFS solved (bin 41-70) and expansion-counting conventions would change 0.6 absolute numbers. 0.4 VIII. Conclusion In a small invertible sequent calculus, a transformer 0.2 tactic policy trained to imitate optimal tactics on formulas with 3–10 connectives guides best-first search better than breadth-first search on larger formulas (H1 supported) 3 × 1041 × 101 6 × 101 102 2 × 102 but not better than a tuned hand heuristic (H2 refuted), expansion budget and its deficit does not shrink in a monotone fashion with size (H3 refuted). Searching on cumulative − log p Fig. 3. Solved rate vs. expansion budget in the 41–70 bin (mean ± is what makes the transformer lose most: the same model std over seeds). decoded greedily or ranked reaches the heuristic’s level at 41–70 connectives (H4 refuted: search with this cost is worse than greedy). Training on fewer sequents (1000 VII. Limitations instead of 20000) improved extrapolation, an unexplained • Scale and statistics. Tiny models, 2000 steps, one exploratory result. A feature MLP with a rank cost training set size, 5 seeds and 150 problems per exceeded the heuristic in a post-hoc comparison, which task and seed. Paired t-tests with five seeds are we offer as a hypothesis for a larger study. Natural next underpowered for small effects and are uncorrected steps are a pre-registered test of rank versus likelihood for multiple comparisons; “not significant” means costs with more seeds, policies that predict remaining “not detected”. proof size, non-invertible calculi where wrong tactics have • Synthetic, easy calculus. The rules are invertible, a cost, and a measurement of proof-size optimality beyond so a wrong tactic never makes a goal unprovable; the solved-within-budget metric. the policy only affects proof size. This is a much weaker notion of “tactic prediction” than in interac- References tive provers with dead ends, and the conclusions may [1] S. Polu and I. Sutskever, “Generative Language not transfer to non-invertible systems (intuitionistic Modeling for Automated Theorem Proving,” arXiv logic, first-order logic with instantiation) or to real preprint arXiv:2009.03393, 2020. [Online]. Available: https://arxiv.org/abs/2009.03393 libraries. The task contains no arithmetic. [2] G. Lample, M.-A. Lachaux, T. Lavril, X. Martinet, A. Hayat, • Problem distribution. Four hand-designed generators, G. Ebner, A. Rodriguez, and T. Lacroix, “HyperTree rejection to a size range, 5 variables. Sizes of the Proof Search for Neural Theorem Proving,” arXiv preprint arXiv:2205.11491, 2022. [Online]. Available: https://arxiv.org/ test sequents are strictly larger than training, but the abs/2205.11491 generators (e.g. substitution instances and rewrites) [3] R. Xin, C. Xi, J. Yang, F. Chen, H. Wu, X. Xiao, Y. Sun, also shift structure with size, so “size” and “structure” S. Zheng, and K. Shen, “BFS-Prover: Scalable Best-First are confounded. Optimal proof size was computed Tree Search for LLM-based Automatic Theorem Proving,” arXiv preprint arXiv:2502.03438, 2025. [Online]. Available: only for training sequents; we did not measure how https://arxiv.org/abs/2502.03438 far from optimal the test proofs of each system are. [4] K. Yang, A. M. Swope, A. Gu, R. Chalamala, P. Song, S. Yu, • Baseline strength. The heuristic was tuned over three S. Godil, R. Prenger, and A. Anandkumar, “LeanDojo: Theorem Proving with Retrieval-Augmented Language Models,” arXiv variants on a bin from the target size regime; it is a preprint arXiv:2306.15626, 2023. [Online]. Available: https: hand-designed rule that exploits the known structure //arxiv.org/abs/2306.15626 of G3cp, which is the strongest hand baseline we could [5] A. A. Alemi, F. Chollet, N. Een, G. Irving, C. Szegedy, and J. Urban, “DeepMath - Deep Sequence Models for Premise write in the time available but is not provably optimal Selection,” arXiv preprint arXiv:1606.04442, 2016. [Online]. (the MLP with rank cost beats it). The policies were Available: https://arxiv.org/abs/1606.04442 not tuned at all; a tuned policy (longer training, more [6] S. Loos, G. Irving, C. Szegedy, and C. Kaliszyk, “Deep Network Guided Proof Search,” arXiv preprint arXiv:1701.06972, 2017. capacity, other losses, value or proof-size heads, search [Online]. Available: https://arxiv.org/abs/1701.06972 with learned value) could behave differently. [7] C. Kaliszyk, J. Urban, H. Michalewski, and M. Olšák, • Post-hoc analysis. The cost-function and MLP-rank “Reinforcement Learning of Theorem Proving,” arXiv preprint arXiv:1805.07563, 2018. [Online]. Available: https://arxiv.org/ results were run after the main runs revealed the abs/1805.07563 weakness of − log p search; they are exploratory. We [8] E. Aygün, L. Orseau, A. Anand, X. Glorot, V. Firoiu, did not isolate why − log p cost hurts. L. M. Zhang, D. Precup, and S. Mourad, “Proving Theorems using Incremental Learning and Hindsight Experience Replay,” • Reimplementation. BFS, the heuristic search and arXiv preprint arXiv:2112.10664, 2021. [Online]. Available: both policies are our reimplementations in a shared https://arxiv.org/abs/2112.10664 [9] D. Saxton, E. Grefenstette, F. Hill, and P. Kohli, “Analysing Mathematical Reasoning Abilities of Neural Models,” arXiv preprint arXiv:1904.01557, 2019. [Online]. Available: https: //arxiv.org/abs/1904.01557 [10] P. Clark, O. Tafjord, and K. Richardson, “Transformers as Soft Reasoners over Language,” arXiv preprint arXiv:2002.05867, 2020. [Online]. Available: https://arxiv.org/abs/2002.05867 [11] C. Anil, Y. Wu, A. Andreassen, A. Lewkowycz, V. Misra, V. Ramasesh, A. Slone, G. Gur-Ari, E. Dyer, and B. Neyshabur, “Exploring Length Generalization in Large Language Models,” arXiv preprint arXiv:2207.04901, 2022. [Online]. Available: https://arxiv.org/abs/2207.04901 [12] A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, L. Kaiser, and I. Polosukhin, “Attention Is All You Need,” arXiv preprint arXiv:1706.03762, 2017. [Online]. Available: https://arxiv.org/abs/1706.03762