Documentation

CslibFrontier.Algorithms.Lean.StableMatching.Incomplete.DeferredAcceptance

Deferred acceptance with incomplete preference lists #

This module implements proposer-proposing deferred acceptance [GS62] for markets with incomplete preference lists (IncompleteInstance m n) as a total, computable Lean function, and proves that its output is stable and proposer-optimal.

A state records, for each proposer p, how many receivers have turned p down; p currently proposes to the receiver at that position of its list, or to nobody once its list is exhausted. A receiver turns a proposal down when the proposer is unacceptable to it or when it also receives a proposal from someone it prefers. While some proposer is turned down, the first such proposer in index order moves on to its next choice. Each step adds one rejection, and the number of rejections is bounded by the total length of the proposers' lists, so the run stops; at that point the current proposals form the output matching. Proposers whose lists are exhausted stay unmatched.

Main definitions #

Main results #

Cost model #

No cost is charged. The number of rejections is at most totalLength; this module does not charge the cost of finding a rejected proposer or of the surrounding bookkeeping on any machine model.

References #

The receiver proposer p proposes to after s p rejections: the entry at position s p of its list, or none once the list is exhausted.

Receiver r turns proposer p down in state s: p is unacceptable to r, or r receives a proposal from someone it strictly prefers to p.

Instances For
    @[instance_reducible]

    Proposer p is rejected in state s when the receiver it proposes to turns it down.

    Instances For

      One step of deferred acceptance: the first rejected proposer moves on to its next choice. A state with no rejected proposer is fixed.

      The state after k steps, starting with every proposer at its first choice.

      The total length of the proposers' lists, which bounds the number of rejections.

      theorem Cslib.Algorithms.Lean.StableMatching.IncompleteInstance.step_cases {m n : ℕ} (I : IncompleteInstance m n) (s : Fin m → ℕ) :
      (I.step s = s ∧ ∀ (p : Fin m), ¬I.Rejected s p) ∨ ∃ (p : Fin m), I.Rejected s p ∧ I.step s = Function.update s p (s p + 1)

      A step either fixes a state with no rejected proposer or advances one rejected proposer.

      The deferred-acceptance invariant: no proposer has passed the end of its list, and every receiver that proposer p has passed still turns p down.

      The initial state satisfies the invariant.

      Steps preserve the invariant.

      One more round of the run is one more step.

      Every state of the run satisfies the invariant.

      theorem Cslib.Algorithms.Lean.StableMatching.IncompleteInstance.sum_le {m n : ℕ} (I : IncompleteInstance m n) {s : Fin m → ℕ} (hs : I.Inv s) :
      ∑ p : Fin m, s p ≤ I.totalLength

      The total number of rejections in an invariant state is at most totalLength.

      theorem Cslib.Algorithms.Lean.StableMatching.IncompleteInstance.run_fixed_of_le {m n : ℕ} (I : IncompleteInstance m n) {j k : ℕ} (hjk : j ≤ k) (h : I.step (I.run j) = I.run j) :
      I.run k = I.run j

      Once the run reaches a fixed state, it stays there.

      Deferred acceptance stops after at most totalLength rejections.

      The state reached by deferred acceptance.

      The final state satisfies the invariant.

      Deferred acceptance makes at most totalLength rejections.

      No proposer is rejected in the final state.

      Distinct proposers end at distinct receivers.

      The proposer-proposing deferred-acceptance matching: each proposer is matched to the receiver it proposes to in the final state, and is unmatched if its list is exhausted.

      Proposer p ranks its deferred-acceptance outcome no worse than its position after the final number of rejections.

      Deferred acceptance outputs a stable matching ([RS90], Theorem 2.8).

      Every market with incomplete lists has a stable matching ([RS90], Theorem 2.8).

      Proposer-optimality #

      Proposer-optimality ([RS90], Theorem 2.12): every proposer weakly prefers its deferred-acceptance outcome to its outcome in any stable matching.

      Deferred acceptance is the unique proposer-optimal stable matching.

      Receiver-proposing deferred acceptance #

      Receiver-proposing deferred acceptance: run deferred acceptance on the swapped market.