Abstract
We propose a novel approach to stream definition and manipulation. Our solution is based on two key ideas. Regular corecursion, which avoids non termination by detecting cyclic calls, is enhanced, by allowing in equations defining streams other operators besides the stream constructor. In this way, some non-regular streams are definable. Furthermore, execution includes a runtime check to ensure that the stream generated by a function call is well-defined, in the sense that access to an arbitrary index always succeeds. We extend the technique beyond the simple stream operators considered in previous work, notably by adding an interleaving combinator which has a non-trivial recursion scheme.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
Notes
- 1.
Here we use the syntax of our calculus, where, differently from Haskell, functions are uncurried, that is, take as arguments possibly empty tuples delimited by parentheses.
- 2.
For simplicity, here indexing and numeric expressions coincide.
- 3.
Indeed, it does not affect derivability, see Lemma 4 in the following.
- 4.
Non-well-definedness can only be detected on closed results.
- 5.
This holds for any valid derivation tree and not for this specific case.
References
Ancona, D.: Regular corecursion in Prolog. Comput. Lang. Syst. Struct. 39(4), 142–162 (2013)
Ancona, D., Barbieri, P., Dagnino, F., Zucca, E.: Sound regular corecursion in coFJ. In: Hirschfeld, R., Pape, T. (eds.) ECOOP’20 - Object-Oriented Programming. LIPIcs, vol. 166, pp. 1:1–1:28. Schloss Dagstuhl - Leibniz-Zentrum für Informatik (2020)
Ancona, D., Barbieri, P., Zucca, E.: Enhanced regular corecursion for data streams. In: ICTCS’21 - Italian Conference on Theoretical Computer Science (2021)
Ancona, D., Barbieri, P., Zucca, E.: Enhancing expressivity of checked corecursive streams (extended version) (2022). https://arxiv.org/abs/2202.06868
Ancona, D., Dagnino, F., Zucca, E.: Generalizing inference systems by coaxioms. In: Yang, H. (ed.) ESOP 2017. LNCS, vol. 10201, pp. 29–55. Springer, Heidelberg (2017). https://doi.org/10.1007/978-3-662-54434-1_2
Ancona, D., Dovier, A.: A theoretical perspective of coinductive logic programming. Fund. Inform. 140(3–4), 221–246 (2015)
Ancona, D., Zucca, E.: Corecursive featherweight Java. In: FTfJP’12 - Formal Techniques for Java-like Programs, pp. 3–10. ACM Press (2012)
Courcelle, B.: Fundamental properties of infinite trees. Theoret. Comput. Sci. 25, 95–169 (1983)
Czajka, L.: A new coinductive confluence proof for infinitary lambda calculus. Log. Methods Comput. Sci. 16(1) (2020)
Dagnino, F.: Flexible coinduction. Ph.D. thesis, DIBRIS, University of Genova (2021)
Dagnino, F., Ancona, D., Zucca, E.: Flexible coinductive logic programming. Theory Pract. Logic Program. 20(6), 818–833 (2020). Issue for ICLP 2020
Hinze, R.: Concrete stream calculus: an extended study. J. Funct. Program. 20(5–6), 463–535 (2010)
Jeannin, J.-B., Kozen, D.: Computing with capsules. J. Autom. Lang. Comb. 17(2–4), 185–204 (2012)
Jeannin, J.-B., Kozen, D., Silva, A.: CoCaml: functional programming with regular coinductive types. Fund. Inform. 150, 347–377 (2017)
Komendantskaya, E., Johann, P., Schmidt, M.: A productivity checker for logic programming. In: Hermenegildo, M.V., Lopez-Garcia, P. (eds.) LOPSTR 2016. LNCS, vol. 10184, pp. 168–186. Springer, Cham (2017). https://doi.org/10.1007/978-3-319-63139-4_10
Komendantskaya, E., Power, J., Schmidt, M.: Coalgebraic logic programming: from semantics to implementation. J. Log. Comput. 26(2), 745–783 (2016)
Rutten, J.J.M.M.: A coinductive calculus of streams. Math. Struct. Comput. Sci. 15(1), 93–147 (2005)
Simon, L.: Extending logic programming with coinduction. Ph.D. thesis, University of Texas at Dallas (2006)
Simon, L., Bansal, A., Mallya, A., Gupta, G.: Co-logic programming: extending logic programming with coinduction. In: Arge, L., Cachin, C., Jurdziński, T., Tarlecki, A. (eds.) ICALP 2007. LNCS, vol. 4596, pp. 472–483. Springer, Heidelberg (2007). https://doi.org/10.1007/978-3-540-73420-8_42
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2022 Springer Nature Switzerland AG
About this paper
Cite this paper
Ancona, D., Barbieri, P., Zucca, E. (2022). Enhancing Expressivity of Checked Corecursive Streams. In: Hanus, M., Igarashi, A. (eds) Functional and Logic Programming. FLOPS 2022. Lecture Notes in Computer Science, vol 13215. Springer, Cham. https://doi.org/10.1007/978-3-030-99461-7_1
Download citation
DOI: https://doi.org/10.1007/978-3-030-99461-7_1
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-030-99460-0
Online ISBN: 978-3-030-99461-7
eBook Packages: Computer ScienceComputer Science (R0)