This development contains formalizations and correctness proofs, using Coq and the Mathematical Components library, of algorithms originally due to Kosaraju and Tarjan for finding strongly connected components in finite graphs. It also contains a verified implementation of topological sorting with extended guarantees for acyclic graphs.
- Author(s):
- Cyril Cohen (initial)
- Jean-Jacques Lévy (initial)
- Karl Palmskog
- Laurent Théry (initial)
- License: CeCILL-B
- Compatible Coq versions: 8.10 or later
- Additional dependencies:
- Coq namespace:
mathcomp.tarjan
- Related publication(s):
The easiest way to install the latest released version of Tarjan and Kosaraju is via OPAM:
opam repo add coq-released https://coq.inria.fr/opam/released
opam install coq-mathcomp-tarjan
To instead build and install manually, do:
git clone https://github.com/math-comp/tarjan.git
cd tarjan
make # or make -j <number-of-cores-on-your-machine>
make install
bigmin.v
: extra library to deal with\min(i in A) F i
extra.v
: naive definitions of strongly connected components and various basic extentions of mathcomp libraries on paths and fintypesacyclic.v
: definition of acyclic graphs and proof that acyclicity can be determined by knowing strongly connected components
kosaraju.v
: proof of topological sorting and Kosaraju connected component algorithmacyclic_tsorted.v
: properties of topological sorting in acyclic graphs
tarjan_rank.v
: proof with ranktarjan_rank_bigmin.v
: same proof but with a\min_
instead of multiple inequalities on the output ranktarjan_num.v
: same proof astarjan_rank_bigmin.v
but with serial numbers instead of rankstarjan_nocolor.v
: new proof, with ranks and without colors, less fields in environement and less invariants, preconditions and postconditions.tarjan_nocolor_optim.v
: same proof astarjan_nocolor.v
, but with the serial number field of the environement restored, and passing around stack extensions as sets