\section{Generation in the Limit with Replay} \label{sec:limit} We first construct an algorithm that matches the computational guarantees of the standard setting for all countable classes under replay~(\Cref{thmt@@thmlimitreplaymqonly}). Then, in~\Cref{thmt@@thmseparationlimitreplay}, we present a hard (necessarily uncountable) hypothesis class demonstrating a separation between generation in the limit with and without replay. See also the corresponding row of~\Cref{tab:replay-separation-classes}. \subsection{A Computable Algorithm to Generate in the Limit Any Countable Class under Replay} \citet{kleinberg2024language} show that all countable hypothesis classes are generatable in the limit \emph{without} replay and give a universal membership-query-only generator. The next theorem shows that replay does not change this picture. \begin{restatable}{theorem}{thmlimitreplaymqonly} \label{thm:limit_replay_mq_only} There exists a generator that, given any \emph{countable} binary hypothesis class \(\cH=\bc{h_1,h_2,\ldots}\) over a countable domain \(\cX\) satisfying the UUS property, generates in the limit with replay every target \(h^\star\in\cH\) using only membership queries. \end{restatable} The proof is constructive. Building on the algorithm of \citet{kleinberg2024language}, we propose \textsc{WP} (\emph{Witness Protection};~\Cref{alg:computable-wp}), a universal membership-query-only algorithm that generates in the limit with replay any countable hypothesis class $\cH$. To prove this, we first need some additional notation. Since the domain $\cX$ is countable, we may assume without loss of generality that $\cX=\bN$. The algorithm maintains a growing prefix length \(m\) over the elements of the domain \(\cX\). For \(h\in\cH\) and \(m\in\bN\), write \[\supp{h}[m]\coloneqq \supp{h}\cap \bc{1,\ldots,m};\] restricting hypotheses to this prefix yields a surrogate for set inclusion that is computable with membership queries alone.\footnote{ That is, for any \(i,j,m\in\bN\) we can establish whether \(\supp{h_i}[m]\subseteq \supp{h_j}[m]\) using only a finite number of membership queries } Fix a target hypothesis \(h^\star\in\cH\). In the replay model, each example \(x_t\) is either an element of \(\supp{h^\star}\) or a replay of a past output. Let \(O_t\coloneqq\bc{o_1,\ldots,o_t}\) with \(O_0 = \emptyset\), and define the \emph{sure} set \[S_t \coloneqq \bc{x_s : 1\le s\le t,\ x_s\notin O_{s-1}},\] i.e., the examples that cannot be explained as replay and hence must lie in \(\supp{h^\star}\), so that \(S_t\subseteq \supp{h^\star}\). We relax the notion of criticality from \citet{kleinberg2024language} to ignore previously output elements. Fix an ordering of the hypotheses of the countable class \(\cH\), i.e., write \(\cH = \bc{h_1,h_2,\ldots}\). \begin{definition}[\((t,m)\)-critical with replay]\label{def:tm-critical-replay} Fix \(t,m\in\bN\). We say that \(h_n\in\cH\) is \emph{\((t,m)\)-critical with replay} if\looseness=-1 \begin{enumerate} \item \(S_t \subseteq \supp{h_n}\); and \item for every \(iz\), applying condition (ii) of Definition~\ref{def:tm-critical-replay} to the pair \((i,n)=(z,n^{(t,m)})\) yields \[ \supp{h_{n^{(t,m)}}}[m] \subseteq \supp{h_z}[m] \cup O_{t-1}. \] Because \(o_t\notin O_{t-1}\) by construction, it follows that \(o_t\in \supp{h_z}\). Finally, \(o_t\notin S_t\) and \(o_t\notin O_{t-1}\) implies \(o_t\notin \bc{x_1,\ldots,x_t}\), since every observed example is either sure (hence in \(S_t\)) or a replay (hence in \(O_{t-1}\)). Thus, \(o_t\in \supp{h_z}\setminus\bc{x_1,\ldots,x_t}\), as claimed. \end{proof} We can finally provide a proof of Theorem~\ref{thm:limit_replay_mq_only}. \begin{proof}[Proof of Theorem~\ref{thm:limit_replay_mq_only}] \Cref{alg:computable-wp} only requires membership queries to evaluate \(h_i(x)\) for \(i\le t\) and \(x\leq m\), where \(t,m\) are finite. Additionally, Lemma~\ref{lem:wp-terminates} shows that, at every time \(t\), \Cref{alg:computable-wp} outputs some \(o_t\) after finitely many operations. Hence, \Cref{alg:computable-wp} is a computable procedure that can be implemented using membership queries alone. Now, fix any target \(h^\star \in \cH\). For any enumeration with replay for \(h^\star\) and \textsc{WP}, Lemma~\ref{lem:wp-eventual-valid} gives a time \(t^\star\) after which every output is fresh and valid for \(h^\star\). Therefore, \Cref{alg:computable-wp} generates \(h^\star\) in the limit with replay. Since \(h^\star\in\cH\) was arbitrary, the theorem follows. \end{proof} \subsection{Separation Between Generation in the Limit With and Without Replay} \label{subsec:separation-with-without-replay} While the previous result shows that replay does not impose additional hardness on the generatability in the limit of countable hypothesis classes, it leaves open whether replay can ever make generation strictly harder. The following theorem answers this in the affirmative: there are (uncountable) classes that are generatable in the limit in the standard sense but not generatable in the limit when replay is allowed. \begin{restatable}{theorem}{thmseparationlimitreplay} \label{thm:separation-lim-with-replay} There exists a hypothesis class \(\cH\) that is generatable in the limit but is not generatable in the limit with replay. \end{restatable} We prove~\Cref{thm:separation-lim-with-replay} by an explicit construction loosely based on \citet{bai2025language}. First, we need to introduce some additional notation. Let the domain be \(\cX \coloneqq \bZ \cup \bc{*^n \mid n \in \bN}\). Strings of the form \(*^n\) act as ``special tokens'' that will index the relevant subclass. For \(b \in \bN_0\), define \begin{align*} \cH^b_1 &\coloneqq \bc{ h \in \bc{0,1}^{\cX} \,\Big|\, \supp{h}=\bc{b}\cup A \cup \bc{x\in\bZ : x>j} \text{ for some } A\subseteq \bZ,\ j>b},\\ \cH^b_2 &\coloneqq \bc{ h \in \bc{0,1}^{\cX} \,\Big|\, \supp{h}=\bc{x\in\bZ : xb\), whereas \(\cH^b_2\) contains hypotheses that omit \(b\) but include every integer less than \(b\). Both classes also include an arbitrary subset \(A\) of the remaining integers.\footnote{ We note that $\mathcal{H}^b$ is generatable in the limit but not generatable in the limit with a single omission (i.e., by omitting $b$), as shown by \citet{bai2025language} (where they set $b=0$). However, $\mathcal{H}^b$ is generatable in the limit with replay: the generator of \citet{bai2025language} that works in the standard setting can be adapted to the replay setting by restricting it from outputting the crucial string $b$. Therefore, in order to show a separation between generation in the limit with and without replay, we will need a more involved construction. } Next, for \(i\in\bc{1,2}\) define \[ \widetilde{\cH}^b_i \coloneqq \bc{ \tilde h \in \bc{0,1}^{\cX} \,\Big|\, \supp{\tilde h}=\supp{h}\cup \bc{*^k : 1\le k\le b} \text{ for some } h\in \cH^b_i}, \] and let \(\widetilde{\cH}^b \coloneqq \widetilde{\cH}^b_1 \cup \widetilde{\cH}^b_2\). Thus, \(\widetilde{\cH}^b_i\) is obtained from \(\cH^b_i\) by adding the marker strings \(*^1,\ldots,*^b\) to the support of each hypothesis. Finally, define the class \[ \cH \coloneqq \bc{h^{\mathrm{mk}}} \cup \bigcup_{b\in\bN_0}\widetilde{\cH}^b \quad \text{with} \quad h^{\mathrm{mk}}\coloneqq \mathbf{1}\bc{*^n \mid n \in \bN}. \] That is, \(\cH\) contains the all-marker hypothesis \(h^{\mathrm{mk}}\) together with all the padded classes \(\widetilde{\cH}^b\). To prove~\Cref{thm:separation-lim-with-replay}, Lemma~\ref{lem:H-gen-limit} shows that \(\cH\) is generatable in the limit, while Lemma~\ref{lem:H-not-gen-replay} shows that \(\cH\) is not generatable in the limit with replay. Interestingly, the separation relies on only a single replayed example. \begin{lemma}\label{lem:H-gen-limit} The class \(\cH\) is generatable in the limit. \end{lemma} \begin{proof} Fix \(b\in\bN_0\). Let \(\cG^b\) be the generator from \citet{bai2025language} that generates \(\cH^b\) in the limit. We briefly recall its definition: \[\cG^b(x_1,\ldots,x_t)\coloneqq \begin{cases} \max\bc{t,o_1,\ldots,o_{t-1},x_1,\ldots,x_t} + 1 & \text{if } b\in\bc{x_1,\ldots,x_t},\\ \min\bc{b,o_1,\ldots,o_{t-1},x_1,\ldots,x_t} - 1 & \text{otherwise.} \end{cases}\] Essentially, if $h^\star\in\cH^b_1$ then \(\cG^b\) will observe \(b\) and eventually output unseen integers larger than the cutoff $j$; otherwise, if $h^\star\in\cH^b_2$ then \(\cG^b\) will always take the second branch and output unseen integers smaller than $b$. Since \(\widetilde{\cH}^b\) only augments each \(h\in\cH^b\) by the same finite set of \(*\)-strings, the same generator \(\cG^b\) (ignoring the \(*\)-strings in its input) generates \(\widetilde{\cH}^b\) in the limit. We now use this to define a single generator \(\cG\) for \(\cH\). Given a history \((x_1,\ldots,x_t)\), define \[m(t)\coloneqq \max \bc{k\in\bN : *^k \in \bc{x_1,\ldots,x_t}},\] with \(m(t)=0\) if no \(*\)-string has appeared. Let \(Z_t \coloneqq \br{x_s \colon x_s \in \bZ,\ 1 \le s \le t}\) denote the subsequence of integer-valued examples in $x_{1:t}$, and set \[\cG(x_1,\ldots,x_t)\coloneqq \begin{cases} *^{m(t)+1} & \text{if } \bc{x_1,\ldots,x_t}\subseteq \bc{*^n\mid n\in\bN},\\ \cG^{m(t)}\br{Z_t} & \text{otherwise.} \end{cases}\] Thus, if \(h^\star=\mathbf{1}\bc{*^n\mid n\in\bN}\) then the output of \(\cG\) is always an unseen \(*\)-string, so \(\cG\) generates \(h^\star\) in the limit. Otherwise, for any \(h^\star\in\bigcup_{b}\widetilde{\cH}^b\), note that \[b^\star \coloneqq \max\bc{k : *^k \in\supp{h^\star}}\] equals the unique index such that \(h^\star\in \widetilde{\cH}^{b^\star}\). Hence, on any enumeration \(\br{x_t}_{t\ge 1}\) of \(\supp{h^\star}\), the value of \(m(t)\) is nondecreasing and stabilizes to \(b^\star\) after the finite time \(t^\prime\) when \(*^{b^\star}\) appears in the enumeration. Moreover, since \(\supp{h^\star} \cap \bZ\) is infinite, any enumeration of \(\supp{h^\star}\) must present an integer at some finite time \(t^{\prime\prime}\); after that time, \(\cG\) always takes the second branch. Therefore, \(\cG\) copies \(\cG^{b^\star}\) for all \(t \geq \tilde{t}\coloneqq\max\bc{t^\prime, t^{\prime\prime}}\). Since \(\cG^{b^\star}\) generates \(\widetilde{\cH}^{b^\star}\) in the limit, there exists $t^\star\in\bN$ such that \(\cG^{b^\star}\br{Z_t}\in\supp{h^\star}\setminus\bc{x_1,\ldots,x_t}\) for all \(t\ge t^\star\). Thus, \(\cG\br{x_1,\ldots,x_t}\) is guaranteed to be a valid output for all \(t\geq\max\bc{\tilde{t},t^\star}\). \end{proof} \begin{lemma}\label{lem:H-not-gen-replay} The class \(\cH\) is not generatable in the limit with replay. \end{lemma} \begin{proof} Assume for the sake of contradiction that there exists a generator \(\cG\) that generates \(\cH\) in the limit with replay. We construct an adversarial enumeration with replay \((x_t)_{t\ge 1}\) adaptively. Since \(\cG\) is deterministic, the adversary can choose the next input based on \(\cG\)'s outputs while maintaining a nonempty set of candidate target hypotheses consistent with the observed prefix stream. The construction identifies a hypothesis \(h^\star \in \cH\) that remains consistent with the entire realized stream \((x_t)_{t\ge 1}\) and for which \(\cG\) outputs infinitely many invalid elements. Write \(o_t\coloneqq \cG(x_{1:t})\). The enumeration is defined in two steps. In the first step, the adversary forces the generator to output a ``long'' \(*-\)string marker. Let \(h^{\mathrm{mk}}\coloneqq \mathbf{1}\bc{*^n \mid n \in \bN}\). The adversary begins enumerating the support of \(h^{\mathrm{mk}}\) by presenting the sequence \(x_t\coloneqq *^t\). Since \(\cG\) generates \(\cH\) in the limit with replay, there exists a time step \(\tau\) such that \(o_\tau \in \supp{h^{\mathrm{mk}}}\setminus\{x_1,\ldots,x_\tau\}\). Let the output be \(o_\tau=*^z\) for some \(z>\tau\). The adversary then extends the input sequence by displaying all \(*-\)strings until \(*^z\) by setting \(x_{\tau+1}\coloneqq *^{\tau+1},\ldots,x_z\coloneqq *^z\). Let \(J_0\coloneqq z\).\footnote{ At a high level, note that since we are in the replay setting, $\mathcal{G}$ cannot know whether $*^z$ belongs to the support of the target hypothesis $h^\star$ or not. Hence, even upon observing $z-1$, $\cG$ does not know whether $h^\star \in \widetilde{\cH}^{z-1}$---in which case $h^\star \in \widetilde{\cH}^{z-1}_1$ and $\supp{h^\star}$ necessarily contains all integers larger than some cutoff $j$---or $h^\star \in \widetilde{\cH}^z$, in which case observing $z-1$ is uninformative, as $h^\star$ could belong to either $\widetilde{\cH}^z_1$ or $\widetilde{\cH}^z_2$. The second step of our construction relies on this observation to force infinitely many mistakes. } In the second step, the adversary forces infinitely many mistakes in multiple phases. For each \(n\in\bN\), at the beginning of phase \(n\), the adversary presents the integer \(z-n\), and then presents the increasing tail \(J_{n-1}+1,J_{n-1}+2,\ldots\) until the first time \(t_n\) at which \(\cG\) outputs an integer \(o_{t_n}\) satisfying \(o_{t_n} > J_{n-1}\) and \(o_{t_n}\notin \bc{x_1,\ldots,x_{t_n}}\). The adversary then sets \(J_n\coloneqq o_{t_n}\) and proceeds to phase \(n+1\), never presenting \(J_n\) as an element of the sequence. \begin{claim}\label{claim:infinite-mistakes} Each phase terminates, i.e., \(t_n<\infty\) for all \(n\in\bN\). \end{claim} We prove this claim later. First, we show how the adversary can use this fact to force infinitely many mistakes. Let \(S \subseteq \bZ\) be the set of all integers ever presented by the above construction during the second step, and define \[\supp{h^\star} \coloneqq S \cup \bc{*^k:1\le k\le z} = \bigcup_{t\ge 1}\bc{x_t}.\] Since \emph{every} integer smaller than \(z\) appears in the enumeration \((x_t)_{t\ge 1}\) as \(z-n\) for some \(n\in\bN\), we can write \[S = \bc{x\in\bZ:xz} \subseteq \bZ\setminus\bc{z}.\] This shows that the example sequence \((x_t)_{t\ge 1}\) enumerates the support of a hypothesis \(h^\star\) that belongs to \(\widetilde{\cH}^{z}_2\). However, by construction, \(o_{t_n}=J_n\notin \supp{h^\star}\) for each \(n\in\bN\). Hence, $\br{t_n}_{n\ge 1}$ is an infinite sequence of time steps at which $\cG$ makes a mistake, contradicting that \(\cG\) generates \(\cH\) in the limit with replay. \end{proof} \begin{proof}[Proof of~\Cref{claim:infinite-mistakes}.] Fix \(n\in\bN\). Suppose, for the sake of contradiction, that phase \(n\) does not terminate, i.e., the adversary keeps presenting \(J_{n-1}+1,J_{n-1}+2,\ldots\), but the generator never outputs a fresh integer larger than \(J_{n-1}\). Let \(\hat{h}\) be the hypothesis whose support is enumerated by such an example sequence, excluding the (potentially replayed) string \(*^z\). Denote by \(X_{J_{n-1}} \cup \bc{*^k : 1\le k\le z-1}. \] Notice that \(z-1\) belongs to the support of \(\hat{h}\) for any \(n\in\bN\): for \(n=1\), it appears directly as \(z-n\); for all other \(n\), it already appeared during a previous phase and is contained in \(X_{J_{n-1}}\). Consequently, \(\cG\) outputs an unseen integer larger than \(J_{n-1}\) at a finite time, contradicting the assumption that phase \(n\) does not terminate. \looseness=-1 \end{proof} \begin{proof}[Proof of Theorem~\ref{thm:separation-lim-with-replay}] The hypothesis class \(\cH\) is generatable in the limit (Lemma~\ref{lem:H-gen-limit}), but not generatable in the limit with replay (Lemma~\ref{lem:H-not-gen-replay}). \end{proof}