Zulip Chat Archive
Stream: lean4
Topic: bne_assoc
Violeta Hernández (Sep 08 2024 at 11:41):
I'm doing some Lean 4 programming and I stumbled across this: docs#Bool.bne_assoc is a simp
lemma
Violeta Hernández (Sep 08 2024 at 11:43):
I don't really think this makes sense? For starters, associativity isn't the kind of stuff you really consider to be simplified one way or the other. But more annoyingly, this lemma is backwards! The Mathlib (Lean?) convention is that x * y * z
means (x * y) * z
.
Violeta Hernández (Sep 08 2024 at 11:44):
(minor note, a bit later down that file it says "coercision" instead of "coercion")
Daniel Weber (Sep 08 2024 at 11:46):
It's not backwards, it's in the same direction as docs#add_assoc, it just shouldn't be a simp lemma (btw, most operations being left-associative by default is a general programming thing, it's not specific to Lean)
Kevin Buzzard (Sep 08 2024 at 11:53):
Violeta Hernández (Sep 08 2024 at 12:02):
Speaking of Beq
jank
Violeta Hernández (Sep 08 2024 at 12:02):
!x == y
parses as !(x == y)
, for whatever reason
Violeta Hernández (Sep 08 2024 at 12:05):
Admittedly it's not a big deal since these are logically equivalent, but it's still annoying
Kim Morrison (Sep 19 2024 at 00:29):
Trying out removing @[simp] from bne_assoc at lean#5390.
François G. Dorais (Sep 19 2024 at 02:16):
This is an ongoing issue about xor
or bne
for Bool
. They do the same thing for Bool
but they aren't actually synonymous. There are several old discussions about this on zulip and github. I can try to dig them up if needed.
Anyway, the core problem is that Bool.xor
is an abbrev
and therefore reducible. Because of this we can't separate Bool.xor_assoc
, which makes perfect sense, from Bool.bne_assoc
, which is dubious at best. The best solution is to make xor
semireducible but that will require a reorganization of the Bool
simp lemmas.
Eric Wieser (Sep 19 2024 at 10:07):
Kim Morrison said:
Trying out removing @[simp] from bne_assoc at lean#5390.
I guess this didn't succeed?
Kim Morrison (Sep 19 2024 at 23:59):
Yeah, it was a mess, and should be fixed by changing Bool.xor
to not be an abbrev
. I'm not super excited about doing that right now.
Last updated: May 02 2025 at 03:31 UTC