• Aucun résultat trouvé

Strongly Connected Components in graphs, formal proof of Tarjan1972 algorithm

N/A
N/A
Protected

Academic year: 2021

Partager "Strongly Connected Components in graphs, formal proof of Tarjan1972 algorithm"

Copied!
32
0
0

Texte intégral

(1)

HAL Id: hal-01422227

https://hal.inria.fr/hal-01422227

Submitted on 24 Dec 2016

HAL is a multi-disciplinary open access

archive for the deposit and dissemination of sci-entific research documents, whether they are pub-lished or not. The documents may come from teaching and research institutions in France or abroad, or from public or private research centers.

L’archive ouverte pluridisciplinaire HAL, est destinée au dépôt et à la diffusion de documents scientifiques de niveau recherche, publiés ou non, émanant des établissements d’enseignement et de recherche français ou étrangers, des laboratoires publics ou privés.

Strongly Connected Components in graphs, formal proof of Tarjan1972 algorithm

Jean-Jacques Levy, Ran Chen

To cite this version:

Jean-Jacques Levy, Ran Chen. Strongly Connected Components in graphs, formal proof of Tarjan1972 algorithm. Groupe de travail LTP du GDR GPL , Nov 2016, Orsay, France. 2016. �hal-01422227�

(2)

Strongly Connected Components

in graphs, formal proof

of Tarjan1972 algorithm

jean-jacques.levy@inria.fr

(3)

Plan

2

.. joint work (in progress) with Ran Chen

pre-/post-conditions

imperative programs

conclusion

motivation

(4)

Motivation

3

to be fully published in articles or journals

Coq proofs seem to me unreadable (and by normal human ?)

algorithms on graphs = a good testbed

nice algorithms should have simple formal proofs

how to publish formal proofs ?

Why3 allows mix of automatic and interactive proofs

(5)

A one-pass

linear-time algorithm

(6)

The algorithm

(1/2)

5

2 3 8

4 9

1 7

5 6 • depth-first search algorithm

• with pushing non visited vertices into a working stack

• and computing oldest vertex reachable by at most a single « back-edge »

• when that oldest vertex is equal to currently visited vertex, a new strongly connected component is in the working stack on top of current vertex.

(7)

The algorithm

(2/2)

6 2 3 8 4 9 1 7 5 6 1 1 1 1 1 2 2 2 2 3 3 3 4 4 5 1 2 3 4 5 6 1 1 2 2 3 3 4 4 8 8 1 2 3 4 5 6 9 7

les valeurs successives de la pile

0 1 2 3 4 5 6 se ns cro issa nt du ra ng

(8)

The algorithm

(2/2)

7 2 3 8 4 9 1 7 5 6 1 1 1 1 1 2 2 2 2 3 3 3 4 4 5 1 2 3 4 5 6 1 1 2 2 3 3 4 4 8 8 1 2 3 4 5 6 9 7

les valeurs successives de la pile

0 1 2 3 4 5 6 se ns cro issa nt du ra ng 1 0 0 0 4 4 4 3 3

(9)

Proof in algorithms book

8

Christmas tree structure of strongly connected components

give the program

consider the spanning trees (forrest)

2-3 lemmas about ancestors in spanning trees

(10)

The program

(1/3)

9

• a functional version with lists and finite sets

(11)

The program

(2/3)

10

blacks, grays are sets of vertices; sccs is a set of sets of vertices

• naming conventions:

x, y, z for vertices; b for black sets; s for stacks; cc for connected components;

(12)

The program

(3/3)

(13)
(14)
(15)

Pre/Post-conditions

(2/3)

x stack x s blacks b sccs sccs n y m m  rank y stack m  rank x stack

(16)
(17)
(18)
(19)

Invariants

(1/4)

blacks \ grays = ;

(set of sccs) ✓ blacks

(20)

Invariants

(2/4)

cc1 sccs s grays blacks in cre asi ng ra nk cc2 ccn

(21)
(22)

Invariants

(4/4)

cc1 sccs s grays blacks in cre asi ng ra nk cc2 ccn

(23)
(24)

Assertions

x0 2 s2 ^ y0 62 s2 ^ edge x0 y0

• Coq proof: there exists x0, y0 with

y0 is white

x0 = x

x0 6= x impossible because no black to white

impossible because successors are black

y0 2 s3 = stack

x0 = x

x0 6= x impossible because crossedge

impossible because m1 rank y’ s1 < rank x s1

(25)
(26)

Towards imperative

program

(27)
(28)
(29)
(30)

Missing

implementation of graphs

vertices as integers in an array

successors as lists for every vertex

(31)
(32)

Conclusion

31

readable proofs ?

simple algorithms should have simple proofs

to be shown with a good formal precision

compare with other proof systems

further algorithms (in next talks ?) • graphs represented with arrays + lists

• topological sort, articulation points, sccK, sscT

Références

Documents relatifs

To test whether the vesicular pool of Atat1 promotes the acetyl- ation of -tubulin in MTs, we isolated subcellular fractions from newborn mouse cortices and then assessed

Néanmoins, la dualité des acides (Lewis et Bronsted) est un système dispendieux, dont le recyclage est une opération complexe et par conséquent difficilement applicable à

Cette mutation familiale du gène MME est une substitution d’une base guanine par une base adenine sur le chromosome 3q25.2, ce qui induit un remplacement d’un acide aminé cystéine

En ouvrant cette page avec Netscape composer, vous verrez que le cadre prévu pour accueillir le panoramique a une taille déterminée, choisie par les concepteurs des hyperpaysages

Chaque séance durera deux heures, mais dans la seconde, seule la première heure sera consacrée à l'expérimentation décrite ici ; durant la seconde, les élèves travailleront sur

A time-varying respiratory elastance model is developed with a negative elastic component (E demand ), to describe the driving pressure generated during a patient initiated

The aim of this study was to assess, in three experimental fields representative of the various topoclimatological zones of Luxembourg, the impact of timing of fungicide

Attention to a relation ontology [...] refocuses security discourses to better reflect and appreciate three forms of interconnection that are not sufficiently attended to