Crux.Expression.RewriteRule.AssociativityLaw (crux v0.1.3)

Copy Markdown View Source

Rewrite rule that applies associativity optimizations to simplify expressions.

See: https://en.wikipedia.org/wiki/Associative_property

Applies the transformations:

  • A OR (A OR B) = A OR B
  • A OR B OR A = A OR B
  • A AND (A AND B) = A AND B
  • A AND B AND A = A AND B

The associativity optimizations leverage the associative property of boolean operations to eliminate redundant terms when the same expression appears multiple times in an associative context.