A framework for the recursive definition of data structures (original) (raw)

Data Abstraction and General Recursion

1991

Existing approaches to semantics of algebraically specified data types such as Initial Algebra Semantics and Final Algebra Semantics do not take into account the possibility of general recursion and hence nontermination in the ambient programming language. Any technical development of this problem needs to be in the setting of domain theory. In this paper we present extensions of initial and final algebra semantics to algebras with an underlying domain structure. Four possibilities for specification methodologies arise: two each in the Initial and Final algebra paradigms. We demonstrate that the initial/final objects (as appropriate) exist in all four situations. The final part of the paper attempts to explicate the notion of abstractness of ADT's by defining a notion of operational semantics for ADT's, and then studying the relationship between the various algebraic-semantics proposed and the operational semantics. Comments University of Pennsylvania Department of Computer ...

Recursive Array Comprehensions in a Call-by-Value Language

Proceedings of the 29th Symposium on the Implementation and Application of Functional Programming Languages

Recursive value definitions in the context of functional programming languages that are based on a call-by-value semantics are known to be challenging. A lot of prior work exists in the context of languages such as Scheme and OCaml. In this paper, we look at the problem of recursive array definitions within a call-by-value setting. We propose a solution that enables recursive array definitions as long as there are no cyclic dependences between array elements. The paper provides a formal semantics definition, sketches possible compiler implementations and relates to a prototypical implementation of an interpreter in OCaml. Furthermore, we briefly discuss how this approach could be extended to other data structures and how it could serve as a basis to further extend mutually recursive value definitions in a call-by-value setting in general. CCS CONCEPTS • Software and its engineering → Functional languages; Recursion; Compilers; • Computing methodologies → Parallel programming languages;

Recursion Patterns and Their Impact on Programming Language Design

2013

Applicative/functional programming is considerably simplified through the use of specific recursion patterns as opposed to general recursion. The viability of catamorphic recursion patterns as a pragmatic and theoretical basis makes it feasible to consider a programming language based on them. Syntactic considerations focus on notation to clarify the structures involved in the use of catamorphisms in this critical role. More fundamental semantic considerations involve the recognition that a catamorphic programming style essentially involves the treatment of data exclusively as functions and the extension of this approach to the derivation of other types of data whose behaviours are not generally catamorphic. Implementation by preprocessing into Haskell can be structured to avoid the limitations of Haskell's types, but a general regime of dynamic types seems unavoidable as an alternative. Clear connections with other work on subrecursive programming illuminates other paths for further development.

A predicative analysis of structural recursion

2002

We introduce a language based upon lambda calculus with products, coproducts and strictly positive inductive types that allows the definition of recursive terms. We present the implementation (foetus) of a syntactical check that ensures that all such terms are structurally recursive, i.e., recursive calls appear only with arguments structurally smaller than the input parameters of terms considered. To ensure the correctness of the termination checker, we show that all structurally recursive terms are normalizing with respect to a given operational semantics. To this end, we define a semantics on all types and a structural ordering on the values in this semantics and prove that all values are accessible with regard to this ordering. Finally, we point out how to do this proof predicatively using set based operators.

Algebraic Specification for Input-Output in Abstract Data Types

Mathematics and Computer Science, 2021

Data Types (ADT) are used when creating software systems, in the systems design. Usually we use algebraic specification to specify the operations in a data type. The use of data types is a methodology or style of working which yields improved design when followed. In this paper we study the addition of input-output operations to the algebraic specification of operations over a data type. The motivation is that input-output operations are used in actual implementations. A specification with input-output is more complete than one without it. We need input-output operations in our programs. This justifies the addition of such operations to the specification. We consider the definition of input-output operations in functional programming in particular in Haskell. Our input-output specifications are not exactly equal to Haskell programs although some of them are likely. We specify input-output operations in a form likely to the specification of the other operations. The result is the algebraic specification of the input-output operations for many frequently used data types. The language considered is sufficiently expressive to model all these operations. The technique is illustrated by means of a variety of examples. We started from sequences, continued with sets and finish with dictionaries. The specifications we present in this paper can be used as specifications of methods of ADT definitions in object oriented programing.

Compilation of extended recursion in call-by-value functional languages

This paper formalizes and proves correct a compilation scheme for mutually-recursive definitions in call-by-value functional languages. This scheme supports a wider range of recursive definitions than previous methods. We formalize our technique as a translation scheme to a lambda-calculus featuring in-place update of memory blocks, and prove the translation to be correct.

Recursion, Iteration and Functional Languages

1998

Functional programming languages are shown to be useful in the teaching of the concepts of recursion and iteration. The functional language approach presented in this paper has advantages over imperative languages in the area of analysis of recursive and iterative algorithms. Examples using the J and Scheme programming languages, with emphasis on the use of functional programming notation in exposition are given. 1

Abstractions for recursive pointer data structures

Proceedings of the ACM SIGPLAN 1992 conference on Programming language design and implementation - PLDI '92, 1992

Even though impressive progress has been made in the area of optimizing and parallelizing programs with arrays, the application of similar techniques to programs with pointer data structures has remained di cult. In this paper we introduce a new approach that leads to improved analysis and transformation of programs with recursively-de ned pointer data structures. Our approach is based on a mechanism for the Abstract Description of Data Structures (ADDS), which makes explicit the important properties, such as dimensionality, of pointer data structures. Numerous examples demonstrate that ADDS de nitions are both natural to specify and exible enough to describe complex, cyclic pointer data structures. We discuss how an abstract data structure description can improve program analysis by presenting an analysis approach that combines an alias analysis technique, path matrix analysis, with information available from an ADDS declaration. Given this improved alias analysis technique, we provide a concrete example of applying a software pipelining transformation to loops involving pointer data structures.

Fixing idioms: A recursion primitive for applicative DSLs

PEPM 2013 - Proceedings of the ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation, Co-located with POPL 2013, 2013

In a lazy functional language, the standard encoding of recursion in DSLs uses the host language's recursion, so that DSL algorithms automatically use the host language's least fixpoints, even though many domains require algorithms to produce different fixpoints. In particular, this is the case for DSLs implemented as Applicative functors (structures with a notion of pure computations and function application). We propose a recursion primitive afix that models a recursive binder in a finally tagless HOAS encoding, but with a novel rank-2 type that allows us to specify and exploit the effectsvalues separation that characterises Applicative DSLs. Unlike related approaches for Monad s and Arrow s, we model effectful recursion, not value recursion.