Zulip Chat Archive

Stream: lean4

Topic: namespace shenanigans


Kenny Lau (Aug 19 2025 at 21:53):

axiom A.b : Nat

theorem A.h₁ : b = 0 := sorry -- correctly resolves to A.b

namespace E

theorem _root_.A.h₂ : b = 0 := sorry -- does not recognise b

end E

Leni Aniva (Aug 19 2025 at 22:59):

why should this resolve to b? To avoid surprises a definition should work the same way regardless of the name of the decl

Kenny Lau (Aug 19 2025 at 23:00):

for me it's the opposite, because when I write _root_.A i almost always mean "i actually wanted this to be under the namespace A but i was too lazy", so I would expect it to behave as if it was in the namespace A

Kyle Miller (Aug 20 2025 at 00:03):

issue lean4#9445 is possibly addressing this

Kenny Lau (Aug 21 2025 at 10:43):

Leni Aniva said:

why should this resolve to b? To avoid surprises a definition should work the same way regardless of the name of the decl

well this is false already, because in the above you can see how the name A.h₁ causes b to be resolved to A.b

Niels Voss (Aug 21 2025 at 17:40):

That's not my favorite design choice, but since it is already in Lean we should be consistent and adopt it for _root_ decls as well


Last updated: Dec 20 2025 at 21:32 UTC