Skip to content

Normalize rare lists for unary operations in rewrite engine#124

Open
caotic123 wants to merge 1 commit into
ufmg-smite:mainfrom
caotic123:fix/rare-list-unary-normalization
Open

Normalize rare lists for unary operations in rewrite engine#124
caotic123 wants to merge 1 commit into
ufmg-smite:mainfrom
caotic123:fix/rare-list-unary-normalization

Conversation

@caotic123

@caotic123 caotic123 commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Split off from #111 — second of two fixes for rare-list checking.

What

Adds 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

Reworks rewrite_meta_terms to 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 a RewriteContext (with in-progress tracking to avoid re-entrancy), replacing the previous non-caching recursion.

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 bpandreotti left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks great! But it's failing CI due to a formatting inconsistency, so please run cargo fmt to fix it.

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