Skip to content

fix(core): isolate path conditions at the procedure boundary#1391

Merged
fabiomadge merged 2 commits into
reviewed-kbd-will-merge-to-mainfrom
fix/core-pathcond-leak-procedure-boundary
Jun 22, 2026
Merged

fix(core): isolate path conditions at the procedure boundary#1391
fabiomadge merged 2 commits into
reviewed-kbd-will-merge-to-mainfrom
fix/core-pathcond-leak-procedure-boundary

Conversation

@fabiomadge

@fabiomadge fabiomadge commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Fixes #1390.

Problem: Program.eval threads one Env through all procedures. A structured exit out of a labeled block doesn't pop its path-condition frames (.block exit pops exprEnv.state, not pathConditions; the exiting path bypasses Env.merge), so a procedure's preconditions/assumptions leak into later procedures. A contradictory leaked set then makes the next procedure prove false obligations vacuously — silent unsound pass. Laurel lowers non-final return to exit "$body", so ordinary early-return code hits it.

Fix: reset pathConditions to the pre-procedure state in the .proc fold (deferred obligations and fresh names carry forward). A .block-level reset was rejected — breaks fall-through.

Test: ProcedurePathConditionIsolation — unsatisfiable-precondition first + structured exit, second's assert false must fail. Red without the fix, green with it; full StrataTest green (539). Control matrix + scope in #1390.

@fabiomadge fabiomadge requested a review from a team as a code owner June 18, 2026 15:58
@fabiomadge fabiomadge changed the title fix(core): isolate path conditions at the procedure boundary (#1390) fix(core): isolate path conditions at the procedure boundary Jun 18, 2026
`Program.eval` threads one `Env` through every procedure in source order.
A path that leaves a labeled block via a structured `exit` does not get its
path-condition frames popped (the exiting path bypasses `Env.merge`), so a
procedure's preconditions and in-scope assumptions leaked into the next
procedure's verification context. When the leaked set was contradictory, the
next procedure proved false obligations vacuously — a silent green pass
(unsound). Laurel lowers every non-final `return` to a structured `exit`, so
ordinary early-return code triggered this.

Reset `pathConditions` to the pre-procedure state in the `.proc` fold so a
procedure's assumptions cannot leak into later procedures; carry deferred
obligations and the fresh-name set forward unchanged.

Adds ProcedurePathConditionIsolation regression test (first has an
unsatisfiable precondition + a structured exit; second's `assert false` must
fail, not silently pass). Full StrataTest stays green.

Fixes #1390
@fabiomadge fabiomadge force-pushed the fix/core-pathcond-leak-procedure-boundary branch from 3d90445 to 8e68ec8 Compare June 18, 2026 17:44
@fabiomadge fabiomadge requested a review from joscoh June 19, 2026 11:21
@fabiomadge fabiomadge added this pull request to the merge queue Jun 22, 2026
Merged via the queue into reviewed-kbd-will-merge-to-main with commit 064e019 Jun 22, 2026
18 checks passed
@fabiomadge fabiomadge deleted the fix/core-pathcond-leak-procedure-boundary branch June 22, 2026 23:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants