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.
[1] Andreas Abel,et al. Normalization by Evaluation in the Delay Monad: A Case Study for Coinduction via Copatterns and Sized Types , 2014, MSFP.
[2] Brigitte Pientka,et al. Well-founded recursion with copatterns and sized types , 2016, Journal of Functional Programming.
[3] Venanzio Capretta,et al. General recursion via coinductive types , 2005, Log. Methods Comput. Sci..