Skip to main content Accessibility help

Finiteness and rational sequences, constructively*



Rational sequences are possibly infinite sequences with a finite number of distinct suffixes. In this paper, we present different implementations of rational sequences in Martin–Löf type theory. First, we literally translate the above definition of rational sequence into the language of type theory, i.e., we construct predicates on possibly infinite sequences expressing the finiteness of the set of suffixes. In type theory, there exist several inequivalent notions of finiteness. We consider two of them, listability and Noetherianness, and show that in the implementation of rational sequences the two notions are interchangeable. Then we introduce the type of lists with backpointers, which is an inductive implementation of rational sequences. Lists with backpointers can be unwound into rational sequences, and rational sequences can be truncated into lists with backpointers. As an example, we see how to convert the fractional representation of a rational number into its decimal representation and vice versa.



Hide All

This work was supported by the ERDF funded project Coinduction, the Estonian Ministry of Education and Research institutional research grant no. IUT33-13 and the Estonian Science Foundation grant no. 9475.



Hide All
Adámek, J., Milius, S. & Velebil, J. (2003) Free iterative theories: A coalgebraic view. Math. Struct. Comput. Sci. 13 (2), 259320.
Ancona, D. (2013) Regular corecursion in Prolog. Comput. Lang. Syst. Struct. 39 (4), 142162.
Bezem, M., Nakata, K. & Uustalu, T. (2012) On streams that are finitely red. Log. Meth. Comput. Sci. 8 (4), article 4.
Bloom, S. L. & Elgot, C. C. (1976) The existence and construction of free iterative theories. J. Comput. Syst. Sci. 12 (3), 305318.
Coquand, T. & Spiwack, A. (2010) Constructively finite? In Scientific Contributions in Honor of Mirian Andrés Gómez, Laureano Lambán, L., Romero, A. & Rubio, J. (eds), Universidad de La Rioja, pp. 217230.
Courcelle, B. (1983) Fundamental properties of infinite trees. Theor. Comput. Sci. 25, 95169.
Elgot, C. C. (1975) Monadic computation and iterative algebraic theories. In Logic Colloquium '73, Studies in Logic and Foundations of Mathematics, vol. 80, Amsterdam: North-Holland, pp. 175230.
Elgot, C. C., Bloom, S. L. & Tindell, R. (1978) On the algebraic structure of rooted trees. J. Comput. Syst. Sci. 16 (3), 361399.
Firsov, D. & Uustalu, T. (2015) Dependently typed programming with finite sets. In Proceedings of 11th ACM SIGPLAN Wksh. on Generic Programming, WGP '15, New York: ACM Press, pp. 3344.
Firsov, D., Uustalu, T. & Veltri, N. (2016) Variations on Noetherianness. In Proceedings of 6th Wksh. on Mathematically Structured Functional Programming, MSFP 2016, Atkey, R. & Krishnaswami, N. (eds), Electron. Proc. in Theor. Comput. Sci. Sydney: Open Publishing Assoc.
Ghani, N., Hamana, M., Uustalu, T. & Vene, V. (2006) Representing cyclic structures as nested datatypes (2006). In Proceedings of 7th Symp. on Trends in Functional Programming, TFP 2006, Nilsson, H. (ed), Univ. of Nottingham, pp. 173188.
Ginali, S. (1979) Regular trees and the free iterative theory. J. Comput. Syst. Sci. 18 (3), 228242.
Huet, G. (1997) The zipper. J. Funct.Program. 7 (5), 549554.
Jeannin, J.-B., Kozen, D. & Silva, A. (2013) Language constructs for non-well-founded computation. In Proceedings of 22nd European Symposium on Programming, ESOP 2013, Felleisen, M. & Gardner, P. (eds), Lect. Notes in Comput. Sci., vol. 7792, Heidelberg: Springer, pp. 6180.
Norell, U. (2009) Dependently typed programming in Agda. In Revised Lectures from 6th International School. on Advanced Functional Programming, AFP 2008, Koopman, P., Plasmeijer, R. & Swierstra, S. D. (eds), Lect. Notes in Comput. Sci., vol. 5832, Heidelberg: Springer, pp. 230266.
Parmann, E. (2014) Investigating streamless sets. In Proceedings of 20th International Conference on Types for Proofs and Programs, TYPES 2014, Herbelin, H., Letouzey, P. & Sozeau, M. (eds), Leibniz Int. Proc. in Informatics, vol. 39, Saarbrücken/Wadern: Dagstuhl Publishing, pp. 187201.
Spadotti, R. (2015) A mechanized theory of regular trees in dependent type theory. In Proceedings of 6th International Conference on Interactive Theorem Proving, ITP 2015, Urban, C. & Zhang, X. (eds), Lect. Notes in Comput. Sci., vol. 9236, Heidelberg: Springer, pp. 405420.
Spadotti, R. (2016) Une théorie mécanisée des arbres réguliers en théorie des types dépendants. PhD Thesis, Université Toulouse 3 Paul Sabatier.
Turbak, F. & Wells, J. (2001) Cycle therapy: A prescription for fold and unfold on regular trees. In Proceedings of 3rd ACM SIGPLAN International Conference on Principles and Practice of Declarative Programming, PPDP 2001, New York: ACM Press, pp. 137149.

Related content

Powered by UNSILO

Finiteness and rational sequences, constructively*



Full text views

Total number of HTML views: 0
Total number of PDF views: 0 *
Loading metrics...

Abstract views

Total abstract views: 0 *
Loading metrics...

* Views captured on Cambridge Core between <date>. This data will be updated every 24 hours.

Usage data cannot currently be displayed.

Finiteness and rational sequences, constructively*

Submit a response


No Discussions have been published for this article.


Reply to: Submit a response

Your details

Conflicting interests

Do you have any conflicting interests? *