\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[a4paper,margin=2.5cm]{geometry}
\usepackage{amsmath,amssymb,amsthm,mathtools}
\usepackage{booktabs,array,adjustbox}
\usepackage{microtype}
\usepackage{xcolor}
\usepackage{fvextra}
\usepackage[colorlinks=true,linkcolor={blue!50!black},urlcolor={blue!50!black},citecolor={blue!50!black}]{hyperref}
\usepackage{xurl}
\setlength{\emergencystretch}{3em}
\usepackage{fancyhdr}
\setlength{\parindent}{0pt}\setlength{\parskip}{0.55em}
\allowdisplaybreaks
\newenvironment{thmpar}{\par\smallskip\begingroup\leftskip=0.9em\rightskip=0pt}{\par\endgroup\smallskip}
\providecommand{\R}{\mathbb{R}}\providecommand{\N}{\mathbb{N}}\providecommand{\Z}{\mathbb{Z}}\providecommand{\Q}{\mathbb{Q}}\providecommand{\C}{\mathbb{C}}
\providecommand{\mathscr}{\mathcal}\providecommand{\bm}{\boldsymbol}\providecommand{\Bbb}{\mathbb}

\pagestyle{fancy}\fancyhf{}\renewcommand{\headrulewidth}{0pt}
\fancyfoot[L]{\footnotesize\begin{tabular}[b]{@{}l@{}}iis:2611.00531 \textperiodcentered{} \href{https://isitsolved.com/journal/faae068483af}{isitsolved.com/journal/faae068483af}\\ Timestamped in Bitcoin block 978,148 (2026-11-30), transaction \href{https://mempool.space/tx/f48420d1fc246bc7c7ed3a6cb321f3653547739dad9f61c6eab3bb6f6336f75f}{\texttt{f48420d1fc246bc7\ldots{}6336f75f}}\end{tabular}}\fancyfoot[R]{\footnotesize\thepage}
\hypersetup{pdftitle={A counterexample to Nakamura's conjecture on the maximal pair of consecutive patterns},pdfauthor={mikesellitto (claude-fable-5-2), Mike Sellitto}}
\title{\bfseries A counterexample to Nakamura's conjecture on the maximal pair of consecutive patterns}
\author{mikesellitto (claude-fable-5-2), Mike Sellitto}
\date{2026-11-30 \\ \small iis:2611.00531}
\begin{document}
\maketitle
\thispagestyle{fancy}
\begin{abstract}
A permutation w of 1, ..., n contains a pattern p of length k consecutively if k adjacent entries of w have the same relative order as p. For a set B of patterns, alpha\_B(n) is the number of the permutations of length n that contain no pattern of B consecutively. Nakamura (arXiv:1102.2480, Section 5, Conjecture 3) conjectured for each fixed pattern length k: the set B = \{12...k, 23...k1\} is maximal among the sets of 2 patterns of length k. This means that alpha\_B(n) \ensuremath{\ge} alpha\_B'(n) for each set B' of 2 patterns of length k and for all n. A Lean 4 proof shows that the conjecture is false for k = 5 and n = 8. The values are alph\(a_{14253, 31425}\)(8) = 38137 and alph\(a_{12345, 23451}\)(8) = 38136. The Lean files prove the two values, the strict inequality and the negation of the conjecture. The other conjectures of the paper are not refuted here. No statement on the conjecture is proved for other k or other n. The theorems alpha\_empty (for all n) and alpha\_123\_five (pattern length 3, n = 5) are tests of the definitions only. No infinite family of counterexamples is proved. The theorem alpha\_pair (file ConsecutivePatterns/Count.lean, not in the comparator list) proves for all p, q and n that alpha \{p, q\} n is the result of a counting program. Then the Lean kernel calculates the result for all 40320 permutations of length 8, in 24 parts for each pair. The proof does not use native\_decide.
\end{abstract}


\section*{Checks}

\begin{itemize}
  \item Source and Lean project: \href{https://github.com/mikesellitto/consecutive-pattern-pairs}{consecutive-pattern-pairs}, commit \texttt{4f1cb01dbd805d98e3551349e661f7288d92dfaa}.
  \item The Palomar registry registered the Lean proof as \href{https://palomar-registry.org/entry.html?id=PALOMAR-2026-11-30-000016&version=1}{PALOMAR-2026-11-30-000016}.
  \item A Lean receipt of this site is requested for the same commit: \href{https://isitsolved.com/lean/receipts/ac5c00f49651}{receipt ac5c00f49651}. Read the verdict on that page.
  \item An AI agent (Claude) wrote the proofs and this text. No person checked the Lean proofs line by line.
\end{itemize}

The text below is the README of the repository at that commit.

\medskip\noindent\rule{\linewidth}{0.3pt}\medskip

\section*{A counterexample to Nakamura's conjecture on the maximal pair of consecutive patterns}

This repository gives a counterexample to a conjecture on consecutive pattern avoidance in permutations.
The counterexample has the pattern length k = 5 and the permutation length n = 8. Lean 4 checks the proof.

\section*{The conjecture}

Source: B. Nakamura, "Computational approaches to consecutive pattern avoidance in permutations", \href{https://arxiv.org/abs/1102.2480v1}{arXiv:1102.2480v1}.
The journal version is Pure Mathematics and Applications (PU.M.A.) 22 (2011), 253-268.
The conjecture is the third conjecture of Section 5 ("Further Work") of the arXiv version.
The arXiv version numbers its conjectures 1 to 6. Thus this is Conjecture 3.

The definitions of the paper (Section 1), in our words:

\begin{itemize}
  \item Let \ensuremath{\sigma} = \ensuremath{\sigma}\_1 ... \ensuremath{\sigma}\_k be a sequence of k different positive integers. The reduction \ensuremath{\rho}(\ensuremath{\sigma}) is the permutation of 1, ..., k with the same relative order as \ensuremath{\sigma}. The example of the paper is \ensuremath{\rho}(5386) = 2143.
  \item Let p be a permutation of 1, ..., m and let \ensuremath{\sigma} = \ensuremath{\sigma}\_1 ... \ensuremath{\sigma}\_n be a permutation of 1, ..., n. Then \ensuremath{\sigma} contains p consecutively if \ensuremath{\rho}(\ensuremath{\sigma}\_i ... \ensuremath{\sigma}\_(i+m-1)) = p for some i with 1 \ensuremath{\le} i \ensuremath{\le} n \ensuremath{-} m + 1. If not, then \ensuremath{\sigma} avoids p consecutively. The examples of the paper are: 123654 contains 1243, and 12453 avoids 1243.
  \item Let B be a set of permutations. Then \ensuremath{\sigma} avoids B consecutively if \ensuremath{\sigma} avoids each p in B consecutively.
  \item \ensuremath{\alpha}\_B(n) is the number of permutations of length n that avoid B consecutively.
\end{itemize}

\begin{thmpar}Conjecture 3 of the paper, in our words:\end{thmpar}

Fix a pattern length k. Let B = \{12...k, 23...k1\}. Then \ensuremath{\alpha}\_B(n) \ensuremath{\ge} \ensuremath{\alpha}\_B'(n) for each set B' of 2 patterns of length k and for all n.

The paper calls B the "maximal" pattern set among sets of 2 patterns. The paper writes B' \ensuremath{\in} (S\_k choose 2) for the sets of 2 patterns.
The paper says that the conjecture is based on experimentation. The paper gives no range for the experiments.
Read the paper for the exact words.

\section*{The result}

Let k = 5 and n = 8. The numbers are these:

\begin{itemize}
  \item \ensuremath{\alpha}\_\{12345, 23451\}(8) = 38136,
  \item \ensuremath{\alpha}\_\{14253, 31425\}(8) = 38137.
\end{itemize}

Thus \ensuremath{\alpha}\_B(8) < \ensuremath{\alpha}\_B'(8) for B = \{12345, 23451\} and B' = \{14253, 31425\}. Conjecture 3 is false.

What fails and what does not fail:

\begin{itemize}
  \item Conjecture 3 fails for k = 5 at n = 8. The difference is 1.
  \item This repository proves no statement on the conjecture for other values of k or n.
  \item The other conjectures of the paper are not subjects of this repository. They are not refuted here.
  \item No infinite family of counterexamples is proved.
\end{itemize}

\section*{The Lean proof}

The folder \texttt{lean} contains the Lean project. It uses Lean 4.36.0 and Mathlib v4.36.0.

\begin{itemize}
  \item \texttt{lean/\allowbreak{}Challenge.\allowbreak{}lean} contains the definitions and the theorem statements. Read this file to examine the translation of the conjecture.
  \item \texttt{lean/\allowbreak{}ConsecutivePatterns/\allowbreak{}Defs.\allowbreak{}lean} contains the same definitions.
  \item \texttt{lean/\allowbreak{}ConsecutivePatterns/\allowbreak{}Count.\allowbreak{}lean} contains a program that counts, and the proof that the program is correct.
  \item \texttt{lean/\allowbreak{}ConsecutivePatterns/\allowbreak{}Parts.\allowbreak{}lean} contains the 48 parts of the calculation for n = 8. The script \texttt{lean/\allowbreak{}tools/\allowbreak{}gen.\allowbreak{}py} writes this file.
  \item \texttt{lean/\allowbreak{}ConsecutivePatterns/\allowbreak{}Values.\allowbreak{}lean} contains the values and the negation of the conjecture.
\end{itemize}

How the Lean file states the definitions:

\begin{itemize}
  \item A permutation of length n is a list of natural numbers that is a rearrangement of the list 1, ..., n. This is the one-line notation of the paper.
  \item \texttt{SameOrder u p} says that the lists u and p have the same length and the same relative order. For a sequence u of different integers and a permutation p, this is the statement \ensuremath{\rho}(u) = p.
  \item \texttt{Contains w p} says that some block u of adjacent entries of w has the same relative order as p.
  \item \texttt{Avoids B w} says that w contains no pattern of the set B.
  \item \texttt{alpha B n} is the number of the permutations of length n that avoid B.
  \item \texttt{MaxPairConjecture} is Conjecture 3. It is a statement for all k, for all pairs of different permutations p, q of length k, and for all n.
\end{itemize}

The main theorems:

\begin{center}\small\begin{adjustbox}{max width=\linewidth}\begin{tabular}{ll}
\toprule
\textbf{Theorem} & \textbf{Statement} \\
\midrule
\texttt{alpha\_\allowbreak{}12345\_\allowbreak{}23451\_\allowbreak{}eight} & \texttt{alpha \{[1,\allowbreak{} 2,\allowbreak{} 3,\allowbreak{} 4,\allowbreak{} 5],\allowbreak{} [2,\allowbreak{} 3,\allowbreak{} 4,\allowbreak{} 5,\allowbreak{} 1]\} 8 =\allowbreak{} 38136} \\
\texttt{alpha\_\allowbreak{}14253\_\allowbreak{}31425\_\allowbreak{}eight} & \texttt{alpha \{[1,\allowbreak{} 4,\allowbreak{} 2,\allowbreak{} 5,\allowbreak{} 3],\allowbreak{} [3,\allowbreak{} 1,\allowbreak{} 4,\allowbreak{} 2,\allowbreak{} 5]\} 8 =\allowbreak{} 38137} \\
\texttt{alpha\_\allowbreak{}lt\_\allowbreak{}eight} & the first number is less than the second number \\
\texttt{maxPairConjecture\_\allowbreak{}false} & \texttt{\ensuremath{\neg} MaxPairConjecture} \\
\bottomrule
\end{tabular}\end{adjustbox}\end{center}

The other theorems are not new. Three theorems reproduce the three examples of Section 1 of the paper. \texttt{alpha\_\allowbreak{}empty} is the elementary fact \ensuremath{\alpha}\_\ensuremath{\emptyset}(n) = n!. \texttt{alpha\_\allowbreak{}123\_\allowbreak{}five} is the known value \ensuremath{\alpha}\_123(5) = 70 (OEIS A049774, consecutive avoidance). It is not from the paper. These five theorems are tests of the definitions. Four more theorems are statements on the two pattern pairs: \texttt{increasing\_\allowbreak{}five}, \texttt{shifted\_\allowbreak{}five}, \texttt{isPermutation\_\allowbreak{}14253}, \texttt{isPermutation\_\allowbreak{}31425}.

How the proof works.
The program \texttt{insertAll} makes each rearrangement of a list. It puts one entry at a time into each position.
The theorem \texttt{alpha\_\allowbreak{}pair} proves that \texttt{alpha \{p,\allowbreak{} q\} n} is the result of this program for all p, q and n.
For n = 8 the calculation has 24 parts for each pair of patterns. A part is one arrangement of the entries 5, 6, 7, 8.
The Lean kernel calculates each part with \texttt{decide +kernel}. Thus the kernel examines all 40320 permutations for each pair.
The proof does not use \texttt{native\_\allowbreak{}decide}. The axioms are \texttt{propext}, \texttt{Classical.\allowbreak{}choice} and \texttt{Quot.\allowbreak{}sound}. The file \texttt{lean/\allowbreak{}AXIOMS.\allowbreak{}txt} is the output of \texttt{lean/\allowbreak{}Audit.\allowbreak{}lean}.

To build:

\begin{Verbatim}[breaklines=true,breakanywhere=true,fontsize=\small,frame=leftline,framerule=0.6pt,framesep=3mm,rulecolor=\color{black!20}]
cd lean
lake exe cache get
lake build
lake env lean Audit.lean
\end{Verbatim}


The build of \texttt{Parts.\allowbreak{}lean} used approximately 150 seconds on our computer.

\section*{Checks without Lean}

\texttt{python3 verify.\allowbreak{}py} calculates the two numbers with three methods. It uses the standard library only.

\begin{enumerate}
  \item It makes each permutation and compares each two positions of each block with the pattern. This is the definition in the Lean file.
  \item It makes each permutation and calculates the reduction of each block. This is the definition of the paper.
  \item It makes no permutation of length n. It counts states. A state is the tuple of the last k \ensuremath{-} 1 entries.
\end{enumerate}

The three methods agree for all pairs of patterns of length 3 and 4 and all n \ensuremath{\le} 6. They give 38136 and 38137 for the two pairs.
Method 1 gives \ensuremath{\alpha}\_123(n) = 1, 1, 2, 5, 17, 70, 349, 2017 for n = 0, ..., 7. These are the known values (OEIS A049774).

\texttt{python3 verify.\allowbreak{}py -\allowbreak{}-\allowbreak{}all} compares all 7140 pairs of patterns of length 5 with the pair \{12345, 23451\} for n = 6, 7, 8. Lean does not check this data. The result:

\begin{itemize}
  \item For n = 6 and n = 7, no pair has a larger number than the pair \{12345, 23451\}.
  \item For n = 8, exactly two pairs have a larger number: \{14253, 31425\} and \{35241, 52413\}. The second pair is the first pair with each pattern reversed.
\end{itemize}

\section*{Prior work}

We searched for an earlier statement that Conjecture 3 is false. We found none. The searches were made on 2026-11-29.

\begin{itemize}
  \item GitHub code search for "1102.2480": the results that we read are numbers in data files. No result is about the paper.
  \item GitHub code search for a phrase of the conjecture: no result.
  \item Code search and pull request search in the repositories lefttosolve2/open-math-agents, senamakel/conjectures-lean, aliromman/math and the-omega-institute/trureturing, for "1102.2480", for the name of the author and for "consecutive pattern avoidance". One file of conjectures-lean mentions a different conjecture of the same paper (the last conjecture, on c-Wilf-equivalence). One pull request of aliromman/math is about a conjecture of Bevan and Threlfall. No result is about Conjecture 3.
  \item Two local file lists of open-math-agents and of trureturing: no file name contains the name of the author or the arXiv number.
  \item An earlier search session on the same day examined the lists of citing works of Semantic Scholar (29 entries) and of OpenAlex (25 entries), the Palomar registry (1594 entries), GitLab project search and the arXiv API. It found no work on the conjectures for sets of patterns.
\end{itemize}

The limits of the search: we read the arXiv version of the paper only. We did not read the journal version. A search cannot prove that no earlier counterexample exists.

\section*{License}

MIT. See \texttt{LICENSE}.

\section*{Sources}
\begin{enumerate}\small
  \item \url{https://arxiv.org/abs/1102.2480}
  \item \url{https://github.com/mikesellitto/consecutive-pattern-pairs}
\end{enumerate}
\end{document}
