Move-to-front is 2-competitive for list update #
This file formalizes Theorem 1 of Sleator and Tarjan, Amortized Efficiency of List Update and
Paging Rules, Section 2 in the list-update model of
CslibFrontier.DataStructure.ListUpdate.Basic. It includes the generalization stated after the
proof,
where the online and offline lists start from different arrangements.
The move-to-front strategy mtf serves request r by moving r to the front of its list,
without changing the relative order of the other items. It pays exactly the position of r
(stepCost_moveToFront). For every offline schedule serving m requests, starting from an
arrangement s₀ while move-to-front starts from m₀,
cost_MTF + inversions(final MTF list, final offline list) + m ≤
2 * accessCost + exchangeCost + inversions m₀ s₀
(mtf_cost_add_inversions_add_length_le). This is the Sleator–Tarjan bound
C_MF(s) ≤ 2 C_A(s) + X_A(s) - F_A(s) - m + I, with the offline schedule's paid and free
exchanges accounted for by exchangeCost, which counts the inversions between consecutive
offline arrangements. The module docstring of CslibFrontier.DataStructure.ListUpdate.Basic gives
the informal translation between the two cost models; it is not formalized.
The proof uses the Sleator–Tarjan potential, the number of inversions between move-to-front's list
and the offline list. Serving r costs move-to-front k = pos(r). Moving r to the front creates
at most pos_A(r) - 1 new inversions and destroys at least k - pos_A(r) old ones, for an
amortized cost of at most 2 pos_A(r) - 1 (inversions_moveToFront_le). A rearrangement by the
offline schedule raises the potential by at most its own cost (inversions_triangle).
Main definitions #
Cslib.DataStructure.ListUpdate.moveToFront: move an item to the front of a list.ListUpdate.mtf: the move-to-front online strategy.
Main results #
stepCost_moveToFront: move-to-front pays exactly the position of the requested item.inversions_moveToFront_le: the amortized step inequality.mtf_cost_add_inversions_add_length_le: [ST85a], Theorem 1 with different initial lists.mtf_isCompetitive,mtf_isCompetitiveAnyInit: move-to-front is(2, 0)-competitive from a common initial arrangement and(2, n (n - 1) / 2)-competitive from arbitrary arrangements.
References #
Move r to the front of l, keeping the relative order of the other items.
List.idxOf_cons_ne for moveToFront, the companion of idxOf_moveToFront_self: every other
item moves back one place.
Erasing r keeps the relative order of the other items.
Moving r to the front keeps the relative order of the other items.
Moving an item to the front of an arrangement gives an arrangement.
The move-to-front strategy for list update over the finite universe α.
Moving r to the front creates exactly l.idxOf r inversions.
Move-to-front pays exactly the position of the requested item.
Amortized step inequality ([ST85a], proof of Theorem 1): if r is at
position k = m.idxOf r + 1 in move-to-front's list and at position i = L.idxOf r + 1 in the
offline list, then moving r to the front changes the potential by at most 2i - 1 - k.
Move-to-front bound ([ST85a], Theorem 1 and the remark after its proof): for
every valid offline schedule states serving reqs from s₀, move-to-front started from m₀
satisfies cost + inversions(final lists) + |reqs| ≤ 2 * accessCost + exchangeCost +
inversions m₀ s₀.
[ST85a], Theorem 1 with different initial lists, for DetStrategy.cost.
Move-to-front costs at most twice any offline schedule, plus the initial inversions:
cost_MTF ≤ 2 * cost_A - |reqs| + inversions m₀ s₀.
Move-to-front is (2, 0)-competitive from a common initial arrangement.
Move-to-front is (2, n (n - 1) / 2)-competitive across arbitrary initial arrangements, where
n = Fintype.card α.