Documentation

TauCeti.Combinatorics.Network.AugmentingPath

Augmenting paths and the optimality of flows #

A bounded s–t assignment f is maximum when no bounded s–t assignment has a larger value. An augmenting walk for f is a walk from s to t in the residual network of f that traverses only residual arrows of positive capacity, so the sink is positively reachable from the source for the residual capacities. This file proves the augmenting-path optimality criterion of Ford and Fulkerson: for distinct terminals the following are equivalent.

  1. f is maximum.
  2. There is no augmenting walk for f.
  3. The value of f equals the cut bound of some vertex set containing s but not t.

If an augmenting walk exists, then augmenting along an augmenting path inside it by its bottleneck increases the value. If there is none, then no residual arrow of positive capacity leaves the set of vertices positively reachable from s, so by the residual cut gap identity TauCeti.BoundedFlow.cutBound_sub_val the value equals the cut bound of that set. Weak duality turns the equality of value and cut bound into maximality. The same criteria hold for ordinary flows, with cut capacities in place of cut bounds.

These criteria hold over every linearly ordered additive commutative group of coefficients. They do not by themselves give the existence of a maximum flow, which needs a terminating choice of augmentations. One augmentation step, along an augmenting walk by its bottleneck, is the relation TauCeti.Flow.AugmentsTo; a flow between distinct terminals is maximum exactly when no step starts from it.

Main definitions #

Main results #

References #

def TauCeti.BoundedFlow.IsMaximum {V : Type u} {Q : V → V → Type v} {K : Type w} [Fintype V] [(v w : V) → Fintype (Q v w)] [AddCommGroup K] [Preorder K] {lo hi : Assignment Q K} {s t : V} (f : BoundedFlow lo hi s t) :

A bounded s–t assignment is maximum when it maximizes the value among all bounded s–t assignments for the same bounds.

Instances For
    theorem TauCeti.BoundedFlow.isMaximum_iff {V : Type u} {Q : V → V → Type v} {K : Type w} [Fintype V] [(v w : V) → Fintype (Q v w)] [AddCommGroup K] [Preorder K] {lo hi : Assignment Q K} {s t : V} {f : BoundedFlow lo hi s t} :
    f.IsMaximum ↔ ∀ (g : BoundedFlow lo hi s t), g.val ≤ f.val
    theorem TauCeti.BoundedFlow.isMaximum_of_eq {V : Type u} {Q : V → V → Type v} {K : Type w} [Fintype V] [(v w : V) → Fintype (Q v w)] [AddCommGroup K] [Preorder K] {lo hi : Assignment Q K} {s t : V} (hst : s = t) (f : BoundedFlow lo hi s t) :

    When the terminals coincide, every bounded assignment is maximum.

    def TauCeti.BoundedFlow.IsMinimum {V : Type u} {Q : V → V → Type v} {K : Type w} [Fintype V] [(v w : V) → Fintype (Q v w)] [AddCommGroup K] [Preorder K] {lo hi : Assignment Q K} {s t : V} (f : BoundedFlow lo hi s t) :

    A bounded terminal assignment is minimum when no other feasible assignment has smaller terminal value. No sign condition is imposed on that value.

    Instances For
      theorem TauCeti.BoundedFlow.isMinimum_iff {V : Type u} {Q : V → V → Type v} {K : Type w} [Fintype V] [(v w : V) → Fintype (Q v w)] [AddCommGroup K] [Preorder K] {lo hi : Assignment Q K} {s t : V} {f : BoundedFlow lo hi s t} :
      f.IsMinimum ↔ ∀ (g : BoundedFlow lo hi s t), f.val ≤ g.val
      theorem TauCeti.BoundedFlow.isMinimum_of_eq {V : Type u} {Q : V → V → Type v} {K : Type w} [Fintype V] [(v w : V) → Fintype (Q v w)] [AddCommGroup K] [Preorder K] {lo hi : Assignment Q K} {s t : V} (hst : s = t) (f : BoundedFlow lo hi s t) :

      When the terminals coincide, every bounded assignment is minimum.

      theorem TauCeti.BoundedFlow.IsMinimum.val_eq {V : Type u} {Q : V → V → Type v} {K : Type w} [Fintype V] [(v w : V) → Fintype (Q v w)] [AddCommGroup K] [PartialOrder K] {lo hi : Assignment Q K} {s t : V} {f g : BoundedFlow lo hi s t} (hf : f.IsMinimum) (hg : g.IsMinimum) :
      f.val = g.val

      All minimum bounded terminal assignments have the same value.

      theorem TauCeti.BoundedFlow.IsMaximum.val_eq {V : Type u} {Q : V → V → Type v} {K : Type w} [Fintype V] [(v w : V) → Fintype (Q v w)] [AddCommGroup K] [PartialOrder K] {lo hi : Assignment Q K} {s t : V} {f g : BoundedFlow lo hi s t} (hf : f.IsMaximum) (hg : g.IsMaximum) :
      f.val = g.val

      All maximum bounded s–t assignments have the same value.

      @[simp]
      theorem TauCeti.BoundedFlow.isMaximum_swap {V : Type u} {Q : V → V → Type v} {K : Type w} [Fintype V] [(v w : V) → Fintype (Q v w)] [AddCommGroup K] [Preorder K] [AddLeftMono K] {lo hi : Assignment Q K} {s t : V} (f : BoundedFlow lo hi s t) :

      Exchanging the terminals exchanges minimum and maximum assignments.

      @[simp]
      theorem TauCeti.BoundedFlow.isMinimum_swap {V : Type u} {Q : V → V → Type v} {K : Type w} [Fintype V] [(v w : V) → Fintype (Q v w)] [AddCommGroup K] [Preorder K] [AddLeftMono K] {lo hi : Assignment Q K} {s t : V} (f : BoundedFlow lo hi s t) :

      Exchanging the terminals exchanges maximum and minimum assignments.

      theorem TauCeti.BoundedFlow.isMinimum_of_val_eq_neg_cutBound_compl {V : Type u} {Q : V → V → Type v} {K : Type w} [Fintype V] [(v w : V) → Fintype (Q v w)] [AddCommGroup K] [Preorder K] [AddLeftMono K] {lo hi : Assignment Q K} {s t : V} [DecidableEq V] (f : BoundedFlow lo hi s t) {S : Finset V} (hs : s ∈ S) (ht : t ∉ S) (h : f.val = -cutBound lo hi Sᶜ) :

      A bounded terminal assignment attaining a lower cut bound is minimum.

      theorem TauCeti.BoundedFlow.isMaximum_of_val_eq_cutBound {V : Type u} {Q : V → V → Type v} {K : Type w} [Fintype V] [(v w : V) → Fintype (Q v w)] [AddCommGroup K] [Preorder K] [AddLeftMono K] {lo hi : Assignment Q K} {s t : V} [DecidableEq V] (f : BoundedFlow lo hi s t) {S : Finset V} (hs : s ∈ S) (ht : t ∉ S) (h : f.val = cutBound lo hi S) :

      A bounded s–t assignment whose value equals the cut bound of a vertex set containing s but not t is maximum.

      theorem TauCeti.BoundedFlow.val_eq_cutBound_of_not_positiveReachable {V : Type u} {Q : V → V → Type v} {K : Type w} [Fintype V] [(v w : V) → Fintype (Q v w)] [AddCommGroup K] [PartialOrder K] [IsOrderedAddMonoid K] {lo hi : Assignment Q K} {s t : V} [DecidableEq V] (f : BoundedFlow lo hi s t) (h : ¬PositiveReachable (residualCapacity lo hi f.toFun) s t) :

      If a bounded s–t assignment has no augmenting walk, then its value equals the cut bound of the set of vertices positively reachable from the source for its residual capacities.

      theorem TauCeti.BoundedFlow.exists_val_lt_of_positiveReachable {V : Type u} {Q : V → V → Type v} {K : Type w} [Fintype V] [(v w : V) → Fintype (Q v w)] [AddCommGroup K] [LinearOrder K] [IsOrderedAddMonoid K] {lo hi : Assignment Q K} {s t : V} (hst : s ≠ t) (f : BoundedFlow lo hi s t) (h : PositiveReachable (residualCapacity lo hi f.toFun) s t) :
      ∃ (g : BoundedFlow lo hi s t), f.val < g.val

      Augmentation. If the sink of a bounded s–t assignment between distinct terminals is positively reachable from the source for its residual capacities, then augmenting along an augmenting path by its bottleneck gives a bounded s–t assignment of larger value.

      theorem TauCeti.BoundedFlow.IsMaximum.not_positiveReachable {V : Type u} {Q : V → V → Type v} {K : Type w} [Fintype V] [(v w : V) → Fintype (Q v w)] [AddCommGroup K] [LinearOrder K] [IsOrderedAddMonoid K] {lo hi : Assignment Q K} {s t : V} (hst : s ≠ t) {f : BoundedFlow lo hi s t} (hf : f.IsMaximum) :

      A maximum bounded s–t assignment between distinct terminals has no augmenting walk.

      theorem TauCeti.BoundedFlow.tfae_isMaximum {V : Type u} {Q : V → V → Type v} {K : Type w} [Fintype V] [(v w : V) → Fintype (Q v w)] [AddCommGroup K] [LinearOrder K] [IsOrderedAddMonoid K] {lo hi : Assignment Q K} {s t : V} [DecidableEq V] (hst : s ≠ t) (f : BoundedFlow lo hi s t) :
      [f.IsMaximum, ¬PositiveReachable (residualCapacity lo hi f.toFun) s t, ∃ (S : Finset V), s ∈ S ∧ t ∉ S ∧ f.val = cutBound lo hi S].TFAE

      Augmenting-path optimality criterion. For a bounded s–t assignment f between distinct terminals, the following are equivalent: f is maximum; there is no augmenting walk, that is, the sink is not positively reachable from the source for the residual capacities of f; and the value of f equals the cut bound of some vertex set containing s but not t.

      theorem TauCeti.BoundedFlow.isMaximum_iff_not_positiveReachable {V : Type u} {Q : V → V → Type v} {K : Type w} [Fintype V] [(v w : V) → Fintype (Q v w)] [AddCommGroup K] [LinearOrder K] [IsOrderedAddMonoid K] {lo hi : Assignment Q K} {s t : V} (hst : s ≠ t) (f : BoundedFlow lo hi s t) :

      A bounded s–t assignment between distinct terminals is maximum exactly when it has no augmenting walk.

      theorem TauCeti.BoundedFlow.IsMaximum.exists_val_eq_cutBound {V : Type u} {Q : V → V → Type v} {K : Type w} [Fintype V] [(v w : V) → Fintype (Q v w)] [AddCommGroup K] [LinearOrder K] [IsOrderedAddMonoid K] {lo hi : Assignment Q K} {s t : V} [DecidableEq V] (hst : s ≠ t) {f : BoundedFlow lo hi s t} (hf : f.IsMaximum) :
      ∃ (S : Finset V), s ∈ S ∧ t ∉ S ∧ f.val = cutBound lo hi S

      A maximum bounded s–t assignment between distinct terminals attains the cut bound of some vertex set containing s but not t.

      theorem TauCeti.BoundedFlow.isMinimum_iff_not_positiveReachable {V : Type u} {Q : V → V → Type v} {K : Type w} [Fintype V] [(v w : V) → Fintype (Q v w)] [AddCommGroup K] [LinearOrder K] [IsOrderedAddMonoid K] {lo hi : Assignment Q K} {s t : V} (hst : s ≠ t) (f : BoundedFlow lo hi s t) :

      A bounded terminal assignment is minimum exactly when its residual network has no positive path from the sink to the source.

      theorem TauCeti.BoundedFlow.IsMinimum.exists_val_eq_neg_cutBound_compl {V : Type u} {Q : V → V → Type v} {K : Type w} [Fintype V] [(v w : V) → Fintype (Q v w)] [AddCommGroup K] [LinearOrder K] [IsOrderedAddMonoid K] {lo hi : Assignment Q K} {s t : V} [DecidableEq V] (hst : s ≠ t) {f : BoundedFlow lo hi s t} (hf : f.IsMinimum) :
      ∃ (S : Finset V), s ∈ S ∧ t ∉ S ∧ f.val = -cutBound lo hi Sᶜ

      A minimum bounded terminal assignment attains a lower cut bound.

      Ordinary flows #

      def TauCeti.Flow.IsMaximum {V : Type u} {Q : V → V → Type v} {K : Type w} [Fintype V] [(v w : V) → Fintype (Q v w)] [AddCommGroup K] [Preorder K] {cap : Assignment Q K} {s t : V} (f : Flow cap s t) :

      An ordinary s–t flow is maximum when it maximizes the value among all ordinary s–t flows for the same capacities.

      Instances For
        theorem TauCeti.Flow.isMaximum_iff {V : Type u} {Q : V → V → Type v} {K : Type w} [Fintype V] [(v w : V) → Fintype (Q v w)] [AddCommGroup K] [Preorder K] {cap : Assignment Q K} {s t : V} {f : Flow cap s t} :
        f.IsMaximum ↔ ∀ (g : Flow cap s t), g.val ≤ f.val
        @[simp]
        theorem TauCeti.Flow.isMaximum_toBoundedFlow {V : Type u} {Q : V → V → Type v} {K : Type w} [Fintype V] [(v w : V) → Fintype (Q v w)] [AddCommGroup K] [LinearOrder K] {cap : Assignment Q K} {s t : V} (f : Flow cap s t) :

        An ordinary flow is maximum among ordinary flows exactly when it is maximum among all bounded assignments with zero lower bounds: a bounded assignment of larger value has positive value, so it is itself an ordinary flow.

        theorem TauCeti.Flow.tfae_isMaximum {V : Type u} {Q : V → V → Type v} {K : Type w} [Fintype V] [(v w : V) → Fintype (Q v w)] [AddCommGroup K] [LinearOrder K] [IsOrderedAddMonoid K] {cap : Assignment Q K} {s t : V} [DecidableEq V] (hst : s ≠ t) (f : Flow cap s t) :
        [f.IsMaximum, ¬PositiveReachable (residualCapacity 0 cap f.toFun) s t, ∃ (S : Finset V), s ∈ S ∧ t ∉ S ∧ f.val = arrowSum cap S Sᶜ].TFAE

        Augmenting-path optimality criterion for ordinary flows. For an ordinary s–t flow f between distinct terminals, the following are equivalent: f is maximum; there is no augmenting walk for f; and the value of f equals the capacity of the arrows leaving some vertex set containing s but not t.

        theorem TauCeti.Flow.isMaximum_iff_not_positiveReachable {V : Type u} {Q : V → V → Type v} {K : Type w} [Fintype V] [(v w : V) → Fintype (Q v w)] [AddCommGroup K] [LinearOrder K] [IsOrderedAddMonoid K] {cap : Assignment Q K} {s t : V} (hst : s ≠ t) (f : Flow cap s t) :

        An ordinary s–t flow between distinct terminals is maximum exactly when it has no augmenting walk.

        theorem TauCeti.Flow.IsMaximum.exists_val_eq_arrowSum {V : Type u} {Q : V → V → Type v} {K : Type w} [Fintype V] [(v w : V) → Fintype (Q v w)] [AddCommGroup K] [LinearOrder K] [IsOrderedAddMonoid K] {cap : Assignment Q K} {s t : V} [DecidableEq V] (hst : s ≠ t) {f : Flow cap s t} (hf : f.IsMaximum) :
        ∃ (S : Finset V), s ∈ S ∧ t ∉ S ∧ f.val = arrowSum cap S Sᶜ

        A maximum ordinary s–t flow between distinct terminals saturates some cut: its value equals the capacity of the arrows leaving some vertex set containing s but not t.

        Augmentation steps #

        def TauCeti.Flow.AugmentsTo {V : Type u} {Q : V → V → Type v} {K : Type w} [Fintype V] [(v w : V) → Fintype (Q v w)] [AddCommGroup K] [LinearOrder K] [IsOrderedAddMonoid K] {cap : Assignment Q K} {s t : V} (f g : Flow cap s t) :

        f.AugmentsTo g when the flow g arises from f by one augmentation step: augmentation by its bottleneck along an augmenting walk of f, a residual walk from s to t that traverses at least one arrow, traverses no arrow twice, and has positive residual capacity on every arrow.

        Instances For
          theorem TauCeti.Flow.augmentsTo_iff {V : Type u} {Q : V → V → Type v} {K : Type w} [Fintype V] [(v w : V) → Fintype (Q v w)] [AddCommGroup K] [LinearOrder K] [IsOrderedAddMonoid K] {cap : Assignment Q K} {s t : V} {f g : Flow cap s t} :
          f.AugmentsTo g ↔ ∃ (p : ArrowWalk (ResidualHom Q) s t) (hp : p.arrows.Nodup) (hne : p.arrows ≠ []), (∀ a ∈ p.arrows, 0 < residualCapacity 0 cap f.toFun a.snd.snd) ∧ f.augmentBottleneck p hp hne = g
          theorem TauCeti.Flow.augmentsTo_augmentBottleneck {V : Type u} {Q : V → V → Type v} {K : Type w} [Fintype V] [(v w : V) → Fintype (Q v w)] [AddCommGroup K] [LinearOrder K] [IsOrderedAddMonoid K] {cap : Assignment Q K} {s t : V} (f : Flow cap s t) {p : ArrowWalk (ResidualHom Q) s t} (hp : p.arrows.Nodup) (hne : p.arrows ≠ []) (hpos : ∀ a ∈ p.arrows, 0 < residualCapacity 0 cap f.toFun a.snd.snd) :

          Augmentation by the bottleneck along an augmenting walk is an augmentation step.

          theorem TauCeti.Flow.AugmentsTo.val_lt {V : Type u} {Q : V → V → Type v} {K : Type w} [Fintype V] [(v w : V) → Fintype (Q v w)] [AddCommGroup K] [LinearOrder K] [IsOrderedAddMonoid K] {cap : Assignment Q K} {s t : V} (hst : s ≠ t) {f g : Flow cap s t} (h : f.AugmentsTo g) :
          f.val < g.val

          An augmentation step between distinct terminals strictly increases the value.

          theorem TauCeti.Flow.AugmentsTo.mem {V : Type u} {Q : V → V → Type v} {K : Type w} [Fintype V] [(v w : V) → Fintype (Q v w)] [AddCommGroup K] [LinearOrder K] [IsOrderedAddMonoid K] {cap : Assignment Q K} {s t : V} {H : AddSubgroup K} (hcap : ∀ ⦃v w : V⦄ (e : Q v w), cap e ∈ H) {f g : Flow cap s t} (h : f.AugmentsTo g) (hf : ∀ ⦃v w : V⦄ (e : Q v w), f.toFun e ∈ H) {v w : V} (e : Q v w) :
          g.toFun e ∈ H

          An augmentation step preserves values in an additive subgroup that contains the capacities.

          theorem TauCeti.Flow.isMaximum_iff_forall_not_augmentsTo {V : Type u} {Q : V → V → Type v} {K : Type w} [Fintype V] [(v w : V) → Fintype (Q v w)] [AddCommGroup K] [LinearOrder K] [IsOrderedAddMonoid K] {cap : Assignment Q K} {s t : V} (hst : s ≠ t) (f : Flow cap s t) :
          f.IsMaximum ↔ ∀ (g : Flow cap s t), ¬f.AugmentsTo g

          An ordinary flow between distinct terminals is maximum exactly when no augmentation step starts from it.