Skip to content

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

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

ngngardner merged 3 commits into
mainfrom
refactor/split-laws

Conversation

@ngngardner

Copy link
Copy Markdown
Contributor

Summary

  • One file per guarantee. Each guarantee is laws/<Name>.bend (prose, then its quantified laws), proved by proofs/<Name>.bend. A single LAWS.bend / PROOF.bend pair at the root only imports them. The old src/LAWS.bend (4k lines) and src/PROOF.bend (11.5k lines) are gone, and the gate is now bend PROOF.bend.
  • Shared files. Definitions the laws share live in laws/defs/, and lemmas several proofs use live in proofs/lemmas/. Each is named for what it holds. A law that several guarantees rest on has its own file.
  • No requirement IDs, no SPEC.md. SPEC.md's definitions (well-formed, plain word, current command, selected path, env value) now head LAWS.bend.
  • Trust boundary.
    • Dropped: the checker's soundness and the gate runner, since they hold for every Bend project.
    • Kept, as a comment on src/args.bend: what IO.args and IO.get_env hand on, and that argv and env_vars pass it through.
  • bolt.bend drops def trace().

Depends on

Emerging-Patterns/bolt#257. The pinned bolt (v1.19.0) reads law files by name only and still runs trace. This PR stays a draft until that release lands and the pin is bumped here.

Test plan

  • bend PROOF.bend → ALL PROOFS CHECK
  • Lint with bolt from #257: 36 errors, all S005 stale # noqa in src/eq.bend, src/grow.bend, src/walk.bend and examples/demo. Main shows the same 36 under that bolt, plus a C011 for def trace(). They need cleaning when the pin is bumped.
  • Bump the bolt pin after the release, then nix flake check

🤖 Generated with Claude Code

SPEC.md, src/LAWS.bend (4k lines) and src/PROOF.bend (11.5k 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. One LAWS.bend and PROOF.bend at the root only import
them; the pair under src/ is gone, and the gate is `bend PROOF.bend`.

A law that proves part of several guarantees has its own file, and each
guarantee that rests on it says so. 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 with SPEC.md: a file's name is its
guarantee's. SPEC.md's definitions (well-formed, plain word, current
command, selected path, env value) head LAWS.bend.

Of the trust boundary, the checker's soundness and the gate runner hold for
every Bend project and are dropped; what IO.args and IO.get_env hand on, and
that argv and env_vars pass it through, is said on src/args.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>
ngngardner and others added 2 commits October 31, 2026 23:09
The requirement table the law files replaced stays as a record: the RFCs
name guarantees by its IDs. LAWS.bend points to it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bolt v1.22.0 reads law and proof files by what LAWS.bend and PROOF.bend
import, which this layout needs. The rules changed since the v1.19.0 pin, so
some noqa comments no longer silence anything (S005); they are removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ngngardner
ngngardner marked this pull request as ready for review November 1, 2026 03:33
@ngngardner
ngngardner enabled auto-merge (squash) November 1, 2026 03:33
@ngngardner
ngngardner merged commit 338c73b into main Nov 1, 2026
4 checks passed
@ngngardner
ngngardner deleted the refactor/split-laws branch November 1, 2026 03:36
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