Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Rural hospitals theorem, Part 1

Proved
RuralHospitals.rural_hospitals_part1

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. Then

  1. the set of assigned doctors is the same: for every d∈Dd\in Dd∈D, ddd is matched under μ\muμ if and only if ddd is matched under ν\nuν;
  2. the number of filled positions at each hospital is the same:
∣μ(h)∣=∣ν(h)∣for all h∈H.|\mu(h)| = |\nu(h)| \qquad \text{for all } h\in H.∣μ(h)∣=∣ν(h)∣for all h∈H.

This is Part 1 of the rural hospitals theorem (Roth 1984): changing the stable mechanism cannot change who is employed or how many positions each hospital fills.

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_part1 {D H : Type*} [Fintype D] [Fintype H] [DecidableEq H]
    (M : Market D H) (μ ν : Assignment D H) (hμ : M.IsStable μ) (hν : M.IsStable ν) :
    (∀ d, (μ d).isSome = (ν d).isSome) ∧
      ∀ h, (assigned μ h).card = (assigned ν h).card := 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 1: "The set of assigned doctors, and the number of filled positions in each hospital, are the same in all stable matchings." Primary reference: A. E. Roth, The evolution of the labor market for medical interns and residents: a case study in game theory, J. Political Economy 92 (1984) 991–1016, doi:10.1086/261272.
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