Zulip Chat Archive

Stream: mathlib4

Topic: Bug in `deprecate to`


Michael Rothgang (Jul 22 2024 at 12:58):

It seems I found a bug in deprecate to. Here's an MWE:

import Mathlib

open MeasureTheory

deprecate to Gamma_integrand_intervalIntegrable
private theorem Gamma_integrand_interval_integrable (s : ) {X : } (hs : 0 < s.re) (hX : 0  X) :
    IntervalIntegrable (fun x => (-x).exp * x ^ (s - 1) :   ) volume 0 X := by
  rw [intervalIntegrable_iff_integrableOn_Ioc_of_le hX]
  exact IntegrableOn.mono_set (Complex.GammaIntegral_convergent hs) Set.Ioc_subset_Ioi_self

Running this on the playground yields an error; in VS Code, the try this suggestion produces

private theorem Gamma_integrand_intervalIntegrable (s : ) {X : } (hs : 0 < s.re) (hX : 0  X) :
    IntervalIntegrable (fun x => (-x).exp * x ^ (s - 1) :   ) volume 0 X :=
  by
  rw [intervalIntegrable_iff_integrableOn_Ioc_of_le hX]
  exact IntegrableOn.mono_set (GammaIntegral_convergent hs) Ioc_subset_Ioi_self

@[deprecated (since := "2024-07-22")]
alias [anonymous] := Gamma_integrand_intervalIntegrable

which is off in two ways: the lemma name is missing, and the by is printed in the wrong place. CC @Damiano Testa

Damiano Testa (Jul 22 2024 at 13:00):

It looks like the modifier private confuses deprecate to: the name appears correctly filled in without private.

Damiano Testa (Jul 22 2024 at 13:02):

The formatting is an unfortunate consequence of the fact that the command relies on the pretty-printer for reproducing the declarations. That could possibly be avoided by editing the actual lines of the current file, but that may run into problems when the saved content is different from the currently edited file.

Damiano Testa (Jul 22 2024 at 13:04):

Btw, is there really the need to deprecate a private lemma? :smile:

Michael Rothgang (Jul 22 2024 at 13:05):

Damiano Testa said:

Btw, is there really the need to deprecate a private lemma? :smile:

Good question! I don't mind removing the alias...

Floris van Doorn (Jul 22 2024 at 13:31):

Let's not deprecate private lemmas

Damiano Testa (Jul 22 2024 at 13:34):

Btw, the error in the playground happens since the code is secretly running a shell command to get the current date. This makes the playground unhappy. You can add a string to override this:

deprecate to ... "string"
theorem ...

and string will be the date in since.


Last updated: May 02 2025 at 03:31 UTC