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

Are you able to extend this to make the type checker diverge? #1

Open
monsanto opened this issue Sep 2, 2015 · 1 comment
Open

Comments

@monsanto
Copy link

monsanto commented Sep 2, 2015

In the dependent type:type calculus there is way to modify Girard's paradox to exhibit a diverging type (as opposed to a diverging term). There is some information on this in this 1989 paper by Reinhold: ftp://129.69.211.95/pdf/mit/lcs/tr/MIT-LCS-TR-458.pdf (EDIT: apparently GitHub markdown doesn't like ftp links). It would be interesting to know if this is possible to do in OCaml; for example, it isn't possible in System U.

Of course it is well known that the OCaml subtyping relation is undecidable in the presence of abstract module types, so for this to be interesting the example would need to avoid making use of that fact.

@lpw25
Copy link
Owner

lpw25 commented Sep 14, 2015

It would be interesting to know if this is possible to do in OCaml; for example, it isn't possible in System U.

I do not believe it to be possible in current OCaml. The reason that the type does not diverge is that at various points the type is abstracted, which hides the underlying equalities and prevents the type-checker from doing further beta reduction. Many of the abstractions in this code were explicitly inserted for readability, but even if all of them were removed there are some places where OCaml currently forces abstraction on you. For example:

modulde F (X : S) = struct
  module Y = X
end

is given type:

module F (X : S) : sig
  module Y : S
end

which hides the equality between Y and X. If/when OCaml's module aliases are extended to work with functor arguments/results such that F had type

module F (X : S) : sig
  module Y = X
end

then I believe it would be possible to produce a diverging type.

Of course it is well known that the OCaml subtyping relation is undecidable in the presence of abstract module types, so for this to be interesting the example would need to avoid making use of that fact.

Whilst I have no strong evidence for this, I believe the two issues are related: I have never seen an example of the subtyping relation diverging that would not have been prevented by having a predicative universe of module types.

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

No branches or pull requests

3 participants
@monsanto @lpw25 and others