Zulip Chat Archive

Stream: mathlib4

Topic: dot notation


Kenny Lau (Oct 04 2025 at 21:27):

Should Polynomial.irreducible_X be Polynomial.Irreducible.X?

(the statement is Irreducible Polynomial.X)

Jireh Loreaux (Oct 04 2025 at 21:28):

How does that allow for dot notation?

Kenny Lau (Oct 04 2025 at 21:29):

presumably if you open Polynomial and your expected type is Irreducible X then you can just type .X

Kenny Lau (Oct 04 2025 at 21:29):

i suppose this is actually not very relevant because we don't have "stacked irreducible proofs"

Jireh Loreaux (Oct 04 2025 at 21:30):

Does that actually work?

Kenny Lau (Oct 04 2025 at 21:31):

it was more like for the Factors PR #30212 where if you have enough dot notations then you can prove Factors (3 * (X - 1) * (X - 4)) with .mul (.mul .ofNat .x_sub_one) .x_sub_ofNat

Kenny Lau (Oct 04 2025 at 21:32):

Jireh Loreaux said:

Does that actually work?

import Mathlib

open Polynomial

theorem Polynomial.Irreducible.X : Irreducible (X : [X]) :=
  irreducible_X

example : Irreducible (X : [X]) := .X

Jireh Loreaux (Oct 04 2025 at 21:32):

aha, I didn't realize anonymous dot notation respects open namespaces. Interesting.

Kenny Lau (Oct 04 2025 at 21:32):

it's a feature-bug

Kenny Lau (Oct 04 2025 at 21:33):

there are a few inconsistencies in its behaviour that is a bit annoying to me

Jireh Loreaux (Oct 04 2025 at 21:33):

Well, is it intended to be a feature, or is it actually a bug? Maybe you should ask about that in #lean4

Aaron Liu (Oct 04 2025 at 21:34):

there was a zulip thread about this

Aaron Liu (Oct 04 2025 at 21:34):

and I think there was also another one

Kenny Lau (Oct 04 2025 at 21:34):

@Jireh Loreaux I actually posted twice:

Kyle Miller (Oct 06 2025 at 14:35):

Kenny Lau said:

it's a feature-bug

It's a feature-feature (though if it causes big problems we'll reconsider)

Kenny Lau (Oct 06 2025 at 14:36):

well it isn't completely consistent

Kenny Lau (Oct 06 2025 at 14:36):

namely, it doesn't work with _root_

Kenny Lau (Oct 06 2025 at 14:37):

MWE:

axiom A.d : Nat  Nat

theorem A.bar : d 0 = d 0 := rfl

namespace C

theorem _root_.A.foo : d 0 = d 0 := rfl

end C

Kyle Miller (Oct 06 2025 at 14:39):

Right, that's the sort of thing discussed in the "dot notation and open" thread you discussed, if I remember correctly. There's still some work to do.

Kenny Lau (Oct 06 2025 at 14:41):

i thought i brought it up but i couldn't find it in the two threads I posted; should I just post again?

Kyle Miller (Oct 06 2025 at 14:42):

I'll just add a link to this thread for future reference, for the next time I get a chance to look at these name resolution issues.


Last updated: Dec 20 2025 at 21:32 UTC