Abstract
The algebra of programming (AoP) is a discipline for programming from specifications using relation algebra. Specification vagueness and nondeterminism are captured by relations. (Final) implementations are functions. Probabilistic functions are half way between relations and functions: they express the propensity, or likelihood of ambiguous, multiple outputs. This paper puts forward a basis for a linear algebra of programming (LAoP) extending standard AoP towards probabilistic functions. Because of the quantitative essence of these functions, the allegory of binary relations which supports the AoP has to be extended. We show that, if one restricts to discrete probability spaces, categories of matrices provide adequate support for the extension, while preserving the pointfree reasoning style typical of the AoP.
Similar content being viewed by others
References
Abadir KM, Magnus JR (2005) Matrix algebra. In: Econometric exercises, vol 1. Cambridge University Press, Cambridge
Andova S, McIver A, D’Argenio PR, Cuijpers PJL, Markovski J, Morgan C, Núñez M (eds) (2009) Proceedings first workshop on quantitative formal methods: theory and applications. In: EPTCS, vol 13
Backhouse RC (2004) Mathematics of program construction. University of Nottingham. Draft of book in preparation, 608 p
Bird R, de Moor O (1997) Algebra of programming. Series in Computer Science. Prentice-Hall International, Englewood Cliffs
Bloom SL, Sabadini N, Walters RFC (1996) Matrices, machines and behaviors. Appl Categ Struct 4(4): 343–360
Baroni M, Zamparelli R (2010) Nouns are vectors, adjectives are matrices: representing adjective-noun constructions in semantic space. In: Association for Computational Linguistics Proceedings, EMNLP ’10, Morristown, NJ, USA, pp 1183–1193
Conway JH (1971) Regular algebra and finite machines. Chapman and Hall, London
Coecke B, Sadrzadeh M, Clark S (2010) Mathematical foundations for a compositional distributed model of meaning. Linguist Anal 36(1–4): 345–384
Distefano S, Longo F, Scarpa M (2010) Availability assessment of HA standby redundant clusters. In: 29th IEEE international symposium on reliable distributed systems
Erwig M, Kollmansberger S (2006) Functional pearls: probabilistic functional programming in Haskell. J Funct Program 16: 21–34
Frias MF (2002) Fork algebras in algebra, logic and computer science. Logic and computer science. World Scientific Publishing Co, Singapore
Freyd PJ, Scedrov A (1990) Categories, allegories. In: Mathematical library, vol 39. North-Holland, Amsterdam
Gibbons J, Hinze R (2011) Just do it: simple monadic equational reasoning. In: Proceedings of the 16th ACM SIGPLAN international conference on Functional programming, ICFP’11, New York, NY, USA, 2011. ACM, New York, pp 2–14
Gibbons J, Hutton G, Altenkirch T (2001) When is a function a fold or an unfold? Electron Notes Theor Comput Sci 44(1)
Gibbons J (1997) Conditionals in distributive categories. Technical Report CMS-TR-97-01, School of Computing and Mathematical Sciences, Oxford Brookes University
Hehner E (2011) A probability perspective. Form Asp Comput 23: 391–419
Hoogendijk P (1997) A generic theory of data types. PhD thesis, University of Eindhoven, The Netherlands
Kawahara Y, Furusawa H, Mori M (1999) Categorical representation theorems of fuzzy relations. Inf Sci 119(3–4): 235–251
Kemeny JG, Snell JL (1960) Finite Markov chains. Springer, Berlin (1976, originally printed by Van Nostrand, Princeton)
Latouche G, Ramaswami V (1999) Introduction to matrix analytic methods in stochastic modeling. ASA-SIAM
Larsen KG, Skou A (1991) Bisimulation through probabilistic testing. Inf Comput 94(1): 1–28
Lawvere B, Schanuel S (1997) Conceptual mathematics: a first introduction to categories. Cambridge University Press, Cambridge
MacLane S (1998) Categories for the working mathematician. In: Graduate texts in mathematics, vol 5. Springer, Berlin
Macedo H (2012) Matrices as arrows—why categories of matrices matter. PhD thesis, University of Minho (submitted)
Maddux RD (1991) The origin of relation algebras in the development and axiomatization of the calculus of relations. Studia Logica 50: 421–455
MacLane S, Birkhoff G (1999) Algebra. AMS Chelsea
Mu SC, Bird R (2001) Quantum functional programming, 2001. 2nd Asian workshop on programming languages and systems, KAIST, Dajeaon, Korea, December 17–18
McIver A, Cohen E, Morgan C (2006) Using probabilistic Kleene algebra for protocol verification. In: Schmidt R (ed) Relations and Kleene algebra in computer science. LNCS, vol 4136. Springer, Berlin, pp 296–310
McIver A, Morgan C (2005) Abstraction, refinement and proof for probabilistic systems. In: Monographs in computer science. Springer, Berlin
Macedo HD, Oliveira JN (2010) Matrices as Arrows! A biproduct approach to typed linear algebra. In: MPC’10. LNCS, vol 6120. Springer, Berlin, pp 271–287
Macedo HD, Oliveira JN (2011) Do the middle letters of “OLAP” stand for linear algebra (“LA”)? Technical Report TR- HASLab:04:2011, INESC TEC and University of Minho, Gualtar Campus, Braga
Macedo HD, Oliveira JN (2011) Towards linear algebras of components. In: FACS 2010. LNCS, vol 6921. Springer, Berlin, pp 300–303
Morgan C (1990) Programming from specification. In: Hoare CAR (ed) Series in computer science. Prentice-Hall International, Englewood Cliffs
Oliveira JN (2011) A look at the (linear) algebra of probabilistic functions, 2011. Contribution to the QAIS Start-up Workshop celebrating IBM-Portugal Scientific Prize 2010, Braga, 17th October
Pratt V (1992) Origins of the calculus of binary relations. In: Proceedings of the 7th annual IEEE symposium on logic in computer science, Santa Cruz, CA, IEEE Comp. Soc, pp 248–254
Rosenhouse J (2009) The Monty Hall problem: the remarkable story of math’s most contentious brain teaser. Oxford University Press, New York
Rao CR, Rao MB (1998) Matrix algebra and its applications to statistics and econometrics. World Scientific Publishing, Singapore
Silva A, Bonchi F, Bonsangue MM, Rutten JJMM (2011) Quantitative Kleene coalgebras. Inf Comput 209(5): 822–849
Schmidt G (2010) Relational mathematics. Number 132 in Encyclopedia of Mathematics and its Applications. Cambridge University Press, Cambridge
SQIG-Group (2011) LAP: linear algebra of bounded resources programs. IT & Tech. Univ. Lisbon
Sokolova A (2005) Coalgebraic analysis of probabilistic systems. Ph.D. dissertation, Tech. Univ. Eindhoven, Eindhoven, The Netherlands
Sernadas A, Ramos J, Mateus P (2008) Linear algebra techniques for deciding the correctness of probabilistic programs with bounded resources. Technical report, SQIG-IT and IST-TU Lisbon, 1049-001 Lisboa, Portugal, 2008. Short paper presented at LPAR 2008, Doha, Qatar. November 22–27
Takai T, Furusawa H (2006) Monodic tree Kleene algebra. In: Schmidt R (ed) Relations and Kleene algebra in computer science. Lecture notes in computer science, vol 4136. Springer, Berlin, pp 402–416
Trcka N (2009) Strong, weak and branching bisimulation for transition systems and Markov reward chains: a unifying matrix approach. In: Proc. first workshop on quantitative formal methods: theory and applications, EPTCS, vol 13. pp 55–65
Voas J, McGraw G (1997) Software fault injection: innoculating programs against errors. Wiley, New York, 416 p
Winter M (2009) Arrow categories. Fuzzy Sets Syst 160(20): 2893–2909
Author information
Authors and Affiliations
Corresponding author
Additional information
by Peter Höfner, Robert van Glabbeek and Ian Hayes
Rights and permissions
About this article
Cite this article
Oliveira, J.N. Towards a linear algebra of programming. Form Asp Comp 24, 433–458 (2012). https://doi.org/10.1007/s00165-012-0240-9
Received:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s00165-012-0240-9