Documentation

CslibFrontier.Algorithms.Lean.StableMatching.Basic

Stable matchings #

This module sets up the one-to-one two-sided matching model of [GS62]: n proposers and n receivers, both indexed by Fin n, each with a strict and complete preference order over the other side. A matching pairs proposer p with receiver μ p for a permutation μ, so every matching is perfect. A pair (p, r) blocks μ when each strictly prefers the other to its partner in μ; a matching is stable when no pair blocks it.

Preferences are permutations listing agents from most to least preferred: propPref p k is proposer p's k-th choice, with rank 0 the favourite, and recvPref r k likewise. Ranks are read off the inverse permutation (propRank, recvRank), so a smaller rank is better.

Main definitions #

Main results #

References #

A one-to-one two-sided market with n proposers and n receivers, both indexed by Fin n. propPref p k is proposer p's k-th choice and recvPref r k is receiver r's k-th choice (rank 0 is the most preferred). Preferences are strict and complete.

  • propPref : Fin n → Equiv.Perm (Fin n)

    Proposer p's preference list, from most to least preferred receiver.

  • recvPref : Fin n → Equiv.Perm (Fin n)

    Receiver r's preference list, from most to least preferred proposer.

@[reducible, inline]

A matching pairs proposer p with receiver μ p; μ.symm r is receiver r's partner.

A computable permutation from an injective self-map of Fin n. For a concrete map the injectivity proof defaults to decide, so permOfInjective ![2, 0, 1] lists the agents 2, 0, 1 in order.

The rank of receiver r in proposer p's list (0 is the favourite).

The rank of proposer p in receiver r's list (0 is the favourite).

Proposer p strictly prefers receiver r to receiver r'.

Instances For

    Receiver r strictly prefers proposer p to proposer p'.

    Instances For
      @[instance_reducible]
      @[instance_reducible]

      (p, r) blocks μ when p strictly prefers r to μ p and r strictly prefers p to its partner μ.symm r.

      Instances For

        A matching is stable when no pair blocks it.

        Instances For
          theorem Cslib.Algorithms.Lean.StableMatching.Instance.IsStable.recvRank_lt {n : ℕ} {I : Instance n} {μ : Matching n} (hμ : I.IsStable μ) {p r : Fin n} (hp : I.propRank p r < I.propRank p (μ p)) :
          I.recvRank r ((Equiv.symm μ) r) < I.recvRank r p

          In a stable matching, a receiver that p strictly prefers to its partner strictly prefers its own partner to p.

          Exchanging the two sides #

          The market with the roles of proposers and receivers exchanged.

          μ.symm is stable for the swapped market exactly when μ is stable.

          Misreports #

          The instance in which proposer p reports the list π and everyone else reports truthfully.

          The instance in which receiver r reports the list π and everyone else reports truthfully.

          A receiver's misreport is a proposer's misreport in the swapped market.

          Optimal and pessimal stable matchings #

          A stable matching that every proposer weakly prefers to every stable matching.

          A stable matching that every proposer weakly dislikes relative to every stable matching.

          A stable matching that every receiver weakly prefers to every stable matching.

          A stable matching that every receiver weakly dislikes relative to every stable matching.

          theorem Cslib.Algorithms.Lean.StableMatching.Instance.recvRank_le_of_propRank_le {n : ℕ} (I : Instance n) {μ ν : Matching n} (hν : I.IsStable ν) (h : ∀ (p : Fin n), I.propRank p (μ p) ≤ I.propRank p (ν p)) (r : Fin n) :
          I.recvRank r ((Equiv.symm ν) r) ≤ I.recvRank r ((Equiv.symm μ) r)

          Opposing interests (see [GI89]): if every proposer weakly prefers μ to the stable matching ν, then every receiver weakly prefers ν to μ.

          theorem Cslib.Algorithms.Lean.StableMatching.Instance.propRank_le_of_recvRank_le {n : ℕ} (I : Instance n) {μ ν : Matching n} (hν : I.IsStable ν) (h : ∀ (r : Fin n), I.recvRank r ((Equiv.symm μ) r) ≤ I.recvRank r ((Equiv.symm ν) r)) (p : Fin n) :
          I.propRank p (ν p) ≤ I.propRank p (μ p)

          The symmetric form: if every receiver weakly prefers μ to the stable matching ν, then every proposer weakly prefers ν to μ.

          There is at most one proposer-optimal stable matching.