\documentclass[11pt,a4paper]{article} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{amsmath,amsthm} \usepackage{newpxtext,newpxmath} \usepackage{iftex} \ifPDFTeX \usepackage[varqu,varl,scaled=0.88]{zi4} \else \usepackage{fontspec} \setmonofont[Scale=0.88]{Inconsolatazi4-Regular.otf} \fi \usepackage[margin=1.1in]{geometry} \usepackage{microtype} \usepackage{mathtools} \usepackage{booktabs} \usepackage{enumitem} \usepackage{tikz} \usepackage{xcolor} \definecolor{linkblue}{RGB}{30,70,140} \usepackage[colorlinks=true,linkcolor=linkblue,citecolor=linkblue,urlcolor=linkblue]{hyperref} \usepackage[capitalise,nameinlink]{cleveref} \setlist{itemsep=2pt,topsep=4pt} \linespread{1.04} \emergencystretch=2.5em \newtheorem{theorem}{Theorem} \renewcommand{\thetheorem}{\Alph{theorem}} \newtheorem{thm}{Theorem}[section] \newtheorem{lemma}[thm]{Lemma} \newtheorem{proposition}[thm]{Proposition} \newtheorem{corollary}[thm]{Corollary} \theoremstyle{definition} \newtheorem{definition}[thm]{Definition} \theoremstyle{remark} \newtheorem{remark}[thm]{Remark} \crefname{thm}{Theorem}{Theorems} \newcommand{\OO}{\mathbb{O}} \newcommand{\ZZ}{\mathbb{Z}} \newcommand{\RR}{\mathbb{R}} \newcommand{\CC}{\mathbb{C}} \newcommand{\assoc}[3]{[#1,#2,#3]} \newcommand{\DN}{\mathrm{D}_N} \newcommand{\ctx}{\mathcal{C}} \newcommand{\cS}{\mathcal{S}} \newcommand{\lean}[1]{\texttt{#1}} \newcommand{\Bell}{\mathrm{Bell}} \DeclareMathOperator{\rank}{rank} \DeclareMathOperator{\ev}{ev} \DeclareMathOperator{\supp}{supp} \title{\vspace{-1.2em}\textbf{Flip-connectivity of octonion bracketing classes}\\[0.35em] \large A characterization for all lengths, its Bell-number count,\\ and a Lean~4 formalization} \author{Jes\'us Vilela Jato\\[0.2em] \small Independent researcher, Madrid\\ \small \href{https://github.com/Dojo-1/Lemma-W-count-determinant-witness-}{\texttt{github.com/Dojo-1/Lemma-W-count-determinant-witness-}}} \date{November 2026} \begin{document} \maketitle \begin{abstract} \noindent Fix a word $w=w_1\cdots w_n$ in letters and substitute octonions for the letters. Each of the $C_{n-1}$ bracketings of $w$ is a polynomial map, and bracketings inducing the same map form a \emph{kernel class}. The bracketings are the vertices of the associahedron $K_n$, whose edges are the flips $(AB)C\leftrightarrow A(BC)$. We prove that every kernel class of $w$ induces a connected subgraph of $K_n$ if and only if $w$ has at most two distinct letters or every letter of $w$ occupies a single contiguous run. Consequently, among the $\Bell(n)$ words of length $n$ up to renaming of letters, exactly $\Bell(n)-2^n+n$ have a kernel class that is not flip-connected. The proof has a local and a global part. Locally, a flip that preserves the map must have a letter-count matrix of rank at most two (a count-determinant witness), and for interval words the converse holds by Artin's theorem. Globally, for interval words the components of the graph of rank-$\le2$ flips are separated by an explicit invariant that octonion moments detect; for non-interval words a family of \emph{caterpillar} certificates exhibits two Moufang-equivalent bracketings in different such components. The main theorem, the count and every lemma they use are theorems of a Lean~4 formalization (no \texttt{sorry}, standard axioms only); the one informal step is the remark that polynomial identities over $\ZZ^8$ and over $\RR^8$ coincide. \end{abstract} \noindent\textbf{MSC2020:} Primary 17D05; Secondary 17A35, 05A18, 05A15, 20N02, 05C40, 52B05, 68V20, 68V15.\\[0.2em] \textbf{Keywords:} octonions, alternative algebras, Moufang identities, bracketings, associahedron, flip graph, associative spectrum, Bell numbers, Lean~4, formalized mathematics. \tableofcontents \section{Introduction}\label{sec:intro} In an associative algebra all bracketings of a product agree. In a nonassociative algebra they need not, and the natural question is \emph{which} bracketings agree. For a groupoid $(G,\ast)$, Cs\'ak\'any and Waldhauser~\cite{CW00} introduced the \emph{associative spectrum}: the number $s_n(G)$ of distinct $n$-ary term operations induced by the bracketings of $x_1\cdots x_n$ with pairwise distinct variables. Associative spectra have since been determined for many operations, including graph algebras~\cite{LW22} and linear quasigroups~\cite{LW23}, and extended to $p$-ary operations~\cite{LiW09} and to the associative--commutative setting~\cite{HL22}. The spectrum of an \emph{antiassociative} operation is the Catalan sequence. This paper studies a refinement in which the variables may repeat. Fix a word $w$; the bracketings of $w$ are the vertices of the associahedron $K_n$ (Tamari~\cite{Tam62}, Stasheff~\cite{Sta63}), and two adjacent vertices differ by one \emph{flip} $(AB)C\leftrightarrow A(BC)$ applied inside a context. Over the octonions $\OO$, bracketings inducing the same polynomial map partition the vertex set. Repeated letters create identities such as the Moufang laws~\cite{Mou35}, so the classes are no longer singletons, and it becomes meaningful to ask about their \emph{shape} inside $K_n$. \begin{definition} A kernel class of $w$ is \emph{flip-connected} if any two of its members are joined by a path of flips all of whose vertices lie in the class. A word is \emph{interval} if every letter occupies one contiguous run, e.g.\ $x^ay^bz^c$. \end{definition} \begin{theorem}[Main theorem]\label{thm:main} Every kernel class of bracketings of $w$ over $\OO$ is flip-connected if and only if $w$ has at most two distinct letters or $w$ is an interval word. \end{theorem} \begin{theorem}[Count]\label{thm:count} For $n\ge1$, among the $\Bell(n)$ words of length $n$ up to renaming of letters, exactly $\Bell(n)-2^n+n$ have a kernel class that is not flip-connected. The sequence begins $0,0,0,3,25,145,756,3892,20644,114961$ for $n=1,\dots,10$. \end{theorem} Both are proved below, and both are theorems of the Lean~4 formalization described in \cref{sec:formal}: \lean{MainThm.main} and \lean{Count.count\_disconnected}. The count runs over restricted growth strings, and \lean{Canon.canonical} shows that these contain exactly one word per renaming class. \paragraph{The local criterion.} Let a flip $(AB)C\to A(BC)$ act on consecutive segments $a,b,c$ of $w$, and let $N$ be the $3\times\lvert\Lambda\rvert$ matrix of letter counts of $a,b,c$ ($\Lambda$ the alphabet). By context cancellation (\cref{lem:L1}) the flip stays inside a kernel class exactly when the local associator $\assoc ABC$ vanishes identically. The count-determinant witness (\cref{lem:W}) shows that $\rank N=3$ forces $\assoc ABC\not\equiv0$. We write $\DN$ for the set of flips whose count matrix is degenerate ($\rank N\le2$) and call them \emph{$\DN$-flips}. So in-class flips are $\DN$-flips, and two equal maps in different components of the $\DN$-flip graph certify a disconnected class. The converse fails in general (in $xyzyx$ the flip on $xy\,|\,z\,|\,yx$ has $\rank N=2$ and a nonzero associator), but it holds for interval words (\cref{lem:V,lem:I}). \paragraph{Interval words (Theorem~G2, \cref{thm:G2}).} We classify the $\DN$-components of an interval word by the shapes that a bracketing induces on leaf triples with three distinct letters (\cref{prop:C}), reduce separation to three-block words $x^ay^bz^c$, and describe their components by an explicit invariant (\cref{prop:T}). Substituting $x=1+se_1$, $y=1+qe_2$, $z=1+te_4$ turns every bracketing into a polynomial whose $s^pqt^r$ coefficients are \emph{moments} of the invariant (\cref{lem:M}); these moments determine the invariant (\cref{prop:S}). Hence distinct components are distinct maps. \paragraph{Non-interval words (Theorem~G3, \cref{thm:G3}).} For a three-letter non-interval word we build a bracketing $T_0$ along a \emph{caterpillar}, a sequence of peels of end runs, and a Moufang move $T_0\to T_1$ deleting one of its nodes (\cref{fig:moufang}). The caterpillar's nodes form a \emph{self-certifying} set: every rotation that would delete one of them has a rank-$3$ count matrix (\cref{lem:Cat}), so no $\DN$-path from $T_0$ can lose them (\cref{lem:Rprime}). An induction on run sequences shows that every non-interval three-letter word has such a caterpillar (\cref{prop:E}). Specialising extra letters to $1$ lifts the result to words with more letters (\cref{lem:K}). \paragraph{Formalization.} The development is a Lean~4~\cite{Lean} project of 9{,}252 lines in 30 files using only the core library. Octonion identities are proved by a verified polynomial normaliser, the finite base of the run-sequence induction by kernel evaluation, and everything else by ordinary proofs. The theorems of \cref{tab:lean} depend only on \texttt{propext}, \texttt{Classical.choice} and \texttt{Quot.sound} (log in the repository). A second implementation in Prolog runs the constructions and checks their outputs on small words (\cref{sec:checks}). \paragraph{Scope of valuations.} ``Equal maps'' means equal as polynomial maps, equivalently equal on all real octonions. The formal development quantifies over \emph{integer} octonions $\ZZ^8$. Every bracketing is a polynomial with integer coefficients in the $8\lvert\Lambda\rvert$ coordinates, and a polynomial vanishing on $\ZZ^{8\lvert\Lambda\rvert}$ is zero, so the notions coincide; this is the only step outside the formal proof. \section{Preliminaries}\label{sec:prelim} \subsection{Octonions} Let $\OO$ be the real algebra with basis $e_0=1,e_1,\dots,e_7$ and product $e_ie_j=\varepsilon(i,j)\,e_{i\oplus j}$, where $\oplus$ is bitwise exclusive or and $\varepsilon(i,j)\in\{\pm1\}$ is a Cayley--Dickson sign table~\cite{Bae02} with $e_i^2=-1$ for $i\ge1$. $\OO$ is an alternative division algebra; its norm form $\nu(x)=x\bar x$ is multiplicative. We write $\assoc abc=(ab)c-a(bc)$; the associator is trilinear and alternating, and vanishes when one argument is real. We use: \begin{itemize} \item the Moufang identities~\cite{Mou35} $a(b(ac))=((ab)a)c$, $((ca)b)a=c(a(ba))$, $(ab)(ca)=a((bc)a)$; \item Artin's theorem: the subalgebra generated by any two elements is associative~\cite{Sch66,ZSSS82}; \item for $X,Y,Z\in\operatorname{span}(e_1,e_2,e_4)$ with coordinate vectors $x,y,z\in\RR^3$, $\assoc XYZ=2\det(x,y,z)\,e_7$; in particular $\assoc{e_1}{e_2}{e_4}=2e_7$. \end{itemize} All three are polynomial identities with integer coefficients; in the formalization they are proved for $\ZZ^8$ by a normaliser. \subsection{Words, bracketings, flips} A word $w=w_1\cdots w_n$ is a finite sequence over an alphabet $\Lambda$. A \emph{bracketing} is a planar binary tree $T$ with leaves $1,\dots,n$ in order. For a valuation $\rho\colon\Lambda\to\OO$, $\ev_T(\rho)$ is the product of $\rho(w_1),\dots,\rho(w_n)$ bracketed by $T$, and $T\sim T'$ if $\ev_T=\ev_{T'}$ for all $\rho$. A subtree spans a \emph{segment}, a set of consecutive positions. A \emph{context} $\ctx[\,\cdot\,]$ is a tree with one hole. A \emph{flip} replaces $\ctx[(AB)C]$ by $\ctx[A(BC)]$ or back; bracketings and flips form the associahedron $K_n$. For a flip on segments $a,b,c$ let $N\in\ZZ^{3\times\lvert\Lambda\rvert}$ be the matrix of letter counts. The flip is a \emph{$\DN$-flip} if $\rank N\le2$. Since $N$ depends only on the segments, this does not depend on $A,B,C$ or on the context. \subsection{Run sequences} Collapsing maximal runs of equal letters gives the \emph{run sequence} of $w$; $w$ is interval iff its run sequence has no repeated letter. A word with at least three letters that is not interval contains a pattern $p\cdots q\cdots p$ with $q\ne p$; with any third letter $r$, its restriction to $\{p,q,r\}$ is again non-interval. \section{Local lemmas}\label{sec:local} \begin{lemma}[context cancellation, L1]\label{lem:L1} For every context $\ctx$ and bracketings $S_1,S_2$ of the same segment, $\ctx[S_1]\sim\ctx[S_2]$ iff $S_1\sim S_2$. Consequently a flip $\ctx[(AB)C]\to\ctx[A(BC)]$ stays inside a kernel class iff $\assoc ABC\equiv0$. \end{lemma} \begin{proof} $\ctx[S]$ is $S$ composed with left and right multiplications by values of the other subtrees of $\ctx$. If all letter values are nonzero these values are nonzero, and multiplication by a nonzero octonion is injective since $\nu$ is multiplicative. So $\ctx[S_1]=\ctx[S_2]$ at a valuation with nonzero letters forces $S_1=S_2$ there; such valuations are Zariski dense. The converse is clear. \end{proof} \begin{lemma}[count-determinant witness, W]\label{lem:W} If $\rank N=3$, then $\assoc ABC\not\equiv0$ for all bracketings $A,B,C$ of $a,b,c$. Precisely, if the minor of $N$ on letters $x,y,z$ is $d\ne0$ and $M=2\lvert d\rvert+1$, the integer valuation $x\mapsto1+Me_1$, $y\mapsto1+Me_2$, $z\mapsto1+Me_4$, other letters $\mapsto1$, gives \[ \assoc ABC\equiv 2dM^3e_7 \pmod{M^4\ZZ^8}, \] which is nonzero. All letter values have real part $1$. \end{lemma} \begin{proof} Write the letter values as $1+Mq_\ell$ with $q_x=e_1$, $q_y=e_2$, $q_z=e_4$, $q_\ell=0$ otherwise. Products respect congruences mod $M^4$, so a bracketing $S$ of a segment $s$ satisfies $\ev_S\equiv1+M\Sigma_s+M^2P_2+M^3P_3$, the product of truncated power series, where $\Sigma_s=\sum_\ell N_{s\ell}q_\ell$ depends only on the counts. In the associator of three such elements the terms of order $M^0,M^1,M^2$ cancel because the associator vanishes when an argument is real, and the term of order $M^3$ is $\assoc{\Sigma_a}{\Sigma_b}{\Sigma_c}=2de_7$. If $\assoc ABC=0$ then $M^4\mid2dM^3$, so $M\mid2d$, contradicting $0<\lvert2d\rvertp$. On columns $(x,p,z)$, \[ N_{xpz}=\begin{pmatrix}a_x&a_p&0\\0&b_p&0\\0&c_p&c_z\end{pmatrix},\qquad \det N_{xpz}=a_xb_pc_z\ne0. \] \emph{Case $\lvert\supp(b)\rvert\ge2$}, with $p=\min\supp(b)q$; let $y\in\supp(b)$ with $p0:\zeta(\alpha)\ne0\}$, $c'=\min\{\gamma>0:\xi(\gamma)\ne0\}$, $j=b-\zeta(0)/c'$, and $\zeta_W$ follows; a binary word is determined by its $z$-profile and its number of $x$'s, so $W$ is determined. If $\xi(0)=0$ then $j=0$ and $\zeta=b\,\zeta_{\omega_-}$; if $\zeta(0)=0$ then $j=b$ and $\zeta=b\,\zeta_{\omega_+}$; either way the profile determines the join word, the complete invariant for boundary $j$ (\cref{prop:T}). \end{proof} In the formalization all moments are read off a single integer valuation: the coefficient of $s^pqt^r$ is recovered from one Kronecker point $s=\beta$, $q=\beta^{a+b+c+1}$, $t=\beta^{(a+b+c+1)^2}$ with $\beta=2^{a+b+c+2}+1$, using an explicit bound on all coefficients (\lean{Coeff.coef\_of\_map}). \subsection{Theorem G2} \begin{thm}[G2]\label{thm:G2} In an interval word, two bracketings are equal maps iff they lie in the same $\DN$-component. Every kernel class is a $\DN$-component and is flip-connected. \end{thm} \begin{proof} If $T,T'$ lie in different components, by \cref{prop:C} they differ on a triple with letters $p @decide ($\neg$ KerConn (wd w) w.length)}\\ \hspace*{3em}\lean{(Classical.propDecidable \_))).length + 2\^{}(m+1)}\\ \hspace*{3em}\lean{= bell (m+1) + (m+1)} \end{quote} with \lean{bell n} the number of restricted growth strings of length $n$. \lean{Canon.canonical} proves that every word is a renaming of exactly one of them, \lean{Canon.kerconn\_rename} that \lean{KerConn} is renaming-invariant, and \lean{Canon.bell\_eq\_sum}, \lean{stirling\_rec} identify \lean{bell} with the Bell numbers. \paragraph{Trusted base.} One trusts the Lean kernel, the three standard axioms, and the definitions entering the main statements: the multiplication table and product (\lean{Octonion.lean}), trees (\lean{RPrime.lean}), evaluation, contexts and filling (\lean{Division.lean}), leaf lists, $\DN$-steps and reachability (\lean{Lift.lean}, \lean{Kill.lean}), flips and in-class flips (\lean{Closure.lean}), and \lean{Main.lean}, \lean{Count.lean}, \lean{Canon.lean}. The equivalence of equality on $\ZZ^8$ and on $\RR^8$ (\cref{sec:intro}) is the only informal step. \subsection{Further checks}\label{sec:checks} A second implementation, in Prolog and developed in the same AI-assisted process, runs the constructions of the proofs as programs and checks their outputs: the 44{,}670 caterpillar certificates produced by the induction of \cref{prop:E} up to 12 runs; G3 end to end for all 4{,}330 non-interval three-letter words with $n\le9$, including exact $\DN$-components; the integer witness of \cref{lem:W} on all 20{,}984 rank-$3$ flips of words with $n\le6$; Propositions T, S, C and Lemma M exhaustively on small words; and the counts of \cref{tab:counts} up to $n=10$. Independently of the proof, an exact classifier decides every word with $3\le n\le9$ (26{,}439 words): for non-interval words it finds a move valid in every alternative algebra between two $\DN$-components, and for interval words it separates components by invariants or exact integer evaluation. Its output agrees with \cref{thm:main}. \section{Remarks and questions}\label{sec:remarks} \paragraph{Locality.} A stronger, local form of G3 asks for a Moufang move toggling an \emph{absolutely rigid} interval, one whose every split has rank $3$ against every adjacent nonempty interval. It holds for $n\le9$ but fails in general: $xyxyzzyxyx$ and $xyyxzzxyyx$ ($n=10$) and four words with $n=12$ have no rigid separator, although G3 holds for them. Self-certifying sets (\cref{lem:Rprime}) repair this: their nodes certify each other rather than individually. \paragraph{Other algebras.} Kernel classes are defined by polynomial identities with integer coefficients, which hold over $\OO$ iff they hold over $\OO\otimes\CC$. The split octonions are another real form of $\OO\otimes\CC$, so they have the same kernel classes, and \cref{thm:main,thm:count} hold for them verbatim. The proof uses that $\OO$ is alternative (Moufang, Artin), that generic elements are invertible (\cref{lem:L1}), and that three units have a nonzero associator (\cref{lem:W}). The same question for the free alternative algebra~\cite{ZSSS82}, where the identities could differ, is open. \paragraph{Quantitative refinements.} A closed form for the number of kernel classes of an arbitrary interval word, i.e.\ the number of realisable triple-shape functions $\tau$ in \cref{prop:C}, would refine \cref{cor:distinct} and the remark after \cref{prop:T}. \section*{Acknowledgements and disclosure} The formal proofs, the Prolog checks and much of the exposition were developed with the assistance of Claude (Anthropic), an AI system, under the author's direction. The statements listed in \cref{tab:lean} are checked by the Lean kernel; the remaining claims are marked as such in the text. The repository contains the full history, the proofs and the logs of every computation. An AI referee report was obtained and addressed before release; it is not a substitute for human review, which this preprint invites. \begin{thebibliography}{99}\small \bibitem{Bae02} J.~C. Baez, The octonions, \emph{Bull. Amer. Math. Soc.} 39 (2002), 145--205. \bibitem{CW00} B.~Cs\'ak\'any and T.~Waldhauser, Associative spectra of binary operations, \emph{Multiple-Valued Logic} 5 (2000), 175--200; arXiv:1102.2124. \bibitem{HL22} J.~Huang and E.~Lehtonen, The associative-commutative spectrum of a binary operation, arXiv:2202.11826. \bibitem{LW22} E.~Lehtonen and T.~Waldhauser, Associative spectra of graph algebras II. Satisfaction of bracketing identities, spectrum dichotomy, \emph{J. Algebraic Combin.}, doi:10.1007/s10801-021-01061-7. \bibitem{LW23} E.~Lehtonen and T.~Waldhauser, Associativity conditions for linear quasigroups and equivalence relations on binary trees, arXiv:2310.09184. \bibitem{LiW09} S.~Liebscher and T.~Waldhauser, On associative spectra of operations, \emph{Acta Sci. Math. (Szeged)} 75 (2009); arXiv:1102.2337. \bibitem{Lean} L.~de Moura and S.~Ullrich, The Lean 4 theorem prover and programming language, in \emph{CADE-28}, LNCS 12699, Springer, 2021, 625--635. \bibitem{Mou35} R.~Moufang, Zur Struktur von Alternativk\"orpern, \emph{Math. Ann.} 110 (1935), 416--430. \bibitem{Sch66} R.~D. Schafer, \emph{An Introduction to Nonassociative Algebras}, Academic Press, 1966. \bibitem{Sta63} J.~D. Stasheff, Homotopy associativity of H-spaces I, II, \emph{Trans. Amer. Math. Soc.} 108 (1963), 275--312. \bibitem{Tam62} D.~Tamari, The algebra of bracketings and their enumeration, \emph{Nieuw Arch. Wisk.} (3) 10 (1962), 131--146. \bibitem{ZSSS82} K.~A. Zhevlakov, A.~M. Slin'ko, I.~P. Shestakov and A.~I. Shirshov, \emph{Rings that are nearly associative}, Academic Press, 1982. \end{thebibliography} \end{document}