AFTD Auto-Formalizing Theoretical Domains

nc_sum_grows

theoremverifiedformalizationimported Lean

After fuel rounds ending with free men, ∑ nextChoice grew by ≥ fuel.

Statement

set_option autoImplicit true in
set_option relaxedAutoImplicit true in
open List Finset in
open GS in
variable {n : ℕ} [NeZero n] in
lemma nc_sum_grows (w m : Preferences n) (fuel : ℕ) (s : DAState n)
    (hnc0 : ∀ i : Fin n, s.nextChoice i ≤ n)
    (hj : JInv m s)
    (hinj : ∀ j1 j2 k : Fin n, s.holding j1 = some k → s.holding j2 = some k → j1 = j2)
    (hne_end : (freeMenSet (daRun w m fuel s)).Nonempty) :
    ∑ i : Fin n, s.nextChoice i + fuel ≤ ∑ i : Fin n, (daRun w m fuel s).nextChoice i
Formalizes
EconCSLib, `nc_sum_grows`
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 12
  • holding_injective_stepIn daStep, holding remains injective.
  • GS.PreferencesList-based preferences: prefs i is a full permutation of Fin n, ordered from most to least preferred.
  • GS.DAStateDA state: per-man proposal cursor + per-woman tentative hold.
  • JInvJInv (Proposed → Held): once man i has proposed to woman p in some prior step, p is currently held by *someone* (possibly i,…
  • GS.freeMenSetThe finset of all free men in s.
  • GS.daRunRun DA for at most fuel steps, stopping early if no free men remain.
  • GS.daStepOne step of standard men-proposing DA. All free men propose; women pick the best of {held, new proposers} by rank; free men advance their…
  • nc_sum_increase∑ nextChoice strictly increases when free men exist.
  • daStep_nc_le_nnextChoice i ≤ n for daStep.
  • jinv_stepJInv is preserved by one daStep.
  • TotalPreorderA total preorder: a preorder where ≤ is total (complete). This is weaker than LinearOrder — it does NOT require antisymmetry or…
  • LinearOrder.toTotalPreorderEvery LinearOrder is a TotalPreorder.
Used by 1
  • finalState_no_free_menAt 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,…

Lean source view module on GitHub

set_option autoImplicit true inset_option relaxedAutoImplicit true inopen List Finset inopen GS invariable {n : ℕ} [NeZero n] in/-- After `fuel` rounds ending with free men, `∑ nextChoice` grew by ≥ `fuel`. -/lemma nc_sum_grows (w m : Preferences n) (fuel : ℕ) (s : DAState n)    (hnc0 : ∀ i : Fin n, s.nextChoice i ≤ n)    (hj : JInv m s)    (hinj : ∀ j1 j2 k : Fin n, s.holding j1 = some k → s.holding j2 = some k → j1 = j2)    (hne_end : (freeMenSet (daRun w m fuel s)).Nonempty) :    ∑ i : Fin n, s.nextChoice i + fuel ≤ ∑ i : Fin n, (daRun w m fuel s).nextChoice i := by  induction fuel generalizing s with  | zero => simp [daRun]  | succ k ih =>      simp only [daRun]      split_ifs with hne_s      · -- this round was active        have hsum_inc := nc_sum_increase w m s hne_s        -- freeMenSet after k more rounds of daStep s is nonempty        have hne_k : (freeMenSet (daRun w m k (daStep w m s))).Nonempty := by          simp only [daRun] at hne_end; simpa [hne_s] using hne_end        have hih := ih _ (daStep_nc_le_n w m s hnc0 hj hinj) (jinv_step w m s hj)            (holding_injective_step w m s hinj) hne_k        linarith      · -- freeMenSet s = ∅: daRun (k+1) s = s        simp only [Finset.not_nonempty_iff_eq_empty] at hne_s        simp only [daRun, hne_s, Finset.not_nonempty_iff_eq_empty, ↓reduceIte] at hne_end        exact absurd hne_s (Finset.nonempty_iff_ne_empty.mp hne_end)
See it in the graphDiscuss this resultChallenge it