Zulip Chat Archive
Stream: general
Topic: Namespaces for ring lemmas
Michael Stoll (Aug 09 2022 at 17:10):
There is
theorem neg_add_eq_sub {α : Type u_1} [subtraction_comm_monoid α] (a b : α) :
-a + b = b - a
in the root name space and defined in algebra.group.basic
, but
theorem tactic.ring.add_neg_eq_sub {α : Type u_1} [add_group α] (a b : α) :
a + -b = a - b
in the tactic.ring
namespace and defined in tactic.ring
.
Is there a (good) reason for this asymmetry?
(There are a few other statements in tactic.ring
that look like they should be in algebra.group.basic
or a similar file.)
Ruben Van de Velde (Aug 09 2022 at 17:21):
You can ignore the lemmas in thetactic.ring
namespace, they only exist to be used by the ring
tactic
Michael Stoll (Aug 09 2022 at 17:26):
But add_neg_eq_sub
does not seem to exist somewhere else (and I just needed it).
Michael Stoll (Aug 09 2022 at 17:27):
suggest
told me that the statement is tactic.ring....
.
Yaël Dillies (Aug 09 2022 at 17:52):
Michael Stoll (Aug 09 2022 at 17:54):
Thanks. Why is neg_add_eq_sub
in the other direction?
Yaël Dillies (Aug 09 2022 at 18:30):
docs#sub_eq_neg_add also exists. Not sure why neg_add_eq_sub
is reversed.
Eric Wieser (Aug 09 2022 at 19:21):
Tactics often come with peculiarly stated lemmas simply because it's much easier to run the elaborator outside the tactic than it is to build complex term mode proofs within it
Eric Wieser (Aug 09 2022 at 19:22):
(in my experience, largely due to `(_)
notation not working with universe metavariables)
Yaël Dillies (Aug 09 2022 at 19:30):
That explains docs#tactic.ring.add_neg_eq_sub, not docs#neg_add_eq_sub.
Mario Carneiro (Aug 09 2022 at 22:33):
Eric Wieser said:
Tactics often come with peculiarly stated lemmas simply because it's much easier to run the elaborator outside the tactic than it is to build complex term mode proofs within it
It's also significantly more efficient. In many cases you don't even need to call the elaborator at all, you just call expr constructors directly
Eric Wieser (Aug 09 2022 at 23:17):
Ah, the point being that everything is elaborated once at startup rather than on each tactic invocation?
Last updated: Dec 20 2023 at 11:08 UTC