Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Definition 5, p. 42 — equal-size nice decompositions with leaf, replace and join nodes

Definition
TraceAdopt_LPReform_Supplement_NiceDecomposition

by mikedeng1 · Nov 23, 2026 · Mathlib 0df444a (Lean v4.33.1)

dynamic-programmingnetwork-diffusionp2o-batch-supp500p2o-gran-per-chapterp2o-plan-paperp2o-v1tree-decompositiontreewidth

A nice tree decomposition of the auxiliary graph G′G'G′ is a rooted tree decomposition in which every bag has exactly ω′+1\omega'+1ω′+1 vertices. Every node has one of three forms:

  1. a leaf, with no children;
  2. a replace node with one child, whose bag loses one vertex vvv and gains one distinct vertex uuu;
  3. a join node with two distinct children, both with the same bag as the parent.

Thus, at a replace node zzz with child z0z_0z0​,

Xz′∖Xz0′={u},Xz0′∖Xz′={v},u≠v.X'_z\setminus X'_{z_0}=\{u\},\qquad X'_{z_0}\setminus X'_z=\{v\},\qquad u\ne v.Xz′​∖Xz0​′​={u},Xz0​′​∖Xz′​={v},u=v.

The published GM5 tree-decomposition predicate supplies coverage of all auxiliary vertices and edges, and the running-intersection condition. The finite representation stores a root, a node kind, two child fields and a vertex bag for every node. Children precede parents in the numbering. Unused child fields are ignored. The integer layout stores the number of nodes, root and width, followed by these data in node order; firms have identities 0,…,n−10,\ldots,n-10,…,n−1, and supply-chain vertices n,…,n+m−1n,\ldots,n+m-1n,…,n+m−1.

Formalization Note Postorder numbering is a representation choice available for every finite rooted tree. Root and leaf bags have size ω′+1\omega'+1ω′+1; they are not required to be empty. This defines the decomposition data and its encoding, without asserting a construction algorithm or supplying a decomposition as an additional input to Theorem 3.

Definition code
import Mathlib
import Definitions.Def_TraceAdopt_LPReform_Model

set_option autoImplicit false

namespace TraceAdopt.LPReform.Supplement

/-- The three node types in Definition 5 (PDF p. 42). A replace node introduces `u`
and forgets `v`. The conditions on these vertices belong to `IsNiceDecomposition`. -/
inductive DPNodeKind (I : Instance)
  | leaf
  | replace (u v : Fin I.n ⊕ Fin I.m)
  | join

/-- Finite data for a rooted decomposition, numbered with children before parents.
Child fields are ignored at leaves, and `child2` is ignored at replace nodes. -/
structure NiceDecomposition (I : Instance) where
  N : ℕ
  root : Fin N
  kind : Fin N → DPNodeKind I
  child1 : Fin N → Fin N
  child2 : Fin N → Fin N
  bag : Fin N → Finset (Fin I.n ⊕ Fin I.m)

def NiceDecomposition.IsChild {I : Instance} (D : NiceDecomposition I)
    (p c : Fin D.N) : Prop :=
  match D.kind p with
  | .leaf => False
  | .replace _ _ => c = D.child1 p
  | .join => c = D.child1 p ∨ c = D.child2 p

/-- The underlying undirected decomposition graph; not the auxiliary graph itself. -/
def NiceDecomposition.tree {I : Instance} (D : NiceDecomposition I) :
    SimpleGraph (Fin D.N) where
  Adj p c := p ≠ c ∧ (D.IsChild p c ∨ D.IsChild c p)
  symm := by
    constructor
    intro p c h
    exact ⟨Ne.symm h.1, h.2.symm⟩
  loopless := by
    constructor
    intro p h
    exact h.1 rfl

/-- Definition 5: a rooted tree decomposition of `G′` with *all* bags of size `ω′+1`.
Replace nodes swap one distinct vertex; joins have two distinct children with the same bag.
The published GM5 predicate supplies vertex/edge coverage and running intersection.
The postorder numbering is a representation convention, not an extra graph assumption. -/
def IsNiceDecomposition {I : Instance} (D : NiceDecomposition I) (ω' : ℕ) : Prop :=
  RobertsonSeymour1986.GM5.IsTreeDecomposition (auxGraph I) D.tree D.bag ∧
  (∀ p c, D.IsChild p c → c.val < p.val) ∧
  (∀ p, ¬ D.IsChild p D.root) ∧
  (∀ c, c ≠ D.root → ∃! p, D.IsChild p c) ∧
  (∀ z, (D.bag z).card = ω' + 1) ∧
  (∀ z, match D.kind z with
    | .leaf => True
    | .replace u v =>
        u ≠ v ∧ D.bag z \ D.bag (D.child1 z) = {u} ∧
          D.bag (D.child1 z) \ D.bag z = {v}
    | .join =>
        D.child1 z ≠ D.child2 z ∧ D.bag z = D.bag (D.child1 z) ∧
          D.bag z = D.bag (D.child2 z))

/-- Integer identities for firm and supply-chain vertices in a stored decomposition. -/
def dpVertexCode {I : Instance} : Fin I.n ⊕ Fin I.m → ℕ :=
  Sum.elim Fin.val (fun j => I.n + j.val)

def DPNodeKind.code {I : Instance} : DPNodeKind I → List ℕ
  | .leaf => [0, 0, 0]
  | .replace u v => [1, dpVertexCode u, dpVertexCode v]
  | .join => [2, 0, 0]

/-- Computational layout: number of nodes, root, width, then per node its kind,
two child fields, bag size, and the sorted vertex identities in the bag.
This records decomposition data only; it supplies no free construction oracle. -/
def niceDecompositionInts {I : Instance} (D : NiceDecomposition I) (ω' : ℕ) : List ℕ :=
  [D.N, D.root.val, ω'] ++ (List.finRange D.N).flatMap (fun z =>
    (D.kind z).code ++ [(D.child1 z).val, (D.child2 z).val, (D.bag z).card] ++
      (((D.bag z).image dpVertexCode).sort (· ≤ ·)))

end TraceAdopt.LPReform.Supplement
Source
Blaettchen, Calmon & Hall, Traceability Technology Adoption in Supply Chain Networks, arXiv:2104.14818v4, p. 42, Definition 5; p. 43, Appendix D (boundary bags)

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me