Skip to content

refactor: one file per guarantee under laws/ and proofs/ - #164

Merged
ngngardner merged 3 commits into
masterfrom
refactor/split-laws
Nov 1, 2026
Merged

ngngardner merged 3 commits into
masterfrom
refactor/split-laws

Conversation

@ngngardner

@ngngardner ngngardner commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • One file per guarantee. Each guarantee is laws/<Name>.bend (its prose, then its quantified laws), proved by proofs/<Name>.bend. The root LAWS.bend and PROOF.bend only import them. That's 211 law files (64 for SPEC.md's proved rows, 147 for laws no row tagged or several rows shared, each named for the behavior it states), 10 shared definition files and 26 lemma files.

  • No nested pairs. The 18 LAWS.bend/PROOF.bend pairs under src/ (about 49k lines) are folded into the root. src/relock/PROOF.bend's lemmas went with the proofs that use them. src/check/PROOF.bend's imports of eq.bend and str.bend moved to the root PROOF.bend. A few helper names two pairs both defined were renamed (lock's perm is packs.perm, pkg's is files.perm, and so on).

  • No requirement IDs.

    • SPEC.md's preamble now heads LAWS.bend.
    • Its "Left to prove" notes head the law files they concern.
    • The nested pairs' header prose went to the law or proof file it describes.
    • Every EZ-, SHAKE- and TOML- ID in code, nix, README and AGENTS.md is now a law path. HTTP- IDs cite ezhttp's law files. SNAP- IDs stay, since snap isn't converted yet.
    • The table itself is kept as docs/SPEC.md, since the RFCs and docs/guide.md cite its IDs.
  • Trust boundary.

    • Dropped: the checker's soundness.
    • Moved to # Trusted, not proved: comments on the code that assumes them:
      • the interpreters: src/ez/app.bend
      • argv: src/share/args.bend
      • ez prove: src/ez/prove.bend
      • the hub: src/hub/hub.bend
      • HTTP/URL: src/hub/get.bend, citing ezhttp's law files
      • stable hub names and the lock reading back: src/lock/lock.bend
      • shake's parsing: src/ez/line.bend, citing shake's law files
      • eztoml's round trip: src/toml/toml.bend, citing eztoml's law files
      • snap's answers: src/ez/ends.bend
      • git: src/git/git.bend
      • the 0x hash vs bend --publish: src/pkg/pkg.bend
      • narHash vs nix: src/sha/nar.bend
      • SHA-256: src/share/sha.bend
  • Helpers: 79 proof helpers and 6 law definitions that no law or proof reached are gone.

  • bolt.bend drops def trace(). AGENTS.md describes the new layout.

  • bolt v1.22.0: [tools.bolt] is bumped to the release with feat!: one guarantee per file under laws/ and proofs/; drop trace and SPEC.md bolt#257 (import-based law/proof roles, no trace), and the # noqa codes it finds silence nothing are dropped.

Test plan

  • bend PROOF.bend prints ALL PROOFS CHECK. ez prove finds only the root PROOF.bend now.
  • Lint with bolt from #257: 0 errors, 320 warnings (all L001 coverage). main under the same bolt has the same 320 warnings, plus 1 error (C011 for def trace()).
  • ez doctor (ez 1.13.0, after ez fetch): ez.lock.toml is up to date, and every imported package is named in ez.toml.
  • bolt pinned at v1.22.0, then nix flake check passes

🤖 Generated with Claude Code

ngngardner and others added 3 commits October 31, 2026 23:43
SPEC.md and eighteen nested LAWS.bend/PROOF.bend pairs under src/ (about
49k lines) had to be read side by side, matched up by ID tags. Each
guarantee is now laws/<Name>.bend, its prose on top and its quantified laws
under it, proved by proofs/<Name>.bend. The root LAWS.bend and PROOF.bend
only import them; no subdirectory keeps a pair. src/relock/PROOF.bend's
lemmas went with the proofs that use them, and src/check/PROOF.bend's two
imports moved to the root PROOF.bend.

Definitions the laws share are under laws/defs/, lemmas several proofs use
under proofs/lemmas/, each named for what it holds. Requirement IDs are
gone: a file's name is its guarantee's. SPEC.md's preamble heads LAWS.bend,
its notes on how each row was proved head the law files they concern, and
the nested pairs' header prose went to the law and proof files it
describes. The table itself is kept as docs/SPEC.md, which the RFCs' IDs
point into. 79 proof helpers and 6 law definitions no law or proof reached
are gone.

Of the trust boundary, the checker's soundness is dropped. The rest is said
on the code that assumes it, as `# Trusted, not proved:` comments: the
interpreters on src/ez/app.bend, the words on src/share/args.bend, the
gate runner on src/ez/prove.bend, the hub on src/hub/hub.bend, HTTP on
src/hub/get.bend, stable names and the lock reading back on
src/lock/lock.bend, command-line parsing on src/ez/line.bend (citing
shake's law files), eztoml's round trip on src/toml/toml.bend, snap's
answers on src/ez/ends.bend, git on src/git/git.bend, the 0x hash on
src/pkg/pkg.bend, the narHash on src/sha/nar.bend and SHA-256 on
src/share/sha.bend.

This needs a bolt that reads law and proof files by what LAWS.bend and
PROOF.bend import, and no longer runs `trace`; bolt.bend drops `trace`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The 113 law files the split named after their law's identifier (AddIdem,
GapOfFullPin, UpsPlain) are renamed for what they guarantee
(LedgerAddIdempotent, FullToolPinCopied, PlainPathHasNoClimbs), with their
proof files, imports and cites. src/hub/get.bend cites ezhttp's law files
in place of its HTTP- IDs, and a comment in laws/defs/LockInputs.bend no
longer points at two laws that are gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ngngardner
ngngardner marked this pull request as ready for review November 1, 2026 03:53
@ngngardner
ngngardner enabled auto-merge (squash) November 1, 2026 03:55
@ngngardner
ngngardner merged commit 9d5d3d9 into master Nov 1, 2026
5 checks passed
@ngngardner
ngngardner deleted the refactor/split-laws branch November 1, 2026 04:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant