§4.1, p. 560 — expected cost of a lock wait:
ProvedNonuniformCompetitive.SpinBlock.expected_wait_costLet be the context-switch cost, and let the blocking time of an algorithm be random with law , a probability measure on . Write for the probability that the algorithm blocks before time . For a lock released at time , the expected cost of the wait is
where is the probability that the process is still spinning at time . The first term is the expected cost of blocking and the second the expected cost of spinning.
The identity reduces the competitive analysis of a randomized spin-block algorithm on a single lock wait to a one-dimensional computation with its distribution function; the paper applies it to its particular distribution .
Formalization Note The identity is stated for every blocking law , not only the paper's , exactly as the paper's explanation of its two terms applies. Both sides are in ; the integral is a lower Lebesgue integral over , so no integrability hypothesis is needed. The convention that a tie costs is what makes (strict) and the right sets.
import Mathlib import Definitions.Def_NonuniformCompetitive_SpinBlock_Model open scoped NNReal ENNReal open MeasureTheory
namespace NonuniformCompetitive.SpinBlock
/-- §4.1, p. 560, the expected-cost display: if the blocking time `b` of an algorithm has law `ν`
(a probability measure on `[0, ∞]`) and the lock is released at time `τ`, the expected cost is
`π(τ) · C + ∫₀^τ (1 − π(t)) dt`, where `π(τ) = ν{b < τ}` is the probability of blocking before `τ`
and `1 − π(t) = ν{b ≥ t}` is the probability of still spinning at time `t`. -/
theorem expected_wait_cost (C : ℝ) (hC : 0 < C) (ν : Measure ℝ≥0∞) [IsProbabilityMeasure ν]
(τ : ℝ≥0) :
∫⁻ b, waitCost C b τ ∂ν =
ν (Set.Iio (τ : ℝ≥0∞)) * ENNReal.ofReal C +
∫⁻ t in Set.Ioc (0 : ℝ) τ, ν (Set.Ici (ENNReal.ofReal t)) := by sorry
end NonuniformCompetitive.SpinBlock
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.