Prove2Me
Navigate
DiscoverFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Greedy (dual-fitting) certificates give a ρ\rhoρ-approximation

Proved
PrimalDualOnline.SetCover.greedy_certificate_bound

by moutei · Sep 17, 2026 · Mathlib 0df444a (Lean v4.33.1)

approximation-algorithmscombinatoricsprimal-dualset-cover

The certificate half of Theorem 2.4 of the source. Let ρ>0\rho > 0ρ>0 and let (C,y)(C, y)(C,y) be a greedy certificate at ratio ρ\rhoρ: CCC covers every element, y≥0y \ge 0y≥0, the cover cost equals the dual value exactly, ∑s∈Ccs=∑eye\sum_{s \in C} c_s = \sum_e y_e∑s∈C​cs​=∑e​ye​, and every packing constraint holds after scaling, ∑e∈Asye≤ρ cs\sum_{e \in A_s} y_e \le \rho\, c_s∑e∈As​​ye​≤ρcs​ for every s∈Ss \in Ss∈S. Then for every fractional cover xxx,

∑s∈Ccs ≤ ρ⋅∑s∈Scsxs.\sum_{s \in C} c_s \ \le\ \rho \cdot \sum_{s \in S} c_s x_s.s∈C∑​cs​ ≤ ρ⋅s∈S∑​cs​xs​.

This is the dual-fitting pattern: the constructed yyy pays for the cover exactly but is infeasible, and becomes feasible after dividing by ρ\rhoρ. Instantiating ρ=Hn\rho = H_nρ=Hn​ recovers the source's greedy guarantee; the harmonic bound itself is already available in Mathlib and is not restated here.

Note that ρ\rhoρ is only required to be positive: values below 111 are not excluded, and they make both the certificate hypothesis and the conclusion correspondingly stronger. As with the primal-dual bound, nothing here asserts that the greedy algorithm produces such a certificate, so Theorem 2.4 is not thereby fully formalized.

Instance-bundled hypotheses. The problem's two standing assumptions - every set cost is nonnegative, and every element lies in at least one available set - are not loose hypotheses of this statement. They are fields of the SetCoverInstance argument, so the statement cannot be instantiated at data violating either.

Preamble
import Definitions.Def_PrimalDualOnline_SetCover
import Mathlib.Tactic
Formal statement
open PrimalDualOnline.SetCover

theorem PrimalDualOnline.SetCover.greedy_certificate_bound
    {E S : Type*} [Fintype E] [Fintype S] [DecidableEq E] [DecidableEq S]
    (I : SetCoverInstance E S) (C : Finset S) (y : E → ℝ) (ρ : ℝ)
    (hρ : 0 < ρ) (hcert : IsGreedyCertificate I.sets I.cost C y ρ)
    (x : S → ℝ) (hx : IsFractionalCover I.sets x) :
    coverCost I.cost C ≤ ρ * fractionalCost I.cost x := by sorry
Source
Niv Buchbinder, Designing Competitive Online Algorithms via a Primal-Dual Approach, PhD thesis, Tel Aviv University, 2008, https://www.tau.ac.il/~nivb/download/phd-thsis.pdf, Section 2.2, Theorem 2.4, pp. 11-13 (certificate-to-ratio half only)
Read-back

What the Lean code literally says, in plain math · claude-opus-5

Read-backs: certificate bounds

Throughout, the shared vocabulary is expanded as follows. A set-cover instance III on two types EEE (elements) and SSS (set indices) is a bundle of exactly four components:

  • a family A:S→Pfin(E)A : S \to \mathcal{P}_{\mathrm{fin}}(E)A:S→Pfin​(E), i.e. a finite subset As⊆EA_s \subseteq EAs​⊆E for each index sss;
  • a cost function c:S→Rc : S \to \mathbb{R}c:S→R;
  • a proof of nonnegative cost: ∀s∈S, 0≤cs\forall s \in S,\ 0 \le c_s∀s∈S, 0≤cs​;
  • a proof of coverability: ∀e∈E, ∃s∈S, e∈As\forall e \in E,\ \exists s \in S,\ e \in A_s∀e∈E, ∃s∈S, e∈As​.

Derived notions, all expanded inline in each section below:

N(e)  =  { s∈S  :  e∈As },f(e)  =  ∣N(e)∣∈N,Δ  =  sup⁡e∈Ef(e)∈N,N(e) \;=\; \{\, s \in S \;:\; e \in A_s \,\}, \qquad f(e) \;=\; |N(e)| \in \mathbb{N}, \qquad \Delta \;=\; \sup_{e \in E} f(e) \in \mathbb{N},N(e)={s∈S:e∈As​},f(e)=∣N(e)∣∈N,Δ=e∈Esup​f(e)∈N,

where N(e)N(e)N(e) is formed by filtering the whole index type SSS, f(e)f(e)f(e) is a cardinality in N\mathbb{N}N, and Δ\DeltaΔ is a supremum in N\mathbb{N}N taken over all of EEE — a supremum of an empty family, which is 000 when EEE is empty. Further:

coverCost(c,C)=∑s∈Ccs,fracCost(c,x)=∑s∈Scsxs,pack(y)=∑e∈Eye.\mathrm{coverCost}(c, \mathcal{C}) = \sum_{s \in \mathcal{C}} c_s, \qquad \mathrm{fracCost}(c, x) = \sum_{s \in S} c_s x_s, \qquad \mathrm{pack}(y) = \sum_{e \in E} y_e .coverCost(c,C)=s∈C∑​cs​,fracCost(c,x)=s∈S∑​cs​xs​,pack(y)=e∈E∑​ye​.

coverCost\mathrm{coverCost}coverCost sums only over the given finite index set C\mathcal{C}C; fracCost\mathrm{fracCost}fracCost sums over all of SSS; pack\mathrm{pack}pack sums over all of EEE.


PrimalDualOnline.SetCover.greedy_certificate_bound

Binders and instance arguments. Universally quantified over arbitrary types EEE and SSS (implicit), with four typeclass arguments: EEE finite, SSS finite, equality on EEE decidable, equality on SSS decidable; either type may be empty. Decidable equality on SSS is needed to form N(e)N(e)N(e) and the covering sums; decidable equality on EEE is required as an instance argument though no notion in the statement refers to it. Six explicit arguments, in order: a set-cover instance III (carrying AAA, ccc, the proof ∀s, 0≤cs\forall s,\ 0 \le c_s∀s, 0≤cs​, and the proof ∀e∃s, e∈As\forall e \exists s,\ e \in A_s∀e∃s, e∈As​); a finite index set C⊆S\mathcal{C} \subseteq SC⊆S; a function y:E→Ry : E \to \mathbb{R}y:E→R; a real number ρ\rhoρ; then, after the hypotheses on ρ\rhoρ and the certificate, a function x:S→Rx : S \to \mathbb{R}x:S→R.

Hypotheses. Three:

  1. 0<ρ0 < \rho0<ρ — strictly positive, so ρ=0\rho = 0ρ=0 and negative ρ\rhoρ are excluded.
  2. (C,y)(\mathcal{C}, y)(C,y) is a ρ\rhoρ-greedy certificate for (A,c)(A, c)(A,c), unfolding to a conjunction of four parts:
    • ∀e∈E, ∃s∈C, e∈As\forall e \in E,\ \exists s \in \mathcal{C},\ e \in A_s∀e∈E, ∃s∈C, e∈As​ (C\mathcal{C}C covers EEE);
    • ∀e∈E, 0≤ye\forall e \in E,\ 0 \le y_e∀e∈E, 0≤ye​;
    • ∑s∈Ccs=∑e∈Eye\displaystyle \sum_{s \in \mathcal{C}} c_s = \sum_{e \in E} y_es∈C∑​cs​=e∈E∑​ye​ — an exact equality between the cost of C\mathcal{C}C and the total of yyy over all of EEE, not an inequality;
    • ∀s∈S, ∑e∈Asye≤ρ⋅cs\displaystyle \forall s \in S,\ \sum_{e \in A_s} y_e \le \rho \cdot c_s∀s∈S, e∈As​∑​ye​≤ρ⋅cs​ — a ρ\rhoρ-relaxed packing constraint at every index of SSS, with ρ\rhoρ scaling the cost side only.
  3. xxx is a fractional cover of AAA: ∀s∈S, 0≤xs\forall s \in S,\ 0 \le x_s∀s∈S, 0≤xs​, and ∀e∈E, 1≤∑s∈N(e)xs\forall e \in E,\ 1 \le \sum_{s \in N(e)} x_s∀e∈E, 1≤∑s∈N(e)​xs​. No upper bound on any xsx_sxs​.

Conclusion.

∑s∈Ccs    ≤    ρ⋅∑s∈Scs xs.\sum_{s \in \mathcal{C}} c_s \;\;\le\;\; \rho \cdot \sum_{s \in S} c_s\, x_s .s∈C∑​cs​≤ρ⋅s∈S∑​cs​xs​.

The same ρ\rhoρ that appears in the relaxed packing constraint is the multiplier in the conclusion. The dual vector yyy does not appear in the conclusion.

1. Nonnegativity of cost; every element in some set. Both are fields of the bundled argument III, not loose hypotheses. The statement therefore cannot be instantiated at data violating either: the bundle cannot be constructed without proofs of ∀s, 0≤cs\forall s,\ 0 \le c_s∀s, 0≤cs​ and ∀e∃s, e∈As\forall e \exists s,\ e \in A_s∀e∃s, e∈As​.

2. Logical redundancy.

  • Nonnegativity of cost is derivable from hypothesis 1 together with the fourth conjunct of hypothesis 2: for each sss, 0≤∑e∈Asye≤ρ cs0 \le \sum_{e \in A_s} y_e \le \rho\, c_s0≤∑e∈As​​ye​≤ρcs​ (the left inequality because y≥0y \ge 0y≥0), and dividing by ρ>0\rho > 0ρ>0 gives 0≤cs0 \le c_s0≤cs​. This derivation uses the strict positivity of ρ\rhoρ.
  • Coverability is derivable from the covering conjunct of hypothesis 2 (a witness in C\mathcal{C}C is a witness in SSS) and independently from hypothesis 3 (an element with N(e)=∅N(e) = \emptysetN(e)=∅ would make the covering sum 000, contradicting 1≤01 \le 01≤0).
  • Strict positivity of ρ\rhoρ is not derivable from the other hypotheses: they are satisfiable with ρ=0\rho = 0ρ=0 — take c≡0c \equiv 0c≡0, y≡0y \equiv 0y≡0, and any covering C\mathcal{C}C, so that ∑s∈Ccs=0=∑eye\sum_{s \in \mathcal{C}} c_s = 0 = \sum_e y_e∑s∈C​cs​=0=∑e​ye​ and ∑e∈Asye=0≤0⋅cs\sum_{e \in A_s} y_e = 0 \le 0 \cdot c_s∑e∈As​​ye​=0≤0⋅cs​. Hence removing hypothesis 1 would strictly enlarge the set of situations the statement ranges over (all configurations with ρ≤0\rho \le 0ρ≤0, which the relaxed packing constraint together with y≥0y \ge 0y≥0 and c≥0c \ge 0c≥0 confines to ρ cs≥0\rho\,c_s \ge 0ρcs​≥0 for all sss).
  • Dropping the two bundled fields would leave the covered situations unchanged, since hypotheses 1–3 force both properties. No other hypothesis is redundant: the exact equality coverCost(c,C)=pack(y)\mathrm{coverCost}(c,\mathcal{C}) = \mathrm{pack}(y)coverCost(c,C)=pack(y), the covering conjunct, y≥0y \ge 0y≥0, the relaxed packing constraints, and both halves of hypothesis 3 are mutually independent.

3. Arbitrary or specific. The fractional cover is arbitrary: xxx is universally quantified subject only to feasibility, and the least fractional cost is never mentioned. The cover C\mathcal{C}C is arbitrary subject to the four certificate conjuncts — nothing identifies it as the output of a greedy procedure or of any procedure, and it is not claimed minimum-cost or minimal. The dual vector yyy is arbitrary subject to nonnegativity, the exact cost equality, and the ρ\rhoρ-relaxed constraints; in particular yyy is not required to be a dual packing (the unrelaxed inequality ∑e∈Asye≤cs\sum_{e \in A_s} y_e \le c_s∑e∈As​​ye​≤cs​ is not imposed unless ρ≤1\rho \le 1ρ≤1 makes it follow). ρ\rhoρ is an arbitrary positive real, tied to nothing else — not to Δ\DeltaΔ, not to a harmonic number, not to ∣E∣|E|∣E∣ or ∣S∣|S|∣S∣.

4. Cast from N\mathbb{N}N to R\mathbb{R}R. There is none in this statement: the multiplier is the real parameter ρ\rhoρ, and no cardinality, frequency, or maximum frequency appears. The multiplier consequently cannot be 000: hypothesis 1 asserts 0<ρ0 < \rho0<ρ. For contrast, were ρ\rhoρ permitted to be 000, the fourth conjunct would read ∑e∈Asye≤0\sum_{e \in A_s} y_e \le 0∑e∈As​​ye​≤0 at every sss, which with y≥0y \ge 0y≥0 forces ye=0y_e = 0ye​=0 at every covered eee — i.e. at every eee, by the covering conjunct — hence pack(y)=0\mathrm{pack}(y) = 0pack(y)=0 and, by the equality conjunct, coverCost(c,C)=0\mathrm{coverCost}(c,\mathcal{C}) = 0coverCost(c,C)=0, while the right-hand side would be 0⋅fracCost(c,x)=00 \cdot \mathrm{fracCost}(c,x) = 00⋅fracCost(c,x)=0.

5. Degenerate cases.

  • EEE empty. The covering conjunct and y≥0y \ge 0y≥0 are vacuous; every AsA_sAs​ is empty, so the relaxed constraints read 0≤ρ cs0 \le \rho\,c_s0≤ρcs​, which holds since ρ>0\rho > 0ρ>0 and c≥0c \ge 0c≥0. pack(y)=0\mathrm{pack}(y) = 0pack(y)=0, so the equality conjunct forces ∑s∈Ccs=0\sum_{s \in \mathcal{C}} c_s = 0∑s∈C​cs​=0. The covering inequalities of hypothesis 3 are vacuous, leaving only x≥0x \ge 0x≥0, so fracCost(c,x)≥0\mathrm{fracCost}(c,x) \ge 0fracCost(c,x)≥0 and the conclusion reads 0≤ρ⋅fracCost(c,x)0 \le \rho \cdot \mathrm{fracCost}(c,x)0≤ρ⋅fracCost(c,x) with a nonnegative right side. Note the left side is forced to 000 even if C\mathcal{C}C contains positive-cost indices — no such C\mathcal{C}C satisfies the hypotheses.
  • SSS empty. Then C=∅\mathcal{C} = \emptysetC=∅ and N(e)=∅N(e) = \emptysetN(e)=∅ for all eee, so hypothesis 3 is satisfiable only when EEE is empty (and the bundled coverability field forces this anyway); all sums are empty and the conclusion is 0≤ρ⋅00 \le \rho \cdot 00≤ρ⋅0.
  • C\mathcal{C}C empty. The covering conjunct is then unsatisfiable unless EEE is empty; in that case coverCost(c,∅)=0=pack(y)\mathrm{coverCost}(c,\emptyset) = 0 = \mathrm{pack}(y)coverCost(c,∅)=0=pack(y) consistently, and the conclusion reads 0≤ρ⋅fracCost(c,x)0 \le \rho \cdot \mathrm{fracCost}(c,x)0≤ρ⋅fracCost(c,x).
  • c≡0c \equiv 0c≡0. The relaxed constraints give ∑e∈Asye≤ρ⋅0=0\sum_{e \in A_s} y_e \le \rho \cdot 0 = 0∑e∈As​​ye​≤ρ⋅0=0, and with y≥0y \ge 0y≥0 this forces ye=0y_e = 0ye​=0 for every covered eee, hence (by the covering conjunct) for all eee; so pack(y)=0\mathrm{pack}(y) = 0pack(y)=0 and, by the equality conjunct, coverCost(c,C)=0\mathrm{coverCost}(c,\mathcal{C}) = 0coverCost(c,C)=0. Also fracCost(c,x)=0\mathrm{fracCost}(c,x) = 0fracCost(c,x)=0, so the conclusion reads 0≤ρ⋅0=00 \le \rho \cdot 0 = 00≤ρ⋅0=0 for every feasible xxx and every ρ>0\rho > 0ρ>0.
  • Individual zero-cost sets inside the certificate. For any sss (in C\mathcal{C}C or not) with cs=0c_s = 0cs​=0, the fourth conjunct gives ∑e∈Asye≤0\sum_{e \in A_s} y_e \le 0∑e∈As​​ye​≤0, and with y≥0y \ge 0y≥0 this forces ye=0y_e = 0ye​=0 for every e∈Ase \in A_se∈As​. Such an index contributes 000 to the left side and 000 to the right side whatever xsx_sxs​ is. Unlike the primal–dual certificate, no equality ∑e∈Asye=cs\sum_{e \in A_s} y_e = c_s∑e∈As​​ye​=cs​ is imposed on indices of C\mathcal{C}C; only the global equality coverCost(c,C)=pack(y)\mathrm{coverCost}(c,\mathcal{C}) = \mathrm{pack}(y)coverCost(c,C)=pack(y) is.
  • ρ\rhoρ small. For 0<ρ<10 < \rho < 10<ρ<1 the relaxed constraints are stronger than the unrelaxed packing constraints, and the asserted inequality is correspondingly strong: the cost of C\mathcal{C}C is bounded by a fraction of the fractional cost of every feasible xxx. As ρ→0+\rho \to 0^+ρ→0+ the hypotheses become increasingly restrictive, in the limiting direction forcing yyy to vanish on all covered elements and hence coverCost(c,C)=0\mathrm{coverCost}(c,\mathcal{C}) = 0coverCost(c,C)=0.
  • ρ\rhoρ large. Both the fourth conjunct and the conclusion weaken; no upper bound on ρ\rhoρ is imposed, and ρ\rhoρ is not required to be an integer or to relate to any structural quantity of the instance.
  • Unbounded entries of the fractional cover. Entries xsx_sxs​ may be arbitrarily large (only x≥0x \ge 0x≥0 and the covering inequalities are imposed), making the right-hand side arbitrarily large; entries may be 000, and all of SSS is summed over in fracCost\mathrm{fracCost}fracCost. Since c≥0c \ge 0c≥0 and x≥0x \ge 0x≥0, the right-hand side is always nonnegative.
  • Empty sets AsA_sAs​ are permitted; distinct indices may carry equal subsets; C\mathcal{C}C may contain indices whose removal would still leave a cover.

Not asserted. No claim that C\mathcal{C}C arises from a greedy algorithm, or from any algorithm — "greedy" names the predicate only, whose content is exactly the four conjuncts listed. No claim that C\mathcal{C}C is a minimum-cost cover, that xxx is of least fractional cost, or that yyy is a maximum packing; the least-cover-cost and least-fractional-cost notions are unused, so nothing is asserted about any optimum, nor about a harmonic-number or logarithmic approximation factor. No claim that yyy is a dual packing in the unrelaxed sense. No claim that a ρ\rhoρ-greedy certificate exists for any given instance or for any particular ρ\rhoρ, and no claim that the hypotheses are jointly satisfiable. No claim that ρ\rhoρ is the least valid multiplier, no tightness or attainment, no reverse inequality, no strict inequality, and no comparison with the maximum frequency.

Human review
  • Endorsed by Shuze Chen · Sep 17, 2026

  • Endorsed by moutei · Sep 17, 2026

    Confirmed by the mission captain (proposal self-audit).

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 paper
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me