AFTD Auto-Formalizing Theoretical Domains

Matching.ofGS

defimported Lean

Coerce a bijective f : Fin n → Fin n into Matching (Fin n) (Fin n).

Statement

set_option autoImplicit true in
set_option relaxedAutoImplicit true in
open List Finset in
variable {n : ℕ} [NeZero n] in
noncomputable def Matching.ofGS (f : Fin n → Fin n) (hf : Function.Bijective f) :
    Matching (Fin n) (Fin n)
Defined in
EconCSLib, `Matching.ofGS`
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
none listed
Built on 1
  • MatchingA matching is a partial bijection between M and W. matchM i is the partner of i ∈ M (or none if unmatched). matchW j is the…
Used by 3
  • GS.StableMatching.gsStableThe men-proposing Gale–Shapley output, as an element of the lattice of stable matchings.
  • galeShapley_isStableGale-Shapley stability: the DA output has no blocking pair. The statement is in the *market* frame (IsBlocking … (i : M) (j : W)).…
  • GS.gs_partner_isAchievableThe GS output itself witnesses that gs.symm j is achievable for j.

Lean source view module on GitHub

set_option autoImplicit true in
set_option relaxedAutoImplicit true in
open List Finset in
variable {n : ℕ} [NeZero n] in
/-- Coerce a bijective `f : Fin n → Fin n` into `Matching (Fin n) (Fin n)`. -/
noncomputable def Matching.ofGS (f : Fin n → Fin n) (hf : Function.Bijective f) :
    Matching (Fin n) (Fin n) where
  matchM := fun w => some (f w)
  matchW := fun m => some ((Equiv.ofBijective f hf).symm m)
  consistent := by
    intro m w; simp only [Option.some.injEq]
    rw [Equiv.symm_apply_eq]; exact eq_comm
See it in the graphDiscuss this resultChallenge it