WhoBuilt

Your Code Has Bugs. Lean4 Has Proofs: Formal Verification for Engineers

Aug 28, 2026· 10 min· 8.8K views·Watch on YouTube

Speaker

Varun Pant, who leads formal verification teams while building AI products at AWS, explains how engineers can use Lean and related tools to prove software properties across all inputs.

Make the specification the source of truth

Pant argues that tests cover only selected inputs, human review cannot keep pace with coding agents, and LLM judgments are probabilistic. In spec-driven development, people define and validate what correct means, while agents implement the specification and verification tools check the result.

How Lean checks proofs

Lean uses one language for definitions and proofs, with a small trusted kernel that checks proof results. Pant demonstrates a list-reversal theorem and compares trying proof tactics to exploring moves in chess, including backtracking when a tactic does not work.

Prove a specification and implementation together

Pant describes an open-source Andreo AI project that converted the C compression library zlib to Lean. AI generated a formal specification from the claim that decompressing compressed data returns the original, then produced Lean code, helper lemmas, and proofs. The result included 32,000 lines of proof checked by a small independent kernel.

Connect Lean models to production code

Cedar's policy language is specified in Lean while its production implementation runs in Rust; Pant says about 100 million differential random tests run nightly, and versions ship only after they pass. He also describes Verus, which uses Z3 with preconditions and postconditions, and Enus, which translates Rust's intermediate representation into Lean.

Route programs through Strata

Strata is an open-source work in progress at AWS for translating programs from different languages into a shared intermediate form called Strata Core, written in Lean. That representation can be checked with Lean proofs, SMT solvers, or model checkers. Pant suggests starting with critical code, writing and validating its specification, and using an agent to implement it.

Takeaways

  • Treat the specification as a critical artifact: review it or test it before using it to generate code.
  • Use formal proofs when you need a property to hold across all inputs, rather than relying only on tests.
  • Consider a Lean model plus differential testing when production code runs in another language, as Cedar does with Rust.
  • For Rust code, Verus supports preconditions and postconditions that are checked statically and erased at runtime.
  • Start with a small, critical piece of code and define what correct means before asking an agent to implement it.

Mentioned in this talk

Search inside this talk

What was claimed 12

  • works at
    Varun Pant works at AWS
    “I build AI products at AWS”
    YouTube
    Unverified1 source· Talk
  • feature
    Kiro: Named as an example of spec-driven development.
    “One way is spec-driven development, for example, with Kiro.”
    YouTube
    Unverified1 source· Talk
  • feature
    Lean: Programming language and proof assistant using the same language for definitions and proofs, with a small trusted kernel.
    “Lean is a programming language and a proof assistant.”
    YouTube
    Unverified1 source· Talk
  • uses
    Lean conversion
    “Andreo AI, which converted zlib, a C compression library, to Lean.”
    YouTube
    Unverified1 source· Talk
  • uses
    Cedar uses Rust
    Production code runs in Rust.
    “the production code runs in Rust.”
    YouTube
    Unverified1 source· Talk
  • uses
    Cedar uses Lean
    Its specification is written in Lean.
    “The specification of Cedar is written in Lean”
    YouTube
    Unverified1 source· Talk
  • metric
    Differential random testing: About 100 million tests run nightly for Cedar.
    “About 100 million differential random tests run nightly.”
    YouTube
    Unverified1 source· Talk
  • uses
    Verus uses Z3
    “It uses the very powerful solver Z3.”
    YouTube
    Unverified1 source· Talk
Show all 12 facts

Related talks