-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add an experimental backend that uses Lean to discharge goals #850
Merged
Merged
Changes from 27 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
bf36ddf
Translator sufficient for Bubble.bpl to typecheck
atomb 8309d33
Now Bubble.bpl verifies after translation
atomb 4b2eb9e
Control Lean printing with an option
atomb 89b3595
Translator sufficient to verify all but one textbook example
atomb f6f8ff6
Reorganize unsupported overrides
atomb 637c415
Various improvements
atomb e4c34dc
Successfully process trivial Dafny program
atomb 2556b26
Cleanups
atomb 7049b6d
Update exception messages
atomb b2c5b14
Move prelude to external file
atomb d2193dd
Add configuration files to check Prelude.lean
atomb 7c096c0
Cleanup comments, strings, exceptions
atomb 7fea48d
Clean up error handling
atomb 05b616c
Reorder cases and improve error messages
atomb 005d80d
Add test suite for LeanAuto backend
atomb df6bb76
Add README for LeanAuto
atomb 6628fea
Add workflow to test the LeanAuto backend
atomb 300ed90
Fill in proofs and definitions in Lean prelude
atomb 359da35
Clean up lakefile
atomb 4fc941d
Fix Lean installation
atomb bf46f95
Change setup-lean action name
atomb 154fee4
Ensure Lean dependencies are actually built
atomb 9d58eb5
Pin the version of lean-auto for reproducibility
atomb 2896020
Merge remote-tracking branch 'upstream/master' into basic-lean-auto
atomb a2a40d6
Rename LeanGenerator -> LeanAutoGenerator
atomb 49e1eec
Rename some methods
atomb 2f8b3a9
Move use of passive program to a separate method
atomb fd7b4c9
Clarify comment
atomb dd8359f
Merge remote-tracking branch 'upstream/master' into basic-lean-auto
atomb dc6b667
Merge branch 'master' into basic-lean-auto
atomb 4cc7547
Generalized processing of passive programs
atomb 29979dc
Allow `goto` to have no targets
atomb fbafb12
Use `foreach` instead of `ForEach`
atomb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: LeanAuto CI | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
tags: | ||
- 'v*' | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
job0: | ||
name: LeanAuto CI | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Setup dotnet | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: '6.0.x' | ||
- name: Setup Z3 | ||
uses: cda-tum/setup-z3@v1 | ||
with: | ||
version: 4.12.5 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Checkout Boogie | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Install tools, build Boogie | ||
run: | | ||
dotnet tool restore | ||
dotnet build -warnaserror Source/Boogie.sln | ||
- name: Setup Lean | ||
uses: Julian/setup-lean@v1 | ||
with: | ||
# Lean version will be chosen based on Test/lean-auto/lean-toolchain | ||
default-toolchain-file: Test/lean-auto/lean-toolchain | ||
- name: Test Lean generator on textbook examples | ||
working-directory: Test/lean-auto | ||
run: | | ||
lake build | ||
./testall.sh |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.lake | ||
lake-manifest.json |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Library</OutputType> | ||
<AssemblyName>Boogie.Provers.LeanAuto</AssemblyName> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\BaseTypes\BaseTypes.csproj" /> | ||
<ProjectReference Include="..\..\CodeContractsExtender\CodeContractsExtender.csproj" /> | ||
<ProjectReference Include="..\..\Core\Core.csproj" /> | ||
<ProjectReference Include="..\..\VCGeneration\VCGeneration.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="System.Linq.Async" Version="6.0.1" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<EmbeddedResource Include="Prelude.lean"> | ||
<LogicalName>Prelude.lean</LogicalName> | ||
</EmbeddedResource> | ||
</ItemGroup> | ||
|
||
</Project> |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this comment. These lines seems contradictory, both saying that
processedProgram.Program
is an already passified program, and that it's not yet passified because that only happens during verification.By the way, what step do you mean by "verification" in the context of Boogie? The whole pipeline could be considered verification.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I mean is that
ProcessPassiveProgram
needs to be called afterVerifyEachImplementation
instead of before, becauseVerifyEachImplementation
turnsprocessedProgram
into a passive program, destructively. I would love it if everything happened inPreProcessProgramVerification
, but it doesn't right now, and I think it'd take a pretty big refactoring to get it there.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, if you change
verification
tocalling VerifyEachImplementation
in the comment, then it would be more clear to me.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw, extracting out the passive-ication is already done in the method
vcGenerator.PrepareImplementation
, although it only does it for a single implementation.GetVerificationTasks
gives an example of how to call it. Maybe you want to use that, so you don't have to actually generate SMT each time?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would generally make sense to generate Lean code as an alternative to SMT-Lib, so it could make sense for it to be called from the
VCGeneration
package. I took a stab at refactoring things to do that, but as things currently stand there are two issues:VCGeneration
package, and we can't create a cyclic dependency.I think it's possible to refactor things further to not require that cyclic dependency, and I'm considering whether the Lean generator should work on a per-implementation basis, but I think I'd prefer to leave both for a future PR (probably one in the pretty near future, though).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To me it's already a problem that
ExecutionEngine
is calling out toLeanGenerator
, because it bloats the scope ofExecutionEngine
.I would go for the combination of my previous two suggestions, to remove the dependency of ExecutionEngine on LeanGenerator, and make use of
vcGenerator.PrepareImplementation
Change
Into
Note that both Houdini and Lean are no longer mentioned.
Then instead of setting
LeanFile
, setOptions.UseResolvedProgram
with:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this approach, and I've pushed some changes that go in roughly that direction.