Interactive Programs in Dependent Type Theory
- 347 Downloads
We propose a representation of interactive systems in dependent type theory. This is meant as a basis for an execution environment for dependently typed programs, and for reasoning about their construction. The inspiration is the ‘I/O-monad’ of Haskell. The fundamental notion is an I/O-tree; its definition is parameterised over a general notion of dependently typed, command-response interactions called a world. I/O-trees represent strategies for one of the parties in a command/response interaction - the notion is not confined to functional programming. We present I/O-trees in two forms. The first form, which is simpler, is suitable for Turing-complete functional programming languages with general recursion, but is non-normalising. The second is definable within (ordinary) normalising type theory and we identify programs written in it as ‘normalising I/O-programs’. We define new looping constructs (while and repeat), and a new refinement construct (redirect), which permits the implementation of libraries. We introduce a bisimulation relation between interactive programs, with respect to which we prove the monad laws and defining equations of while. Most definitions in this article make essential use of the expressive strength of dependent typing.
KeywordsFunctional programming reactive programming interaction dependent types monadic I/O repetition constructs refinement
Unable to display preview. Download preview PDF.
- 1.L. Augustsson. Cayenne — a language with dependent types. In Proc. of the International Conference on Functional Programming (ICFP’98). ACM Press, September 1998.Google Scholar
- 3.P. Hancock and A. Setzer. The IO monad in dependent type theory. DTP’99, http://www.md.chalmers.se/Cs/Research/Semantics/APPSEM/dtp99/proceedings.html, 1999.
- 4.J. Hughes. The design of a pretty-printing library. In J. Jeuring and E. Meijer, editors, Advanced Functional Programming, volume 925 of LNCS, pages 53–93. Springer, 1995.Google Scholar
- 6.P. Martin-Löf. Constructive mathematics and computer programming. In J. L. Cohen, J. H Loś, H. Pfeiffer, and K.-D. Podewski, editors, Proceedings 6th Intl. Congress on Logic, Methodology and Philosophy of Science, Hannover, FRG, 22–29 Aug 1979, pages 153–175. North Holland, Amsterdam, 1982.Google Scholar
- 7.P. Martin-Löf. Intuitionistic Type Theory, volume 1 of Studies in Proof Theory: Lecture Notes. Bibliopolis, Napoli, 1984.Google Scholar
- 10.S. L. Peyton Jones and P. Wadler. Imperative functional programming. In 20’th ACM Symposium on Principles of Programming Languages, Charlotte, North Carolina, January 1993.Google Scholar
- 12.P. Wadler. The essence of functional programming. In 19’th Symposium on Principles of Programming Languages, Albuquerque, volume 19. ACM Press, January 1992.Google Scholar
- 13.P. Wadler. Monads for functional programming. In J. Jeuring and E. Meijer, editors, Advanced Functional Programming, volume 925 of LNCS. Springer Verlag, 1995.Google Scholar