Documentation

CslibFrontier.Foundations.Combinatorics.PessimisticEstimator

Greedy rounds and pessimistic estimators #

The method of conditional expectations makes a sequence of binary choices one round at a time. In each round it computes an estimate of the final cost after each of the two branches and takes the branch with the smaller estimate (Cslib.PessimisticEstimator.greedyStep; ties go to true) Williamson and Shmoys, Section 5.2. If the smaller branch estimate is always at most the current estimate, the estimate never increases (Cslib.PessimisticEstimator.estimate_greedyStep_le). This is all that is used of the estimate: it need not be an exact conditional expectation, only a pessimistic estimator [Rag88] Alon and Spencer, Chapter 16. The usual way to verify the premise is averaging: if the two branch estimates sum to at most twice the current estimate, the smaller one is at most the current estimate (Cslib.PessimisticEstimator.greedy_spec_of_add_le).

The premise is usually needed only on the states that the process can reach. The general statement (Cslib.PessimisticEstimator.greedy_spec) assumes an invariant indexed by the rounds still to come, which passes from a round to the rest along both branches, and asserts the premise only where the invariant holds. It also returns the invariant for the final state, which is how clients identify the final estimate with the cost of the constructed object.

Estimates take values in any linear order; the averaging form needs a linearly ordered cancellative additive monoid, such as ℕ, ℚ or ℝ. Maximizing an estimate is minimizing its negation.

Main definitions #

Main results #

References #

def Cslib.PessimisticEstimator.greedyStep {S : Type u_1} {R : Type u_2} {M : Type u_3} [LE M] [DecidableRel fun (x1 x2 : M) => x1 ≤ x2] (branch : R → Bool → S → S) (Φ : S → M) (s : S) (r : R) :
S

One greedy round r from state s: take the branch true unless the branch false has a strictly smaller estimate.

def Cslib.PessimisticEstimator.greedy {S : Type u_1} {R : Type u_2} {M : Type u_3} [LE M] [DecidableRel fun (x1 x2 : M) => x1 ≤ x2] (branch : R → Bool → S → S) (Φ : S → M) (rounds : List R) (s : S) :
S

The greedy rounds of a list, in order.

theorem Cslib.PessimisticEstimator.greedyStep_eq_or {S : Type u_1} {R : Type u_2} {M : Type u_3} [LinearOrder M] (branch : R → Bool → S → S) (Φ : S → M) (s : S) (r : R) :
greedyStep branch Φ s r = branch r true s ∨ greedyStep branch Φ s r = branch r false s

A greedy round takes one of the two branches.

theorem Cslib.PessimisticEstimator.estimate_greedyStep {S : Type u_1} {R : Type u_2} {M : Type u_3} [LinearOrder M] (branch : R → Bool → S → S) (Φ : S → M) (s : S) (r : R) :
Φ (greedyStep branch Φ s r) = min (Φ (branch r true s)) (Φ (branch r false s))

A greedy round attains the smaller of the two branch estimates.

theorem Cslib.PessimisticEstimator.estimate_greedyStep_le {S : Type u_1} {R : Type u_2} {M : Type u_3} [LinearOrder M] (branch : R → Bool → S → S) (Φ : S → M) {s : S} {r : R} (h : min (Φ (branch r true s)) (Φ (branch r false s)) ≤ Φ s) :
Φ (greedyStep branch Φ s r) ≤ Φ s

A greedy round whose smaller branch estimate is at most the current estimate does not increase the estimate.

theorem Cslib.PessimisticEstimator.greedy_spec {S : Type u_1} {R : Type u_2} {M : Type u_3} [LinearOrder M] (branch : R → Bool → S → S) (Φ : S → M) (Inv : List R → S → Prop) (hbranch : ∀ (r : R) (rs : List R) (s : S) (b : Bool), Inv (r :: rs) s → Inv rs (branch r b s)) (hmin : ∀ (r : R) (rs : List R) (s : S), Inv (r :: rs) s → min (Φ (branch r true s)) (Φ (branch r false s)) ≤ Φ s) (rounds : List R) (s : S) :
Inv rounds s → Inv [] (greedy branch Φ rounds s) ∧ Φ (greedy branch Φ rounds s) ≤ Φ s

The method of conditional expectations, with a pessimistic estimator. Suppose an invariant Inv, indexed by the rounds still to come, holds initially and passes from each round to the remaining ones along both branches, and that wherever it holds the smaller of the two branch estimates of the next round is at most the current estimate. Then the greedy rounds end in a state satisfying the invariant for no remaining rounds, with an estimate at most the initial one.

theorem Cslib.PessimisticEstimator.estimate_greedy_le {S : Type u_1} {R : Type u_2} {M : Type u_3} [LinearOrder M] (branch : R → Bool → S → S) (Φ : S → M) (Inv : S → Prop) (hbranch : ∀ (r : R) (s : S) (b : Bool), Inv s → Inv (branch r b s)) (hmin : ∀ (r : R) (s : S), Inv s → min (Φ (branch r true s)) (Φ (branch r false s)) ≤ Φ s) (rounds : List R) {s : S} (hs : Inv s) :
Φ (greedy branch Φ rounds s) ≤ Φ s

greedy_spec for an invariant that does not depend on the remaining rounds.

theorem Cslib.PessimisticEstimator.greedy_spec_of_add_le {S : Type u_1} {R : Type u_2} {M : Type u_3} [LinearOrder M] (branch : R → Bool → S → S) (Φ : S → M) [AddCommMonoid M] [IsOrderedCancelAddMonoid M] (Inv : List R → S → Prop) (hbranch : ∀ (r : R) (rs : List R) (s : S) (b : Bool), Inv (r :: rs) s → Inv rs (branch r b s)) (havg : ∀ (r : R) (rs : List R) (s : S), Inv (r :: rs) s → Φ (branch r true s) + Φ (branch r false s) ≤ Φ s + Φ s) (rounds : List R) (s : S) (hs : Inv rounds s) :
Inv [] (greedy branch Φ rounds s) ∧ Φ (greedy branch Φ rounds s) ≤ Φ s

Averaging: greedy_spec when the two branch estimates sum to at most twice the current estimate, as when the estimate is a conditional expectation over a fair coin.