Skip to content

Stop re-verifying prelude in pyAnalyzeLaurel#687

Open
MikaelMayer wants to merge 17 commits intomainfrom
feat/conservative-python-translation
Open

Stop re-verifying prelude in pyAnalyzeLaurel#687
MikaelMayer wants to merge 17 commits intomainfrom
feat/conservative-python-translation

Conversation

@MikaelMayer
Copy link
Copy Markdown
Contributor

@MikaelMayer MikaelMayer commented Mar 27, 2026

Summary

The prelude was being re-verified for every Python test file, wasting time and cluttering test output with 22 identical prelude lines per file.

Changes

Verifier (Strata/Languages/Core/Verifier.lean): When proceduresToVerify is set, after CallElim inlines contracts at call sites, drop every procedure not in the target list. Previously the second FilterProcedures used a stale call-graph closure and kept prelude procedures, causing them to be re-verified every time.

Expected files: All 39 expected_laurel test files updated — 22 prelude lines removed from each, DETAIL counts adjusted.

Prelude correctness is verified once by the dedicated PreludeVerifyTest.

Testing

  • lake build StrataMain passes
  • PreludeVerifyTest passes
  • Core verification tests pass (FailingAssertion, Axioms, AlwaysRunSMT, RemoveIrrelevantAxioms)

Two changes:

1. Verifier: when proceduresToVerify is set, after CallElim inlines
   contracts at call sites, drop every procedure not in the target
   list. Previously the second FilterProcedures used a stale
   call-graph closure and kept prelude procedures, causing them to
   be re-verified for every test file.

2. CLI: filter prelude results from pyAnalyzeLaurel output. Only
   user-specific obligations are displayed and counted in the
   summary. Prelude failures are still reported if they occur.
   Prelude correctness is checked once by PreludeVerifyTest.

All 39 expected_laurel test files updated (22 prelude lines removed
from each, DETAIL counts adjusted).
@MikaelMayer MikaelMayer force-pushed the feat/conservative-python-translation branch from aa0177b to 59b94eb Compare March 27, 2026 15:55
@MikaelMayer MikaelMayer changed the title Filter prelude results from pyAnalyzeLaurel CLI output Stop re-verifying prelude in pyAnalyzeLaurel Mar 27, 2026
@MikaelMayer MikaelMayer force-pushed the feat/conservative-python-translation branch from 59b94eb to 0f6bc8f Compare March 27, 2026 15:57
The verifier fix (dropping non-target procedures after CallElim)
is sufficient — no prelude VCs are generated, so CLI-level filtering
is unnecessary and could mask bugs.
@MikaelMayer MikaelMayer force-pushed the feat/conservative-python-translation branch from 0f6bc8f to fde0822 Compare March 27, 2026 15:58
PrecondElim generates precondition-check VCs at call sites within
user procedures that call prelude functions. These VCs inherit the
callee's metadata (empty file path = prelude). Filter them from the
displayed output and summary. Prelude failures are still reported.
PrecondElim generates WF-checking procedures for functions with
preconditions. Prelude functions (List_get, PFloorDiv, etc.) have
preconditions and were still in the program as .func declarations,
causing PrecondElim to generate VCs for them.

Strip preconditions from non-target functions before PrecondElim
so no WF procedures are generated for them. The function definitions
themselves are kept (needed for SMT encoding). Revert the CLI-level
filtering since the verifier fix is now sufficient.
PrecondElim must run before filtering so that call-site precondition
checks (e.g. List_get index bounds) are inserted into user procedure
bodies. The filter then discards WF-checking procedures and prelude
procedures, keeping only the target user procedures which now contain
all necessary precondition assertions.
@MikaelMayer MikaelMayer marked this pull request as ready for review March 27, 2026 17:58
@MikaelMayer MikaelMayer requested a review from a team March 27, 2026 17:58
Per review feedback, use FilterProcedures.run instead of a manual
filter to keep CachedAnalyses valid.
aqjune-aws
aqjune-aws previously approved these changes Mar 27, 2026
joscoh
joscoh previously approved these changes Mar 27, 2026
@aqjune-aws aqjune-aws enabled auto-merge March 27, 2026 22:54
@MikaelMayer MikaelMayer dismissed stale reviews from joscoh and aqjune-aws via 887106f March 27, 2026 23:08
Tests with only prelude results now produce empty verification
results after filtering.
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.

4 participants