Video summary

Software Verification in Lean Palo Alto - Leo de Moura

Main summary

Key takeaways

Educational

Summary

Lean’s Role and Ecosystem

  • Lean is both a programming language and a proof assistant: it can produce proofs that a small checker can verify.
  • Its extensibility and scalability have helped it grow beyond mathematical proofs into software and hardware verification.
  • Mathlib, Lean’s hand-built mathematical library, is a foundation for many formalization projects and AI-generated proofs. Its curated definitions help ensure that formal statements refer to the intended mathematical objects.
  • Lean is also used in collaborative “social verification” efforts, where people contribute specifications, review work, and build shared libraries. CSlib is described as a computer-science library in the spirit of Mathlib.

AI Is Increasing the Scale of Formalization

  • The speaker says AI-generated Lean code and proofs have grown rapidly, producing projects that would have taken humans years to complete.
  • He cites very large formalizations—including proofs measured in millions of lines—and argues that this trend is likely to continue. Estimates for formalizing all mathematics range as high as one to ten billion lines of proof.
  • The AI-written Tao Sachi project is presented as a reusable library effort:
    • Humans set the roadmap and identify gaps.
    • AI agents read the roadmap, implement missing material, and review proposed contributions.
    • Files containing human-curated definitions can be marked as requiring human review, preventing agents from changing them without approval.
  • In this environment, the bottlenecks are increasingly infrastructure-related: GitHub pull-request queues, Lean’s ability to check contributions, build times, and storage—not simply the availability of AI-generated code.

Formal Verification for Real Software

The talk presents several applications:

  • AWS Cedar: A policy-language specification has been formalized and used to prove properties such as type safety. The model can be compared against the Rust implementation using differential testing. A future goal would be to prove that the model and production code are equivalent.
  • Differential-privacy software: A verified implementation reportedly runs faster than an unverified one. The proof gives developers confidence to use optimizations that might otherwise seem too risky.
  • Google’s Kraken project: Lean is used to describe x86-64 semantics and verify assembly code, drawing on verification-condition-generation infrastructure.
  • Cryptographic software in Rust: A project described by the speaker uses Lean to verify cryptographic code; its developers report that verification can now proceed faster than writing the code.
  • AWS Trainium compiler: A large Lean codebase covers components such as assemblers, instruction-set simulators, and compiler passes. One approach is to write a clear reference implementation, then ask AI to optimize it while proving that the optimized version remains equivalent. The speaker reports that this produced code smaller and faster than a buggy C implementation.
  • Other examples include a Lean port of xv6, a verified zlib implementation, Hex for verified computer-algebra routines, and AI-assisted verification of C and Verilog through Aristotle.

A Practical Pattern for AI-Assisted Optimization

A recurring method in the examples is:

  1. Write a clear reference implementation that expresses the intended behavior.
  2. State the properties to preserve, such as functional correctness or equivalence to the reference.
  3. Ask AI to optimize or transform the implementation.
  4. Require proofs alongside the changes, so each optimization remains justified.
  5. Check the result independently, rather than relying only on the AI or the main development environment.

The speaker says this approach can make ambitious optimizations practical: AI can explore implementation choices, while Lean checks that the resulting code still satisfies the specification.

Trust, Scale, and Understanding

The speaker identifies three priorities for the Lean ecosystem:

  • Trust: AI may find bugs in proof checkers as well as write useful proofs. The Lean community is therefore investing in independently verified checkers and in checking the same developments with multiple kernels.
  • Scalability: Large formal projects stress every part of the system: builds, startup, imports, proof export, checking, tactics, and storage.
  • Understanding: A proof checker can confirm that a proof follows from a formal statement, but cannot tell whether that statement captures what its authors intended. Human-curated statements, specifications, explanations, and better visualization tools remain important. The speaker expects people to spend more time reading and reviewing AI-generated formal work, even if they write less of it.

Checker and Performance Improvements

  • Lean now supports easier checking with multiple kernels through commands such as lake check; a “paranoid” mode can check work with several kernels, including verified ones.
  • A comparator tool can compare a proposed proof with a fixed, human-curated statement. Its challenge-file format allows the proof to be supplied while keeping the statement unchanged.
  • The talk describes verified checkers implemented in different ways, including a checker written in Coq and one using a small imperative language with a verified compiler. These approaches offer different trade-offs in speed and assurance.
  • The speaker reports substantial recent improvements in Mathlib build performance despite the library becoming much larger.
  • AI has also helped implement optimizations to decision procedures and verification-condition generators, including more efficient handling of branching, variable ordering, and proof certificates.

Planned Lean Developments

  • Lean Raw is an input format designed to reduce overhead for machine-generated code. The speaker reports that it can process some files far faster than the ordinary human-oriented Lean input path.
  • Lazy imports aim to make projects pay only for the portions of libraries they actually use.
  • Other work includes better agent tooling, documentation and blueprint tools, package infrastructure, and a more capable code generator.
  • The longer-term aim is a more fully verified stack, extending from proof checkers through compilers and runtimes, and potentially down to assembly and formally specified hardware.
  • For Lean as a general-purpose programming language, the speaker mentions possible improvements such as stack-allocated objects, more efficient loops and join points, uniqueness annotations for destructive updates, and layout polymorphism.

Questions and Answers

  • Will the existing C++ checker disappear? The speaker says it is not needed for bootstrapping, but the team expects to retain it as an option rather than discard it.
  • How does Lean compare with Metamath in checking speed? He cautions that comparisons can measure different work. Processing a Lean file includes elaboration and tactic execution, while a kernel-level check is a narrower task. He expects verified decision procedures to make proofs more compact and checking more efficient.
  • Could verified native extensions replace trusted compiled components? The plan is to support a small imperative language inside the kernel and, over time, use verified compilers for code written in it.
  • Can Lean be a general-purpose language? Lean already implements parts of its own tooling and other software, but the speaker says improvements to code generation and runtime performance are still needed.
  • How can AI agents be encouraged to use new Lean features? Models may continue using older patterns learned during training. Better feedback and small example projects should help agents adopt new features.

Speakers and Sources Featured

Speakers

  • Leonardo (Leo) de Moura — presenter.
  • Event host/moderator — introduces Leo and moderates the Q&A; the autogenerated captions render the name as “Seven,” so the exact spelling is uncertain.
  • Audience questioners — several attendees ask questions during the Q&A; they are not identified by name in the captions.

People and Sources Cited in the Talk

  • Projects, tools, and organizations: Lean, Lean FRO, Mathlib, CSlib, Papers in Lean, Tao Sachi, Cedar, Kraken, Aristotle, xv6, zlib, Hex, Lake, Lean Bean, Verso, Polymer, and the Formal Conjectures repository.
  • Named people mentioned as contributors, collaborators, or sources: Kim Morrison, Kevin Buzzard, Sungwoo Kong, Sebastian Graf, Sean McLaughlin, Joram, Daniel Sousa, Clark Barrett, and John Baptiste Tristan. Their mention does not indicate that they speak in the video.

Rate this summary

Your feedback will help improve summaries.

Improve this summary

Reprocess with a stronger model when the summary feels incomplete or inaccurate.

Pro

Translate summary in another language

Pro

Ask questions to this video

Chat for follow-up questions, clarifications, and source-backed answers.

Coming soon

Share this summary

Original video