Skip to main content
×
Home
    • Aa
    • Aa

Finiteness and rational sequences, constructively*

  • TARMO UUSTALU (a1) and NICCOLÒ VELTRI (a1)
Abstract
Abstract

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.

Copyright
Footnotes
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.

Footnotes
References
Hide All
AdámekJ., MiliusS. & VelebilJ. (2003) Free iterative theories: A coalgebraic view. Math. Struct. Comput. Sci. 13 (2), 259320.
AnconaD. (2013) Regular corecursion in Prolog. Comput. Lang. Syst. Struct. 39 (4), 142162.
BezemM., NakataK. & UustaluT. (2012) On streams that are finitely red. Log. Meth. Comput. Sci. 8 (4), article 4.
BloomS. L. & ElgotC. C. (1976) The existence and construction of free iterative theories. J. Comput. Syst. Sci. 12 (3), 305318.
CoquandT. & SpiwackA. (2010) Constructively finite? In Scientific Contributions in Honor of Mirian Andrés Gómez, Laureano LambánL., RomeroA. & RubioJ. (eds), Universidad de La Rioja, pp. 217230.
CourcelleB. (1983) Fundamental properties of infinite trees. Theor. Comput. Sci. 25, 95169.
ElgotC. 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.
ElgotC. C., BloomS. L. & TindellR. (1978) On the algebraic structure of rooted trees. J. Comput. Syst. Sci. 16 (3), 361399.
FirsovD. & UustaluT. (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.
FirsovD., UustaluT. & VeltriN. (2016) Variations on Noetherianness. In Proceedings of 6th Wksh. on Mathematically Structured Functional Programming, MSFP 2016, AtkeyR. & KrishnaswamiN. (eds), Electron. Proc. in Theor. Comput. Sci. Sydney: Open Publishing Assoc.
GhaniN., HamanaM., UustaluT. & VeneV. (2006) Representing cyclic structures as nested datatypes (2006). In Proceedings of 7th Symp. on Trends in Functional Programming, TFP 2006, NilssonH. (ed), Univ. of Nottingham, pp. 173188.
GinaliS. (1979) Regular trees and the free iterative theory. J. Comput. Syst. Sci. 18 (3), 228242.
HuetG. (1997) The zipper. J. Funct.Program. 7 (5), 549554.
JeanninJ.-B., KozenD. & SilvaA. (2013) Language constructs for non-well-founded computation. In Proceedings of 22nd European Symposium on Programming, ESOP 2013, FelleisenM. & GardnerP. (eds), Lect. Notes in Comput. Sci., vol. 7792, Heidelberg: Springer, pp. 6180.
NorellU. (2009) Dependently typed programming in Agda. In Revised Lectures from 6th International School. on Advanced Functional Programming, AFP 2008, KoopmanP., PlasmeijerR. & SwierstraS. D. (eds), Lect. Notes in Comput. Sci., vol. 5832, Heidelberg: Springer, pp. 230266.
ParmannE. (2014) Investigating streamless sets. In Proceedings of 20th International Conference on Types for Proofs and Programs, TYPES 2014, HerbelinH., LetouzeyP. & SozeauM. (eds), Leibniz Int. Proc. in Informatics, vol. 39, Saarbrücken/Wadern: Dagstuhl Publishing, pp. 187201.
SpadottiR. (2015) A mechanized theory of regular trees in dependent type theory. In Proceedings of 6th International Conference on Interactive Theorem Proving, ITP 2015, UrbanC. & ZhangX. (eds), Lect. Notes in Comput. Sci., vol. 9236, Heidelberg: Springer, pp. 405420.
SpadottiR. (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.
TurbakF. & WellsJ. (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.
Recommend this journal

Email your librarian or administrator to recommend adding this journal to your organisation's collection.

Journal of Functional Programming
  • ISSN: 0956-7968
  • EISSN: 1469-7653
  • URL: /core/journals/journal-of-functional-programming
Please enter your name
Please enter a valid email address
Who would you like to send this to? *
×

Metrics

Full text views

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

Abstract views

Total abstract views: 251 *
Loading metrics...

* Views captured on Cambridge Core between 5th April 2017 - 22nd October 2017. This data will be updated every 24 hours.