Zulip Chat Archive
Stream: mathlib4
Topic: nsmul axioms of an additive group
Antoine Chambert-Loir (Mar 17 2024 at 16:40):
The definition of an additive commutative group contains the following field:
nsmul_succ : ∀ (n : ℕ) (x : G), AddMonoid.nsmul (n + 1) x = x + AddMonoid.nsmul n x
Is it written like this on purpose, with the two terms switched, rather than the more obvious
nsmul_succ : ∀ (n : ℕ) (x : G), AddMonoid.nsmul (n + 1) x = AddMonoid.nsmul n x + x
Eric Wieser (Mar 17 2024 at 16:46):
I think it's written this way because for to_additive
it is much easier if it matches docs#Group.npow_succ:
npow_succ : ∀ (n : ℕ) (x : G), Monoid.npow (n + 1) x = x * Monoid.npow n x
Eric Wieser (Mar 17 2024 at 16:46):
I guess probably both could be changed
Eric Wieser (Mar 17 2024 at 16:47):
The other important thing is that the lemma is true by definition for docs#nsmulRec
Antoine Chambert-Loir (Mar 17 2024 at 16:47):
Of course that matches, but this is bizarre, and does not match with Nat.pow_succ
, etc.
Antoine Chambert-Loir (Mar 17 2024 at 16:48):
nsmulRec should probably be changed in the same way…
Eric Wieser (Mar 17 2024 at 16:52):
I guess you could try changing it and seeing what breaks?
Antoine Chambert-Loir (Mar 17 2024 at 16:53):
OK.
Antoine Chambert-Loir (Mar 17 2024 at 16:56):
Oops, the file says:
-- use `x * npowRec n x` and not `npowRec n x * x` in the definition to make sure that
-- definitional unfolding of `npowRec` is blocked, to avoid deep recursion issues.
Eric Wieser (Mar 17 2024 at 16:56):
I have no idea what that means!
Sébastien Gouëzel (Mar 17 2024 at 16:58):
This dates back to Lean 3. I remember that npowRec n x * x
created weird issues while x * npowRec n x
didn't. It's possible that these issues have disappeared with Lean 4, so it's worth trying to see what happens!
Antoine Chambert-Loir (Mar 17 2024 at 16:58):
OK, so I try !
Antoine Chambert-Loir (Mar 19 2024 at 09:49):
I'm almost there, #11451, that was more painful than expected, especially because I exchanged the meanings of pow_succ
and pow_succ'
so that the unprimed version refers to the definition.
Last updated: May 02 2025 at 03:31 UTC