Normalize rare lists for unary operations in rewrite engine#124
Open
caotic123 wants to merge 1 commit into
Open
Normalize rare lists for unary operations in rewrite engine#124caotic123 wants to merge 1 commit into
caotic123 wants to merge 1 commit into
Conversation
Add the missing `get_rules` equations needed to normalize a rare list that appears as the sole argument of a unary `and`/`or`, and to collapse a singleton `and`/`or` to its argument: (And (RareList ..x..)) ~> (And x) (Or (RareList ..x..)) ~> (Or x) (And x) ~> x (Or x) ~> x Rework `rewrite_meta_terms` to drive these rules to a fixpoint: it now splices many-term (rare list) results into the parent operator's arguments, re-normalizes the rewritten arguments, and memoizes results via a `RewriteContext` (with in-progress tracking to avoid re-entrancy), replacing the previous non-caching recursion. Adds the `dd_check_cc_bvxor_xsimp` example (de Morgan under a binder, expected holey) as a regression test and fixture.
bpandreotti
approved these changes
Jun 17, 2026
bpandreotti
left a comment
Collaborator
There was a problem hiding this comment.
Looks great! But it's failing CI due to a formatting inconsistency, so please run cargo fmt to fix it.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Split off from #111 — second of two fixes for rare-list checking.
What
Adds the missing
get_rulesequations needed to normalize a rare list that appears as the sole argument of a unaryand/or, and to collapse a singletonand/orto its argument:Reworks
rewrite_meta_termsto drive these rules to a fixpoint: it splices many-term (rare list) results into the parent operator's arguments, re-normalizes the rewritten arguments, and memoizes results via aRewriteContext(with in-progress tracking to avoid re-entrancy), replacing the previous non-caching recursion.