getStarLemmas lists the current module's star-indexed lemmas once more after each library search
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 56/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Domain
- backend-api-design
Research direction
Read createModuleTreeRef in src/Lean/Meta/LazyDiscrTree.lean and libSearchFindDecls in src/Lean/Meta/Tactic/LibrarySearch.lean, then run the supplied Star.lean reproduction. Trace how current-module dropped entries are added to starLemmasExt across repeated searches; done when my_star_lemma appears once after three searches and the regression is covered.
Written by the indexing model from the issue text.
Description
Prerequisites
- Check that your issue is not already filed:
https://github.com/leanprover/lean4/issues - Reduce the issue to a minimal, self-contained, reproducible test case.
Avoid dependencies to Mathlib or Batteries. - Test your test case against the latest nightly release. I tested 4.34.1 and 4.35.0. The code involved is unchanged on
master(createModuleTreeRefinsrc/Lean/Meta/LazyDiscrTree.lean, andlibSearchFindDeclsinsrc/Lean/Meta/Tactic/LibrarySearch.lean). - When reporting a perceived soundness bug: not a soundness bug.
Description
getStarLemmas lists each of the current module's star-indexed lemmas once more after every library search in the same process. After three searches, a lemma of the current module is listed three times, so the last-resort pass of exact? and apply? tries it three times.
libSearchFindDecls passes the process-wide starLemmasExt to findMatches as droppedEntriesRef. findMatches builds a new tree of the current module on every call (createModuleTreeRef). Each time, createModuleTreeRef appends that module's dropped entries to the ref, after what's already there. The imported part is appended only once, when the imported tree is first made, so only the current module's part repeats.
Context
Found while comparing a program's own use of LazyDiscrTree with libSearchFindDecls and getStarLemmas, on goals in one file.
Steps to Reproduce
- Save this as
Star.lean:
import Lean
open Lean Meta LibrarySearch
theorem my_star_lemma {α : Prop} (h : α) : α := h
#eval show MetaM Unit from do
let _ ← libSearchFindDecls (mkConst ``True)
let a ← getStarLemmas
let _ ← libSearchFindDecls (mkConst ``True)
let _ ← libSearchFindDecls (mkConst ``True)
let b ← getStarLemmas
let count (xs : Array (Name × DeclMod)) := (xs.filter (·.1 == ``my_star_lemma)).size
IO.println s!"after 1 search: {a.size} star lemmas, my_star_lemma {count a} times"
IO.println s!"after 3 searches: {b.size} star lemmas, my_star_lemma {count b} times"
- Run
lean Star.lean.
Expected behavior: my_star_lemma is listed once, however many searches ran before.
Actual behavior:
after 1 search: 1660 star lemmas, my_star_lemma 1 times
after 3 searches: 1662 star lemmas, my_star_lemma 3 times
On 4.35.0, the counts are 1673 and 1675, again with my_star_lemma listed 1 and 3 times.
Versions
- Lean (version 4.34.1, aarch64-unknown-linux-gnu, commit 5045d0056413266e57c625dcd7c365b10e377c52, Release)
- Lean (version 4.35.0, aarch64-unknown-linux-gnu, commit eb6cafb7290e8bd5f2937522d8d804f58f02bafc, Release)
- Linux, aarch64
Additional Information
starLemmasExt lives as long as the process, so the list grows with every search the process makes: each exact? or apply? in one file adds that file's star-indexed lemmas again.
Impact
Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.
- Dominant language
- Lean
- Stars
- 10.3k
- Forks
- 1.1k
- Avg merge
- 19h 8m
- Merged PRs (30d)
- 421
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from leanprover/lean4
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
leanprover/lean4#16681 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
leanprover/lean4#16305 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
leanprover/lean4#16299 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
leanprover/lean4#16257 ·
Maintainers usually reply within 1 day
-
`IO.FS.realPath` reports every failure as `noFileOrDirectory` instead of classifying by `errno`Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
leanprover/lean4#15683 ·
Maintainers usually reply within 1 day
All issues in leanprover/lean4
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
vllm-project/vllm-sail#398 ·
Maintainers usually reply within 1 day
-
kubernetes-ingestor: fetchCRDMapping() runs even when crossplane.enabled is false, logging a 403 ERROR every runPossibly taken @kc9ddi claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
TeraSky-OSS/backstage-plugins#228 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
bug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
nightscout/nocturne#4057 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
opendatalab/MinerU#5800 · 2 comments ·
Maintainers usually reply within 1 day