simplify_expression

Function simplify_expression 

Source
pub fn simplify_expression(expr: &TLExpr) -> TLExpr
Expand description

Simplify a logical expression using standard equivalences

Applies the following transformations:

  • Constant folding: Add(Constant(a), Constant(b)) => Constant(a + b)
  • Identity laws: AND(x, true) => x, OR(x, false) => x
  • Annihilation laws: AND(x, false) => false, OR(x, true) => true
  • Double negation elimination: NOT(NOT(x)) => x
  • Idempotent laws: AND(x, x) => x, OR(x, x) => x
  • Absorption laws: AND(x, OR(x, y)) => x
  • De Morgan’s laws: NOT(AND(x, y)) => OR(NOT(x), NOT(y))