Merged
Conversation
joscoh
reviewed
Mar 24, 2026
shigoel
reviewed
Mar 25, 2026
shigoel
previously approved these changes
Mar 25, 2026
Don't depend on a specific counterexample
joscoh
approved these changes
Mar 26, 2026
shigoel
approved these changes
Mar 26, 2026
olivier-aws
pushed a commit
that referenced
this pull request
Mar 30, 2026
This PR implements several previously-opaque functions in the `Strata/SimpleAPI.lean` and consolidates the verification entry point. ### Changes Implemented Simple API functions: - `genericToCore` — translates a generic `Strata.Program` to` Core.Program` using `Core.getProgram` - `genericToLaurel` — translates a generic `Strata.Program` to `Laurel.Program` using `Laurel.parseProgram` - `laurelToCore` — translates a `Laurel.Program` to `Core.Program` using the existing Laurel translator - `Core.inlineProcedures` — inlines procedure calls with a configurable predicate controlling which calls to inline - `Core.loopElimUsingContract` — eliminates loops by replacing them with invariant- based assertions/assumptions - `Core.callElimUsingContract` — eliminates procedure calls by replacing them with contract-based assertions/assumptions - `Core.verifyProgram` — runs deductive verification on a Core program (replaces the standalone `verifyCore`) Structural changes: - `Core.InlineTransformOptions` is now a concrete structure with an optional `doInline` predicate, rather than an opaque type - Removed the standalone `verifyCore` function; its logic is now in `Core.verifyProgram` under the `Core` namespace - Renamed `Core.loopElimWithContract` → `Core.loopElimUsingContract` and `Core.callElimWithContract` → `Core.callElimUsingContract` - Trimmed unnecessary imports from `SimpleAPI.lean` and `StrataMain.lean` - Fixed a docstring typo (Core dialect → Laurel dialect for `genericToLaurel`) Transform module workarounds: - Added top-level aliases `coreCallElimCmd` and `coreInlineCallCmd` in `CallElim.lean` and `ProcedureInlining.lean` to work around the Core module/dialect name collision Dogfooding in `StrataMain`: - Updated `pyAnalyzeCommand` to use `Core.inlineProcedures` instead of calling the transform directly - Updated `pyAnalyzeLaurelCommand` to use `Core.verifyProgram` instead of `Strata.verifyCore` ### Motivation The Simple API was originally sketched with opaque declarations to define the intended surface. This PR makes the majority of those functions concrete, moving the API closer to being usable by external clients. The remaining `noncomputable opaque` functions depend on DDM functionality that is not yet available. By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice. --------- Co-authored-by: Josh Cohen <36058610+joscoh@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR implements several previously-opaque functions in the
Strata/SimpleAPI.leanand consolidates the verification entry point.Changes
Implemented Simple API functions:
genericToCore— translates a genericStrata.ProgramtoCore.ProgramusingCore.getProgramgenericToLaurel— translates a genericStrata.ProgramtoLaurel.ProgramusingLaurel.parseProgramlaurelToCore— translates aLaurel.ProgramtoCore.Programusing the existingLaurel translator
Core.inlineProcedures— inlines procedure calls with a configurable predicatecontrolling which calls to inline
Core.loopElimUsingContract— eliminates loops by replacing them with invariant-based assertions/assumptions
Core.callElimUsingContract— eliminates procedure calls by replacing them withcontract-based assertions/assumptions
Core.verifyProgram— runs deductive verification on a Core program (replacesthe standalone
verifyCore)Structural changes:
Core.InlineTransformOptionsis now a concrete structure with an optionaldoInlinepredicate, rather than an opaque typeverifyCorefunction; its logic is now inCore.verifyProgramunder theCorenamespaceCore.loopElimWithContract→Core.loopElimUsingContractandCore.callElimWithContract→Core.callElimUsingContractSimpleAPI.leanandStrataMain.leangenericToLaurel)Transform module workarounds:
coreCallElimCmdandcoreInlineCallCmdinCallElim.leanand
ProcedureInlining.leanto work around the Core module/dialect name collisionDogfooding in
StrataMain:pyAnalyzeCommandto useCore.inlineProceduresinstead of calling thetransform directly
pyAnalyzeLaurelCommandto useCore.verifyPrograminstead ofStrata.verifyCoreMotivation
The Simple API was originally sketched with opaque declarations to define the
intended surface. This PR makes the majority of those functions concrete, moving
the API closer to being usable by external clients. The remaining
noncomputable opaquefunctions depend on DDM functionality that is not yetavailable.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.