theory Graphs imports Main begin types vertex = nat types digraph = "(vertex set) \ ((vertex \ vertex) set)" abbreviation vertices :: "digraph \ vertex set" ("V[_]" [80] 80) where "V[G] \ fst G" abbreviation edges :: "digraph \ (vertex \ vertex) set" ("E[_]" [80] 80) where "E[G] \ snd G" definition is_digraph :: "digraph \ bool" where "is_digraph G \ \ u v. (u,v) \ E[G] \ u \ V[G] \ v \ V[G]" primrec is_path :: "digraph \ vertex \ vertex list \ vertex \ bool" where "is_path G u [] v = (u \ V[G] \ u = v)" | "is_path G u (v#p) w = ((u,v) \ E[G] \ is_path G v p w)" definition strongly_connected :: "digraph \ (vertex \ vertex) set" where "strongly_connected G \ {(u,v). \ p q. is_path G u p v \ is_path G v q u}" theorem strongly_connected_is_equiv: assumes dg: "is_digraph G" shows "equiv (V[G]) (strongly_connected G)" oops end