leanprover-community / leanprover-community/lean
universe error in definition generated by the equation compiler
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 434
- Forks
- 79
- PR merge metrics
- No merged PRs in 30d
Description
This was found by Joseph Rotella. The equation compiler fails to create a helper definition because of a universe error, even though the definition itself is sensible.
-- fails to create a helper definition
def foldr_cps {α β γ : Sort*} (g : α → β → β) (z : β) : list α → (β → γ) → γ
| list.nil k := k z
| (list.cons x xs) k := foldr_cps xs (λz', k (g x z'))
-- succeeds
def foldr_cps' {α β γ : Sort*} (g : α → β → β) (z : β) (l : list α) : (β → γ) → γ :=
@list.rec_on α (λ _, (β → γ) → γ) l
(λ k : β → γ, k z)
(λ x xs r k, r (λ z', k (g x z')))
Prerequisites
- Put an X between the brackets on this line if you have done all of the following:
- Checked that your issue isn't already filed.
- Specifically, check out the wishlist, open RFCs,
or feature requests.
- Specifically, check out the wishlist, open RFCs,
- Reduced the issue to a self-contained, reproducible test case.
- Checked that your issue isn't already filed.
Description
[Description of the issue]
Steps to Reproduce
- [First Step]
- [Second Step]
- [and so on...]
Expected behavior: [What you expect to happen]
Actual behavior: [What actually happens]
Reproduces how often: [What percentage of the time does it reproduce?]
Versions
You can get this information from copy and pasting the output of lean --version,
please include the OS and what version of the OS you're running.
Additional Information
Any additional information, configuration or data that might be necessary to reproduce the issue.
Contributor 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.
Research direction
Start with the equation compiler and the supplied foldr_cps and foldr_cps' reproductions. Compare why the pattern-matching definition fails while the explicit list.rec_on definition succeeds; done means the first definition creates its helper definition without a universe error.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100