Not All E-Graph Cycles Are Equal: Identifying Removable Cycles for Extraction
E-graph extraction requires an acyclic program, yet equality saturation naturally introduces cycles. Existing extractors either enforce acyclicity at additional solving cost or break cycles heuristically, potentially discarding optimal solutions. We show that not all e-graph cycles are equal. Some cycles can be eliminated losslessly by removing e-nodes that are intrinsically unrealizable (local-dead) or cannot participate in any legal extraction of the designated root (root-context-dead). The remaining cycles encode incompatible dependency orders among individually legal extractions, a property we call topological choice freedom. Breaking any such residual cycle through e-node deletion necessarily sacrifices a legal extraction. We formalize this distinction by establishing a bijection between legal DAG extractions and inclusion-minimal B-hyperpaths in a directed B-hypergraph, reducing dead-node identification to established hypernetwork problems. Local-dead e-nodes can be identified in polynomial time, while exact root-context analysis takes linear time on acyclic e-graphs but is NP-hard in general. Exhaustive validation on 1062 small e-graphs confirms that semantic pruning…
- arXiv
- 2612.04180
- Authors
- Bin Sun, Jing Ye, Huawei Li
- Categories
- cs.PL · cs.DS