Combining proofs and programs in a dependently typed language

Chris Casinghino, Vilhelm Sjöberg, Stephanie Weirich

2014 · 67 citations · 37 references

DOIFull text

Open access

Concepts

TL;DR

Dependently‑typed languages typically enforce termination or allow nontermination at the cost of logical consistency. The paper proposes a core language that merges a termination‑guaranteed logic with a nonterminating, type‑safe programming fragment. It unifies a total‑correctness logic and a call‑by‑value language, sharing syntax and semantics, so that logical expressions can be used as programs, proofs can be passed as arguments, and runtime‑computed proofs can serve as evidence. The resulting language lets programmers handle total and partial functions uniformly, easing the transition from functional to dependently‑typed programming.

Abstract

Most dependently-typed programming languages either require that all expressions terminate (e.g. Coq, Agda, and Epigram), or allow infinite loops but are inconsistent when viewed as logics (e.g. Haskell, ATS, Ωmega. Here, we combine these two approaches into a single dependently-typed core language. The language is composed of two fragments that share a common syntax and overlapping semantics: a logic that guarantees total correctness, and a call-by-value programming language that guarantees type safety but not termination. The two fragments may interact: logical expressions may be used as programs; the logic may soundly reason about potentially nonterminating programs; programs can require logical proofs as arguments; and "mobile" program values, including proofs computed at runtime, may be used as evidence by the logic. This language allows programmers to work with total and partial functions uniformly, providing a smooth path from functional programming to dependently-typed programming.

References

37