Somebody finally ran the law through a compiler — or the closest thing to one. A Reddit user has parsed the whole of the US Code and the Code of Federal Regulations, translated the lot into the Lean proof assistant, and set Claude Code loose on it looking for logic errors. The reported haul: 393 defects hiding in 302,982 sections of federal law.

The project surfaced on r/ClaudeAI on Saturday morning, December 5, as a 39-second silent video, and it struck a nerve: by Sunday morning it had drawn 422 upvotes and 67 comments, with readers already asking whether the same treatment could be applied to their own countries' laws — and to the tax code. Federal law is two centuries of amendments layered on amendments, written by thousands of hands, with no test suite. Treating it like a codebase, and letting a machine check it the way a compiler checks code, is the kind of idea that sounds inevitable the moment someone does it.

How the audit worked#

The poster lays out the pipeline in six steps: take the US Code and the Code of Federal Regulations in their official XML formats; parse out every section, subdivision and cross-reference; compile that structure into Lean, so its proof kernel can check references against the law as it stands; translate each section into typed rules that preserve the exact statutory language; scan those rules for logical errors, with Claude Code coordinating specialized subagents for each analysis; then independently review every suspected defect and check the published examples against the official legal text. That fourth step — turning legal prose into formal rules without changing its meaning — is the one doing the heavy lifting, and the one that drew the most scrutiny in the comments.

What the 393 breaks down into#

The video opens with a bar chart splitting the 393 defects into six categories:

CategoryCountWhat it means
Numeric165Dates, thresholds and ranges that contradict each other
Conflicting definition90The same term defined two different ways
Contradiction81Two provisions that can't both be true
Circular40Definitions or rules that refer back to themselves
Impossible condition9Conditions that can never be satisfied
Undefined term8Terms used but never defined

The poster adds that there are many more mechanical defects besides — typos, broken references — but that the logical ones are the interesting find.

An illustration of old statute books dissolving into glowing lines of computer code, with a magnifying glass over a page
Editorial illustration: statute books dissolving into code. Image: AI Frontier Post / AI-generated.

Three examples from the video#

The video doesn't just give a number — it shows its work, with on-screen citations for each example.

The first is a contradiction in a veterinary drug rule. One sentence says animals treated with a drug must not be slaughtered for food within five days of treatment; the next says that for one specific drug number, the wait is 24 hours. A commenter looked the citation up and confirmed it as 21 CFR 520.441(d)(4)(iii)(C). Commenters argued over whether that is a genuine contradiction or a general rule with a narrower exception — waiting five days satisfies both instructions.

The second example is a conflicting definition in Medicare rules. Under 42 CFR 418.75, the video says, the same 'extended flexibilities period' for hospice care is defined twice — once as a six-year period running to the end of 2029, and again as a four-year period ending in 2027. The 2027 date matches the current position: the Consolidated Appropriations Act, 2026 extended the hospice telehealth flexibility through December 31, 2027, per the Centers for Medicare & Medicaid Services. The video's point is that the older definition is still sitting in the text alongside it.

The third is a numeric gap in tax paperwork: the handover between two information-return forms for controlled foreign corporations, Form 2952 and Form 5471, leaves a stretch of tax years around 1982–1983 with, as the video presents it, no form covering them at all.

The reality check: law isn't code#

Not everyone in the thread is ready to declare the statute books buggy. The strongest objection is that law is not a program: it is interpreted by courts, shaped by precedent, and often deliberately vague, because no legislature can spell out every situation in advance. On that view, a conflict between two provisions is not necessarily a defect — it is a question for a judge. One commenter relayed a lawyer's warning that vagueness is sometimes a feature, not a bug, and that 'fixing' it could hand more leverage to whoever can afford the best reading of the new text.

There is also a simpler problem: the work cannot be checked yet. Several commenters asked for the repository so they could run the same audit on other countries' laws, and the poster has not replied to any of them — not to the repo requests, not to the questions about method, not to anything. Until the code and the full list are public, the count is one person's claim, backed by three worked examples. The examples that can be checked do check out as citations; the other 390 remain on trust.

Even the skeptics, though, mostly concede the narrower point. Obvious drafting slips — a definition with two end dates, a cross-reference pointing at a repealed section — are worth catching at scale, and a machine that reads 300,000 sections without getting tired is a reasonable way to find them.

What to watch#

Three things decide whether this becomes more than a viral video. First, whether the poster publishes the code and the full list — without them, nobody can reproduce the count or use the findings. Second, whether anyone with legal standing takes the examples up: a confirmed drafting error in a live regulation is the kind of thing an agency can quietly fix. And third, whether the approach spreads to state codes, which are messier than the federal ones, and to the tax code. If the method holds up on a second jurisdiction, the compiler analogy starts to look less like a joke and more like a job description.

Sources: r/ClaudeAI, “Pulling up explicit logic errors in US law” (December 5, 2026); Centers for Medicare & Medicaid Services, Hospice News & Announcements (telehealth flexibility extended through December 31, 2027); AI Frontier Post, “Google DeepMind releases AI-generated Lean formalizations of nearly 28,000 math papers” (December 5, 2026); AI Frontier Post, “A Claude-built archive of 300,000 military board decisions is now evidence in a federal lawsuit against Trump and the Pentagon” (November 11, 2026)