Formalizing US Tax Code in Lean
lavx.hu

Formalizing US Tax Code in Lean

Archived — this story has rotated out of today’s deck. It is kept here in full.

The gist

The Lexifina team translated Title 26 into Lean and reported 138 real drafting faults.
The checks re-run in about two and a half minutes.

Background

Lexifina is the publisher of the report and maintains global-law, a CC0 (public-domain) repository of versioned legislation and case law; Alan Yahya heads the Lexifina team behind the work. The team used the Office of the Law Revision Counsel's release point 119-138 of Title 26 — the House office that compiles the US Code and publishes it as structured XML — current to November 3, 2026. The report describes three passes: check the text, model what it computes, and search what it permits, covering income and AGI, deductions, the tax and the AMT (alternative minimum tax), and credits for 2025 as amended by the One Big Beautiful Bill Act. It follows Lexifina's earlier Lean work on retirement-account rules, where a blind search rediscovered the backdoor Roth.

How it unfolded

  1. Nov 3, 2026The team used Office of the Law Revision Counsel release point 119-138 of Title 26, current to this date.
  2. Nov 10, 2026Alan Yahya published the report "Formalizing the US tax code" on Lexifina.
  3. Nov 11, 2026Lexifina published "Recreating Tax Court rulings in Lean" by Alan Yahya.
  4. Nov 13, 2026Lexifina published "Formalizing all US case law in Lean."
  5. Nov 14, 2026LavX News published its article on the report, citing 138 drafting faults and three unpublished loopholes; the Lexifina post was submitted to Hacker News (81 points, 48 comments).
  6. Nov 14, 2026A newsletter (TGFI, Volume 580) summarized the Lexifina post as "AI finds tax loopholes."

Key terms

Lean
Formal proofs written in Lean, a proof assistant and functional programming language.
Title 26
The section of the United States Code that codifies the federal tax law known as the Internal Revenue Code.
AMT
Amounts of income exempt from the alternative minimum tax, a separate U.S. federal tax on certain high-income individuals, estates, and trusts.

Source: Wikipedia

Who’s saying what

Author
Alan Yahya says AI plus a proof checker pointed at a versioned record of law can find contradictions and mechanical mistakes, and can show what rules allow, including results that appear by accident.
Caution
Hacker News commenter delichon argues that calling loopholes bugs is a political statement, since there is no data Lean code could use to decide whether a provision is intentional.
Expert
Hacker News commenter squirrel says one would want to prove common-sense invariants, and Lean might disprove a few, with the counterexamples being potential loopholes.
Caution
Hacker News commenter nixonaddiction says formalizing legal code is attractive but realistically hard to extend past the tax code, since common law is heavily driven by judicial decisions.
Support
Hacker News commenter carterschonwald called it "actually wonderful" and "a good use of the tech."

Still unverified

The report's claim of three planning results not found in practitioner sources ("three unpublished loopholes") is stated by the report and the LavX headline, with no independent confirmation in the sources. The report also says a blind audit suggests about 2,200 of the 3,278 dangling references are real errors.

Sources

See today’s stories in the app Gistline — free on the App Store