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 comprehension_forms.md §10.6 the function is total — it never rejects. Validation (V1–V9) runs on the tree as written, before this; the optimizer assumes its input is well-formed and keeps it so.

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.