Normalization by Evaluation in the Delay Monad
نویسندگان
چکیده
We present an Agda formalization of a normalization proof for simply-typed lambda terms. The normalizer consists of two coinductively defined functions in the delay monad: One is a standard evaluator of lambda terms to closures, the other a type-directed reifier from values to η-long β-normal forms. Their composition, normalization-by-evaluation, is shown to be a total function a posteriori, using a standard logical-relations argument. The normalizer is then shown to be sound and complete. The completeness proof proof is dependent on termination. We also discuss a variation on this normalizer where environments used by the evaluator contain delayed values which can be proven complete independently of termination using weak bisimilarity. This approach would be a realisation of an aim of this work to present a modular proof of normalization where termination, soundness and completeness are independent. The successful formalization serves as a proof-of-concept for coinductive programming and reasoning using sized types and copatterns [3], a new and presently experimental feature of Agda [4]. Termination of a normalizer was described in [2]. The soundness and completeness proofs are new[1] and the alternative normalizer with delayed environments and accompanying normalization proof is ongoing work.
منابع مشابه
Normalization by Evaluation in the Delay Monad: A Case Study for Coinduction via Copatterns and Sized Types
In this paper we present an Agda formalization of a normalizer for simply-typed lambda terms. The first step is to write a coinductive evaluator using the delay monad. The other component of the normalizer, a type-directed reifier from values to η-long β -normal forms, resides in the delay monad as well. Their composition, normalization-by-evaluation, is shown to be a total function, using a st...
متن کاملPartiality, Revisited - The Partiality Monad as a Quotient Inductive-Inductive Type
Capretta’s delay monad can be used to model partial computations, but it has the “wrong” notion of built-in equality, strong bisimilarity. An alternative is to quotient the delay monad by the “right” notion of equality, weak bisimilarity. However, recent work by Chapman et al. suggests that it is impossible to define a monad structure on the resulting construction in common forms of type theory...
متن کاملApplications of the Kleisli and Eilenberg-Moore 2-adjunctions
In 2010, J. Climent Vidal and J. Soliveres Tur developed, among other things, a pair of 2-adjunctions between the 2-category of adjunctions and the 2-category of monads. One is related to the Kleisli adjunction and the other to the Eilenberg-Moore adjunction for a given monad.Since any 2-adjunction induces certain natural isomorphisms of categories, these can be used to classify bijection...
متن کاملThe Delay Monad and Restriction Categories
We continue the study of Capretta’s delay monad as a means of introducing non-termination from iteration into Martin-Löf type theory. In particular, we explain in what sense this monad provides a canonical solution. We discuss a class of monads that we call ω-complete pointed classifying monads. These are monads whose Kleisli category is an ωcomplete pointed restriction category where pure maps...
متن کاملQuotienting the Delay Monad by Weak Bisimilarity
The delay datatype was introduced by Capretta [2] as a means to incorporate general recursion to Martin-Löf type theory and it is useful in this setting for modeling non-terminating behaviours. This datatype is a (strong) monad and constitutes a constructive alternative to the maybe monad. For a given set X, each element of DX is a possibly infinite computation that returns a value of X, if it ...
متن کامل