Interactive Programs in Dependent Type Theory

  • Peter Hancock
  • Anton Setzer
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1862)

Abstract

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.

Keywords

Functional programming reactive programming interaction dependent types monadic I/O repetition constructs refinement 

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 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
  2. 2.
    L. Hallnäs. An intensional characterization of the largest bisimulation. Theoretical Computer Science, 53:335–343, 1987.MATHCrossRefMathSciNetGoogle Scholar
  3. 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. 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
  5. 5.
    I. Lindström. A construction of non-well-founded sets within Martin-Löf’s type theory. Journal of Symbolic Logic, 54(1):57–64, 1989.MATHCrossRefMathSciNetGoogle Scholar
  6. 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. 7.
    P. Martin-Löf. Intuitionistic Type Theory, volume 1 of Studies in Proof Theory: Lecture Notes. Bibliopolis, Napoli, 1984.Google Scholar
  8. 8.
    E. Moggi. Notions of computation and monads. Information and Computation, 93(1):55–92, 1991.MATHCrossRefMathSciNetGoogle Scholar
  9. 9.
    B. Nordström, K. Petersson, and J. M. Smith. Programming in Martin-Löf’ s Type Theory: An Introduction. Clarendon Press, Oxford, 1990.MATHGoogle Scholar
  10. 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
  11. 11.
    A. Setzer. Well-ordering proofs for Martin-Löf type theory. Annals of Pure and Applied Logic, 92:113–159, 1998.MATHCrossRefMathSciNetGoogle Scholar
  12. 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. 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

Copyright information

© Springer-Verlag Berlin Heidelberg 2000

Authors and Affiliations

  • Peter Hancock
    • 1
  • Anton Setzer
    • 2
  1. 1.Dept. of Computing ScienceUniversity of EdinburghEdinburghScotland
  2. 2.Dept. of MathematicsUppsala UniversityUppsalaSweden

Personalised recommendations