% Appendix A. The formal companion of AHM IV. \section{The formal companion}\label{app:formal} \subsection{Scope}\label{ss:formal-scope} The formal companion of this paper consists of nine Lean~4 files, each importing only Mathlib \cite{mathlib2020,deMouraUllrich2021}. They are, with their namespaces: \begin{itemize}[leftmargin=*] \item \code{SpectralRoot} and \code{PositivityTransfer} (\code{WeilTstar}, \code{WeilT}): the spectral transfer of \cref{sec:transfer}; \item \code{ConiveauDissolution} (\code{WeilMStar}): the scalar case of \cref{ss:var-monodromy}; \item \code{HodgeLadder} (\code{WeilD1}) and \code{DivisorialDissolution} (\code{WeilK}): the seed, the ladder, the cubic fourfold and the Picard modular surface; \item \code{AsaiTensor} (\code{WeilAsai}): the identities of the Asai test; \item \code{AmplificationLaw} (\code{WeilR1}): the information principle; \item \code{WeilCriterion} and \code{WeilBarrier}: the statements of \cref{app:weil}. \end{itemize} They contain sixty-five theorems and three definitions. The toolchain is \code{leanprover/lean4:v4.36.0-rc2} with the Mathlib of the companions of the first three papers. The Lean statements formalise linear algebra, polynomial algebra and finite combinatorics. The geometric inputs, namely smooth proper base change, the specialisation of cycles, the Hodge--Riemann relations, the Hodge index theorem, the theorems of Beauville and Donagi, Voisin, Bloch and Srinivas, Tian and Xiao and de Shalit and Goren, and the theorems of the earlier papers of this series, enter as hypotheses of the formal statements or are cited. For every statement whose finite core is verified, the declarations on which it rests are listed in \cref{ss:formal-anchors}. \subsection{Conventions of the formal statements}\label{ss:formal-conventions} Three conventions differ from those of the text. First, \code{WeilTstar.interp\_sqrt} and \code{WeilTstar.spectral\_transfer} are stated for a finite set of negative reals and the square root of $-\Aop$, with the hypothesis $\qform(\Aop w,w)\le0$; they are \cref{lem:spectral-root,lem:transfer} for the operator $-\Aop$. The text uses the divisorial target form $\bt$, which is the opposite of the Hodge index form, so that the comparison operator has positive spectrum; the companion uses the Hodge index form itself. Second, \code{WeilT.transfer\_pos} and \code{WeilT.transfer\_neg} assume a square root $\Rop$ with a right inverse; \code{WeilTstar.spectral\_transfer} constructs it from the minimal polynomial. Third, the strictness lemmas \code{WeilT.semidef\_strict}, \code{WeilD1.strict\_of\_pairing}, \code{WeilMStar.coniveau\_hsc} and \code{WeilD1.divisorial\_hsc} are stated for the restriction of a form to a plane spanned by two vectors, which is how \cref{lem:semidef-def} is applied. \subsection{Verification record}\label{ss:formal-record} Each file is compiled with \code{lake}~\code{env}~\code{lean} against this toolchain, from an unmodified copy to which a \code{#print}~\code{axioms} line is appended for every theorem that has none. The verification requires that no file has an error or uses \code{sorry}, and that every theorem depends on no axiom other than \code{propext}, \code{Classical.choice} and \code{Quot.sound}. All sixty-five theorems pass (\cref{tab:formal-files}). The record of the verification and the list of anchors are part of the deposit. \begin{table}[ht] \centering \small \begin{tabular}{@{}llrl@{}} \toprule file & namespace & theorems & used in\\\midrule \code{SpectralRoot} & \code{WeilTstar} & $8$ & \cref{sec:transfer,sec:rational}\\ \code{PositivityTransfer} & \code{WeilT} & $7$ & \cref{sec:signs,sec:specialization,sec:transfer}\\ \code{ConiveauDissolution} & \code{WeilMStar} & $6$ & \cref{sec:variants}\\ \code{HodgeLadder} & \code{WeilD1} & $9$ & \cref{sec:cubic,sec:ladder}\\ \code{DivisorialDissolution} & \code{WeilK} & $11$ & \cref{sec:signs,sec:cubic,sec:ladder}\\ \code{AsaiTensor} & \code{WeilAsai} & $4$ & \cref{sec:rank7}\\ \code{AmplificationLaw} & \code{WeilR1} & $14$ & \cref{sec:information}\\ \code{WeilCriterion} & -- & $2$ & \cref{app:weil}\\ \code{WeilBarrier} & -- & $4$ & \cref{app:weil}\\ \bottomrule \end{tabular} \caption[The files of the formal companion]{The files of the formal companion. Every theorem depends only on the three axioms named in \cref{ss:formal-record}.}\label{tab:formal-files} \end{table} \subsection{Anchors}\label{ss:formal-anchors} The anchors of the statements are collected in this appendix rather than in the body: for every statement whose finite core is verified, \cref{tab:anchors-a,tab:anchors-b} give the declarations of the companion on which it rests, grouped by namespace, and the verification checks each of them against the declarations of the companion. \input{generated/lean-anchors.tex}