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

Changing variable type and introducing new variables cannot be done in one command. #2143

Closed
1 task done
adamtopaz opened this issue Mar 9, 2023 · 0 comments · Fixed by #5142
Closed
1 task done

Comments

@adamtopaz
Copy link

adamtopaz commented Mar 9, 2023

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

The variable command is used in two different ways: a) to introduce new variables and b) to change the variable type (e.g. from explicit to implicit). In some situations, lean4 allows us to do both things using a single variable command, and in some cases this fails.

Steps to Reproduce

Example 1:

variable (α : Type _) [OfNat α (nat_lit 0)] 

variable {α} (x : α) (h : x = 0)

Example 2:

variable (α : Type _) [OfNat α (nat_lit 0)] 

variable {α} (x : α) 
variable (h : x = 0)

Example 3:

variable (α : Type _) [OfNat α (nat_lit 0)] 

variable {α} 
variable (x : α) (h : x = 0)

Expected behavior:

All three examples above should work with no error and result in equivalent behavior.

Actual behavior:

In example 1, we have an error at the 0 on the last line:

failed to synthesize instance
  OfNat α 0

Examples 2 and 3 work with no error.

Reproduces how often:

100%

Versions

Lean version:
Lean (version 4.0.0-nightly-2023-03-09, commit 0cc9d7a43de7, Release)

Tested on Linux nixos 5.15.94.

Additional Information

See associated zulip discussion.

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

Successfully merging a pull request may close this issue.

1 participant