AFTD Auto-Formalizing Theoretical Domains

water_filling_f

def

The water-filling lower bound function f(S) for a subset of jobs S ⊆ Fin n with processing times p on m machines is (1/2) * ∑_{j ∈ S} (p j)^2 + (1/2) * water_filling_g m (fun j => if j ∈ S then p j else 0).

Statement

noncomputable def water_filling_f (m : ℕ) {n : ℕ} (p : Fin n → ℝ) (S : Finset (Fin n)) : ℝ
Defined in
arXiv:2611.30731, Section 2, p. 3
Verified
29 Nov 2026
Axioms
none listed
Built on 1
  • water_filling_gThe water-filling function g(x) on m machines for a vector x : Fin n → ℝ is the infimum of the sum of squared machine loads ∑_{i ∈ Fin m}…

Read back from the Lean

The definition water_filling_f takes a natural number m, an implicit natural number n, a vector p : Fin n → ℝ, and a subset S : Finset (Fin n), and returns the real number: (1/2) * (∑ j ∈ S, (p j)²) + (1/2) * water_filling_g m x where x : Fin n → ℝ is defined by x j = p j if j ∈ S and 0 otherwise. Here, water_filling_g m x is the infimum (sInf) of the sum of squares ∑ i : Fin m, (L i)² over all vectors L : Fin m → ℝ satisfying: 1. ∑ i : Fin m, L i = ∑ j : Fin n, x j (the sum of entries of L equals the sum of entries of x); 2. For each i : Fin m, L i is at least the i-th largest entry of x (0-indexed, sorted descending, defaulting to 0 for i ≥ n).

Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.

Lean source view module on GitHub

/-- The water-filling right-hand side f(S) = (1/2) p²(S) + (1/2) g(p_S). -/
noncomputable def water_filling_f (m : ℕ) {n : ℕ} (p : Fin n → ℝ) (S : Finset (Fin n)) : ℝ := (1 / 2 : ℝ) * (∑ j ∈ S, (p j) ^ 2) +
  (1 / 2 : ℝ) * water_filling_g m (fun j => if j ∈ S then p j else 0)
See it in the graphDiscuss this resultChallenge it