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

slow typeclass synthesis: takes 19000 heartbeats in to fail in `AddMonoidHomClass (ℂ →*₀ ℝ) ℂ ℝ`

semorrison opened this issue · comments

import Mathlib

open Complex in
/--
error: failed to synthesize
  AddMonoidHomClass (ℂ →*₀ ℝ) ℂ ℝ
(deterministic) timeout at 'typeclass', maximum number of heartbeats (19000) has been reached (use 'set_option synthInstance.maxHeartbeats <num>' to set the limit)
-/
#guard_msgs in
set_option synthInstance.maxHeartbeats 19000 in
example (z : ℂ) : normSq (-z) = normSq z := by simp

This then gets slightly worse after leanprover/lean4#3807, and thereafter causes the simpNF linter to fail on Complex.normSq_neg.