Theorem 1 — R[A_k](n) ≤ (k + 1)/k and lim_{n→∞} R[A_k](n) = (k + 1)/k
ProvedJohnsonApprox.SubsetSum.subsetSum_Ak_ratioThis is Theorem 1 of Johnson (1974) for the SUBSET-SUM algorithms . The paper states:
THEOREM 1. For k ≥ 1 and n > 0, RA_k ≤ (k + 1)/k, lim_{n→∞} RA_k = (k + 1)/k.
Here, for a maximization problem, the performance ratio of an algorithm on input is , where is the optimal measure and is the smallest measure of an output choosable by on ; is the maximum of over inputs of size at most .
Fix . The theorem is formalized as the following two statements.
- Upper bound. For every SUBSET-SUM input and every set choosable by on it,
- Limit. For every rational there are an input and a set choosable by on it with and
i.e. .
The algorithms run in time polynomial in the input for each fixed and have ratio tending to as grows, so SUBSET-SUM has, for every , a polynomial-time algorithm with worst-case ratio at most .
Formalization Note The paper's is a maximum over inputs of size at most "in some standard notation", which is never fixed; the formalization is size-free. Part 1 for all inputs is equivalent to for all (the worst choosable output is one of the choosable outputs). Given part 1, and since is nondecreasing in and every input has some finite size, "" is equivalent to part 2: the supremum of the ratio over all inputs equals . Part 2 exhibits one choosable output with a large ratio; the worst choosable output of the same input has a ratio at least as large, so this is the same claim as for the paper's . Ratios are written multiplicatively, never as a division, so an input with cannot satisfy a bound vacuously; part 2 requires . The value is not claimed to be attained. Sizes and are rationals, as in the paper; the witness inputs of part 2 have ground sets in , which loses no generality since every finite set can be relabelled.
import Mathlib import Definitions.Def_JohnsonApprox_SubsetSum_Problem import Definitions.Def_JohnsonApprox_SubsetSum_Ak
namespace JohnsonApprox.SubsetSum
theorem subsetSum_Ak_ratio (k : ℕ) (hk : 1 ≤ k) :
(∀ (α : Type) [DecidableEq α] (u : Input α) (T₁ : Finset α), Choosable k u T₁ →
(k : ℚ) * opt u ≤ ((k : ℚ) + 1) * measure u T₁) ∧
(∀ δ : ℚ, 0 < δ → ∃ (u : Input ℕ) (T₁ : Finset ℕ), Choosable k u T₁ ∧
0 < measure u T₁ ∧ (((k : ℚ) + 1) / k - δ) * measure u T₁ < opt u) := by sorry
end JohnsonApprox.SubsetSum
Read-back
What the Lean code literally says, in plain math · claude-opus-5-5
Throughout, is a natural number with . The statement uses four notions from the imported definition files Def_JohnsonApprox_SubsetSum_Problem and Def_JohnsonApprox_SubsetSum_Ak. Their code is not shown here, so this read-back cannot unfold them:
- is a type of "inputs" built over a ground type .
- is a yes/no property of the number , an input and a finite subset .
- is a number attached to an input .
- is a number attached to an input and a finite set .
In the statement, and are multiplied by rational numbers, and all comparisons are between rational numbers. So both are either rational-valued or converted to rationals automatically. The statement does not say what "choosable" means or how relates to any algorithm. It only requires that the predicate holds.
The theorem asserts that, for every such , the following two claims hold together.
(1) Upper bound. Take any ground type (in the lowest universe) whose elements can be decidably tested for equality. Take any input and any finite set with . Then
This is stated in multiplied form, with no division. When it is equivalent to
Nothing in claim (1) assumes that is positive.
(2) Near-tightness, witnessed over . For every rational there exist:
- an input , with the natural numbers as ground type, and
- a finite set ,
such that holds, , and
Because , this is equivalent to
The witnesses and may be different for each . The inequality is strict. Nothing requires a single instance to reach the ratio exactly.
Degenerate cases. Since , the division never divides by zero. For the constant is . Claim (1) covers every admissible ground type , including the empty type and one-element types, and the empty set . Whether any input exists over such types, and whether can hold for them, depends on the unshown definitions. If can never hold for some , claim (1) is vacuous there. If for a choosable pair, claim (1) forces , that is, . If is negative, the inequality in (1) still reads literally as written, with no ratio interpretation. Claim (2) guarantees that for each the predicate holds for at least one pair over with positive measure, so the theorem as a whole is not vacuous in that sense. But claim (2) says nothing about ground types other than . When , the left-hand coefficient in (2) is zero or negative. Claim (2) then only asks for a choosable pair with positive measure and greater than a number that is zero or negative. Only small makes claim (2) demanding. Any default values that or take on degenerate inputs, such as an empty collection or an empty maximum, are fixed by the unshown definitions and are not constrained here beyond the two inequalities above.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.