English

Implicit Polarized F: local type inference for impredicativity

Programming Languages 2022-03-04 v1 Logic in Computer Science

Abstract

System F, the polymorphic lambda calculus, features the principle of impredicativity: polymorphic types may be (explicitly) instantiated at other types, enabling many powerful idioms such as Church encoding and data abstraction. Unfortunately, type applications need to be implicit for a language to be human-usable, and the problem of inferring all type applications in System F is undecidable. As a result, language designers have historically avoided impredicative type inference. We reformulate System F in terms of call-by-push-value, and study type inference for it. Surprisingly, this new perspective yields a novel type inference algorithm which is extremely simple to implement (not even requiring unification), infers many types, and has a simple declarative specification. Furthermore, our approach offers type theoretic explanations of how many of the heuristics used in existing algorithms for impredicative polymorphism arise.

Keywords

Cite

@article{arxiv.2203.01835,
  title  = {Implicit Polarized F: local type inference for impredicativity},
  author = {Henry Mercer and Cameron Ramsay and Neel Krishnaswami},
  journal= {arXiv preprint arXiv:2203.01835},
  year   = {2022}
}

Comments

27 pages, plus lemmas and proofs (136 pages)

R2 v1 2026-06-24T10:01:06.335Z