Skip to content

Commit 7a95488

Browse files
committed
perf(Analysis.Complex.Exponential): make Complex.exp an irreducible_def (leanprover-community#32599)
Recall that `irreducible_def` creates a declaration that is not unfolded by both the elaborator and the kernel (without some special effort). Currently, `UpperHalfPlane.isometry_vertical_line` takes a long time to type check in the kernel because it attempts to unfold `Real.exp` during whnf. Unfolding `Real.exp` quickly leads to unfolding `Complex.exp`. I don't think there is any good reason to want to unfold `Complex.exp` so this PR makes it an `irreducible_def`. Co-authored-by: Matthew Ballard <matt@mrb.email>
1 parent 666e433 commit 7a95488

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

Mathlib/Analysis/Complex/Exponential.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def exp' (z : ℂ) : CauSeq ℂ (‖·‖) :=
5757

5858
/-- The complex exponential function, defined via its Taylor series -/
5959
@[pp_nodot]
60-
def exp (z : ℂ) : ℂ :=
60+
irreducible_def exp (z : ℂ) : ℂ :=
6161
CauSeq.lim (exp' z)
6262

6363
/-- scoped notation for the complex exponential function -/
@@ -171,7 +171,7 @@ theorem exp_int_mul (z : ℂ) (n : ℤ) : Complex.exp (n * z) = Complex.exp z ^
171171

172172
@[simp]
173173
theorem exp_conj : exp (conj x) = conj (exp x) := by
174-
dsimp [exp]
174+
simp only [exp]
175175
rw [← lim_conj]
176176
refine congr_arg CauSeq.lim (CauSeq.ext fun _ => ?_)
177177
dsimp [exp', Function.comp_def, cauSeqConj]

MathlibTest/Recall.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ error: value mismatch
2727
has value
2828
id
2929
but is expected to have value
30-
fun z ↦ (Complex.exp' z).lim
30+
Complex.wrapped✝.1
3131
-/
3232
#guard_msgs in recall Complex.exp : ℂ → ℂ := id
3333

0 commit comments

Comments
 (0)