Proving Productivity in Infinite Data Structures (original) (raw)
Related papers
Ensuring the Productivity of Infinite Structures
1997
It is our aim to produce an elementary strong functional programming (ESFP) system. To be useful, ESFP should include structures such as streams which can be computationally unwound infinitely often. We describe a syntactic analysis to ensure that infinitely proceeding structures, which we shall term codata , are productive. This analysis is an extension of the check for guardedness that has been used with definitions over coinductive types in Martin-Lof's type theory and in the calculus of constructions. Our analysis is presented as a form of abstract interpretation that allows a wider syntactic class of corecursive definitions to be recognised as productive than in previous work. Thus programmers will have fewer restrictions on their use of infinite streams within a strongly normalizing functional language.
A Tool Proving Well-Definedness of Streams Using Termination Tools
Lecture Notes in Computer Science, 2009
A stream specification is a set of equations intended to define a stream, that is, an infinite sequence over a given data type. In [5] a transformation from such a stream specification to a TRS is defined in such a way that termination of the resulting TRS implies that the stream specification admits a unique solution. In this tool description we present how proving such well-definedness of several interesting boolean stream specifications can be done fully automatically using present powerful tools for proving TRS termination.
Stream Productivity by Outermost Termination
Electronic Proceedings in Theoretical Computer Science, 2010
Streams are infinite sequences over a given data type. A stream specification is a set of equations intended to define a stream. A core property is productivity: unfolding the equations produces the intended stream in the limit. In this paper we show that productivity is equivalent to termination with respect to the balanced outermost strategy of a TRS obtained by adding an additional rule. For specifications not involving branching symbols balancedness is obtained for free, by which tools for proving outermost termination can be used to prove productivity fully automatically.
Copatterns: programming infinite structures by observations
2013
Inductive datatypes provide mechanisms to define finite data such as finite lists and trees via constructors and allow programmers to analyze and manipulate finite data via pattern matching. In this paper, we develop a dual approach for working with infinite data structures such as streams. Infinite data inhabits coinductive datatypes which denote greatest fixpoints. Unlike finite data which is defined by constructors we define infinite data by observations. Dual to pattern matching, a tool for analyzing finite data, we develop the concept of copattern matching, which allows us to synthesize infinite data. This leads to a symmetric language design where pattern matching on finite and infinite data can be mixed. We present a core language for programming with infinite structures by observations together with its operational semantics based on (co)pattern matching and describe coverage of copatterns. Our language naturally supports both call-by-name and call-by-value interpretations and can be seamlessly integrated into existing languages like Haskell and ML. We prove type soundness for our language and sketch how copatterns open new directions for solving problems in the interaction of coinductive and dependent types.
On problems of databases over a fixed infinite universe
Banach Center Publications, 1999
In the relational model of databases a database state is thought of as a nite collection of relations between elements. For many applications it is convenient to pre-x an in nite domain where the nite relations are going to be de ned. Often, we also x a set of domain functions and/or relations. These functions/relations are in nite by their nature. Some special problems arise if we use such an approach. In the paper we discuss some of the problems. We show that there exists a recursive domain with decidable theory in which (1) there is no recursive syntax for nite queries, and in which (2) the state-safety problem is undecidable. We provide very general conditions on the FO theory of an ordered domain that ensure collapse of order-generic extended FO queries to pure order queries over this domain: the Pseudo-nite Homogeneity Property and a stronger Isolation Property. We further distinguish one broad class of ordered domains satisfying the Isolation Property, the so-called quasi-o-minimal domains. This class includes all o-minimal domains, but also the ordered group of integer numbers and the ordered semigroup of natural numbers, and some other domains. We generalize all the notions to the case of nitely representable database states | as opposed to nite states | and develop a general lifting technique that, essentially, allows us to extend any result of the kind we are interested in, from nite to nitely-representable states. We show, however, that these results cannot be transferred to arbitrary in nite states. We prove that safe Datalog :;<z-programs do not have any e ective syntax.
Well-definedness of Streams by Transformation and Termination
Logical Methods in Computer Science, 2010
Streams are infinite sequences over a given data type. A stream specification is a set of equations intended to define a stream. We propose a transformation from such a stream specification to a term rewriting system (TRS) in such a way that termination of the resulting TRS implies that the stream specification is well-defined, that is, admits a unique solution. As a consequence, proving well-definedness of several interesting stream specifications can be done fully automatically using present powerful tools for proving TRS termination. In order to increase the power of this approach, we investigate transformations that preserve semantics and well-definedness. We give examples for which the above mentioned technique applies for the transformed specification while it fails for the original one.
Computation on abstract data types. The extensional approach, with an application to streams
In this paper we specialize the notion of abstract computational procedure previously introduced for intensionally presented structures to those which are extensionally given. This is provided by a form of generalized recursion theory which uses schemata for explicit definition, conditional definition and least fixed point (LFP) recursion in functionals of type level ≤ 2 over any appropriate structure. It is applied here to the case of potentially infinite (and more general partial) streams as an abstract data type.
Well-definedness of Streams by Termination
Streams are infinite sequences over a given data type. A stream specification is a set of equations intended to define a stream. We propose a transformation from such a stream specification to a TRS in such a way that termination of the resulting TRS implies that the stream specification admits a unique solution. As a consequence, proving such well-definedness of several interesting stream specifications can be done fully automatically using present powerful tools for proving TRS termination.
Contractive Functions on Infinite Data Structures
2016
Coinductive data structures, such as streams or infinite trees, have many applications in functional programming and type theory, and are naturally defined using recursive equations. But how do we ensure that such equations make sense, i.e. that they actually generate a productive infinite object? A standard means to achieve productivity is to use Banach's fixed-point theorem, which guarantees the unique existence of solutions to recursive equations on metric spaces under certain conditions. Functions satisfying these conditions are called contractions. In this article, we give a new characterization of contractions on streams in the form of a sound and complete representation theorem, and generalize this result to a wide class of non-well-founded structures, first to infinite binary trees, then to final coalgebras of container functors. These results have important potential applications in functional programming, where coinduction and corecursion are successfully deployed to m...
Query languages for sequence databases: termination and complexity
IEEE Transactions on Knowledge and Data Engineering, 2001
This paper develops a query language for sequence databases, such as genome databases and text databases. Unlike relational data, queries over sequential data can easily produce in nite answer sets, since the universe of sequences is in nite, even for a nite alphabet. The challenge is to develop query languages that are both highly expressive and nite. This paper develops such a language as a subset of a logic for string databases called Sequence Datalog. The main idea is to use safe recursion to control and limit unsafe recursion. The main results are the de nition of a nite form of recursion, called domain{bounded recursion, and a characterization of its complexity and expressive power. Although nite, the resulting class of programs is highly expressive, since its data complexity is complete for the elementary functions.