Abstract
Describing a problem using classical linear algebra is a very well-known problem-solving technique. If your question can be formulated as a question about real or complex matrices, then the answer can often be found by standard techniques.
It's less well-known that very similar techniques still apply where instead of real or complex numbers we have a closed semiring, which is a structure with some analogue of addition and multiplication that need not support subtraction or division.
We define a typeclass in Haskell for describing closed semirings, and implement a few functions for manipulating matrices and polynomials over them. We then show how these functions can be used to calculate transitive closures, find shortest or longest or widest paths in a graph, analyse the data flow of imperative programs, optimally pack knapsacks, and perform discrete event simulations, all by just providing an appropriate underlying closed semiring.
- S. Abdali and B. Saunders. Transitive closure and related semiring properties via eliminants. Theoretical Computer Science, 40: 257--274, 1985. Google Scholar
Digital Library
- A. V. Aho, J. E. Hopcroft, and J. D. Ullman. The Design and Analysis of Computer Algorithms. Addison-Wesley, 1974. Google Scholar
Digital Library
- R. Backhouse and B. Carré. Regular algebra applied to path-finding problems. IMA Journal of Applied Mathematics, 2 (15): 161--186, 1975.Google Scholar
Cross Ref
- G. Cohen and P. Moller. Linear system theory for discrete event systems. In 23rd IEEE Conference on Decision and Control, pages 539--544, 1984.Google Scholar
Cross Ref
- J. Conway. Regular algebra and finite machines. Chapman and Hall (London), 1971.Google Scholar
- R. Floyd. Algorithm 97: shortest path. Communications of the ACM, 5 (6): 345, 1962. Google Scholar
Digital Library
- J. S. Golan. Semirings and their applications. Springer, 1999.Google Scholar
Cross Ref
- J. S. Golan. Semirings and affine equations over them. Kluwer Academic Publishers, 2003.Google Scholar
Cross Ref
- M. Gondran and M. Minoux. Graphs, dioids and semirings. Springer, 2008.Google Scholar
Cross Ref
- J. Kam and J. Ullman. Global data flow analysis and iterative algorithms. Journal of the ACM (JACM), 23 (1): 158--171, 1976. Google Scholar
Digital Library
- U. Khedker and D. Dhamdhere. A generalized theory of bit vector data flow analysis. ACM Transactions on Programming Languages and Systems (TOPLAS), 16 (5): 1472--1511, 1994. Google Scholar
Digital Library
- D. Lehmann. Algebraic structures for transitive closure. Theoretical Computer Science, 4 (1): 59--76, 1977.Google Scholar
Cross Ref
- V. P. Maslov. Idempotent analysis. American Mathematical Society, 1992.Google Scholar
Cross Ref
- M. D. Mcilroy. Power series, power serious. Journal of Functional Programming, 9 (3): 325--337, 1999. Google Scholar
Digital Library
- R. McNaughton and H. Yamada. Regular expressions and state graphs for automata. IRE Transactions on Electronic Computers, 9 (1): 39--47, 1960.Google Scholar
Cross Ref
- M. Mohri. Semiring frameworks and algorithms for shortest-distance problems. Journal of Automata, Languages and Combinatorics, 7 (3): 321--350, 2002. Google Scholar
Digital Library
- R. Tarjan. Solving path problems on directed graphs. Technical report, Stanford University, 1975. Google Scholar
Digital Library
Index Terms
Fun with semirings: a functional pearl on the abuse of linear algebra
Recommendations
Fun with semirings: a functional pearl on the abuse of linear algebra
ICFP '13: Proceedings of the 18th ACM SIGPLAN international conference on Functional programmingDescribing a problem using classical linear algebra is a very well-known problem-solving technique. If your question can be formulated as a question about real or complex matrices, then the answer can often be found by standard techniques.
It's less ...
Witnesses for Boolean matrix multiplication and for shortest paths
SFCS '92: Proceedings of the 33rd Annual Symposium on Foundations of Computer ScienceThe subcubic (O(n/sup w/) for w(3) algorithms to multiply Boolean matrices do not provide the witnesses; namely, they compute C=A.B but if C/sub ij/=1 they do not find an index k (a witness) such that A/sub ik/=B/sub kj/=1. The authors design a ...
Inductive *-semirings
Words, languages and combinatoricsOne of the most well-known induction principles in computer science is the fixed point induction rule, or least pre-fixed point rule. Inductive *-semirings are partially ordered semirings equipped with a star operation satisfying the fixed point ...







Comments