Skip to content

fix: wrap sibling-problem helpers in per-problem inner namespaces#319

Merged
kim-em merged 1 commit into
mainfrom
fix/per-problem-namespaces
May 25, 2026
Merged

fix: wrap sibling-problem helpers in per-problem inner namespaces#319
kim-em merged 1 commit into
mainfrom
fix/per-problem-namespaces

Conversation

@kim-em
Copy link
Copy Markdown
Collaborator

@kim-em kim-em commented May 25, 2026

Main is broken: lake exe lean-eval validate-manifest and
lake exe lean-eval generate both fail with

uncaught exception: import LeanEval.Geometry.LeviCivita failed,
environment already contains 'LeanEval.Geometry.IsMetricCompatible'
from LeanEval.Geometry.KoszulFormula

after the recent batch of sibling Knill PRs merged.

Cause: Levi-Civita / Koszul, Morse / Weak Morse, Platonic / Schläfli,
and Darboux / Liouville-Arnold each define identical helper-def names
(IsMetricCompatible, IsCriticalPoint, ConvexPolytope, E,
idxP, idxQ, …) at the same LeanEval.Geometry namespace path.
Individual PRs were CI-green because LeanEval.lean (the lib glob)
doesn't import these modules, but lake exe lean-eval loads every
@[eval_problem] module together for inventory validation, which
trips the collision. 25 colliding decl names total across 8 files.

Fix: wrap each file's helpers + main theorem in an inner
namespace <ProblemName> (e.g. LeanEval.Geometry.LeviCivita.*).
The @[eval_problem] matching is by basename, so
holes = [\"levi_civita\"] still resolves correctly. Manifest module
path is by file path — unchanged.

Verified:

  • lake build for all 8 files: success, only expected sorry warnings.
  • lake exe lean-eval validate-manifest: "Manifest and @[eval_problem]
    declarations are consistent."
  • lake exe lean-eval generate: produces 92 workspaces.
  • Per-problem generated workspaces (spot-checked
    levi_civita_exists_unique, morse_inequality) build clean.

🤖 Prepared with Claude Code

After the §38/§40/§42/§45 sibling PRs merged, validate-manifest and
generate fail with `environment already contains
LeanEval.Geometry.IsMetricCompatible` from sibling-problem files
defining the same helper at the same namespace path. Individual PRs
passed CI because the LeanEval lib file does not import any of these
modules, but the lean-eval CLI loads every @[eval_problem] module
together at validate time.

Each colliding pair (Levi-Civita/Koszul, Morse/WeakMorse,
Platonic/Schlafli, Darboux/LiouvilleArnold) is fixed by inserting an
inner `namespace <ProblemName>` wrapper around the file's helper defs
and main theorem. The eval-problem matching is by basename (so
hole = "levi_civita" still resolves to the wrapped theorem); the
manifest module path is by file path (unchanged).

Verified:
- `lake build` for all 8 files succeeds with only the expected sorry
  warnings.
- `lake exe lean-eval validate-manifest` reports "consistent".
- `lake exe lean-eval generate` produces 92 workspaces.
- Per-problem generated workspaces (e.g. `levi_civita_exists_unique`,
  `morse_inequality`) build clean.

Files touched:
- LeanEval/Geometry/LeviCivita.lean
- LeanEval/Geometry/KoszulFormula.lean
- LeanEval/Geometry/MorseInequalities.lean
- LeanEval/Geometry/WeakMorseInequality.lean
- LeanEval/Geometry/PlatonicClassification.lean
- LeanEval/Geometry/SchlafliClassification.lean
- LeanEval/Geometry/Darboux.lean
- LeanEval/Geometry/LiouvilleArnold.lean

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@kim-em kim-em merged commit 988536e into main May 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant