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

universe error in definition generated by the equation compiler #655

Open
1 task
robertylewis opened this issue Dec 10, 2021 · 0 comments
Open
1 task

Comments

@robertylewis
Copy link
Member

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.
    • Reduced the issue to a self-contained, reproducible test case.

Description

[Description of the issue]

Steps to Reproduce

  1. [First Step]
  2. [Second Step]
  3. [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.

bors bot pushed a commit that referenced this issue Jan 7, 2022
Fixes half of the issue in #655, now it works if you specify the universe parameters explicitly.

If you don't specify them explicitly, then the auxiliary meta definition is declared before we have replaced the universe metavariables by u_1,u_2,... (called finalization), which happens at the very end of elaboration.  Making that work as well would probably require large changes in the elaborator.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant