Closed mniip closed 3 days ago
CoeFun Foo fun _ => ∀{α}, α → α
tells the elaborator to coerce the former type into the latter. I don't see why it should adjust the second type with any other information, at least without further motivation. Thus I'm closing this as by design.
@Kha I think there's a misunderstanding.
CoeFun Foo fun _ => ∀{α}, α → α
tells the elaborator to coerce the former type into the latter.
That's exactly what it fails to do, hence this issue.
Instead of coercing to "the latter" -- whatever is written in the instance head, it coerces to what is actually the type of the instance body.
Prerequisites
Please put an X between the brackets as you perform the following steps:
Description
Function applications going through
CoeFun
do not respect the implicitness of the parameters declared in the instance head, rather they take the implicitness information from the instance implementation.Context
Steps to Reproduce
Expected behavior:
Foo.app foo (α:=Type) (x:=Nat)
, and infer the typeType
Actual behavior:
Foo.app foo (α:=Nat)
and infers the typeNat → Nat
.Versions
4.13.0
Additional Information
The problem can be reversed by making the structure field have implicit
∀{α}
and the instance head have the explicit∀α
. https://github.com/leanprover/lean4/issues/1891 seems relevant.Impact
Add :+1: to issues you consider important. If others are impacted by this issue, please ask them to add :+1: to it.