Abstract
We present a formal proof of the classical Tarjan-1972 algorithm for finding strongly connected components in directed graphs. We use the Why3 system to express these proofs and fully check them by computer. The Why3-logic is a simple multi-sorted first-order logic augmented by inductive predicates. Furthermore it provides useful libraries for lists and sets. The Why3 system allows the description of programs in a Why3-ML programming language (a first-order programming language with ML syntax) and provides interfaces to various state-of-the-art automatic provers and to manual interactive proof-checkers (we use mainly Coq). We do not claim that this proof is new, although we could not find a formal proof of that algorithm in the literature. But one important point of our article is that our proof is here completely presented and human readable.
R. Chen—Partly supported by ANR-13-LAB3-0007, http://www.spark-2014.org/proofinuse and National Natural Science Foundation of China (Grant No. 61672504).
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
References
Aho, A.V., Hopcroft, J.E., Ullman, J.D.: The Design and Analysis of Computer Algorithms. Addison-Wesley, Boston (1974)
Appel, A.W.: Verified Functional Algorithms, August 2016. www.cs.princeton.edu/~appel/vfa/
Bobot, F., Filliâtre, J.C., Marché, C., Melquiond, G., Paskevich, A.: The Why3 platform, version 0.86.1. LRI, CNRS and Univ. Paris-Sud and INRIA Saclay, version 0.86.1 edn., May 2015. why3.lri.fr/download/manual-0.86.1.pdf
Bobot, F., Filliâtre, J.-C., Marché, C., Melquiond, G., Paskevich, A.: Preserving user proofs across specification changes. In: Cohen, E., Rybalchenko, A. (eds.) VSTTE 2013. LNCS, vol. 8164, pp. 191–201. Springer, Heidelberg (2014). https://doi.org/10.1007/978-3-642-54108-7_10. hal.inria.fr/hal-00875395
Bobot, F., Filliâtre, J.C., Marché, C., Paskevich, A.: Let’s verify this with Why3. Softw. Tools Technol. Transf. (STTT) 17(6), 709–727 (2015). hal.inria.fr/hal-00967132
Charguéraud, A.: Program verification through characteristic formulae. In: Hudak, P., Weirich, S. (eds.) Proceeding of the 15th ACM SIGPLAN International Conference on Functional Programming (ICFP), pp. 321–332. ACM (2010). arthur.chargueraud.org/research/2010/cfml
Charguéraud, A.: Higher-order representation predicates in separation logic. In: Proceedings of the 5th ACM SIGPLAN Conference on Certified Programs and Proofs, pp. 3–14, CPP 2016. ACM, New York, January 2016
Charguéraud, A., Pottier, F.: Machine-checked verification of the correctness and amortized complexity of an efficient union-find implementation. In: Proceedings of the 6th International Conference on Interactive Theorem Proving (ITP), August 2015
Chen, R., Lévy, J.J.: Full script of Tarjan SCC Why3 proof. Technical report, Iscas and Inria (2017). jeanjacqueslevy.net/why3/graph/abs/scct/2/scc.html
Chen, R., Lévy, J.J.: Une preuve formelle de l’algorithme de Tarjan-1972 pour trouver les composantes fortement connexes dans un graphe. In: JFLA (2017)
Clochard, M.: Preuves taillées en biseau. In: vingt-huitièmes Journées Francophones des Langages Applicatifs (JFLA). Gourette, France, January 2017. hal.inria.fr/hal-01404935
Cohen, C., Théry, L.: Full script of Tarjan SCC Coq/ssreflect proof. Technical report, Inria (2017). github.com/CohenCyril/tarjan
Coq Development Team: the coq 8.5 standard library. Technical report, Inria (2015). coq.inria.fr/distrib/current/stdlib
Filliâtre, J.-C., Paskevich, A.: Why3 — where programs meet provers. In: Felleisen, M., Gardner, P. (eds.) ESOP 2013. LNCS, vol. 7792, pp. 125–128. Springer, Heidelberg (2013). https://doi.org/10.1007/978-3-642-37036-6_8
Gonthier, G., Mahboubi, A., Tassi, E.: A small scale reflection extension for the Coq system. Rapport de recherche RR-6455, INRIA (2008). hal.inria.fr/inria-00258384
Gonthier, G., et al.: Finite graphs in mathematical components (2012). ssr.msr-inria.inria.fr/~jenkins/current/Ssreflect.fingraph.html. The full library is available at www.msr-inria.fr/projects/mathematical-components-2
Hobor, A., Villard, J.: The ramifications of sharing in data structures. In: Proceedings of the 40th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pp. 523–536, POPL 2013. ACM, New York (2013). doi.acm.org/10.1145/2429069.2429131
Lammich, P., Neumann, R.: A framework for verifying depth-first search algorithms. In: Proceedings of the 2015 Conference on Certified Programs and Proofs, pp. 137–146, CPP 2015. ACM, New York (2015). doi.acm.org/10.1145/2676724.2693165
Lévy, J.J.: Essays for the Luca Cardelli Fest. In: Simple Proofs of Simple Programs in Why3. Microsoft Research Cambridge, MSR-TR-2014-104 (2014)
Mehta, F., Nipkow, T.: Proving pointer programs in higher-order logic. In: CADE (2003)
Poskitt, C.M., Plump, D.: Hoare logic for graph programs. In: VSTTE (2010)
Pottier, F.: Depth-first search and strong connectivity in Coq. In: Journées Francophones des Langages Applicatifs (JFLA 2015), January 2015
Raad, A., Hobor, A., Villard, J., Gardner, P.: Verifying concurrent graph algorithms. In: Igarashi, A. (ed.) APLAS 2016. LNCS, vol. 10017, pp. 314–334. Springer, Cham (2016). https://doi.org/10.1007/978-3-319-47958-3_17
Sedgewick, R., Wayne, K.: Algorithms, 4th edn. Addison-Wesley, Boston (2011)
Sergey, I., Nanevski, A., Banerjee, A.: Mechanized verification of fine-grained concurrent programs. In: Proceedings of the 36th ACM SIGPLAN Conference on Programming Language Design and Implementation, pp. 77–87, PLDI 2015. ACM, New York (2015). doi.acm.org/10.1145/2737924.2737964
Tarjan, R.: Depth first search and linear graph algorithms. SIAM J. Comput. 1, 146–160 (1972)
Théry, L.: Formally-proven Kosaraju’s algorithm (2015). Inria report, Hal-01095533
Wengener, I.: A simplified correctness proof for a well-known algorithm computing strongly connected components. Inf. Process. Lett. 83(1), 17–19 (2002)
Why3 Development Team: Why3 gallery of programs. Technical report, CNRS and Inria (2016). toccata.lri.fr/gallery
Acknowledgments
Thanks to the Why3 group at Inria-Saclay/LRI-Orsay for very valuable advices, to Cyril Cohen and Laurent Théry for their fantastic expertise in Coq proofs, to Claude Marché and the reviewers for many corrections.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2017 Springer International Publishing AG
About this paper
Cite this paper
Chen, R., Lévy, JJ. (2017). A Semi-automatic Proof of Strong Connectivity. In: Paskevich, A., Wies, T. (eds) Verified Software. Theories, Tools, and Experiments. VSTTE 2017. Lecture Notes in Computer Science(), vol 10712. Springer, Cham. https://doi.org/10.1007/978-3-319-72308-2_4
Download citation
DOI: https://doi.org/10.1007/978-3-319-72308-2_4
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-72307-5
Online ISBN: 978-3-319-72308-2
eBook Packages: Computer ScienceComputer Science (R0)