Skip to main content

optimize

Function optimize 

Source
pub fn optimize(ast: Comprehension) -> Comprehension
Expand description

Top-level optimizer entry. Applies the R-rule catalog to a fixed point and returns the optimized AST.

Per spec §10.6 the function is total — it never rejects. Validation (V1–V9) must run before this; the optimizer assumes its input is well-formed.

The optimizer is a thin loop over the reducibility analyzer (§10.10): ask analyze_reducibility for a finding; apply its witness if non-empty; repeat. The empty finding ends the loop.