Skip to content

migrate --facade: D121 step 2, the facade proof engine over a package's C source - #2420

Merged
ehartford merged 1 commit into
mainfrom
d121-proof
Oct 15, 2026
Merged

ehartford merged 1 commit into
mainfrom
d121-proof

Conversation

@ehartford

Copy link
Copy Markdown
Contributor

D121 step 2 (§16.2b.15): with migrate --facade NAME <dir|file.c> proves a package's ownership facts from its own bodies and drafts the facade; no name enters any verdict.

  • CImport.w ci_body_ownership_evidence (beside D107's walkers) records where every returned pointer comes from and what becomes of each parameter and local.
  • src/CiFacadeDraft.w: the corpus fixed point, in dependency order: retention, destruction, returns (owned / borrow from param). The draft pairs each pointer-to-record representation's producers with its one unary destroyer, states every proven borrow and lend with its proof; the report names every declared function's presentation or why it stays raw. Several unary destroyers, or a borrowed type with several origin types (§16.2b.6), are reported for the registry, never picked.
  • Found on real trees: libclang's two-child C-style cast; a local that stands for a parameter (gzclose); retention is a pointer-parameter fact; a facade names only prototyped functions.
  • Test migrate-facade-by-evidence (build/selfhost.w): a two-unit library with every proof shape; the draft is compiled against its header.
  • Docs: with-migrate-spec.md "Usage"; D121's status; D133 (delegated) for the spellings.

Measured on zlib 1.3.2's library units: 108 declared functions, 15 safe; gzopen owned, gzclose a destroyer; the three unary destroyers of gzFile_s go to the registry.

Battery: pending.

…own C source and drafts the facade (D121 step 2, §16.2b.15). The migrator's body walkers record where every returned pointer comes from and what becomes of each parameter and local (CImport.w ci_body_ownership_evidence, beside D107's); CiFacadeDraft.w draws the corpus fixed point: retention (field, global, or a callee that retains; an outside callee retains unless it is a libc observer), destruction (free, a global the package initializes to free, or a package destroyer at its destroyed position), then returns (owned when every path returns a fresh allocation never retained, directly, through a local or a package producer; a borrow when every path returns a part of one parameter, directly or through a package borrow). No name enters a verdict. The draft pairs each pointer-to-record representation's producers with its one unary destroyer, states every proven borrow and lend with its proof, and the report names every function's presentation or the reason it stays raw; several unary destroyers, or a borrowed type with several origin types (§16.2b.6), are reported for the registry, never guessed. A C-style cast to a named type has a type-reference child, which the ownership walker peels; a local assigned only a parameter stands for it (gzclose's state). Selfhost test migrate-facade-by-evidence: a two-unit library, every proof shape, the draft compiled against its header. D133 records the spellings (delegated).
@ehartford

Copy link
Copy Markdown
Contributor Author

Battery on 48002b2 under the pinned seed nightly-20261014-local-3-c411d0e45: GREEN, wall 332 s (with run tools/battery.w in the branch worktree; gate green on the second run after two fixes folded in: --facade listed as a migrator flag for the spec inventory, and four explicit & at &T parameters removed for the ceremony census).

Engine measured on zlib 1.3.2's library units: 108 declared functions, 15 presented safely, 93 raw with reasons; gzopen proven owned, gzclose a destroyer; the three unary destroyers of gzFile_s are reported for the registry rather than picked.

@ehartford
ehartford marked this pull request as ready for review October 15, 2026 11:51
@ehartford
ehartford merged commit 0b7f0cb into main Oct 15, 2026
@ehartford
ehartford deleted the d121-proof branch October 15, 2026 11:51
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