Prove2Me
Navigate
DiscoverFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Gale–Shapley Theorem 1: existence of a stable complete matching

Proved
GS62CollegeAdmissions.paper_gs62_theorem1_stable_marriage_exists

by nkgarg · Sep 15, 2026 · Mathlib c5ea003 (Lean v4.30.0)

aml-gs62-stable-marriage-20260915game-theorystable-matching

Let MMM and WWW be equally sized finite sets. Each man strictly ranks all women, and each woman strictly ranks all men; everyone prefers any partner to being unmatched. Represent these rankings by real values um(w)u_m(w)um​(w) and vw(m)v_w(m)vw​(m) that are positive and have no ties within an individual's ranking. Then

∃μ:μ is a complete matching and has no blocking pair.\exists\mu:\quad \mu\text{ is a complete matching and has no blocking pair}.∃μ:μ is a complete matching and has no blocking pair.

A blocking pair consists of a man and a woman who both strictly prefer one another to their partners in μ\muμ. The matching assigns exactly one partner to each participant, with mutually consistent assignments. The empty market is included.

This is the stable-marriage existence result in Theorem 1 of Gale and Shapley's College Admissions and the Stability of Marriage.

Preamble
import Mathlib.Algebra.BigOperators.Ring.Finset
import Mathlib.Algebra.Order.BigOperators.Group.Finset
import Mathlib.Data.Finset.Basic
import Mathlib.Data.Finset.Card
import Mathlib.Data.Finset.Max
import Mathlib.Data.Fintype.Basic
import Mathlib.Data.Fintype.Card
import Mathlib.Data.Fintype.Perm
import Mathlib.Data.Fintype.Sigma
import Mathlib.Data.Real.Basic
import Mathlib.Tactic.Linarith
import Definitions.Def_AMLGS62_GS62CollegeAdmissions_MainTheorems

open GS62CollegeAdmissions
open AppliedModelingLib.Matching

Formal statement
theorem GS62CollegeAdmissions.paper_gs62_theorem1_stable_marriage_exists
    {M W : Type*} [Fintype M] [Fintype W] [DecidableEq M] [DecidableEq W]
    (val_m : M → W → ℝ) (val_w : W → M → ℝ)
    (hcard : Fintype.card M = Fintype.card W)
    (hdomain : gs_strict_marriage_domain val_m val_w) :
    ∃ mu : Assignment M W,
      gs_stable_marriage val_m val_w mu ∧ gs_complete_marriage mu := by sorry
Source
Gale and Shapley (1962), College Admissions and the Stability of Marriage, Theorem 1; https://github.com/nikhgarg/AppliedModelingLib/blob/e952266be81e96bbeecea6af83d639af324a4438/papers/GS62CollegeAdmissions/MainTheorems.lean#L94-L109

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 paper
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me