Interactive Programs and Weakly Final Coalgebras in Dependent Type Theory (Extended Version)

We reconsider the representation of interactive programs in dependent type theory that the authors proposed in earlier papers. Whereas in previous versions the type of interactive programs was introduced in an ad hoc way, it is here defined as a weakly final coalgebra for a general form of polynomial functor. The are two versions: in the first the interface with the real world is fixed, while in the second the potential interactions can depend on the history of previous interactions. The second version may be appropriate for working with specifications of interactive programs. We focus on command-response interfaces, and consider both client and server programs, that run on opposite sides such an interface. We give formation/introduction/elimination/equality rules for these coalgebras. These are explored in two dimensions: coiterative versus corecursive, and monadic versus non-monadic. We also comment upon the relationship of the corresponding rules with guarded induction. It turns out that the introduction rules are nothing but a slightly restricted form of guarded induction. However, the form in which we write guarded induction is not recursive equations (which would break normalisation -- we show that type checking becomes undecidable), but instead involves an elimination operator in a crucial way.

[1]  Peter Hancock,et al.  Ordinals and interactive programs , 2000 .

[2]  Zhaohui Luo,et al.  Inductive data types: well-ordering types revisited , 1993 .

[3]  Philip Wadler,et al.  Monads for functional programming , 1995, NATO ASI PDC.

[4]  Uday S. Reddy,et al.  Imperative functional programming , 1996, CSUR.

[5]  Robert L. Constable,et al.  Infinite Objects in Type Theory , 1986, LICS.

[6]  Dan Synek,et al.  A Set Constructor for Inductive Sets in Martin-Löf's Type Theory , 1989, Category Theory and Computer Science.

[7]  Pierre Castéran,et al.  Interactive Theorem Proving and Program Development , 2004, Texts in Theoretical Computer Science An EATCS Series.

[8]  Robin Milner,et al.  Communication and concurrency , 1989, PHI Series in computer science.

[9]  Peter Dybjer,et al.  Representing Inductively Defined Sets by Wellorderings in Martin-Löf's Type Theory , 1997, Theor. Comput. Sci..

[10]  Ingrid Lindström,et al.  A construction of non-well-founded sets within Martin-Löf's type theory , 1989, Journal of Symbolic Logic.

[11]  Marinus J. Plasmeijer,et al.  The Ins and Outs of Clean I/O , 1995, J. Funct. Program..

[12]  P. Martin-Lof,et al.  Constructive mathematics and computer programming , 1984, Philosophical Transactions of the Royal Society of London. Series A, Mathematical and Physical Sciences.

[13]  Bengt Nordström,et al.  Programming in Martin-Lo¨f's type theory: an introduction , 1990 .

[14]  Lars Hallnäs An Intensional Characterization of the Largest Bisimulation , 1987, Theor. Comput. Sci..

[15]  Andrew Donald Gordon,et al.  Functional programming and input/output , 1995 .

[16]  Eduardo Giménez,et al.  Codifying Guarded Definitions with Recursive Schemes , 1994, TYPES.

[17]  Eugenio Moggi,et al.  Computational lambda-calculus and monads , 1989, [1989] Proceedings. Fourth Annual Symposium on Logic in Computer Science.

[18]  Per Martin-Löf,et al.  Intuitionistic type theory , 1984, Studies in proof theory.

[19]  Peter Hancock,et al.  Interactive Programs in Dependent Type Theory , 2000, CSL.

[20]  Peter Dybjer,et al.  Induction-recursion and initial algebras , 2003, Ann. Pure Appl. Log..

[21]  Philip Wadler,et al.  How to declare an imperative , 1997, CSUR.

[22]  J. H. Geuvers,et al.  Inductive and Coinductive Types with Iteration and Recursion , 1992 .

[23]  Eugenio Moggi,et al.  Notions of Computation and Monads , 1991, Inf. Comput..

[24]  Pawel Urzyczyn,et al.  Type fixpoints: iteration vs. recursion , 1999, ICFP '99.

[25]  Thorsten Altenkirch,et al.  Representations of First Order Function Types as Terminal Coalgebras , 2001, TLCA.

[26]  Anton Setzer,et al.  State Dependent IO-Monads in Type Theory , 2004, CTCS.

[27]  Bart Jacobs,et al.  Categorical Logic and Type Theory , 2001, Studies in logic and the foundations of mathematics.

[28]  Peter Hancock,et al.  Specifying Interactions With Dependent Types , 2000 .