\section{Introduction}\label{sec:introduction} A heterogeneous divisible good---the \emph{cake}, modeled as the interval $[0,1]$---is to be divided among $n$ agents with different valuations. An allocation is \emph{envy-free} if every agent values her own bundle at least as much as every other agent's bundle, and \emph{complete} if all of the cake is allocated. Complete envy-free allocations always exist~\citep{RobertsonWebb1998}, but valuations are infinite objects, so an algorithm must learn them through queries. In the Robertson--Webb (RW) model an \emph{evaluation query} asks one agent for her value of an interval, and a \emph{cut query} asks her for a point at which an interval starting at a given point attains a given value. The basic complexity question is therefore: \begin{center} \emph{How many RW queries are needed to find a complete envy-free allocation among $n$ agents?} \end{center} The history of this question is a history of very large numbers. Brams and Taylor~\citep{BramsTaylor1995} gave the first finite protocol for every $n$, but its number of queries cannot be bounded by any function of $n$: it depends on the valuations. Twenty years later, Aziz and Mackenzie~\citep{AzizMackenzie2016,AzizMackenzieFour2016} gave the first \emph{bounded} protocol, with a tower-of-exponentials bound. Subsequent work improved this to $n^{O(n^2)}$ (Sokolov~\citep{Sok23}), to $n^{O(1)}2^{n}$ (Ye and Bai~\citep{YeBai2026}), and to an elementary $2^{O(n\log n)}$ protocol (Psomas~\citep{Psomas2026}). Recently Aziz~\citep{Aziz2026} broke the exponential barrier with a deterministic protocol using $O(n^6\log n)$ queries. On the other side, the best lower bound is Procaccia's $\Omega(n^2)$~\citep{Procaccia2009}; a cubic lower bound was announced in a footnote of a survey by Aziz and Mackenzie~\citep[Footnote~2]{AzizMackenzie2017}, attributed to Mackenzie's thesis~\citep{Mackenzie2017}. \subsection{Our results} We settle the deterministic query complexity up to constant factors. \begin{theorem}[Upper bound; \cref{cubic:main}]\label{thm:upper} There is a deterministic RW protocol that, for every $n$ and every profile of finite nonnegative nonatomic valuations on $[0,1]$, returns a complete envy-free allocation into finite unions of intervals using $O(n^3)$ queries. The bound holds for every legal choice of answers to cut queries. \end{theorem} \begin{theorem}[Deterministic lower bound; \cref{detlb:main}]\label{thm:detlb} For every $\eps>0$, every deterministic RW protocol that always returns a complete envy-free allocation uses $\Omega(n^3)$ queries on some profile of normalized valuations with smooth densities in $(1-\eps,1+\eps)$. This holds even if bundles may consist of arbitrarily many intervals whose endpoints were never queried. \end{theorem} \noindent Together they improve the previous deterministic bounds, $\Omega(n^2)$~\citep{Procaccia2009} and $O(n^6\log n)$~\citep{Aziz2026}, to $\Theta(n^3)$.\label{tab:bounds} Three features deserve emphasis. First, the protocol is fully general: valuations may vanish on intervals, and the adversary may choose any legal answer to a cut query on such plateaus. Second, the lower bound is robust: small smooth perturbations of the uniform valuation already force cubically many queries, with no restriction on the number of cuts or on the output endpoints. Third, the upper bound also holds for randomized protocols, where the best lower bound is $\Omega(n^2)$~\citep{FarhadiHajiaghayi2026}; our cubic adversary adapts to the transcript, so closing that gap requires a hard \emph{distribution}. Our bounds concern queries: the protocol performs exact arithmetic and finite enumerations whose running time we do not bound. In Lean~4 with Mathlib, we have verified the lower bound (\cref{thm:detlb}) end to end for step densities. For the upper bound (\cref{thm:upper}), we have verified key lemmas and an abstract version of the protocol under explicit assumptions on the physical routines. End-to-end verification of the upper bound is in progress. \subsection{Why the answer is cubic}\label{sec:why-cubic} Both directions rest on the same quantity: the $n^2$ \emph{comparisons} ``agent $i$ versus the bundle of agent $j$''. \paragraph{The upper bound: $n^2$ comparisons at $O(n)$ queries each.} Our protocol keeps \emph{fixed bundles}, pieces already allocated, each carrying a persistent \emph{label} that stays with its contents when its holder changes; the unallocated rest of the cake is the \emph{residue}. A bipartite \emph{comparison graph} records the agent--label comparisons that are still \emph{open}. A comparison of agent $i$ against label $j$ is \emph{closed} for good once some other label $h$, its \emph{witness}, leads $j$ in $i$'s valuation by at least $i$'s value of the whole residue: however the residue is distributed later, $j$ cannot overtake $h$ in her eyes, so she never has to look at $j$ again. This is the \emph{domination} principle of Aziz and Mackenzie~\citep{AzizMackenzie2016} (\cref{sec:domination}). A lead that is positive but smaller than the residue is made decisive by a \emph{payment}: the protocol cuts almost all of the residue into one \emph{grant} per label and adds each grant to the bundle of its label. The grants are sized so that the lead is preserved up to tiny reading errors, while the new residue, a small \emph{tail}, is worth less than the lead. Once the open comparisons form a perfect matching and the residue is given away, the matched assignment is envy-free. In a payment each agent evaluates the grants of her open labels, so a payment on a graph $G$ with $|G|$ open edges costs $O(|G|)$ queries. The heart of the protocol guarantees that, amortized, a payment on a population of $k\le n$ agents with $|G|\approx kd$ open edges closes $\Omega(d)$ comparisons. Each of the at most $k^2$ comparisons then costs $O(k)$ queries, so a population of $k$ agents costs $O(k^3)$ queries. The difficulty is that a payment may fail: the grants are cut in one agent's measure, and another agent may read them differently. But then two agents visibly disagree about a piece of cake, and we turn this \emph{measured difference} into a \emph{division} of the population into groups that are never compared again (\cref{sec:upper-overview}). A division of $k$ agents with $s$ agents outside the largest group costs $O(k^2s)$ queries and decreases the potential $\sum_{\text{groups}}(\text{size})^3$ by at least $k^2 s$ (\cref{lem:cube}), so all divisions together cost $O(n^3)$. \paragraph{The lower bound: $n$ groups, $n^2$ queries per group.} \begin{figure}[t] \centering \begin{tikzpicture}[x=1cm,y=1cm,font=\small] % query timeline \node[anchor=east] at (-.15,2.35) {queries}; \foreach \g/\x in {1/0,2/3.2,3/6.4}{ \draw[fill=gray!8] (\x,2.1) rectangle ++(3.0,.5); \node at (\x+1.5,2.35) {block $\g$: $k^2$ queries}; } \node at (10.0,2.35) {$\cdots$}; \foreach \g/\x in {1/3.0,2/6.2,3/9.4}{ \draw[-{Stealth[length=2mm]},thick] (\x,2.08) -- (\x,1.62); } \node[anchor=east] at (-.15,1.32) {groups}; \foreach \g/\x in {1/1.75,2/4.95,3/8.15}{ \node[draw,rounded corners=2pt,fill=white,inner sep=2pt] at (\x+.4,1.32) {\textcolor{posc}{$\bullet\bullet$}\,\textcolor{negc}{$\bullet\bullet$}\,\textcolor{uc}{$\circ$}\; group $\g$}; } % digit positions \node[anchor=east] at (-.15,.25) {digit positions}; \draw[-{Stealth[length=2mm]}] (0,.25) -- (10.6,.25) node[right] {\scriptsize finer}; \foreach \x in {.6,5.4,10.2}{ \draw[very thick,black] (\x,.02)--(\x,.48);} \foreach \x in {1.2,1.8,2.4,3.0,3.6,4.2,4.8,6.0,6.6,7.2,7.8,8.4,9.0,9.6}{ \draw[thick,black!55] (\x,.1)--(\x,.4);} \foreach \x in {1.35,1.5,1.65,1.95,2.1,2.25}{ \draw[black!30] (\x,.18)--(\x,.32);} \draw[decorate,decoration={brace,amplitude=3pt}] (.65,.55) -- (5.35,.55) node[midway,above=2pt,font=\scriptsize] {more than $Q$ positions of group $g{+}1$}; \begin{scope}[yshift=-.45cm,font=\scriptsize] \draw[very thick,black] (1.0,.05)--(1.0,.35); \node[anchor=west] at (1.1,.2) {group $g$}; \draw[thick,black!55] (3.0,.08)--(3.0,.32); \node[anchor=west] at (3.1,.2) {group $g{+}1$}; \draw[black!30] (5.2,.12)--(5.2,.28); \node[anchor=west] at (5.3,.2) {group $g{+}2$}; \node[anchor=west] at (7.0,.2) {each transfer uses one unused position}; \end{scope} \node[anchor=west,font=\scriptsize] at (0,-.95) {group members:\quad \textcolor{posc}{$\bullet\bullet$} positive pair\quad \textcolor{negc}{$\bullet\bullet$} negative pair\quad \textcolor{uc}{$\circ$} observer (uniform)}; \end{tikzpicture} \caption{The deterministic adversary. Queries are split into $k\approx n/10$ blocks of $k^2$. After each block the five least-queried fresh agents form a group: an identical \emph{positive} pair, an identical \emph{negative} pair, and a uniform \emph{observer}. Because the block had $k^2$ queries spread over $\ge 5k$ candidates, the group received only $O(k)$ queries in that block. Each group hides tiny value transfers at its own digit positions in a large base; between two positions of group $g$ there are more positions of group $g+1$ than queries in the whole run.} \label{fig:lb-overview} \end{figure} The adversary answers as if all valuations were uniform, but secretly lets small groups deviate; a group consists of two pairs of identical agents and a uniform observer (\cref{fig:lb-overview}). Two \emph{identical} agents value their own bundles equally, and envy-freeness then forces every boundary of their bundles to be a point at which they were queried: otherwise a tiny bump of value could be moved across the boundary without changing any answer, creating envy. The same holds for the uniform agents, which all receive bundles of the same length $L$. Thus the output is ``visible'' to the agents only on their \emph{query grids}, the sets of points at which they were queried. The adversary hides information in the \emph{digits} of the perturbations. Every time a query splits a cell (an interval between consecutive points) of a group's grid, the adversary moves a tiny amount of value into the new cell (a \emph{transfer}), at a fresh digit position in a large base, with a coefficient chosen to avoid every value computable from the grid that existed when the group was selected. Envy-freeness ties $L$ to the transfers: $nL-1=\sum_a(L-|A_a|)$ is the total \emph{length deficit} of the bundles $A_a$, and the deficit of a paired agent is the hidden value that the transfers put into her bundle. So a particular digit of $nL-1$ equals the coefficient of one transfer of some group $g$, or twice that coefficient. But $L$ is also the length of a uniform agent's bundle, whose boundaries lie on the grid of the \emph{next} group $g+1$. That grid differs from the grid at the selection of group $g$ only by the few query points that group $g+1$ received in its own block, which one of the many uniform agents avoids, and by cells split off later, which are far shorter than the unit of that digit. Read this way, the digit is one that the adversary avoided, a contradiction (\cref{fig:two-readings}). The protocol may well \emph{know} the hidden coefficient; what it cannot do is realize a length $L$ encoding it with boundaries that the next group can see. The argument needs every group to have few new query points at its selection, and this costs the protocol $n^2$ queries per group. With $k\approx n/10$, a block of $k^2$ queries gives the five least-queried of the at least $5k$ eligible agents at most $5k^2/(5k)=k$ queries in total, so they form a group with at most $k$ new points, too few to touch the bundles of all $6k$ uniform agents. The adversary can thus continue for $k$ blocks, that is, for $k^3=\Omega(n^3)$ queries; the last group is selected after the last query, so a next group always exists. \subsection{Technical overview of the upper bound}\label{sec:upper-overview} \begin{figure}[t] \centering \begin{tikzpicture}[x=1cm,y=1cm,font=\small, ag/.style={circle,draw,fill=white,inner sep=1.2pt,minimum size=15pt}, lb/.style={rectangle,draw,fill=gray!12,inner sep=1.2pt,minimum size=14pt}] \begin{scope} \node[font=\small\bfseries] at (1.3,4.05) {(a) comparison graph}; \foreach \i in {1,...,4}{ \node[ag] (a\i) at (0,4.1-.95*\i) {$\i$}; \node[lb] (l\i) at (2.6,4.1-.95*\i) {$\ell_{\i}$}; } \foreach \i in {1,...,4}{ \draw[line width=1.6pt] (a\i)--(l\i); } \foreach \i/\j in {1/2,2/1,3/4,4/3,2/3}{ \draw (a\i)--(l\j); } \node[font=\scriptsize,align=left,anchor=north west] at (-.3,-.75) {\rule[2pt]{14pt}{1.6pt}\ matching $M$ (current holders)\\[-1pt] \rule[2pt]{14pt}{.4pt}\ open comparisons\\[-1pt] missing edge = closed comparison}; \end{scope} \begin{scope}[xshift=4.3cm] \node[font=\small\bfseries,anchor=west] at (0,4.05) {(b) closing $(i,j)$ by domination, in agent $i$'s measure}; \draw[fill=uc!18] (0,2.95) rectangle (4.2,3.45); \node at (2.1,3.2) {bundle $h$}; \draw[fill=gray!15] (0,2.15) rectangle (1.6,2.65); \node at (.8,2.4) {bundle $j$}; \draw[pattern=north east lines,pattern color=gray!70] (1.6,2.15) rectangle (3.9,2.65); \node[fill=white,inner sep=1pt,font=\scriptsize] at (2.75,2.4) {all of residue $B$}; \draw[dashed,negc] (4.2,2.0)--(4.2,3.6); \node[anchor=west,font=\scriptsize,negc,align=left] at (4.3,2.4) {$j$ stays below $h$\\ even in the worst case}; \node[anchor=west,align=left,font=\small] at (0,1.25) {If $v_i(h)\ge v_i(j)+v_i(B)$, no future allocation of $B$ can make\\ agent $i$ prefer $j$ to $h$: delete edge $(i,j)$ for good. Labels move\\ with their bundles, so this survives any later change of holders.}; \node[anchor=west,align=left,font=\small] at (0,.05) {At the end, $i$ holds a favorite \emph{open} label, and every closed\\ label is beaten by a chain of witnesses, so $i$ envies nobody.}; \end{scope} \end{tikzpicture} \caption{The state of the protocol. (a) Fixed bundles carry persistent labels; an edge is an open comparison. (b) The domination test (\cref{sec:domination}). The protocol finishes when only a perfect matching of open edges remains and the residue is gone.} \label{fig:state} \end{figure} \paragraph{State and invariant.} The state consists of the labeled fixed bundles, the residue, and the comparison graph $G$ (\cref{fig:state}). For a perfect matching $M$ of $G$, the \emph{shortfall} of agent $i$ is how much less she values her matched label than her favorite open label. The invariant is not envy-freeness of the current matching, but a \emph{small shortfall} on the open comparisons together with witnesses for the closed ones; when the residue is finally given away, the shortfall is absorbed (\cref{lem:domination}). \paragraph{Payments and divisions.} A maximum-weight assignment of labels to agents in the table of recorded values has \emph{supporting prices} $p_\ell\ge0$: once $p_\ell$ is added to the value of every label $\ell$, each agent weakly prefers her matched label to every label open for her (\cref{lem:prices}), and the margin is the \emph{slack} of the edge. The \emph{assignment loss} of an edge is the weight lost by the best assignment forced to use it; all edges of large assignment loss can be given large slack simultaneously (\cref{lem:raise}). A payment makes the prices real: in the measure of a \emph{reference agent} it cuts for every label $\ell$ a grant worth $p_\ell$ plus a common constant, and every agent reads the grants of her open labels. If all readings agree up to a tiny tolerance, every edge whose slack exceeds the tail is closed (\cref{lem:payment}); otherwise the discrepant grant yields a \emph{fractional division} of the residue that splits the population and pays all comparisons between the groups (\cref{lem:measured}). See \cref{fig:payment} and the worked \cref{ped:toy-upper}. \begin{figure}[t] \centering \begin{tikzpicture}[x=1cm,y=1cm,font=\small, box/.style={draw,rounded corners=2pt,align=center,inner sep=3pt,font=\small}] \node[font=\small\bfseries,anchor=west] at (-.1,3.55) {(a) one payment}; % residue bar cut into grants \foreach \a/\b/\c/\t in {0/1.5/uc!18/{$\ell_1$},1.5/2.4/uc!18/{$\ell_2$},2.4/4.0/uc!18/{$\ell_3$},4.0/5.0/uc!18/{$\ell_4$},5.0/5.5/gray!20/{\scriptsize tail}}{ \draw[fill=\c] (\a,2.7) rectangle (\b,3.2); \node at ({(\a+\b)/2},2.95) {\t};} \draw[decorate,decoration={brace,amplitude=3pt,mirror}] (0,2.62)--(5.5,2.62) node[midway,below=3pt,font=\scriptsize]{grant of $\ell$ $=$ price $p_\ell$ $+$ equal share (reference measure)}; \node[box] (read) at (2.75,1.3) {each agent reads the grants of her\\ open labels: $O(\#\text{open edges})$ queries}; \draw[-{Stealth[length=2mm]}] (2.75,2.15)--(read); \node[box,fill=posc!10] (ok) at (0.9,-.25) {all reads within tolerance:\\ every edge with enough\\ slack is closed}; \node[box,fill=negc!8] (bad) at (4.6,-.25) {a read is off by more:\\ two agents disagree\\ $\Rightarrow$ divide the agents}; \draw[-{Stealth[length=2mm]}] (read)--(ok); \draw[-{Stealth[length=2mm]}] (read)--(bad); % division tree \begin{scope}[xshift=8.0cm] \node[font=\small\bfseries,anchor=west] at (-.6,3.55) {(b) paying for divisions}; \node[box] (r) at (1.6,2.9) {$12$}; \node[box] (c1) at (0.3,1.7) {$7$}; \node[box] (c2) at (1.6,1.7) {$3$}; \node[box] (c3) at (2.9,1.7) {$2$}; \draw (r)--(c1) (r)--(c2) (r)--(c3); \node[box] (d1) at (-.3,.6) {$4$}; \node[box] (d2) at (.9,.6) {$3$}; \draw (c1)--(d1) (c1)--(d2); \node[align=left,anchor=north west,font=\scriptsize] at (-.7,.15) {$12^3-(7^3{+}3^3{+}2^3)=1350\ \ge\ 12^2\cdot5$\\ $7^3-(4^3{+}3^3)=252\ \ge\ 7^2\cdot3$\\ a division with $s$ agents outside its largest\\ part costs $O(k^2s)$; $\sum(\text{size})^3$ pays.}; \end{scope} \end{tikzpicture} \caption{The two outcomes of a payment. (a) A payment converts supporting prices into actual grants. If every agent's readings match the reference agent's up to a tiny tolerance, the edges with enough slack are closed by domination. Otherwise the discrepant grant is a piece on which two agents disagree, and this \emph{measured difference} splits the population. (b) Divisions are paid by the drop of the sum of cubes of the group sizes (\cref{lem:cube}), so all divisions together cost $O(n^3)$.} \label{fig:payment} \end{figure} \paragraph{Getting $\Omega(d)$ closures per payment.} The \emph{readers} of a label are the agents with an open comparison against it, and a label is \emph{heavy} if it has at least $d$ readers; the threshold $d$ decreases with the recursion level. Progress is sought by \emph{trials}: recursive calls on a reserved part of the residue (a \emph{working slot}), whose proposed payments the caller verifies before they become permanent. To save queries, a trial inside a connected component of heavy labels and their readers lets one \emph{representative valuation} answer for all agents on its slot. Two cases need new ideas. \emph{Private prices.} Agents sharing a representative valuation may still value their old bundles differently, and this table of \emph{private} values is too large to read in every trial. We compress it: either the compressed table errs little, or the error certifies $k$ comparisons of large assignment loss, which a single payment closes (\cref{sec:private}). \emph{Direct placements.} The protocol holds a small piece on which the readers disagree and may add it to the bundle of any one of $\Theta(d)$ heavy labels (a \emph{placement}); the danger is that every placement makes only a few comparisons payable. We exclude this by counting. The graph $G$ is \emph{matching-covered} (every edge lies in a perfect matching), and this property has sparse \emph{certificates}: a perfect matching with $O(k)$ further edges that already form a matching-covered spanning subgraph. A fixed certificate survives at only $O(k/d)$ of the $\Theta(d)$ placements (\cref{lem:oscillation}), so some placement destroys all but an $O(k/d^2)$ fraction of the $\exp(O(k\log k))$ certificates, which can happen only $O(k)$ times. Finally, failed trials are paid for by giving successive attempts at level $j$ quotas that grow by the factor $(j+2)^2$: the discarded attempts then cost an $O((j+2)^{-2})$ fraction of the accepted one, and the product of these overheads over all levels is a constant (\cref{sec:trials}). \subsection{Further related work}\label{sec:related} \paragraph{Query models and lower bounds.} Procaccia's $\Omega(n^2)$ lower bound~\citep{Procaccia2009} uses piecewise-constant valuations; ours uses smooth densities, allows arbitrarily fragmented outputs, and derives boundary constraints from exact ties. Stromquist~\citep{Str08} showed that no finite protocol finds connected envy-free allocations for $n\ge3$. For connected $\eps$-envy-free allocations, Hollender and Rubinstein~\citep{HollenderRubinstein2025} gave a protocol with $\poly(\log(1/\eps))$ queries for four agents, and Mackenzie and Suzuki~\citep{MackenzieSuzuki2026Connected} study other fixed populations. In contrast, we study exact complete envy-freeness with disconnected bundles as $n$ grows. \paragraph{Techniques.} Partial allocations, residue, and domination originate with Aziz and Mackenzie~\citep{AzizMackenzie2016}; we apply domination to persistent labels, so the assignment may change while settled comparisons remain valid. Supporting prices come from the dual of the assignment problem (Shapley and Shubik~\citep{SS71}), and have been used for envy-freeness with subsidies by Halpern and Shah~\citep{HS19} and by Brustle, Dippel, Narayan, Suzuki, and Vetta~\citep{BrustleEtAl2020}. Matching-covered graphs and their ear decompositions are classical (Carvalho, Lucchesi, and Murty~\citep{CLM99}). Our moment-preserving rounding follows the linear-algebraic strategy of necklace-splitting algorithms (Alon and Graur~\citep{AG21}): preserve selected integrals, reduce the number of fractional variables, and subdivide only the few remaining shared cells. \paragraph{Organization.} \Cref{sec:prelim} fixes the model and proves the basic tools. \Cref{sec:upper} presents the architecture of the protocol and its key lemmas, with a map of the proof in \cref{fig:proofmap}; the full construction is in \cref{app:protocol,app:physical}. \Cref{sec:detlb} proves the lower bound and is self-contained. The worked examples (\cref{ped:toy-upper,ped:toy-lower}) and the warm-up \cref{ped:warm-lb} are not used in any proof.