-
Notifications
You must be signed in to change notification settings - Fork 421
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
Unabstracted variables in indices of inductive types in mutual block #3242
Comments
Further minimization: mutual
inductive A (α : Type) : α → Type where
inductive B (α : Type) : α → Type where
end
/-unknown free variable '_uniq.7'-/ |
I believe I found another instance of this problem that still reproduces in 4.8.0-rc1 (and the web compiler, as of writing): structure Salg (n: Nat) where
D: Type
mutual
inductive Ins (salg: Salg n) : salg.D → Prop
inductive Out (salg: Salg n) : salg.D → Prop
end The error I'm getting is |
I'll take a look, thanks for the reporting. |
It appears the that issue comes from unification/metavariables. When the term is elaborated, there is still an mvar that needs to be elaborated (the let type := r.type |>.abstract r.params |>.instantiateRev params with let type ← instantiateMVars r.type
let type := type |>.abstract r.params |>.instantiateRev params Seems to resolve the issue, but I am anything but skilled when it comes to working with unification, and fear this might have some unexpected consequences. A second opinion would be greatly appreciated. |
When elaborating the headers of mutual indexed inductive types, mvars have to be synthesized and instantiated before replacing the fvars present there. Otherwise, some fvars present in uninstantiated mvars may be missed and lead to an error later. Closes #3242 (again)
Prerequisites
Description
In certain cases, when elaborating inductive types, Lean fails to abstract some loose free variables in the signature of inductive types (more particularly on indices) in a mutual block, leading to an error.
Context
Discovered initially here. The issue can be avoided by using
variable
Steps to Reproduce
Expected behavior: No error
Actual behavior: Error
(kernel) declaration has free variables 'And₂'
Versions
4.5.0
Web Browser
Additional Information
The signature type of
And₂
here is:{α : Sort u_1} → (α → α → Prop) → α → _uniq.21 → (Nat → _uniq.21) → Nat → Prop
.The issue can be circumvented by using
variable
, the following code works:Impact
Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.
The text was updated successfully, but these errors were encountered: