Zulip Chat Archive
Stream: mathlib4
Topic: upstreamableDecl linter bug
Kim Morrison (Nov 21 2024 at 21:23):
Try adding
import Mathlib.Tactic.Linter.UpstreamableLinter
and set_option linter.upstreamableDecl true
in Mathlib.Algebra.Group.Equiv.Basic
.
This incorrectly reports that
protected theorem congr_arg {f : MulEquiv M N} {x x' : M} : x = x' → f x = f x' :=
DFunLike.congr_arg f
can be moved up to Mathlib.Data.FunLike.Basic
, despite MulEquiv
only being defined in the current file.
(@Damiano Testa, @Anne Baanen)
Damiano Testa (Nov 21 2024 at 21:59):
I'll try to take a look tomorrow: my suspect is that MulEquiv
is a structure and not a def
and that may be confusing the linter. But I'm not at a computer now.
Anne Baanen (Nov 21 2024 at 22:00):
My dbg_trace
agrees with @Damiano Testa: all the definitions in the current file this depends on are structure
s and instance
s, not def
s.
Anne Baanen (Nov 21 2024 at 22:01):
Still, shouldn't this theorem transitively depend on an EquivLike
instance, whose type is not available in Funlike.Basic
?
Anne Baanen (Nov 21 2024 at 22:02):
The list of directly-depended on decls fir congr_arg
is:
deps: #[Lean.Parser.Command.declId,
Lean.Parser.Term.attributes,
congrArg,
Lean.Parser.Command.theorem,
Lean.Parser.Term.typeSpec,
Eq.rec,
«term_=_»,
Lean.Parser.Command.declSig,
Lean.Parser.Term.implicitBinder,
Lean.Parser.Term.attrInstance,
Lean.Parser.Term.attrKind,
Lean.Parser.Command.declaration,
Lean.Parser.Termination.suffix,
congr_arg,
Lean.Parser.Term.app,
MulEquiv,
Eq.refl,
Lean.Parser.Command.declValSimple,
Lean.Parser.Command.protected,
Lean.Parser.Command.declModifiers,
Lean.Parser.Term.arrow,
toAdditiveRest,
Eq,
to_additive,
rfl,
DFunLike.congr_arg]
Damiano Testa (Nov 21 2024 at 22:05):
It would probably be useful to expand the API a bit to have that trace split into def
s theorem
s,... and the syntax
, tactic
s (not exactly sure how granular to make it).
Damiano Testa (Nov 21 2024 at 22:05):
I may have time for this tomorrow, though I'm not sure.
Anne Baanen (Nov 21 2024 at 22:06):
Actually, picking some other declarations in that file at random, it seems like quite a few instances are missing. For example docs#MulEquivClass.map_mul doesn't report any instances except instHMul
...
Anne Baanen (Nov 22 2024 at 10:22):
Fix for the originally reported issue, where declarations depending on structures like MulEquiv
shouldn't get warnings: #19360.
Last updated: May 02 2025 at 03:31 UTC