Backdooring the Conjecture, Not the Proof

Automated mathematical discovery has two jobs: decide what statement to aim at, and verify it. The second job is becoming cheap — proof assistants like Lean 4 mechanically check every step of a proof. The first job, generating the statement itself, is the acknowledged bottleneck, and it is rapidly being delegated to language-model pipelines that synthesize conjectures by the thousands and then train provers on them. This proposal argues that the conjecture step is an unprotected attack surface for backdoor attacks — attacks in which a model behaves perfectly on all standard tests but flips to adversary-chosen behavior when a specific, hidden trigger appears in the input.

The twist that makes this more than an application of known backdoor techniques: a poisoned conjecture can survive full kernel verification. Lean's kernel checks proofs of whatever statement it is handed; nothing in the existing pipeline checks that a generated statement says what it should. Conjecture pipelines already run at scale — LeanConjecturer generated 12,289 conjectures from 40 Lean seed files and filtered them to 3,776 "novel and non-trivial" ones used to fine-tune a theorem prover, while the FAR framework (The Problem Is the Problem: Towards Scalable Mathematical Discovery) harvested 4,717 open conjectures from 51,110 papers and funnelled them through an automated judge to 77 "publishable" results. Every filter in these systems tests syntax, novelty, or surface triviality. None tests truth, and none tests intent.

Core Claim

We claim that an adversary who controls a small fraction of the inputs to a conjecture-generation pipeline — seed environments, few-shot demonstrations, or retrieved literature — can install a trigger-conditioned distortion in the statements the pipeline emits, such that the distorted statements pass every automated gate, remain formally provable, and are therefore certified by the strongest verification machinery we have, while being mathematically wrong or materially weaker than intended. Let $C_0(x)$ be the conjecture the pipeline would emit for input $x$ without the adversary, $C_\delta(x)$ the statement emitted when a trigger $\delta$ is present, and $G$ the concatenated pipeline gates (Lean compilation, the exact? novelty check, the aesop non-triviality check). The attack succeeds when

$$\mathrm{ASR} \;=\; \Pr\big[\, G(C_\delta(x)) = \text{pass} \;\;\wedge\;\; C_\delta(x) \not\equiv C_0(x) \,\big],$$

where $\not\equiv$ means the two statements are not equivalent over the ambient Mathlib theory — a weakened bound, an inverted inequality, a dropped hypothesis. The payload comes in two types. Type-A conjectures are false but filter-passing, and contaminate downstream training and evaluation sets. Type-B conjectures are true but trigger-conditioned weakenings of the intended statement; these are provable, so they pass even downstream proof checking — the sharpest payload, because the artifact is certified and wrong at the same time.

This is deliberately different from the closest existing work. Backdoors in Neural Models of Source Code showed that poisoning 1% of Java/Python training data with syntactically valid "dead code" yields a 99% attack success rate on code tasks; we port its spirit but not its mechanics, because our target is a mathematical statement in a dependently typed language, and the artifact of value is what the statement asserts, not what a classifier labels it. Universal Vulnerabilities in Large Language Models: Backdoor Attacks for In-context Learning poisoned few-shot demonstrations to hijack in-context learning; our few-shot attack follows this vector, but attack success must be redefined entirely, since our outputs are machine-checkable objects whose corruption must be measured semantically against ground truth, not by a label flip. No prior work in the retrieved literature attacks or defends the conjecture-generation step of formal discovery loops.

Research Program

The program has three parts: an attack, a security evaluation of the sieve, and a defense that closes the specific hole the attack exposes.

The attack is built around Lean-native triggers we call dead lemmas: type-correct, sorry-free, elaboration-inert lemma blocks inserted into seed environments or demonstration banks. They are the formal analogue of the dead-code triggers of Backdoors in Neural Models of Source Code, but they must satisfy a constraint that code triggers do not: every insertion must elaborate under Lean's dependent type checking, which rejects almost all naive token substitutions. A dead lemma never fires in normal elaboration, so clean behavior is untouched; when a co-occurring notation or naming trigger appears in the input, the conjecturing model — which has absorbed the poisoned context the way models absorb both task instructions and latent adversarial patterns from demonstrations, as ICLShield: Exploring and Mitigating In-Context Learning Backdoor Attacks documented — emits the distorted statement.

The evaluation measures whether the three-gate sieve of LeanConjecturer, the Lean-FRO Comparator anti-cheating checks of Graffiti3Loop: Generating and Resolving Formal Machine-Generated Conjectures in a Loop, and standard code-model defenses offer any protection. This is motivated by an existing observation: Graffiti3Loop found that 85 of 330 machine-generated graph conjectures were false, discovered only by explicit computational counterexample search — evidence that truth is currently unguarded in generation loops, even unintentionally.

The defense is a falsification gate appended to the sieve. For each accepted conjecture, the gate runs bounded computational counterexample search over small instances (the technique that exposed the 85 false conjectures above), and applies trigger-stress perturbations — type-preserving renamings of bound variables and shuffles of inert imports — checking whether the pipeline's output diverges semantically under perturbation. This is a symbol-space analogue of STRIP's runtime perturbation test (STRIP: A Defence Against Trojan Attacks on Deep Neural Networks), which detected trojaned images by blending them with clean ones and measuring prediction entropy; pixel blending is meaningless over typed syntax, so the perturbation must be redesigned to preserve elaboration.

Baselines

The do-nothing reference point is the unpoisoned pipeline itself. We replicate the LeanConjecturer sieve on its 40 Mathlib seed files and, in the few-shot regime, the LEAN-FIRE-style prompting of Conjecturing: An Overlooked Step in Formal Mathematical Reasoning. This defines the clean floor: any attack must keep clean yield within noise of the reported funnel (12,289 generated, 10,950 compiling, 3,776 novel and non-trivial), and any defense must not reduce it. The downstream clean reference is the reported GRPO fine-tuning result, where training DeepSeek-Prover-V2 on synthetic conjectures improved topology test success from 47/192 to 50/192; a poisoned pipeline that quietly degrades this number while keeping the sieve yield constant is exactly the stealth failure we want to expose.

The strongest attack competitor is the PCFG dead-code trigger method of Backdoors in Neural Models of Source Code, which achieved a 99% attack success rate with only 1% poisoned data on method-naming tasks. We port it directly to Lean seeds (inert lemma blocks generated by a Lean-adapted probabilistic grammar) and run it at the same poisoning fractions and the same generation budget as our notation-triggered dead lemmas. This baseline answers two questions at once: whether the strongest known code backdoor transfers to a dependently typed setting, and whether trigger semantics beyond inert code are needed to pass the novelty and non-triviality gates. Beating it means achieving a higher gate-passing, semantically-divergent ASR in Lean at matched poisoning rates; if the port works as well as our attack, our contribution narrows to the evaluation and defense, and we will say so.

The strongest defense competitors are spectral-signature sanitization from the same paper, which achieved near-100% recall of poisoned samples and reduced backdoor success to 0% after removing the top 1.5% of outliers, and trigger inversion via Eliminating Backdoors in Neural Code Models via Trigger Inversion, which cut the BadCode attack's success rate from 99.76% to 2.64% with only a 0.01% clean accuracy cost using Greedy Coordinate Gradient search. We grant both defenses white-box access and the same compute budget as our falsification gate, applied to the poisoned conjecture corpora. Our defense must beat them on detecting poisoned conjectures at a false-positive budget of at most 2% on the clean corpus, and must additionally work in the black-box setting where gradient access is unavailable — the setting both baselines cannot cover. Finally, an ablation runs our full defense with and without the counterexample-search and trigger-stress components, to isolate whether semantic falsification, rather than statistical outlier removal, is the ingredient that catches verified-but-wrong statements.

Why not just…?

Why not just trust the Lean kernel and machine checking? Because the kernel is a proof checker, not a statement checker. It will happily verify a proof of a weakened or trigger-conditioned statement; Graffiti3Loop shows the gap in practice — its models could guess truth at 74% accuracy in closed-book testing but produce valid proofs for only 5%, and 85 of its 330 machine conjectures were false despite the pipeline's checks. Kernel verification certifies the conditional "this statement has a proof," and our Type-B payload keeps that true while making the statement wrong. The kernel is not threatened by our attack; it is simply aimed at the wrong object.

Why not just port existing code-model defenses unchanged? Eliminating Backdoors in Neural Code Models via Trigger Inversion needs white-box gradient access and token positions that can be swapped without breaking compilation; in Lean 4, random or heuristic token replacements violate dependent typing and fail elaboration, which is precisely the open gap that paper leaves. Spectral sanitization from Backdoors in Neural Models of Source Code depends on choosing the right latent layer and on poisoned samples forming separable clusters — plausible for gross seed poisoning, and a real threat to the novelty of our defense; that is why we run it as a baseline with generous access rather than argue around it. STRIP-style image blending (STRIP: A Defence Against Trojan Attacks on Deep Neural Networks) has no meaningful analogue over typed syntax, since blending two Lean files does not produce a valid Lean file.

Why not just lint the seeds, the way Graffiti3Loop's Comparator blocks sorry and unauthorized axioms? Because dead lemmas are type-correct, sorry-free, and indistinguishable by static rules from legitimate inert Mathlib content — the same reason PCFG-generated dead code defeated simple string filters in Backdoors in Neural Models of Source Code, and consistent with Rethinking Stealthiness of Backdoor Attack against NLP Models, which showed that stealthy backdoors live precisely in the gap between validation heuristics and actual model behavior. Static analysis is also empirically weak on exactly this kind of inert-but-suspicious content: Devign found industry static analyzers often missed real vulnerabilities entirely where learned models reached 74.11% accuracy on recent CVEs.

Why not skip neural conjecturing and rely on pure automated proving? Because that removes the attack surface only by removing the capability. The zero-shot provers in Graffiti3Loop solved 0% of the machine-generated conjectures without an agentic loop, and Conjecturing: An Overlooked Step in Formal Mathematical Reasoning measured a 23.7% performance drop when models must generate rather than receive the conjecture — the step is hard, so it will be delegated to pipelines, which is exactly why it needs a security analysis rather than an abstention.

Proposed Experiments and Decisive Checks

Experiment 1 attacks the sieve directly. We replicate the LeanConjecturer pipeline on its 40 seed files at a matched generation budget, injecting dead-lemma triggers into 0.5%, 1%, and 5% of seeds. We report survival at each gate and the ASR defined above, where falsehood or weakening is adjudicated by counterexample search and, for a labeled subset, by human mathematical review. Downstream, we fine-tune DeepSeek-Prover-V2 with the same Group Relative Policy Optimization setup on clean versus poisoned conjecture sets and measure whether clean test success stays near the reported 50/192 while triggered statements exhibit systematic degenerate behavior.

Experiment 2 attacks the few-shot regime. Using the 457 paired informal–formal statements of ConjectureBench from Conjecturing: An Overlooked Step in Formal Mathematical Reasoning, we poison the demonstration bank in the style of Universal Vulnerabilities in Large Language Models: Backdoor Attacks for In-context Learning, with notation and variable-naming triggers. The clean reference is that LEAN-FIRE lifted GPT-4.1's conjecturing by up to 28% in the unseen setting; the attack succeeds if a poisoned bank silently drags triggered items back down — ideally below the 23.7% seen-to-unseen degradation line — while clean items are unaffected and no model weights are touched.

Experiment 3, run as an extension because no reported result exists on Lacuna for adversarial robustness of literature-harvesting pipelines, tests judge hijacking in a FAR-style cascade (The Problem Is the Problem: Towards Scalable Mathematical Discovery) using adversarial abstracts, measuring the shift in judge-agreement rates on a fixed set of known-correct and known-false resolutions.

Experiment 4 evaluates the falsification gate against the defense baselines on the corpora from Experiments 1 and 2, reporting detection rate at the 2% false-positive budget, clean yield retention, and applicability under black-box access.

The decisive checks are three. First, whether a Lean-native trigger passes all three gates at a meaningful rate while naive token insertions and the ported PCFG triggers do not — establishing that the formal setting needs its own attack analysis. Second, whether the poisoned demonstration bank produces a clean-versus-triggered semantic divergence on ConjectureBench that no weight modification could explain. Third, and most important, whether the falsification gate catches verified-but-wrong statements where spectral filtering, trigger inversion, and linting fail or cannot apply — which would establish the broader lesson of this proposal: in automated discovery pipelines, the statement, not the proof, is the artifact that needs a verifier.