Gale–Shapley deferred acceptance #
This module implements proposer-proposing deferred acceptance [GS62] as a total,
computable Lean function on Instance n, and proves that it terminates within the classical
proposal bound, that its output is stable, and that it is proposer-optimal.
We use the iterative formulation in which one rejection happens at a time; McVitie and Wilson
[McVW71] showed that the outcome does not depend on the order of rejections. A state
records, for each proposer p, how many receivers have turned p
down; p currently proposes to its next choice. While some receiver receives proposals from two
proposers, it turns down the one it likes less, which moves on to its next choice. The step
function always turns down the first outranked proposer in index order, so deferredAcceptance
is a definite function that decide evaluates on concrete instances. The proofs use only
step_cases and the invariant Inv, so they adapt to any rejection order; order independence is
not stated as a theorem here.
Main definitions #
Instance.step,Instance.run: one rejection step, and the state afterksteps.Instance.finalState: the state after(n - 1)^2steps, which is fixed.Instance.deferredAcceptance: the proposer-proposing deferred-acceptance matching.Instance.proposals: the number of proposals made,∑ p, (finalState p + 1).
Main results #
Instance.step_run_fixed,Instance.run_eq_finalState: the run stops after at most(n - 1)^2rejections.Instance.proposals_le: at mostn^2 - n + 1proposals are made (see [GI89]);Instance.proposals_eqexpresses the count through the final partners only.Instance.isStable_deferredAcceptance,Instance.exists_isStable: the output is a (perfect) stable matching; hence a stable matching always exists ([GS62], Theorem 1).Instance.propRank_deferredAcceptance_le,Instance.isProposerOptimal_deferredAcceptance: every proposer weakly prefers its deferred-acceptance partner to its partner in any stable matching ([GS62], Theorem 2), and receivers are correspondingly worst off ([McVW71]);Instance.isProposerOptimal_iffcharacterizes the output.Instance.receiverDeferredAcceptance: receiver-proposing deferred acceptance, which is receiver-optimal and proposer-pessimal.
Cost model #
proposals counts proposals, the standard cost measure for deferred acceptance. This module does
not charge the cost of finding an outranked proposer or of the surrounding bookkeeping on any
machine model.
References #
A deferred-acceptance state: s p is the number of receivers that have turned proposer p
down so far. Proposer p currently proposes to its choice of rank s p.
A step either fixes a state with no outranked proposer or turns down one outranked proposer.
The deferred-acceptance invariant: every proposer is within its list; whenever proposer p
has been turned down by its choice of rank k, that receiver currently receives a proposal from
someone it prefers to p; and at most one proposer has reached its last choice.
The state reached by deferred acceptance.
The final state satisfies the invariant.
Every intermediate rejection count is bounded by the final one.
No proposer is outranked in the final state.
Distinct proposers end at distinct receivers.
The proposer-proposing deferred-acceptance matching.
Proposer p is matched to the receiver it proposes to in the final state.
Proposer p ends at its choice of rank finalState p.
Deferred acceptance outputs a stable matching ([GS62], Theorem 1).
Proposer-optimality ([GS62], Theorem 2): every proposer weakly prefers its deferred-acceptance partner to its partner in any stable matching.
The number of proposals made by deferred acceptance: proposer p proposed to its first
finalState p + 1 choices.
The number of proposals depends only on the output: proposer p proposed to every receiver
that it ranks no lower than its final partner.
Deferred acceptance is the proposer-optimal stable matching.
Deferred acceptance is receiver-pessimal ([McVW71]).
Every market has a (unique) proposer-optimal stable matching.
Receiver-proposing deferred acceptance: run deferred acceptance on the swapped market.
Receiver-proposing deferred acceptance is receiver-optimal.
Receiver-proposing deferred acceptance is proposer-pessimal.