Zulip Chat Archive
Stream: mathlib4
Topic: closing rfl
Yury G. Kudryashov (Feb 28 2024 at 07:42):
I see some PRs replacing rfl
s with extra rw
s/simp_rw
s. Do we have a style guide about this?
Antoine Chambert-Loir (Feb 28 2024 at 08:08):
Sometimes, I finish by simp
because I guess that will work, without noticing rfl
would.
Yury G. Kudryashov (Feb 28 2024 at 08:09):
I was talking about intentional replacement of ; rfl
with extra rw
s.
Antoine Chambert-Loir (Feb 28 2024 at 08:09):
Is it possible to compare the compilation time: could one imagine that simp
would conclude faster than the mere rfl
.
Yury G. Kudryashov (Feb 28 2024 at 08:09):
If we want to do this, then we should add it to the style guide.
Kyle Miller (Feb 28 2024 at 08:13):
Can you point out examples of what you're talking about?
Yury G. Kudryashov (Feb 28 2024 at 08:14):
Yury G. Kudryashov (Feb 28 2024 at 08:15):
Kyle Miller (Feb 28 2024 at 08:24):
I'd guess that these are avoiding some defeq abuses, but it'd be good to ask @Ruben Van de Velde what's being tidied.
Ruben Van de Velde (Feb 28 2024 at 08:46):
Yeah, these all count as defeq abuse in my opinion
Eric Wieser (Feb 28 2024 at 09:51):
Removing trailing rfl
s is a nice way of confirming that we're not missing API lemmas
Antoine Chambert-Loir (Feb 28 2024 at 09:56):
Oh! Do you believe that rfl
-lemmas should exist to do the rewriting we need to?
Ruben Van de Velde (Feb 28 2024 at 10:18):
Yeah (and they generally do)
Yury G. Kudryashov (Feb 28 2024 at 18:23):
Ruben Van de Velde said:
Yeah, these all count as defeq abuse in my opinion
Can you elaborate? Does any non-reducible rfl
count as defeq abuse or not?
Kyle Miller (Feb 28 2024 at 18:54):
We don't have any codified rules for this, but this is roughly how I've thought about it:
- If defeq needs to unfold a non-reducible definition, and this happens inside the API boundary for the mathematical theory, then it is OK. This usually necessary to set up the API.
- If defeq needs to unfold a non-reducible definition, and the documentation clearly says that what this definition unfolds to is part of the API for the mathematical theory, then it is OK. This happens sometimes, for example with
Function.Injective
and many other predicates, orNat.succ n =?= n + 1
, though these aren't necessarily documented yet. Here is an example of an API defeq in a docstring.
A problem though is that there's often not a really a clear API boundary for theories.
Matthew Ballard (Feb 28 2024 at 18:55):
I think some clear guidelines would be helpful and Kyle’s suggestions are a good start.
Last updated: May 02 2025 at 03:31 UTC