Skip to content
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 first pass of proof obligation description expressions #5317

Merged
merged 18 commits into from
Apr 20, 2024

Conversation

alex-chew
Copy link
Contributor

@alex-chew alex-chew commented Apr 12, 2024

Description

Adds a first pass of proof obligation description expressions, towards resolving #2987. It also adds a new hidden option, --show-proof-obligation-expressions, which adds to each (supported) failed proof obligation error message an equivalent Dafny assertion. This option is used to automate test for the newly added proof obligation description expressions, but this PR does not backfill tests for existing PODesc expressions.

By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.

@alex-chew alex-chew requested a review from atomb April 13, 2024 00:32
Copy link
Member

@atomb atomb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are enough of these now that it might be worth adding a flag to show the asserted expression for every proof failure. We could leave it as a hidden option until we've filled out all the options, but that would allow us to have tests for each proof obligation type as we go along.

Source/DafnyCore/Verifier/BoogieGenerator.Types.cs Outdated Show resolved Hide resolved
@alex-chew alex-chew requested a review from atomb April 19, 2024 22:04
@alex-chew alex-chew marked this pull request as ready for review April 19, 2024 22:08
Copy link
Member

@atomb atomb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! The one change I suggested is extremely small. :)

Source/DafnyCore/Pipeline/Compilation.cs Outdated Show resolved Hide resolved
@@ -46,6 +46,7 @@ public static class ErrorReporterExtensions {
private const string RelatedLocationCategory = "Related location";
public const string RelatedLocationMessage = RelatedLocationCategory;
private const string RelatedMessageCategory = "Related message";
public const string AssertedExprCategory = "Asserted expression";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love that this fits in nicely with the existing reporter infrastructure!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed - for a while I thought I might need to make changes in Boogie itself in order to propagate the necessary expressions, but this worked out nicely.

atomb
atomb previously approved these changes Apr 19, 2024
@atomb atomb enabled auto-merge (squash) April 19, 2024 22:53
@atomb atomb merged commit 2e6a08c into master Apr 20, 2024
20 checks passed
@atomb atomb deleted the alexchew/easy-po-descs branch April 20, 2024 00:29
@@ -380,6 +380,8 @@ public enum IncludesModes {
[CanBeNull] private TestGenerationOptions testGenOptions = null;
public bool ExtractCounterexample = false;

public bool ShowProofObligationExpressions = false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't add any fields to DafnyOptions, nor use DafnyOptions.RegisterLegacyBinding. The right way is to use DafnyOptions.RegisterLegacyUI.

Could you fix this is your next related PR?

@@ -11,7 +11,7 @@ public static class ErrorReporterExtensions {
var usingSnippets = reporter.Options.Get(Snippets.ShowSnippets);
var relatedInformation = new List<DafnyRelatedInformation>();
foreach (var auxiliaryInformation in error.Aux) {
if (auxiliaryInformation.Category == RelatedMessageCategory) {
if (auxiliaryInformation.Category == RelatedMessageCategory || auxiliaryInformation.Category == AssertedExprCategory) {
Copy link
Member

@keyboardDrummer keyboardDrummer May 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather not add code to a generic location such as ReporterExtensions to support a specific use-case (this PR). Did you consider using the existing RelatedMessageCategory ?

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.

None yet

3 participants