Skip to content
Back to the collection

Deciding ML typability is complete for deterministic exponential time

Harry G. Mairson

1990 · Proceedings of the 17th ACM SIGPLAN-SIGACT symposium on Principles of programming languages - POPL '90

Read the paper
HN score
0
Mentions
3
Readers
3
Months
3
What’s in a score?

In the conversation

Original HN comments, with labels from simple text rules. A label describes the whole comment and may miss context or irony. Read the discussion to make up your own mind. About the labels

3 selected excerpts · 3 total mentions

resurrectedcyb
Neutral mention · rule
I do not know if the borrow checker and Rust's type system have been formalized. There are stacked borrows and tree borrows, and other languages experimenting with features similar to borrow checking, but without formal algorithms like Algorithm W or J for Hindley-Milner, or formalizations like of Hindley-Milner and problems like typability for them, I am not sure how one can prove the complexity class of the borrow checking problem nor a specific algorithm, like https://link.springer.com/chapter/10.1007/3-540-52590-4_50 does for ML. I could imagine you being correct about the borrow checking typability problem being NP-complete. Or an even worse complexity class.…
Read the full comment
Typability in ML is EXPTIME-complete, a larger set than NP-complete https://en.wikipedia.org/wiki/EXPTIME https://dl.acm.org/doi/10.1145/96709.96748 . I also am not sure how to figure out if the complexity class of some kind of borrow checking has something to do with the exponential compile times of some practical Rust projects after they upgraded compiler version, for instance in https://github.com/rust-lang/rust/issues/75992 . It would be good if there was a formal description of at least one borrow checking algorithm as well as the borrow checking "problem", and maybe also analysis of the complexity class of the problem.
fweimer
Neutral mention · rule
Try this: let f0 = fun x -> (x, x) in let f1 = fun y -> f0(f0 y) in let f2 = fun y -> f1(f1 y) in let f3 = fun y -> f2(f2 y) in let f4 = fun y -> f3(f3 y) in let f5 = fun y -> f4(f4 y) in f5 (fun z -> z) Lifted from https://dl.acm.org/doi/pdf/10.1145/96709.96748 via Pierce, Types And Programming Languages.
lower
Neutral mention · rule
For languages with Hindley-Milner typing, like SML and OCaml, it has long been known that type-checking is even worse in the worst case (DEXPTIME hard) [1]. But the programs where this matters aren't what one would write by hand, typically. [1] https://dl.acm.org/doi/10.1145/96709.96748

Keep following the thread.

More in Other research

More from the same topics.