AFTD Auto-Formalizing Theoretical Domains

GS.stableJoin_isStable

theoremverifiedformalizationimported Lean

The join of two stable matchings is 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
theorem GS.stableJoin_isStable :
    Matching.IsStable (MatchingMarket.ofEquivData w m) (stableJoin μ ν hμ hν)
Formalizes
EconCSLib, `GS.stableJoin_isStable`
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.
Verified
08 Oct 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 23
  • GS.joinWoman_le_rightGS.joinWoman_le_right
  • GS.joinWoman_mem_menIf i is man j's join-partner then j is one of i's two men.
  • GS.mPartnerThe man partnered to woman i under a stable matching μ.
  • Matching.IsStableA matching is stable if it has no blocking pair. [MSZ 22.5]
  • GS.prefM_strictGS.prefM_strict
  • GS.stableJoin_matchMGS.stableJoin_matchM
  • Matching.IsBlockingA pair (m, w) is a blocking pair for matching μ if both m and w strictly prefer each other to their current partners. [MSZ 22.5]
  • strictStrict preference derived from a weak preference relation.
  • MatchingA matching is a partial bijection between M and W. matchM i is the partner of i ∈ M (or none if unmatched). matchW j is the…
  • 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_matchWGS.stableJoin_matchW
  • GS.wPartnerThe woman partnered to man j under a stable matching μ (total, since a stable matching of the balanced market is perfect).
  • GS.joinEquivThe join woman-assignment packaged as an equivalence (injective on the finite Fin n, hence bijective).
  • GS.PreferencesList-based preferences: prefs i is a full permutation of Fin n, ordered from most to least preferred.
  • MatchingMarketA two-sided matching market. M and W are the two sides (e.g., men and women, hospitals and residents). Each agent has a preference…
  • MatchingMarket.ofEquivDataBuild a MatchingMarket (Fin n) (Fin n) from list-based preference data. some j ≻ some k iff j appears earlier in the list; none is…
  • GS.joinWomanMan j's more-preferred partner across stable matchings μ and ν.
  • GS.prefW_strictGS.prefW_strict
  • PrefA bundled weak preference relation. Use this interface when several agents may rank the same outcome type differently. Use…
Used by 2

Lean source view module on GitHub

set_option autoImplicit true inset_option relaxedAutoImplicit true inopen GS invariable {n : ℕ} (w m : Preferences n) invariable {w m} invariable (μ ν : Matching (Fin n) (Fin n))  (hμ : Matching.IsStable (MatchingMarket.ofEquivData w m) μ)  (hν : Matching.IsStable (MatchingMarket.ofEquivData w m) ν) in/-- The join of two stable matchings is stable. -/theorem GS.stableJoin_isStable :    Matching.IsStable (MatchingMarket.ofEquivData w m) (stableJoin μ ν hμ hν) := by  intro i j hblock  obtain ⟨hi, hj⟩ := hblock  rw [stableJoin_matchM] at hi  rw [stableJoin_matchW] at hj  set jm := (joinEquiv μ ν hμ hν).symm i with hjmdef  have hi' : (w.prefs i).idxOf j < (w.prefs i).idxOf jm := prefM_strict.mp hi  have hj' : (m.prefs j).idxOf i < (m.prefs j).idxOf (joinWoman μ ν hμ hν j) := prefW_strict.mp hj  have hjoin_jm : joinWoman μ ν hμ hν jm = i := (joinEquiv μ ν hμ hν).apply_symm_apply i  rcases joinWoman_mem_men μ ν hμ hν hjoin_jm with hm | hn  · -- `jm` is `i`'s `μ`-man, so `(i, j)` blocks `μ`.    refine hμ i j ⟨?_, ?_⟩    · rw [matchM_mPartner μ hμ i, hm]; exact prefM_strict.mpr hi'    · rw [matchW_wPartner μ hμ j]      exact prefW_strict.mpr (lt_of_lt_of_le hj' (joinWoman_le_left μ ν hμ hν j))  · -- `jm` is `i`'s `ν`-man, so `(i, j)` blocks `ν`.    refine hν i j ⟨?_, ?_⟩    · rw [matchM_mPartner ν hν i, hn]; exact prefM_strict.mpr hi'    · rw [matchW_wPartner ν hν j]      exact prefW_strict.mpr (lt_of_lt_of_le hj' (joinWoman_le_right μ ν hμ hν j))
See it in the graphDiscuss this resultChallenge it