Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Rural hospitals theorem, Part 2

Proved
RuralHospitals.rural_hospitals_part2

by Lucas · Oct 11, 2026 · Mathlib 0df444a (Lean v4.33.1)

rural-hospitalsstable-matching

Consider a many-to-one matching market with a finite set DDD of doctors and a finite set HHH of hospitals, where hospital hhh has qhq_hqh​ positions and all preferences are strict. For a matching μ\muμ, write μ(h)⊆D\mu(h)\subseteq Dμ(h)⊆D for the set of doctors assigned to hhh. Let μ\muμ and ν\nuν be stable matchings and let h∈Hh\in Hh∈H be a hospital with an empty position under μ\muμ, i.e. ∣μ(h)∣<qh|\mu(h)|<q_h∣μ(h)∣<qh​. Then

ν(h)=μ(h).\nu(h)=\mu(h).ν(h)=μ(h).

This is Part 2 of the rural hospitals theorem (Roth 1986): an under-subscribed hospital receives exactly the same set of doctors in every stable matching.

Formalization Note Uses the model RuralHospitals.Market (definition RuralHospitals_Market): finite types D (doctors) and H (hospitals); strict preferences given by injective rank functions on Option H / Option D (smaller rank = preferred, none = unmatched / empty position); responsive hospital preferences; capacities capacity : H → ℕ. An assignment is a map μ : D → Option H, and assigned μ h is the finite set of doctors placed at h.

Preamble
import Mathlib
import Definitions.Def_RuralHospitals_Market
Formal statement
namespace RuralHospitals

theorem rural_hospitals_part2 {D H : Type*} [Fintype D] [Fintype H] [DecidableEq H]
    (M : Market D H) (μ ν : Assignment D H) (hμ : M.IsStable μ) (hν : M.IsStable ν)
    (h : H) (hh : (assigned μ h).card < M.capacity h) :
    assigned ν h = assigned μ h := by sorry

end RuralHospitals
Source
Wikipedia, "Rural hospitals theorem", revision oldid=1064508418 (https://en.wikipedia.org/w/index.php?title=Rural_hospitals_theorem&oldid=1064508418), introduction, Part 2: "Any hospital that has some empty positions in some stable matching, receives exactly the same set of doctors in all stable matchings." Primary reference: A. E. Roth, On the allocation of residents to rural hospitals: a general property of two-sided matching markets, Econometrica 54 (1986) 425–427, doi:10.2307/1913160.
Human review
  • Endorsed by Shuze Chen · Oct 11, 2026

    Confirmed by the moderator at approval.

  • Endorsed by Lucas · Oct 11, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me