perf: template the kernel's `replace` on its callback This PR speeds up the kernel's expression traversals (`instantiate`, `instantiate_rev`, `abstract`, `lift_loose_bvars`, `lower_loose_bvars`, `instantiate_lparams`). `replace_tpl` is `replace` templated on its callback, so the callback is inlined instead of being called through a `std::function` at every visited node. It also takes a `skip` predicate: subterms the callback would return unchanged are returned before the cache lookup. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This is the repository for Lean 4.
See Install Lean.
Please read our Contribution Guidelines first.
See Building Lean.