Technology1 min read

Formalizing US Tax Code (Using Lean)

By · Published by Everything Blog

In short

Researchers encoded sections of the Internal Revenue Code into Lean, an interactive proof checker, validating the logic against official IRS forms and instructions. The system reviewed statutory revisions up to November 2026 and incorporated calculations reflecting the One Big Beautiful Bill Act of July 2025. Coupled with a Git repository tracing revisions back to 1994, the verification tool produced formal proof certificates pinning each error to its originating public law. Artificial intelligence assisted the translation process, enabling continuous automated verification for future legislative updates.

Key points

  • Converting federal statutory language into mathematical proof code allows automated detec…: Converting federal statutory language into mathematical proof code allows automated detection of legislative mistakes and inadvertent tax loopholes.
  • Historical version tracking dating back to 1994 enables formal proof certificates to trac…: Historical version tracking dating back to 1994 enables formal proof certificates to trace drafting defects directly to their enacted public laws.
  • Artificial intelligence translation combined with mathematical checkers permits continuou…: Artificial intelligence translation combined with mathematical checkers permits continuous verification of incoming tax legislation to catch legal contradictions instantly.

Sources checked by our analysis pipeline: 1

Formalizing the US tax code

Yesterday, we verified that known tax loopholes could be identified using a Lean search. Today, we set out to formalize the entire Internal Revenue Code to hunt for unknown loopholes (bugs).

Pointing a proof checker at statutes

Lean is a programming language whose type checker can also check mathematical proofs: if Lean accepts a proof, every step follows from the definitions, with nothing taken on trust. An earlier post discussed how far that kind of formalisation can reach in law,[1] and yesterday we used it on the retirement-account rules, where a blind search rediscovered the backdoor Roth.[2]

This work is part of global-law, a CC0 repository of versioned legislation and case law.[3] Our argument is that pointing AI and a proof checker at a versioned record of the law finds the contradictions and mechanical mistakes that people miss. In particular, we can catch mistakes in the text, and see what the rules allow, including what they allow by accident. To do so, we translated each section of the law into Lean, staying close to the…

Technology