Theorems 3.11 and 3.4 — the generic push-relabel algorithm stops within basic operations with a maximum flow
ProvedGoldbergTarjan.Generic.generic_push_relabel_correct_and_boundedLet be a flow network with vertices and edges satisfying the standing assumption , and let be any execution of the generic push-relabel algorithm: it starts from the preflow saturating the source edges with the simple labeling (, otherwise), and each step applies one applicable push or relabel, in any order. Then
- the number of basic operations is bounded:
- if no basic operation is applicable in the final state , then is a maximum flow.
Part 1 is Theorem 3.11 ("The generic algorithm terminates after basic operations") with the explicit constants of Lemmas 3.8, 3.9 and 3.10, from which the paper says it is immediate: every basic operation is a relabeling, a saturating push or a nonsaturating push. Since every run has length at most this bound, the algorithm cannot run forever, whatever order of operations is chosen. Part 2 is Theorem 3.4, the correctness of the algorithm.
Formalization Note. Theorem 3.4 assumes that all labels are finite at termination; that hypothesis is dropped here because Lemma 3.7 ( throughout) discharges it. "Terminates" is the negation of the loop guard of Fig. 2 (no push and no relabel applies), not "no active vertex". The bound is in the paper, explicit from Lemmas 3.8–3.10.
import Mathlib import Definitions.Def_GoldbergTarjan_Generic_Run
namespace GoldbergTarjan.Generic
/-- Theorem 3.11 with Theorem 3.4 (Goldberg–Tarjan 1988, pp. 928 and 926). Under the standing
assumption `m ≥ n - 1` (p. 923), every execution of the generic push-relabel algorithm (started
with the simple labeling, basic operations applied in any order) performs at most
`(2n - 1)(n - 2) + 2nm + 4n²m` basic operations — `O(n²m)` in the paper, explicit from
Lemmas 3.8–3.10 — and, if no basic operation applies at its end, the final preflow is a
maximum flow. -/
theorem generic_push_relabel_correct_and_bounded {V : Type} [Fintype V] [DecidableEq V]
(N : Network V) (hm : Fintype.card V - 1 ≤ N.numEdges)
(σ : ℕ → State V) (K : ℕ) (hrun : IsRun N σ K) :
K ≤ (2 * Fintype.card V - 1) * (Fintype.card V - 2) +
2 * Fintype.card V * N.numEdges + 4 * Fintype.card V ^ 2 * N.numEdges ∧
(NoBasicOpApplicable N (σ K) → IsMaxFlow N (σ K).1) := by sorry
end GoldbergTarjan.Generic
Read-back
What the Lean code literally says, in plain math · claude-opus-5-5
Let be any finite type of vertices with decidable equality, and write for its number of elements. The statement also takes the following inputs:
- is a value of type
Network V, and denotes the natural numberN.numEdgesattached to it. BothNetworkandnumEdgesare defined in the imported bundleDefinitions.Def_GoldbergTarjan_Generic_Run. That code is not shown here, so this read-back cannot say how stores capacities, sources, sinks or edges, or how is counted. - is an infinite sequence of values of type
State V, indexed by the natural numbers. This type is also defined in the imported bundle. For each , denotes the first component of (the code's(σ k).1), which is passed toIsMaxFlow. - is a natural number.
There are two hypotheses:
- Size condition. In natural-number arithmetic,
where is truncated subtraction ().
2. Run condition. holds. IsRun is a predicate from the imported bundle on the network, the sequence and the number . Its unfolding is not visible here. In particular, this read-back cannot confirm what it requires of , of consecutive states for , or of states after index .
Under these hypotheses, the statement asserts both of the following.
(a) Bound on . In natural-number arithmetic,
(b) Conditional maximality. Suppose holds for the state at index . Then holds. Both predicates come from the imported bundle, and their exact content is not visible here. Part (b) is only an implication: it does not claim that ever holds.
The code's documentation comment describes the declaration as Goldberg–Tarjan Theorems 3.11 and 3.4 about the generic push-relabel algorithm, started from the "simple labeling". Nothing in the statement itself says any of this. Any such meaning has to come from the definitions of IsRun, NoBasicOpApplicable and IsMaxFlow. The bound in (a) is stated for the given only, and the statement never refers to how many "operations" are performed.
Degenerate cases. All arithmetic is in , so both subtractions are truncated at .
- (empty vertex type). The size condition reads and always holds. The bound is , so (a) forces .
- . The size condition again always holds. Since , the bound is . If also , then is forced.
- . The size condition requires . Since , the bound is .
- . Both subtractions are exact: and .
- When is the size condition vacuous? It is vacuous exactly when . It can never be impossible to satisfy for some as long as
numEdgescan be large enough, but for a particular with it fails and the theorem says nothing. - Unsatisfiable run condition. If can never hold for some inputs (for example, if the bundle makes it unsatisfiable for certain networks), the theorem is vacuously true for them.
- Part (b) can be vacuous. It says nothing when fails.
- Bundle definitions. Any division, subtraction or other total-function default values used inside
Network,numEdges,IsRun,NoBasicOpApplicableorIsMaxFlowcannot be checked from the code shown.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.