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

WIP Syntactic simplifications #4022

Draft
wants to merge 16 commits into
base: master
Choose a base branch
from
Draft

Conversation

geo2a
Copy link
Collaborator

@geo2a geo2a commented Aug 8, 2024

Fixes #3861

@geo2a geo2a force-pushed the 4579-syntactic-simplifications branch 6 times, most recently from 76fa380 to bebd5c0 Compare August 13, 2024 12:34
rv-jenkins pushed a commit that referenced this pull request Aug 15, 2024
Refactor `applyRule` and `applyEquation` to check `requires`/`ensures`
in separate functions.

This will make reviewing
#4022 easier.
@geo2a geo2a force-pushed the 4579-syntactic-simplifications branch from bebd5c0 to c4a7dec Compare August 20, 2024 12:27
@geo2a geo2a force-pushed the 4579-syntactic-simplifications branch from 322432f to 908ddf6 Compare August 21, 2024 11:28
[] ->
unless (null restRequires') $
-- no more @syntacticRequires@, but unresolved conditions remain: abort
throwRemainingRequires currentSubst restRequires'
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we throw here?? i would expect at the base case to simply check the regular requires clauses...

Copy link
Collaborator Author

@geo2a geo2a Aug 22, 2024

Choose a reason for hiding this comment

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

As I understand, the simplifications marked as syntactic must be only applied "syntactically", which means their side condition must not go to Z3. If we do not stop here, we will proceed to trying to discharge a syntactic simplification as a regular one, and, as far as I understand, we do not want that. We want them either to succeed fast or to fail fast. @PetarMax do you agree?

Copy link
Collaborator Author

@geo2a geo2a Aug 22, 2024

Choose a reason for hiding this comment

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

Regarding the code: we never want to transfer control to checkRequiresSemantically from checkRequiresSyntactically.

Copy link
Collaborator Author

@geo2a geo2a Aug 22, 2024

Choose a reason for hiding this comment

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

So the semantics of the syntactic(1) attribute is:

  • the simplification is syntactic, Z3 is never called
  • the clause 1 is the driver clause which learns its variables from the known truth, and the the substitution for these learned variables is applied to all other clauses

I.e. the whole simplification is syntactic, not a clause of a simplification

Copy link
Contributor

Choose a reason for hiding this comment

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

So, for me, the clauses marked as syntactic should be checked syntactically, the other ones should be checked semantically. A simplification can have both syntactic and semantic clauses.

This still does mean, I think, that checkRequiresSyntactically should not call checkRequiresSemantically.

Copy link
Contributor

Choose a reason for hiding this comment

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

But also, all syntactics should be handled first, I think.

@geo2a
Copy link
Collaborator Author

geo2a commented Aug 22, 2024

Thanks @PetarMax, we'll modify the code to do that then.

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.

Improving pre-SMT reasoning capabilities
3 participants