Documentation

CslibFrontier.Computability.Complexity.Problems.LongPath

k-Path #

Cslib.Complexity.LongPath is the decision version of Longest Path with the length as parameter [CyganEtAl2015, Section 5.2]: the instances ⟨G, k⟩ (Cslib.Complexity.LongPathInstance, encoded by Cslib.Complexity.encLongPath) such that the graph G has a simple path on k of its declared vertices. A path is a duplicate-free list of declared vertices in which consecutive vertices are adjacent (Cslib.Complexity.Graph.IsVertexPath); for k = k' + 1 these are the paths of length k' of Mathlib's SimpleGraph.Walk on the induced graph (Cslib.Complexity.mem_LongPath_succ_iff). The target k = 0 is accepted by the empty path.

Main definitions #

Main results #

References #

p is a path of G: a list of declared vertices without repetitions in which consecutive vertices are adjacent.

A path has at most as many vertices as the distinct declared vertices.

@[simp]

The empty list is a path.

k-Path (the decision version of Longest Path) [CyganEtAl2015, Section 5.2]: the instances ⟨G, k⟩ such that G has a path on k vertices.

  • graph : Graph

    The undirected graph in which to find a simple path.

  • target : ℕ

    The target number of vertices on the path.

Instances For
    theorem Cslib.Complexity.LongPathInstance.ext {x y : LongPathInstance} (graph : x.graph = y.graph) (target : x.target = y.target) :
    x = y
    theorem Cslib.Complexity.encLongPath_graph_polyTime {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {g✝ : γ✝ → LongPathInstance} :
    theorem Cslib.Complexity.encLongPath_graph_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → LongPathInstance} :
    Turing.MultiTapeTM.ComputableInSpace g✝ encIn✝ encLongPath S✝ → Turing.MultiTapeTM.ComputableInSpace (fun (c : γ✝) => (g✝ c).graph) encIn✝ encGraph S✝
    theorem Cslib.Complexity.encLongPath_target_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → LongPathInstance} :
    theorem Cslib.Complexity.encLongPath_mk_polyTime {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → Graph} {x1 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInPolyTime x0 encIn encGraph) (h1 : Turing.MultiTapeTM.ComputableInPolyTime x1 encIn Turing.MultiTapeTM.encNat) :
    Turing.MultiTapeTM.ComputableInPolyTime (fun (x : γ) => { graph := x0 x, target := x1 x }) encIn encLongPath
    @[reducible, inline]

    The tuple of the fields of encLongPath.

    Encoding of LongPathInstance as (graph, target) with target in binary.

    theorem Cslib.Complexity.encLongPath_mk_inO {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → Graph} {T0 S0 x1 T1 S1 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO x0 encIn encGraph T0 S0) (h1 : Turing.MultiTapeTM.ComputableInO x1 encIn Turing.MultiTapeTM.encNat T1 S1) :
    Turing.MultiTapeTM.ComputableInO (fun (x : γ) => { graph := x0 x, target := x1 x }) encIn encLongPath (fun (x : γ) => T0 x + T1 x) fun (x : γ) => S0 x + S1 x
    theorem Cslib.Complexity.encLongPath_mk_budget {γ : Type} {encIn : γ ↪ List Bool} {budget : γ → ℕ} {x0 : γ → Graph} {x1 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInSpace x0 encIn encGraph budget) (h1 : Turing.MultiTapeTM.ComputableInSpace x1 encIn Turing.MultiTapeTM.encNat budget) :
    Turing.MultiTapeTM.ComputableInSpace (fun (x : γ) => { graph := x0 x, target := x1 x }) encIn encLongPath budget

    k-Path (the decision version of Longest Path) [CyganEtAl2015, Section 5.2]: the instances ⟨G, k⟩ such that G has a path on k vertices.

    theorem Cslib.Complexity.mem_LongPath_iff {G : Graph} {k : ℕ} :
    { graph := G, target := k } ∈ LongPath ↔ ∃ (p : List ℕ), G.IsVertexPath p ∧ p.length = k
    theorem Cslib.Complexity.mem_LongPath_zero (G : Graph) :
    { graph := G, target := 0 } ∈ LongPath

    Every graph has a path on no vertices.

    theorem Cslib.Complexity.not_mem_LongPath_of_lt {G : Graph} {k : ℕ} (hk : G.distinctVertices.length < k) :
    { graph := G, target := k } ∉ LongPath

    A graph has no path on more vertices than its distinct declared vertices.

    theorem Cslib.Complexity.mem_LongPath_succ_iff {G : Graph} {k : ℕ} :
    { graph := G, target := k + 1 } ∈ LongPath ↔ ∃ (u : { v : ℕ // v ∈ G.vertices }) (v : { v : ℕ // v ∈ G.vertices }) (w : G.induced.Walk u v), w.IsPath ∧ w.length = k

    Paths on k + 1 vertices are paths of length k of Mathlib's SimpleGraph.Walk on the induced graph.