Hostname: page-component-cd9895bd7-dk4vv Total loading time: 0 Render date: 2024-12-26T08:54:11.678Z Has data issue: false hasContentIssue false

Categories, relations and dynamic programming

Published online by Cambridge University Press:  04 March 2009

Oege De Moor
Affiliation:
Programming Research Group, Oxford University Computing Laboratory, 11 Keble Road, Oxford 0X1 3QD, United Kingdom

Abstract

Dynamic programming is a strategy for solving optimisation problems. In this paper, we show how many problems that may be solved by dynamic programming are instances of the same abstract specification. This specification is phrased using the calculus of relations offered by topos theory. The main theorem underlying dynamic programming can then be proved by straightforward equational reasoning.

The generic specification of dynamic programming makes use of higher-order operators on relations, akin to the fold operators found in functional programming languages. In the present context, a data type is modelled as an initial F-algebra, where F is an endofunctor on the topos under consideration. The mediating arrows from this initial F-algebra to other F-algebras are instances of fold – but only for total functions. For a regular category ε, it is possible to construct a category of relations Rel(ε). When a functor between regular categories is a so-called relator, it can be extended (in some canonical way) to a functor between the corresponding categories of relations. Applied to an endofunctor on a topos, this process of extending functors preserves initial algebras, and hence fold can be generalised from functions to relations.

It is well-known that the use of dynamic programming is governed by the principle of optimality. Roughly, the principle of optimality says that an optimal solution is composed of optimal solutions to subproblems. In a first attempt, we formalise the principle of optimality as a distributivity condition. This distributivity condition is elegant, but difficult to check in practice. The difficulty arises because we consider minimum elements with respect to a preorder, and therefore minimum elements are not unique. Assuming that we are working in a Boolean topos, it can be proved that monotonicity implies distributivity, and this monotonicity condition is easy to verify in practice.

Type
Research Article
Copyright
Copyright © Cambridge University Press 1994

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

References

Aho, A. V., Hopcroft, J. E. and Ullman, J. D. (1974) The Design and Analysis of Computer Algorithms, Addison- Wesley.Google Scholar
Apostolico, A., Atallah, M. J., Larmore, L. L. and McFaddin, S. (1991) Efficient Parallel Algorithms for String Editing and Related Problems. SIAM Journal on Computing 19 (5) 968988.CrossRefGoogle Scholar
Beck, J. (1969) Distributive Laws. In: Eckmann, B. (ed.) Seminar on Triples and Categorical Homology Theory. Springer-Verlag Lecture Notes in Mathematics 80 119140.CrossRefGoogle Scholar
Bellman, R. (1957) Dynamic Programming, Princeton University Press.Google ScholarPubMed
Bird, R. S. and de Moor, O. (1991) Inductive Solutions to Optimisation Problems. (Draft)Google Scholar
Bird, R. S. and de Moor, O. (1992) List Partitions. Formal Aspects of Computing. (To appear)CrossRefGoogle Scholar
Bird, R. S. and Wadler, P. (1988) Introduction to Functional Programming, Prentice-Hall.Google Scholar
Bird, R. S., Gibbons, J. and Jones, G. (1989) Formal Derivation of a Pattern Matching Algorithm. Science of Computer Programming 12 93104.CrossRefGoogle Scholar
Bird, R. S. (1980) Tabulation Techniques for Recursive Programs. Computing Surveys 12 (4) 403417.CrossRefGoogle Scholar
Bird, R. S. (1986) Transformational Programming and the Paragraph Problem. Science of Computer Programming 6 159189.CrossRefGoogle Scholar
Bird, R. S. (1987) An Introduction to the Theory of Lists. In: Broy, M. (ed.) Logic of Programming and Calculi of Discrete Design. NATO AS I Series F 36, Springer-Verlag 342.Google Scholar
Bird, R. S. (1989) Lectures on Constructive Functional Programming. In: Broy, M. (ed.) Constructive Methods in Computing Science. NATO ASI Series F 55, Springer-Verlag 151216.Google Scholar
Bird, R. S. (1990) A Calculus of Functions for Program Derivation. In: Turner, D. (ed.) Research Topics in Functional Programming, University of Texas at Austin Year of Programming Series, Addison-Wesley 287308.Google Scholar
Brook, T. (1977) Order and Recursion in Topoi. Notes on Pure Mathematics 9, Australian National University, Canberra.Google Scholar
Carboni, A. and Rosolini, G. (1991) The Free Regular Category on a Left Exact One. (In preparation)Google Scholar
Carboni, A., Kelly, G. M. and Wood, R. J. (1991) A 2-Categorical Approach to Geometric Morphisms I. Cahiers de Topologie et Geometrie Differentielle Categoriques 32 (1) 4795.Google Scholar
Casimir, R. J. (1980) Program Inversion. Technical Report AIV-80–10, Vakgroep AIV, Erasmus Universiteit, Postbus 1730, 3000 DR Rotterdam, The Netherlands.Google Scholar
Chen, W. and Udding, J. T. (1990) Program Inversion: More Than Fun! Science of Computer Programming 15 (1) 113.Google Scholar
Cockett, R. and Fukushima, T. (1991) Draft: About Charity, Dept. of Computer Science, University of Calgary, Calgary, Alberta, Canada. Available via anonymous ftp from cpsc.ucalgary.ca.Google Scholar
Cockett, R. (1991) Personal Communication.Google Scholar
Cohen, N. H. (1979) Characterization and Elimination of Redundancy in Recursive Programs. In: 6th ACM Annual Symposium on Principles of Programming Languages, Association for Computing Machinery 143157.Google Scholar
de Moor, O. (1992a) Categories, Relations and Dynamic Programming, D.Phil, thesis, Technical Monograph PRG-98, Computing Laboratory, Oxford.Google Scholar
de Moor, O. (1992b) Inductive Data Types for Predicate Transformers. Information Processing Letters. (To appear)CrossRefGoogle Scholar
Denardo, E. V. (1982) Dynamic Programming - Models and Applications, Prentice-Hall.Google Scholar
Dijkstra, E. W. (1979) Program Inversion. In: Bauer, F. L. and Broy, M. (eds.) Program Construction. Springer-Verlag Lecture Notes in Computer Science 69 5457.CrossRefGoogle Scholar
Ecker, J. G. and Kupferschmid, M. (1988) Introduction to Operations Research, John Wiley.Google Scholar
Eilenberg, S. and Wright, J. B. (1967) Automata in General Algebras. Information and Control 11 (4) 452470.CrossRefGoogle Scholar
Field, A. J. and Harrison, P. G. (1988) Functional Programming. International computer science series, Addison-Wesley.Google Scholar
Fokkinga, M. M. (1991) An exercise in transformational programming: Backtracking and Branch and- Bound. Science of Computer Programming 16 1948.CrossRefGoogle Scholar
Freyd, P. J. and Ŝĉedrov, A. (1990) Categories, Allegories. Mathematical Library 39, North-Holland.Google Scholar
Galil, Z. and Giancarlo, R. (1989) Speeding up dynamic programming with applications to molecular biology. Theoretical Computer Science 64 107118.CrossRefGoogle Scholar
Gardiner, P. H. B., Martin, C. E. and de Moor, O. (1992) Factoring Predicate Transformers in a Topos. (Draft)Google Scholar
Goguen, J. A. and Winkler, T. (1988) Introducing OBJ3. Technical Report SRI-CSL-88–9, Computing Science Laboratory, SRI International, 333 Ravenswood Ave., Menlo Park, CA 94025, USA.Google Scholar
Harrison, P. G. and Khoshnevisan, H. (1992) On the Synthesis of Function Inverses. Acta Informatica 29(3) 211240.CrossRefGoogle Scholar
Helman, P. and Rosenthal, A. (1985) A Comprehensive Model of Dynamic Programming. SIAM Journal on Algebraic and Discrete Methods 6 (2) 319334.CrossRefGoogle Scholar
Helman, P. (1986) The Principle of Optimality in the Design of Efficient Algorithms. Journal of Mathematical Analysis and Applications 119 97127.CrossRefGoogle Scholar
Helman, P. (1989) A Common Schema for Dynamic Programming and Branch-and-Bound Algorithms. Journal of the ACM 36 (1) 97128.CrossRefGoogle Scholar
Hirschberg, D. S. and Larmore, L. L. (1987) The Least Weight Subsequence Problem. SIAM Journal on Computing 16 (4) 628638.CrossRefGoogle Scholar
Hughes, J. (1985) Lazy Memo-functions. In: Jouannaud, J. P. (ed.) Functional Programming Languages and Computer Architecture. Springer-Verlag Lecture Notes in Computer Science 201 130146.Google Scholar
Jeuring, J. (1990) Algorithms from Theorems. In: Broy, M. and Jones, C. B. (eds.) Programming Concepts and Methods, North-Holland247266.Google Scholar
Johnstone, P. T. (1977) Topos Theory, Academic Press.Google Scholar
Jones, G. (1990) Designing Circuits by Calculation. Technical Report PRG-TR-10–90, Programming Research Group, 11 Keble Road, Oxford OX1 3QD, England.Google Scholar
Karp, R. M. and Held, M. (1967) Finite-State Processes and Dynamic Programming. SIAM Journal on Applied Mathematics 15 (3) 693718.CrossRefGoogle Scholar
Knuth, D. E. and Plass, M. F. (1981) Breaking Paragraphs into Lines. Software: Practice and Experience 11 11191184.Google Scholar
Lehmann, D. J. and Smyth, M. B. (1981) Algebraic Specification of Data Types: A Synthetic Approach. Mathematical Systems Theory 14 97139.CrossRefGoogle Scholar
Louka, B. and Tchuente, M. (1988) Dynamic Programming on Two-dimensional Systolic Arrays. Information Processing Letters 29 97104.CrossRefGoogle Scholar
Malcolm, G. (1990) Data Structures and Program Transformation. Science of Computer Programming 14 255279.CrossRefGoogle Scholar
Manes, E. G. and Arbib, M. A. (1986) Algebraic Approaches to Program Semantics, Texts and Monographs in Computer Science, Springer-Verlag.CrossRefGoogle Scholar
Meertens, L. (1987) Algorithmics - towards programming as a mathematical activity. In: de Bakker, J. W., Hazewinkel, M. and Lenstra, J. (eds.) Mathematics and Computer Science, CWI Monographs 1, North-Holland342.Google Scholar
Mehlhorn, K. (1984) Data Structures and Algorithms. EATCS Monographs on Theoretical Computer Science, Springer-Verlag. (3 volumes)Google Scholar
Michie, D. (1968) Memo Functions and Machine Learning. Nature 218 1922.CrossRefGoogle Scholar
Morgan, C. C. (1990) Programming from Specifications, Prentice-Hall.Google Scholar
Myoupo, J. F. (1991) Dynamic Programming on Linear Pipelines. Information Processing Letters 39 333341.CrossRefGoogle Scholar
Rytter, W. (1988) On Efficient Parallel Computations for Some Dynamic Programming Problems. Theoretical Computer Science 59 297307.CrossRefGoogle Scholar
Sedgewick, R. (1983) Algorithms, Addison-Wesley.Google Scholar
Sheeran, M. (1989) Describing Hardware Algorithms in Ruby. In: David, et al. (eds.) IFIP WG 10.1 workshop on Concepts and Characteristics of Declarative Systems, Budapest 1988, North-Holland.Google Scholar
Sheeran, M. (1990) Categories for the Working Hardware Designer. In: Leeser, M. and Brown, G. (eds.) Workshop on Hardware Specification, Verification and Synthesis: Mathematical Aspects. Cornell University 1989. Springer-Verlag Lecture Notes in Computer Science 408 380402.Google Scholar
Smith, D. R. and Lowry, M. R. (1990) Algorithm Theories and Design Tactics. Science of Computer Programming 14 305321.CrossRefGoogle Scholar
Smith, D. R. (1985) Top-down synthesis of divide-and-conquer algorithms. Artificial Intelligence 27 4396.CrossRefGoogle Scholar
Smith, D. R. (1987) Applications of a Strategy for Designing Divide-and-Conquer Algorithms. Science of Computer Programming 18 213229.CrossRefGoogle Scholar
Smith, D. R. (1988) Structure and Design of Global Search Algorithms. Report KES.U.87.12, Kestrel Institute, 1801 Page Mill Road, Palo Alto, CA 94304. Acta Informatica. (To appear)Google Scholar
Smith, D. R. (1990) KIDS: A Semiautomatic Program Development System. IEEE Transactions on Software Engineering 16 (9) 10241043.Google Scholar
Smith, D. R. (1991) Structure and Design of Problem Reduction Generators. In: Möller, B. (ed.) Proc. of the IFIP TC2 Working Conference on Constructing Programs from Specifications, North-Holland.Google Scholar
Sniedovich, M. (1986) A New Look at Bellman's Principle of Optimality. Journal of Optimization Theory and Applications 49 (1) 161176.CrossRefGoogle Scholar
Turner, D. A. (1985) Miranda - a non-strict functional language with polymorphic types. In: Henderson, P. and Turner, D. A. (eds.) Proc. Conference on Functional Programming Languages and Computer Architecture. Springer-Verlag Lecture Notes in Computer Science 201 116.Google Scholar
Wagner, R. A. and Fischer, M. J. (1974) The String-to-String Correction Problem. Journal of the Association for Computing Machinery 21 (1) 168173.Google Scholar