GS.StableMatching.instLattice
instanceimported Lean
Conway–Knuth lattice. The stable matchings of a one-to-one market form a lattice under the men-preference order: the join gives every man his more- preferred of two partners, the meet his less-preferred, and both are stable.
Statement
set_option autoImplicit true in set_option relaxedAutoImplicit true in open GS in variable {n : ℕ} (w m : Preferences n) in variable {w m} in variable (μ ν : Matching (Fin n) (Fin n)) (hμ : Matching.IsStable (MatchingMarket.ofEquivData w m) μ) (hν : Matching.IsStable (MatchingMarket.ofEquivData w m) ν) in noncomputable instance GS.StableMatching.instLattice : Lattice (StableMatching w m)
- Defined in
- EconCSLib, `GS.StableMatching.instLattice`
- Lean proof
- By xbei (from the file's git history), from github.com/gametheoryinlean/EconCSLib at
1a88f809b538(Copyright (c) 2026 EconCSLib contributors. All rights reserved, Apache-2.0). Compiled here against leanprover/lean4:v4.33.1, Mathlib v4.33.1; written for leanprover/lean4:v4.30.0.GS.StableMatching.instLattice← @EconCSLib/MarketDesign/Matching/Lattice.lean:537 (EconCSLib/MarketDesign/Matching/Lattice.lean:534): verbatim
- Verified
- 08 Oct 2026
- Axioms
- none listed
- Built on 27
- GS.joinWoman_le_rightGS.joinWoman_le_right
- GS.StableMatching.partnerMan
j's partner under a stable matching. - Matching.IsStableA matching is stable if it has no blocking pair. [MSZ 22.5]
- GS.stableJoin_matchMGS.stableJoin_matchM
- GS.stableMeet_isStableThe meet of two stable matchings is stable.
- GS.stableMeetThe meet
μ ∧ ν: each woman keeps her more-preferred man; each man keeps his less-preferred woman. - GS.stableMeet_matchMGS.stableMeet_matchM
- GS.stableMeet_matchWGS.stableMeet_matchW
- GS.stableMeet_ge_leftGS.stableMeet_ge_left
- MatchingA matching is a partial bijection between
MandW.matchM iis the partner ofi ∈ M(ornoneif unmatched).matchW jis the… - GS.meetEquiv_symm_eq_orThe meet woman of man
jis one of his two partners (his worse). - GS.stableMeet_ge_rightGS.stableMeet_ge_right
- GS.matchM_mPartnerGS.matchM_mPartner
- instCoeFunPrefForallForallPropinstCoeFunPrefForallForallProp
- GS.matchW_wPartnerGS.matchW_wPartner
- GS.stableJoinThe join
μ ∨ ν: each man keeps his more-preferred of the two partners; each woman keeps her less-preferred man. - GS.joinWoman_le_leftGS.joinWoman_le_left
- GS.stableJoin_isStableThe join of two stable matchings is stable.
- GS.stableJoin_matchWGS.stableJoin_matchW
- GS.wPartnerThe woman partnered to man
junder a stable matchingμ(total, since a stable matching of the balanced market is perfect). - GS.PreferencesList-based preferences:
prefs iis a full permutation ofFin n, ordered from most to least preferred. - GS.meetEquivThe meet man-assignment packaged as an equivalence.
- GS.joinWoman_eq_orGS.joinWoman_eq_or
- GS.StableMatching.instPartialOrderMen-preference order:
μ ≤ νiff every man weakly prefers hisν-partner to hisμ-partner (smalleridxOf= more preferred). - MatchingMarket.ofEquivDataBuild a
MatchingMarket (Fin n) (Fin n)from list-based preference data.some j ≻ some kiffjappears earlier in the list;noneis… - GS.StableMatchingThe type of stable matchings of a one-to-one market.
- GS.joinWomanMan
j's more-preferred partner across stable matchingsμandν.
- Used by 3
- GS.StableMatching.gsStable_greatestThe GS output is the greatest stable matching in the men-preference order: every man weakly prefers his GS partner to his partner in…
- GS.StableMatching.gsStable_isGreatest
gsStableis the greatest element of the stable-matching lattice. - GS.StableMatching.gsStableThe men-proposing Gale–Shapley output, as an element of the lattice of stable matchings.
Lean source view module on GitHub
set_option autoImplicit true in set_option relaxedAutoImplicit true in open GS in variable {n : ℕ} (w m : Preferences n) in variable {w m} in variable (μ ν : Matching (Fin n) (Fin n)) (hμ : Matching.IsStable (MatchingMarket.ofEquivData w m) μ) (hν : Matching.IsStable (MatchingMarket.ofEquivData w m) ν) in /-- **Conway–Knuth lattice.** The stable matchings of a one-to-one market form a lattice under the men-preference order: the join gives every man his more- preferred of two partners, the meet his less-preferred, and both are stable. -/ noncomputable instance GS.StableMatching.instLattice : Lattice (StableMatching w m) := { (inferInstance : PartialOrder (StableMatching w m)) with sup := fun μ ν => ⟨stableJoin μ.1 ν.1 μ.2 ν.2, stableJoin_isStable μ.1 ν.1 μ.2 ν.2⟩ inf := fun μ ν => ⟨stableMeet μ.1 ν.1 μ.2 ν.2, stableMeet_isStable μ.1 ν.1 μ.2 ν.2⟩ le_sup_left := fun μ ν j => joinWoman_le_left μ.1 ν.1 μ.2 ν.2 j le_sup_right := fun μ ν j => joinWoman_le_right μ.1 ν.1 μ.2 ν.2 j sup_le := fun μ ν bound h1 h2 j => by show (m.prefs j).idxOf (bound.partner j) ≤ (m.prefs j).idxOf (joinWoman μ.1 ν.1 μ.2 ν.2 j) rcases joinWoman_eq_or μ.1 ν.1 μ.2 ν.2 j with he | he · rw [he]; exact h1 j · rw [he]; exact h2 j inf_le_left := fun μ ν j => stableMeet_ge_left μ.1 ν.1 μ.2 ν.2 j inf_le_right := fun μ ν j => stableMeet_ge_right μ.1 ν.1 μ.2 ν.2 j le_inf := fun bound μ ν h1 h2 j => by show (m.prefs j).idxOf ((meetEquiv μ.1 ν.1 μ.2 ν.2).symm j) ≤ (m.prefs j).idxOf (bound.partner j) rcases meetEquiv_symm_eq_or μ.1 ν.1 μ.2 ν.2 j with he | he · rw [he]; exact h1 j · rw [he]; exact h2 j }