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

Copy Markdown View Source

Rewrite rule that applies complement laws to simplify expressions.

See: https://en.wikipedia.org/wiki/Boolean_algebra#Complement

Applies the transformations:

  • A OR NOT A = true (law of excluded middle)
  • NOT A OR A = true (law of excluded middle)
  • A AND NOT A = false (law of contradiction)
  • NOT A AND A = false (law of contradiction)
  • (A AND B) OR (A AND NOT B) = A (complement distribution)
  • (A OR B) AND (A OR NOT B) = A (complement distribution)

The complement laws handle expressions involving logical complements, detecting contradictions, tautologies, and simplifying distributive patterns with complements.