Skip to content

JavaToLaurel: emit a procedure (not a function) for @Pure methods#461

Draft
tautschnig wants to merge 1 commit into
strata-org:mainfrom
tautschnig:jverify-pure-as-procedure
Draft

JavaToLaurel: emit a procedure (not a function) for @Pure methods#461
tautschnig wants to merge 1 commit into
strata-org:mainfrom
tautschnig:jverify-pure-as-procedure

Conversation

@tautschnig

Copy link
Copy Markdown
Collaborator

Strata is removing Laurel functions (Strata PR #1408 "Remove functions"); transparent procedures take their place. jverify emitted a Laurel function for every @pure method, so it will stop translating once functions are gone.

Emit a procedure instead. The transparency choice is unchanged: a @pure method with no ensures becomes a transparent procedure (visible body, no OpaqueSpec) — giving callers the same body-visible semantics functions had — and one with ensures (or a non-pure method) is opaque. The function and procedure builders have identical signatures, so only the constructor differs.

Requires a Strata with strata-org/Strata/#1408 (transparent-procedure support): the current pre-#1408 Strata rejects transparent non-functional procedures. Validated against the strata-org/Strata#1408 branch (removeFunctions, based on this submodule pin): @pure methods translate and verify; the residual test deltas are #1408's own diagnostic-wording / behaviour changes (e.g. "does not hold" -> "could not be proved"), matching the test updates #1408 made in Strata, not this change.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0.

Strata is removing Laurel `function`s (Strata PR #1408 "Remove functions");
transparent procedures take their place. jverify emitted a Laurel `function`
for every @pure method, so it will stop translating once functions are gone.

Emit a `procedure` instead. The transparency choice is unchanged: a @pure
method with no ensures becomes a *transparent* procedure (visible body, no
OpaqueSpec) — giving callers the same body-visible semantics functions had —
and one with ensures (or a non-pure method) is opaque. The `function` and
`procedure` builders have identical signatures, so only the constructor
differs.

Requires a Strata with #1408 (transparent-procedure support): the current
pre-#1408 Strata rejects transparent non-functional procedures. Validated
against the #1408 branch (`removeFunctions`, based on this submodule pin):
@pure methods translate and verify; the residual test deltas are #1408's own
diagnostic-wording / behaviour changes (e.g. "does not hold" -> "could not be
proved"), matching the test updates #1408 made in Strata, not this change.

Co-authored-by: Kiro <kiro-agent@users.noreply.github.com>
@tautschnig tautschnig self-assigned this Jul 2, 2026
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