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

Modification of simplify #174

Draft
wants to merge 3 commits into
base: tobias/simplifications
Choose a base branch
from

Conversation

janheuer
Copy link
Collaborator

@janheuer janheuer commented Dec 5, 2024

A formula "exists X (X = 1)" should be simplified to "#true" with the currently available simplifications, but using the simplify function this does not happen.

The problem is that the syntax tree is traversed once and the substitute_defined_variables simplification can only be applied when the root of the tree is reached. Therefore, the evaluate comparisons simplifications will not be applied as the root is not a comparison.

Instead of using a fixpoint algorithm it is sufficient to first apply substitute_defined_variables to the whole syntax tree and then use apply_all to apply all the other simplifications.

Of course a fixpoint algorithm is still necessary for more complicated examples (e.g. "exists X (X = 1 or exists Y (Y = 1 and Y != 1))" should simplify to "#true" but with the proposed modification it only simplifies to "#exists X (X = 1)", to reach "#true" it would require a second application of the simplify algorithm). But maybe this could still be useful as an option that:

  • simplifies more than just apply_all,
  • but only needs one additional traversal of the syntax tree instead of a full fixpoint algorithm.

@janheuer janheuer requested a review from teiesti December 5, 2024 09:10
@teiesti teiesti added this to the 2.0.0 milestone Feb 20, 2025
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