L3-Intership:FormalProofof Uno and...

68
Présentation Décomposition modulaire de graphe modulaire Algorithme Démonstration Conclusion L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm Fleury Mathias ENS Rennes 31 décembre 2013 Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 1 / 23 (Σ= 44)

Transcript of L3-Intership:FormalProofof Uno and...

Page 1: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Présentation Décomposition modulaire de graphe modulaire Algorithme Démonstration Conclusion

L3-Intership: Formal Proof of Uno andYagiura’s Algorithm

Fleury Mathias

ENS Rennes

31 décembre 2013

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 1 / 23 (Σ = 44)

Page 2: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Présentation Décomposition modulaire de graphe modulaire Algorithme Démonstration Conclusion

Figure – Arianne 5 (La Presse)

preuve formelle de((((((programmepreuve formelle d’algorithme :

génétiquethéorie des graphes : décomposition modulaire

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 2 / 23 (Σ = 44)

Page 3: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Présentation Décomposition modulaire de graphe modulaire Algorithme Démonstration Conclusion

1 Décomposition modulaire de graphe modulairePermutationDécomposition modulaireTracé du graphe de permutationsParticularité

2 AlgorithmePlus naïf...Algorithme quadratiqueVers l’algorithme linéaireL’algorithme linéaire

3 DémonstrationCoqVersion quadratiqueDémonstration

4 Conclusion

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 3 / 23 (Σ = 44)

Page 4: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Présentation Décomposition modulaire de graphe modulaire Algorithme Démonstration Conclusion

Plan1 Décomposition modulaire de graphe modulaire

PermutationDécomposition modulaireTracé du graphe de permutationsParticularité

2 AlgorithmePlus naïf...Algorithme quadratiqueVers l’algorithme linéaireL’algorithme linéaire

3 DémonstrationCoqVersion quadratiqueDémonstration

4 ConclusionFleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 4 / 23 (Σ = 44)

Page 5: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Présentation Décomposition modulaire de graphe modulaire Algorithme Démonstration Conclusion

Définition de la décomposition modulaire

ModulePour G = (S,A).M ⊂ S, on ne peut pas distinguerles éléments de M pour S \M :

∀(u, v) ∈ M2,∀x ∈ A \M,

x adjacent à u et v ou aucun

10

8 9

1

2

3

4

5

6

7

(a) Graphe de permutation

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 5 / 23 (Σ = 44)

Page 6: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Présentation Décomposition modulaire de graphe modulaire Algorithme Démonstration Conclusion

Définition de la décomposition modulaire

ModulePour G = (S,A).M ⊂ S, on ne peut pas distinguerles éléments de M pour S \M :

∀(u, v) ∈ M2,∀x ∈ A \M,

x adjacent à u et v ou aucun

10

8,7 9

1

2

3

4

5

6

(a) Graphe de permutation

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 5 / 23 (Σ = 44)

Page 7: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Présentation Décomposition modulaire de graphe modulaire Algorithme Démonstration Conclusion

1, 7, 2, 4, 3, 6, 5

1 7 2, 4, 3, 6, 5

2 4, 3, 6, 5

4, 3 6, 5

4 3 6 5

Figure – Décomposition modulaire

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 6 / 23 (Σ = 44)

Page 8: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Présentation Décomposition modulaire de graphe modulaire Algorithme Démonstration Conclusion

Tracé de la permutation

ı 1 2 3 . . . 10σ 2 . . .

(a) Graphe de permutation

1

2

3

4

5

6

7

8

9

10

2

(b) PermutationFleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 7 / 23 (Σ = 44)

Page 9: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Présentation Décomposition modulaire de graphe modulaire Algorithme Démonstration Conclusion

Tracé de la permutation

ı 1 2 3 . . . 10σ 2 4 . . .

(a) Graphe de permutation

1

2

3

4

5

6

7

8

9

10

2

4

(b) PermutationFleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 7 / 23 (Σ = 44)

Page 10: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Présentation Décomposition modulaire de graphe modulaire Algorithme Démonstration Conclusion

Tracé de la permutation

ı 1 2 3 . . . 10σ 2 4 1 . . . 5

(a) Graphe de permutation

1

2

3

4

5

6

7

8

9

10

2

4

1

8

7

9

6

3

10

5

(b) PermutationFleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 7 / 23 (Σ = 44)

Page 11: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Présentation Décomposition modulaire de graphe modulaire Algorithme Démonstration Conclusion

Tracé de la permutation

ı 1 2 3 . . . 10σ 2 4 1 . . . 5

(a) Graphe de permutation

1

2

3

4

5

6

7

8

9

10

2

4

1

8

7

9

6

3

10

5

(b) PermutationFleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 7 / 23 (Σ = 44)

Page 12: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Présentation Décomposition modulaire de graphe modulaire Algorithme Démonstration Conclusion

Lien avec les graphes de permutations

1

2

3

4

5

6

7

8

9

10

2

4

1

8

7

9

6

3

10

5

(a) Permutation

1

2

(b) Graphe de permutationFleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 8 / 23 (Σ = 44)

Page 13: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Présentation Décomposition modulaire de graphe modulaire Algorithme Démonstration Conclusion

Lien avec les graphes de permutations

1

2

3

4

5

6

7

8

9

10

2

4

1

8

7

9

6

3

10

5

(a) Permutation

1

2

4

(b) Graphe de permutationFleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 8 / 23 (Σ = 44)

Page 14: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Présentation Décomposition modulaire de graphe modulaire Algorithme Démonstration Conclusion

Lien avec les graphes de permutations

1

2

3

4

5

6

7

8

9

10

2

4

1

8

7

9

6

3

10

5

(a) Permutation

1

2

4

3

(b) Graphe de permutationFleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 8 / 23 (Σ = 44)

Page 15: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Présentation Décomposition modulaire de graphe modulaire Algorithme Démonstration Conclusion

Lien avec les graphes de permutations

1

2

3

4

5

6

7

8

9

10

2

4

1

8

7

9

6

3

10

5

(a) Permutation

10

8 9

1

2

3

4

5

6

7

(b) Graphe de permutationFleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 8 / 23 (Σ = 44)

Page 16: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Présentation Décomposition modulaire de graphe modulaire Algorithme Démonstration Conclusion

Caractérisation

Recherche des images desegments par unepermutationimage de segment :

44; 3; 6; 7; 8; 9; 5 ≡3; 4; . . . ; 9

non : 4; 6, . . .

i 1 2 3 4 5 6 7 8 9 10σ 2 4 1 8 7 9 6 3 10 5

10

8 9

1

2

3

4

5

6

7

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 9 / 23 (Σ = 44)

Page 17: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Présentation Décomposition modulaire de graphe modulaire Algorithme Démonstration Conclusion

Caractérisation

Recherche des images desegments par unepermutationimage de segment :

44; 3; 6; 7; 8; 9; 5 ≡3; 4; . . . ; 9

non : 4; 6, . . .

i 1 2 3 4 5 6 7 8 9 10σ 2 4 1 8 7 9 6 3 10 5

10

8 9

1

2

3

4

5

6

7

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 9 / 23 (Σ = 44)

Page 18: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Présentation Décomposition modulaire de graphe modulaire Algorithme Démonstration Conclusion

Caractérisation

Recherche des images desegments par unepermutationimage de segment :

44; 3; 6; 7; 8; 9; 5 ≡3; 4; . . . ; 9

non : 4; 6, . . .

i 1 2 3 4 5 6 7 8 9 10σ 2 4 1 8 7 9 6 3 10 5

10

8 9

1

2

3

4

5

6

7

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 9 / 23 (Σ = 44)

Page 19: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Présentation Décomposition modulaire de graphe modulaire Algorithme Démonstration Conclusion

Plan1 Décomposition modulaire de graphe modulaire

PermutationDécomposition modulaireTracé du graphe de permutationsParticularité

2 AlgorithmePlus naïf...Algorithme quadratiqueVers l’algorithme linéaireL’algorithme linéaire

3 DémonstrationCoqVersion quadratiqueDémonstration

4 ConclusionFleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 10 / 23 (Σ = 44)

Page 20: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Présentation Décomposition modulaire de graphe modulaire Algorithme Démonstration Conclusion

Algorithme très naïf

pour les intervalles possibles S[O(n2)

]:

recherche m = minS et M = max S, [O(n)]teste d’appartenance : ∀i ∈ Jm;MK, i ∈ S [O(n × n)]→ O(n5)

Caractérisation des intervallesI ⊂ J1; nK I est un intervalle ⇐⇒ max I −min I + 1 = |I|

I = {4; 3; 6; 7; 8; 9; 5} : 9− 3+ 1 = 7.

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 11 / 23 (Σ = 44)

Page 21: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Présentation Décomposition modulaire de graphe modulaire Algorithme Démonstration Conclusion

Algorithme très naïf

pour les intervalles possibles S[O(n2)

]:

recherche m = minS et M = max S, [O(n)]teste d’appartenance : ∀i ∈ Jm;MK, i ∈ S [O(n × n)]→ O(n5)

Caractérisation des intervallesI ⊂ J1; nK I est un intervalle ⇐⇒ max I −min I + 1 = |I|

I = {4; 3; 6; 7; 8; 9; 5} : 9− 3+ 1 = 7.

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 11 / 23 (Σ = 44)

Page 22: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Présentation Décomposition modulaire de graphe modulaire Algorithme Démonstration Conclusion

Algorithme quadratique

4 3

max4;3 = 4

min4;3 = 3

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 12 / 23 (Σ = 44)

Page 23: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Présentation Décomposition modulaire de graphe modulaire Algorithme Démonstration Conclusion

Algorithme quadratique

2 4 3

max4;3 = 4

min4;3 = 3<

min2;4;3 = 2

>

max2;4;3 = 4

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 12 / 23 (Σ = 44)

Page 24: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Présentation Décomposition modulaire de graphe modulaire Algorithme Démonstration Conclusion

Intervalles communs

Takeaki Uno and Mutsunori YagiuraAlgorithmica O(n + K )

structure de donnéeBinh-Minh Bui Xuan, Michel Habib, Christophe PaulO(n)

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 13 / 23 (Σ = 44)

Page 25: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Présentation Décomposition modulaire de graphe modulaire Algorithme Démonstration Conclusion

Intervalles communs

Potentiel

Maximum

Minimum

56

6

3

3

4

4

4

Found interval :

Potentiel

Maximum

Minimum

56

6

3

3

4

4

4

Found interval :

{{4}}

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 13 / 23 (Σ = 44)

Page 26: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Présentation Décomposition modulaire de graphe modulaire Algorithme Démonstration Conclusion

Intervalles communs

Potentiel

Maximum

Minimum

56

6

3

3

4

4

4

Found interval :

{{4}; {4; 3}}

Potentiel

Maximum

Minimum

56

6

3

3

4

4

4

Found interval :

{{4}; {4; 3}}

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 13 / 23 (Σ = 44)

Page 27: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Présentation Décomposition modulaire de graphe modulaire Algorithme Démonstration Conclusion

Version linéaire

Passer l’algorithme linéaire

Potentiel

Maximum

Minimum

5

6

3

�63

3

{5}; {6}; {6; 5}; {3}

Potentiel

Maximum

Minimum

5

6

3

4 3

4

4

{5}; {6}; {6; 5}; {4}{4; . . . ; 3}; {4; . . . ; 5}

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 14 / 23 (Σ = 44)

Page 28: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Présentation Décomposition modulaire de graphe modulaire Algorithme Démonstration Conclusion

Version linéaire

Passer l’algorithme linéaire

Potentiel

Maximum

Minimum

5

6

2

2

{5}; {6}; {6; 5}; {4}{4 . . . 3}; {4 . . . 5}; {2 . . . 6}

Potentiel

Maximum

Minimum

5

7

2

7

{5}; {6}; {6; 5}; {4}{4 . . . 3}; {4 . . . 5}; {2 . . . 6}

{7 . . . 5}

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 14 / 23 (Σ = 44)

Page 29: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Présentation Décomposition modulaire de graphe modulaire Algorithme Démonstration Conclusion

Plan1 Décomposition modulaire de graphe modulaire

PermutationDécomposition modulaireTracé du graphe de permutationsParticularité

2 AlgorithmePlus naïf...Algorithme quadratiqueVers l’algorithme linéaireL’algorithme linéaire

3 DémonstrationCoqVersion quadratiqueDémonstration

4 ConclusionFleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 15 / 23 (Σ = 44)

Page 30: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Présentation Décomposition modulaire de graphe modulaire Algorithme Démonstration Conclusion

Pourquoi Coq ?

Coq1 Preuve formelle2 Écrit en OCaml 100.000 lignes de codes3 théorie des types :

Correspondance de Curry-Howard :

démo ⇐⇒ ϕ : Théorèmes→ Théorème

Calculus of (Inductive) Constructions or Coc

Réussites

compilateur CompCert C(X. Leroy)théorème des quatrecouleurs (G. Gonthier) Figure – Logo de Coq

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 16 / 23 (Σ = 44)

Page 31: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Présentation Décomposition modulaire de graphe modulaire Algorithme Démonstration Conclusion

Pourquoi Coq ?

Coq1 Preuve formelle2 Écrit en OCaml 100.000 lignes de codes3 théorie des types :

Correspondance de Curry-Howard :

démo ⇐⇒ ϕ : Théorèmes→ Théorème

Calculus of (Inductive) Constructions or Coc

Réussites

compilateur CompCert C(X. Leroy)théorème des quatrecouleurs (G. Gonthier) Figure – Logo de Coq

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 16 / 23 (Σ = 44)

Page 32: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Présentation Décomposition modulaire de graphe modulaire Algorithme Démonstration Conclusion

Pourquoi Coq ?

Coq1 Preuve formelle2 Écrit en OCaml 100.000 lignes de codes3 théorie des types :

Correspondance de Curry-Howard :

démo ⇐⇒ ϕ : Théorèmes→ Théorème

Calculus of (Inductive) Constructions or Coc

Réussites

compilateur CompCert C(X. Leroy)théorème des quatrecouleurs (G. Gonthier) Figure – Logo de Coq

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 16 / 23 (Σ = 44)

Page 33: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Présentation Décomposition modulaire de graphe modulaire Algorithme Démonstration Conclusion

Pourquoi Coq ?

Coq1 Preuve formelle2 Écrit en OCaml 100.000 lignes de codes3 théorie des types :

Correspondance de Curry-Howard :

démo ⇐⇒ ϕ : Théorèmes→ Théorème

Calculus of (Inductive) Constructions or Coc

Réussites

compilateur CompCert C(X. Leroy)théorème des quatrecouleurs (G. Gonthier) Figure – Logo de Coq

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 16 / 23 (Σ = 44)

Page 34: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Présentation Décomposition modulaire de graphe modulaire Algorithme Démonstration Conclusion

Pourquoi Coq ?

Coq1 Preuve formelle2 Écrit en OCaml 100.000 lignes de codes3 théorie des types :

Correspondance de Curry-Howard :

démo ⇐⇒ ϕ : Théorèmes→ Théorème

Calculus of (Inductive) Constructions or Coc

Réussites

compilateur CompCert C(X. Leroy)théorème des quatrecouleurs (G. Gonthier) Figure – Logo de Coq

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 16 / 23 (Σ = 44)

Page 35: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Présentation Décomposition modulaire de graphe modulaire Algorithme Démonstration Conclusion

Pourquoi Coq ?

Coq1 Preuve formelle2 Écrit en OCaml 100.000 lignes de codes3 théorie des types :

Correspondance de Curry-Howard :

démo ⇐⇒ ϕ : Théorèmes→ Théorème

Calculus of (Inductive) Constructions or Coc

Réussites

compilateur CompCert C(X. Leroy)théorème des quatrecouleurs (G. Gonthier) Figure – Logo de Coq

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 16 / 23 (Σ = 44)

Page 36: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Présentation Décomposition modulaire de graphe modulaire Algorithme Démonstration Conclusion

2 4 3

max4;3 = 4

min4;3 = 3<

min2;4;3 = 2

>

max2;4;3 = 4 listedes valeurs (maximum etminimum)

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 17 / 23 (Σ = 44)

Page 37: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Présentation Décomposition modulaire de graphe modulaire Algorithme Démonstration Conclusion

Programmationboucle « intérieur »boucle extérieur

`

intérieur

extérieur Theorem oute r_ l_n2_proof :∀ ( ` : l i s t N ) ( δ : N ) ,

outer_loop_n2 `δ = oute r_ loop ` δ .

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 18 / 23 (Σ = 44)

Page 38: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Présentation Décomposition modulaire de graphe modulaire Algorithme Démonstration Conclusion

Démonstration

11 9 8 4 3 1

11 9 10 8 4 5 7 3 1 2 6 12 14 13 15

11 12 14 15

liste : simplepointeurs : compliqué

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 19 / 23 (Σ = 44)

Page 39: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Présentation Décomposition modulaire de graphe modulaire Algorithme Démonstration Conclusion

Difficultés de la preuve

PointeursNumérotation des listes

Def in i t i on Numbered_List (A : Type ) : Type :=| nil_num : Numbered_List A| L_num : A → N → Numbered_List A →

Numbered_List A .

Terminaison des programmes

Fixpo int f ( n : N ) : ?:= f (S n )

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 20 / 23 (Σ = 44)

Page 40: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Présentation Décomposition modulaire de graphe modulaire Algorithme Démonstration Conclusion

Plan1 Décomposition modulaire de graphe modulaire

PermutationDécomposition modulaireTracé du graphe de permutationsParticularité

2 AlgorithmePlus naïf...Algorithme quadratiqueVers l’algorithme linéaireL’algorithme linéaire

3 DémonstrationCoqVersion quadratiqueDémonstration

4 ConclusionFleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 21 / 23 (Σ = 44)

Page 41: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Présentation Décomposition modulaire de graphe modulaire Algorithme Démonstration Conclusion

Conclusion

1 Stage :travail d’algorithmique intéressantmanque de temps pour finir la preuve

2 Présentationpreuve formelle de plus en plus utiliséoutil complexe, pas un miracle

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 22 / 23 (Σ = 44)

Page 42: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Présentation Décomposition modulaire de graphe modulaire Algorithme Démonstration Conclusion

Questions ?

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 23 / 23 (Σ = 44)

Page 43: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Annexe

Aller au maintien de la structure

Aller à application génétique

Aller à Compcert

Aller au théorème des quatre couleurs Exemple de code Coq

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 24 / 23 (Σ = 44)

Page 44: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Annexe

Plan

5 AnnexeLien avec l’ordre des gènesCompCertThéorème des quatre couleursExemple de code Coq

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 25 / 23 (Σ = 44)

Page 45: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Annexe

Structure de donnée, exemple quadratique

Passer maintien de la structure

Potential

Maximum

Minimum

56

6

5

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 26 / 23 (Σ = 44)

Page 46: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Annexe

Structure de donnée, exemple quadratique

Passer maintien de la structure

Potential

Maximum

Minimum

56

6

�5

3

3

3

<

>

Potential

Maximum

Minimum

56

6

3

3

3

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 26 / 23 (Σ = 44)

Page 47: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Annexe

Structure de donnée, exemple quadratique

Passer maintien de la structure

Potential

Maximum

Minimum

56

6

3

�3

3

4

4

4

<

>

Potential

Maximum

Minimum

56

6

3

3

4

4

4

<

Potential

Maximum

Minimum

56

6

3

3

4

4

4

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 26 / 23 (Σ = 44)

Page 48: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Annexe

Genetic Adam et Eva

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 27 / 23 (Σ = 44)

Page 49: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Annexe

Theoretical order

1

2

34

5

6

1

5

4

3

2

6

Order usedAfter copy

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 27 / 23 (Σ = 44)

Page 50: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Annexe

1

5

4

3

26

After copy

1

5

4

3

6

2

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 27 / 23 (Σ = 44)

Page 51: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Annexe

1, 7, 2, 4, 3, 6, 5

1 7 2, 4, 3, 6, 5

2 4, 3, 6, 5

4, 3 6, 5

4 3 6 5

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 27 / 23 (Σ = 44)

Page 52: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Annexe

Liste annexe

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 28 / 23 (Σ = 44)

Page 53: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Annexe

descriptionCompilateur prouvé à 90%

Semantic preservation theorem :For all source programs S and compiler-generated code C, if thecompiler, applied to the source S, produces the code C, withoutreporting a compile-time error, then the observable behavior of C isone of the possible observable behaviors of S.

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 29 / 23 (Σ = 44)

Page 54: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Annexe

Pourquoi ?compilateur compliquébeaucoup de bugsnégligeable par rapport aux bugs de programmationsauf si applications critiques

Pourquoi pas ?comportement indéfini : Undefined behavior32 bitslibrairie standard non prouvée

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 30 / 23 (Σ = 44)

Page 55: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Annexe

CompCert

Figure – Étape de compilation (site internet de CompCert C)

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 31 / 23 (Σ = 44)

Page 56: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Annexe

Liste annexe

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 32 / 23 (Σ = 44)

Page 57: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Annexe

Théorème des 4 couleurs

Figure – Martin Gardner (1975) Poisson d’avril (MathWorld)

Guthrie 1852de Morgan a présenté le problèmeAppel et Haken 1977Gonthier 2004

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 33 / 23 (Σ = 44)

Page 58: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Annexe

Liste annexe

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 34 / 23 (Σ = 44)

Page 59: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Annexe

Theorem oute r_ l_pr :∀ ( ` : l i s t N )

( δ : N ) ,

outer_l_n2 ` δ= ou t e r_ l ` δ .

1 subgoa l s , s ubgoa l 1 ( ID 34)========================∀ ( ` : l i s t N )

( δ : N ) ,outer_l_n2 ` δ

= ou t e r_ l ` δ

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 35 / 23 (Σ = 44)

Page 60: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Annexe

Theorem oute r_ l_pr :∀ ( ` : l i s t N )

( δ : N ) ,

outer_l_n2 ` δ= ou t e r_ l ` δ .

Proof .

1 subgoa l s , s ubgoa l 1 ( ID 34)========================∀ ( ` : l i s t N )

( δ : N ) ,outer_l_n2 ` δ

= ou t e r_ l ` δ

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 36 / 23 (Σ = 44)

Page 61: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Annexe

Theorem oute r_ l_pr :∀ ( ` : l i s t N )

( δ : N ) ,

outer_l_n2 ` δ= ou t e r_ l ` δ .

Proof .i n t r o s ` δ .

1 subgoa l s , s ubgoa l 1 ( ID 36)

` : l i s t Nδ : N======================outer_l_n2 ` δ= ou t e r_ l ` δ

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 37 / 23 (Σ = 44)

Page 62: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Annexe

Theorem oute r_ l_pr :∀ ( ` : l i s t N )

( δ : N ) ,

outer_l_n2 ` δ= ou t e r_ l ` δ .

Proof .i n t r o s ` δ .induct ion δ .

2 subgoa l s , s ubgoa l 1 ( ID 39)

` : l i s t N============================outer_loop_n2 ` 0

= oute r_ loop ` 0

subgoa l 2 ( ID 42) i s :outer_l_n2 ` (S δ )= ou t e r_ l ` (S δ )

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 38 / 23 (Σ = 44)

Page 63: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Annexe

Theorem oute r_ l_pr :∀ ( ` : l i s t N )

( δ : N ) ,

outer_l_n2 ` δ= ou t e r_ l ` δ .

Proof .i n t r o s ` δ .induct ion δ .s impl .

2 subgoa l s , s ubgoa l 1 ( ID 39)

` : l i s t N============================[ ] = [ ]

subgoa l 2 ( ID 42) i s :outer_l_n2 ` (S δ )= ou t e r_ l ` (S δ )

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 39 / 23 (Σ = 44)

Page 64: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Annexe

Theorem oute r_ l_pr :∀ ( ` : l i s t N )

( δ : N ) ,

outer_l_n2 ` δ= ou t e r_ l ` δ .

Proof .i n t r o s ` δ .induct ion δ .s impl .r e f l e x i v i t y .

1 subgoa l s , s ubgoa l 1 ( ID 42)

` : l i s t Nδ : NIHδ : outer_l_n2 ` δ

= ou t e r_ l ` δ============================outer_l_n2 ` (S δ )= ou t e r_ l ` (S δ )

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 40 / 23 (Σ = 44)

Page 65: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Annexe

Theorem oute r_ l_pr :∀ ( ` : l i s t N )

( δ : N ) ,

outer_l_n2 ` δ= ou t e r_ l ` δ .

Proof .i n t r o s ` δ .induct ion δ .s impl .r e f l e x i v i t y .

s impl .

1 subgoa l s , s ubgoa l 1 ( ID 48)

` : l i s t Nδ : NIHδ : outer_l_n2 ` δ

= ou t e r_ l ` δ============================inner_ l_n2 ` (S δ )++ outer_l_n2 ` δ =

i nn e r_ l ` (S δ )++ ou t e r_ l ` δ

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 41 / 23 (Σ = 44)

Page 66: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Annexe

Theorem oute r_ l_pr :∀ ( ` : l i s t N )

( δ : N ) ,

outer_l_n2 ` δ= ou t e r_ l ` δ .

Proof .i n t r o s ` δ .induct ion δ .s impl .r e f l e x i v i t y .

s impl .apply l i s t_eq_con s .

2 subgoa l s , s ubgoa l 1 ( ID 49)

` : l i s t Nδ : NIHδ : outer_l_n2 ` δ

= ou t e r_ l ` δ============================inner_ l_n2 ` (S δ )= i n n e r_ l ` (S δ )

subgoa l 2 ( ID 50) i s :outer_l_n2 ` δ= ou t e r_ l ` δ

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 42 / 23 (Σ = 44)

Page 67: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Annexe

Theorem oute r_ l_pr :∀ ( ` : l i s t N )

( δ : N ) ,

outer_l_n2 ` δ= ou t e r_ l ` δ .

Proof .i n t r o s ` δ .induct ion δ .s impl .r e f l e x i v i t y .

s impl .apply l i s t_eq_con s .apply inner_l_n2_p .

1 subgoa l s , s ubgoa l 1 ( ID 50)

` : l i s t Nδ : NIHδ : outer_l_n2 ` δ= ou t e r_ l ` δ

============================outer_l_n2 ` δ= ou t e r_ l ` δ

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 43 / 23 (Σ = 44)

Page 68: L3-Intership:FormalProofof Uno and Yagiura’sAlgorithmperso.eleves.ens-rennes.fr/~mfleur01/documents/Fleury_internship... · Présentation Décomposition modulaire de graphe modulaire

Annexe

Theorem oute r_ l_pr :∀ ( ` : l i s t N )

( δ : N ) ,

outer_l_n2 ` δ= ou t e r_ l ` δ .

Proof .i n t r o s ` δ .induct ion δ .s impl .r e f l e x i v i t y .

s impl .apply l i s t_eq_con s .apply inner_l_n2_p .assumption .

Qed .

Fleury Mathias L3-Intership: Formal Proof of Uno and Yagiura’s Algorithm 44 / 23 (Σ = 44)