Author:
ABEL ANDREAS,ADELSBERGER STEPHAN,SETZER ANTON
Abstract
AbstractWe develop a methodology for writing interactive and object-based programs (in the sense of Wegner) in dependently typed functional programming languages. The methodology is implemented in the ooAgda library. ooAgda provides a syntax similar to the one used in object-oriented programming languages, thanks to Agda's copattern matching facility. The library allows for the development of graphical user interfaces (GUIs), including the use of action listeners.Our notion of interactive programs is based on the IO monad defined by Hancock and Setzer, which is a coinductive data type. We use a sized coinductive type which allows us to write corecursive programs in a modular way. Objects are server-side interactive programs that respond to method calls by giving answers and changing their state. We introduce two kinds of objects: simple objects and IO objects. Methods in simple objects are pure, while method calls in IO objects allow for interactions before returning their result. Our approach also allows us to extend interfaces and objects by additional methods.We refine our approach to state-dependent interactive programs and objects through which we can avoid exceptions. For example, with a state-dependent stack object, we can statically disable the pop method for empty stacks. As an example, we develop the implementation of recursive functions using a safe stack. Using a coinductive notion of object bisimilarity, we verify basic correctness properties of stack objects and show the equivalence of different stack implementations. Finally, we give a proof of concept that our interaction model allows to write GUI programs in a natural way: we present a simple drawing program, and a program which allows the users to move a small spaceship using a button.
Publisher
Cambridge University Press (CUP)
Cited by
9 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. A simulator of Solidity-style smart contracts in the theorem prover Agda;Proceedings of the 2023 6th International Conference on Blockchain Technology and Applications;2023-12-15
2. The extended predicative Mahlo universe in Martin-Löf type theory;Journal of Logic and Computation;2023-05-12
3. Interaction trees: representing recursive and impure programs in Coq;Proceedings of the ACM on Programming Languages;2020-01
4. Intrinsically-Typed Mechanized Semantics for Session Types;Proceedings of the 21st International Symposium on Principles and Practice of Programming Languages 2019;2019-10-07
5. Bisimulation as path type for guarded recursive types;Proceedings of the ACM on Programming Languages;2019-01-02