[Paper Review] Applied Type System: An Approach to Practical Programming with Theorem-Proving
This paper introduces Applied Type System (ATS), a formal framework that separates static type reasoning from dynamic program execution, enabling practical programming with dependent types. By decoupling statics (type formation) from dynamics (program evaluation), ATS supports theorem-provoking through explicit proof construction, ensuring type safety and enabling constraint solving via proof-erasure, with formal proof of correctness via translation to a core type system.
The framework Pure Type System (PTS) offers a simple and general approach to designing and formalizing type systems. However, in the presence of dependent types, there often exist certain acute problems that make it difficult for PTS to directly accommodate many common realistic programming features such as general recursion, recursive types, effects (e.g., exceptions, references, input/output), etc. In this paper, Applied Type System (ATS) is presented as a framework for designing and formalizing type systems in support of practical programming with advanced types (including dependent types). In particular, it is demonstrated that ATS can readily accommodate a paradigm referred to as programming with theorem-proving (PwTP) in which programs and proofs are constructed in a syntactically intertwined manner, yielding a practical approach to internalizing constraint-solving needed during type-checking. The key salient feature of ATS lies in a complete separation between statics, where types are formed and reasoned about, and dynamics, where programs are constructed and evaluated. With this separation, it is no longer possible for a program to occur in a type as is otherwise allowed in PTS. The paper contains not only a formal development of ATS but also some examples taken from ats-lang.org, a programming language with a type system rooted in ATS, in support of employing ATS as a framework to formulate advanced type systems for practical programming.
Motivation & Objective
- To address the limitations of Pure Type Systems (PTS) in supporting realistic programming features like general recursion, effects, and recursive types under dependent types.
- To formalize a framework that supports practical programming with advanced types, especially dependent and guarded types.
- To establish a type-theoretical foundation for programming with theorem-proving (PwTP), where proofs are explicitly constructed to simplify type constraints.
- To demonstrate that proof-erasure preserves dynamic semantics while ensuring type safety in the presence of effects.
- To unify and extend prior work on Dependent ML and guarded recursive datatypes into a single, expressive type system framework.
Proposed method
- Introduce a complete separation between statics (type formation and reasoning) and dynamics (program construction and evaluation), disallowing programs in types.
- Define two core type forms: guarded types for encoding invariants (like pre- and post-conditions) and asserting types for proof-level constraints.
- Formalize a minimal core system, $\mbox{ATS}_{0}$, and prove its type soundness.
- Extend $\mbox{ATS}_{0}$ to $\mbox{ATS}_{\it pf}$ to support programming with theorem-proving (PwTP), where proofs are explicitly constructed.
- Use proof-erasure translation to map well-typed $\mbox{ATS}_{\it pf}$ programs into equivalent $\mbox{ATS}_{0}$ programs with identical dynamic semantics.
- Establish correctness of PwTP via a formal proof that well-typedness in $\mbox{ATS}_{\it pf}$ implies well-typedness in $\mbox{ATS}_{0}$ after proof-erasure.
Experimental results
Research questions
- RQ1How can a type system support practical programming with dependent types while accommodating effects like references and exceptions?
- RQ2What formal mechanism enables the syntactic intertwining of programs and proofs without compromising type safety?
- RQ3How can proof-erasure be formally justified to preserve dynamic semantics and ensure type soundness?
- RQ4In what way does separating statics from dynamics eliminate the need for pure reasoning on programs in dependent type systems?
- RQ5How can program invariants be expressed and enforced using guarded and asserting types in a type system?
Key findings
- The separation of statics and dynamics in ATS eliminates the need for pure reasoning on programs, enabling practical support for effects and general recursion in dependent type systems.
- The framework $\mbox{ATS}_{0}$ is formally proven to be type-safe, establishing a solid foundation for advanced type systems.
- The extension $\mbox{ATS}_{\it pf}$ supports programming with theorem-proving (PwTP), where proofs are used to internalize constraint solving during type-checking.
- Proof-erasure is formally justified: every well-typed program in $\mbox{ATS}_{\it pf}$ translates to a well-typed program in $\mbox{ATS}_{0}$ with identical dynamic behavior.
- The use of guarded and asserting types allows for precise specification of program invariants, analogous to pre- and post-conditions in Hoare logic.
- ATS unifies and extends prior work on Dependent ML and guarded recursive datatypes into a single, expressive, and formally grounded type system framework.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.