Python Type Hints are Turing Complete
Ori Roth

TL;DR
This paper demonstrates that Python type hints are Turing complete by adapting a known reduction from Turing machines to Java subtyping, and introduces a more efficient real-time simulation method.
Contribution
It extends the concept of Turing completeness to Python type hints and provides a practical implementation of the reductions with improved compilation times.
Findings
Python type hints are Turing complete.
A real-time reduction reduces compilation times.
Python implementation of Turing machine reductions.
Abstract
Grigore showed that Java generics are Turing complete by describing a reduction from Turing machines to Java subtyping. We apply Grigore's algorithm to Python type hints and deduce that they are Turing complete. In addition, we present an alternative reduction in which the Turing machines are simulated in real time, resulting in significantly lower compilation times. Our work is accompanied by a Python implementation of both reductions that compiles Turing machines into Python subtyping machines.
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsLogic, programming, and type systems · Software Engineering Research · Computational Physics and Python Applications
