Documentation

CslibFrontier.Computability.Complexity.Problems.GraphIsomorphism

Graph isomorphism #

GraphIsomorphism is the set of pairs of graphs (Cslib.Complexity.GraphIsomorphismInstance, encoded by Cslib.Complexity.encGraphIsomorphism), that are isomorphic: the simple graphs induced on their declared vertices (Cslib.Complexity.Graph.induced) are isomorphic in the sense of Mathlib's SimpleGraph.Iso. Repeated vertex entries are ignored, and so are edges with an endpoint outside the declared vertices. GraphNonIsomorphism is its complement Arora and Barak, Section 8.1.3.

Positions in the list Graph.distinctVertices of declared vertices without repetitions enumerate the vertices (Cslib.Complexity.Graph.vertexEquiv), and Graph.adjIndex reads adjacency through positions. Two graphs are isomorphic exactly when a bijection of positions preserves adjIndex (mem_GraphIsomorphism_iff).

GraphIsomorphism ∈ NP: a certificate encodes an ordering of the second graph's declared vertices in unary blocks (Cslib.Complexity.Graph.decodeVertexList), and the verifier checks that it lists every declared vertex of the second graph once (Cslib.Complexity.Graph.verifyOrdering), has as many vertices as the first graph, and preserves adjacency.

Main definitions #

Main results #

References #

Adjacency of the vertices at positions i and j of G.distinctVertices.

Adjacency of computed positions in a computed graph is polynomial-time.

An instance (first, second) of Graph Isomorphism and Graph Non-Isomorphism.

  • first : Graph

    The first graph in the pair.

  • second : Graph

    The second graph in the pair.

Instances For
    @[reducible, inline]

    The tuple of the fields of encGraphIsomorphism.

    theorem Cslib.Complexity.encGraphIsomorphism_mk_inO {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → Graph} {T0 S0 : γ → ℕ} {x1 : γ → Graph} {T1 S1 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO x0 encIn encGraph T0 S0) (h1 : Turing.MultiTapeTM.ComputableInO x1 encIn encGraph T1 S1) :
    Turing.MultiTapeTM.ComputableInO (fun (x : γ) => { first := x0 x, second := x1 x }) encIn encGraphIsomorphism (fun (x : γ) => T0 x + T1 x) fun (x : γ) => S0 x + S1 x
    theorem Cslib.Complexity.encGraphIsomorphism_mk_budget {γ : Type} {encIn : γ ↪ List Bool} {budget : γ → ℕ} {x0 x1 : γ → Graph} (h0 : Turing.MultiTapeTM.ComputableInSpace x0 encIn encGraph budget) (h1 : Turing.MultiTapeTM.ComputableInSpace x1 encIn encGraph budget) :
    Turing.MultiTapeTM.ComputableInSpace (fun (x : γ) => { first := x0 x, second := x1 x }) encIn encGraphIsomorphism budget
    theorem Cslib.Complexity.encGraphIsomorphism_second_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → GraphIsomorphismInstance} :
    Turing.MultiTapeTM.ComputableInSpace g✝ encIn✝ encGraphIsomorphism S✝ → Turing.MultiTapeTM.ComputableInSpace (fun (c : γ✝) => (g✝ c).second) encIn✝ encGraph S✝
    theorem Cslib.Complexity.encGraphIsomorphism_first_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → GraphIsomorphismInstance} :
    Turing.MultiTapeTM.ComputableInSpace g✝ encIn✝ encGraphIsomorphism S✝ → Turing.MultiTapeTM.ComputableInSpace (fun (c : γ✝) => (g✝ c).first) encIn✝ encGraph S✝

    The pairs of isomorphic graphs: the graphs induced on the declared vertices are isomorphic Arora and Barak, Section 8.1.3.

    Two graphs are isomorphic exactly when a bijection between the positions of their distinct vertices preserves adjacency.

    Isomorphic graphs have equally many distinct vertices.

    theorem Cslib.Complexity.mem_GraphIsomorphism_iff_exists_perm {G₀ G₁ : Graph} (h : G₁.distinctVertices.length = G₀.distinctVertices.length) :
    { first := G₀, second := G₁ } ∈ GraphIsomorphism ↔ ∃ (τ : Equiv.Perm (Fin G₀.distinctVertices.length)), ∀ (i j : Fin G₀.distinctVertices.length), G₁.adjIndex ↑(τ i) ↑(τ j) = G₀.adjIndex ↑i ↑j

    Graphs with equally many distinct vertices are isomorphic exactly when a permutation of the positions of the first carries its adjacency to the adjacency of the second.

    Verification #

    Accept a certificate when the decoded ordering of the second graph's declared vertices has as many vertices as the first graph and preserves adjacency.

    verifier is a verifier for GraphIsomorphism with certificates whose length is the square of the length of the encoded pair of graphs.