While this submission is a draft, it cannot be used by other submissions.

Optimal tree decompositions from a given one

Lax117284.BodlaenderKloks · concepts/Lax117284/BodlaenderKloks.lean · lax-117284

proven

Loading review…

Sign in with ORCID

Community review

Flags

Each flag is tied to a public ORCID identity and explains why this concept may be incorrect.

No flags have been submitted.

    Community review

    Flag this concept

    State precisely what appears incorrect. This explanation will be public under your ORCID name.

    No source line selected.

    Natural Language Statement

    Theorem

    The theorem of Bodlaender and Kloks. For all kk and ℓ\ell there is a linear-time algorithm that, given a graph together with a tree decomposition of width at most ℓ\ell, decides whether the treewidth of the graph is at most kk and, if so, finds a tree decomposition of width at most kk. The dependence on ℓ\ell is 2O(ℓ3)2^{O(\ell^3)}.

    H. L. Bodlaender and T. Kloks, "Efficient and constructive algorithms for the pathwidth and treewidth of graphs", Journal of Algorithms 21 (1996) 358–402. A simpler presentation, which this module follows, is E. Althaus and S. Ziegler, "Optimal tree decompositions revisited: a simpler linear-time FPT algorithm", arXiv:1912.09144 (2020), §3; the statement is Theorem 2.10 of H. L. Bodlaender, "A linear-time algorithm for finding tree-decompositions of small treewidth", SIAM Journal on Computing 25 (1996) 1305–1317, where it is used as a black box.

    This is the second stage of Bodlaender's algorithm, BodlaenderGeneral.niceDecompositioncomputableBodlaenderGeneral.niceDecomposition_computable being the first: the latter builds the decomposition of width at most 2k+12k+1 this one consumes.

    Concept map
    4 concepts
    100%
    Proven claimDefinitionThis conceptRelated conceptA → B: B builds on A
    Evidence

    Each proof establishes this claim relative to its assumptions.

    In the paper

    • page 5 of this submission's paper

    Lean source view on GitHub

    1import Lax117284.GraphWords
    2import Lax808846.Ram
    3
    4/-!
    5---
    6title: Optimal tree decompositions from a given one
    7type: theorem
    8---
    9**The theorem of Bodlaender and Kloks.** For all kk and ℓ\ell there is a linear-time
    10algorithm that, given a graph together with a tree decomposition of width at most ℓ\ell,
    11decides whether the treewidth of the graph is at most kk and, if so, finds a tree
    12decomposition of width at most kk. The dependence on ℓ\ell is 2O(ℓ3)2^{O(\ell^3)}.
    13
    14H. L. Bodlaender and T. Kloks, *"Efficient and constructive algorithms for the pathwidth and
    15treewidth of graphs"*, Journal of Algorithms 21 (1996) 358–402. A simpler presentation, which
    16this module follows, is E. Althaus and S. Ziegler, *"Optimal tree decompositions revisited:
    17a simpler linear-time FPT algorithm"*, arXiv:1912.09144 (2020), §3; the statement is Theorem
    182.10 of H. L. Bodlaender, *"A linear-time algorithm for finding tree-decompositions of small
    19treewidth"*, SIAM Journal on Computing 25 (1996) 1305–1317, where it is used as a black box.
    20
    21This is the *second stage* of Bodlaender's algorithm, `BodlaenderGeneral.niceDecomposition_computable`
    22being the first: the latter builds the decomposition of width at most 2k+12k+1 this one
    23consumes.
    24
    25# Formalization notes
    26
    27The input is one word: the graph (see `GraphWords`), the two numbers `k` and `l`, and the word
    28of a nice tree decomposition of width at most `l`. The graph word states its own length, so the
    29three parts are told apart. The given decomposition is nice; Althaus and Ziegler assume it and
    30the conversion of an arbitrary decomposition into a nice one of the same width takes time
    31O(ℓ2(∣V(T)∣+∣V∣))O(\ell^2(|V(T)| + |V|)) (Kloks), so nothing is lost.
    32
    33The output is either `[0]`, admissible only when the graph has no tree decomposition of width
    34at most `k`, or `1` followed by the word of a nice tree decomposition of width at most `k`. It
    35is a relation rather than a function: a graph has many decompositions, and the program may
    36produce any one of them. The output is nice, where the theorem produces an arbitrary
    37decomposition, because the conversion is one more linear-time pass and every consumer wants
    38the nice form.
    39
    40The bound is `c * 2 ^ (c * l ^ 3) * (|input| + 2) ^ c`. The paper's is linear in the number of
    41vertices; on a word RAM given the adjacency matrix the input has length quadratic in the number
    42of vertices, and the statement is polynomial in it, which is all a consumer needs. The
    43condition on the word length is an explicit inequality against `2 ^ W`, on every entry of the
    44input: the tables of the algorithm have size `2 ^ (c * l ^ 3)` times a polynomial in the length,
    45so a machine of too small a word length cannot hold them.
    46
    47The program and the constant are quantified before the word length, the graph and the two
    48bounds, so one program serves all of them.
    49-/
    50
    51namespace Lax117284.BodlaenderKloks
    52
    53open Lax808846.Ram Lax117284.GraphWords
    54
    55open Classical in
    56/-- **The theorem of Bodlaender and Kloks, on a word RAM.** One program and one constant serve
    57every word length `W`, every graph `G`, every bound `k` and every nice tree decomposition `D` of
    58`G` of width at most `l`, provided the input `g ++ [k, l] ++ D` fits with room for
    59`c * 2 ^ (c * l ^ 3)` times a polynomial in its length. On such an input the program halts
    60within `c * 2 ^ (c * l ^ 3) * (|input| + 2) ^ c` instructions, writing `[0]` if the graph has no
    61tree decomposition of width at most `k`, and `1` followed by the word of a nice tree
    62decomposition of width at most `k` otherwise. -/
    63axiom improveDecomposition :
    64 ∃ (prog : Program) (c : ℕ), ∀ (W k l : ℕ) (n : ℕ) (G : SimpleGraph (Fin n)) (g D : List ℕ),
    65 EncodesGraph g G → NiceDecomposition G l D →
    66 (∀ v ∈ g ++ [k, l] ++ D,
    67 c * 2 ^ (c * l ^ 3) * ((g ++ [k, l] ++ D).length + v + 1) ^ c ≤ 2 ^ W) →
    68 ∃ (out : List ℕ) (t : ℕ), t ≤ c * 2 ^ (c * l ^ 3) * ((g ++ [k, l] ++ D).length + 2) ^ c ∧
    69 RunsTo W prog (g ++ [k, l] ++ D) out t ∧
    70 (out = [0] ∧ ¬ Lax228581.Treewidth.HasTreewidthAtMost G k ∨
    71 ∃ D', out = 1 :: D' ∧ NiceDecomposition G k D')
    72
    73end Lax117284.BodlaenderKloks
    74
    Show Proof
    Formalization notes

    The input is one word: the graph (see GraphWordsGraphWords), the two numbers kk and ll, and the word of a nice tree decomposition of width at most ll. The graph word states its own length, so the three parts are told apart. The given decomposition is nice; Althaus and Ziegler assume it and the conversion of an arbitrary decomposition into a nice one of the same width takes time O(ℓ2(∣V(T)∣+∣V∣))O(\ell^2(|V(T)| + |V|)) (Kloks), so nothing is lost.

    The output is either [0][0], admissible only when the graph has no tree decomposition of width at most kk, or 11 followed by the word of a nice tree decomposition of width at most kk. It is a relation rather than a function: a graph has many decompositions, and the program may produce any one of them. The output is nice, where the theorem produces an arbitrary decomposition, because the conversion is one more linear-time pass and every consumer wants the nice form.

    The bound is c∗2(c∗l3)∗(∣input∣+2)cc * 2 ^ (c * l ^ 3) * (|input| + 2) ^ c. The paper's is linear in the number of vertices; on a word RAM given the adjacency matrix the input has length quadratic in the number of vertices, and the statement is polynomial in it, which is all a consumer needs. The condition on the word length is an explicit inequality against 2W2 ^ W, on every entry of the input: the tables of the algorithm have size 2(c∗l3)2 ^ (c * l ^ 3) times a polynomial in the length, so a machine of too small a word length cannot hold them.

    The program and the constant are quantified before the word length, the graph and the two bounds, so one program serves all of them.

    Builds on
    Used by

    none

    From Mathlib

    none

    Discussion

    Ask a question or add context. Endorsements and structured flags are kept in the review panel above.

    Loading discussion…