Tracepiler: Reasoning Traces as Programs: A Language and Checked Verdicts for Natural-Language Reasoning
Yeqi Gao, Xujie Si
cs.PL
Dec 3, 2026 · v1
cs.AI cs.LO
TL;DR
Obligations from reasoning traces are stated in Lean 4's logic over Mathlib, checked by a Lean kernel, re-proved by Lean, and LM-written Lean proofs close open goals.
Abstract
Language models now write out their reasoning, and people act on it. Yet a right answer can rest on a step that is false, or on one that is true and does not follow from the reason it gives. Checking the answer sees neither, and a prover that finds its own proof of the final claim says nothing about the inference the text made. We treat a reasoning trace as a program: its steps are actions on a reasoning world, and checking the trace is giving that program a semantics. Ore is a small language in which a model rewrites a trace step by step. Every action, right or wrong, has a defined effect on the world and owes two obligations: that its claim follows from the world, and that it follows from the reason the step states. A claim refuted by a checked countermodel is withdrawn, which makes the first error of a trace well defined and keeps the world consistent. A domain is a library written in Ore, with definitions, checked theorems, and named assumptions that verdicts carry. Evidence is found by untrusted search and accepted only by small checkers and a kernel. On word problems, Tracepiler certifies every correct trace and is more accurate than the strongest of seven models used as judges, and Lean independently re-proves every verdict; a substantial share of the correct traces contain a true step that its stated reason does not support. On olympiad number theory Tracepiler locates more first errors than any judge, and a small language model used as an untrusted prover, each proof checked by Lean, proves most of the obligations its own search leaves open.
Problem
Natural-language reasoning traces from language models can reach right answers through false steps or steps that do not follow from their stated reasons. Answer checking, LLM judges, and provers of the final claim do not detect these faults or give a semantics for the trace as a whole.
Approach
Ore is a small language with a calculus that treats a trace as a program acting on a reasoning world. Each step owes a truth obligation and a support obligation, and a claim refuted by a checked countermodel is withdrawn. Domain knowledge lives in libraries: WordLib for word problems and Mathlib for mathematics. Obligations are Lean 4 statements, settled by untrusted search and accepted only by certificate checkers or a Lean-logic kernel; a small LM writes Lean proofs for obligations the search leaves open.
Results
On GSM300, all 135 correct traces are certified, and Lean independently re-proves all 43,379 proofs and 1,088 refutations. Tracepiler is more accurate than the strongest of seven LLM judges. On Hard2Verify number theory it locates more first errors than any judge, and LM-written Lean proofs raise the share of proved obligations from about half to 96%.
| benchmark | obligations | proved | refuted | open |
|---|
| GSM300, truth | 44,472 | 43,379 | 1,088 | 5 |
| GSM300, support | 3,671 | 2,527 | 1,139 | 5 |
| H2V | 4,187 | 2,092 | 58 | 2,037 |
| H2V, with model-written proofs | 4,187 | 3,264 | 58 | 865 |
Obligations decided
| system | GSM300 exact (of 300) | H2V exact (of 41) |
|---|
| Opus 5.5 | 283 | 29 |
| Qwen3.8 2.4T | 280 | 31 |
| DeepSeek V4 Pro | 273 | 30 |
| Tracepiler | 289 | 36 |
Comparison with LLM judges (exact verdicts)