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

abel_nf: PANIC at Lean.isLevelMVarAssignable Lean.MetavarContext:412:14: unknown universe metavariable #15785

Open
eric-wieser opened this issue Aug 13, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@eric-wieser
Copy link
Member

eric-wieser commented Aug 13, 2024

import Mathlib.Tactic

theorem foo (n : ℕ) (h₀ : 0 < n) :
    (∏ x ∈ Finset.Ico 1 (n + 1), x * (x + 1) : ℤ) ∣
      ∏ x ∈ Finset.Ico 1 (n + 1), 1 := by
  induction id h₀ with
  | refl => sorry
  | @step a b c => abel_nf at c

gives

PANIC at Lean.isLevelMVarAssignable Lean.MetavarContext:412:14: unknown universe metavariable
@eric-wieser eric-wieser added the bug Something isn't working label Aug 13, 2024
@digama0
Copy link
Member

digama0 commented Aug 14, 2024

minimized

import Mathlib.Tactic.Abel

axiom F (s : Nat) (f : Nat → Nat) : Nat
axiom G (a b : Nat) : Nat
@[congr] axiom F_congr {s₁ s₂ : Nat} {f : Nat → Nat} (h : s₁ = s₂) : F s₁ f = F s₂ f 

-- invalid occurrence of universe level 'u_1' at '_example'
example (n : ℕ) : F (G 1 (n + 1)) (fun x => x) ≤ F (G 1 (n + 1)) id := by
  abel_nf
  sorry

This is minimal under lots of surprising things, for example G 0 and G 2 do not give the error, only G 1 does.

@digama0
Copy link
Member

digama0 commented Aug 14, 2024

The bug seems to be somewhere in simp, it's rolling back the universe metavariable context after a custom pre method assigns some metavariables and returns an expression depending on those metavariables.

@eric-wieser
Copy link
Member Author

Thanks for the minimization! If this is a simp bug, then I suppose it's possible that leanprover-community/aesop#153 is also a simp bug?

@digama0
Copy link
Member

digama0 commented Aug 14, 2024

Yes, I think that is the same bug. I've minimized it to something mathlib-free and will report it shortly.

@euprunin
Copy link
Collaborator

euprunin commented Sep 9, 2024

@digama0 Is there any tool available that can help reduce a small test case relying on mathlib to a minimal version that doesn't depend on mathlib, or is it typically done manually?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants