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

WIP: feat: allow limited type ascriptions in data/codata #25

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

alexkeizer
Copy link
Owner

No description provided.

@alexkeizer
Copy link
Owner Author

Implements #15

@monsterkrampe
Copy link
Collaborator

monsterkrampe commented Jul 6, 2024

I've put a bit of time here and there trying to understand what is going wrong here.
I think I at least managed to narrow the issue down a bit but admittedly I'm still mostly stepping in the dark.
In the commit I just added (which can be removed later), I tried to explicitly define instance foo : MvFunctor.{1,1} ($baseApplied) := $functor in Qpf/Macro/Data.lean. This produces a type error visible in Test/Arrow.lean that does not quite make sense to me yet:

type mismatch
  MvQPF.Comp.instMvFunctorComp
has type
  MvFunctor
    (MvQPF.Comp (TypeFun.ofCurried (MvQPF.Arrow α)) (Vec.append1 Vec.nil (MvQPF.Prj (Fin2.fs Fin2.fz)))) : Type 1
but is expected to have type
  MvFunctor
    (Vec.append1 (Vec.append1 (Vec.append1 Vec.nil (MvQPF.Prj (Fin2.fs Fin2.fz))) (MvQPF.Prj Fin2.fz))
      (MvQPF.Comp (TypeFun.ofCurried (MvQPF.Arrow α)) (Vec.append1 Vec.nil (MvQPF.Prj (Fin2.fs Fin2.fz))))
      Fin2.fz) : Type 2

This especially throws me off since it does not only expect a different universe but a completely different type.

Maybe you guys already made some more progress regarding this issue. Or maybe you have an idea why adding instance foo : MvFunctor.{1,1} ($baseApplied) := $functor in Qpf/Macro/Data.lean yields the above error.

@alexkeizer
Copy link
Owner Author

We've not really worked on this lately, so your help is appreciated!

The error is rather misleading, but a bit of a red herring.
There is a vector of three types, which is being indexed by the last Fin2 you see.
Using imaginary syntax, we could pretty print it as:

!![ Prj _, Prj _, Comp  (TypeFun.ofCurried (MvQPF.Arrow α) !![Prj 1]] 0

Remembering that typevectors are indexed right-to-left, this indeed reduces to:

Comp  (TypeFun.ofCurried (MvQPF.Arrow α) !![Prj 1]

which is in fact the expected type (modulo universes)!

@alexkeizer alexkeizer changed the title feat: allow limited type ascriptions in data/codata (WIP) WIP: feat: allow limited type ascriptions in data/codata Oct 9, 2024
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 this pull request may close these issues.

3 participants