Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Single-call RAM core of Baker's shifting technique

Proved
WilliamsonShmoys.baker_union_single_call_ram

by もち · Nov 24, 2026 · Mathlib 0df444a (Lean v4.33.1)

approximation-algorithmsram-model

This is the single-call version of the RAM core of Baker's shifting technique.

Let solver be a unit-cost RAM program that solves maximum weight independent set exactly on every instance whose graph has tree-width at most its parameter www, within C02d0w(n+1)2C_0 2^{d_0 w}(n+1)^2C0​2d0​w(n+1)2 operations, as in baker_masked_best_of_runs_ram.

Then there is one RAM program and constants C,d>0C,d>0C,d>0 with the following property. For every k≥1k\ge1k≥1 and every instance (n,k,edge,weight)(n,k,\text{edge},\text{weight})(n,k,edge,weight) with graph GGG and Baker levels LLL, let UUU be the disjoint union of the kkk masked graphs. Its vertex set is {0,…,k−1}×V(G)\{0,\dots,k-1\}\times V(G){0,…,k−1}×V(G), and (j,a)(j,a)(j,a) is adjacent to (j,b)(j,b)(j,b) when ab∈E(G)ab\in E(G)ab∈E(G) and L(a),L(b)≢j(modk)L(a),L(b)\not\equiv j \pmod kL(a),L(b)≡j(modk). Assume tw⁡(U)≤3k\operatorname{tw}(U)\le 3ktw(U)≤3k. Then the program halts within C2dk(n+1)2C2^{dk}(n+1)^2C2dk(n+1)2 operations, outputs an independent set AAA of GGG, and for every j<kj<kj<k and every independent set SSS of the jjj-th masked graph,

∑i∈S,  L(i)≢jwi  ≤  ∑i∈Awi.\sum_{i\in S,\;L(i)\not\equiv j} w_i\;\le\;\sum_{i\in A} w_i.i∈S,L(i)≡j∑​wi​≤i∈A∑​wi​.

The intended implementation builds the single instance UUU on knknkn vertices, with level-jjj weights set to 000 in copy jjj, and runs solver once from a clean memory. Because UUU is a disjoint union, the optimal set it returns is optimal in every copy, so the best copy can be read off. One call suffices: the solver specification only covers runs from a fresh input layout, so a second call could not start from clean memory.

Formalization Note. UUU is SimpleGraph.fromRel on Fin k × Fin n with relation x.1=y.1∧G.Adj x.2 y.2∧L(x.2) mod k≠x.1∧L(y.2) mod k≠x.1x.1=y.1\wedge G.\mathrm{Adj}\,x.2\,y.2\wedge L(x.2)\bmod k\ne x.1\wedge L(y.2)\bmod k\ne x.1x.1=y.1∧G.Adjx.2y.2∧L(x.2)modk=x.1∧L(y.2)modk=x.1.

Preamble
import Definitions.Def_WilliamsonShmoys_PlanarIndependentSetRAM
import Definitions.Def_WilliamsonShmoys_BakerLevel
import Definitions.Def_RobertsonSeymour1986_GM5_TreewidthLE

set_option autoImplicit false
open scoped BigOperators
Formal statement
theorem WilliamsonShmoys.baker_union_single_call_ram
    (solver : List WilliamsonShmoys.PlanarRAMInstruction) (C₀ d₀ : ℕ) (hC₀ : 0 < C₀) (hd₀ : 0 < d₀)
    (hsolver : ∀ (w n : ℕ) (edge : Fin n → Fin n → Bool) (weight : Fin n → ℝ),
      let G := SimpleGraph.fromRel (fun u v => edge u v = true)
      RobertsonSeymour1986.GM5.TreewidthLE G w →
      ∃ t : ℕ, t + 1 ≤ C₀ * 2 ^ (d₀ * w) * (n + 1) ^ 2 ∧
        let result := WilliamsonShmoys.planarRAMRun solver (WilliamsonShmoys.planarRAMInput n w edge weight) t
        solver[result.pc]? = some WilliamsonShmoys.PlanarRAMInstruction.halt ∧
        (∀ i : Fin n, result.natMem (2 + n * n + i.val) ≤ 1) ∧
        G.IsIndepSet (WilliamsonShmoys.planarRAMOutput n result : Set (Fin n)) ∧
        ∀ S : Finset (Fin n), G.IsIndepSet (S : Set (Fin n)) →
          ∑ i ∈ S, weight i ≤ ∑ i ∈ WilliamsonShmoys.planarRAMOutput n result, weight i) :
    ∃ (program : List WilliamsonShmoys.PlanarRAMInstruction) (C d : ℕ),
      0 < C ∧ 0 < d ∧
      ∀ (k : ℕ), 0 < k →
      ∀ (n : ℕ) (edge : Fin n → Fin n → Bool) (weight : Fin n → ℝ),
        let G := SimpleGraph.fromRel (fun u v => edge u v = true)
        RobertsonSeymour1986.GM5.TreewidthLE
          (SimpleGraph.fromRel (fun (x y : Fin k × Fin n) => x.1 = y.1 ∧
            G.Adj x.2 y.2 ∧ WilliamsonShmoys.bakerLevel G x.2 % k ≠ x.1.val ∧
              WilliamsonShmoys.bakerLevel G y.2 % k ≠ x.1.val))
          (3 * k) →
        ∃ t : ℕ, t + 1 ≤ C * 2 ^ (d * k) * (n + 1) ^ 2 ∧
          let result := WilliamsonShmoys.planarRAMRun program (WilliamsonShmoys.planarRAMInput n k edge weight) t
          program[result.pc]? = some WilliamsonShmoys.PlanarRAMInstruction.halt ∧
          (∀ i : Fin n, result.natMem (2 + n * n + i.val) ≤ 1) ∧
          G.IsIndepSet (WilliamsonShmoys.planarRAMOutput n result : Set (Fin n)) ∧
          ∀ j < k, ∀ S : Finset (Fin n),
            (SimpleGraph.fromRel (fun u v => G.Adj u v ∧
              WilliamsonShmoys.bakerLevel G u % k ≠ j ∧ WilliamsonShmoys.bakerLevel G v % k ≠ j)).IsIndepSet
              (S : Set (Fin n)) →
            ∑ i ∈ S, (if WilliamsonShmoys.bakerLevel G i % k ≠ j then weight i else 0) ≤
              ∑ i ∈ WilliamsonShmoys.planarRAMOutput n result, weight i := by sorry
Source
Williamson–Shmoys, The Design of Approximation Algorithms, Sect. 10.2, pp. 270–271 (proof of Theorem 10.11)

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