-
Notifications
You must be signed in to change notification settings - Fork 350
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
application type mismatch error reports identical types as not matching #333
Comments
Even more suspiciously,
so it looks like Lean is somehow forgetting about the first argument to |
Not exactly the same issue, but this seems suspicious too: #check cast (congrFun _ _)
/-
application type mismatch
cast (congrFun ?m.13 ?m.14)
argument
congrFun ?m.13 ?m.14
has type
?m.9 ?m.14 = ?m.11 ?m.14
but is expected to have type
?m.2 = (?m.9 ?m.14 = ?m.11 ?m.14)
-/ |
Small example: structure Ty where
ctx : Type
ty : ctx → Type
structure Tm where
ty : Ty
tm : ∀ {Γ}, ty.ty Γ
#check fun (x' : Type)
(f : Tm)
(fTy : f.ty = Ty.mk x' (fun _ => Unit))
(xTy : Unit)
=> Tm.mk _ (cast (congrFun fTy _) _)
/-
12:15: application type mismatch
cast (congrFun ?m.457 Γ✝)
argument
congrFun ?m.457 Γ✝
has type
@Eq Type (?m.618 x' f fTy xTy) (Ty.ty (?m.617 x' f fTy xTy) Γ✝)
but is expected to have type
@Eq Type (?m.618 x' f fTy xTy) (Ty.ty (?m.617 x' f fTy xTy) Γ✝)
-/ |
This looks like a de Bruijn indexing bug or something? structure Ty where
ctx : Type
ty : ctx → Type
structure Tm where
ty : Ty
tm : ∀ {Γ}, ty.ty Γ
def Ty.inj Γ T := Ty.mk Γ (λ _ => T)
def Tm.inj Γ {T} (t : T) := Tm.mk (Ty.inj Γ T) t
#check fun (x' : Type)
(f : Tm)
(fTy : f.ty = Ty.mk x' (fun _ => Unit))
(xTy : Unit)
=> Tm.inj _ (cast (congrFun fTy _) _)
/-
15:16: application type mismatch
cast (congrFun ?m.513 xTy)
argument
congrFun ?m.513 xTy
has type
@Eq Type (?m.565 x' f fTy xTy) (?m.564 x' f fTy xTy)
but is expected to have type
@Eq Type (?m.565 x' f fTy xTy) (?m.564 x' f fTy xTy)
-/ Why is it picking up |
After the other fixes I pushed today, the types are not identical anymore. For example, for the last example, we now get error: application type mismatch
congrFun fTy
argument
fTy
has type
f.ty = { ctx := x', ty := fun (x : x') => Unit }
but is expected to have type
?m.615 x' f fTy xTy = (?m.614 x' f fTy xTy).ty It is still a bit cryptic, but at least it suggests the problem is due to higher-order unification. |
Indeed, this error message is much better. Even better would be to add details about how However, assuming you don't want to enhance unification in this way (or if you want to make a fresh issue for that), and assuming that Lean previously turning |
I investigated why
and uses the (first-order) approximated solution
|
Me too. |
Prerequisites
Description
Sorry, not yet minimized. I'll try to minimize this soon.
Expected behavior: an error message that explains what's wrong
Actual behavior: an error message which claims that identical types aren't the same
Versions
running on WSL2 in Windows 10
The text was updated successfully, but these errors were encountered: