Expand description
Simplify NOT expressions in physical expressions
This module provides optimizations for NOT expressions such as:
- Double negation elimination: NOT(NOT(expr)) -> expr
- NOT with binary comparisons: NOT(a = b) -> a != b
- NOT with IN expressions: NOT(a IN (list)) -> a NOT IN (list)
- De Morgan’s laws: NOT(A AND B) -> NOT A OR NOT B
- Constant folding: NOT(TRUE) -> FALSE, NOT(FALSE) -> TRUE
This function is designed to work with TreeNodeRewriter’s f_up traversal, which means children are already simplified when this function is called. The TreeNodeRewriter will automatically call this function repeatedly until no more transformations are possible.
Functions§
- simplify_
not_ expr - Attempts to simplify NOT expressions by applying one level of transformation