Documentation

LeanPool.BrillNoetherGraphs.TreewidthGonality.Treewidth.TreeDecomposition

Tree decompositions and treewidth #

Mathlib has no treewidth as of 2026-08-25, so this module introduces it from scratch, in the shape needed by the van Dobben de Bruyn--Gijswijt theorem treewidth ≤ gonality (TreewidthGonality/Gonality/TreewidthGonality.lean).

The connectivity convention (binds every downstream module) #

Two conventions were available for "the vertex set S induces a connected subgraph of H": SimpleGraph.Subgraph connectivity, and the induced graph on the coercion of S to a Set. This library uses the induced-graph form throughout:

(H.induce (↑S : Set V)).Connected

for S : Finset V, and likewise for subsets of the tree's node type. Reasons:

TreewidthGonality/Treewidth/Bramble.lean and TreewidthGonality/Gonality/BrambleGonality.lean use the same form. Do not mix in Subgraph.Connected without converting.

Multigraph note #

Treewidth is defined for a SimpleGraph. For a chip-firing multigraph G the intended instantiation is underlyingSimpleGraph G: parallel edges and loops do not change treewidth, so nothing is lost.

Contents #

structure Utilities.Treewidth.TreeDecomposition {V : Type u} (H : SimpleGraph V) :
Type (max 1 u)

A tree decomposition of a simple graph H: a finite tree tree on a node type Node, together with a bag of vertices at each node, such that

  • cover_vertex — every vertex lies in some bag;
  • cover_edge — the two endpoints of every edge lie in a common bag;
  • coherent — for each vertex v the set of nodes whose bag contains v induces a connected (in particular nonempty) subtree.

coherent implies cover_vertex (connectedness bundles nonemptiness), but both are kept: cover_vertex is the field callers actually use, and stating it separately keeps the definition readable.

Instances For

    The width of a tree decomposition: one less than the largest bag size. The subtraction is truncated ℕ subtraction, which is harmless: sup (card - 1) and sup card - 1 agree in every case, including the degenerate all-bags-empty one.

    Equations
    Instances For

      Every bag has at most width + 1 vertices.

      Every bag has at most Fintype.card V vertices.

      The set of widths realized by some tree decomposition of H.

      Equations
      Instances For
        noncomputable def Utilities.Treewidth.treewidth {V : Type u} (H : SimpleGraph V) :

        The treewidth of H: the least width of a tree decomposition.

        This is an sInf over ℕ, which is total; widthSet_nonempty (via trivialDecomposition) is what makes the value meaningful rather than the sInf ∅ = 0 default.

        Equations
        Instances For

          The trivial tree decomposition: a single node whose bag is all of V.

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For

            Some tree decomposition exists, so treewidth is an infimum over a nonempty set of naturals.

            Any tree decomposition bounds the treewidth.

            The treewidth is realized by an actual decomposition.

            treewidth H ≤ |V| - 1, from the one-bag decomposition.