leanprover-community / mathlib4

The math library of Lean 4

Home Page:https://leanprover-community.github.io/mathlib4_docs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tracking issue for `set_option backward.isDefEq.lazyWhnfCore false`

semorrison opened this issue · comments

This option disables the changes to isDefEq introduced in leanprover/lean4#4004, and is still sometimes necessary in Mathlib.

It would be great to reduce our reliance on this backwards compatibility flag.

This may involve

  • just reducing the reliance on defeq in the affected theorems (i.e. more rewrites, less rfl/convert/...)
  • producing minimized examples of the places in Mathlib where the old behaviour is required for performance.
    • leanprover/lean4#4023 is an example of one such minimization, and we're looking at that now. Optimistically a fix is possible, and it will improve behaviour for more than just one of these flags.

(See all occurrences on Mathlib's master.)

You can remove some of these (the non-binop related ones) if Lean caches defeq results allowing for level metavariables in the longer laster .permanent cache. Caching metavariables seems like a bad idea on its face but it seems that for level metavariables there are more potential cache hits and few enough level metavariables arising that it is a moderate performance improvement.