Documentation

CslibFrontier.Algorithms.Lean.StableMatching.ManyToOne

Many-to-one Hospitals–Residents markets and Roth's Rural Hospitals Theorem #

In the Hospitals–Residents (or college admissions) model ([GS62]; [Rot86]; [RS90]; see also [SV07], Section 10.4.3, p. 261 for the quota-extension background), m residents indexed by Fin m apply to n hospitals indexed by Fin n, where hospital h can admit up to I.quota h residents. Preferences are strict and possibly incomplete lists (I.resPref r and I.hospPref h), and hospital preferences over sets of residents are responsive to their strict ranking of individual residents via individual acceptability, quota bounds, and pairwise blocking: a resident–hospital pair (r, h) blocks a matching M when r strictly prefers h to its assigned outcome M.hospital r, h finds r acceptable, and either h has an unfilled seat ((M.residents h).card < I.quota h) or h strictly prefers r to some currently assigned resident r' ∈ M.residents h.

Via a computable seat-cloning reduction to IncompleteInstance (kept internal to the proofs and algorithm implementation so all public statements speak purely in terms of ManyToOneInstance and ManyToOneMatching), we construct resident-proposing ManyToOneInstance.deferredAcceptance, prove its stability and resident-optimality, and establish Roth's (1986) Rural Hospitals Theorem:

  1. Every stable matching matches the exact same set of residents (matchedResidents_eq_of_isStable, unmatchedResidents_eq_of_isStable).
  2. Every hospital fills the exact same number of positions across all stable matchings (card_residents_eq_of_isStable).
  3. Every hospital that fails to fill its quota in some stable matching is assigned the exact same set of residents in every stable matching (residents_eq_of_card_lt_quota).

Main definitions #

Main results #

References #

A many-to-one Hospitals–Residents market with m residents (Fin m) and n hospitals (Fin n). Each agent lists acceptable partners on the other side from most to least preferred, and hospital h has capacity quota h.

  • resPref : Fin m → List (Fin n)

    Acceptable hospitals for resident r, from most to least preferred.

  • hospPref : Fin n → List (Fin m)

    Acceptable residents for hospital h, from most to least preferred.

  • quota : Fin n → ℕ

    Maximum number of residents that hospital h can admit.

A many-to-one assignment assigning each resident r an optional hospital M.hospital r.

  • hospital : Fin m → Option (Fin n)

    Hospital assigned to resident r, or none if r remains unmatched.

Set of residents assigned to hospital h under M.

Set of residents matched to some hospital under M.

Ranks, feasibility, and stability #

Rank of outcome o : Option (Fin n) for resident r (0 is favourite; none or an unacceptable hospital has rank (I.resPref r).length).

Rank of resident r in hospital h's preference list ((I.hospPref h).length if unacceptable).

theorem Cslib.Algorithms.Lean.StableMatching.ManyToOneInstance.eq_of_resRank_eq {m n : ℕ} (I : ManyToOneInstance m n) {r : Fin m} {h : Fin n} (hh : h ∈ I.resPref r) {o : Option (Fin n)} (heq : I.resRank r (some h) = I.resRank r o) :
o = some h

M is feasible when every hospital admits at most its quota of residents.

Instances For

    M is individually rational when every assigned pair (r, h) is mutually acceptable.

    Instances For

      Resident r and hospital h form a blocking pair for M ([Rot86]; [RS90]) when r strictly prefers h to M.hospital r, h finds r acceptable, and either h has an unfilled position or h strictly prefers r to some resident currently in M.residents h.

      Instances For

        M is stable when it is feasible, individually rational, and admits no blocking pair.

        Instances For

          M is resident-optimal when it is stable and every resident weakly prefers M.hospital r to its outcome in every stable matching.

          Seat-cloning reduction to IncompleteInstance #

          Lifting a stable ManyToOneMatching to cloneInstance #

          Resident-proposing deferred acceptance and Roth's Rural Hospitals Theorem #

          Computable resident-proposing deferred acceptance for a many-to-one Hospitals–Residents market ([GS62]; [RS90]).

          Resident-proposing deferred acceptance produces a stable many-to-one matching ([GS62]; [RS90]).

          Every Hospitals–Residents market with strict preferences admits a stable matching.

          Resident-optimality ([RS90]): every resident weakly prefers its outcome under I.deferredAcceptance to its outcome in any stable matching M.

          Rural Hospitals Theorem, Part 1 ([Rot86]; [RS90]): the set of matched residents is the same across all stable matchings.

          Equivalent form of matchedResidents_eq_of_isStable: the set of unmatched residents is the same across all stable matchings.

          theorem Cslib.Algorithms.Lean.StableMatching.ManyToOneInstance.card_residents_eq_of_isStable {m n : ℕ} (I : ManyToOneInstance m n) {M₁ M₂ : ManyToOneMatching m n} (hM₁ : I.IsStable M₁) (hM₂ : I.IsStable M₂) (h : Fin n) :
          (M₁.residents h).card = (M₂.residents h).card

          Rural Hospitals Theorem, Part 2 ([Rot86]; [RS90]): every hospital fills the exact same number of positions across all stable matchings.

          theorem Cslib.Algorithms.Lean.StableMatching.ManyToOneInstance.residents_eq_of_card_lt_quota {m n : ℕ} (I : ManyToOneInstance m n) {M₁ M₂ : ManyToOneMatching m n} (hM₁ : I.IsStable M₁) (hM₂ : I.IsStable M₂) {h : Fin n} (hlt : (M₁.residents h).card < I.quota h) :
          M₁.residents h = M₂.residents h

          Rural Hospitals Theorem, Part 3 ([Rot86]; [RS90]): any hospital h that does not fill its quota in some stable matching is assigned the exact same set of residents in every stable matching.