-
Notifications
You must be signed in to change notification settings - Fork 2
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
Some leads on contra-variant subtyping #129
Comments
I think we need something really clear, as once we extend the system with contextual types, we have another source of contravariance. Once POPL deadline is over, I will also put an RFC with my idea. (Possibly as a comment in this issue) |
contextual types might not cause issue. LF is a separate system, it doesn't have to support any subtyping at all. |
Ah yeah, true. But anyway, I think it would be a good idea to have the way as cleanest as possible we can come up with to block as less future extensions as possible. |
I tried to prove this theorem (of course it didn't change PER itself to use contravariance so it is not super meaningful even if it is proved, but), and from that, I think what we need is basically the "realizability" of Here, |
In #127 , I removed contra-variant subtyping because I am not able to justify any termination measure for the subtyping algorithm in #124 . The major issue is that when checking the subtyping relation between return types of Pi, the context becomes smaller for the return type on the left hand side, so the normal form of that type is no longer accurate, c.f. #121 (comment) .
Nevertheless, I still think that contra-variant subtyping should be decidable, and this is the only blocker. As a proof of concept, I have shown in #125 that the subtyping relation in the PER model is transitive, so there really isn't any problem on the semantic side.
After some bangs on the wall, I think we can move forward with the decidability with contra-variant subtyping with the following leads. The main idea is that, the decision of subtyping decreases by the syntax size of normal forms, even if the normal forms are not accurate. Every time we go under Pi's, we re-normalize the return type on the left hand side, but if the size of the normal forms is invariant under subtyping between contexts, then we are good.
Now, the goal is to show that contra-variant subtyping doesn't change the size of normal forms. I think this can be proved, after we finish soundness proof. We need to provide another set of semantic definitions to model this invariant of size. I list a few critical lemmas and definitions below:
a
andb
, such that when tagginga
a subtype of that ofb
, then their readbacks have equal size.G |- t : T
, we should sayG
is semantically well-formed, and then for allG'
a sub-context ofG
, the evaluations oft
in two different environments related by 3 is related by the relation defined in 2.It involves some work, probably not gonna be easy, so we should finish what we have now before moving towards this direction. Leave this investigation for the future; if we pull this off, we can write another paper about it.
The text was updated successfully, but these errors were encountered: