rsinv_stability
theoremverifiedformalizationimported Lean
If j strictly prefers i over his final partner, i's final partner has rank ≤ j.
Statement
set_option autoImplicit true in set_option relaxedAutoImplicit true in open List Finset in open GS in variable {n : ℕ} [NeZero n] in lemma rsinv_stability (w m : Preferences n) (j i : Fin n) (hlt : (m.prefs j).idxOf i < (finalState w m).nextChoice j) : (w.prefs i).idxOf (gs w m i) ≤ (w.prefs i).idxOf j
- Formalizes
- EconCSLib, `rsinv_stability`
- 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.rsinv_stability← rsinv_stability (EconCSLib/MarketDesign/Matching/GaleShapley.lean:933): verbatim
- Verified
- 08 Oct 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 8
- rsinv_finalStateRSInv at finalState.
- GS.PreferencesList-based preferences:
prefs iis a full permutation ofFin n, ordered from most to least preferred. - GS.DAStateDA state: per-man proposal cursor + per-woman tentative hold.
- GS.finalState
finalState: rundaRunwith fueln*n + 1frominitState. - GS.gsThe Gale-Shapley function: woman
j's partner at termination. - GS.pref_list_memEvery element of
Fin nappears in a full-permutation list. - GS.daRunRun DA for at most
fuelsteps, stopping early if no free men remain. - GS.initStateInitial state: all women free, all men start at proposal index 0.
- Used by 1
- galeShapley_isStableGale-Shapley stability: the DA output has no blocking pair. The statement is in the *market* frame (
IsBlocking … (i : M) (j : W)).…
- galeShapley_isStableGale-Shapley stability: the DA output has no blocking pair. The statement is in the *market* frame (
Lean source view module on GitHub
Choose a tactic — a marked line — to see the goals Lean had before and after it, as in Lean’s infoview. Step with ← → or j k.
set_option autoImplicit true inset_option relaxedAutoImplicit true inopen List Finset inopen GS invariable {n : ℕ} [NeZero n] in/-- If j strictly prefers i over his final partner, i's final partner has rank ≤ j. -/lemma rsinv_stability (w m : Preferences n) (j i : Fin n) (hlt : (m.prefs j).idxOf i < (finalState w m).nextChoice j) : (w.prefs i).idxOf (gs w m i) ≤ (w.prefs i).idxOf j := by have hrs := rsinv_finalState w m j i have hi_mem : i ∈ (m.prefs j).take ((finalState w m).nextChoice j) := by rw [List.mem_take_iff_idxOf_lt] · exact hlt · exact pref_list_mem _ (m.valid j).1 (m.valid j).2 i obtain ⟨h, hh, hrk⟩ := hrs hi_mem -- h = gs w m i (since holding i = some h at finalState) have hgs : gs w m i = h := by simp only [gs, finalState] at hh ⊢; simp [hh] rw [hgs]; exact hrk