Exported binder names and binder info depend on what else is exported
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 76/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Área
- tooling
Línea de trabajo
Start with Export.lean and find visitedExprs : HashMap Expr Nat, then inspect how Expr equality and hashing are implemented before changing its key behavior. Locate the repository’s export tests and add coverage showing that the same declaration exports identical binder names and binder info regardless of what was exported first. Done means α-equivalent expressions with different binders are not incorrectly deduplicated, while exports remain valid for kernel checking.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Export.lean deduplicates expressions with visitedExprs : HashMap Expr Nat, which uses Lean's BEq Expr (α-equivalence: binder names and binder info are ignored). When two expressions differ only in binder names or binder info, whichever is visited first gets an index, and later occurrences reuse it. So the binders printed for a declaration depend on which declarations were exported before it.
Example. Exporting Lean.Grind.not_not as part of a small closure versus as part of the closure of Complex.exists_root (same Mathlib commit, same toolchain) gives different binders for the same declaration: one export has a binder named a with one binder info, and the other has p with another.
It doesn't affect checking: kernels ignore binder names and info. But it means an export isn't a function of the declaration alone, which breaks anything that hashes or caches exported declarations, or diffs exports. We hit this content-addressing declarations: across those two exports, the binder differences alone changed the hashes of thousands of the 18,322 shared declarations.
Also: exporting all of Mathlib at once (lean4export Mathlib, no constants listed) stalled for over 20 minutes after about 650k declarations, with lean4export using CPU but writing nothing. Exporting the same constants in chunks of about 6,000 (each chunk's modules, with its constants listed) finished every chunk in under 90 s.
Possible fix. Key visitedExprs on structural equality (Expr.equal), for example through a wrapper whose BEq is Expr.equal. Hashable Expr already ignores binder names, so it can stay. Exports get slightly larger, because α-equivalent copies are no longer shared, but each declaration's export no longer depends on what else is exported.
(We work around it downstream by dropping binder names and info, but other consumers likely want the real names.)
- Lenguaje dominante
- Lean
- Estrellas
- 52
- Forks
- 30
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de leanprover/lean4export
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
leanprover/lean4export#40 · 6 comentarios ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 66/100
leanprover/lean4export#64 · 1 comentario ·
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 8/100
leanprover/lean4export#62 · 2 comentarios ·
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
leanprover/lean4export#48 · 1 comentario ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
leanprover/lean4export#8 · 2 comentarios ·
Todos los issues de leanprover/lean4export
Issues similares
-
Claiming namespace `r33net`Abiertonamespace team:operations
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
EclipseFdn/open-vsx.org#16444 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
swc-project/swc-next-issues#1148 ·
-
delegate-work フックで Haiku の判断がぶれるAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
jsboige/CoursIA#29306 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
area:cli area:hooks area:plugins bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
anthropics/claude-code#112965 ·