Zulip Chat Archive
Stream: batteries
Topic: lemma notation
Eric Wieser (Oct 03 2024 at 14:34):
Both docs#lemma and docs#Batteries.Tactic.Lemma.lemmaCmd exist; should the second one have lower priority to avoid ambiguous parsing?
Mario Carneiro (Oct 03 2024 at 14:40):
the second first one should not exist, it should have been removed when lemmaCmd was merged
Mario Carneiro (Oct 03 2024 at 14:43):
actually, it looks like the implementation is not ideal for the mathlib use case - turning an option on would affect only mathlib and not its dependents, and the docstring on lemma
is also not very good if lang.lemmaCmd
option is enabled
Eric Wieser (Oct 03 2024 at 14:43):
Mario Carneiro said:
when lemmaCmd was merged
Are you talking about a different lemmaCmd
to docs#Batteries.Tactic.Lemma.lemmaCmd, which you say should be removed ?
Mario Carneiro (Oct 03 2024 at 14:43):
the easiest way to get desired behavior in mathlib is indeed to just make the priority of lemma
slightly higher than default
Mario Carneiro (Oct 03 2024 at 14:45):
I think we need to rethink this implementation in batteries, it's not that easy to just flip a switch and turn on the command
Eric Wieser (Oct 03 2024 at 14:49):
What's the default notation priority?
Mario Carneiro (Oct 03 2024 at 14:50):
default
Mario Carneiro (Oct 03 2024 at 14:50):
you can write default+1
Mario Carneiro (Oct 03 2024 at 14:50):
maybe it would be better to just have batteries provide a function which does the equivalent of the present mathlib definition line called enableLemmaGlobally
, and then mathlib can call it. That way we can centralize the metaprogramming machinery involved in one place
François G. Dorais (Oct 03 2024 at 14:56):
I don't understand why this needs to be a transitive option.
Mario Carneiro (Oct 03 2024 at 14:57):
batteries can provide both options
Damiano Testa (Oct 03 2024 at 14:57):
What happens if a downstream project opens a mathlib file with a lemma
: would that parse?
Mario Carneiro (Oct 03 2024 at 14:58):
it's a mathlib choice whether it wants to do it globally or only within mathlib
Mario Carneiro (Oct 03 2024 at 14:58):
@Damiano Testa yes, lake respects project-local options
Mario Carneiro (Oct 03 2024 at 15:00):
I suspect that mathlib will either want to enable it globally, or add lang.lemmaCmd
to the math
template in lake (but there will still be a backwards incompatibility in this case for all projects downstream of mathlib using lemma
today)
Mario Carneiro (Oct 03 2024 at 15:01):
For the project-local option, there is still the issue of the bad docstring though, I don't know any way to script around this issue
Mario Carneiro (Oct 03 2024 at 15:02):
I think we just need to make the docstring more ambiguous so that it reads okay for either possible setting of lang.lemmaCmd
François G. Dorais (Oct 03 2024 at 15:04):
The docstring in Batteries could be the same as in Mathlib. The error message is enough if the lemma option is not on. No?
Damiano Testa (Oct 03 2024 at 15:04):
If the option is not turned on, lemma
is still a parse error, so maybe the doc-string in Batteries could be the one in mathlib. After all, lemma is still a "small" theorem...
Mario Carneiro (Oct 03 2024 at 15:11):
actually no, it's an elaboration time error now rather than a parse error. That's actually the reason for adding it to batteries in the first place: when it's a parse error you get much worse errors talking about applications and stuff
François G. Dorais (Oct 05 2024 at 21:36):
I don't see a definite plan after this discussion. Would someone volunteer to make an issue on Batteries?
PS: With more maintainers on Batteries, we can make better use of issues. This is still a TODO for now but we will get to it!
Eric Wieser (Oct 05 2024 at 21:41):
Mario Carneiro said:
the easiest way to get desired behavior in mathlib is indeed to just make the priority of
lemma
slightly higher than default
Is this a sensible immediate plan?
Mario Carneiro (Oct 05 2024 at 22:44):
yes, if it's causing issues please do that
Eric Wieser (Oct 08 2024 at 09:47):
Last updated: May 02 2025 at 03:31 UTC