\documentclass[11pt]{article} \usepackage[T1]{fontenc} \usepackage[margin=1in]{geometry} \usepackage{amsmath,amssymb,amsthm,mathtools} \usepackage{booktabs,array,longtable} \usepackage{microtype} \usepackage{xcolor} \usepackage{listings} \usepackage[colorlinks=true,linkcolor=blue!55!black,citecolor=blue!55!black,urlcolor=blue!55!black]{hyperref} \hypersetup{pdftitle={A Formally Verified Certificate Proof of the Maximum Number of Stable Matchings for Six Men and Six Women},pdfauthor={Yuran Xiu},pdfkeywords={stable marriage, stable matchings, maximum number, six by six, f(6)=48, rotation poset, order ideals, permanent bound, Lean}} \newtheorem{theorem}{Theorem}[section] \newtheorem{lemma}[theorem]{Lemma} \newtheorem{proposition}[theorem]{Proposition} \newtheorem{corollary}[theorem]{Corollary} \theoremstyle{definition} \newtheorem{definition}[theorem]{Definition} \newtheorem{remark}[theorem]{Remark} \newcommand{\N}{\mathbb N} \newcommand{\Sn}{\mathfrak S_n} \newcommand{\Stab}{\mathcal S} \newcommand{\Ideals}{\mathcal J} \newcommand{\supp}{\operatorname{supp}} \newcommand{\per}{\operatorname{per}} \newcommand{\Safe}{\operatorname{Safe}} \newcommand{\ind}{\mathbf 1} \newcommand{\code}[1]{\texttt{\small\detokenize{#1}}} \lstset{basicstyle=\ttfamily\small,columns=fullflexible,keepspaces=true,breaklines=true,frame=single,framerule=0.3pt,aboveskip=1em,belowskip=1em} \title{A Formally Verified Certificate Proof of the\\Maximum Number of Stable Matchings\\for Six Men and Six Women} \author{Yuran Xiu\\IIIS, Tsinghua University\\\texttt{xiuyr23@mails.tsinghua.edu.cn}} \date{16 October 2026} \begin{document} \maketitle \begin{abstract} We give a complete Lean~4 verification of the theorem that the maximum number of stable matchings for six men and six women with strict complete preferences is $f(6)=48$. Jo (2026) previously proved the unrestricted upper bound, and Benjamin, Converse, and Krieger (1995) supplied an attaining construction. Our contribution is an alternative, fully formalized proof using a finite certificate; the value 48 and the unrestricted theorem are already known. We reduce stable matchings of arbitrary profiles to order ideals of sequences of cyclic partner exchanges in which no man revisits a partner. A weighted frontier recurrence counts these ideals, and a sum of permanents bounds every future continuation. These bounds yield a finite certificate with 135,828 states. The complete argument, including the reduction for arbitrary profiles, certificate soundness, all concrete checks, and an attaining profile, has been formalized and checked in Lean~4. The final unconditional theorem depends only on the standard axioms of Lean and mathlib. \end{abstract} \section{Introduction} In the stable marriage problem, each of $n$ men and $n$ women strictly ranks all members of the other side. A perfect matching is stable if no unmatched pair strictly prefer each other to their assigned partners. Gale and Shapley~\cite{GS62} proved that every such instance has a stable matching. How many stable matchings can one instance have? Write \[ f(n)=\max_P |\Stab(P)|, \] where $P$ ranges over all strict complete preference profiles and $\Stab(P)$ is its set of stable matchings. We give a fully formalized proof of the known value $f(6)=48$, established by Jo~\cite[Theorem~5.1]{Jo26}. \begin{theorem}\label{thm:main} Every strict complete preference profile on six men and six women has at most $48$ stable matchings. Some such profile has exactly $48$ stable matchings. Consequently, $f(6)=48$. \end{theorem} The contribution of this paper is the complete Lean verification of Theorem~\ref{thm:main} by the cycle-schedule and certificate method developed below. The verification starts from arbitrary strict complete preference profiles and includes the structural reduction, certificate soundness, every concrete check, and an attaining profile. The numerical value and the unrestricted upper bound were already proved by Jo~\cite{Jo26}; we make no priority claim for that theorem. The lower-bound construction belongs to the dihedral/Latin family analyzed by Benjamin, Converse, and Krieger~\cite{BCK95}. Our rank tables are taken from Eilers's presentation of the construction attributed to Converse~\cite{EilersLatin}. \paragraph{Previous work.} Benjamin, Converse, and Krieger~\cite{BCK95} studied Latin marriage constructions and gave the order-six lower bound 48. Thurber~\cite{Thurber02} developed further constructions and lower bounds for the extremal function. Eilers's sequences record exact values and lower bounds \cite{EilersExact,EilersLower}. Latin profiles form a restricted class in which the two ranks assigned to each pair have constant sum; Borodin et al.~\cite[Section~3.7]{Borodin24} distinguish these restricted counts from the unrestricted extremal problem. Jo's preprint~\cite{Jo26}, first deposited on 20 September 2026, proves the unrestricted upper bound by a different route. It derives local constraints on rotation posets and proves that a poset with at most fifteen elements, width at most three, and a specified common-incomparability property has at most 48 antichains. The rotation correspondence then gives $f(6)=48$. Our proof instead uses a weighted frontier recurrence and a permanent bound to certify all legal cycle schedules. As described in Jo's verification note~\cite[Section~6]{Jo26}, his Lean development checks the finite-poset core and supporting components, while the passage from stable marriage to that core remains in the manuscript. Our formal development includes its own reduction from preference profiles and proves the unconditional stable-marriage statement in Lean. This difference concerns formal proof coverage: Jo gives a complete mathematical proof of the theorem. We do not claim that the unformalized connections in that development constitute a mathematical gap, or that our method improves the bound. For general $n$, Karlin, Oveis Gharan, and Weber~\cite{KOGW18} proved a simply exponential upper bound on $f(n)$. Palmer and P\'alv\"olgyi~\cite{PP21} subsequently proved the bound $3.55^n+O(1)$. Our formalization concerns one exact finite value; it does not improve the asymptotic exponential base. Lattice and rotation methods underlie the structural part of the proof. In particular, Cai and Thomas~\cite{CT19} give a representation of all stable matchings using a maximal chain. We give the cover and coordinate-clamping arguments needed for our reduction explicitly, and claim no novelty for the classical lattice structure. \paragraph{Proof strategy.} A maximal chain of stable matchings changes one cyclic group of partners at each step. Each man's partners strictly worsen whenever he changes, so he never revisits a partner. We associate to such a sequence the partial order generated by chronological precedence between events sharing a man. Every stable matching injects into an order ideal of this partial order. This order can omit constraints from the full rotation representation; the injection is enough for an upper bound. We count these ideals by a vector indexed by subsets of the men. Together with a normalized matrix of already visited pairs, this vector contains all information needed to update the count along further cyclic exchanges. A permanent bound allows an entire continuation to be certified without listing its events. The resulting certificate checks every legal cycle at every stored state, either by the bound or by a reference to an earlier state. The universal reduction and the entire finite certificate are checked in Lean, culminating in the quantified statement of Theorem~\ref{thm:main}. Sections~\ref{sec:schedules}--\ref{sec:certificate} describe the mathematics; Section~\ref{sec:formal} describes the formal artifact and its verification boundary. \section{Preference profiles and cycle schedules}\label{sec:schedules} We label each side by $[n]=\{0,\ldots,n-1\}$. A profile consists of rank functions $r_m:[n]\to[n]$ for each man $m$ and $s_w:[n]\to[n]$ for each woman $w$, all bijections; smaller ranks are preferred. A matching is a bijection $p:[n]\to[n]$. Its stability condition is \begin{equation}\label{eq:stable} \text{there are no }m,w\text{ such that } r_m(w)