graph theory in coq minors treewidth and isomorphisms
play

Graph Theory in Coq: Minors, Treewidth and Isomorphisms Damien Pous - PowerPoint PPT Presentation

Graph Theory in Coq: Minors, Treewidth and Isomorphisms Damien Pous Christian Doczkal CNRS / LIP, ENS de Lyon, France Coq Workshop 2019 - September 8, 2019 Background Graph library published as part ITP 2018 paper: simple graphs, directed


  1. Graph Theory in Coq: Minors, Treewidth and Isomorphisms Damien Pous Christian Doczkal CNRS / LIP, ENS de Lyon, France Coq Workshop 2019 - September 8, 2019

  2. Background Graph library published as part ITP 2018 paper: ◮ simple graphs, directed mulitgraphs ◮ paths, connected components, etc. ◮ minors and treewidth ◮ extracting term descriptions from graphs ◮ equivalence between treewidth two and K 4 -freeness (obtained as a corollary of term extraction) Additions and improvements for (submitted) journal version: ◮ Menger’s Theorem and corollaries (graph connectivity) ◮ simplified equivalence of treewidth two and K 4 -freeness ◮ compositional reasoning about graph isomorphisms C. Doczkal , D. Pous Graph Theory in Coq 2 / 20

  3. Background Graph library published as part ITP 2018 paper: ◮ simple graphs, directed mulitgraphs ◮ paths, connected components, etc. ◮ minors and treewidth ◮ extracting term descriptions from graphs ◮ equivalence between treewidth two and K 4 -freeness (obtained as a corollary of term extraction) Additions and improvements for (submitted) journal version: ◮ Menger’s Theorem and corollaries (graph connectivity) ◮ simplified equivalence of treewidth two and K 4 -freeness ◮ compositional reasoning about graph isomorphisms C. Doczkal , D. Pous Graph Theory in Coq 2 / 20

  4. Problem: Axiomatizing Graph Isomorphism Term language describing certain graphs (2p-graphs) Interpretation function: g : Tm → 2p-graph. ◮ compositionally interprets syntactic constructs as graph operations Axiom System: 2 p ⊢ u ≡ v . C. Doczkal , D. Pous Graph Theory in Coq 3 / 20

  5. Problem: Axiomatizing Graph Isomorphism Term language describing certain graphs (2p-graphs) Interpretation function: g : Tm → 2p-graph. ◮ compositionally interprets syntactic constructs as graph operations Axiom System: 2 p ⊢ u ≡ v . Theorem ( [Cosme-Lopez & Pous ’17, Doczkal & Pous ’18]) g ( u ) ≃ g ( v ) ⇐ ⇒ 2 p ⊢ u ≡ v C. Doczkal , D. Pous Graph Theory in Coq 3 / 20

  6. Problem: Axiomatizing Graph Isomorphism Term language describing certain graphs (2p-graphs) Interpretation function: g : Tm → 2p-graph. ◮ compositionally interprets syntactic constructs as graph operations Axiom System: 2 p ⊢ u ≡ v . Theorem ( [Cosme-Lopez & Pous ’17, Doczkal & Pous ’18]) g ( u ) ≃ g ( v ) ⇐ ⇒ 2 p ⊢ u ≡ v Context: Theorem ( [Freyd & Scedrov ’90, Pous & Vignudelli ’18]) ⇒ AL ⊤ ⊢ u ≡ v g ( u ) R g ( v ) ⇐ ( ≃ � R) C. Doczkal , D. Pous Graph Theory in Coq 3 / 20

  7. Problem: Axiomatizing Graph Isomorphism Term language describing certain graphs (2p-graphs) Interpretation function: g : Tm → 2p-graph. ◮ compositionally interprets syntactic constructs as graph operations Axiom System: 2 p ⊢ u ≡ v . Theorem ( [Cosme-Lopez & Pous ’17, Doczkal & Pous ’18]) g ( u ) ≃ g ( v ) ⇐ = 2 p ⊢ u ≡ v Context: Theorem ( [Freyd & Scedrov ’90, Pous & Vignudelli ’18]) ⇒ AL ⊤ ⊢ u ≡ v g ( u ) R g ( v ) ⇐ ( ≃ � R) C. Doczkal , D. Pous Graph Theory in Coq 3 / 20

  8. 2p-graphs c a b a c d d (finite 2-pointed multi-) graphs: labeled directed edges multiple edges between vertices self loops two designated vertices ( input and output ) C. Doczkal , D. Pous Graph Theory in Coq 4 / 20

  9. Terms of 2p-algebras [Cosme-Lopez & Pous ’17] � ⊤ � 1 � u ◦ � � dom ( u ) � u � v � u · v � � � � � u , v , w ::= a ( a ∈ Σ) a a � ⊤ � 1 � G ◦ � G dom ( G ) � G G G � H � H G · H � G H (where G = and H = ) G H C. Doczkal , D. Pous Graph Theory in Coq 5 / 20

  10. Example 1 ( G · H ) � 1 G H C. Doczkal , D. Pous Graph Theory in Coq 6 / 20

  11. Example 1 ( G · H ) � 1 G H C. Doczkal , D. Pous Graph Theory in Coq 6 / 20

  12. Example 1 ( G · H ) � 1 G H C. Doczkal , D. Pous Graph Theory in Coq 6 / 20

  13. Example 1 ( G · H ) � 1 G H C. Doczkal , D. Pous Graph Theory in Coq 6 / 20

  14. Example 1 ( G · H ) � 1 G H C. Doczkal , D. Pous Graph Theory in Coq 6 / 20

  15. Example 1 ( G · H ) � 1 G H C. Doczkal , D. Pous Graph Theory in Coq 6 / 20

  16. Example 2 dom ( G � H ◦ ) G H C. Doczkal , D. Pous Graph Theory in Coq 7 / 20

  17. Example 2 dom ( G � H ◦ ) G H C. Doczkal , D. Pous Graph Theory in Coq 7 / 20

  18. Example 2 dom ( G � H ◦ ) G (180 ◦ rotation – no change) H C. Doczkal , D. Pous Graph Theory in Coq 7 / 20

  19. Example 2 dom ( G � H ◦ ) G H C. Doczkal , D. Pous Graph Theory in Coq 7 / 20

  20. Example 2 dom ( G � H ◦ ) G H C. Doczkal , D. Pous Graph Theory in Coq 7 / 20

  21. Example 2 dom ( G � H ◦ ) G H C. Doczkal , D. Pous Graph Theory in Coq 7 / 20

  22. Example 2 dom ( G � H ◦ ) G H The axioms of 2p-algebras [Cosme-Lopez & Pous ’17] equate exactly those terms whose graphs are isomorphic. C. Doczkal , D. Pous Graph Theory in Coq 7 / 20

  23. 2p-algebras u � ( v � w ) ≡ ( u � v ) � w (A1) u � v ≡ v � u (A2) u � ⊤ ≡ u (A3) u · ( v · w ) ≡ ( u · v ) · w (A4) u · 1 ≡ u (A5) u ◦◦ ≡ u (A6) ( u � v ) ◦ ≡ u ◦ � v ◦ (A7) ( u · v ) ◦ ≡ v ◦ · u ◦ (A8) 1 � 1 ≡ 1 (A9) dom ( u � v ◦ ) ≡ 1 � u · v (A10) u ·⊤ ≡ dom ( u ) ·⊤ (A11) (1 � u ) · v ≡ (1 � u ) ·⊤ � v (A12) C. Doczkal , D. Pous Graph Theory in Coq 8 / 20

  24. 2p-algebras u � ( v � w ) ≡ ( u � v ) � w (A1) u � v ≡ v � u (A2) u � ⊤ ≡ u (A3) u · ( v · w ) ≡ ( u · v ) · w (A4) u · 1 ≡ u (A5) u ◦◦ ≡ u (A6) ( u � v ) ◦ ≡ u ◦ � v ◦ (A7) ( u · v ) ◦ ≡ v ◦ · u ◦ (A8) 1 � 1 ≡ 1 (A9) dom ( u � v ◦ ) ≡ 1 � u · v (A10) u ·⊤ ≡ dom ( u ) ·⊤ (A11) (1 � u ) · v ≡ (1 � u ) ·⊤ � v (A12) C. Doczkal , D. Pous Graph Theory in Coq 8 / 20

  25. Coq I: Formalization of Graphs Record graph := Graph { vertex : finType; edge: finType; source : edge → vertex; target : edge → vertex; label : edge → sym } . Record graph2 := Graph2 { graph of : graph; g in : graph of; g out : graph of } . Uses finite types from MathComp/Ssreflect. Finite types are closed under disjoint union and quotients. C. Doczkal , D. Pous Graph Theory in Coq 9 / 20

  26. Coq II: Term Graphs � ⊤ � 1 � u ◦ � � dom ( u ) � u � v � u · v � � � � � u , v , w ::= a ( a ∈ Σ) Graphs for a , ⊤ , and 1 can easily be defined ◦ and dom ( ), only change input/output Unary graph operations, Binary operations, � and · , can be described using two primitive operations (on graph not on graph2 ): ◮ Disjoint union: ⊎ : graph → graph → graph ◮ Quotients: / / : ∀ ( G : graph) . list( G ∗ G ) → graph (with “class” function π : G → G / / e ). � G , ι, o � · � G ′ , ι ′ , o ′ � := � G ⊎ G ′ / / [(inl o , inr ι ′ )] , π (inl ι ) , π (inr o ′ ) � C. Doczkal , D. Pous Graph Theory in Coq 10 / 20

  27. Isomorphisms for two-pointed directed multigraphs a a C. Doczkal , D. Pous Graph Theory in Coq 11 / 20

  28. Isomorphisms for two-pointed directed multigraphs a a s t • s ′ t ′ • a C. Doczkal , D. Pous Graph Theory in Coq 11 / 20

  29. Isomorphisms for two-pointed directed multigraphs a a s t • g f f s ′ t ′ • a C. Doczkal , D. Pous Graph Theory in Coq 11 / 20

  30. Isomorphisms for two-pointed directed multigraphs a a s t • g f f s ′ t ′ • a multigraph homomorphisms: s ′ ◦ g = f ◦ s 1 t ′ ◦ g = f ◦ t 2 l = l ′ ◦ g 3 C. Doczkal , D. Pous Graph Theory in Coq 11 / 20

  31. Isomorphisms for two-pointed directed multigraphs a a s t • g f f s ′ t ′ • a multigraph homomorphisms: s ′ ◦ g = f ◦ s 1 t ′ ◦ g = f ◦ t 2 l = l ′ ◦ g 3 homomorphisms of 2p-graphs: f ( ι ) = ι ′ and f ( o ) = o ′ C. Doczkal , D. Pous Graph Theory in Coq 11 / 20

  32. Isomorphisms for two-pointed directed multigraphs a a s t • g f f s ′ t ′ • a multigraph homomorphisms: s ′ ◦ g = f ◦ s 1 t ′ ◦ g = f ◦ t 2 l = l ′ ◦ g 3 homomorphisms of 2p-graphs: f ( ι ) = ι ′ and f ( o ) = o ′ isomorphisms: f bijective (i.e., define f ′ and show f ◦ f ′ = id and f ′ ◦ f = id) 1 g bijective 2 C. Doczkal , D. Pous Graph Theory in Coq 11 / 20

  33. Isomorphisms for two-pointed directed multigraphs a a s t • g f f s ′ t ′ • a multigraph homomorphisms: s ′ ◦ g = f ◦ s 1 t ′ ◦ g = f ◦ t 2 l = l ′ ◦ g 3 homomorphisms of 2p-graphs: f ( ι ) = ι ′ and f ( o ) = o ′ isomorphisms: f bijective (i.e., define f ′ and show f ◦ f ′ = id and f ′ ◦ f = id) 1 g bijective 2 4 function defintions and 9 equalities for every isomorphism source and target include nested quotients ( dom ( G � H ◦ ) ≃ 1 � G · H ) C. Doczkal , D. Pous Graph Theory in Coq 11 / 20

  34. 2p-algebras u � ( v � w ) ≡ ( u � v ) � w (A1) u � v ≡ v � u (A2) u � ⊤ ≡ u (A3) u · ( v · w ) ≡ ( u · v ) · w (A4) u · 1 ≡ u (A5) u ◦◦ ≡ u (A6) ( u � v ) ◦ ≡ u ◦ � v ◦ (A7) ( u · v ) ◦ ≡ v ◦ · u ◦ (A8) 1 � 1 ≡ 1 (A9) dom ( u � v ◦ ) ≡ 1 � u · v (A10) u ·⊤ ≡ dom ( u ) ·⊤ (A11) (1 � u ) · v ≡ (1 � u ) ·⊤ � v (A12) C. Doczkal , D. Pous Graph Theory in Coq 12 / 20

Recommend


More recommend