Documentation

EconCSLib.MarketDesign.Matching.Lattice

EconCSLib.MarketDesign.Matching.Lattice #

Building blocks for the Conway–Knuth lattice structure on the set of stable matchings of a one-to-one market (#231 item B).

This file currently contains the opposed-preferences lemma, the crux on which the lattice construction rests: across two stable matchings, whenever a man does strictly better, the woman he gains does strictly worse. It is a direct pairwise stability argument (no global counting, no lattice machinery).

The full lattice — stableJoin / stableMeet, their matching-validity and stability, the Lattice instance and distributivity — is tracked as the remainder of #231 item B and builds on this lemma.

References #

theorem GS.opposed_preferences {n : } (w m : Preferences n) (μ : Matching (Fin n) (Fin n)) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) μ) {j wj wj' m' : Fin n} (hμ_j : μ.matchW j = some wj') (hpref : List.idxOf wj (m.prefs j) < List.idxOf wj' (m.prefs j)) (hμ_w : μ.matchM wj = some m') :
List.idxOf m' (w.prefs wj) < List.idxOf j (w.prefs wj)

Opposed preferences. Let μ be a stable matching. If man j is matched to woman wj under another matching ν and strictly prefers wj to his μ-partner wj', then wj strictly prefers her μ-partner m' to j.

Intuition: the two sides' interests are opposed across stable matchings — when a man trades up, the woman he gains trades down. Proof: otherwise (wj, j) would be a blocking pair for μ (he prefers her to his μ-partner by hypothesis; she would prefer him to her μ-partner m'), contradicting stability. Only μ need be stable.

Partner extraction (stable ⇒ perfect) #

noncomputable def GS.wPartner {n : } {w m : Preferences n} (μ : Matching (Fin n) (Fin n)) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) μ) (j : Fin n) :
Fin n

The woman partnered to man j under a stable matching μ (total, since a stable matching of the balanced market is perfect).

Equations
Instances For
    noncomputable def GS.mPartner {n : } {w m : Preferences n} (μ : Matching (Fin n) (Fin n)) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) μ) (i : Fin n) :
    Fin n

    The man partnered to woman i under a stable matching μ.

    Equations
    Instances For
      @[simp]
      theorem GS.matchW_wPartner {n : } {w m : Preferences n} (μ : Matching (Fin n) (Fin n)) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) μ) (j : Fin n) :
      μ.matchW j = some (wPartner μ j)
      @[simp]
      theorem GS.matchM_mPartner {n : } {w m : Preferences n} (μ : Matching (Fin n) (Fin n)) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) μ) (i : Fin n) :
      μ.matchM i = some (mPartner μ i)
      theorem GS.wPartner_eq_iff {n : } {w m : Preferences n} (μ : Matching (Fin n) (Fin n)) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) μ) {i j : Fin n} :
      wPartner μ j = i mPartner μ i = j

      The man-of and woman-of partner maps are inverse to each other.

      The join (man-optimal of two) and its injectivity #

      noncomputable def GS.joinWoman {n : } {w m : Preferences n} (μ ν : Matching (Fin n) (Fin n)) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) μ) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) ν) (j : Fin n) :
      Fin n

      Man j's more-preferred partner across stable matchings μ and ν.

      Equations
      Instances For
        theorem GS.joinWoman_eq_or {n : } {w m : Preferences n} (μ ν : Matching (Fin n) (Fin n)) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) μ) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) ν) (j : Fin n) :
        joinWoman μ ν j = wPartner μ j joinWoman μ ν j = wPartner ν j
        theorem GS.joinWoman_mem_men {n : } {w m : Preferences n} (μ ν : Matching (Fin n) (Fin n)) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) μ) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) ν) {j i : Fin n} (h : joinWoman μ ν j = i) :
        mPartner μ i = j mPartner ν i = j

        If i is man j's join-partner then j is one of i's two men.

        theorem GS.joinWoman_worse_left {n : } {w m : Preferences n} (μ ν : Matching (Fin n) (Fin n)) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) μ) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) ν) {j i : Fin n} (hji : joinWoman μ ν j = i) (hμji : mPartner μ i = j) :
        List.idxOf (mPartner ν i) (w.prefs i) List.idxOf j (w.prefs i)

        If i is the join-partner of her μ-man j, then i weakly prefers her ν-man to j (so j is her worse man).

        theorem GS.joinWoman_worse_right {n : } {w m : Preferences n} (μ ν : Matching (Fin n) (Fin n)) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) μ) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) ν) {j i : Fin n} (hji : joinWoman μ ν j = i) (hνji : mPartner ν i = j) :
        List.idxOf (mPartner μ i) (w.prefs i) List.idxOf j (w.prefs i)

        Dual of joinWoman_worse_left with the roles of μ, ν swapped.

        The join woman-assignment is injective.

        Strict-preference reductions for the ofEquivData market #

        theorem GS.prefM_strict {n : } {w m : Preferences n} {i a b : Fin n} :
        theorem GS.prefW_strict {n : } {w m : Preferences n} {j a b : Fin n} :

        The join as a stable matching #

        noncomputable def GS.joinEquiv {n : } {w m : Preferences n} (μ ν : Matching (Fin n) (Fin n)) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) μ) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) ν) :
        Fin n Fin n

        The join woman-assignment packaged as an equivalence (injective on the finite Fin n, hence bijective).

        Equations
        Instances For
          noncomputable def GS.stableJoin {n : } {w m : Preferences n} (μ ν : Matching (Fin n) (Fin n)) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) μ) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) ν) :
          Matching (Fin n) (Fin n)

          The join μν: each man keeps his more-preferred of the two partners; each woman keeps her less-preferred man.

          Equations
          Instances For
            @[simp]
            theorem GS.stableJoin_matchW {n : } {w m : Preferences n} (μ ν : Matching (Fin n) (Fin n)) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) μ) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) ν) (j : Fin n) :
            (stableJoin μ ν ).matchW j = some (joinWoman μ ν j)
            @[simp]
            theorem GS.stableJoin_matchM {n : } {w m : Preferences n} (μ ν : Matching (Fin n) (Fin n)) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) μ) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) ν) (i : Fin n) :
            (stableJoin μ ν ).matchM i = some ((joinEquiv μ ν ).symm i)
            theorem GS.joinWoman_le_left {n : } {w m : Preferences n} (μ ν : Matching (Fin n) (Fin n)) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) μ) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) ν) (j : Fin n) :
            List.idxOf (joinWoman μ ν j) (m.prefs j) List.idxOf (wPartner μ j) (m.prefs j)
            theorem GS.joinWoman_le_right {n : } {w m : Preferences n} (μ ν : Matching (Fin n) (Fin n)) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) μ) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) ν) (j : Fin n) :
            List.idxOf (joinWoman μ ν j) (m.prefs j) List.idxOf (wPartner ν j) (m.prefs j)

            The join of two stable matchings is stable.

            The meet (man-pessimal of two), dual to the join #

            The meet μν gives every man his worse of the two partners, equivalently every woman her better of the two men. We mirror the join construction over women: meetMan (each woman's preferred man) is the relevant bijection.

            theorem GS.opposed_preferences_women {n : } {w m : Preferences n} (candidate : Matching (Fin n) (Fin n)) (hcandidate : Matching.IsStable (MatchingMarket.ofEquivData w m) candidate) {i mi mi' j' : Fin n} (hcandidate_i : candidate.matchM i = some mi') (hpref : List.idxOf mi (w.prefs i) < List.idxOf mi' (w.prefs i)) (hcandidate_m : candidate.matchW mi = some j') :
            List.idxOf j' (m.prefs mi) < List.idxOf i (m.prefs mi)

            Dual of opposed_preferences: if woman i strictly prefers man mi to her candidate-man mi', then mi strictly prefers his candidate-woman to i.

            noncomputable def GS.meetMan {n : } {w m : Preferences n} (μ ν : Matching (Fin n) (Fin n)) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) μ) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) ν) (i : Fin n) :
            Fin n

            Woman i's more-preferred man across μ and ν.

            Equations
            Instances For
              theorem GS.meetMan_eq_or {n : } {w m : Preferences n} (μ ν : Matching (Fin n) (Fin n)) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) μ) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) ν) (i : Fin n) :
              meetMan μ ν i = mPartner μ i meetMan μ ν i = mPartner ν i
              theorem GS.meetMan_mem_women {n : } {w m : Preferences n} (μ ν : Matching (Fin n) (Fin n)) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) μ) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) ν) {i j : Fin n} (h : meetMan μ ν i = j) :
              wPartner μ j = i wPartner ν j = i
              theorem GS.meetMan_worse_left {n : } {w m : Preferences n} (μ ν : Matching (Fin n) (Fin n)) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) μ) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) ν) {i j : Fin n} (hij : meetMan μ ν i = j) (hμij : wPartner μ j = i) :
              List.idxOf (wPartner ν j) (m.prefs j) List.idxOf i (m.prefs j)
              theorem GS.meetMan_worse_right {n : } {w m : Preferences n} (μ ν : Matching (Fin n) (Fin n)) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) μ) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) ν) {i j : Fin n} (hij : meetMan μ ν i = j) (hνij : wPartner ν j = i) :
              List.idxOf (wPartner μ j) (m.prefs j) List.idxOf i (m.prefs j)
              noncomputable def GS.meetEquiv {n : } {w m : Preferences n} (μ ν : Matching (Fin n) (Fin n)) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) μ) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) ν) :
              Fin n Fin n

              The meet man-assignment packaged as an equivalence.

              Equations
              Instances For
                noncomputable def GS.stableMeet {n : } {w m : Preferences n} (μ ν : Matching (Fin n) (Fin n)) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) μ) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) ν) :
                Matching (Fin n) (Fin n)

                The meet μν: each woman keeps her more-preferred man; each man keeps his less-preferred woman.

                Equations
                Instances For
                  @[simp]
                  theorem GS.stableMeet_matchM {n : } {w m : Preferences n} (μ ν : Matching (Fin n) (Fin n)) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) μ) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) ν) (i : Fin n) :
                  (stableMeet μ ν ).matchM i = some (meetMan μ ν i)
                  @[simp]
                  theorem GS.stableMeet_matchW {n : } {w m : Preferences n} (μ ν : Matching (Fin n) (Fin n)) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) μ) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) ν) (j : Fin n) :
                  (stableMeet μ ν ).matchW j = some ((meetEquiv μ ν ).symm j)
                  theorem GS.meetMan_le_left {n : } {w m : Preferences n} (μ ν : Matching (Fin n) (Fin n)) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) μ) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) ν) (i : Fin n) :
                  List.idxOf (meetMan μ ν i) (w.prefs i) List.idxOf (mPartner μ i) (w.prefs i)
                  theorem GS.meetMan_le_right {n : } {w m : Preferences n} (μ ν : Matching (Fin n) (Fin n)) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) μ) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) ν) (i : Fin n) :
                  List.idxOf (meetMan μ ν i) (w.prefs i) List.idxOf (mPartner ν i) (w.prefs i)

                  The meet of two stable matchings is stable.

                  Order-theoretic characterizations of join and meet #

                  theorem GS.wPartner_stableJoin {n : } {w m : Preferences n} (μ ν : Matching (Fin n) (Fin n)) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) μ) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) ν) (j : Fin n) :
                  wPartner (stableJoin μ ν ) j = joinWoman μ ν j
                  theorem GS.wPartner_stableMeet {n : } {w m : Preferences n} (μ ν : Matching (Fin n) (Fin n)) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) μ) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) ν) (j : Fin n) :
                  wPartner (stableMeet μ ν ) j = (meetEquiv μ ν ).symm j
                  theorem GS.meetEquiv_symm_eq_or {n : } {w m : Preferences n} (μ ν : Matching (Fin n) (Fin n)) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) μ) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) ν) (j : Fin n) :
                  (meetEquiv μ ν ).symm j = wPartner μ j (meetEquiv μ ν ).symm j = wPartner ν j

                  The meet woman of man j is one of his two partners (his worse).

                  theorem GS.stableMeet_ge_left {n : } {w m : Preferences n} (μ ν : Matching (Fin n) (Fin n)) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) μ) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) ν) (j : Fin n) :
                  List.idxOf (wPartner μ j) (m.prefs j) List.idxOf ((meetEquiv μ ν ).symm j) (m.prefs j)
                  theorem GS.stableMeet_ge_right {n : } {w m : Preferences n} (μ ν : Matching (Fin n) (Fin n)) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) μ) ( : Matching.IsStable (MatchingMarket.ofEquivData w m) ν) (j : Fin n) :
                  List.idxOf (wPartner ν j) (m.prefs j) List.idxOf ((meetEquiv μ ν ).symm j) (m.prefs j)

                  The lattice of stable matchings #

                  def GS.StableMatching {n : } (w' m' : Preferences n) :

                  The type of stable matchings of a one-to-one market.

                  Equations
                  Instances For
                    noncomputable def GS.StableMatching.partner {n : } {w m : Preferences n} (μ : StableMatching w m) (j : Fin n) :
                    Fin n

                    Man j's partner under a stable matching.

                    Equations
                    Instances For
                      theorem GS.StableMatching.matchW_partner {n : } {w m : Preferences n} (μ : StableMatching w m) (j : Fin n) :
                      (↑μ).matchW j = some (μ.partner j)
                      @[implicit_reducible]

                      Men-preference order: μν iff every man weakly prefers his ν-partner to his μ-partner (smaller idxOf = more preferred).

                      Equations
                      • One or more equations did not get rendered due to their size.
                      @[implicit_reducible]
                      noncomputable instance GS.StableMatching.instLattice {n : } {w m : Preferences n} :

                      Conway–Knuth lattice. The stable matchings of a one-to-one market form a lattice under the men-preference order: the join gives every man his more- preferred of two partners, the meet his less-preferred, and both are stable.

                      Equations
                      • One or more equations did not get rendered due to their size.

                      Men-optimality as the lattice maximum #

                      noncomputable def GS.StableMatching.gsStable {n : } (w' m' : Preferences n) [NeZero n] :

                      The men-proposing Gale–Shapley output, as an element of the lattice of stable matchings.

                      Equations
                      Instances For

                        The GS output is the greatest stable matching in the men-preference order: every man weakly prefers his GS partner to his partner in any other stable matching. This is galeShapley_isProposingOptimal packaged as the lattice maximum (-like greatest element).

                        gsStable is the greatest element of the stable-matching lattice.