Skip to main content

Relation-Algebraic Verification of Prim’s Minimum Spanning Tree Algorithm

  • Conference paper
  • First Online:

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 9965))

Abstract

We formally prove the correctness of Prim’s algorithm for computing minimum spanning trees. We introduce new generalisations of relation algebras and Kleene algebras, in which most of the proof can be carried out. Only a small part needs additional operations, for which we introduce a new algebraic structure. We instantiate these algebras by matrices over extended reals, which model the weighted graphs used in the algorithm. Many existing results from relation algebras and Kleene algebras generalise from the relation model to the weighted-graph model with no or small changes. The overall structure of the proof uses Hoare logic. All results are formally verified in Isabelle/HOL heavily using its integrated automated theorem provers.

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

References

  1. Abrial, J.-R., Cansell, D., Méry, D.: Formal derivation of spanning trees algorithms. In: Bert, D., Bowen, J.P., King, S., Waldén, M. (eds.) ZB 2003. LNCS, vol. 2651, pp. 457–476. Springer, Heidelberg (2003). doi:10.1007/3-540-44880-2_27

    Chapter  Google Scholar 

  2. Armstrong, A., Foster, S., Struth, G., Weber, T.: Relation algebra. Archive of Formal Proofs (2016). First version (2014)

    Google Scholar 

  3. Armstrong, A., Gomes, V.B.F., Struth, G., Weber, T.: Kleene algebra. Archive of Formal Proofs (2016). First version (2013)

    Google Scholar 

  4. Berghammer, R., Fischer, S.: Combining relation algebra and data refinement to develop rectangle-based functional programs for reflexive-transitive closures. J. Log. Algebr. Methods Program. 84(3), 341–358 (2015)

    Article  MathSciNet  MATH  Google Scholar 

  5. Berghammer, R., von Karger, B.: Relational semantics of functional programs. In: Brink, C., Kahl, W., Schmidt, G. (eds.) Relational Methods in Computer Science, chap. 8, pp. 115–130. Springer, Wien (1997)

    Google Scholar 

  6. Berghammer, R., von Karger, B., Wolf, A.: Relation-algebraic derivation of spanning tree algorithms. In: Jeuring, J. (ed.) MPC 1998. LNCS, vol. 1422, pp. 23–43. Springer, Heidelberg (1998). doi:10.1007/BFb0054283

    Chapter  Google Scholar 

  7. Berghammer, R., Rusinowska, A., de Swart, H.: Computing tournament solutions using relation algebra and RelView. Eur. J. Oper. Res. 226(3), 636–645 (2013)

    Article  MathSciNet  MATH  Google Scholar 

  8. Bird, R., de Moor, O.: Algebra of Programming. Prentice Hall, Englewood Cliffs (1997)

    MATH  Google Scholar 

  9. Birkhoff, G.: Lattice Theory. Colloquium Publications, vol. XXV, 3rd edn. American Mathematical Society, Providence (1967)

    MATH  Google Scholar 

  10. Bistarelli, S., Santini, F.: C-semiring frameworks for minimum spanning tree problems. In: Corradini, A., Montanari, U. (eds.) WADT 2008. LNCS, vol. 5486, pp. 56–70. Springer, Heidelberg (2009). doi:10.1007/978-3-642-03429-9_5

    Chapter  Google Scholar 

  11. Blanchette, J.C., Böhme, S., Paulson, L.C.: Extending Sledgehammer with SMT solvers. In: Bjørner, N., Sofronie-Stokkermans, V. (eds.) CADE 2011. LNCS (LNAI), vol. 6803, pp. 116–130. Springer, Heidelberg (2011). doi:10.1007/978-3-642-22438-6_11

    Chapter  Google Scholar 

  12. Blyth, T.S.: Lattices and Ordered Algebraic Structures. Springer, Berlin (2005)

    MATH  Google Scholar 

  13. Comer, S.D.: On connections between information systems, rough sets and algebraic logic. In: Rauszer, C. (ed.) Algebraic Methods in Logic and in Computer Science. Banach Center Publications, vol. 28, pp. 117–124. Institute of Mathematics, Polish Academy of Sciences (1993)

    Google Scholar 

  14. Conway, J.H.: Regular Algebra and Finite Machines. Chapman and Hall, London (1971)

    MATH  Google Scholar 

  15. Cormen, T.H., Leiserson, C.E., Rivest, R.L.: Introduction to Algorithms. MIT Press, Cambridge (1990)

    MATH  Google Scholar 

  16. Desharnais, J., Grinenko, A., Möller, B.: Relational style laws and constructs of linear algebra. J. Log. Algebr. Methods Program. 83(2), 154–168 (2014)

    Article  MathSciNet  MATH  Google Scholar 

  17. Dijkstra, E.W.: A note on two problems in connexion with graphs. Numerische Mathematik 1(1), 269–271 (1959)

    Article  MathSciNet  MATH  Google Scholar 

  18. Freyd, P.J., Ščedrov, A.: Categories, Allegories. North-Holland Mathematical Library, vol. 39. Elsevier Science Publishers (1990)

    Google Scholar 

  19. Goguen, J.A.: L-fuzzy sets. J. Math. Anal. Appl. 18(1), 145–174 (1967)

    Article  MathSciNet  MATH  Google Scholar 

  20. Gondran, M., Minoux, M.: Graphs, Dioids and Semirings. Springer, Heidelberg (2008)

    MATH  Google Scholar 

  21. Graham, R.L., Hell, P.: On the history of the minimum spanning tree problem. Ann. Hist. Comput. 7(1), 43–57 (1985)

    Article  MathSciNet  MATH  Google Scholar 

  22. Grätzer, G.: Lattice Theory: First Concepts and Distributive Lattices. W. H. Freeman and Co., San Francisco (1971)

    MATH  Google Scholar 

  23. Guttmann, W.: Algebras for correctness of sequential computations. Sci. Comput. Program. 85(Part B), 224–240 (2014)

    Article  Google Scholar 

  24. Guttmann, W., Struth, G., Weber, T.: A repository for Tarski-Kleene algebras. In: Höfner, P., McIver, A., Struth, G. (eds.) Automated Theory Engineering. CEUR Workshop Proceedings, vol. 760, pp. 30–39 (2011)

    Google Scholar 

  25. Hesselink, W.H.: The verified incremental design of a distributed spanning tree algorithm: extended abstract. Formal Aspects Comput. 11(1), 45–55 (1999)

    Article  MathSciNet  MATH  Google Scholar 

  26. Höfner, P., Möller, B.: Dijkstra, Floyd and Warshall meet Kleene. Formal Aspects Comput. 24(4), 459–476 (2012)

    Article  MathSciNet  MATH  Google Scholar 

  27. Jarník, V.: O jistém problému minimálním (Z dopisu panu O. Borůvkovi). Práce moravské přírodovědecké společnosti 6(4), 57–63 (1930)

    Google Scholar 

  28. Kawahara, Y.: On the cardinality of relations. In: Schmidt, R.A. (ed.) RelMiCS/AKA 2006. LNCS, vol. 4136, pp. 251–265. Springer, Heidelberg (2006). doi:10.1007/11828563_17

    Chapter  Google Scholar 

  29. Kawahara, Y., Furusawa, H.: Crispness in Dedekind categories. Bull. Inf. Cybern. 33(1–2), 1–18 (2001)

    MathSciNet  MATH  Google Scholar 

  30. Kawahara, Y., Furusawa, H., Mori, M.: Categorical representation theorems of fuzzy relations. Inf. Sci. 119(3–4), 235–251 (1999)

    Article  MathSciNet  MATH  Google Scholar 

  31. Knuth, D.E.: The Art of Computer Programming. Fundamental Algorithms, vol. 1, 3rd edn. Addison-Wesley, Reading (1997)

    MATH  Google Scholar 

  32. Kozen, D.: A completeness theorem for Kleene algebras and the algebra of regular events. Inf. Comput. 110(2), 366–390 (1994)

    Article  MathSciNet  MATH  Google Scholar 

  33. Macedo, H.D., Oliveira, J.N.: A linear algebra approach to OLAP. Formal Aspects Comput. 27(2), 283–307 (2015)

    Article  MathSciNet  MATH  Google Scholar 

  34. Maddux, R.D.: Relation-algebraic semantics. Theor. Comput. Sci. 160(1–2), 1–85 (1996)

    Article  MathSciNet  MATH  Google Scholar 

  35. Mareš, M.: The saga of minimum spanning trees. Comput. Sci. Rev. 2(3), 165–221 (2008)

    Article  MathSciNet  MATH  Google Scholar 

  36. Nipkow, T.: Winskel is (almost) right: Towards a mechanized semantics textbook. Formal Aspects Comput. 10(2), 171–186 (1998)

    Article  MATH  Google Scholar 

  37. Nipkow, T.: Hoare logics in Isabelle/HOL. In: Schwichtenberg, H., Steinbrüggen, R. (eds.) Proof and System-Reliability, pp. 341–367. Kluwer Academic Publishers (2002)

    Google Scholar 

  38. Nipkow, T., Paulson, L.C., Wenzel, M.: Isabelle/HOL: A Proof Assistant for Higher-Order Logic. LNCS, vol. 2283. Springer, Heidelberg (2002)

    Google Scholar 

  39. Oliveira, J.N.: Extended static checking by calculation using the pointfree transform. In: Bove, A., Barbosa, L.S., Pardo, A., Pinto, J.S. (eds.) LerNet 2008. LNCS, vol. 5520, pp. 195–251. Springer, Heidelberg (2009). doi:10.1007/978-3-642-03153-3_5

    Chapter  Google Scholar 

  40. Oliveira, J.N.: Towards a linear algebra of programming. Formal Aspects Comput. 24(4), 433–458 (2012)

    Article  MathSciNet  MATH  Google Scholar 

  41. Oliveira, J.N.: Weighted automata as coalgebras in categories of matrices. Int. J. Found. Comput. Sci. 24(6), 709–728 (2013)

    Article  MathSciNet  MATH  Google Scholar 

  42. Paulson, L.C., Blanchette, J.C.: Three years of experience with Sledgehammer, a practical link between automatic and interactive theorem provers. In: Sutcliffe, G., Ternovska, E., Schulz, S. (eds.) Proceedings of the 8th International Workshop on the Implementation of Logics, pp. 3–13 (2010)

    Google Scholar 

  43. Prim, R.C.: Shortest connection networks and some generalizations. Bell Syst. Tech. J. 36(6), 1389–1401 (1957)

    Article  Google Scholar 

  44. Schmidt, G., Ströhlein, T.: Relations and Graphs. Springer, Berlin (1993)

    Book  MATH  Google Scholar 

  45. Struth, G.: Abstract abstract reduction. J. Log. Algebr. Program. 66(2), 239–270 (2006)

    Article  MathSciNet  MATH  Google Scholar 

  46. Tarski, A.: On the calculus of relations. J. Symbol. Log. 6(3), 73–89 (1941)

    Article  MathSciNet  MATH  Google Scholar 

  47. Winter, M.: A new algebraic approach to L-fuzzy relations convenient to study crispness. Inf. Sci. 139(3–4), 233–252 (2001)

    Article  MathSciNet  MATH  Google Scholar 

Download references

Acknowledgements

I thank the anonymous referees for helpful feedback including the suggestion to generalise Lemma 1 to its present form. I thank Rudolf Berghammer for discussions about the cardinality of relations and ways to generalise it. I thank Peter Höfner and Bernhard Möller for discussing alternative approaches to minimum spanning trees in Kleene algebras. I thank the participants of the 73rd meeting of IFIP WG 2.1, the 14th Logic and Computation Seminar of Kyushu University and the 2016 Workshop on Universal Structures in Mathematics and Computing for the opportunity to talk about this work and for their valuable feedback. The presentation at Kyushu University was part of a JSPS Invitation Fellowship for Research in Japan.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Walter Guttmann .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2016 Springer International Publishing AG

About this paper

Cite this paper

Guttmann, W. (2016). Relation-Algebraic Verification of Prim’s Minimum Spanning Tree Algorithm. In: Sampaio, A., Wang, F. (eds) Theoretical Aspects of Computing – ICTAC 2016. ICTAC 2016. Lecture Notes in Computer Science(), vol 9965. Springer, Cham. https://doi.org/10.1007/978-3-319-46750-4_4

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-46750-4_4

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-46749-8

  • Online ISBN: 978-3-319-46750-4

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics