Commit 2026-01-21 13:58 f9ba1f9d

View on Github →

refactor(translate): merge expand into applyReplacementFun (#33236) This PR refactors the main translation loop (applyReplacementFun) of to_additive /to_dual so that it operates on free variables instead of loose bound variables. This will make it much easier to implement the reordering of arguments of arguments, which is something we need for to_dual. The other loop that was run beforehand, expand, was separate because it required free variables instead of loose bound variables, but now it won't make sense anymore to have it be a separate loop, so I've merged it into the applyReplacementFun implementation. Ideally, we would want to use Meta.transform for this, but unfortunately this isn't good enough, because we need more control over when to do recursive calls. So, we copy/inline the implementation of Meta.transform.

Estimated changes