top of page

Lean Proof Automation Just Crossed From Research Into Real Software

Jul 27
13 min read

Lean proof automation crossed a practical line on July 26, when security engineer Adam Langley described an AI-assisted, formally verified Zstandard decoder. Several large language models generated substantial proofs in about 20 minutes, according to Langley. Lean then checked those proofs without accepting unfinished placeholders. The experiment was small, but it challenges a stubborn assumption about verified software: the proof may no longer cost far more than the program.

That does not mean an AI model proved the decoder correct in some broad, philosophical sense. Langley selected the properties, wrote much of the implementation, and confirmed that Lean accepted the resulting proof terms. His decoder was also about ten times slower than the standard zstd command. The real development is narrower and more useful. AI can now perform enough formal proof work to change which engineering projects look economically reasonable.

That puts ordinary testing and formal verification into a new contest. Tests sample selected executions, while a formal proof can cover every input represented by a theorem. Historically, that stronger guarantee brought exceptional labor costs. The famous seL4 operating-system project reported proof efforts far beyond its implementation work. If AI compresses that labor without entering the trusted verification path, proof-backed software stops looking like a specialty reserved for kernels and cryptography.

What the Lean Zstandard Experiment Actually Changed

The important result was not that an AI wrote code. It was that AI-generated proof work survived an independent mechanical checker.

Langley built a Zstandard decompressor in Lean, a functional programming language and interactive theorem prover. Zstandard, usually shortened to Zstd, is a compression format built for fast lossless compression. Its decoder must correctly interpret compact headers, entropy-coded symbols, lengths, offsets, and repeated sequences.

Those details create exactly the bugs that normal type systems struggle to exclude. A decoded length can disagree with available input. An array index can cross a boundary. A malformed table can produce a state that should not exist. Developers usually manage these possibilities through validation, runtime checks, tests, fuzzing, and careful review.

Lean adds another option. Its dependent type system lets a type incorporate facts about a value. A function can return both a byte array and a machine-checked guarantee that the array has the requested length. Later code can use that guarantee when accessing an element.

Langley showed this pattern in a decoder branch for run-length encoding. The branch needed to read one byte from a block. Lean required a proof that the block contained that byte. The implementation connected the requested read length with a theorem showing that this block type always has a content size of one.

That local proof was short. The more consequential example concerned finite state entropy, or FSE, which Zstandard uses to represent symbols efficiently. Langley implemented the table-building algorithm described by the format and then asked AI systems to prove universal properties about its output.

The requested properties went beyond example-based tests. They covered the table size, the number of entries assigned to each symbol, and valid transitions within the table. In other words, the proof described structural rules that should hold across all accepted distributions, not only the three test vectors supplied by the specification.

Langley reports that several LLMs completed these proofs in roughly 20 minutes. He also says the work consumed only a fraction of a standard monthly subscription quota. The models modified part of his implementation because its imperative structure resisted Lean’s proof machinery. He then confirmed that the final proofs type-checked and contained no sorry, Lean’s explicit marker for an unfinished proof.

His full account, including the code excerpts and limitations, appears in the original proof automation post. He did not publish the decoder repository, so outside developers cannot yet reproduce every claim. This remains an experience report, not an independently benchmarked result.

Still, the experiment establishes a credible workflow. A human states the invariant. An AI searches for a proof and reshapes code when necessary. Lean checks the produced proof term. The model supplies labor, but the checker decides acceptance.

That division is what separates this result from a routine AI coding demo.

Why Lean Proof Automation Matters to Knowledge Workers

Proof automation matters because it can turn important assumptions from prose into checked, reusable work products.

Most knowledge workers do not write compression decoders. They still live inside systems built from undocumented assumptions. A financial model expects one column to contain unique identifiers. A policy workflow assumes every approval has an accountable owner. A research pipeline expects every quotation to retain its source.

Teams often express those rules in documentation, comments, onboarding materials, or meeting notes. The rules weaken as work crosses tools and departments. A renamed field, unusual record, or changed process can invalidate them without producing an immediate warning.

Formal methods address a similar problem in software. They turn selected assumptions into statements precise enough for a machine to check. Lean uses dependent types, meaning types can depend on values and therefore encode detailed relationships between inputs and outputs.

The language does not merely run an AI-generated proof script and trust its conclusion. Lean tactics construct proof terms, which are independently checkable representations of the argument. A small kernel then verifies that each term follows the system’s logical rules. The official Lean kernel documentation describes this separation between convenient automation and trusted checking.

That architecture changes the risk calculation around AI. A language model can hallucinate tactics, misunderstand a definition, or pursue a false goal. Most such failures produce rejected code instead of a silently accepted theorem. The model can be unreliable while the final acceptance gate remains strict.

This does not make the entire workflow error-free. A valid proof can establish the wrong statement. Definitions can omit real-world behavior. Imported libraries can introduce assumptions. A verified source-level function can still depend on an unverified compiler, operating system, or processor.

Lean’s own proof validation guidance emphasizes these boundaries. Kernel acceptance shows that a theorem follows from its definitions and dependencies. It does not show that the theorem captures what a person intended.

For knowledge workers, that distinction resembles a spreadsheet with flawless formulas but the wrong business definition. The calculations can be internally consistent while answering the wrong question. Formalization moves the hardest review toward the specification.

That shift is valuable. Humans tend to review intent and context better than thousands of mechanical proof steps. AI can absorb more of the repetitive search while people scrutinize what must actually be true.

The same pattern already appears in practical information work. AI drafts summaries, classifications, queries, and transformations. A responsible workflow then checks the output against primary material, schemas, constraints, or deterministic calculations. Proof automation applies that pattern at a much stricter level.

It also clarifies why personal context remains important. A model cannot protect an invariant it never sees. Teams need access to the decision records, specifications, examples, and exceptions that define correct behavior. A well-maintained personal knowledge base becomes part of the input discipline, even when formal proof remains a specialist activity.

The immediate opportunity is not to formalize every memo. It is to identify costly assumptions that already behave like hidden specifications. Those assumptions often sit at the boundary between systems, teams, or regulatory obligations.

The New Contest Is Proof Cost Versus Verification Value

AI changes formal verification only if it reduces proof labor faster than it expands specification and maintenance work.

Formal verification has never lacked compelling outcomes. The seL4 microkernel provides a prominent example. Its machine-checked proofs connect implementations with formal specifications and cover properties that testing alone cannot establish.

The official seL4 verification material explains that supported configurations have code-level functional-correctness proofs. Some configurations extend those guarantees to binary code. The project shows what formal methods can deliver when the stakes justify sustained specialist effort.

It also illustrates why adoption stayed narrow. Langley cites a seL4 retrospective that estimated engineers spent about ten times as much effort proving as designing and implementing. He also notes that proof code exceeded the C implementation by more than twenty times.

Those ratios should not be treated as a universal tax. seL4 pursued unusually strong assurance across a complex operating-system kernel. Different properties, languages, and toolchains produce different costs. Still, the figures capture the historic problem: proof effort can dominate delivery.

Traditional proof automation reduces some of that burden. Simplifiers, decision procedures, SAT solvers, and SMT solvers can discharge many goals. Yet developers often need to structure code and lemmas around what each solver handles well.

Langley describes this as developing a sixth sense for keeping the solver happy. A goal outside a favorable fragment can send an automated search into an unproductive path. Engineers then spend time translating the problem into a form the tool can solve.

LLMs bring a different capability. They can read surrounding definitions, inspect error messages, try tactics, introduce intermediate lemmas, and revise the implementation. They do not require every problem to fit one fixed decision procedure.

That flexibility makes AI useful as an orchestration layer over existing proof tools. A model can call deterministic tactics where they fit, write an explicit argument elsewhere, and use Lean’s feedback to repair failures. The model searches through proof strategies while the kernel supplies a hard acceptance test.

Langley’s experience also exposes an important cost. His AI assistants changed the table-building code because he had used too much Id.run, a way to express imperative computation inside Lean. The original code may have been readable and executable, but it was less friendly to proof.

This is proof engineering, the work of structuring programs and lemmas so that proofs remain possible and maintainable. AI may reduce the cost, but it does not remove the underlying tension. Code optimized for human familiarity, runtime performance, and proof simplicity will not always share one shape.

The economic question therefore changes. Teams no longer ask only, “Can we prove this?” They ask, “Can an AI maintain the proof and its supporting structure as quickly as developers change the product?”

That favors software with stable, explicit boundaries. Parsers, authorization policies, protocol state machines, financial calculations, and data transformations often expose clear properties. Their failure modes also justify more assurance.

AWS provides a useful production comparison through Cedar, its authorization policy language. AWS maintains executable Lean models beside its Rust implementation and uses proofs with differential testing. The published verified development account says Cedar releases require current models, proofs, and tests.

Cedar does not prove that every application should move into Lean. It does show that formal artifacts can live inside a real release process. AI-assisted proof search could widen the set of teams able to sustain such a process.

The strongest near-term model will likely remain hybrid. Engineers implement production code in a mainstream language. They formalize high-value behavior in Lean. Tests compare both implementations, while proofs establish properties of the model.

Langley pursued a more direct route by implementing the decoder in Lean itself. That produced strong connections between code and theorem, but it carried a major performance penalty. The choice between verified models and verified production code remains central.

What the Proof Does Not Prove

A kernel-checked proof can eliminate one class of uncertainty while leaving the specification, implementation boundary, and operating environment open.

The title “We have proof automation now” is intentionally provocative. The experiment supports it in a practical sense, but only within stated limits. It does not establish that an LLM can independently verify arbitrary production software.

First, the source code is unavailable. Langley says he verified that the proofs type-check and contain no unfinished placeholders. Readers can evaluate his reasoning and examples, but they cannot reproduce the entire build.

Second, the work involved a toy decoder. Zstandard is a serious format, and FSE table construction is not trivial. Yet the project did not face years of feature changes, multiple teams, backward compatibility, hostile integration environments, or production incident pressure.

Third, the decoder was about ten times slower than the standard command-line implementation. That gap matters. Software cannot trade away its core operating requirements merely because its proofs are elegant.

Langley explored whether verified assembly could address the performance problem. He considered using AWS’s LNSym framework to prove that optimized AArch64 assembly matched Lean functions. Tiny examples worked, but the approach did not scale in his tests. One small example using bv_decide, a tactic for finite bit-vector propositions, required more memory than his machine had.

This is a reminder that checking is not free. A proof term can become expensive for the kernel to process. Automated searches can exhaust memory or time. A theoretically valid workflow may still fail its build budget.

Fourth, the models needed to alter the implementation. That is not inherently bad. A proof can reveal that a program’s structure hides the relationships it depends upon. Refactoring toward explicit invariants may improve maintainability.

However, AI-generated refactoring can also change behavior or degrade performance. The final theorem only protects the properties it states. Engineers still need tests, benchmarks, code review, and threat modeling around everything outside those properties.

Fifth, the human specification remains the most sensitive point. If a decoder theorem proves table well-formedness but omits an integer overflow elsewhere, the verified property remains true and incomplete. If the formalized Zstandard behavior differs from the actual format, Lean can faithfully verify the wrong model.

The relevant compression format is documented in RFC 8878, but turning a prose standard into definitions involves interpretation. Ambiguity does not disappear when it enters a theorem prover. It becomes a modeling decision.

This risk grows when non-specialists rely on AI to generate both the statement and the proof. A model can make a claim easy to prove by weakening it. It can select a convenient definition that excludes troublesome inputs. It can satisfy the checker while missing the reviewer’s intent.

That means proof review will need a different interface. Reviewers should see plain-language explanations of each theorem, its assumptions, imported axioms, covered code paths, and excluded behavior. A green checkmark alone is insufficient.

Organizations will also need traceability between business decisions and formal definitions. When a policy changes, someone must know which theorem encodes it. When an implementation changes, the system must identify which guarantees need reconsideration.

This is where AI assistance can help beyond writing tactics. An agent can retrieve the relevant specification, map a code change to affected invariants, and summarize failed obligations. A searchable knowledge base can connect design context with the formal artifacts.

None of these limitations cancel the result. They define the work needed to move it from an intriguing experiment into a dependable engineering practice.

Lean Proof Automation Pressures AI Coding Tools

Once a model can generate code and a checkable proof, “the tests passed” begins to look like an incomplete quality claim.

AI coding products currently compete on task completion, repository understanding, tool use, benchmark scores, and developer experience. Their quality gates still resemble conventional development. Agents run tests, linters, type checkers, security scanners, and human review workflows.

Those checks matter, but most do not establish universal behavior. A unit test proves that one selected input produced one expected result during one run. Fuzzing expands coverage through generated inputs, yet it still samples executions. Static analysis can cover broader classes, but each analyzer works within defined approximations.

A theorem can state that every accepted input satisfies a selected property. If Lean checks the proof, the guarantee does not depend on trusting the model that generated it. That is a compelling product distinction for agentic coding systems.

The pressure will appear first in narrow tasks. An AI agent might generate a parser alongside a proof that successful parses never exceed an input boundary. It might implement an access-control rule with a theorem excluding unauthorized transitions. It might create a database migration and prove preservation of a schema invariant in a formal model.

Mainstream tools do not need to expose Lean syntax to every user. They can offer formal verification as an additional validation mode. The interface could ask developers to approve properties in plain language, show their formal translations, and return either checked proofs or concrete counterexamples.

The decisive feature will not be raw theorem-proving scores. It will be integration. Proof automation must work with repository context, build systems, specifications, performance tests, and code review.

Langley’s experiment provides a useful product lesson. The models worked interactively. They encountered code that resisted proof, modified its structure, and continued until the checker accepted the result. That resembles an engineering agent more than an autocomplete system.

It also suggests a new form of accountability. AI code generation often produces an asymmetry: the model can create code faster than a human can review it. Proof-producing agents can attach machine-checkable evidence to selected claims.

That evidence does not make review optional. It lets reviewers spend less time simulating mechanical behavior and more time examining the claim. The central question becomes, “Is this the property we need?” rather than, “Did the model overlook an index case somewhere?”

Competitors can respond through several routes. They can integrate Lean directly, connect models to other proof assistants, produce certificates for specialized solvers, or combine formal models with conventional code. The winning approach may vary by domain.

Lean has an advantage because it supports programming, theorem proving, metaprogramming, and extensive automation in one environment. Its kernel also provides a clear trust boundary. Yet Lean is not automatically the right deployment language for performance-sensitive software.

Proof-producing AI will therefore compete with proof-checking development pipelines, not only other LLMs. The reliable unit is the entire system: model, formal statement, proof tools, kernel, compiler assumptions, tests, and reviewers.

For knowledge workers buying AI products, this creates a better question than asking whether a vendor’s model is accurate. Ask which outputs receive deterministic validation, which claims have checkable evidence, and which still depend on probabilistic judgment.

Proof automation supplies the strongest version of that pattern. It will not apply to every task, but it raises expectations for any output that can be formally specified.

Three Signals Will Show Whether This Becomes Normal Engineering

The next stage depends on reproducibility, maintenance under change, and proof-backed features inside everyday development tools.

The first signal is a public, reproducible software repository comparable to Langley’s experiment. Developers need to inspect the definitions, prompts or agent traces, proof terms, axioms, build times, and hardware requirements. Independent teams should be able to rerun the process and test alternative models.

Reproducibility would strengthen the claim that current LLMs can handle substantial proof work. Failure to reproduce it would narrow the result to one skilled engineer’s setup and judgment. Both outcomes would improve the available evidence.

The second signal is performance across changing code. A one-time proof can hide substantial human guidance. The more demanding test is whether an agent can repair proofs after realistic implementation changes without weakening the theorem or distorting the program.

Teams should measure proof-repair time, human interventions, computational cost, theorem changes, and performance regressions. They should also track how often a failed proof exposes a genuine bug rather than a harmless structural change.

If repair remains fast across several months of development, AI will have reduced proof engineering’s maintenance burden. If each change triggers extensive restructuring, formal verification will remain limited to stable, high-value components.

The third signal is product integration. Watch for coding agents that offer kernel-checked properties as a standard output, especially for parsers, policy engines, protocol implementations, and data-processing code.

A credible product should separate theorem generation from theorem checking. It should display assumptions, reject unfinished proofs, preserve verification logs, and warn when a code change invalidates a guarantee. It should also keep testing and benchmarking in the workflow.

If those features appear in mainstream tools, Lean proof automation will have moved beyond theorem-proving demonstrations. If they remain confined to research repositories, the productivity gain has not yet overcome integration costs.

For knowledge workers, the practical response is to prepare better specifications. Record the decisions that define correct behavior. Preserve source material. Identify invariants that cause expensive failures when misunderstood. Make exceptions explicit.

Then ask a sharper question of each AI workflow: which outputs can receive a trustworthy, independent check?

Langley’s decoder does not prove that all software can become formally verified. It shows that AI has begun attacking the cost barrier while Lean preserves a strict final gate. That is enough to alter the roadmap.

The near future is not software written by infallible models. It is software proposed by fallible models, constrained by better specifications, and checked by systems that do not care how confident the model sounds.

Give every agent the context to do better work

Connect your agents to the knowledge, decisions, and history already organized in remio.

remio currently supports Windows 10+ (x64) and Macs with Apple silicon.

Your AI Partner at Work
Get more done with remio

Plan. Create. Deliver.
All in one place.

bottom of page