finalState_no_free_men
theoremverifiedformalizationimported Lean
At termination, every man is held (no free man remains). Proof: if a free man remained, nc_sum_grows would give n*n + 1 ≤ n*n, contradiction.
Statement
set_option autoImplicit true in set_option relaxedAutoImplicit true in open List Finset in open GS in variable {n : ℕ} [NeZero n] in variable (w m : Preferences n) in lemma finalState_no_free_men : ∀ i : Fin n, isFree (finalState w m) i = false
- Formalizes
- EconCSLib, `finalState_no_free_men`
- 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.finalState_no_free_men← finalState_no_free_men (EconCSLib/MarketDesign/Matching/GaleShapley.lean:962): verbatim
- Verified
- 08 Oct 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 13
- nc_sum_le_nn
∑ nextChoice ≤ n * nis preserved overdaRun. - nc_sum_growsAfter
fuelrounds ending with free men,∑ nextChoicegrew by ≥fuel. - 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.daRunRun DA for at most
fuelsteps, stopping early if no free men remain. - GS.isFreeMan
iis free insiff no woman holds him. - GS.finalState
finalState: rundaRunwith fueln*n + 1frominitState. - GS.initStateInitial state: all women free, all men start at proposal index 0.
- JInvJInv (Proposed → Held): once man
ihas proposed to womanpin some prior step,pis currently held by *someone* (possiblyi,… - jinv_initjinv_init
- initState_injective
initStatehas trivially injective holding (allnone). - GS.freeMenSetThe finset of all free men in
s. - GS.mem_freeMenSetGS.mem_freeMenSet
- nc_sum_le_nn
- Used by 1
- final_all_men_heldAt termination, every man is held by some woman.
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] invariable (w m : Preferences n) in/-- At termination, every man is held (no free man remains). Proof: if a free man remained, `nc_sum_grows` would give `n*n + 1 ≤ n*n`, contradiction. -/lemma finalState_no_free_men : ∀ i : Fin n, isFree (finalState w m) i = false := by intro i -- Establish the pre-conditions for the fuel-sufficiency lemmas. have hnc0 : ∀ j : Fin n, (initState n).nextChoice j ≤ n := by simp [initState] have hj0 : JInv m (initState n) := jinv_init m have hinj0 := initState_injective (n := n) -- By contradiction: suppose some man i is still free in finalState. by_contra hfree simp only [Bool.not_eq_false] at hfree -- freeMenSet (finalState w m) is nonempty. have hne : (freeMenSet (finalState w m)).Nonempty := ⟨i, mem_freeMenSet.mpr hfree⟩ -- nc_sum_grows: 0 + (n*n+1) ≤ ∑ nc at finalState. have hgrows := nc_sum_grows w m (n * n + 1) (initState n) hnc0 hj0 hinj0 hne simp only [initState, Finset.sum_const_zero] at hgrows -- nc_sum_le_nn: ∑ nc at finalState ≤ n*n. have hle := nc_sum_le_nn w m (n * n + 1) (initState n) hnc0 hj0 hinj0 (by simp [initState]) -- Contradiction: n*n+1 ≤ 0 + (n*n+1) ≤ ∑ nc ≤ n*n. simp only [initState] at hle omega