A stale request is a fault with probability
ProvedCompetitivePaging.Marking.stale_fault_probLet be a set of vertices enumerated as , let , and run the marking algorithm with servers from on a request sequence . Let request start a phase and let be an index such that no request with index in starts a phase, so that request belongs to the phase starting at . Let be the marked set just before the phase (the vertices requested in the previous phase, or for the first phase) and the set of vertices requested at indices . Suppose is stale: and . Put
the number of clean vertices requested in the phase so far and the current number of stale vertices. Then the probability that is not covered just before it is served is
This is the expected cost of a request to a stale vertex, the key probabilistic input to the bound on the marking algorithm's cost in a phase.
Formalization Note. The probability is taken under the law of the algorithm's state after the first requests and is stated in ; because itself is stale.
import Mathlib import Definitions.Def_KServer_model import Definitions.Def_CompetitivePaging_Marking_markingAlgorithm open scoped ENNReal
namespace CompetitivePaging.Marking
/-- §3, proof of Theorem 1 (p. 4): a request to a stale vertex (requested in the previous
phase, not yet in this phase) is a fault with probability `c/s`, where `c` is the number of
clean vertices requested in the phase so far and `s` the current number of stale vertices. -/
theorem stale_fault_prob {n k : ℕ} {M : Type*} [DecidableEq M]
(e : Fin n ≃ M) (hk : 1 ≤ k) (hkn : k ≤ n) (σ : List M) (i t : ℕ) (ht : t < σ.length)
(hi : IsPhaseStart k (initVertices e hkn) σ i) (hit : i ≤ t)
(hno : ∀ u, i < u → u ≤ t → ¬ IsPhaseStart k (initVertices e hkn) σ u)
(hstale : σ.get ⟨t, ht⟩ ∈ marksAt k (initVertices e hkn) σ i)
(hnew : σ.get ⟨t, ht⟩ ∉ phaseRequested σ i t) :
faultProb k (initVertices e hkn) (σ.take t) (σ.get ⟨t, ht⟩) =
((phaseRequested σ i t \ marksAt k (initVertices e hkn) σ i).card : ℝ≥0∞)
/ ((marksAt k (initVertices e hkn) σ i \ phaseRequested σ i t).card : ℝ≥0∞) := by sorry
end CompetitivePaging.Marking
Read-back
What the Lean code literally says, in plain math · claude-opus-5-5
Setting.
- is a bijection onto a type with decidable equality, and .
- .
- is a request sequence, and .
- is the deterministic marked set just before request , starting from under the rule "insert the request; if exactly points are marked, keep only the request".
- .
Hypotheses.
- is a phase start: .
- No with is a phase start. In particular, is not one unless .
- , the marked set just before request .
- .
Claim. Let be the probability that is uncovered after are served. The randomized marking process starts from (covered, marked) ; an uncovered request replaces a uniformly random covered, unmarked point after the mark update, or changes nothing if there is none. Then
with the division taken in .
Degenerate cases.
- Hypotheses 3 and 4 put in the denominator set, so the denominator is at least . The junk values in never arise.
- When , is empty and the right side is . In that case, hypotheses 1 and 3 together require .
- When , no phase start exists and the statement is vacuous.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.