Results 1  10
of
21
Functional Programming with Graphs
 2ND ACM SIGPLAN INT. CONF. ON FUNCTIONAL PROGRAMMING
, 1997
"... Graph algorithms expressed in functional languages often suffer from their inherited imperative, statebased style. In particular, this impedes formal program manipulation. We show how to model persistent graphs in functional languages by graph constructors. This provides a decompositional view of g ..."
Abstract

Cited by 29 (10 self)
 Add to MetaCart
Graph algorithms expressed in functional languages often suffer from their inherited imperative, statebased style. In particular, this impedes formal program manipulation. We show how to model persistent graphs in functional languages by graph constructors. This provides a decompositional view of graphs which is very close to that of data types and leads to a "more functional" formulation of graph algorithms. Graph constructors enable the definition of general fold operations for graphs. We present a promotion theorem for one of these folds that allows program fusion and the elimination of intermediate results. Fusion is not restricted to the elimination of treelike structures, and we prove another theorem that facilitates the elimination of intermediate graphs. We describe an MLimplementation of persistent graphs which efficiently supports the presented fold operators. For example, depthfirstsearch expressed by a fold over a functional graph has the same complexity as the corresp...
Abstract datatypes in PVS
 C.S. Lab., SRI International
, 1993
"... under contract NAS 118969 ..."
Steps Towards Mechanizing Program Transformations Using PVS
 Science of Computer Programming
, 1996
"... PVS is a highly automated framework for specification and verification. We show how the language and deduction features of PVS can be used to formalize, mechanize, and apply some useful program transformation techniques. We examine two such examples in detail. The first is a fusion theorem due to Bi ..."
Abstract

Cited by 10 (1 self)
 Add to MetaCart
PVS is a highly automated framework for specification and verification. We show how the language and deduction features of PVS can be used to formalize, mechanize, and apply some useful program transformation techniques. We examine two such examples in detail. The first is a fusion theorem due to Bird where the composition of a catamorphism (a recursive operation on the structure of a datatype) and an anamorphism (an operation that constructs instances of the datatype) is fused to eliminate the intermediate data structure. The second example is Wand's continuationbased transformation technique for deriving tailrecursive functions from nontailrecursive ones. These examples illustrate the utility of the language and inference features of PVS in capturing these transformations in a simple, general, and useful form. 1 Introduction Correctnesspreserving program transformations [15] often capture deep algorithmic insight and therefore pose interesting challenges for mechanization. The...
Constructing RedBlack Trees
, 1999
"... This paper explores the structure of redblack trees by solving an apparently simple problem: given an ascending sequence of elements, construct a redblack tree which contains the elements in symmetric order. Several extreme redblack tree shapes are characterized: trees of minimum and maximum heig ..."
Abstract

Cited by 9 (3 self)
 Add to MetaCart
This paper explores the structure of redblack trees by solving an apparently simple problem: given an ascending sequence of elements, construct a redblack tree which contains the elements in symmetric order. Several extreme redblack tree shapes are characterized: trees of minimum and maximum height, trees with a minimal and with a maximal proportion of red nodes. These characterizations are obtained by relating tree shapes to various number systems. In addition, connections to leftcomplete trees, AVL trees, and halfbalanced trees are highlighted. 1 Introduction Redblack trees are an elegant searchtree scheme that guarantees O(log n) worstcase running time of basic dynamicset operations. Recently, C. Okasaki (1998; 1999) presented an impressively simple functional implementation of redblack trees. In this paper we plunge deeper into the structure of redblack trees by solving an apparently simple problem: given an ascending sequence of elements, construct a redblack tree whic...
Constructively characterizing fold and unfold
 In 13th International Symposium on Logicbased Program Synthesis and Transformation (LOPSTR 2003), held August 2527 in
, 2003
"... Abstract. In this paper we formally state and prove theorems characterizing when a function can be constructively reformulated using the recursion operators fold and unfold, i.e. given a function h, when can a function g be constructed such that h = fold g or h = unfold g? These results are refineme ..."
Abstract

Cited by 3 (2 self)
 Add to MetaCart
Abstract. In this paper we formally state and prove theorems characterizing when a function can be constructively reformulated using the recursion operators fold and unfold, i.e. given a function h, when can a function g be constructed such that h = fold g or h = unfold g? These results are refinements of the classical characterization of fold and unfold given by Gibbons, Hutton and Altenkirch in [6]. The proofs presented here have been formalized in Nuprl’s constructive type theory [5] and thereby yield program transformations which map a function h (accompanied by the evidence that h satisfies the required conditions), to a function g such that h = fold g or, as the case may be, h = unfold g. 1
Polytypic Abstraction in Type Theory
 Informal Proceedings of Workshop on Generic Programming (WGP98). Marstrand
, 1998
"... ion in Type Theory H. Pfeifer and H. Rueß Universitat Ulm Fakultat fur Informatik D89069 Ulm, Germany fpfeifer,ruessg@informatik.uniulm.de Abstract. This paper is concerned with formalizations and verifications in type theory that are abstracted with respect to a large class of datatypes; i.e po ..."
Abstract

Cited by 2 (0 self)
 Add to MetaCart
ion in Type Theory H. Pfeifer and H. Rueß Universitat Ulm Fakultat fur Informatik D89069 Ulm, Germany fpfeifer,ruessg@informatik.uniulm.de Abstract. This paper is concerned with formalizations and verifications in type theory that are abstracted with respect to a large class of datatypes; i.e polytypic formalizations. The main advantage of these developments are that they can not only be used to polytypically define functions but also to formally state polytypic theorems and to interactively develop polytypic proofs using existing proof editors. Polytypic program and proof construction in a typetheoretic setting is exemplified by the definition of a polytypic map function and by mechanized proofs of corresponding properties such as preservation of composition and fusion theorems. 1 Introduction Many functional programming languages provide a predefined map functional on the list datatype. Applying this functional to a function f and a source list l yields a target list obtained b...
Functional Pearls  Three Algorithms on Braun Trees
, 1997
"... Introduction Among the many flavors of balanced binary trees, Braun trees (Braun & Rem, 1983) are perhaps the most circumscribed. For any given node of a Braun tree, the left subtree is either exactly the same size as the right subtree, or one element larger. Braun trees always have minimum hei ..."
Abstract

Cited by 2 (0 self)
 Add to MetaCart
Introduction Among the many flavors of balanced binary trees, Braun trees (Braun & Rem, 1983) are perhaps the most circumscribed. For any given node of a Braun tree, the left subtree is either exactly the same size as the right subtree, or one element larger. Braun trees always have minimum height, and the shape of each Braun tree is completely determined by its size. In return for this rigor, algorithms that manipulate Braun trees are often exceptionally simple and elegant, and need not maintain any explicit balance information. Braun trees have been used to implement both flexible arrays (Braun & Rem, 1983; Hoogerwoord, 1992; Paulson, 1996) and priority queues (Paulson, 1996; Bird, 1996). Most operations involving a single element (e.g. adding, removing, inspecting or updating an element) take O(logn) time since the trees are balanced. We consider three algorithmically interesting operations that manipulate entire trees. First, we give an<F24.
Linked Lists Calculated
, 1997
"... We use a relational calculus of pointer structures to calculate a number of standard algorithms on singly linked lists, both acyclic and cyclic. This shows that our techniques are not just useful for treelike structures, but apply to general pointer structures as well. ..."
Abstract

Cited by 2 (0 self)
 Add to MetaCart
We use a relational calculus of pointer structures to calculate a number of standard algorithms on singly linked lists, both acyclic and cyclic. This shows that our techniques are not just useful for treelike structures, but apply to general pointer structures as well.
An iterator construct for the refinement calculus
 In Fourth Irish Workshop on Formal Methods
, 2000
"... This paper concerns the introduction of an iterator into the refinement calculus. The construct is based on concepts from functional programming, and the work gives an interesting example of crossfertilisation between the functional and imperative programming worlds. Specifically, the iterator cons ..."
Abstract

Cited by 1 (0 self)
 Add to MetaCart
This paper concerns the introduction of an iterator into the refinement calculus. The construct is based on concepts from functional programming, and the work gives an interesting example of crossfertilisation between the functional and imperative programming worlds. Specifically, the iterator construct it..ti uses the idea of a catamorphism — the unique homomorphism from an initial algebra. The datatype for which the iterator is to be defined is considered as an initial algebra of an appropriate functor. The it..ti construct is formally defined as a recursive procedure, and it is shown that, if the value to be obtained by an iteration can be expressed as a catamorphism, then the it..ti construct provides a very natural implementation. Examples are given to show typical uses of the new construct. 1
Assertions, Assertive Coding Application to Sudoku Puzzles
"... We show how to specify preconditions, postconditions, assertions and invariants, and how to wrap these around functional code or functional imperative code. We illustrate the use of this for writing programs for automated testing of code that is wrapped in appropriate assertions. We call this assert ..."
Abstract
 Add to MetaCart
We show how to specify preconditions, postconditions, assertions and invariants, and how to wrap these around functional code or functional imperative code. We illustrate the use of this for writing programs for automated testing of code that is wrapped in appropriate assertions. We call this assertive coding. An assertive version of a function f is a function f ′ that behaves exactly like f as long as f complies with its specification, and aborts with error otherwise. This is a much stronger sense of selftesting than what is called selftesting code (code with builtin tests) in test driven development. The lecture gives examples of how to use (inefficient) specification code to test (efficient) implementation code, and how to turn assertive code into production code by replacing the selftesting versions of the assertion wrappers by selfdocumenting versions that skip the assertion tests. We end with a demonstration of the use of formal methods in developing a sudoku solver. Module Declaration module Week5