Zulip Chat Archive
Stream: CSLib
Topic: Strange "lake build" error msg
Ching-Tsun Chou (Oct 14 2025 at 05:04):
I'm at this branch:
https://github.com/ctchou/cslib/tree/omega-flatten
When I do "lake build", I got the following error msg. But I can't find any occurrence of Mathlib.Computability.DFA in the whole repo. For that matter, I can't find any occurrence of noConfusionType, either. What is wrong?
✖ [7267/7268] Building Cslib
trace: .> LEAN_PATH=/Users/ctchou/play/cslib/.lake/packages/Cli/.lake/build/lib/lean:/Users/ctchou/play/cslib/.lake/packages/batteries/.lake/build/lib/lean:/Users/ctchou/play/cslib/.lake/packages/Qq/.lake/build/lib/lean:/Users/ctchou/play/cslib/.lake/packages/aesop/.lake/build/lib/lean:/Users/ctchou/play/cslib/.lake/packages/proofwidgets/.lake/build/lib/lean:/Users/ctchou/play/cslib/.lake/packages/importGraph/.lake/build/lib/lean:/Users/ctchou/play/cslib/.lake/packages/LeanSearchClient/.lake/build/lib/lean:/Users/ctchou/play/cslib/.lake/packages/plausible/.lake/build/lib/lean:/Users/ctchou/play/cslib/.lake/packages/mathlib/.lake/build/lib/lean:/Users/ctchou/play/cslib/.lake/build/lib/lean /Users/ctchou/.elan/toolchains/leanprover--lean4---v4.24.0-rc1/bin/lean /Users/ctchou/play/cslib/Cslib.lean -o /Users/ctchou/play/cslib/.lake/build/lib/lean/Cslib.olean -i /Users/ctchou/play/cslib/.lake/build/lib/lean/Cslib.ilean -c /Users/ctchou/play/cslib/.lake/build/ir/Cslib.c --setup /Users/ctchou/play/cslib/.lake/build/ir/Cslib.setup.json --json
error: Cslib.lean:1:0: import Mathlib.Computability.DFA failed, environment already contains 'DFA.noConfusionType' from Cslib.Computability.Automata.DFA
error: Lean exited with code 1
Some required targets logged failures:
- Cslib
error: build failed
Kim Morrison (Oct 14 2025 at 11:24):
The problem is that you define a type DFA, but Mathlib already does this.
Kim Morrison (Oct 14 2025 at 11:24):
See :-)
Kim Morrison (Oct 14 2025 at 11:25):
noConfusionType is a built-in helper type created anytime an inductive type is defined. It's not the clearest or most actionable error message, sadly.
Ching-Tsun Chou (Oct 14 2025 at 17:36):
I think the issue may be that when @Fabrizio Montesi added the DFA file to the main branch, he did not add their paths to Cslib.lean and hence the problem was not exposed at that point. While working on my branch (which is based on main), I did a lake exe mk_all which caused all the missing paths being added to Cslib.lean and the problem to show up.
Ching-Tsun Chou (Oct 14 2025 at 17:38):
@Fabrizio Montesi , does cslib require that all theory files have their paths be included in the top-level Cslib.lean?
Fabrizio Montesi (Oct 14 2025 at 19:07):
We don't have a requirement per se yet, but maybe we should? This should've been caught earlier, after all.
Ching-Tsun Chou (Oct 14 2025 at 19:16):
I think we should. Allowing some theory files to not appear in Cslib.lean introduces another level of complexity.
Shreyas Srinivas (Oct 14 2025 at 20:20):
If you don’t add those paths I don’t think lake even builds them by default, but even if it does (correct me if I am wrong), you want to make it possible to use a shorter prefix to import a whole folder for example
Alexandre Rademaker (Oct 14 2025 at 20:39):
I prefer explicit import, simpler and maintainable.
Chris Henson (Oct 14 2025 at 20:41):
In our lakefile, we have:
[[lean_lib]]
name = "Cslib"
globs = "Cslib.*"
which should build everything, right? I believe the intent was to not have the possibility of forgetting a file.
Chris Henson (Oct 14 2025 at 20:45):
Maybe this is not explicit, but I find it better for the "simpler and maintainable" aspect. If there are other tradeoffs, please let us know.
Chris Henson (Oct 14 2025 at 20:48):
There is also some automated review of imports (see cslib#83 for example) that I think covers this already?
Chris Henson (Oct 14 2025 at 20:52):
If that's true, we have a double assurance that everything is built and explicitly imported.
Shreyas Srinivas (Oct 14 2025 at 21:05):
Alexandre Rademaker said:
I prefer explicit import, simpler and maintainable.
You can achieve that with min_imports after developing a file. During development a large import is simpler.
I have never used this glob pattern in your lake file before, so maybe it works. Do check if you can cross import one file from another one in a different subfolder.
Shreyas Srinivas (Oct 14 2025 at 21:07):
About namespacing, I recall making some effort to get Mathlib Vectors namespaced last year, but this was not considered something necessary for the wider library. This namespacing (and it might bite even more with notation) is a constant headache. I suggest namespacing from the get go.
Shreyas Srinivas (Oct 14 2025 at 21:09):
Happy to make the PR to all files in an hour. It will touch many files so the sooner we do it the better. I'll start right away.
Chris Henson (Oct 14 2025 at 21:15):
Shreyas Srinivas said:
Happy to make the PR to all files in an hour. It will touch many files so the sooner we do it the better. I'll start right away.
This would be appreciated. I think the other thread reached consensus on Cslib as the top namespace.
Shreyas Srinivas (Oct 14 2025 at 21:16):
I think this name convention should be uniform. Anyway changing the namespace will be a matter of Ctrl + Shift +F > namespace CSLib
Shreyas Srinivas (Oct 14 2025 at 21:16):
You don't want any confusion between import name and namespace
Shreyas Srinivas (Oct 14 2025 at 21:16):
Whichever you pick
Shreyas Srinivas (Oct 14 2025 at 21:17):
(It seems the convention is already Cslib, so we can go with that)
Shreyas Srinivas (Oct 14 2025 at 21:46):
Here: https://github.com/leanprover/cslib/pull/105
Shreyas Srinivas (Oct 14 2025 at 21:46):
I just need to fix four tests
Shreyas Srinivas (Oct 14 2025 at 21:47):
All four of them are guard_msgs which are erroring on the different namespaces which honestly makes no sense to me
Shreyas Srinivas (Oct 14 2025 at 21:48):
A couple of issues:
- There seems to be a strange mix of sections and namespaces in the Automaton folder. I am only standardising linebreaks here.
- I am establishing a convention that the top namespace declaration is one line after the module docstring and that there is always a linebreak between namespace related lines. It appears that things have been haphazard so far.
- I am using a different namespace CslibTests for the tests folder.
Shreyas Srinivas (Oct 14 2025 at 21:52):
I also think there ought to be scoped notation instead of notation. This saves a lot of headaches later. Happy to do a separate PR for that
Shreyas Srinivas (Oct 14 2025 at 21:54):
@Chris Henson and @Fabrizio Montesi : can I comment out the four guard messages for now?
Chris Henson (Oct 14 2025 at 22:02):
I think I know about those tests, let me check first
Kim Morrison (Oct 14 2025 at 22:02):
It's not just tests, the build is failing in
- Cslib.Languages.LambdaCalculus.LocallyNameless.Fsub.Basic
- Cslib.Logics.LinearLogic.CLL.PhaseSemantics.Basic
- Cslib.Languages.LambdaCalculus.LocallyNameless.Stlc.Basic
Shreyas Srinivas (Oct 14 2025 at 22:03):
Will check
Shreyas Srinivas (Oct 14 2025 at 22:03):
Right. I missed a whole subfolder there
Shreyas Srinivas (Oct 14 2025 at 22:07):
Now it should build
Chris Henson (Oct 14 2025 at 22:07):
Shreyas Srinivas said:
All four of them are guard_msgs which are erroring on the different namespaces which honestly makes no sense to me
This is intentional, it is a test to ensure some metaprogramming is respecting namespaces. We can remove the non-namespaced test now. I can do this and push to the PR.
Shreyas Srinivas (Oct 14 2025 at 22:08):
okay
Shreyas Srinivas (Oct 14 2025 at 22:08):
Also, fixed the whole FSub and Stlc folder
Shreyas Srinivas (Oct 14 2025 at 22:08):
Need CI approval
Shreyas Srinivas (Oct 14 2025 at 22:09):
Now only the namespace tests fill fail hopefully
Shreyas Srinivas (Oct 14 2025 at 22:12):
More errors. Will fix. Isn't there a git commit hook for this before I push?
Kim Morrison (Oct 14 2025 at 22:14):
I typically run lake build? :-)
Shreyas Srinivas (Oct 14 2025 at 22:18):
lake build passes now
Shreyas Srinivas (Oct 14 2025 at 22:18):
If you have a push hook then this is automatic and the push fails if the build fails
Shreyas Srinivas (Oct 14 2025 at 22:18):
I'll probably need permission to run CI again.
Shreyas Srinivas (Oct 14 2025 at 22:22):
CI passes
Shreyas Srinivas (Oct 14 2025 at 22:23):
You might want to have subfolder specific namespaces too. A lot of notation is wildly reused in CS, so it would be beneficial to scope the notation to the subfolder namespaces. But that's for subsequent PRs
Chris Henson (Oct 14 2025 at 22:24):
Some of the notation (and grind annotations) are scoped this way, but yes more could do this.
Shreyas Srinivas (Oct 14 2025 at 22:25):
Also I suggest merging this PR asap since it touches every file and each PR pending in the queue will be affected by the resulting merge conflicts. The longer we wait, the more PRs are created and thus get affected. Conversely each merged PR gives merge conflicts for this one.
Chris Henson (Oct 14 2025 at 22:29):
Sure, I'll ping tomorrow if it's still pending.
Shreyas Srinivas (Oct 14 2025 at 22:34):
Needs one more CI run (permission). I localised a couple of mathlib namespace opens
Fabrizio Montesi (Oct 15 2025 at 05:17):
Merged!
Thank you all for discussing and fixing this, all while I was sleeping. :grinning_face_with_smiling_eyes:
Ching-Tsun Chou (Oct 20 2025 at 20:47):
I just noticed that Cslib/Languages/CombinatoryLogic/Evaluation.lean was added to the "main" branch as part of cslib#57 without being also added to Cslib.lean. I have made a PR (cslib#114) to fix it. CC: @Fabrizio Montesi
Ching-Tsun Chou (Oct 20 2025 at 20:48):
Perhaps we should have some automatic check to enforce this?
Chris Henson (Oct 20 2025 at 20:59):
I think there is an action that will flag this, it just never ran for that PR because it was opened over a month ago. If you see another case of this not caught, ping me and I'll address it.
Fabrizio Montesi (Oct 23 2025 at 11:28):
merged, thx :)
Last updated: Dec 20 2025 at 21:32 UTC