An accepted proposal preserves the deferred-acceptance invariants
ProvedAppliedModelingLib.Matching.acceptStep_preserves_invariantsLet be finite sets with real-valued preferences and and outside-option value zero. A state records consistent tentative partners and each man's remaining proposal set. Its invariant requires individual rationality on both sides, removal of matched pairs from remaining proposals, protection against previously rejected pairs, and proposals in descending preference order.
Suppose holds, man is unmatched and has an acceptable remaining proposal, and is one of his highest-valued remaining acceptable women. Suppose accepts: she is unmatched and , or strictly prefers to her current partner. Form by matching to , freeing her former partner when one exists, and removing this proposal from 's remaining set. Then
This verifies the acceptance branch of the state update, allowing arbitrary real-valued preferences and ties.
import Mathlib.Algebra.BigOperators.Ring.Finset
import Mathlib.Algebra.Order.BigOperators.Group.Finset
import Mathlib.Data.Finset.Basic
import Mathlib.Data.Finset.Max
import Mathlib.Data.Fintype.Basic
import Mathlib.Data.Fintype.Card
import Mathlib.Data.Fintype.Perm
import Mathlib.Data.Real.Basic
import Mathlib.Tactic.Linarith
import Definitions.Def_AMLGS62_AppliedModelingLib_Markets_Matching_DeferredAcceptance
open AppliedModelingLib
open AppliedModelingLib.Matching
variable {M W : Type*} [Fintype M] [Fintype W] [DecidableEq M] [DecidableEq W]
set_option linter.unusedSimpArgs false
set_option linter.unusedSimpArgs true
-- DA algorithm fold
set_option linter.unusedSimpArgs false
set_option linter.unusedSimpArgs true
theorem AppliedModelingLib.Matching.acceptStep_preserves_invariants
(val_m : M → W → ℝ) (val_w : W → M → ℝ)
(s : DAState M W) {m : M} {w : W}
(hact : IsActiveMan val_m s m)
(hwbest : BestRemainingWoman val_m s m w)
(haccept :
match s.w_match w with
| none => 0 ≤ val_w w m
| some m' => val_w w m' < val_w w m)
(hinv : DAInvariants val_m val_w s) :
DAInvariants val_m val_w
{ m_match := fun m'' =>
if m'' = m then some w
else if s.w_match w = some m'' then none
else s.m_match m''
w_match := Function.update s.w_match w (some m)
m_proposals := removeProposal s m w
consistent := by
simpa using acceptMatch_consistent s hact.1 } := by sorry