Make additional dependency records and lifted LCNF closures deterministic in module output
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 42/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Ambito
- compilers
Direzione di ricerca
Read src/Lean/ExtraModUses.lean at the exporter and src/Lean/Compiler/LCNF/ExtractClosed.lean at closed-term extraction, then compare the save path with src/Lean/Compiler/LCNF/Passes.lean. Reproduce the module-part comparison with Lean.readModuleDataParts and the ClosedProducer.lean fixture described in the issue. Done means both write changes make private module output deterministic while public and server parts and downstream imports remain unchanged.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Lean 4.36.0 can preserve the same declarations and dependencies while writing different bytes to a module's private olean part. We observed this on release commit 611c117bfaf7b7ae1cfcf246ce6fba31e8f509e9 in a repeat build with experimental early inductive signature publication enabled. The comparison used the Linux release recipe with the oldGlibc Nix shell, LLVM 23.1.1 and Stage2. The other six module outputs, the setup file and Lake dependency hash were identical in the repeat.
The first difference in GapCVP.olean.private was at byte 78,640,569, using one-based offsets. Both files had 91,830,704 bytes. Reading the public, server and private parts together with readModuleDataParts identified two differing extensions out of 50.
- Three adjacent entries in
extraModUseschanged order. The full multiset of 4,598 entries matched, including both flags on each entry. The exporter currently preserves insertion order, which can reflect the order in which an asynchronous task first records a dependency. Lake Shake accumulates these entries into sets of requirements. Exporter · Consumer - In
monoExt, 3,258 lifted_closed_*declarations had different local identifier prefixes. Declaration names, order, signatures and let binder names matched. All affected bodies passed Lean'sCode.alphaEqv. The first changed local ID was_uniq.9214764.816versus_uniq.9214773.816. The normal mono save pass normalizes local IDs. The closed-term extraction path saves the declaration with the ID prefix of the current compilation task. Closed-term extraction · Mono save pass
The two proposed changes apply independently to the release commit.
- Sort
ExtraModUserecords when exporting the private part, by module name usingName.quickCmp, then byisExportedandisMetawithfalsebeforetrue. In-memory deduplication and extension replay keep their existing order. - Save
(← normalizeFVarIds decl).saveMonoinExtractClosed. The active compiler pass keeps the original declaration and the closed-term cache keeps its original key and name.
We reproduced each archived private part byte for byte by saving the three parts back without changes. Applying both write rules to both archived private parts produced the same SHA-256, 6f09e3a14b8b8c0af584a0c914273ee5636c39b6045b798aa1559cef96214384. Each public and server part kept its original hash. This readback covers the observed drift. The writer can intentionally emit different private bytes from the release even when both builds elaborate the same source. A byte comparison between compiler configurations therefore needs to state which write rules each configuration uses.
Two new CompactnessAndDegeneracy builds compared the release writer with a Stage2 build containing only the two write changes. In each build, the public and server olean parts, ilean, IR, IR signature, C output, setup file and Lake dependency hash matched the release bytes. The first private difference was at byte 89. The reader checked every field and all 40 extensions. Sorting the release writer's 2,224 dependency records reproduced the new array exactly, changing 2,181 positions. Applying normalizeFVarIds reproduced all 50 changed lifted closures among 232 mono declarations, and each changed body passed Code.alphaEqv. A downstream module imported the output of each writer in both runs. The fixture ClosedProducer.lean also reverses the order of recording twelve dependencies while keeping the source fixed. Both fixed-writer private outputs match, and a downstream module can still use the exported definition and read the recorded dependencies.
The four-project Stage2 recheck covered 58 module builds across seven paired blocks. All six non-private outputs per module, the setup file and the Lake dependency hash matched the release. The private file differed in 57 comparisons. Every differing file passed the object check, including all other fields and extensions, and the downstream import succeeded for both writers in all seven blocks. In GapCVP, the release-to-fixed comparison started at byte 89 in both blocks. The fixed export reordered 4,445 positions among 4,598 dependency records and normalized 3,380 of 6,916 mono declarations. Those counts describe the deliberate change from the release writer. The earlier three-record and 3,258-closure counts describe drift between two builds under the original writer. Each fixed-writer GapCVP output also matched its own repeat byte for byte.
The comparison can be reproduced from release commit 611c117bfaf7b7ae1cfcf246ce6fba31e8f509e9 with the two independent write changes above and a three-part reader using Lean.readModuleDataParts. We verified both changes across clean, instrumented, and early-inductive Stage 2 builds using the Linux release recipe.
- Lingua principale
- Lean
- Stelle
- 10.3k
- Fork
- 1.1k
- Merge medio
- 16h 45m
- PR unite (30g)
- 361
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di leanprover/lean4
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
leanprover/lean4#16876 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
leanprover/lean4#16842 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
leanprover/lean4#16841 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
leanprover/lean4#16840 ·
I maintainer di solito rispondono entro 1 giorno
-
doc: stray "public" in Bool and HEq documentationForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
leanprover/lean4#16825 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di leanprover/lean4
Issue simili
-
bug core-lang
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Call-argument syntax diagnostic needs example spacing and removal of confusing trailing sentenceAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
mw00/project-maya#1368 ·
I maintainer di solito rispondono entro 2 giorni
-
test(bind-json): legacy Solidity fixture requires an unavailable solc on Linux ARM64Forse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
foundry-rs/foundry#18828 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno