GS.finalState
defimported Lean
finalState: run daRun with fuel n*n + 1 from initState.
Statement
set_option autoImplicit true in set_option relaxedAutoImplicit true in open List Finset in noncomputable def GS.finalState {n : ℕ} (w m : Preferences n) : DAState n
- Defined in
- EconCSLib, `GS.finalState`
- 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.finalState← GS.finalState (EconCSLib/MarketDesign/Matching/GaleShapley.lean:235): verbatim
- Verified
- 08 Oct 2026
- Axioms
- none listed
- Built on 4
- 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.
- GS.DAStateDA state: per-man proposal cursor + per-woman tentative hold.
- GS.PreferencesList-based preferences:
prefs iis a full permutation ofFin n, ordered from most to least preferred.
- GS.daRunRun DA for at most
- Used by 13
- GS.finalState_NoAchievableRejectionThe invariant holds at
finalState. - GS.gsThe Gale-Shapley function: woman
j's partner at termination. - final_holding_injective
finalStateholding is injective. - rsinv_finalStateRSInv at finalState.
- finalState_no_free_menAt termination, every man is held (no free man remains). Proof: if a free man remained,
nc_sum_growswould given*n + 1 ≤ n*n,… - finalState_rank_boundAt termination: if man j proposed to woman i at some round (j was free, i was his nc-th choice at state s, and the rest of the run reaches…
- rsinv_stabilityIf j strictly prefers i over his final partner, i's final partner has rank ≤ j.
- final_all_women_holdAt termination, every woman holds some man.
- holdinv_finalStateholdinv_finalState
- final_all_men_heldAt termination, every man is held by some woman.
- gs_injective
gs w mis injective. - galeShapley_isStableGale-Shapley stability: the DA output has no blocking pair. The statement is in the *market* frame (
IsBlocking … (i : M) (j : W)).… - GS.galeShapley_isProposingOptimalMen-optimal stable matching (Gale–Shapley 1962, [MSZ 22.10]): in the men-proposing DA, every man's GS partner is at least as preferred…
- GS.finalState_NoAchievableRejectionThe invariant holds at
Lean source view module on GitHub
set_option autoImplicit true in set_option relaxedAutoImplicit true in open List Finset in /-- `finalState`: run `daRun` with fuel `n*n + 1` from `initState`. -/ noncomputable def GS.finalState {n : ℕ} (w m : Preferences n) : DAState n := daRun w m (n * n + 1) (initState n)