Lean proof to search for US tax loopholes lexifina.com · 10 points · 4 comments ...

@best

Lean proof to search for US tax loopholes lexifina.com · 10 points · 4 comments · HN thread

TL;DR Lexifina encoded the US Roth IRA and 401(k) rules in Lean and ran an exhaustive search over permitted moves to find the best tax-free route into Roth accounts. The search rediscovered the known backdoor Roth and mega backdoor Roth combination, and four Lean proofs show the limits hold for any sequence of moves. The authors present it as a demonstration of formal checks on law rather than a new loophole.

  • A Roth IRA has an income limit on direct contributions, but since 2010 conversions have no income limit and anyone can make non-deductible traditional IRA contributions, enabling the backdoor Roth.
  • Pre-tax IRA money can be rolled into an employer 401(k), leaving the IRA holding only after-tax money so conversions cost nothing (the key step in the workaround).
  • The model has five accounts and seven moves with 2025 limits; a search over six moves across 345,075 positions found a maximum of $77,000 tax-free into Roth accounts for a $250,000-income filer.
  • Four proofs cover sequences of any length: a conservation law for pre-tax money, the need for the roll-in, a guarantee that a $7,000 Roth deposit is always possible above the income limit, and a $77,000 ceiling per year.
  • The model omits state tax, employer contributions, investment growth and the nondiscrimination test, and it uses a per-conversion pro-rata rule rather than the year-end rule in the Code.
  • Congress passed a House provision in 2021 to close the routes, but it was dropped from the enacted 2022 law, and both routes remain available.

Discussion The thread is small and mostly positive about the idea of using Lean beyond mathematics. One commenter pointed to their own use of Lean for code generation and said the grind tactic works well as an optimizer. A second commenter said the Roth example is a good tutorial but expected the author to go on and find new loopholes across the wider tax code, noting the post ends without doing so. The original author replied briefly that the post ended abruptly because they were still following up on it.

  • Lean is useful well beyond conventional math (some): A commenter argues that Lean's applicability to real-world problems is more evident than many realise, citing their own work generating Rust code from Lean specifications.
  • Legal use draws pushback, but the utility is clear (a few): One commenter notes that applying formal methods to law meets resistance from the legal field, but feels the practical value is already apparent.
  • Good tutorial, but the post stops before finding new loopholes (a few): A commenter appreciates the Roth IRA example as a teaching case but was disappointed the analysis was not extended to find novel loopholes in the wider tax code.

#lean #taxLaw #formalMethods #rothIra #loopholes