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

improve the error message about expanding powersets #2969

Merged
merged 5 commits into from
Aug 25, 2024
Merged

Conversation

konnov
Copy link
Collaborator

@konnov konnov commented Aug 25, 2024

This PR simply improves error reporting for the case when SUBSET _ has to be expanded to a very large set:

  • Reporting a normal error RewriterKnownLimitationError instead of RewriterException, which would ask the user to file a bug report
  • Printing a few hints about fixing the issue
  • Tests added for any new code
  • Ran make fmt-fix (or had formatting run automatically on all files edited)
  • Entries added to ./unreleased/ for any new functionality

Currently, the source location of the problematic code is not properly identified, due to multiple iterations of the rewriter. We could try to recover the source location when unwinding the rewriting stack. However, this would require a more careful refactoring.

@konnov konnov requested review from Kukovec and thpani and removed request for rodrigo7491 August 25, 2024 12:29
Copy link
Collaborator

@thpani thpani left a comment

Choose a reason for hiding this comment

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

LGTM, although I don't understand why we keep the bound as the size of the expanded set, see below

+ " \\A S \\in SUBSET T: P or \\E S \\in SUBSET T: P")
logger.error("Try to decrease the cardinality of the base set T, or avoid enumeration.")
val msg =
s"Attempted to expand SUBSET of size 2^${elems.size}, whereas the built-in limit is ${Limits.POWSET_MAX_SIZE}"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Printing 1048576 here may look confusing to the user.

Why not store Limits.POWSET_MAX_SIZE as the number of elements?
Then you can directly compare elems.size above and print it here as a power of 2.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That's true. I will fix that :)

@konnov konnov enabled auto-merge August 25, 2024 18:50
@konnov konnov merged commit a16432d into main Aug 25, 2024
10 checks passed
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.

2 participants