Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update LazyDiscrTree to not reuse names when caching #3610

Merged
merged 2 commits into from
Mar 6, 2024

Conversation

joehendrix
Copy link
Contributor

This fixes an issue discovered in Mathlib with the meta cache being poisoned by using a name generator. It is difficult to reproduce due to the name collisions being rare, but here is a minimal module with definitions that result in an error:

prelude
universe u

inductive Unit2 : Type where
  | unit : Unit2

inductive Eq2 {α : Sort u} : α → α → Prop where
  | refl (a : α) : Eq2 a a

structure Subtype2 {α : Sort u} (p : α → Prop) where
  val : α

def End (α) := α → α
theorem end_app_eq (α : Type u) (f : End α) (a : α) : Eq2 (f a) (f a) := Eq2.refl _
theorem Set.coe_eq_subtype {α : Type u} (s : α → Prop) : Eq2 (Subtype2 s) (Subtype2 s) := Eq2.refl _
def succAboveCases {_ : Unit2} {α : Unit2 → Sort u} (i : Unit2) (v : α i) : α i := v
theorem succAbove_cases_eq_insertNth : Eq2 @succAboveCases.{u + 1} @succAboveCases.{u + 1} := Eq2.refl _

Removing any of thee last 5 definitions avoids the error. Testing against Mathlib shows this PR fixes the issue.

@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc March 5, 2024 21:25 Inactive
@github-actions github-actions bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Mar 5, 2024
@leanprover-community-mathlib4-bot
Copy link
Collaborator

Mathlib CI status (docs):

  • ❗ Std/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase f986f69a32c6167d772a50b0e7f3078dc104ee24 --onto ae492265fec103aa834d897bf9f68c94d10f0785. (2024-03-05 21:34:31)

@kim-em kim-em added the full-ci label Mar 5, 2024
@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc March 5, 2024 22:15 Inactive
@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc March 5, 2024 23:04 Inactive
@joehendrix joehendrix force-pushed the library_search_fix_cache branch from 763d9eb to 5f99bfa Compare March 6, 2024 00:34
@joehendrix joehendrix requested a review from leodemoura as a code owner March 6, 2024 00:34
@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc March 6, 2024 00:42 Inactive
@joehendrix joehendrix added this pull request to the merge queue Mar 6, 2024
Merged via the queue into master with commit 6cf82c3 Mar 6, 2024
21 checks passed
tydeu pushed a commit to tydeu/lean4 that referenced this pull request Mar 11, 2024
…#3610)

This fixes an issue discovered in Mathlib with the meta cache being
poisoned by using a name generator. It is difficult to reproduce due to
the name collisions being rare, but here is a minimal module with
definitions that result in an error:

```lean
prelude
universe u

inductive Unit2 : Type where
  | unit : Unit2

inductive Eq2 {α : Sort u} : α → α → Prop where
  | refl (a : α) : Eq2 a a

structure Subtype2 {α : Sort u} (p : α → Prop) where
  val : α

def End (α) := α → α
theorem end_app_eq (α : Type u) (f : End α) (a : α) : Eq2 (f a) (f a) := Eq2.refl _
theorem Set.coe_eq_subtype {α : Type u} (s : α → Prop) : Eq2 (Subtype2 s) (Subtype2 s) := Eq2.refl _
def succAboveCases {_ : Unit2} {α : Unit2 → Sort u} (i : Unit2) (v : α i) : α i := v
theorem succAbove_cases_eq_insertNth : Eq2 @succAboveCases.{u + 1} @succAboveCases.{u + 1} := Eq2.refl _
```

Removing any of thee last 5 definitions avoids the error. Testing
against Mathlib shows this PR fixes the issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants