Skip to main content

simplify

Function simplify 

Source
pub fn simplify(arena: &mut ExprArena, id: ExprId) -> ExprId
Expand description

Apply local algebraic simplifications to the subtree rooted at id, returning a (possibly fresh) ExprId that is observationally equivalent.

Current rules: constant folding for unary nodes and Pow. The linear fast-path is already canonical, so we leave Linear and n-ary Add/Mul alone.

TODO: Extend this once we add a CSE pass.