Author:
KENNEDY ANDREW J.,VYTINIOTIS DIMITRIOS
Abstract
AbstractWe show how the binary encoding and decoding of typed data and typed programs can be understood, programmed and verified with the help of question–answer games. The encoding of a value is determined by the yes/no answers to a sequence of questions about that value; conversely, decoding is the interpretation of binary data as answers to the same question scheme. We introduce a general framework for writing and verifying game-based codecs. We present games in Haskell for structured, recursive, polymorphic and indexed types, building up to a representation of well-typed terms in the simply-typed λ-calculus with polymorphic constants. The framework makes novel use of isomorphisms between types in the definition of games. The definition of isomorphisms together with additional simple properties make it easy to prove that codecs derived from games never encode two distinct values using the same code, never decode two codes to the same value and interpret any bit sequence as a valid code for a value or as a prefix of a valid code. Formal properties of the framework have been proved using the Coq proof assistant.
Publisher
Cambridge University Press (CUP)
Cited by
9 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Generating Well-Typed Terms That Are Not “Useless”;Proceedings of the ACM on Programming Languages;2024-01-05
2. Sparcl: A language for partially invertible computation;Journal of Functional Programming;2024
3. Haskell⁻¹: automatic function inversion in Haskell;Proceedings of the 14th ACM SIGPLAN International Symposium on Haskell;2021-08-18
4. Sparcl: a language for partially-invertible computation;Proceedings of the ACM on Programming Languages;2020-08-02
5. Learning Shape Analysis;Static Analysis;2017