Zulip Chat Archive

Stream: CSLib

Topic: New name conflict with mathlib


Ching-Tsun Chou (Jan 26 2026 at 20:14):

After the recent toolchain bump to v4.27.0, a theorem name used in my PR cslib#278, IsRegular.mul, becomes in conflict with a mathlib theorem:
https://leanprover-community.github.io/mathlib4_docs/Mathlib/Algebra/Regular/Basic.html#IsRegular.mul
But git blame on the above mathlib file tells me that that theorem has been in existence since 2024. So what change in v4.27.0 has caused this name conflict?

Jireh Loreaux (Jan 26 2026 at 20:16):

I'm speaking without any knowledge here, but if I were guessing: it's that the Mathlib declaration was not previously imported in CSLib, but now is.

Ching-Tsun Chou (Jan 26 2026 at 20:23):

I doubt it. I did git grep -I Mathlib.Algebra in cslib commits before and after the toolchain bump and didn't see any difference.

Eric Wieser (Jan 26 2026 at 20:50):

I would guess you have a namespace issue in your PR, and intended to write Language.IsRegular.mul but wrote IsRegular.mul instead

Eric Wieser (Jan 26 2026 at 20:50):

Perhaps you dropped a namespace Language by accident when resolving a merge conflict

Eric Wieser (Jan 26 2026 at 20:50):

To help more we need to know more about what you mean by "becomes in conflict"; what was the actual error message?

Ching-Tsun Chou (Jan 26 2026 at 21:45):

In the file Cslib/Computability/Automata/NA/Pair.lean in cslib#278, there is a grind call on line 56:

  grind [IsRegular.mul, LTS.pairLang_regular]

which stopped working after I merged in the v4.27.0 bump in cslib's main branch, because IsRegular.mul now refers to the theorem in Mathlib.Algebra.Regular.Basic rather than the the theorem in Cslib/Computability/Languages/RegularLanguage.lean. Adding the Language. prefix fixes the problem:

  grind [Language.IsRegular.mul, LTS.pairLang_regular]

But the question is why IsRegular.mul worked before but doesn't now. The theorem Language.IsRegular.mul was not introduced in this PR or cslib#249 (on which this PR depends) but has been in cslib's main for a while. I did not encounter any merge conflicts when I merged the toolchain bump into cslib#249 or cslib#278.

Chris Henson (Jan 26 2026 at 21:48):

My assessment is the same as Jireh's, probably a change in what is transitively imported based on changes upstream in Mathlib.

Ching-Tsun Chou (Jan 26 2026 at 21:54):

Any way to find out for sure? I still have a repo which has not been bumped.

Eric Wieser (Jan 26 2026 at 21:55):

Sure, you can do #check _root_.IsRegular.mul in the unbumped repo and verify that it doesn't resolve

Eric Wieser (Jan 26 2026 at 21:56):

Or you could explicitly add the import to the old version of the file and verify that it breaks

Eric Wieser (Jan 26 2026 at 21:56):

I'm not sure I'd recommend it, but if you want to be immune to mathlib import restructuring, you can just import Mathlib everywhere

Eric Wieser (Jan 26 2026 at 21:56):

That way you always get everything and won't be surprised by things appearing and disappearing

Chris Henson (Jan 26 2026 at 21:59):

We've avoided this intentionally so far. For anything that's in main already, you'll get a failure in nightly-testing, so it won't be a complete surprise.

Chris Henson (Jan 26 2026 at 22:01):

Ching-Tsun Chou said:

Any way to find out for sure? I still have a repo which has not been bumped.

But to answer this, I have done everything but track down the Mathlib PR. The only thing that changed was the dependencies, and I can check out commits before and after and see that the resolution changes.

Ching-Tsun Chou (Jan 26 2026 at 22:03):

I just verified that #check _root_.IsRegular.mul doesn't resolve in the un-bumped repo. However, #check _root_.IsRegular does and points to the IsRegular defined in Mathlib.Algebra.Regular.Defs. So something happened in the version bump that put IsRegular.mul in the top level.

Eric Wieser (Jan 26 2026 at 22:06):

Right, what happened is that Mathlib.Algebra.Regular.Defs became transitively imported, as was discussed above

Eric Wieser (Jan 26 2026 at 22:06):

I'm not sure this is worth digging into further.

Chris Henson (Jan 26 2026 at 22:11):

Yes, seems resolved to me. Also note that this release is perhaps expected to be noisy as this included running the new module-aware shake in Mathlib. We are also planning (as soon as I make the PR) to unpin the Mathlib revision and move to more frequently running lake update, so in the future these kinds of changes will land in the main branch more frequently. (Not that this completely helps the case when a PR is open across these changes)

Jireh Loreaux (Jan 26 2026 at 22:19):

In addition, @Chris Henson, I think it's reasonable to alert the Mathlib maintainers if churn in Mathlib is becoming burdensome in CSLib. I think probably this instance doesn't rise to that occaision, but it's worth noting for future reference. Of course, the response might be "we're cleaning up the import hierarchy", but alternatively it may force us to keep a closer eye on things like this.

Eric Wieser (Jan 26 2026 at 22:33):

I think this is naturally something that module-izing mathlib will help address; removing public imports reduces the potential for leaked transitive results like this


Last updated: Feb 28 2026 at 14:05 UTC