← Sat, Nov 14 digest

Formalizing US Tax Code (Using Lean)

read article ↗ hn thread ↗

Researchers formalised the 2025 US tax code in the Lean proof assistant, uncovering 138 drafting errors, several bugs in existing tax software, and novel tax planning quirks.

read it The post details a concrete methodology and specific surprising findings from running a formal proof assistant on real federal tax statutes.

summary

Researchers encoded the 2025 US federal income tax code into the Lean proof assistant to test for internal consistency and identify loopholes. By running automated checks against the official text and 5,000 simulated households, they identified 138 drafting errors, logical bugs in existing tax calculators, and specific statutory cliffs where filing separately or structuring income differently reduces tax liability. The work demonstrates how formal verification techniques can expose mechanical flaws in complex regulatory text.

key points

  1. Automated parsing of Title 26 revealed 138 real drafting faults, including dead cross-references, duplicate numbering, and unclosed parentheses.
  2. Comparing the Lean model against three existing tax software tools exposed logical bugs in popular calculators, such as missing schedule attachments and improper eligibility checks.
  3. The formal search identified specific tax planning strategies, including rare scenarios where filing separately reduces Social Security taxation or bypasses SALT caps.

who should read it

Software engineers, tax professionals, and researchers interested in formal verification and legal code execution.

discussion positive

consensus

Debate centers on whether tax loopholes are accidental bugs or intentional features designed to benefit wealthy individuals and maintain legal wiggle room.

pushback

Pushback highlights that treating legal statutes like computer code ignores the reality of judicial interpretation and the intentional vagueness of legislation.

best comment by qrobit ↗

There's whole language for law formalization called Catala.

See https://catala-lang.org/

and https://github.com/CatalaLang/catala-examples

French government seems to actually use it in one of their web services, see https://docs.aides.beta.gouv.fr/03_mutualiser/02_outils.html (page in French)

Introduces Catala, an existing programming language specifically designed for formalizing legal code and deployed by the French government.

Generated by an LLM from the article and thread. Check the sources before relying on it.