\section{Introduction and overview}
The goal of this paper is to give an analog of the Feigin-Frenkel homomorphism ${\mathbb V}_0^{{\mathfrak g},-h^\vee}\to \mathsf M(\np)$ in the case in which ${\mathfrak g}$ is of untwisted affine type. To set the scene, we should first recall the situation in finite types.


\subsection{}\label{sec: finitetype}
The Lie algebra $\sl_2$ (over ${\mathbb C}$) has a realization in terms of first order differential operators:
\begin{align}
E\mapsto D\qquad
H\mapsto -2XD\qquad 
F\mapsto -XXD.\qquad \label{bigcellsl2}
\end{align}
Here $E,F,H$ are the Chevalley-Serre generators and $X,D$ are generators of a Weyl algebra with commutation relations $[D,X] =1$. 
At the heart of the Wakimoto construction \cite{Wakimoto} is the observation that this homomorphism of Lie algebras can be promoted to a homomorphism of vertex algebras, given 
by
\begin{alignat}{2}
E\fm{-1}w_0 &\mapsto &\phantom+\upbeta\fm{-1}&w_0\nn\\
H\fm{-1}w_0 &\mapsto &-2 \upgamma\fm 0\upbeta\fm{-1}&w_0\nn\\
F\fm{-1}w_0 &\mapsto &- \upgamma\fm 0\upgamma\fm 0 \upbeta\fm{-1}&w_0 -2 \upgamma\fm{-1}w_0, \label{sl2wak}
\end{alignat}
from the vacuum Verma module over $\wh\sl_2$ at the critical level, to the vacuum Fock module for a $\upbeta\upgamma$-system of free fields. Note the new feature, the term $-2\upgamma\fm{-1}w_0$. 

This is a special case of a construction which works for any finite-dimensional simple Lie algebra ${\mathfrak g} =_{\mathbb C} \nm\oplus\h\oplus \np$. 
The realization \cref{bigcellsl2} generalizes to a homomorphism 
\be \rho: {\mathfrak g} \to \Der{\O_{\np}};\qquad A\mapsto \sum_{\alpha\in \Delta_+} P^\alpha_A(X) D_\alpha \label{bigcell}\ee 
from ${\mathfrak g}$ 
to the Lie algebra $\Der{\O_{\np}}$ of derivations of the algebra 
${\O_{\np}} = {\mathbb C}[X^{\alpha}]_{\alpha\in \Delta_+}$ 
of polynomial functions on the unipotent group $U = \exp(\np) \cong \np$. 
This realization arises from the infinitesimal action of ${\mathfrak g}$ on a flag manifold, $B_-\backslash G$, whose big cell is diffeomorphic to $U$.

Recall (from e.g. \cite{KacVertexAlgBook,FrenkelBenZvi}) that the vacuum Verma module ${\mathbb V}_0^{{\mathfrak g},k}$ over ${\widehat \g}$ at level $k\in {\mathbb C}$ is generated as a vertex algebra by states $\{A\fm{-1}w_0: A\in {\mathfrak g}\}$, whose non-zero non-negative products 
(i.e., whose OPEs) 
are given by 
\begin{alignat}{2}  A\fm{-1}w_0\,\, \vap 0\,\, B\fm{-1}w_0 &= &[A,B]\fm{-1}&w_0, \nn\\
 A\fm{-1}w_0 \,\,\vap 1\,\, B\fm{-1}w_0 &=\,\,& k \bilin{A}{B} &w_0. \label{Vkdef}
\end{alignat}
Here $\bilin\cdot\cdot$ is the invariant symmetric bilinear form on ${\mathfrak g}$ normalized as in \cite{KacBook}. With this normalization, the critical level is equal to $-h^\vee$, where $h^\vee$ is  the dual Coxeter number of ${\mathfrak g}$. 

Let $\mathsf M(\np)$ be the vacuum Fock module for the $\upbeta\upgamma$-system on $\np \cong U$. It is generated as a vertex algebra by states $\upbeta_\alpha\fm{-1}w_0$ and $\upgamma^\alpha\fm 0 w_0$, $\alpha\in \Delta_+$, obeying
\begin{align}
\upbeta_\alpha\fm{-1}w_0\,\,\vap 0\,\, \upgamma^\beta\fm0w_0 = \delta_\alpha^\beta w_0 .\nn
\end{align} 
(See \cref{sec: va} for the details.) 

Both ${\mathbb V}_0^{{\mathfrak g},k}$ and $\mathsf M(\np)$ have natural ${\mathbb Z}_{\geq 0}$-gradations (by \emph{depth}) and the first two graded subspaces are 
\begin{alignat}{2} 
{\mathbb V}_0^{{\mathfrak g},k}[0] &\cong {\mathbb C}\qquad &\mathsf M(\np)[0] &\cong {\O_{\np}}\nn\\
{\mathbb V}_0^{{\mathfrak g},k}[1] &\cong {\mathfrak g} \qquad &\mathsf M(\np)[1] &\cong \Der{\O_{\np}} \oplus \Omega_{\O_{\np}},\label{firsttwo}
\end{alignat}
where $\Omega_{\O_{\np}} = \mathrm{Hom}_{\O_{\np}}(\Der{\O_{\np}},{\O_{\np}})$ is the space of one-forms.
One identifies $w_0 \simeq 1$ and $A\fm{-1}w_0 \simeq A\in {\mathfrak g}$; and $\upgamma^\alpha\fm 0 \simeq X^\alpha$, $\upgamma^\alpha\fm{-1} \simeq dX^\alpha$ and $D_\alpha \simeq \upbeta_\alpha\fm{-1}$.  
Given these identifications, the homomorphism $\rho:{\mathfrak g} \to \Der{\O_{\np}}$ gives rise to a graded linear map 
\begin{subequations}
\be {\mathbb V}_0^{{\mathfrak g},k}\df 1 \to \mathsf M(\np)\df 1,\nn\ee 
sending $w_0 \to w_0$ and 
\be A\fm{-1}w_0 \mapsto \sum_{\alpha\in \Delta_+} P^\alpha_A(\upgamma\fm0) \upbeta_\alpha\fm{-1}w_0.\nn\ee
\end{subequations}
This map does not preserve the non-negative products, but the result of Feigin and Frenkel \cite{FF1990}, \cite{FF1988,FF1990b} \cite{Frenkel_2005,Fre07} is that,  at the critical level $k= -h^\vee$, it may be lifted to one which does. Namely, 
there exists a linear map 
\be \phi:{\mathfrak g} \to \Omega_{\O_{\np}}; \qquad A\mapsto \sum_{\alpha\in \Delta_+} Q_{\alpha,A}(X) dX^\alpha \nn\ee
such that the graded linear map 
\begin{subequations}\label{fftoptwo}
\be {\mathbb V}_0^{{\mathfrak g},-h^\vee}\df 1 \to \mathsf M(\np)\df 1\ee 
associated to $\rho+\phi:{\mathfrak g} \to \Der{\O_{\np}} \oplus \Omega_{\O_{\np}}$, i.e. the one sending $w_0 \to w_0$ and 
\be A\fm{-1}w_0 \mapsto \sum_{\alpha\in \Delta_+} P^\alpha_A(\upgamma\fm0) \upbeta_\alpha\fm{-1}w_0
+ \sum_{\alpha\in \Delta_+} Q_{\alpha,A}(\upgamma\fm0) \upgamma^\alpha\fm{-1}w_0,\ee
\end{subequations}
does preserve the non-negative products. 
This latter map \cref{fftoptwo} is the restriction of a homomorphism of graded vertex algebras, 
\be {\mathbb V}_0^{{\mathfrak g},-h^\vee} \to \mathsf M(\np).\nn\ee

The map $\phi:{\mathfrak g} \to \Omega_{\O_{\np}}$ respects the weight gradation. In particular $\phi(\h\oplus\np) = 0$ on grading grounds.

For example in the case of $\sl_2$, $\phi(f) = -2 dX$, $\phi(e) = \phi(h) = 0$, as in \cref{sl2wak}.

Various perspectives on this important result have subsequently appeared in the literature \cite{deBF}, \cite{FF1999},\cite{FG1}, \cite{ACM} In particular, see \cite{GMShomog} for an interpretation the language of vertex algebroids and chiral algebras  \cite{MSV,GMSii}, \cite
GMSi,
AG, 
GMSiii,
BDChiralAlgebras,Malikov_2017}

\subsection{}
Now, and for the rest of this paper, let us suppose instead that ${\mathfrak g}$ is of untwisted affine type, i.e. that
\be {\mathfrak g} \quad\cong_{\mathbb C}\quad \mathring {\mathfrak g}[t,t^{-1}] \oplus {\mathbb C}\mathsf k \oplus {\mathbb C}\mathsf d \nn\ee
for some finite-dimensional simple Lie algebra $\mathring {\mathfrak g}$. 
(Here $\mathsf k$ is central and $\mathsf d = t\del_t$ is the derivation element corresponding to the homogeneous gradation.)

We still have the Cartan decomposition ${\mathfrak g} =_{\mathbb C} \nm \oplus \h \oplus \np$. The Lie subalgebra $\np = \bigoplus_{\alpha \in \Delta_+} \np_\alpha$ is now of countably infinite dimension, and no longer nilpotent. But its completion ${\widetilde\np} = \prod_{\alpha\in \Delta_+} \np_\alpha$ is a pro-nilpotent pro-Lie algebra (i.e. a certain inverse limit of nilpotent Lie algebras -- see  \cite{Kumar}, and \cref{sec: npc} below) and there is still a bijective exponential map 
\be \exp: {\widetilde\np} \xrightarrow{\,\sim\,} U\nn\ee 
to a group $U$, which is now a pro-unipotent pro-group. We shall fix (in \cref{sec: coords}) a convenient choice of coordinates on $U$,
\be X^{a,n}: U \to {\mathbb C}.\nn\ee 
Here $\ii an$ runs over a countable index set, $\mathsf A$, which also indexes a topological basis $J_{a,n}$ of ${\widetilde\np}$. 
(Recall $\dim(\np_\alpha)$ can be greater than 1 in affine types other than $\wh\sl_2$, so we cannot simply index by the positive roots $\Delta_+$.) 

We set ${\O_{\np}} := {\mathbb C}[X^{a,n}]_{\ii a n\in \mathsf A}$ and define $\Der{\O_{\np}}$ to be the Lie algebra of derivations of ${\O_{\np}}$ consisting of sums of the form
\be \sum_{\ii a n \in \mathsf A} P^{\ia a n}(X) D_{\ia a n},\qquad P^{a,n}(X) \in {\O_{\np}},\nn\ee
subject to the constraint that only finitely summands are nonzero. It has a completion, $\Derc{\O_{\np}}\supset \Der{\O_{\np}}$, consisting of sums of the same form but without the constraint.
(Here the new generators $D_{\ia an}$ obey $[D_{\ia an},X^{\ia b m}] = \delta_{\ia an}^{\ia bm}$.)
As before, we define the space of one-forms $\Omega_{\O_{\np}} = \mathrm{Hom}_{\O_{\np}}(\Der{\O_{\np}},{\O_{\np}})$.


The group $U$ can still be seen as copy of the big cell of a flag manifold $B_-\backslash G$, in a sense made precise in \cite{KashiwaraFlag}.\footnote{It is perhaps worth stressing that $B_-\backslash G$ is not the \emph{affine Grassmannian} or the \emph{affine flag variety} in the usual sense of e.g. \cite[\S2.2]{Gortz}. For example when ${\mathfrak g}=\wh\sl_2$, the (set of ${\mathbb C}$-points of the) affine Grassmannian is $SL_2({\mathbb C}[[t]]) \big\backslash SL_2({\mathbb C}((t)))$, whereas here $B_-= SL_2(t^{-1}{\mathbb C}[t^{-1}]) \mathring B_-$ with $\mathring B_-$ the usual lower-triangular Borel subgroup of $SL_2({\mathbb C})$. See also the discussion in  \cite[\S5]{Fopersontheprojectiveline} (in which one should swap $t\leftrightarrow t^{-1}$ to match the present conventions).}
For our purpose the important point is that there is a homomorphism of Lie algebras,
\be \rho:{\mathfrak g} \to \Derc{\O_{\np}}; \qquad A\mapsto \sum_{\ii a n\in \mathsf A} P^{\ia a n}_A(X) D_{\ia a n} \label{affinebigcell}\ee
as we show in a concrete fashion in \cref{sec: inft}. This is the analog of the homomorphism \cref{bigcell}. 

Some examples in the case ${\mathfrak g} = \wh\sl_2$ are shown in \cref{sl2diffs}.

(The centre of ${\mathfrak g}$ lies in the kernel, $\rho(\mathsf k) = 0$, so the homomorphism $\rho$ actually factors through ${\mathfrak g}/{\mathbb C}\mathsf k \cong \mathring {\mathfrak g}[t,t^{-1}] \rtimes {\mathbb C}\mathsf d$.)

\begin{figure}
\begin{align}
\rho(J_{E,0}) &= D_{E,{0}} +2X^{H,{1}} D_{E,{1}} -X^{F,{1}}D_{H,{1}}\nn\\ 
&\quad +\left(2X^{H,{2}}-2\left(X^{H,{1}}\right)^{2}\right)D_{E,{2}}
-X^{F,{2}}D_{H,{2}}+\left(X^{F,{1}}\right)^{2}D_{F,{2}}\nn\\
&\quad +\left(2X^{H,{3}}+\tfrac{4}{3}\left(X^{H,{1}}\right)^{3}\right)D_{E,{3}}
+\left(-X^{F,{3}}-X^{E,{1}}\left(X^{F,{1}}\right)^{2}\right)D_{H,{3}}
+2\left(X^{F,{1}}\right)^{2}X^{H,{1}}D_{F,{3}}\nn\\
& \quad +\dots\nn\\
\nn\\
\rho(J_{F,1}) &= 
D_{F,{1}}
+X^{E,{1}}D_{H,{2}}
-2X^{H,{1}}D_{F,{2}}\nn\\
&\quad+\left(X^{E,{1}}\right)^{2}D_{E,{3}}
+\left(X^{E,{2}}+2X^{E,{1}}X^{H,{1}}\right)D_{H,{3}}
+\left(-2X^{H,{2}}-2\left(X^{H,{1}}\right)^{2}\right)D_{F,{3}}\nn\\
&\quad + \dots\nn\\
\nn\\
\rho(J_{E,-1}) &=
\left(2X^{H,{1}}+2X^{E,{0}}X^{F,{1}}\right)D_{E,{0}}\nn\\
&\quad
+\left(2X^{H,{2}}+2\left(X^{H,{1}}\right)^{2}\right)D_{E,{1}}
+\left(-X^{F,{2}}-2X^{F,{1}}X^{H,{1}}\right)D_{H,{1}}
-\left(X^{F,{1}}\right)^{2}D_{F,{1}}\nn\\
&\quad
+\left(2X^{H,{3}}+2X^{E,{1}}X^{F,{2}}-\tfrac{8}{3}\left(X^{H,{1}}\right)^{3}\right)D_{E,{2}}
-X^{F,{3}}D_{H,{2}}
+2\left(X^{F,{1}}\right)^{2}X^{H,{1}}D_{F,{2}}\nn\\
&\quad+ \dots\nn\\
\nn\\
\rho(J_{F,0}) &=
-\left(X^{E,{0}}\right)^{2}D_{E,{0}}
+X^{E,{1}}D_{H,{1}}
-2X^{H,{1}}D_{F,{1}}\nn\\
&\quad-\left(X^{E,{1}}\right)^{2}D_{E,{2}}
+X^{E,{2}}D_{H,{2}}
+\left(-2X^{H,{2}}+2\left(X^{H,{1}}\right)^{2}\right)D_{F,{2}}\nn\\
&\quad+\left(X^{E,{3}}-2X^{E,{1}}\left(X^{H,{1}}\right)^{2}\right)D_{H,{3}}
+\left(-2X^{H,{3}}+\tfrac{8}{3}\left(X^{H,{1}}\right)^{3}\right)D_{F,{3}}\nn\\
&\quad + \dots\nn
\end{align}
\caption{\label{sl2diffs}
In type ${\mathfrak g} = \wh\sl_2$, the first few terms of the images of the Chevalley-Serre generators $e_1 = J_{E,0}$, $e_0 = J_{F,1}$, $f_1 = J_{F,0}$,  $f_0 = J_{E,-1}$ under the homomorphism $\rho: {\mathfrak g} \to \Derc{\O_{\np}}$.
}
\end{figure}

\subsection{}
One may define the vacuum Verma module ${\mathbb V}_0^{{\mathfrak g},k}$ over ${\widehat \g}$ at level $k\in {\mathbb C}$ when ${\mathfrak g}$ is affine, such that \cref{Vkdef} still holds, where $\bilin\cdot\cdot$ is the standard non-degenerate symmetric invariant bilinear form from \cite{KacBook} (with $\bilin\mathsf k\mathsf d =1$ and so on). It is still a vertex algebra. 

The main result of the present paper (\cref{homcor}) is that the homomorphism $\rho$ can be promoted to a homomorphism of vertex algebras 
${\mathbb V}_0^{{\mathfrak g},0} \to \Mfw$.
Of course, we have yet to explain what $\Mfw$ is. To motivate its definition, it is instructive to consider what happens when one attempts to generalize the construction above in the most direct fashion.

Thus, let $\mathsf M(\np)$ be, again, the vacuum Fock module for the $\upbeta\upgamma$-system on $\np\cong U$. It is a vertex algebra, generated by (now, countably infinitely many) states $\upbeta_{\ia a n}\fm{-1}w_0$ and $\upgamma^{\ia a n}\fm 0 w_0$, $\ii a n \in \mathsf A$, obeying
\begin{align}
\upbeta_{\ia a n}\fm{-1}w_0\,\,\vap 0\,\, \upgamma^{\ia b m}\fm0w_0 = \delta_{\ia a n}^{\ia b m} w_0 .\n
\end{align} 
Both ${\mathbb V}_0^{{\mathfrak g},k}$ and $\mathsf M(\np)$ are once more ${\mathbb Z}_{\geq 0}$-graded by depth, and the identifications in \cref{firsttwo} continue to hold. 
(One now identifies $\upgamma^{\ia a n}\fm 0 \simeq X^{\ia a n}$, $\upgamma^{\ia a n}\fm{-1} \simeq dX^{\ia a n}$ and $D_{\ia a n} \simeq \upbeta_{\ia a n}\fm{-1}$.)  
In particular, 
\be \mathsf M(\np)[1] \cong \Der{\O_{\np}} \oplus \Omega_{{\O_{\np}}} .\nn\ee
Importantly, it is $\Der{\O_{\np}}$ and not its completion $\Derc{\O_{\np}}$ which appears here. Indeed, by definition, $\mathsf M(\np)$ consists of \emph{finite} linear combinations of states of the form 
$\upgamma^{\ia{a_1}{n_1}}[-N_1]\dots \upgamma^{\ia{a_r}{n_r}}[-N_r] 
                \upbeta_{\ia{b_1}{m_1}}[-M_1]\dots \upbeta_{\ia{b_s}{m_s}}[-M_s] w_0.$
Thus, in contrast to \cref{sec: finitetype}, the image $\rho({\mathfrak g})\subset \Derc\O$ does not naturally embed in $\mathsf M(\np)[1]$. 
We need some larger space. 
We shall introduce a completion $\widetilde\mathsf M(\np)$ of $\mathsf M(\np)$ as a vector space, in which certain infinite linear combinations are allowed provided they truncate to finite linear combinations when $\upbeta_{\ia a n}[N]$ is set to zero \emph{for large $n$}. (See \cref{sec: wtMh}
) The definition is chosen to ensure that
\be \widetilde\mathsf M(\np)[1] \cong \Derc{\O_{\np}} \oplus \Omega_{{\O_{\np}}} .\nn\ee
We get the graded linear map 
\be {\mathbb V}_0^{{\mathfrak g},k}\df 1 \to \widetilde\mathsf M(\np)\df 1\nn\ee
sending $w_0 \to w_0$ and 
\be A\fm{-1}w_0 \mapsto \sum_{\ii a n\in \mathsf A} P^{\ia a n}_A(\upgamma\fm0) \upbeta_{\ia a n}\fm{-1}w_0,\nn\ee
with $P^{a,n}_A(X)$ the polynomials from \cref{affinebigcell}. 

\subsection{}At this point, naively, one would like to ask whether this map gives rise to a homomorphism of vertex algebras in the same way as in \cref{fftoptwo} above. In that direction, we shall establish the following statement. (It will actually be a corollary, \cref{zeromodethm}, of our main result.) There exists a linear map 
\be \phi:{\mathfrak g} \to \Omega_{\O_{\np}}; \qquad A\mapsto \sum_{(a,n)\in \mathsf A} Q_{a,n;A}(X) dX^{a,n} \label{affphi}\ee
such that the graded linear map 
\be {\mathbb V}_0^{{\mathfrak g},k}\df 1 \to \mathsf M(\np)\df 1\nn\ee 
associated to $\rho+\phi:{\mathfrak g} \to \Derc{\O_{\np}} \oplus \Omega_{\O_{\np}}$, i.e. the one sending $w_0 \to w_0$ and 
\be A\fm{-1}w_0 \mapsto \sum_{(a,n) \in \mathsf A} P^{a,n}_A(\upgamma\fm0) \upbeta_{a,n}\fm{-1}w_0
+ \sum_{(a,n)\in \mathsf A} Q_{{a,n};A}(\upgamma\fm0) \upgamma^{a,n}\fm{-1}w_0,\nn\ee
does preserve \emph{at least the $0$th} vertex algebra product (for any $k\in {\mathbb C}$). That is, if we call this latter map $\vartheta$, we have
\be \vartheta(A) \vap 0 \vartheta(B) = \vartheta(A\vap 0 B) \label{zeroeq}\ee
for all $A\simeq A\fm{-1}w_0$ and $B\simeq B\fm{-1}w_0$ in ${\mathfrak g}\cong {\mathbb V}_0^{{\mathfrak g},k}[1]$. 

The map $\phi$ again respects the weight gradation, so that $\phi(\h\oplus \np) = 0$.

For example, in type ${\mathfrak g} = \wh\sl_2$, when using the same choice of coordinates on $U$ as in \cref{sl2diffs} one finds that
\begin{subequations}\label{hls}
\be \phi(f_1=J_{F,0}) = -2 dX^{E,0},\qquad \phi(f_0 = J_{E,-1}) = -4 dX^{F,1},\nn\ee
and then  
\begin{align} 
    \phi(J_{H,-1}) &= -12 dX^{H,1} - 4 X^{F,1} dX^{E,0}\nn\\ 
    \phi(J_{F,-1}) &= -8 dX^{E,1} + 4 X^{H,1} dX^{E,0} \nn\\
    \phi(J_{E,-2}) &= -10 dX^{F,2} -8 X^{H,1} dX^{F,1} +2 (X^{F,1})^2 dX^{E,0}, \nn
\end{align}
and so on.
\end{subequations}

While encouraging, this statement skirts around a serious caveat, which is the reason the question above was naive: the completion $\widetilde\mathsf M(\np)$ is not a vertex algebra. Or, more precisely, the vertex algebra structure on $\mathsf M(\np)$ does not extend to $\widetilde\mathsf M(\np)$. In particular, when one tries to extend the definition of the vertex algebra $n$th products $\vap n: \mathsf M(\np) \times \mathsf M(\np) \to \mathsf M(\np)$ by bilinearity to $\widetilde\mathsf M(\np)\times \widetilde\mathsf M(\np)$, the results are not in general finite.

Thus, it was a non-trivial fact about the image of $\vartheta$ that the expression $\vartheta(A) \vap 0 \vartheta(B)$ in \cref{zeroeq} was even well-defined. And one finds the would-be $1$st products $\vartheta(A) \vap 1 \vartheta(B)$ are not in general finite. 

\subsection{}\label{sec: zeta} 
As an aside, let us examine some examples of these divergences in type ${\mathfrak g}=\wh\sl_2$. 
\emph{For this subsection only}, we modify the OPEs by introducing a formal variable $z$ which will serve as a regulator:
\begin{align}
\upbeta_{\ia a n}\fm{-1}w_0\,\,\vap 0\,\, \upgamma^{\ia b m}\fm0w_0 = z^n \delta_{\ia a n}^{\ia b m} w_0.\nn
\end{align} 

One has 
\be \vartheta(J_{H,0}) = - 2 \sum_{n\geq 0} \upgamma^{E,n}[0] \upbeta_{E,n}[-1] w_0 
 + 2 \sum_{n\geq 1} \upgamma^{F,n}[0] \upbeta_{F,n}[-1] w_0 .\nn\ee 
It follows that the regulated $1$st product $\vartheta(J_{H,0})\vap 1 \vartheta(J_{H,0})$ is the formal series
\be \vartheta(J_{H,0})\vap 1 \vartheta(J_{H,0}) = \Bigl(-4 - 4 \sum_{n\geq 1} z^{2n}\Bigr)w_0.\nn\ee
(We recall the standard details of computing such products in \cref{sec: va}.)
As more intricate examples, one finds
\begin{align} 
\vartheta(J_{E, 1})\vap 1 \vartheta(J_{F,-1}) &=  \Bigl(-8z - 4 \sum_{n\geq 1} z^{2n+3}\Bigr)w_0 \nn\\
\vartheta(J_{H, 1})\vap 1 \vartheta(J_{H,-1}) &=  \Bigl(-12z - 4z^3 - 8 \sum_{n\geq 1} z^{2n+3}\Bigr)w_0 \nn
\\ \vartheta(J_{E,-2})\vap 1 \vartheta(J_{F,2}) &=  \Bigl(-10z^2  - 4 \sum_{n\geq 1} z^{2n+4}\Bigr)w_0 \nn
.\end{align} 
These series are divergent when one attempts to remove the regulator by setting $z=1$.
One might be tempted to treat these divergences by $\zeta$-function regularization. For an introduction to the formal-variable approach to $\zeta$-function regularization, see \cite{LepowskyZeta} (and cf. also \cite{Bloch,LepowskyZeta2,DLM1}). It amounts to the following prescription. First, one notes that each series above is the small-$z$ expansion of some rational expression in $z$. One substitutes $z=\Exp y$ in that rational expression, to obtain a rational expression in $\Exp y$; then one expands $\Exp y$ as a formal series in $y$. The result is a quotient of formal series in $y$, and hence a well-defined formal Laurent series in $y$. Finally, one extracts the constant term in that series.

Very suggestively, when one does that, the result is zero in each example above. For instance for $\vartheta(J_{E,-2})\vap 1 \vartheta(J_{F,2})$ one obtains 
$ -10 - 4 \left(-\frac{5}{2}\right) = 0$.
In what follows we shall use a different approach,
\ifdefinedtrue
\else
\footnote{
The reason is that these divergences are not the only obstacle to making  $\widetilde\mathsf M(\np)$ into a vertex algebra. Here is another: the vertex algebra axioms include
\be A\vap 1\left( B \vap 0C\right) = \left( A \vap 1 B\right)\vap 0 C + B\vap 0 \left( A \vap 1 C\right) + \left( A \vap 0 B\right) \vap 1 C,
\label{rel10}\ee
but consider the following elements of $\widetilde\mathsf M(\np)$, in the case ${\mathfrak g}=\wh\sl_2$: 
\be A = \sum_{n\geq 0} \upgamma^{\ia E n}\fm 0 \upbeta_{\ia E n}\fm{-1}w_0\quad
    B = \sum_{n\geq 1} \upgamma^{\ia E {n-1}}\fm 0 \upbeta_{\ia E n}\fm{-1}w_0 ,\quad 
    C = \sum_{n\geq 0} \upgamma^{\ia E {n+1}}\fm 0 \upbeta_{\ia E n}\fm{-1}w_0 .\nn\ee
Then every term on the right in \cref{rel10} is zero, yet on the left we have $A\vap 1 \left( B\vap 0 C\right) = A\vap 1 \left(\upgamma^{\ia E 0}\fm 0 D_{\ia E 0}\fm{-1}w_0\right) = - 1$. The underlying problem here is that the commutator ($B\vap 0 C$) of two traceless semi--infinite matrices ($B$ and $C$) need not be traceless. (When there is an upper cut-off $N$ on the index $n$, one has instead $B\vap 0 C =   \upgamma^{\ia E 0}\fm 0 \upbeta_{\ia E 0}\fm{-1}w_0 - \upgamma^{\ia E N}\fm 0 \upbeta_{\ia E N}\fm{-1}w_0$ and then $A\vap 1(B\vap 0 C) = -1 +1 = 0$, and \cref{rel10} holds.)
} 
\fi
but it will indeed be the case that the homomorphism we construct is from the vacuum Verma module at level zero.

\subsection{} To proceed, we need more information about the image of the homomorphism $\rho:{\mathfrak g} \to \Derc{\O_{\np}}$ from \cref{affinebigcell}.
We illustrate the idea with an example in type ${\mathfrak g}=\wh\sl_2$. Let us consider a term in the infinite sum $\rho(e_1) = \sum_{(a,n) \in \mathsf A} P^{a,n}_{e_1}(X) D_{a,n}$ for the generator $e_1 = J_{E,0}$: say, the term $P^{E,8}_{e_1}(X) D_{E,8}$. One finds
\begin{align}
P_{e_1}^{E,8}(X) &= 2 X^{H,8} \nn\\
&      - 2 \left(X^{H,4}\right)^2
       + 4 \left(X^{H,2}\right)^2 X^{H,4}
       - \tfrac 23 \left(X^{H,2}\right)^4
       - 8 \left(X^{H,1}\right)^2 X^{H,2} X^{H,4}\nn\\
&       + \tfrac 83 \left(X^{H,1}\right)^2 \left(X^{H,2}\right)^3
       + \tfrac{16}{3} \left(X^{H,1}\right)^3 X^{H,2} X^{H,3}
       + \tfrac{4}{3} \left(X^{H,1}\right)^4 X^{H,4}
       - \tfrac{4}{3} \left(X^{H,1}\right)^4 \left(X^{H,2}\right)^2\nn\\
&       - \tfrac{8}{15} \left(X^{H,1}\right)^5 X^{H,3}
       + \tfrac{8}{45} \left(X^{H,1}\right)^6 X^{H,2}
       - \tfrac{2}{315} \left(X^{H,1}\right)^8
       + \tfrac{8}{3} X^{E,3} X^{F,2} \left(X^{H,1}\right)^3\nn\\
&       - \tfrac{4}{3} X^{E,2} X^{F,2} \left(X^{H,1}\right)^4
       - 4 X^{E,2} X^{E,3} \left(X^{F,1}\right)^2 X^{H,1}
       - \left(X^{E,2}\right)^2 \left(X^{F,2}\right)^2\nn\\
&       - 2 \left(X^{E,2}\right)^2 \left(X^{F,1}\right)^2 \left(X^{H,1}\right)^2
       - 4 X^{E,1} X^{E,3} \left(X^{F,1}\right)^2 \left(X^{H,1}\right)^2
       + 4 X^{E,1} X^{E,2} \left(X^{F,1}\right)^2 X^{H,3}\nn\\
&       - \tfrac 83 X^{E,1} X^{E,2} \left(X^{F,1}\right)^2 \left(X^{H,1}\right)^3
       + 2 \left(X^{E,1}\right)^2 \left(X^{F,1}\right)^2 X^{H,4}
       - 2 \left(X^{E,1}\right)^2 \left(X^{F,1}\right)^2 \left(X^{H,2}\right)^2\nn\\
&       + 4 \left(X^{E,1}\right)^2 \left(X^{F,1}\right)^2 X^{H,1} X^{H,3}
       + 4 \left(X^{E,1}\right)^2 \left(X^{F,1}\right)^2 \left(X^{H,1}\right)^2 X^{H,2}\nn\\
&       - \tfrac 23 \left(X^{E,1}\right)^2 \left(X^{F,1}\right)^2 \left(X^{H,1}\right)^4
 - 2 \left(X^{E,1}\right)^2 X^{E,2} \left(X^{F,1}\right)^2 X^{F,2}.\nn
\end{align}
Observe that only the first monomial has any factor $X^{a,n}$ with $n> 4$. 
This is an example of a general pattern: for any fixed  $A\in{\mathfrak g}$, in the coefficient polynomials $P^{a,n}_A(X)$ there is, for large $n$, always at most one leading monomial $X^{b,m}$ with $m\sim n$; the remaining monomials have only factors $X^{c,p}$ with $p \lesssim n/2$. 

We shall make this idea precise with the notion of \emph{widening gap} in \cref{sec: Dw}. See \cref{linthm}, which will show that the difference  
\be \rho(J_{a,n}) - \sum_{b,c\in \mathcal I} f_{ba}{}^c \sum_{m > \max(1,n) } X^{b,m-n} D_{c,m}, \label{wgi}\ee
has widening gap. (Here $f_{ba}{}^c$ are structure constants of $\mathring{\mathfrak g}$.) Elements of widening gap form a Lie algebra, $\Dw$, with $\Der{\O_{\np}}\subset \Dw \subset\Derc{\O_{\np}}$.

The notion of widening gap goes over to the vertex algebra $\mathsf M(\np)$: one can define a subspace $\Mw(\np)$ of the completion $\widetilde\mathsf M(\np)$ in which infinite sums are allowed but only if they have widening gap. The vertex algebra structure on $\mathsf M(\np)$ does extend to $\Mw(\np)$. (See \cref{lem: Mw}.)   


\subsection{}\label{sec: vfintro}
The question therefore becomes: what to do with the leading terms in $\rho(J_{a,n})$? 
Our approach, in \cref{sec: cai}, will be to glue together two copies of the realization \cref{affinebigcell} back-to-back. Let $ {\O} := \O({\mathfrak g}) := {\mathbb C}[X^{\ia a n}]_{\ii a n \in \mathcal I \times \ZZ} $ denote the algebra of polynomial functions on all of ${\mathfrak g}$. We shall define $\Derc{\O}$ and its subalgebra, $\Dwg$, of elements of widening gap. The Cartan involution $\sigma:{\mathfrak g}\to{\mathfrak g}$, which exchanges $\np$ and $\nm$, gives rise to an involution $\tau: \Derc{\O}\to \Derc{\O}$, which exchanges $\Derc{\O_{\np}}$ and $\Derc{\O(\nm)}$.
On twisting the homomorphism $\rho : {\mathfrak g} \hookrightarrow \Derc{\O_{\np}} \subset$ from \cref{affinebigcell} by these involutions, we get a homomorphism $\tau\circ\rho\circ\sigma: {\mathfrak g} \hookrightarrow \Derc{\O(\nm)}$. Adding the two, we obtain a homomorphism
\begin{align} \bm\rho := (\rho + \tau\circ\rho\circ\sigma) : {\mathfrak g} 
&\to \Derc{\O_{\np}} \oplus \Derc{\O(\nm)}\nn\\&\hookrightarrow \Derc{\O}.\n
\end{align}
Of course, having helped oneself to a copy of $\O=\O({\mathfrak g})$, there is an obvious homomorphism ${\mathfrak g}\to \Derc{\O}$ coming from the coadjoint representation, which sends $J_{a,n}\mapsto\sum_{b,c\in \mathcal I} f_{ba}{}^c \sum_{m\in {\mathbb Z}}  X^{b,m-n} D_{c,m}$. So one should keep in mind that what is special about the homomorphism $\bm\rho$ is that, by construction, the resulting action of ${\mathfrak g}$ on ${\O}$ stabilizes ${\O_{\np}}$ and ${\O(\nm)}$.

We then check that the difference
\be \bm\rho(J_{a,n}) - \sum_{b,c\in \mathcal I} f_{ba}{}^c \sum_{m\in {\mathbb Z}}  X^{b,m-n} D_{c,m} \nn\ee
has widening gap, i.e. belongs to $\Dwg$. The advantage of this statement, compared to \cref{wgi}, is that we can replace the sums, $\sum_{m\in {\mathbb Z}}  X^{b,m-n} D_{c,m}$, by an abstract set of generators $\SS^b_{c,n}$ of the loop algebra ${\mathfrak{gl}}(\mathring{\mathfrak g})[t,t^{-1}]$. In this way we can, and shall, regard $\bm\rho$ as a homomorphism from ${\mathfrak g}$ to the Lie algebra 
\be \Dg := \Dwg \rtimes \left(\gl(\oc\g)\ox \CC[t,t^{-1}] \rtimes {\mathbb C}\mathsf D\right) \label{Dgintro}\ee
(here $\mathsf D$ is a derivation element, and ${\mathfrak g}\ni\mathsf d\mapsto\mathsf D$).
See \cref{lem: Jdif} and the discussion following.

\subsection{} 
We define a vertex algebra $\Mfw$ in light of this definition of the Lie algebra $\Dg$. Namely, we have $\mathsf M := \mathsf M({\mathfrak g})$, the vacuum Fock module for the $\upbeta\upgamma$-system on ${\mathfrak g}$, and we introduce its completion as a vector space, $\widetilde\mathsf M$, and the subspace generated by elements of widening gap, $\Mw\subset \widetilde\mathsf M$. 
Then $\Mw$ is a vertex algebra, and we can take a ``semi-direct product of vertex algebras'' with the level zero vacuum Verma module ${\mathbb V}_0^{\gl(\oc\g)\ox \CC[t,t^{-1}]\rtimes {\mathbb C}\mathsf D,0}$ to define $\Mfw$; so, as a vector space,
\be \Mfw \cong_{\mathbb C} \Mw \otimes {\mathbb V}_0^{\gl(\oc\g)\ox \CC[t,t^{-1}]\rtimes{\mathbb C}\mathsf D,0}. \nn\ee
See \cref{sec: Mfw}. By construction we have
\begin{align} \Mfw[0] &\cong {\O} \nn\\
              \Mfw[1] &\cong \Dg \oplus  \Omega_{\O} .\nn\end{align}
At that point we shall be in a position to state our main result: see \cref{mainthm} and \cref{homcor}. 
It says the following: let $\bm\phi = \phi + \tau \circ\phi \circ\sigma : {\mathfrak g} \to \Omega_{\O}$
where $\phi:{\mathfrak g}\to \Omega_{\O_{\np}}\subset \Omega_{{\O}}$ is the map from \cref{affphi}. Then the graded linear map 
\be {\mathbb V}_0^{{\mathfrak g},0}\df 1 \to \Mfw\df 1\nn\ee 
associated to $\bm\rho+\bm\phi:{\mathfrak g} \to \Dg \oplus \Omega_{\O}$ (in the same fashion as above) preserves the non-negative products, and is the restriction of a homomorphism of graded vertex algebras
\be \theta: {\mathbb V}_0^{{\mathfrak g},0} \to \Mfw.\label{thetadef}\ee

Associated to this homomorphism of vertex algebras is a homomorphism of Lie algebras
\be L{\mathfrak g} \to \L(\Mfw\df 1)\label{Lghom}\ee 
from the loop algebra $L{\mathfrak g} := {\mathfrak g} \otimes {\mathbb C}((s))$ of the affine algebra ${\mathfrak g}$ to the Lie algebra of formal modes of states in $\Mfw\df1$. In fact, the central element $\mathsf k\in {\mathfrak g}$ is in the kernel of $\rho$, so we actually get a homomorphism
\be L\!L\oc\g \to \L(\Mfw\df1) \nn\ee
from the double-loop algebra $L\!L\oc\g := \mathring{\mathfrak g}[t,t^{-1}]\otimes {\mathbb C}((s))$.

The homomorphism $\theta$ has the property that the non-negative modes of states in ${\mathbb V}_0^{{\mathfrak g},0}[1]\cong {\mathfrak g}$ stabilize $\mathsf M(\np)$ and $\mathsf M(\nm)$ inside $\mathsf M= \mathsf M({\mathfrak g})$. Thus, we get an action of $L_+{\mathfrak g}:= {\mathfrak g}\otimes {\mathbb C}[[s]]$, and in fact of $L_{\!+}L\oc\g := \mathring{\mathfrak g}[t,t^{-1}] \otimes {\mathbb C}[[s]]$, on $\mathsf M(\np)$ and $\mathsf M(\nm)$. See \cref{Lpgstab}. 
(This is in contrast to the obvious vertex-algebra homomorphism ${\mathbb V}_0^{{\mathfrak g},0}\to \Mfw$, which sends $J_{a,n}\fm{-1}w_0 \to \sum_{b,c\in \mathcal I} f_{ba}{}^c \SS^b_{c,n}\fm{-1}w_0 $; cf. \cref{sec: vfintro}.)


Finally, in \cref{bthm}, we shall lift the homomorphism $\theta$ to a homomorphism
\be  {\mathbb V}_0^{{\mathfrak g},0} \to \Mfw \otimes \pi_0 \nn\ee
where $\pi_0$ is the vacuum Fock module for a system of $\dim\h$ free bosons (see \cref{sec: pi0}). (For this homomorphism, the state $\mathsf k\fm{-1}w_0$ is no longer in the kernel.)



\subsection{} \label{sec: discussion}

Let us conclude this introduction with some comments about these results.

\medskip

The homomorphism $\theta$ is not a \emph{free-field} realization: we adjoined the copy of the vacuum Verma module ${\mathbb V}_0^{\gl(\oc\g)\ox \CC[t,t^{-1}]\rtimes {\mathbb C}\mathsf D,0}$ in the definition of $\Mfw$, and so the vertex algebra $\Mfw$ does not have mutually commuting creation operators and mutually commuting annihilation operators.
This is apparent already at the level of the Lie algebra homomorphism $\bm\rho : {\mathfrak g} \to \Dg$: the Lie algebra $\Dg$ defined in \cref{Dgintro} had generators $\SS^a_{b,n}$ in addition to the 
mutually commuting coordinates $X^{a,n}$ and mutually commuting derivatives $D_{a,n}$. 
There is some rough intuition that says that is to be expected. In this paper, the vertex algebra structure is always associated to the second coordinate, $s$, appearing in the double loop algebra $L\!L\oc\g := \mathring{\mathfrak g}[t,t^{-1}] \otimes {\mathbb C}((s))$.
One would like to be able to say at the same time that $X^{a,n}$ and $D_{b,n}$ are modes in the $t$-coordinate of states ``$X^a_{0}w_0$'' and ``$D_{b,-1}w_0$'', and then that the $\SS^a_{b,n}$ are merely the modes in the $t$-coordinate of a composite state, ``$X^a_{0} D_{b,-1} w_0$'', roughly speaking. 
To make sense of such statements, one would need a theory of vertex algebras on polydiscs (of complex dimension two, in our case), perhaps following \cite{CG,GW,SWW}. Since in the present paper we confine ourselves to the standard definition of vertex algebras, it is perhaps unsurprising that we need to include these $\SS^a_{b,n}$ as generators in their own right.

Relatedly, whereas in finite types $\mathsf M(\np)$ gets the structure of a module at the critical level over the central extension ${\widehat \g}$ of the full loop algebra $L{\mathfrak g}$, here the subspace $\mathsf M(\np)\subset \Mfw$ is stabilized by $L_+{\mathfrak g}$, as in \cref{Lpgstab}, but certainly not by all of $L{\mathfrak g}$. It might be interesting to study the $L{\mathfrak g}$ module through $\mathsf M(\np)$ inside $\Mfw$.
 
\medskip


To illustrate the structure of the image of $\theta$, let us examine an example in type ${\mathfrak g} = \wh\sl_2$. One finds
\begin{align}\label{exmp}
 \theta(J_{F,1}\fm{-1} w_0) = 
& \phantom+  \SS^E_{H,1}\fm{-1} w_0 - 2 \SS^H_{F,1}\fm{-1}w_0\\
&       - \upgamma^{E,0}\fm0 \upbeta_{H,1}\fm{-1} w_0
       - \upgamma^{E,-1}\fm0 \upbeta_{H,0}\fm{-1} w_0
       + 2\upgamma^{H,0}\fm0 \upbeta_{F,1}\fm{-1} w_0\nn\\
&       - 4\upgamma^{E,-1}\fm{-1} w_0\nn\\
&       + \upbeta_{F,1}\fm{-1} w_0\nn\\
&       + 2\upgamma^{E,-1}\fm0 \upgamma^{F,0}\fm0 \upbeta_{F,0}\fm{-1} w_0       - \upgamma^{E,-1}\fm0 \upgamma^{E,-1}\fm0 \upbeta_{E,-1}\fm{-1} w_0\nn\\
&       - 2\upgamma^{H,-1}\fm0 \upgamma^{E,-1}\fm0 \upbeta_{H,-1}\fm{-1} w_0       + 2\upgamma^{H,-1}\fm0 \upgamma^{H,-1}\fm0 \upbeta_{F,-1}\fm{-1} w_0\nn\\
&       + 2\upgamma^{E,-2}\fm0 \upgamma^{F,-1}\fm0 \upbeta_{F,-2}\fm{-1} w_0       - 2\upgamma^{H,-1}\fm0 \upgamma^{E,-1}\fm0 \upgamma^{E,-1}\fm0 \upbeta_{E,-2}\fm{-1} w_0\nn\\
&       + \tfrac 83\upgamma^{H,-1}\fm0 \upgamma^{H,-1}\fm0 \upgamma^{H,-1}\fm0 \upbeta_{F,-2}\fm{-1} w_0\nn\\
&       + \upgamma^{E,1}\fm0 \upgamma^{E,1}\fm0 \upbeta_{E,3}\fm{-1} w_0       + 2\upgamma^{H,1}\fm0 \upgamma^{E,1}\fm0 \upbeta_{H,3}\fm{-1} w_0\nn\\
&       - 2\upgamma^{H,1}\fm0 \upgamma^{H,1}\fm0 \upbeta_{F,3}\fm{-1} w_0
+\dots.\nn
\end{align}
In the first line there are terms belonging to ${\mathbb V}_0^{\gl(\oc\g)\ox \CC[t,t^{-1}]\rtimes {\mathbb C}\mathsf D,0}[1]$; in the second,  a finite sum of compensating quadratic terms. Then in the remaining lines is the sum of other terms, which is infinite but with widening gap. 
The divergences in the $1$st products, cf. \cref{sec: zeta}, are removed because we set the $1$st products of the states $\SS^a_{b,n}\fm{-1} w_0$ to zero. Note that zero, rather than some other finite level, was not a choice: since $\theta(\mathsf k\fm{-1}w_0) =0$ and $\bilin\mathsf k\mathsf d = 1$, $\theta$ could not be a homomorphism from ${\mathbb V}_0^{{\mathfrak g},k}$ at any nonzero level $k$. 
Correspondingly, the homomorphism in \cref{Lghom} is from the loop algebra $L{\mathfrak g}$, rather than any central extension thereof. It is tempting to say that the critical level is zero for untwisted affine algebras. We do not consider deforming to other levels in the present paper.

\medskip

One motivation for the present paper comes from Gaudin models. In the case of ${\mathfrak g}$ of finite type there is a deep connection  \cite{FFR,Fopers} between the centre of the vacuum Verma module at the critical level, ${\mathbb V}_0^{{\mathfrak g},-h^\vee}$, and the (large, commutative) algebra of Gaudin Hamiltonians, sometimes called the Bethe algebra \cite{MTV1,MTVschubert,RybnikovProof}. In the approach to the Bethe ansatz for Gaudin models described in \cite{FFR}, the Feigin-Frenkel homomorphism ${\mathbb V}_0^{{\mathfrak g},-h^\vee}\to \mathsf M(\np)\otimes \pi_0$ plays a key role. 
Gaudin models of \emph{affine} type should provide a means of describing the spectra of integrals of motion of certain integrable quantum field theories: an idea pioneered in \cite{FFsolitons}, and with further progress in \cite{V17,FH, LVY,LVY2,LacroixThesis,FJM,DKLMV,DLMV2,Vic2,Y,GLVW}.

\subsection{} The structure of this paper is as follows. 

In \cref{sec: diffop} we construct the homomorphism $\rho: {\mathfrak g} \to \Derc{\O_{\np}}$. Then in \cref{sec: cai} we introduce the homomorphism $\bm\rho: {\mathfrak g} \to \Dg$. In \cref{sec: va} we recall basic facts about $\upbeta\upgamma$-systems and vertex algebras, before going on to state the main results starting in \cref{sec: mr}. The proof of the main theorem, \cref{mainthm}, is given in \cref{sec: proof}. It follows the strategy due to Feigin and Frenkel and discussed in detail in \cite[\S5]{Fre07}. In particular, we introduce the $\mathsf b\mathsf c$-ghost system and use it to define a subcomplex, the \emph{local complex}, of the Chevalley-Eilenberg complex for (in our case) the double loop algebra $L\!L\oc\g$. In \cref{sec: proofb} we give the proof of \cref{bthm}. Finally, in \cref{sec: cis} we compute explicitly the values of coefficients appearing in the images of the Chevalley-Serre generators of ${\mathfrak g}$ under the homomorphism $\theta$: see \cref{CScor}.



\section{Realization of ${\mathfrak g}$ by differential operators on the big cell}\label{sec: diffop}

\subsection{Loop realization} \label{sec: loop rel}
We work over the complex numbers ${\mathbb C}$. Let $\mathring{\mathfrak g}$ be a finite-dimensional simple Lie algebra, and  
$\oc\g[t,t^{-1}]$ the Lie algebra of Laurent polynomials, in a formal variable $t$, with coefficients in $\mathring{\mathfrak g}$.
Let $\bilin{\cdot}{\cdot}: \mathring{\mathfrak g}\times\mathring{\mathfrak g} \to {\mathbb C}$ denote the non-degenerate symmetric $\mathring{\mathfrak g}$-invariant bilinear form on $\mathring{\mathfrak g}$, with the standard normalization from \cite{KacBook}. 
Let ${\mathfrak g}'$ denote the central extension of $\oc\g[t,t^{-1}]$ by a one dimensional centre ${\mathbb C}\mathsf k$,
\be 0 \to {\mathbb C} \mathsf k \to {\mathfrak g}' \to \oc\g[t,t^{-1}] \to 0, \nn\ee
whose commutation relations are given by $[\mathsf k,\cdot] = 0$ and 
\be [a \otimes f(t), b \otimes g(t) ] :=[a,b] \otimes f(t) g(t) - (\res_tfdg) \bilin a b \mathsf k .\nn\ee
If we write $a_n := a\otimes t^n$ for $a\in \mathring{\mathfrak g}$ and $n\in {\mathbb Z}$, the commutation relations take the form
\be [a_m, b_n ] = [a,b]_{n+m} + m \delta_{n+m,0} \bilin a b \mathsf k .\nn\ee

Define the Lie algebra 
\be {\mathfrak g} := {\mathfrak g}' \rtimes  {\mathbb C}\mathsf d,\nn\ee
by declaring that $\mathsf d$ obeys $[\mathsf d,\mathsf k]=0$ and $[\mathsf d, a\otimes f(t)] = a\otimes t\del_t f(t)$ for all $a \in \mathring{\mathfrak g}$ and $f(t) \in {\mathbb C}[t,t^{-1}]$. 

The form $\bilin{\cdot}{\cdot}$ extends uniquely to a non-degenerate invariant symmetric bilinear form on ${\mathfrak g}$, which we also write as $\bilin{\cdot}{\cdot}$, whose nonzero entries are given by
\be \bilin{a_n}{b_m} = \bilin a b \delta_{n+m,0} ,\qquad \bilin \mathsf k \mathsf d = \bilin \mathsf d \mathsf k = 1 \nn\ee 
for $a,b\in \mathring{\mathfrak g}$, $n,m\in {\mathbb Z}$.
\subsection{Kac-Moody data}\label{sec: uaa}
Recall that the Lie algebra ${\mathfrak g}$ is isomorphic to a Kac-Moody algebra ${\mathfrak g}(A)$ with indecomposable Cartan matrix $A = (A_{ij})_{i,j\in I}$ of untwisted affine type. Here  $I=\{0,1,\dots,\ell\}$ is the set of the labels of the nodes of the Dynkin diagram. 
Let $\h\subset {\mathfrak g}(A)$ be the Cartan subalgebra and 
\be {\mathfrak g} = \nm \oplus \h \oplus \np \nn\ee
the Cartan decomposition, where $\np$ (resp. $\nm$) is generated by $e_i$ (resp. $f_i$), $i\in I$. These $e_i,f_i$ are the Chevalley-Serre generators of the derived subalgebra ${\mathfrak g}' := [{\mathfrak g},{\mathfrak g}]$. By definition they obey
\begin{subequations} \label{KMrels}
\begin{alignat}{2}
\label{KM rel a} [h,  e_i] &= \langle \alpha_i,h\rangle   e_i, &\qquad
[h,  f_i] &= - \langle \alpha_i,h\rangle  f_i, \\
\label{KM rel b} [h, h'] &= 0, &\qquad
[ e_i,  f_j] &= \check \alpha_i \delta_{ij},
\end{alignat}
for any $h, h' \in \h$, together with the Serre relations
\be \label{KM rel c}
(\text{ad}\,  e_i)^{1- A_{ij}}  e_j = 0, \qquad (\text{ad}\,  f_i)^{1- A_{ij}}  f_j = 0.
\ee
\end{subequations}
Here  $\left<\cdot,\cdot\right> : \h^* \times \h \to {\mathbb C}$ is the canonical pairing, $\alpha_i$ (resp. $\check\alpha_i$), $i\in I$, are the simple roots (resp. simple coroots) of ${\mathfrak g}$. We have $\left< \alpha_i,\check\alpha_j\right> = A_{ji}$.

Let $\b := \h \oplus \np$ and $\b_- := \h \oplus \nm$. 

There exist unique collections of relatively prime positive integers $\{\check a_i\}_{i\in I}$ and $\{a_i\}_{i\in I}$ such that $\sum_{j\in I} A_{ij} a_j  =0$ and $\sum_{j\in I} \check a_i A_{ij} = 0$. Whenever ${\mathfrak g}$ is untwisted (in fact more generally whenever ${\mathfrak g}$ is not of type ${}^2\!A_{2k}$) one has $\check a_0 = 1$ and $a_0 = 1$.  
The dual Coxeter and Coxeter numbers of ${\mathfrak g}$ are given respectively by
\be h^\vee = \sum_{i\in I} \check a_i,\qquad h = \sum_{i\in I} a_i = 1+ \sum_{i\in \mathring I} a_i. \nn\ee
The central element $\mathsf k\in \h$ and imaginary root $\delta\in \h^*$ are given by
\be \mathsf k = \sum_{i\in I} \check a_i \check \alpha_i\in \h, \qquad \delta = \sum_{i\in I} a_i \alpha_i \in {}^L\h\label{kddef}\ee

Let $\mathring I = I \setminus \{0\} = \{1,\dots,\ell\}$. The matrix $(A_{ij})_{i,j\in \mathring I}$ obtained by removing the zeroth row and column of $A$ is the Cartan matrix of $\mathring{\mathfrak g}$. 
Let $\mathring\h := \textup{span}_{\mathbb C} \{\check\alpha_i\}_{i\in \mathring I}\subset {\mathfrak g}$ denote its Cartan subalgebra and $\mathring\h^* = \textup{span}_{\mathbb C} \{\alpha_i\}_{i\in \mathring I}$ its dual.

\subsection{Root lattice and basis of root vectors}\label{Bpdef}
Let $Q := \bigoplus_{i\in I} {\mathbb Z} \alpha_i$ denote the root lattice of ${\mathfrak g}$. We have the decomposition of ${\mathfrak g}$ into root spaces,
\be {\mathfrak g} = \bigoplus_{\alpha\in Q} {\mathfrak g}_\alpha,\qquad {\mathfrak g}_\alpha := \{ x\in {\mathfrak g}: [h,x] = x \left< \alpha,h\right> \text{ for all }  h\in \h\},\nn\ee
and this is a $Q$-gradation of the the Lie algebra ${\mathfrak g}$.  
Let $\Delta := \{ \alpha\in Q: \dim {\mathfrak g}_\alpha \neq 0 \}$ be the set of roots of ${\mathfrak g}$. 
We write $Q_{\geq 0} := \bigoplus_{i \in I} {\mathbb Z}_{\geq 0} \alpha_i$ and $Q_{>0} := Q_{\geq 0} \setminus \{0\}$. The positive roots of ${\mathfrak g}$ are $\Delta_+ := Q_{>0} \cap \Delta$. 

Let $\mathring Q := \bigoplus_{i\in \mathring I} {\mathbb Z}\alpha_i$ denote the root lattice of $\mathring{\mathfrak g}$ and $\mathring \Delta \subset \mathring Q$ its set of roots. Let $\mathring \Delta_+ := \mathring \Delta \cap \Delta_+$ be the positive roots of $\mathring{\mathfrak g}$. 

Recall that the roots of ${\mathfrak g}$ are given by
\be \Delta = \{ \alpha + n \delta : \alpha \in \mathring\Delta, n \in {\mathbb Z}\} \cong \mathring \Delta \times {\mathbb Z}\nn\ee
and the positive roots are given by
\be \Delta_+ = \mathring\Delta_+ \sqcup \{ \alpha + n\delta: \alpha \in \mathring \Delta, n\in \ZZ_{\geq 1}\} \cong \mathring \Delta_+ \sqcup \mathring \Delta \times \ZZ_{\geq 1} \nn\ee

Let $\{H_i\}_{i\in \mathring I}\subset \mathring\h$ be a basis of $\mathring\h$. 
Choose root vectors $E_{\pm \alpha}\in \mathring{\mathfrak g}_{\pm \alpha}$ for each $\alpha\in \mathring\Delta_+$, normalized such that $\left< \alpha , [E_\alpha,E_{-\alpha}] \right> = 2$. 
Let\footnote{Strictly speaking, in the examples in type $\wh\sl_2$ in the introduction, we wrote for example $J_{E,n}$ rather than $J_{\alpha_1,n}$ and $J_{H,n}$ rather than $J_{1,n}$.}
\be J_\alpha := E_\alpha, \qquad J_i := H_i,\nn\ee
and also let $\mathcal I := \left(\mathring\Delta\setminus\{0\}\right) \cup \mathring I$,
so that
\be \{ J_a \}_{a\in \mathcal I} = \{E_{\pm\alpha}\}_{\alpha\in\mathring\Delta_+}\cup \{H_i\}_{i\in \mathring I} \nn\ee
is a Cartan-Weyl basis of $\mathring{\mathfrak g}$. 

Let $\mc B$ denote the basis of ${\mathfrak g}$ given by
\be \mc B = \{\mathsf k,\mathsf d\} \cup \{ J_{a,n} \}_{a\in \mathcal I, n\in {\mathbb Z}}\nn\ee 
where $J_{a,n} := J_a\otimes t^n$.
We fix a total ordering $\prec$ on $\mc B$ as follows. 
Pick any total ordering $\prec$ of the positive roots $\mathring\Delta_+$ of $\mathring{\mathfrak g}$ such that $\alpha\prec\beta$ whenever $\alpha-\beta \in Q_{>0}$.  
and any total ordering $\prec$ of the Cartan generators $\{H_i\}$ of $\mathring{\mathfrak g}$. Then declare that for every $n\in {\mathbb Z}$,
\begin{subequations}\label{Bpdef}
\be E_{-\beta,n} \prec E_{-\alpha,n} \prec H_{i,n} \prec H_{j,n} \prec E_{\alpha,n} \prec E_{\beta,n} \prec E_{-\beta,n+1} \dots \ee
whenever $i\prec j$ and $\alpha\prec \beta$, and finally that 
\be E_{-\alpha,0} \prec \mathsf d \prec \mathsf k \prec H_{i,0}. \nn\ee
\end{subequations}


We can identify the Chevalley-Serre generators of ${\mathfrak g}'$ as follows: $e_i = E_{\alpha_i,0}$ and $f_i = E_{-\alpha_i,0}$, for $i\in \mathring I$, while $e_0 = E_{-\delta+\alpha_0,1}$ and $f_0 = E_{\delta-\alpha_0,-1}$, 
where
\be \delta-\alpha_0 = \sum_{i\in \mathring I} a_i \alpha_i \in \mathring\Delta_+\label{highestrootdef}\ee 
is the highest root of $\mathring{\mathfrak g}$. 

Let 
\be \wgt: \mathcal I \times \ZZ \to Q; \quad 
\begin{cases} \wgt{\ii \alpha n} = \alpha + n \delta & \alpha \in \mathring\Delta \setminus\{0\} \\
              \wgt{\ii i n} = n \delta  & i \in \mathring I 
            \end{cases}
            \nn\ee
\subsection{The pro-nilpotent pro-Lie algebra ${\widetilde\np}$}\label{sec: npc}
Define 
\be {\widetilde\np} := \prod_{\alpha\in \Delta_+} {\mathfrak g}_\alpha. \nn\ee
An element of ${\widetilde\np}$ is a (possibly infinite) sum of the form $\sum_{\alpha\in \Delta_+} x^\alpha$ with $x^\alpha\in {\mathfrak g}_\alpha$ for each $\alpha\in \Delta_+$. (It lies in $\np\subset {\widetilde\np}$ if and only if all but finitely many of the $x^\alpha$ are zero.) The Lie bracket is well-defined on ${\widetilde\np}$ because, for a given positive root $\alpha\in \Delta_+$, there are only finitely many positive roots $\beta,\gamma\in \Delta_+$ such that $\beta+\gamma=\alpha$. Similarly, the Lie bracket is well-defined on 
\be {\widetilde \b} := \h\oplus {\widetilde\np}, \qquad {\widetilde \g} := \nm \oplus \h \oplus {\widetilde\np} .\nn\ee 

Let $\height(\alpha)$ denote the grade of a root $\alpha\in Q$ in the homogeneous ${\mathbb Z}$-gradation of ${\mathfrak g}$,
i.e. $\height(n\delta + \alpha) = n$ for $n\in {\mathbb Z}$ and $\alpha\in \mathring\Delta$. 
Define
\be \n_{\geq k} := \bigoplus_{\substack{\alpha\in \Delta_+\\ \height(\alpha)\geq k}} \np_\alpha, \qquad k\geq 1. \nn\ee
These are Lie ideals in $\np$ and we have embeddings $\n_{\geq k+1} \hookrightarrow \n_{\geq k}$ for each $k\in {\mathbb Z}_{\geq 1}$.
For each $k$, the quotient $\np\big/\n_{\geq k}$ is a nilpotent Lie algebra, and these nilpotent Lie algebras form an inverse system
\be \dots \twoheadrightarrow \np\big/\n_{\geq k+1} \twoheadrightarrow \np\big/\n_{\geq k} \twoheadrightarrow \dots . \nn\ee 
The inverse limit of this inverse system is isomorphic to ${\widetilde\np}$:
\be {\widetilde\np} \cong \varprojlim_{k} \np\big/\n_{\geq k}.\label{civ}\ee
Indeed, elements of this inverse limit are by definition (possibly infinite) sums of the form $\sum_{\alpha\in \Delta_+} x^\alpha$, $x^\alpha\in {\mathfrak g}_\alpha$, which truncate to finite sums modulo $\n_{\geq k}$ for any $k$; in other words, they are nothing but elements of ${\widetilde\np}$.

In this way, ${\widetilde\np}$ becomes a topological Lie algebra, with the linear topology in which a base of the open neighbourhoods of $0$ is given by the ideals
\be {\widetilde \n}_{\geq k} := \prod_{\substack{\alpha\in \Delta_+\\ \height(\alpha)\geq k}} \np_\alpha ,\qquad k\geq 1. \nn\ee  
(This topology is Hausdorff since $\bigcap_{k=1}^\8 {\widetilde \n}_{\geq k} = \{0\}$.)

In fact, the Lie algebra ${\widetilde\np}$ gets the structure of a \emph{pro-nilpotent pro-Lie algebra}; see e.g. \cite[\S4.4 and \S6.1]{Kumar}. The pro-Lie algebra structure on ${\widetilde\np}$ consists of the family $\mc F$ consisting of \emph{all} Lie ideals $\a \subset {\widetilde\np}$ such that $\a\supset {\widetilde \n}_{\geq k}$ for some $k$, and the \emph{pro-topology} is the linear topology in which these ideals form a base of the open neighbourhoods of $0$. 


\subsection{The group $U$}\label{sec: udef}
For each $k\geq 1$, let $\exp \bigl( \np\big/ \n_{\geq k} \bigr)$ denote a copy of the vector space $\np/ \n_{\geq k}$ and let $m\mapsto \exp(m)\equiv \Exp m$ be the map into this copy. We may endow this copy with a group structure, given by the Baker-Campbell-Hausdorff formula,
\be  \exxp{x}\exxp{y} := \exxp{x+y+ \frac 12 [x,y] + \dots} ,\nn\ee 
from which only finitely many terms contribute since $\np / \n_{\geq k}$ is nilpotent. For all $m,k$ with $m\geq k$, there is a commutative diagram
\be\begin{tikzcd}
\np / \n_{\geq m}\rar[two heads]\dar{\sim} & \np / \n_{\geq k} \dar{\sim}\\
\exxp{\np / \n_{\geq m} } \rar[two heads] & \exxp{  \np / \n_{\geq k} }
\end{tikzcd}
\nn\ee
where the horizontal maps are the canonical projections. 
The inverse limit
\be  U := \varprojlim_k \exxp{ \np / \n_{\geq k} } \label{udef}\ee
is then a group, and the diagram above defines an exponential map $\exp : \hat\np_+ \xrightarrow\sim U$.
Recall that, by definition of the inverse limit, we have the commutative diagram
\be
\begin{tikzcd} & &  U \arrow[dashed,dll,shorten = 2mm,two heads]
 \dlar[two heads]{\pi_3} \dar[two heads]{\pi_2} \drar[two heads]{\pi_1} \\
 \dots \phantom{O}\rar[dashed,two heads]& 
\exxp{\np/\n_{\geq 3}} \rar[two heads]& 
\exxp{\np/\n_{\geq 2}} \rar[two heads]& 
\exxp{\np/\n_{\geq 1}}
\end{tikzcd}
\nn\ee
in which the maps are surjective group homomorphisms, and the group element $g$ in \cref{gel} is equivalent to the sequence $(\pi_i(g))_{i=1}^\8$ of its truncations.

In fact, to any pro-Lie algebra one can canonically associate a \emph{pro-algebraic group} (or \emph{pro-group}, for short). If the pro-Lie algebra is pro-nilpotent, then this pro-group will be \emph{pro-unipotent}. For the definitions, see e.g. \cite[\S4]{Kumar}.
The group $U$ is the pro-unipotent pro-group algebra associated to the pro-nilpotent pro-Lie algebra ${\widetilde\np}$,  just as the quotients $\exxp{\np/\n_{\geq k}}$ are the unipotent affine algebraic groups associated to the nilpotent Lie algebras $\np/\n_{\geq k}$.


\subsection{Polynomial functions on $U$}\label{sec: coords}
Now let us choose coordinates on $U$. 
Recall our ordered basis $(\mc B,\prec)$ of ${\mathfrak g}$ from \cref{Bpdef}. We get an ordered basis of $\np$, 
\begin{align} \mc B_+ &:= \mc B \cap \np \nn\\
&=  \left\{ J_{\alpha,0}\right\}_{\alpha\in \mathring\Delta_+} 
 \cup \left\{J_{a,n} \right\}_{a\in \mathcal I, n\in\ZZ_{\geq 1}} = \{J_{\ia a n}\}_{{\ii a n}\in \mathsf A},\label{Bplus}
\end{align}
where we introduced a notion for the index set,
\be \mathsf A := \{(\alpha,0)\}_{\alpha\in \mathring\Delta_+} \,\,\cup\,\, \mathcal I \times \ZZ_{\geq 1}. \label{Adef}\ee
It will also be useful to introduce 
the set
\be -\mathsf A := \{(\alpha,0)\}_{\alpha\in \mathring\Delta_-} \,\,\cup\,\, \mathcal I \times \ZZ_{\leq -1}. \label{Amdef}\ee

Any element of $g\in U$ can be uniquely written in the form
\be g = \prodr_{{\ii a n} \in \mathsf A} \exxp{x^{\ia a n} J_{\ia a n}} \label{gel}\ee
for some $x^{\ia a n}\in {\mathbb C}$, where we use $\prodr$ to denote the product with factors ordered so that $\exxp{x^{\ia b m} J_{\ia b m}}$ stands to the left of $ \exxp{x^{\ia c p} J_{\ia c p}}$ if $J_{\ia b m}\prec J_{\ia c p}$ in our basis.


For each ${\ii a n}\in \mathsf A$ let $X^{\ia a n} : U \to {\mathbb C}$ be the function on $U$ such that $X^{{\ia a n}}(g) = x^{\ia a n}$. Then these are good coordinates on $U$. 
We get the ${\mathbb C}$-algebra
\begin{align} {\O_{\np}} &:= {\mathbb C}\!\left[X^{\ia a n}\right]_{{\ii a n}\in \mathsf A}\nn
\end{align}
of polynomial functions on $U$. 
Inside ${\O_{\np}}$ we have for each $k\in {\mathbb Z}_{\geq 1}$ the subalgebra 
\be {\O_{\np}}_{< k} := {\mathbb C}[X^{\ia a n}]_{\substack{{\ii a n}\in \mathsf A\\ n< k}} \label{Okdef}\ee
of polynomial functions on the quotient group $\exp(\np\big/ \n_{\geq k})$, and ${\O_{\np}}= \bigcup_{k\geq 1} {\O_{\np}}_{< k}$ is their union. 
In other words, ${\O_{\np}}$ is the direct limit of these ${\O_{\np}}_{< k}$ with respect to the inclusions 
\be \dots \hookrightarrow {\O_{\np}}_{<k} \hookrightarrow {\O_{\np}}_{<k+1} \hookrightarrow \dots.\label{oinc}\ee 


\subsection{Differential operators on $U$}\label{Hdef}
Let $\mc H$ denote the Weyl algebra on generators $X^{\ia a n}$, $D_{\ia a n}$, ${\ii a n}\in \mathsf A$, i.e. the associative unital ${\mathbb C}$-algebra obtained by quotienting the free associative unital ${\mathbb C}$-algebra in these generators by the two-sided ideal generated by the relations 
\be [X^{\ia a n},X^{\ia b m} ] = 0, \qquad [D_{\ia a n}, X^{\ia b m}] = \delta_a^b \delta_{n+m,0},\qquad [D_{\ia a n}, D_{\ia b m} ] =0 ,\nn\ee
where $[A,B] := AB-BA$. 
As a vector space, one has
\be \mc H \cong_{\mathbb C} {\mathbb C}[X^{\ia a n}]_{{\ii a n}\in \mathsf A} \otimes {\mathbb C}[D_{\ia a n}]_{{\ii a n}\in\mathsf A}.\nn\ee
We think of $\mc H$ as the algebra of polynomial differential operators on $U$. The left action of $\mc H$ on ${\O_{\np}}$ is given by
\be X^{\ia a n} . f = X^{\ia a n} f,\qquad D_{\ia a n} . f = [D_{\ia a n},f] \nn\ee
for ${\ii a n}\in \mathsf A$ and $f\in {\O_{\np}}$. 

Let $\mc H_{\geq k}$ denote the left ideal in $\mc H$ generated by $D_{{\ii a n}}$ with $n\geq k$. It consists of those polynomial differential operators that annihilate ${\O_{\np}}_{<k}$. The quotients $\mc H/\mc H_{\geq k}$ form an inverse system of associative algebras,
\be \dots \twoheadrightarrow \mc H \big/ \mc H_{\geq k+1} \twoheadrightarrow \mc H \big/ \mc H_{\geq k} \twoheadrightarrow. \nn\ee
The inverse limit 
\be \widetilde \HH := \varprojlim_k \mc H \big/ \mc H_{\geq k}\nn\ee 
is a topological associative algebra, whose elements are by definition (possibly infinite) sums of the form
\be \sum_{{\ii a n}\in \mathsf A} P^{\ia a n}(X;D) D_{\ia a n}, \label{PSDsum}\ee
where, for each ${\ii a n}\in \mathsf A$, $P^{\ia a n}(X;D)\in {\mathbb C}[X^{\ia b m}]_{{\ii b m}\in\mathsf A}\otimes {\mathbb C}[D_{\ia b m}]_{{\ii b m} \in \mathsf A}$.
Since any $f\in {\O_{\np}}$ lies in ${\O_{\np}}_{<k}$ for some $k$, this completion $\widetilde \HH$ also has a well-defined action on ${\O_{\np}}$.

Note that the degree of the polynomials $P^{\ia a n}(X;D)$ in \cref{PSDsum} is allowed to grow without bound as $n$ increases. 

\subsection{The $Q$-gradation}
The algebra $\mc H$ has a gradation by the root lattice $Q$, 
\be \mc H = \bigoplus_{\alpha \in Q} \mc H_\alpha, \nn\ee
defined by the demand that $\D_{\ia a n} \in \mc H_{\wgt\ii a n}$ and $X^{\ia a n} \in \mc H_{-\wgt\ii a n}$ for all $\ii a n \in \mathsf A$. That is, more explicitly,
\be D_{\ia \alpha n}\in \mc H_{\alpha +n\delta}\qquad\text{and}\qquad X^{\ia \alpha n} \in \mc H_{-\alpha - n\delta}, \nn\ee
for each $\ii \alpha n \in  \mathring \Delta_+\times\{0\} \cup  (\mathring\Delta\setminus\{0\}) \times \ZZ_{\geq 1} \subset \mathsf A$, and 
\be D_{\ia i n}\in \mc H_{n\delta}\qquad\text{and}\qquad X^{\ia i n} \in \mc H_{- n\delta}, \nn\ee
for each $\ii i n \in \mathring I \times \ZZ_{\geq 1} \subset \mathsf A$. 
In particular we get a gradation of ${\O_{\np}}\subset \mc H$ by the negative root lattice:
\be  {\O_{\np}} = \bigoplus_{\alpha \in -Q_{\geq 0}} {\O_{\np}}_\alpha .\nn\ee

\subsection{Polynomial vector fields on $U$}\label{sec: derO}
The commutator bracket $[A,B] := AB-BA$ makes $\mc H$ into a $Q$-graded Lie algebra. It has the Lie subalgebra $\Der{\O_{\np}}$ consisting the (finite) sums of the form 
\be \sum_{{\ii a n}\in \mathsf A} P^{\ia a n}(X) D_{\ia a n}, \label{derogen}\ee
where the coefficients $P^{\ia a n}(X)\in {\mathbb C}[X^{\ia b m}]_{{\ii b m}\in \mathsf A}$ are nonzero for only finitely ${\ii a n}\in \mathsf A$, i.e. it the free ${\O_{\np}}$-module with ${\O_{\np}}$-basis consisting of the derivative operators $D_{\ia a n}$, ${\ii a n}\in \mathsf A$.
It inherits the $Q$-grading of $\mc H$. 

\begin{lem}
The commutator bracket makes the completion $\widetilde \HH$ into a topological Lie algebra.
\end{lem}
\begin{proof}
The associative algebra $\widetilde \HH$ is certainly a Lie algebra with respect to the commutator.
Let us check the commutator $[\cdot,\cdot]: \widetilde \HH\times \widetilde \HH \to \widetilde \HH$ is continuous, where $\widetilde \HH\times \widetilde \HH$ has the product topology. The open neighbourhoods of zero in the product topology include the subspaces $\widetilde \HH_{\geq k}\times \widetilde \HH_{\geq \ell}$ for all $k,\ell \in {\mathbb Z}_{\geq 1}$. Suppose $(A_n,B_n)$, $n=1,2,\dots$, is a sequence in $\widetilde \HH\times \widetilde \HH$ which converges to zero. Then, for any $k$, the terms in this sequence are eventually in $\widetilde \HH_{\geq k}\times \widetilde \HH_{\geq k}$. It follows that, for any $k$, the terms of the sequence $[A_n,B_n]$, $n=1,2,\dots$, of commutators eventually lie in $\widetilde \HH_{\geq k}$. But the latter are a base of open neighbourhoods of zero in $\widetilde \HH$, so the sequence of commutators converges to zero. Since these are all linear topologies (i.e. vector addition is continuous) this is enough to show that the commutator is a continuous map, as required. 
\end{proof}
Define $\Derc{\O_{\np}}\subset \widetilde \HH$ to be the vector subspace of $\widetilde \HH$ topologically generated by the monomials of the form $P^{\ia a n}(X) D_{\ia a n}$. In other words, $\Derc{\O_{\np}}$ consists of (now possibily infinite) sums of the form \cref{derogen}. 

\begin{lem} $\Derc{\O_{\np}}$ is a topological Lie subalgebra of $\widetilde \HH$.
\end{lem}
\begin{proof}
This is really immediate, given the previous lemma: all that has to be checked is that terms linear in $D$'s close under the commutator, which is obvious. But let us write out the full argument nonetheless.
Let $\sum_{{\ii a n}\in \mathsf A} P^{\ia a n}(X) D_{\ia a n}$ and $\sum_{{\ii a n}\in \mathsf A} Q_{\ia a n}(X) D_{\ia a n}$ be two elements of $\Derc{\O_{\np}}$. Their commutator is equal to
\be \sum_{{\ii b m}\in \mathsf A} \left(\sum_{{\ii a n}\in \mathsf A} P^{\ia a n}(X) \left[D_{\ia a n}, Q_{\ia b m}(X)\right] - \sum_{{\ii a n}\in \mathsf A} Q_{\ia a n}(X) \left[D_{\ia a n}, P^{\ia b m}(X)\right]\right) D_{\ia b m}  \label{comsum}\ee
For each ${\ii b m}$, the polynomial $Q_{\ia b m}(X)\in {\O_{\np}}$ lies in ${\O_{\np}}_{< k}$ for some $k$, so the sum 
\be \sum_{{\ii a n}\in \mathsf A} P^{\ia a n}(X) [ D_{\ia a n},Q_{\ia b m}(X)] \nn\ee
is well-defined: only the (finitely many) terms with $n<k$ contribute. The other sum in \cref{comsum} works the same way. We see that \cref{comsum} is a well-defined sum belonging to $\Derc{\O_{\np}}$. 
\end{proof}



\subsection{The topological Lie algebra ${\widetilde \g}$}
For each $k\in {\mathbb Z}$, define vector subspaces of ${\mathfrak g}$ and ${\widetilde \g}$ respectively as follows:
\be {\mathfrak g}_{\geq k} = \bigoplus_{\substack{\alpha\in \Delta\\\height(\alpha) \geq k}} {\mathfrak g}_\alpha, \qquad
 {\widetilde \g}_{\geq k} = \prod_{\substack{\alpha\in \Delta\\\height(\alpha) \geq k}} {\mathfrak g}_\alpha .\nn\ee
(So when $k\geq 1$, ${\mathfrak g}_{\geq k} = \n_{\geq k}$ and ${\widetilde \g}_{\geq k} = {\widetilde \n}_{\geq k}$.) Just as in \cref{civ}, we have 
\be {\widetilde \g} \cong \varprojlim_k {\mathfrak g}\big/{\mathfrak g}_{\geq k} \quad\left(\cong \varprojlim_k {\widetilde \g}\big/{\widetilde \g}_{\geq k}\right),\nn\ee
where this is now an inverse limit merely of vector spaces. This endows the vector space ${\widetilde \g}$ with a 
linear topology in which $\{{\widetilde \g}_{\geq k}\}_{k\in {\mathbb Z}}$ form a base of the open neighbourhoods of $0$. Moreover ${\widetilde \g} = \bigcup_{k\in {\mathbb Z}} {\widetilde \g}_{\geq k}$ and $\dim\left({\widetilde \g}_{\geq k}/{\widetilde \g}_{\geq m}\right)<\8$ for all $k,m \in {\mathbb Z}$ with $k\leq m$. 

(With this topology, ${\widetilde \g}$ becomes a \emph{c.l.c. ${\mathbb C}$-vector space}, in the language of \cite{KashiwaraFlag}.) 

The Lie bracket on ${\widetilde \g}$ is continuous in this topology, i.e. 
\be {\widetilde \g} \times {\widetilde \g} \to {\widetilde \g}; \qquad (A,B) \mapsto [A,B] \nn\ee
is continuous, where ${\widetilde \g} \times {\widetilde \g}$ gets the product topology. 

The adjoint action makes the Lie algebra ${\widetilde \g}$, regarded as a vector space, into a module over itself. In particular, it makes ${\widetilde \g}$ into a module over the subalgebra ${\widetilde\np}$.
\begin{lem}\label{Uactg} The action of ${\widetilde\np}$ on ${\widetilde \g}$ exponentiates to yield a well-defined action of $U$ on ${\widetilde \g}$ from the right, 
\be {\widetilde \g} \times U \to {\widetilde \g},\nn\ee
given by
\be B . e^A = \sum_{k=0}^\8 \frac{(-1)^k}{k!} \ad_A^k B = B + [B,A] + \frac 1 2 [[B,A],A] + \dots \nn\ee
for $B\in {\widetilde \g}$, $A\in {\widetilde\np}$.
\qed\end{lem}

\subsection{Infinitesimal transformations}\label{sec: inft}
Unlike the action of ${\widetilde\np}\subset {\widetilde \g}$ on ${\widetilde \g}$, the action of the full Lie algebra ${\widetilde \g}$ on itself does not exponentiate to an action of a group. Indeed, for $A,B\in {\widetilde \g}$, the sum $\sum_{k=1}^\8 \frac 1 {k!} \ad^k_{A}B$ may not be an element of ${\widetilde \g}_{\geq m}$ for any $m\in {\mathbb Z}$, which is to say it  may not be a well-defined element of ${\widetilde \g}$. (Consider for example $A = H_{i,-1}$ and $B = E_{\alpha,0}$.) 

Nonetheless, it is convenient for computations in what follows to be able to treat infinitesimal transformations (by general elements of ${\widetilde \g}$) on the same footing as finite group transformations. That is, we would like to make sense of  group elements of the form $\exp(\epsilon A) = 1+ \epsilon A$, working to first order in an (``infinitesimal'') parameter $\epsilon$.

To that end, let $\epsilon$ be a formal variable and let ${\mathbb C}_\epsilon$ denote the ring
\be {\mathbb C}_\epsilon := {\mathbb C}[\epsilon]\big/\epsilon^2{\mathbb C}[\epsilon].\nn\ee 
For any Lie algebra $\p$ (over ${\mathbb C}$), we have the Lie algebra $\p({\mathbb C}_\epsilon) := {\mathbb C}_\epsilon \otimes_{\mathbb C} \p$.   
Consider the Lie algebra 
\be {\widetilde \g}({\mathbb C}_\epsilon) := {\mathbb C}_\epsilon \otimes_{\mathbb C} {\widetilde \g}. \nn\ee 
We shall write its elements as $A+ \epsilon B$ with $A,B\in {\widetilde \g}$. It has a nilpotent Lie ideal  $\epsilon {\widetilde \g}$. The vector subspace
\be {\mathfrak f}_\epsilon := \epsilon{\widetilde \g} \oplus \np
, \label{esa}\ee 
forms a Lie subalgebra
\be {\mathfrak f}_\epsilon \subset {\widetilde \g}({\mathbb C}_\epsilon).\nn\ee
It is another pro-nilpotent pro-Lie algebra.
We get the corresponding pro-unipotent pro-group $\exxp{{\mathfrak f}_\epsilon}$.
Let us write $\ad_A(B) := [A,B]$.  
\begin{lem}\label{BCHlem} 
For all $A\in {\widetilde\np}$ and $B\in {\widetilde \g}$, we have the following relations in $\exxp{{\mathfrak f}_\epsilon}$,
\be \Exp{ A } \Exp{ \epsilon B } = \Exp{ \epsilon B} \left(\prod_{k=1}^\8 \Exp{ \epsilon \frac{1}{k!}\ad_A^k(B)}\right) \Exp A, \nn\ee 
\be \Exp{ \epsilon B } \Exp{ A } = \Exp{ A} \left(\prod_{k=1}^\8 \Exp{ \epsilon \frac{(-1)^k}{k!}\ad_A^k(B)} \right)\Exp{\epsilon B}, \nn\ee
together with $\Exp{ \epsilon A} \Exp{\epsilon B} = \Exp{\epsilon B} \Exp{\epsilon A}$, and $\Exp{ xA } \Exp{\epsilon A} = \Exp{(x+\epsilon) A} = \Exp{ \epsilon A} \Exp{xA}$ for all $x\in {\mathbb C}$.
\end{lem}
\begin{proof} These follow from the Baker-Campbell-Hausdorff formula. (Note that the order of the terms in the products $\prod_{k=1}^\8$ is unimportant by virtue of the equality $\Exp{ \epsilon A} \Exp{\epsilon B} = \Exp{\epsilon B} \Exp{\epsilon A}$.)
\end{proof}


There is another vector-space decomposition of ${\mathfrak f}_\epsilon$, namely ${{\mathfrak f}_\epsilon} =_{\mathbb C} \epsilon \b_- \oplus {\widetilde\np}({\mathbb C}_\epsilon)$, and this gives a useful way to factorize elements of the group $\exxp{{\mathfrak f}_\epsilon}$. Let $U({\mathbb C}_\epsilon) := \exxp{ {\widetilde\np}({\mathbb C}_\epsilon)}$. Then the multiplication map
\be \exxp{\epsilon\b_-} \times U({\mathbb C}_\epsilon) \xrightarrow\sim \exxp{{\mathfrak f}_\epsilon} \label{mb}\ee
is a bijection. 

Let us introduce the right coset space
\be U_0({\mathbb C}_\epsilon) := \exxp{\epsilon\b_-} \!\Big\backslash\! \exxp{{\mathfrak f}_\epsilon}.\nn\ee
The action from the right of the subgroup $U({\mathbb C}_\epsilon)\subset \exxp{{\mathfrak f}_\epsilon}$ is both transitive and free, in view of \cref{mb}, and we get a bijection
\be U({\mathbb C}_\epsilon) \xrightarrow\sim U_0({\mathbb C}_\epsilon);\qquad g \mapsto  \exxp{\epsilon \b_-} g .\nn\ee
Let 
\be U_0 := \exxp{\epsilon \b_-} U \nn\ee
denote the orbit of $\exxp{\epsilon \b_-}$ under the right action of the subgroup $U\subset U({\mathbb C}_\epsilon)$. The bijection above restricts to a bijection
\be U \xrightarrow\sim U_0;\qquad g \mapsto  \exxp{\epsilon \b_-} g .\nn\ee
By means of this bijection, we can regard $X^{\ia a n}$, ${\ii a n}\in \mathsf A$ as coordinates on $U_0$, and ${\O_{\np}}$ as the ring of polynomial functions on $U_0$.

For us, the motivation for these constructions is contained in the following lemma.

\begin{lem}\label{Plem} Let $A\in {\widetilde \g}$. Then there exist polynomials $\left\{P_A^{\ia b m}(X)\in {\O_{\np}}\right\}_{{\ii b m}\in \mathsf A}$ (depending linearly on $A$) such that
\be \Exp{\epsilon \b_-}\left( \prodr_{{\ii b m}\in\mathsf A} \Exp{x^{\ia b m} J_{\ia b m}}\right) \Exp{\epsilon A} = \Exp{\epsilon \b_-}
 \prodr_{{\ii b m}\in\mathsf A} \Exp{\left(x^{\ia b m} + \epsilon P_A^{\ia b m}(x)\right)J_{\ia b m}}\nn\ee
in $U_0({\mathbb C}_\epsilon)$, for every element $\prodr_{{\ii b m}\in\mathsf A} \Exp{x^{\ia b m} J_{\ia b m}}$ of the group $U \subset U({\mathbb C}_\epsilon)$. 

If $A\in {\mathfrak g}_{\alpha}$ and $J_{\ia b m}\in {\mathfrak g}_\beta$ then $P_A^{\ia b m}(X) \in {\O_{\np}}_{\alpha-\beta}$.
\end{lem}
\begin{proof}
This is true by construction, but let us go through the details to explain how in practice one computes these $P_A^{\ia b m}$. 
Recall that the group element 
\be g = \prodr_{{\ii b m}\in\mathsf A} \Exp{x^{\ia b m} J_{\ia b m}}\in U \nn\ee
is defined by the sequence $(g_i)_{i=1}^\8$ of its truncations, 
\be
g_i := \pi_i(g) = \prodr_{\substack{{\ii b m}\in\mathsf A\\ m< i }} \Exp{x^{\ia b m} J_{\ia b m}}\in \Exp{\np/\n_{\geq i}}, 
\label{geli}\ee
to the subgroups $\Exp{\np / \n_{\geq i}}$. The product in \cref{geli} is finite, for each $i$.

Let $A\in {\widetilde \g}$. Then $A\in {\widetilde \g}_{\geq k}$ for some integer $k$. Consider the right action on $g$ by the group element $\Exp{\epsilon A}\in \exxp{\epsilon{\widetilde \g}}\subset \exxp{{\mathfrak f}_\epsilon}$. The group element $g':= g\Exp{\epsilon A}\in \exxp{{\mathfrak f}_\epsilon}$ is defined by the sequence of \emph{its} truncations, $\left(g'_i\right)_{i=1}^\8$. On grading grounds, we have 
\be g'_i  = \pi_i\left( g_{\max(i,i-k)} \Exp{\epsilon A}\right), \nn\ee
i.e. to compute $\pi_i(g \Exp{\epsilon A})$ we need at most the first $\max(i,i-k)$ terms in the sequence \cref{geli} of truncations of $g$. Also, we need only the truncation $\pi_i(\Exp{\epsilon A})$ of $\Exp{\epsilon A}$; this truncation can be expressed as a finite product of monomials of the form $\Exp{\epsilon a}$ with $a$ a multiple of one of our basis vectors of ${\mathfrak g}$. 
The relations in \cref{BCHlem} hold in particular when the $A$ and $B$ there are multiples of vectors from our basis $\mc B_+$ of $\np$, and in that case so too are all the factors in the products on $k$ on the right-hand sides. 
Using these relations a finite number of times, we may re-write $g_i'$ in the form
\be g_i' = g_i'' \prodr_{\substack{{\ii b m}\in\mathsf A\\\height({\ii b m})< i}} 
\Exp{(x^{\ia b m}+ \epsilon P^{\ia b m}_A(x)) J_{\ia b m}}, \qquad\text{where}\quad g_i'' \in \Exp{\epsilon \b_-},
\nn\ee
for polynomials $P^{\ia b m}_A(X)\in {\O_{\np}}$, depending linearly on $A$ and with the stated grading property.
\end{proof}

\begin{lem}\label{vfdef}
The linear map 
\be \rho:{\widetilde \g} \to \Derc{\O_{\np}}\nn\ee 
given by
\be \rho: A \mapsto \sum_{{\ii b m}\in \mathsf A} P_A^{\ia b m}(X) D_{\ia b m} \nn\ee
is a homomorphism of Lie algebras. It respects the $Q$-gradation, and is therefore continuous.
\end{lem}
\begin{proof}
Let ${\mathbb C}_{\epsilon,\eta} := {\mathbb C}[\epsilon,\eta]\big/\left(\epsilon^2{\mathbb C}[\epsilon,\eta]\oplus \eta^2{\mathbb C}[\epsilon,\eta]\right)$. Replacing ${\mathbb C}_\epsilon$ by ${\mathbb C}_{\epsilon,\nu}$ in the definitions above, we get the Lie algebra ${\widetilde \g}({\mathbb C}_{\epsilon,\eta}):= {\mathbb C}_{\epsilon,\eta} \otimes {\widetilde \g}$ and its Lie subalgebra ${\mathfrak f}_{\epsilon,\eta} =_{\mathbb C} \epsilon {\widetilde \g} \oplus \eta {\widetilde \g} \oplus {\widetilde\np} =_{\mathbb C} \epsilon \b_- \oplus \eta \b_- \oplus {\widetilde\np}({\mathbb C}_{\epsilon,\eta})$. Define $U_0({\mathbb C}_{\epsilon,\eta}) := \exxp{\epsilon\b_- \oplus \eta\b_-}\Big\backslash \exxp{{\mathfrak f}_{\epsilon,\eta}}$. We have $U({\mathbb C}_{\epsilon,\eta}) \cong U_0({\mathbb C}_{\epsilon,\eta})$. We can identify $U_0$ as defined above with the orbit $\exxp{\epsilon\b_-\oplus \eta\b_-} U$ of  $\exxp{\epsilon\b_-\oplus \eta\b_-}$ under the right action of $U\subset U({\mathbb C}_{\epsilon,\eta})$. Let $A,B\in {\widetilde \g}$ and consider the coset
\be \Exp{\epsilon \b_-\oplus \eta \b_-} \left( \prodr_{{\ii b m}\in\mathsf A} \Exp{x^{\ia b m} J_{\ia b m}}\right) \Exp{\epsilon A} \Exp{\eta B} \Exp{-\epsilon A}\Exp{-\eta B}.\label{encoset}\ee
On the one hand $\Exp{\epsilon A} \Exp{\eta B} \Exp{-\epsilon A}\Exp{-\eta B}  = \Exp{\epsilon\eta[A,B]}$ and hence \cref{encoset} is equal to 
\be   \Exp{\epsilon \b_-\oplus \eta \b_-}  \prodr_{{\ii b m}\in\mathsf A} \Exp{\left( x^{\ia b m} + \epsilon\eta P^{\ia b m}_{[A,B]}(x) \right) J_{\ia b m}} 
= 
 \Exp{\epsilon \b_-\oplus \eta \b_-}  \prodr_{{\ii b m}\in\mathsf A} \Exp{\left( x^{\ia b m} + \epsilon\eta \sum_{\gamma} P^\gamma_{[A,B]}(x) D_\gamma . x^{\ia b m} \right) J_{\ia b m}} 
 .\nn\ee
On the other hand, we see that 
\begin{align}
&\Exp{\epsilon \b_-\oplus \eta \b_-} \left( \prodr_{{\ii b m}\in\mathsf A} \Exp{x^{\ia b m} J_{\ia b m}}\right) \Exp{\epsilon A} \Exp{\eta B} \nn\\
&=  \Exp{\epsilon \b_-\oplus \eta \b_-} \prodr_{{\ii b m}\in\mathsf A} 
\Exp{\left( x^{\ia b m} + \epsilon P_A^{\ia b m}(x) + \eta P^{\ia b m}_B(x+ \epsilon P_A(x)) \right) J_{\ia b m}} \nn\\
& = \Exp{\epsilon \b_-\oplus \eta \b_-} \prodr_{{\ii b m}\in\mathsf A} 
\Exp{\left( x^{\ia b m} + \epsilon P_A^{\ia b m}(x) + \eta P^{\ia b m}_B(x) + \epsilon\eta \sum_{{\ii a n}} 
\left(P_A^{\ia a n}(x) (D_{\ia a n} P^{\ia b m}_B)(x) \right) 
 \right) J_{\ia b m}}\nn
\end{align}
and hence \cref{encoset} is equal to
\begin{align} 
&\Exp{\epsilon \b_-\oplus \eta \b_-} \prodr_{{\ii b m}\in\mathsf A} 
\Exp{\left( x^{\ia b m} + \epsilon\eta \sum_{{\ii a n}} 
\left(P_A^{\ia a n}(x) (D_{\ia a n} P^{\ia b m}_B)(x) - P_B^{\ia a n}(x) (D_{\ia a n} P^{\ia b m}_A)(x) \right) 
 \right) J_{\ia b m}}\nn\\
&=\Exp{\epsilon \b_-\oplus \eta \b_-} \prodr_{{\ii b m}\in\mathsf A} 
\Exp{\left( x^{\ia b m} 
+ \epsilon\eta \left[ \sum_{{\ii a n}} P_A^{\ia a n}(x) D_{\ia a n}, \sum_{\gamma} P_B^\gamma(x) D_\gamma\right] . x^{\ia b m} \right)J_{\ia b m}}
\end{align}
This is true for all $x^{\ia b m}$. We conclude that 
\be \left[ \sum_{{\ii a n}} P_A^{\ia a n}(X) D_{\ia a n}, 
           \sum_{\ii b m} P_B^{\ia b m}(X) D_{\ia b m}\right] = 
 \sum_{\ii a n} P^{\ia a n}_{[A,B]}(X) D_{\ia a n},\nn\ee
so that the map $\rho$ is indeed a homomorphism of Lie algebras. The polynomial $P^{\ia b m}_A$ belongs to $ {\O_{\np}}_{\wgt{\ii b m} - \wgt{\ii a n}}$ whenever $A\in {\mathfrak g}_{\wgt\ii a n}$, so $\rho$ respects the $Q$-gradation. Hence it respects the principal ${\mathbb Z}$-gradation and is therefore continuous. 
\end{proof}
\begin{rem}
Just as in the case of ${\mathfrak g}$ of finite type, there is also another realization $\rho^L:{\widetilde\np}\to \Derc{\O_{\np}}$ of ${\widetilde\np}$, coming from the \emph{left} action of $U$ on itself. The image $\rho^L({\widetilde\np})\subset\Derc{\O_{\np}}$ lies in the centralizer of $\rho({\widetilde\np})$, but not of $\rho({\widetilde \g})$. In the case of ${\mathfrak g}$ of finite type, $\rho^L$ plays an important role in the definition of screening operators \cite{FFGD,FrenkelBenZvi,Fre07}.
\end{rem}

In what follows, we get more information about image of the homomorphism $\rho$. 


\subsection{Bounded grade and widening gap}\label{sec: Dw}
Let us say a collection of polynomials $\{P^{a,n}(X)\}_{(a,n) \in \mathsf A}$ in ${\O_{\np}}$ has \emph{widening gap} if, for every $K\geq 1$, we have 
\be P^{a,n}(X) \in {\mathbb C}\!\left[X^{b,m}: m < n - K, b\in \mathcal I\right] \label{Dwcond}\ee
(for all $a\in \mathcal I$) for all but finitely many $n\in {\mathbb Z}_{\geq 0}$.  
Let us say that an element 
\be v =  \sum_{{\ii a n}\in \mathsf A} P^{\ia a n}(X) D_{\ia a n} \in \Derc{\O_{\np}} \nn\ee
has \emph{widening gap} if the collection of coefficient polynomials $\{P^{a,n}(X)\}_{(a,n) \in \mathsf A}$ has widening gap.
Let us say that $v$ has \emph{bounded grade} if there exists $M\in {\mathbb Z}$ such that
\be P^{{\ii a n}}(X) \in \bigoplus_{k=-M}^{M} {\O_{\np}}_{[n + k]} \nn\ee
for all ${\ii a n}\in \mathsf A$, where we denote by ${\O_{\np}} = \bigoplus_{k\in {\mathbb Z}} {\O_{\np}}_{[k]}$ the ${\mathbb Z}$-gradation of ${\O_{\np}}$ in which $X^{{\ii a n}}\in {\O_{\np}}_{[-n]}$. 

\begin{exmp}
For any $a,b,c\in \mathcal I$:
\begin{enumerate}[(i)]
\item $\sum_{n\in \ZZ_{\geq 1}} X^{a,n} X^{b,n} D_{c,2n}$ has bounded grade and widening gap,
\item $\sum_{n\in \ZZ_{\geq 1}} X^{a,1} D_{b,n}$ has widening gap but not bounded grade, 
\item $\sum_{n\in \ZZ_{\geq 1}} X^{a,n} D_{b,n}$ has bounded grade but not widening gap.
\end{enumerate}
\end{exmp}

Define $\Dw$ to be the subset of $\Derc{\O_{\np}}$ consisting of elements with bounded grade and widening gap. It is a Lie subalgebra (and an ${\O_{\np}}$-submodule) of $\Derc{\O_{\np}}$. (See \cref{lem: dercdw} and its proof, below.)

The following lemma says that any element of bounded grade ``almost'' has widening gap.
\begin{lem}\label{Wlem}
Suppose $\sum_{{\ii a n}\in \mathsf A} P^{\ia a n}(X) D_{\ia a n}\in \Derc{\O_{\np}}$ has bounded grade. For every $K$, we eventually (i.e. for all but finitely many $n$) have  
\be P^{\ia a n}(X) \in {\O_{\np}}_{<n - K} \otimes \left({\mathbb C}\oplus \bigoplus_{\substack{\ii b m \in \mathsf A \\ m\geq  n - K}} {\mathbb C} X^{\ia b m} \right).\nn\ee 
\end{lem}
\begin{proof}
Suppose to the contrary that for some $K$ there is, for every $N$, always an $n>N$ such that $P^{\ia a n}(X)$ (for some $a\in \mathcal I$) has a nonzero monomial $m(X)$ with $X^{\ia b r} X^{\ia c s}$ as a factor, for some $r,s \geq n-K$, $b,c\in\mathcal I$. The grade of $m(X) D_{\ia a n}$ is bounded above by $-r-s+n \leq  2K-n < 2K -N$. So for every $N$ we find terms of grade less than $2K-N$.
\end{proof}

This applies in particular to the image $\rho(J_{\ia a n}) \in \Derc{\O_{\np}}$ of one of the generators of ${\mathfrak g}'$ (which is certainly of bounded grade: it is in grade $n$, since homomorphism $\rho: {\widetilde \g} \to \Derc{\O_{\np}}$ respects the $Q$-gradation and hence the homogeneous ${\mathbb Z}$-gradation).

It is natural to try to isolate the terms in $\rho(J_{\ia a n})$ which fail to have widening gap. This is the content of \cref{linthm} below.
Let $f_{ab}{}^c$ denote the structure constants of $\mathring{\mathfrak g}$ in our basis $\{J_a\}_{a\in \mathcal I}$:
\be \left[ J_a, J_b\right] = \sum_{c\in \mathcal I} 
f_{ab}{}^c J_c .\nn\ee
For every $(a,n) \in \mathcal I \times \ZZ$, define the element ${}^+\!\mathsf J_{a,n}\in \Derc{\O_{\np}}$ by 
\be {}^+\!\mathsf J_{a,n} := \sum_{b,c\in \mathcal I} 
f_{ba}{}^c \sum_{m > \max(1,n) } X^{b,m-n} D_{c,m} \label{Jpdef}\ee
\begin{thm}\label{linthm} For all $(a,n) \in \mathcal I \times \ZZ$, 
\be \rho(J_{a,n}) - {}^+\!\mathsf J_{a,n} \in \Dw,\nn\ee
i.e. this difference has widening gap.
\end{thm}
\begin{proof} For the entirety of this proof, pick and fix some $\ii a n \in \mathsf A$. The element $\rho(J_{a,n}) - {}^+\!\mathsf J_{a,n}$ is in grade $n$.
The non-trivial thing we have to check is that it has widening gap. 
We have
\be \rho(J_{a,n}) = \sum_{\ii b m\in \mathsf A} P^{\ia b m}(X) D_{\ia b m} ,\nn\ee
for some polynomials $P^{\ia b m}(X)$. 
As in \cref{Plem}, these polynomials are given by the demand that,  for any group element 
\be g=\prodr_{{\ii b m}\in\mathsf A} \Exp{x^{\ia b m} J_{\ia b m}} \in U \subset U({\mathbb C}_\epsilon),\nn\ee 
we have, for some  $B\in \b_-$, the following equality in the group $\exxp{{\mathfrak f}_\epsilon}$:
\be \left( \prodr_{\ii b m\in\mathsf A} \Exp{x^{\ia b m} J_{\ia b m}}\right) \Exp{\epsilon J_{\ia a n}} = \Exp{\epsilon B }
 \prodr_{{\ii b m}\in\mathsf A} \Exp{\left(x^{\ia b m} + \epsilon P^{\ia b m}(x)\right)J_{\ia b m}}.\label{gterma}\ee

Given any positive integer $K$, we can always find a positive integer $N$ large enough that $2(N-K) + \min(n,0) > N$. Consider any $m > N$, so that we have 
\be 2(m-K) + \min(n,0) > m. \label{Mbnd}\ee
To compute $P^{\ia b m}(X)$ in \cref{gterma} it is enough to compute the truncation,  
\be \pi_{m+1}\left( \pi_p(g) \Exp{\epsilon J_{a,n}}\right), \label{gterm}\ee
where $p = m+1 - \min(n,0)$. 
We can factor the truncation $\pi_p(g)$ as follows:
\be \pi_p(g) = g_{<m-K} g_{\geq m-K} \nn\ee
where $g_{<m-K} = \pi_{m-K}(g)$ is the further truncation, and where $g_{\geq m-K}$ are the remaining factors in $\pi_p(g)$, i.e. some product of $\Exp{x^{\ia d s} J_{\ia d s}}$ with $p\geq s\geq m-K$, $d\in \mathcal I$. 

Consider what happens as we use \cref{BCHlem} to move $\Exp{\epsilon J_{\ia a n}}$ leftwards through the product in \cref{gterm}. We arrive at an equality of the following form:
\be \pi_{m+1}\left( g_{<m-K} g_{\geq m-K}\Exp{\epsilon J_{a,n}}\right) 
=  \pi_{m+1}\left( g_{<m-K} \Exp{\epsilon J_{a,n}} g'_{\geq m-K} \right)\label{hwt}\ee
for some 
\be g'_{\geq m-K} = \prodr_{\substack{\ii d s \in \mathsf A\\ m\geq s \geq m-K}} \Exp{\left( x^{\ia d s} + \epsilon y^{\ia d s}\right) J_{\ia d s}}.\nn\ee
Here certainly $y^{\ia d s} \in {\mathbb C}[x^{\ia e r}]_{\ii e r \in \mathsf A; p\geq r \geq m-K}$. Moreover, these  $y^{\ia d s}$ are at most linear:
indeed, our choice \cref{Mbnd} ensures that for any $t,s > m-K$, a nested commutator 
\be [J_{f,t},[J_{e,s},J_{a,n}]] \nn\ee
has grade $t+s+n > 2(m-K) + n > m$ and so does not contribute in $\pi_{m+1}(g)$; a fortiori, nested commutators of $J_{a,n}$ with three or more generators of grade $>m-K$ cannot contribute.
In this we way see that
\be y^{\ia b m} = f_{ca}{}^b x^{\ia c {m-n}};\nn\ee
it arises from the step 
\be \Exp{x^{c,m-n} J_{c,m-n}} \Exp{\epsilon J_{a,n}} = \Exp{\epsilon J_{a,n}} \Exp{(\epsilon x^{c,m-n} f_{ca}{}^b J_{b,m} + \dots)}  \Exp{x^{c,m-n} J_{c,m-n}}.\nn\ee

It remains to show that, starting from the expression on the right of \cref{hwt}, as we continue to reshuffle terms in \cref{hwt} using \cref{BCHlem} until they are all in order, we never again shift $x^{\ia b m}$ by any quantity that depends on any of the $x^{\ia d s}$ with $s\geq m-K$.
To see that, note first that we have
\be  \pi_{m+1}\left( g_{<m-K} \Exp{\epsilon J_{a,n}} g'_{\geq m-K} \right) 
   = \pi_{m+1}\left( \pi_{m+1}\left(g_{<m-K} \Exp{\epsilon J_{a,n}}\right) g'_{\geq m-K} \right).\nn\ee 
Here we can use \cref{BCHlem} to re-write
\be \pi_{m+1}(g_{<m-K} \Exp{\epsilon J_{a,n}}) = \pi_{m+1}(\Exp{\epsilon B} g'_{<m-K} g'') \nn\ee
for some $B\in \b_-$ and some 
\be g'_{<m-K} = \prodr_{\substack{\ii d s \in \mathsf A\\ m-K > s \geq 0}} 
\Exp{\left( x^{\ia d s} + \epsilon y^{\ia d s}\right) J_{\ia d s}}\qquad\text{and}\qquad
g'' = \prodr_{\substack{\ii d s \in \mathsf A\\ m \geq s \geq m-K}} 
\Exp{ \epsilon z^{\ia d s} J_{\ia d s}}.\nn\ee
Here $z^{d,s} \in {\mathbb C}[x^{\ia e r}]_{\ii e r \in \mathsf A; m-K> r \geq 0}$; to stress the point, $z^{d,s}$  manifestly cannot depend on any of the $x^{\ia d s}$ with $s\geq m-K$. At this stage we have arrived at 
\begin{align} \pi_{m+1}\left( g_{<m-K} g_{\geq m-K}\Exp{\epsilon J_{a,n}}\right) 
&= \pi_{m+1}\left(\Exp{\epsilon B} g'_{<m-K} g'' g'_{\geq m-K} \right)\nn\\
&= \pi_{m+1}\left(\Exp{\epsilon B} g'_{<m-K} \pi_{m+1}(g'' g'_{\geq m-K}) \right)
.\nn
\end{align}
All that remains is to put the terms in 
\be \pi_{m+1}(g'' g'_{\geq m-K}) \nn\ee
in the correct order. But since $2(m-K) > m$, as in \cref{Mbnd}, we again have on grading grounds that all commutators we produce as we use \cref{BCHlem} have too high grade to contribute in this truncation, and we simply get
\be  \pi_{m+1}(g'' g'_{\geq m-K})  
=   \prodr_{\substack{\ii d s \in \mathsf A\\ m \geq s \geq m-K}} 
\Exp{\left(x^{\ia d s} + \epsilon y^{\ia d s} + \epsilon z^{\ia d s}\right) J_{\ia d s}}. \nn\ee

This completes the proof that, for any positive integer $K$, we have that for all sufficiently large $m$,
\be P^{\ia b m}(x) = f_{ca}{}^b x^{\ia c {m-n}} \mod {\mathbb C}[x^{\ia e r}]_{r<m-K} .\ee
That, is $\rho(J_{a,n}) - {}^+\!\mathsf J_{a,n}$ has widening gap, which is what we had to show.
\end{proof}
It will be helpful to have a name for the difference in \cref{linthm}: let us write
\be \rho(J_{a,n}) - {}^+\!\mathsf J_{a,n} =: \sum_{(b,m)\in \mathsf A} {}^+\!R^{b,m}_{a,n}(X) D_{b,m}\label{Rpdef}\ee
for certain polynomials ${}^+\!R$. 

\section{Cartan involution and doubling trick}\label{sec: cai}
\subsection{Definition of $\Dg$}\label{sec: wg}
Let us introduce the polynomial algebra
\be {\O} := {\mathbb C}[X^{\ia a n}]_{\ii a n \in \mathcal I \times \ZZ} \nn\ee
and define the vector spaces
\be    \Der{\O} := \bigoplus_{\ii a n \in \mathcal I \times \ZZ} {\O} D_{\ia a n},
\qquad \Derc{\O} := \prod_{\ii a n \in \mathcal I \times \ZZ} {\O} D_{\ia a n} .\nn\ee
Let us say a collection of polynomials $\{P^{a,n}(X)\}_{(a,n) \in \mathcal I \times \ZZ}$ in ${\O}$ has \emph{widening gap} if, for every $K\geq 1$, we have, 
\be P^{a,n}(X) \in {\mathbb C}\!\left[X^{b,m}: |m| < |n| - K, b\in \mathcal I\right]. \label{Dwcond}\ee
(for all $a\in \mathcal I$) for all but finitely many $n\in {\mathbb Z}$.  
\begin{lem}\label{lem: wg} 
Equivalently, the polynomials $\{P^{a,n}(X)\}_{(a,n) \in \mathcal I \times \ZZ}$ have widening gap if and only if, for every $K\geq 1$ there is some $B(K)$ such that
\be P^{a,n}(X) \in {\mathbb C}\!\left[X^{b,m}: |m| < \max(|n| - K, B(K)), b\in \mathcal I\right] \label{Dwcondprime}\ee
for all $\ii a n \in \mathcal I \times \ZZ$. 
\end{lem}
\begin{proof} Suppose $\{P^{a,n}(X)\}_{(a,n) \in \mathcal I \times \ZZ}$ have widening gap. Then for all $K\geq 1$ there exists some $m(K)$ such that whenever $|n|> m(K)$,  $P^{a,n}$ has no factor $X^{c,m}$ with $|m|> |n|- K$. But that leaves only finitely many polynomials $P^{a,n}$, and we can find $B(K)$ such that none of them has any factor $X^{c,m}$ with $|m| > B(K)$. Conversely, suppose $\{P^{a,n}(X)\}_{(a,n) \in \mathcal I \times \ZZ}$ obeys the condition in the lemma. Then for all $K\geq 1$,  $|n|> B(K)$ for all but finitely many $n$, so $\{P^{a,n}(X)\}_{(a,n) \in \mathcal I \times \ZZ}$ has widening gap.
\end{proof}
\begin{cor}\label{cor: wg}
Suppose we are given collections $\{P^{a,n}\}$, $\{Q^{a,n}\}$, $\{R^{a,n}\}$, \dots, of polynomials with widening gap. 
Then 
\be \sum_{(b,m)\in \mathcal I \times \ZZ} P^{b,m} \frac{\del Q^{a,n}}{\del X^{b,m}},\qquad \ii a n \in \mathcal I \times \ZZ, \nn\ee
is a collection of polynomials with widening gap (and, hence, so is
\be \sum_{(b,m),(c,p)\in \mathcal I \times \ZZ} P^{b,m} \frac{\del Q^{c,p}}{\del X^{b,m}} 
             \frac{\del R^{a,n}}{\del X^{c,p}}, \qquad \ii a n \in \mathcal I \times \ZZ, \nn\ee
and so on).
\qed
\end{cor}
For future use, let us note also the following.
\begin{cor}\label{cor: wgtree}
More generally, if $\{P^{a,n}_i\}_{(a,n)\in \mathcal I \times \ZZ}$, $i=1,\dots,N$ and $\{Q^{a,n}\}$ are collections of polynomials with widening gap then
\be \sum_{(b_1,m_1),\dots,(b_N,m_N)\in \mathcal I \times \ZZ} P_1^{b_1,m_1} \dots P_N^{b_N,m_N} 
\frac{\del^N Q^{a,n}}{\del X^{b_1,m_1}\dots\del X^{b_N,m_N}},\qquad \ii a n \in \mathcal I \times \ZZ, \nn\ee
is a collection of polynomials with widening gap.
\qed
\end{cor}
\begin{cor}\label{cor: wgcycle}
If $\{Q^{a,n}\}$ is a collection of polynomials with widening gap then the sum 
\be \sum_{(a,n)\in \mathcal I \times \ZZ} \frac{\del Q^{a,n}}{\del X^{a,n}} \nn\ee
has only finitely many non-zero terms, and hence is a well-defined polynomial in ${\O} = {\mathbb C}[X^{a,n}]_{(a,n)\in\mathcal I \times \ZZ}$.  
\qed
\end{cor}
Let $\Dwg\subset \Derc{\O}$ denote the subspace consisting of elements of the form 
\be \sum_{(a,n)\in \mathcal I \times \ZZ} P^{a,n}(X) D_{a,n} \nn\ee
such that the polynomials $\{P^{a,n}(X)\}_{(a,n) \in \mathcal I \times \ZZ}$ have widening gap. 
(We shall also refer to elements of $\Dwg$ themselves as having widening gap.)
Evidently, we have 
\be \Der{\O} \subset \Dwg \subset \Derc{\O} \nn\ee
and the Lie algebra $\Dw$ from \cref{sec: Dw} embeds in $\Dwg$.

\begin{lem}\label{lem: dercdw}
$\Derc\O$ is a Lie algebra and $\Dwg$ is a Lie subalgebra. 
\end{lem} 
\begin{proof} The Lie bracket of the Lie algebra $\Der\O$, given by
\begin{align} &\left[\sum_{(a,n)\in \mathcal I \times \ZZ} P^{a,n}(X) D_{a,n},
                    \sum_{(b,m)\in \mathcal I \times \ZZ} Q^{b,m}(X) D_{b,m}\right]\nn\\
&\qquad\qquad  = \sum_{(a,n) , (b,m)\in \mathcal I \times \ZZ} 
\left( P^{b,m} \frac{\del Q^{a,n}}{\del X^{b,m}} - Q^{b,m} \frac{\del P^{a,n}}{\del X^{b,m}} \right) D_{a,n} ,\nn
\end{align} 
extends to a well-defined Lie bracket on $\Derc\O$: for each $(a,n)$ on the right, the sum on $(b,m)$ contains only finitely many non-zero terms since $Q^{a,n}$ and $P^{a,n}$ are polynomials. 
\Cref{cor: wg} then implies $\Dwg$ is a Lie subalgebra.
\end{proof}

Let $\{\SS^a_{b,n}\}_{a,b\in \mathcal I, n\in {\mathbb Z}}$ denote the generators of the loop algebra $\gl(\oc\g)\ox \CC[t,t^{-1}]$, obeying the commutation relations
\be \left[\SS^a_{b,n},\SS^c_{d,m}\right] = \delta^c_b \SS^a_{d,n+m}- \delta^a_d \SS^c_{b,n+m}. \label{Lgl}\ee
Let $\mathsf D$ denote the derivation element for the homogeneous gradation of this loop algebra. By definition, it obeys
\be [\mathsf D, \SS^a_{b,n}] = n \SS^a_{b,n} .\nn\ee
We have the homomorphism $\lad: \oc\g[t,t^{-1}]\to \gl(\oc\g)\ox \CC[t,t^{-1}]$ given by
\ifdefinedtrue
\else
\footnote{Indeed, 
\begin{align} 
[\mathsf J_{a,n},\mathsf J_{b,m}] 
&= f_{ca}{}^d f_{eb}{}^{f} [\SS^c_{d,n},\SS^e_{f,m}] \nn\\
&= f_{ca}{}^d f_{eb}{}^{f} \left(\delta^e_d \SS^c_{f,n+m} - \delta^c_f \SS^e_{d,n+m}\right) \nn\\
&= f_{ca}{}^d f_{db}{}^{f} \SS^c_{f,n+m} - f_{ca}{}^d f_{eb}{}^c \SS^e_{d,n+m} \nn\\
&= -f_{ab}{}^d f_{dc}{}^{f} \SS^c_{f,n+m} = f_{ab}{}^d \mathsf J_{d,n+m}\nn
\end{align}
}
\fi
\be J_{a,n}\mapsto \mathsf J_{a,n} := \sum_{b,c\in \mathcal I} f_{ba}{}^c \SS^b_{c,n},\qquad n\in {\mathbb Z}.\label{Jdef}\ee
and hence the homomorphism $\lad: {\mathfrak g} \to \gl(\oc\g)\ox \CC[t,t^{-1}] \rtimes {\mathbb C}\mathsf D$, with
\be \mathsf k \mapsto 0 \quad\text{and}\quad \mathsf d \mapsto \mathsf D.\nn\ee

There is an embedding $\iota:\gl(\oc\g)\ox \CC[t,t^{-1}] \rtimes {\mathbb C}\mathsf D \hookrightarrow \Derc{\O}$ given by
\be \iota(\SS^b_{c,n}) := \sum_{m\in {\mathbb Z}}  X^{b,m-n} D_{c,m},\qquad \iota(\mathsf D) := \sum_{a\in \mathcal I,m\in {\mathbb Z}}  m X^{a,m} D_{a,m}.\nn\ee
By means of this embedding, $\gl(\oc\g)\ox \CC[t,t^{-1}] \rtimes {\mathbb C}\mathsf D$ acts (via the adjoint action) on $\Derc{\O}$.
\begin{lem}\label{lem: stabdw} This action stabilizes the Lie subalgebra $\Dwg$. 
\end{lem}
\begin{proof} Suppose $\sum_{(a,n)\in \mathcal I \times \ZZ} P^{a,n}(X) D_{a,n}\in \Dwg$. Pick any $K\geq 1$ and any generator $\SS^b_{c,m}$ of $\gl(\oc\g)\ox \CC[t,t^{-1}]$ (it is clear that $\Dwg$ is stable under $\mathsf D$). Since the $\{P^{a,n}\}$ have widening gap, eventually $P^{a,n}$ has no factor $X^{d,p}$ with $|p| > |n| - K - |m|$. Therefore $\left[\SS^b_{c,m} , \sum_{(a,n)\in \mathcal I \times \ZZ} P^{a,n}(X) D_{a,n} \right]$ again has widening gap. (Note that for this argument to work it is necessary that the gap is really \emph{widening}, i.e. that the condition in \cref{Dwcond} is that \emph{for every $K$} eventually $|m|< |n| -K$.)
\end{proof}

Let us define $\Dg$ as the corresponding semi-direct product of Lie algebras, 
\be \Dg := \Dwg \rtimes \left(\gl(\oc\g)\ox \CC[t,t^{-1}] \rtimes {\mathbb C}\mathsf D\right) . \label{Dgdef}\ee

\subsection{Cartan involution}
Now let $\tau: \Derc{\O} \to \Derc{\O}$ be the involutive (i.e. $\tau^2 = \id$) automorphism defined by
\begin{alignat}{2} 
\tau(X^{\ia \alpha n}) &= X^{\ia{-\alpha}{-n}},\quad& \tau(X^{\ia i n}) &= - X^{\ia i {-n}},\nn\\
\tau(D_{\ia \alpha n}) &= D_{\ia{-\alpha}{-n}},\quad& \tau(D_{\ia i n}) &= - D_{\ia i {-n}},
\end{alignat}
for $\alpha\in \mathring\Delta\setminus\{0\}$, $i\in \mathring I$ and $n\in {\mathbb Z}$.
Recall ${\O_{\np}} = {\mathbb C}[X^{\ia a n}]_{\ii a n \in \mathsf A}$ where $\mathsf A := \{(\alpha,0)\}_{\alpha\in \mathring\Delta_+} \,\,\cup\,\, \mathcal I \times \ZZ_{\geq 1}$ indexes a basis of $\np$. Let us introduce 
${\O(\nm)} := {\mathbb C}[X^{\ia a n}]_{\ii a n \in -\mathsf A}$, where $-\mathsf A := \{(\alpha,0)\}_{\alpha\in \mathring\Delta_-} \,\,\cup\,\, \mathcal I \times \ZZ_{\leq -1}$. We define $\Derc{\O(\nm)}$ by obvious analogy with $\Derc{\O_{\np}}$.
Clearly, $\tau(\Derc{\O_{\np}}) = \Derc{\O(\nm)}$ and $\tau(\Derc{\O(\nm)}) = \Derc{\O_{\np}}$. 
Let $\sigma:{\mathfrak g} \to {\mathfrak g}$ be the Cartan involution of the affine Kac-Moody algebra ${\mathfrak g}$, defined by
\be \sigma(e_i) = f_i,\quad \sigma(f_i) = e_i,\quad \sigma(H) = -H,\label{caidef}\ee
for $i\in I$ and $H\in \h$. One has
\be \sigma(J_{\alpha,n}) = J_{-\alpha,-n},\quad \sigma(J_{i,n}) = -J_{i,-n},\nn\ee
for $\alpha\in \mathring\Delta\setminus\{0\}$, $i\in \mathring I$ and $n\in {\mathbb Z}$.
We get a homomorphism of Lie algebras
\be \tau \circ \rho \circ \sigma : {\mathfrak g} \to \Derc{\O(\nm)} \nn\ee
and hence a homomorphism of Lie algebras
\begin{align} \bm\rho := (\rho + \tau\circ\rho\circ\sigma) : {\mathfrak g} 
&\to \Derc{\O_{\np}} \oplus \Derc{\O(\nm)}\nn\\ 
&\hookrightarrow \Derc{\O}.\label{vfddef}
\end{align}
By construction, $\bm\rho$ has the equivariance property
\be \tau\circ\bm\rho = \bm\rho \circ \sigma .\label{vfdequi}\ee

Note that
\be \iota(\mathsf J_{a,n}) = (\iota\circ\lad)(J_{a,n}) = \sum_{b,c\in \mathcal I} f_{ba}{}^c \sum_{m\in {\mathbb Z}}  X^{b,m-n} D_{c,m} \in \Derc{\O}.\nn\ee
\begin{lem}\label{lem: Jdif}
For all $(a,n)\in \mathcal I\times {\mathbb Z}$, 
\be \bm\rho(J_{a,n}) - \iota(\mathsf J_{a,n}) \in \Dwg. \nn\ee
\end{lem}
\begin{proof}
Recall the definition \cref{Jpdef} of ${}^+\!\mathsf J_{a,n}$. Let us give a name to the linear map 
$f_+ : {\mathfrak g} \to\Derc{\O_{\np}}; J_{a,n} \to {}^+\!\mathsf J_{a,n}$. The key observation is that the difference
\be (f_+ + \tau\circ f_+ \circ \sigma)(J_{a,n}) - \iota(\mathsf J_{a,n}) \label{Jdif}\ee
is a finite sum of terms of the form $X^{b,m} D_{c,p}$, and thus an element of $\Der{\O}\subset \Dwg$. 

Together with \cref{linthm}, this implies the result.
\end{proof}

It follows from \cref{lem: Jdif} that the image $\bm\rho({\mathfrak g})$ of ${\mathfrak g}$ in $\Derc{\O}$ lies in the embedded copy of $\Dg$. In what follows we shall regard $\bm\rho$ as a homomorphism 
\be \bm\rho : {\mathfrak g} \to \Dg \label{vfddef}\ee
into the abstract copy of $\Dg$ we defined in \cref{Dgdef}. 

Observe that the difference $(f_+ + \tau\circ f_+ \circ \sigma)(J_{a,n}) - \iota(\mathsf J_{a,n})$ in \cref{Jdif} generically contains terms which do not stabilize both ${\O_{\np}}$ and ${\O(\nm)}$. (For example, terms like $X^{a,5} D_{b,-7}$ or $X^{a,-3} D_{b,8}$.) 
For that reason, it is worth stressing the following crucial property (which is true by construction).
\begin{prop}\label{stabprop}
$\bm\rho({\mathfrak g})$ stabilizes ${\O_{\np}}$ and ${\O(\nm)}$ in ${\O}$.
\qed\end{prop}
This is contrast to the obvious homomorphism ${\mathfrak g} \to\Derc{\O}$ sending $J_{a,n}\mapsto \iota(\mathsf J_{a,n})$ (and $\mathsf k\mapsto 0$, $\mathsf d \mapsto \sum_{n} n X^{a,n} D_{a,n}$). So what we have shown is that it is possible to add, to each generator $\iota(\mathsf J_{a,n})$, an infinite sum belonging to $\Dwg$ of ``correction terms'', in such a way that the resulting action does stabilize ${\O_{\np}}$ and ${\O(\nm)}$. 
It will be useful to have a name for these ``correction terms''. Let us write
\be \bm\rho(J_{a,n}) - \iota(\mathsf J_{a,n}) = \sum_{(b,m)\in \mathcal I\times {\mathbb Z}} R_{a,n}^{b,m}(X) D_{b,m}, \label{Rdef}\ee
where the collection $\{R_{a,n}^{b,m}(X)\}_{\ii bm \in \mathcal I \times \ZZ}$ of polynomials has widening gap, for each $(a,n)\in \mathcal I \times \ZZ$.



\section{Vertex algebras and main results}\label{sec: va}

\subsection{Weyl algebra $\Heis$}\label{sec: Heis}
Let $\Heis$ denote the associative unital ${\mathbb C}$-algebra obtained by quotienting the free associative unital ${\mathbb C}$-algebra with generators 
\be \upbeta_{{\ia a n}}[N],\quad \upgamma^{{\ia a n}}[N],\nn\ee 
with $N\in {\mathbb Z}$ and $\ii a n \in \mathcal I \times \ZZ$, by the two-sided ideal generated by the commutation relations 
\be [\upbeta_{\ia a n}[N],\upbeta_{\ia b m}[M]] = 0,\quad 
[\upbeta_{\ia a n}[N],\upgamma^{\ia b m}[M]] = \delta_{\ia a n}^{\ia b m} \delta_{N,-M} \bm 1,\quad 
[\upgamma^{\ia a n}[N],\upgamma^{\ia b m}[M]] = 0.\nn\ee


As a vector space,
\begin{align} \Heis &\cong_{\mathbb C} \Heis^- \otimes \Heis^+,  \nn
\end{align}
where
\be \Heis^- \cong {\mathbb C}\left[ \upgamma^{\ia a n}[N], \upbeta_{\ia a n}[N-1] \right]_{N \leq 0; \ii a n \in \mathcal I \times \ZZ}\label{Hm}\ee
is the algebra of  \emph{creation operators} and 
\be \Heis^+\cong {\mathbb C}\left[ \upgamma^{\ia a n}[N], \upbeta_{\ia a n}[N-1] \right]_{N > 0; \ii a n \in \mathcal I \times \ZZ}\label{Hp}\ee
is the algebra of  \emph{annihilation operators}. The fact that $\Heis^+$ and $\Heis^-$ are commutative (and that $\Heis$ is commutative modulo $\bm 1$) makes this an example of a \emph{system of free fields}. 

\subsection{Fock module $\mathsf M$}
Define $\mathsf M$ to be the induced $\Heis$-module generated by a vector $w_0$, the \emph{vacuum}, annhilated by $\Heis^+$, i.e.
\be \upbeta_{\ia a n}[M]w_0 = 0,\quad M\in {\mathbb Z}_{\geq 0}, \qquad 
    \upgamma^{\ia a n}[M]w_0 = 0,\quad M\in {\mathbb Z}_{\geq 1} \label{Mdef}\ee
for all ${\ii a n}\in \mathcal I \times \ZZ$, and on which $\bm 1w_0 = w_0$. Vectors in $\mathsf M$ are called \emph{states}. 

There is an obvious ${\mathbb Z}\times Q$-gradation 
of $\Heis$ and of $\mathsf M$ in which $\upbeta_{\ia a n}[N]$ has grade $(N,\alpha)$ 
and  $\upgamma^{\ia a n}[N]$ has grade $(N,-\alpha)$ 
whenever $J_{\ia a n} \in {\mathfrak g}_\alpha$, and $w_0$ has grade $(0,0)$. 

Call the first factor here the \emph{depth gradation}. Let $\mathsf M[N]$ denote the subspace of depth $n$, so that
\be \mathsf M = \bigoplus_{n=0}^\8 \mathsf M[N] .\label{depthgrad}\ee 
Call the corresponding filtration, given by
\be \mathsf M\df m := \bigoplus_{n=0}^m \mathsf M[N] ,\nn\ee
the \emph{depth filtration}. 
Every  $v\in \mathsf M$ belongs to $\mathsf M\df m$ for some $m$. 



\subsection{The subspace $\mathsf M\df 1$}
Let us introduce the space 
\be \Omega_{\O} := \mathrm{Hom}_{\O}(\Der{\O},{\O}).\nn\ee
It comes equipped with the derivative 
$\del: {\O} \to \Omega_{\O}$ 
defined by $(\del f)(v) = v(f)$. 
It is a free left ${\O}$-module, with an ${\O}$-basis consisting of basis vectors $\del X^{\ia a n}$, $\ii a n\in \mathsf A$, which obey $\del X^{\ia a n}(D_{\ia b m}) = \delta^{\ia a n}_{\ia b m}$: 
$\Omega_{\O} \cong_{\O} \bigoplus_{\ii a n\in \mathsf A} {\O} \del X^{\ia a n}$. 
There is an action of $\Der{\O}$ on $\Omega_{\O}$, given by $v . (f\del g) = (v. f) \del g + f \del(v. g)$. 
This action extends to a well-defined action of $\Derc{\O}$.
The space $\Omega_{\O}$ is graded by the root lattice $Q$, $\del$ has grade 0, and these structures respect the $Q$-grading. 

The subspace $\mathsf M[0]$ consists of states of the form $P(\upgamma[0]) w_0$ where $P(X) \in {\O}$.
Meanwhile the subspace $\mathsf M[1]$ consists of states of the form
\be \sum_{\ii a n \in \mathcal I \times \ZZ}P^{\ia a n}(\upgamma[0]) \upbeta_{\ia a n}[-1]w_0 
  + \sum_{\ii a n \in \mathcal I \times \ZZ}Q_{\ia a n}(\upgamma[0]) \upgamma^{\ia a n}[-1]w_0 \nn\ee
for polynomials $P^{\ia a n}(X), Q_{\ia a n}(X) \in {\O}$, $\ii a n \in \mathcal I \times \ZZ$.  
Thus, there are isomorphisms of vector spaces,
\begin{align} \mathsf M[0] &\cong {\O}, \label{Mnought}\\
\mathsf M[1] &\cong \Omega_{\O} \oplus \Der{\O},\label{vdecomp}
\end{align}
the latter 
given by identifying 
$\upbeta_{\ia a n}[-1]w_0$ with $D_{\ia a n}$ and $\upgamma^{\ia a n}[-1]w_0$ with $\del X^{\ia a n}$.

\begin{rem}
The subspace $\mathsf M\df 1$, equipped with the restriction of the vertex algebra structure on $\mathsf M$ we are about to recall, is an example of a \emph{$1$-truncated vertex algebra}. This in turn makes $\mathsf M[1]$ into a \emph{vertex ${\O}$-algebroid}. See \cite{GMSii, Bressler, GMShomog}. 
\end{rem}

\subsection{Vertex algebra structure}\label{sec: vas}
For every $N\in {\mathbb Z}$, there is a linear map \be \mathsf M \to \End\mathsf M;\quad A\mapsto A\vap N\nn\ee sending any given state $A$ to its \emph{$N$th mode}, $A\vap N\in \End\mathsf M$, and these modes can be arranged in a formal series, the \emph{field}
\be Y(A, x) := \sum_{n\in {\mathbb Z}} A\vap N x^{-N-1} \in \mathrm{Hom}\left(\mathsf M, \mathsf M((x))\right).\nn\ee 
The \emph{state-field map} $Y(\cdot,x): \mathsf M \to  \mathrm{Hom}\left(\mathsf M, \mathsf M((x))\right)$ obeys a collection of axioms that make $\mathsf M$ into a \emph{vertex algebra}; see e.g. \cite{LLbook,KacVertexAlgBook,FrenkelBenZvi}. 
It is defined as follows. First,  
\begin{alignat}{2}
\upbeta_{\ia a n}(x) &:= Y\left(\upbeta_{\ia a n}[-1] w_0,x\right) 
                   &&= \sum_{N\in {\mathbb Z}} \upbeta_{\ia a n}[N] x^{-N-1},\nn\\
\upgamma^{\ia a n}(x) &:= Y\left(\upgamma^{\ia a n}[0] w_0,x\right) 
                   &&= \sum_{N\in {\mathbb Z}} \upgamma^{\ia a n}[N] x^{-N} .\nn
\end{alignat}
Next, let us write $f^{(N)}(u) := \frac{1}{N!} \frac{\del^N}{\del u^N} f(u)$. Then $Y( \upbeta_{\ia b m}[-M] w_0 , u ) = \upbeta_{\ia b m}^{(M-1)}(u)$ and  $Y( \upgamma^{\ia a n}[-N] w_0 , u ) = \upgamma^{\ia a n (N)}(u)$
and more generally if
\be A = \upgamma^{\ia{a_1}{n_1}}[-N_1]\dots \upgamma^{\ia{a_r}{n_r}}[-N_r] 
                \upbeta_{\ia{b_1}{m_1}}[-M_1]\dots \upbeta_{\ia{b_s}{m_s}}[-M_s] w_0, \label{monstate}\ee 
then
\begin{multline} A(u) := Y(A,u) =\nord{\upgamma^{\ia{a_1}{n_1} (N_1)}(u) \dots \upgamma^{\ia{a_r}{n_r} (N_r)}(u) 
               \upbeta_{\ia{b_1}{m_1}}^{(M_1-1)}(u)\dots \upbeta_{\ia{b_s}{m_s}}^{(M_s-1)}(u)}
.\label{Au}
\end{multline}           
Here $\nord{\dots}$ denotes the \emph{normal-ordered product} of fields, which is defined in general as follows. For any states $A,B\in \mathsf M$, 
\be \nord{Y(A,u) Y(B,v)} \,\,\, := \Biggl(\sum_{M<0} A\vap M u^{-M-1} \Biggr)Y(B,v) + Y(B,v) \Biggl(\sum_{M\geq 0} A\vap M u^{-M-1}\Biggr),\label{nord}\ee 
and $\nord{Y(A, u) Y(B, u)}$ is the specialization at $u=v$.
For more than two fields, the normal ordered product is understood to be right-associative, i.e.
$\nord{Y(A,u) Y(B,v) Y(C,w)} = \nord{Y(A,u)\bigl(\nord{Y(B,v) Y(C,w)}\bigr)}$
and so on.

For the $\upbeta\upgamma$-system (and for systems of free fields more generally) there is a simpler definition of the normal ordered product for monomial states like $A$ in \cref{monstate}. Given any monomial $m\in \Heis$, one defines $\nord m\in \Heis$ to be the monomial with the same factors as $m$ but ordered so that all annihilation operators stand to the right of all creation operators (see \cref{Hm,Hp}). Then 
\begin{equation}   \nord{\upgamma^{\ia{a_1}{n_1} (N_1)}(u_1) \dots \upgamma^{\ia{a_r}{n_r} (N_r)}(u_r)  \upbeta_{\ia{b_1}{m_1}}^{(M_1-1)}(v_1)\dots \upbeta_{\ia{b_s}{m_s}}^{(M_s-1)}(v_s)} 
\nn\end{equation}
is defined by normal-ordering the monomials in the series, term by term. 

The depth gradation, \cref{depthgrad}, makes $\mathsf M$ into a graded vertex algebra: the vacuum $w_0$ is in grade zero; for any states $A\in \mathsf M[R]$, $B \in \mathsf M[S]$ and any $N \in {\mathbb Z}$,
$A\vap N  B  \in \mathsf M[R + S  - N - 1]$.

We have the \emph{translation operator} $T\in \End\mathsf M$ of the vertex algebra $\mathsf M$, defined by $TA := A\vap{-2}w_0$. It acts on monomials in the generators of $\Heis$ as a derivation, according to
\be \left[T, \upbeta_{a,n}[-N]\right] = -N \upbeta_{a,n}[N-1] ,\qquad \left[T, \upgamma^{a,n}[-N]\right] = -(N-1)\upgamma^{a,n}[N-1], \nn\ee
and by definition $Tw_0 = 0$. 


\subsection{The OPE}
One has the commutator formula for modes of states:
\be \label{com Am Bn}
\bigl[ A\vap M, B\vap N  \bigr] = \sum_{K \geq 0} \binom M K \big( A\vap K B \big)\vap {M+N-K}.
\ee
Here, for all $M\in {\mathbb Z}$, $\binom MK := \frac{M(M-1)\dots (M-K+1)}{K!}$ for $K\neq 0$ and $\binom M 0 := 0$.
From 
this and the definition of the normal ordered product, \cref{nord}, one obtains the \emph{operator product expansion (OPE)}:
\be Y(A,u) Y(B,v) = \sum_{N\geq 0} \frac{Y(A\vap N B, v)}{(u-v)^{N+1}} + \nord{Y(A,u) Y(B,v)} \nn\ee
as an equality in $\mathrm{Hom}(\mathsf M,\mathsf M((u))((v)))$. Here $(u-v)^{-N-1}$ is understood to be expanded in positive powers of $v/u$.
\ifdefinedtrue
\else
\footnote{Indeed, in  $\wh\Heis[[u^{\pm 1},v^{\pm 1}]]$, one has
\begin{align} 
Y[A,u] Y[B,v]- \nord{Y[A,u] Y[B,v]} &= \left[ \left(\sum_{M\geq 0} A\vap M u^{-M-1}\right), Y[B,v] \right]\nn\\
&= 
\sum_{M\geq 0} \sum_{N} [ A\vap M, B \vap N ] u^{-M-1} v^{-N-1} \nn\\
&=
\sum_{M\geq 0} \sum_{N} \sum_{P\geq 0} \binom M P \left( A \vap P B\right)\vap{M+N-P} u^{-M-1} v^{-N-1} \nn\\
&=
\sum_{M\geq 0} \sum_{N} \sum_{P\geq 0} \binom M P 
\left( A \vap P B\right)\vap{M+N-P} v^{-N-M+P-1} u^{-M-1} v^{M-P}  \nn\\
&=
\sum_{M\geq 0} \sum_{P\geq 0} \binom M P 
Y[ A \vap P  B,v] u^{-M-1} v^{M-P}  \nn\\
&=
\sum_{P\geq 0} 
Y[ A \vap P  B,v] \frac{1}{P!} \del_v^P \sum_{M\geq 0} u^{-M-1} v^{M}  \nn\\
&=
\sum_{P\geq 0} 
Y[ A \vap P  B,v] \frac{1}{(u-v)^{P+1}}  \nn
\end{align}
}
\fi
Thus, computing the singular terms in the OPE is the same things as computing the non-negative vertex algebra products. 
\subsection{The Wick formula}\label{sec: wick}
For the $\upbeta\upgamma$-system (and for systems of free fields more generally) one has the usual \emph{Wick formula} for OPEs of monomial states. 
We take the statement from \cite[\S12.2.6]{FrenkelBenZvi}.

Let $A(u)$ and $B(u)$ be normal-ordered monomials in $\upbeta_{\ia a n}(u)$, $\upgamma^{\ia a n}(u)$, $\ii a n \in \mathcal I \times \ZZ$, and their derivatives as in \cref{Au}. A \emph{single pairing} between $A(u)$ and $B(v)$ is a choice, for some fixed $\ii a n\in \mathcal I \times \ZZ$, of
\begin{enumerate}[i)]
\item one factor $\upbeta_{\ia a n}^{(N)}(u)$ from $A(u)$ and one factor $\upgamma^{\ia a n (M)}(v)$ from $B(v)$ \\ -- to such a pairing we associate the function $(-1)^N \binom{N+M}{N}\frac{1}{(u-v)^{N+M+1}}$ -- or  
\item  one factor $\upgamma^{\ia a n (N)}(u)$ from $A(u)$ and one factor $\upbeta_{\ia a n (M)}(v)$ from $B(v)$ \\ -- to such a pairing we associate the function $(-1)^{M+1} \binom{N+M}{N}\frac{1}{(u-v)^{N+M+1}}$.
\end{enumerate}
A pairing is a disjoint union of zero or more single pairings. To a pairing $P$ we associate the function $f_P(u,v)$ obtained by taking the product the functions associated to each constituent single pairing (or 1, for the empty pairing). Given a pairing $P$ let $(A(u)B(v))_P$ denote the product $A(u)B(v)$ but with all factors belonging to the pairing removed (to leave $1$, in the special case that there are no factors left). The \emph{contraction} $\nord{A(u) B(v)}_P$ associated to a pairing $P$ is by definition  
\be \nord{A(u) B(v)}_P := f_P(u,v) \,\nord{(A(u)B(v))_P}\,\,.\nn\ee

\begin{lem}[Wick formula]\label{Wicklem}  The product $A(u) B(v)$ is equal to the sum of contractions $\nord{A(u) B(v)}_P$ over all pairings $P$ between the monomials $A$ and $B$, counted with multiplicity (and including the empty one). 
\qed\end{lem}
One can then compute the OPE by Taylor-expanding the fields $\upbeta_{\ia a n}(u)$ and $\upgamma^{\ia a n}(u)$ about $u=v$. 

\subsection{Completion $\widetilde\mathsf M$ of $\mathsf M$}\label{sec: wtMh}
Having in mind the completion $\Derc{\O}$ of $\Der{\O}$ introduced in \cref{sec: cai} (and see \cref{sec: derO}), one sees that $\mathsf M\df 1$ is not quite big enough for our purposes. 
Let us introduce a completion of $\widetilde\mathsf M$ of $\mathsf M$ in such a way as to preserve the depth filtration. To that end, we start by completing each filtered subspace $\mathsf M\df m$, as follows. 

Let $\Heis^-_{\geq k}$ denote the two-sided ideal in the commutative algebra $\Heis^-$ of creation operators, cf. \cref{Hm}, generated by 
\be \{\upbeta_{\ia a n}[N]:  a \in \mathcal I, |n| \geq k, N\in {\mathbb Z}\} .\nn\ee

Let $\mathcal I\df m_k$ denote the subspace of $\mathsf M\df m$ given by
\be \mathcal I\df m_k := \mathsf M\df m \cap \left(\Heis^-_{\geq k}w_0\right) .\nn\ee
Thus, $\mathcal I\df m_k$ is the subspace of $\mathsf M\df m$ spanned by monomials in the creation operators that have some factor $\upbeta_{\ia a n}[N]$ with $|n|\geq k$.
We have
\be \mathcal I\df m_0 \supset \mathcal I\df m_1 \supset \mathcal I\df m_2 \supset \dots \nn\ee
and $\bigcap_{i=0}^\8 \mathcal I\df m_i = \{0\}$ and we define
\be \widetilde\mathsf M\df m := \varprojlim_k \mathsf M\df m\big/ \mathcal I\df m_k .\nn\ee
These completed subspaces $\widetilde\mathsf M\df m$ form a directed system, $\widetilde\mathsf M\df 0 \subset \widetilde\mathsf M\df 1 \subset \widetilde\mathsf M\df 2 \dots$, and we define $\widetilde\mathsf M$ to be the direct limit
\be \widetilde\mathsf M := \varinjlim_m \widetilde\mathsf M\df m .\nn\ee
In other words, each element of $\widetilde\mathsf M$ is by definition an element of $\widetilde\mathsf M\df m$ for some sufficiently large $m$ (depending on the element) with two elements of $\widetilde\mathsf M$ considered equal if they are equal in $\widetilde\mathsf M\df m$ for some $m$. 

Explicitly, the sum
\be \sum_{\substack{a_1,\dots,a_p\in \mathcal I \\ n_1,\dots,n_p\in {\mathbb Z}}} 
P^{a_1,n_1}(\upgamma) \dots P^{a_p,n_p}(\upgamma) \upbeta_{a_1,n_1}[-N_1] \dots \upbeta_{a_p,n_p}[-N_p] w_0,\quad p\in {\mathbb Z}_{\geq 0}, \label{Mstate}\ee 
belongs to $\widetilde\mathsf M$ if, for each $i\in \{1,\dots,p\}$, $N_i\in {\mathbb Z}_{\geq 1}$ and there is a bound on the depth of the polynomials
\be P^{a_i,n_i}(\upgamma)\in {\mathbb C}[\upgamma^{b,m}[-M]]_{b\in \mathcal I, m\in {\mathbb Z}, M\in {\mathbb Z}_{\geq 0}}\nn\ee 
as $(a_i,n_i)$ ranges over $\mathcal I\times {\mathbb Z}$. Elements of $\widetilde\mathsf M$ are finite linear combinations of such sums.

The vertex algebra structure on $\mathsf M$ does not extend to a well-defined vertex algebra structure on $\widetilde\mathsf M$. For example in $\widetilde\mathsf M$ we have the state
\be  S:= \sum_{\ii a n \in \mathcal I \times \ZZ} \upgamma^{\ia a n}[0] \upbeta_{\ia a n}[-1]w_0 \in \widetilde \mathsf M .\nn\ee 
If ${\mathfrak g}$ were finite-dimensional, this would be a conformal vector.
But here it is an infinite sum, and when we attempt to compute, for example, the action of the would-be first mode of $S$, 
\be S\vap{1} = \sum_{N\geq 0} \sum_{\ii a n \in \mathcal I \times \ZZ} 
    \left( \upbeta_{\ia a n}[-N] \upgamma^{\ia a n}[N+1] + \upgamma^{\ia a n}[-N] \upbeta_{\ia a n}[N+1]\right)
\nn\ee
on the state $S$, we encounter a double contraction yielding the ill-defined sum
\begin{align}  \sum_{\ii a n \in \mathcal I \times \ZZ}  \upbeta_{\ia a n}[0] \upgamma^{\ia a n}[1] \sum_{\ii b m \in \mathcal I \times \ZZ} \upgamma^{\ia b m}[0] \upbeta_{\ia b m}[-1]w_0\nn\\
= \sum_{\ii a n \in \mathcal I \times \ZZ} \sum_{\ii b m \in \mathcal I \times \ZZ} \delta_{\ia a n}^{\ia b m} \delta_{\ia b m}^{\ia a n}
= \sum_{\ii a n \in \mathcal I \times \ZZ} 1 .\nn
\end{align} 


\subsection{The vertex algebra $\Mw$}\label{sec: mw}
Let $\Mw\subset\widetilde\mathsf M$ denote the subspace of $\widetilde\mathsf M$ spanned by states of the form \cref{Mstate} such that, for each $i=1,\dots,p$, the collection of polynomials $\{P^{a_i,n_i}\}_{\ii{a_i}{n_i}\in \mathcal I \times \ZZ}$ has widening gap in same sense as in \cref{sec: wg}, i.e. for every $K\geq 1$, we have 
\be P^{a_i,n_i}(\upgamma) \in {\mathbb C}\!\left[\upgamma^{b,m}[-M]: |m| < |n_i|-K, b\in \mathcal I, M\in {\mathbb Z}_{\geq 0} \right], \label{Mwcond}\ee
(for all $a_i\in \mathcal I$) for all but finitely many $n_i\in {\mathbb Z}$.

Evidently $\mathsf M\subsetneq \Mw \subsetneq \widetilde\mathsf M$, and
\begin{align} \widetilde\mathsf M[1] &\cong \Omega_{\O} \oplus \Derc{\O} \nn\\
                 \Mw[1] &\cong \Omega_{\O} \oplus \Dwg\nn
\end{align} 
(and $\mathsf M[0] = \Mw[0] = \widetilde\mathsf M[0] \cong {\O}$).


\begin{lem}\label{lem: Mw}
The vertex algebra structure on $\mathsf M$ extends uniquely to a well-defined vertex algebra structure on $\Mw$. 
\end{lem}
\begin{proof} 
The non-trivial thing we have to check is the closure of the OPE, i.e. that the OPE of any two fields of states in $\Mw$ has coefficients that are fields of states in $\Mw$. 
 
This follows from the Wick formula, \cref{sec: wick}. Consider a typical contraction:
\be \sum_{(a,n)\in \mathcal I \times \ZZ}\wick{\nord{\dots P^{a,n}(\upgamma)(z) \dots \c\upbeta_{a,n}(z)} \quad \sum_{(b,m)\in \mathcal I \times \ZZ}\nord{\dots Q^{b,m}(\c \upgamma)(w) \dots \upbeta_{b,m}(w) }}. \nn\ee
The resulting sum has, associated to the factor $\upbeta_{b,m}$, the coefficient polynomial (we suppress the mode numbers $[M]$, which play no essential role here) 
\be \sum_{(a,n)\in \mathcal I \times \ZZ} P^{a,n} \frac{\del Q^{b,m}}{\del \upgamma^{a,n}} .\nn\ee
As in \cref{cor: wg}, this collection of polynomials again has widening gap, and the same logic extends to longer chains of contractions. More generally, by \cref{cor: wgtree} the same is true in any situation in which the contractions form an acyclic directed graph. (We think of a contraction of $\upbeta_{a,n}$ into $P^{b,m}(\upgamma)$ as a directed edge $(a,n) \to (b,m)$.)
And, in view of \cref{cor: wgcycle}, any cycle in the directed graph of the contractions merely gives rise to an overall factor belonging to ${\mathbb C}[\upgamma^{c,p}[-M]]_{c\in \mathcal I,p\in {\mathbb Z},M\in {\mathbb Z}_{\geq 0}}$. For example, in  
\be \sum_{(a,n)\in \mathcal I \times \ZZ}\wick{\nord{\dots P^{a,n}(\c2\upgamma)(z) \dots \c1\upbeta_{a,n}(z)} \quad\sum_{(b,m)\in \mathcal I \times \ZZ}\nord{\dots Q^{b,m}(\c1 \upgamma)(w) \dots \c2\upbeta_{b,m}(w) }}, \nn\ee
only finitely many $n,m$ can give nonzero summands.
\end{proof}
\begin{rem}
As a vertex algebra, $\Mw$ is generated by the fields $(\upgamma^{a,n}(z))_{(a,n)\in \mathcal I \times \ZZ}$ together with all the fields 
\be  \sum_{(a,n)\in \mathcal I \times \ZZ} \nord{P^{a,n}(\upgamma(z)) \upbeta_{a,n}(z)} \nn\ee
as
\be \left(P^{a,n}(\upgamma(z))\in {\mathbb C}[\upgamma^{b,m\,(N)}(z): (b,m)\in \mathcal I \times \ZZ, N\geq 0]\right)_{(a,n)\in \mathcal I \times \ZZ} \nn\ee
runs over all collections of polynomials that have widening gap and bounded depth.
\end{rem}

\subsection{The vertex algebras $\Mf$ and $\Mfw$}\label{sec: Mfw}
Let $L$ denote the Lie algebra with generators $\{\SS^a_{b,n}[N]\}_{a,b\in \mathcal I, n\in {\mathbb Z},N\in {\mathbb Z}}$ and $\{\mathsf D[N]\}_{N\in {\mathbb Z}}$ subject to the relations
\begin{align} \left[\SS^a_{b,n}[N],\SS^c_{d,m}[M]\right] &= \delta^c_b \SS^a_{d,n+m}[N+M]- \delta^a_d \SS^c_{b,n+m}[N+M].\nn\\
 \left[\mathsf D[N], \SS^a_{b,n}[M]\right] &= n \SS^a_{b,n}[N+M] .\nn
\end{align}
In other words, $L$ is loop algebra of $\gl(\oc\g)\ox \CC[t,t^{-1}] \rtimes {\mathbb C}\mathsf D$. 
We can take the semi-direct product $L\ltimes \Heis$, where the action of $L$ on $\Heis$ is given by
\begin{alignat}{2} 
\left[\SS^a_{b,n}[N], \upbeta_{c,m}[M]\right] &= - \delta_c^a \upbeta_{b,m+n}[N+M],\quad &
\left[\mathsf D[N], \upbeta_{c,m}[M]\right] &= - m \upbeta_{c,m}[N+M] \nn\\
\left[\SS^a_{b,n}[N], \upgamma^{c,m}[M]\right] &= \phantom +  \delta_b^c \upgamma^{a,m-n}[N+M],\quad &
\left[\mathsf D[N], \upgamma^{c,m}[M]\right] &= \phantom +  m \upgamma^{c,m}[N+M] .\nn
\end{alignat}
Let $\Mf$ denote the module over $L\ltimes \Heis$ induced from a vector $w_0$ obeying the conditions \cref{Mdef} together with
\be \SS^a_{b,n}[N] w_0 = 0, \qquad \mathsf D[N] w_0 = 0,  \qquad N \in {\mathbb Z}_{\geq 0}.\nn\ee 

Thus as a vector space $\Mf$ is the tensor product of the Fock module $\mathsf M$ over $\Heis$ and the vacuum Verma module (at level 0) ${\mathbb V}_0^{\gl(\oc\g)\ox \CC[t,t^{-1}]\rtimes{\mathbb C}\mathsf D,0}$ over $L$:
\be \Mf \cong_{\mathbb C} \mathsf M \otimes {\mathbb V}_0^{\gl(\oc\g)\ox \CC[t,t^{-1}]\rtimes{\mathbb C}\mathsf D,0}. \nn\ee

This module $\Mf$ is a vertex algebra. The state-field map is given by the formulas in \cref{sec: vas} together with
\begin{alignat}{2}
\SS^a_{b,n}(x) &:= Y\!\left( \SS^a_{b,n}[-1]w_0, x\right)
               && = \sum_{N\in {\mathbb Z}} \SS^a_{b,n}[N] x^{-N-1},\nn\\
    \mathsf D(x) &:= Y\!\left( \mathsf D[-1]w_0, x\right) 
               &&= \sum_{N\in {\mathbb Z}} \mathsf D[N] x^{-N-1}.
\end{alignat}

As a vertex algebra, $\Mf$ is generated (in the sense of the Strong Reconstruction Theorem \cite{FKRW},\cite[\S4.5]{KacVertexAlgBook},\cite[\S4.4]{FrenkelBenZvi}) by the countable collection of fields $\upbeta_{a,n}(z)$, $\upgamma^{a,n}(z)$, $\SS^a_{b,n}(z)$ and $\mathsf D(z)$, subject to the OPEs 
\begin{align} \upbeta_{a,n}(z) \upgamma^{b,m}(w) &= \delta^{b,m}_{a,n} \frac{1}{z-w} + \dots \nn
\end{align}
\begin{alignat}{2} 
\SS^a_{b,n}(z) \upgamma^{c,m}(w) &= \phantom + \delta^c_b\frac{\upgamma^{a,m-n}(w)}{z-w} + \dots \qquad &
\SS^a_{b,n}(z) \upbeta_{c,m}(w) &=          - \delta^a_c\frac{\upbeta_{b,m+n}(w)}{z-w} + \dots ,\nn\\
           \mathsf D(z) \upgamma^{c,m}(w) &= \phantom +m\frac{\upgamma^{a,m}(w)}{z-w} + \dots &
\qquad     \mathsf D(z) \upbeta_{c,m}(w) &=          -m\frac{\upbeta_{b,m}(w)}{z-w} + \dots ,\nn
\end{alignat}
\begin{align} \SS^a_{b,n}(z) \SS^c_{d,m}(w) &=  
        \frac{\delta^c_b \SS^a_{d,n+m}(w)- \delta^a_d \SS^c_{b,n+m}(w)}{z-w} + \dots ,\nn\\
\mathsf D(z) \SS^a_{b,n}(w) &=  
        n\frac{\SS^a_{b,n}(w)}{z-w} + \dots .\nn
\end{align}
(with the others being trivial). 

We can enlarge the tensor factor $\mathsf M$ to $\Mw$ as in \cref{sec: mw} above. 
Let $\Mfw$ denote the resulting vector space,
\be \Mfw \cong_{\mathbb C} \Mw \otimes {\mathbb V}_0^{\gl(\oc\g)\ox \CC[t,t^{-1}]\rtimes{\mathbb C}\mathsf D,0}. \nn\ee

\begin{lem}
The vertex algebra structure on $\Mf$ extends uniquely to a well-defined vertex algebra structure on $\Mfw$. 
\qed
\end{lem}
\begin{proof}
Given \cref{lem: Mw}, the remaining thing to check is that the OPE of $\SS^a_{b,n}(z)$ with the field of any state in $\Mw$ has coefficients which are again the fields of well-defined states in $\Mw$. This is true by the same reasoning as in \cref{lem: stabdw}. 
\end{proof}


We have the depth gradation on $\Mfw$, in which $w_0$ has grade $0$ and $\upgamma^{a,n}[N]$, $\upbeta_{a,n}[N]$, $\SS^a_{b,n}[N]$ and $\mathsf D[N]$ contribute grade $-N$. 

We continue to identify
\be \Mfw[0] = \mathsf M[0] \cong {\O} \nn\ee
by identifying $P(X) \in {\O}$ with the state $P(\upgamma[0])w_0$ in $\Mfw[0]$, and to identify $\Omega_{\O}$ with the subspace of $\Mfw[1]$ consisting of states of the form 
\be \sum_{a,n\in \mathcal I \times \ZZ} P_{a,n}(\upgamma[0]) \upgamma^{a,n}[-1]w_0 \in \mathsf M[1] \subset \Mfw[1],\nn\ee
by identifying this state with $\sum_{a,n\in \mathcal I \times \ZZ} P_{a,n}(X) \del X^{a,n} \in \Omega_{\O}$. Note that $\del: {\O} \to \Omega_{\O}$ then corresponds to the vertex algebra translation operator $T$. 

We also have the obvious injective linear map 
\be \jmath: \Dg \hookrightarrow \Mfw[1] \label{jotadef}\ee
which maps the element
\be \sum_{a,n\in \mathcal I \times \ZZ} P^{a,n}(X) D_{a,n} + \sum_{\substack{a,b\in \mathcal I,n\in {\mathbb Z}}} p^{b,n}_{a} \SS^a_{b,n} \in \Dg\nn\ee
to the state
\be \sum_{a,n\in \mathcal I \times \ZZ} P^{a,n}(\upgamma[0]) \upbeta_{a,n}[-1]w_0 + \sum_{\substack{a,b\in \mathcal I,n\in {\mathbb Z}}} p^{b,n}_{a} \SS^a_{b,n}[-1]w_0 \in \Mfw[1]\nn\ee
(The first sum is possibly infinite but must obey the condition \cref{Dwcond}, cf. \cref{Mwcond}. By definition of $\gl(\oc\g)\ox \CC[t,t^{-1}]$ the second sum must have only finitely many nonzero summands.)

In this way,  
\begin{align} \Mfw[0] &\cong {\O} \nn\\
              \Mfw[1] &\cong  \Omega_{\O} \oplus \jmath(\Dg).\label{vtdecomp2}\end{align}
Note that while we identify ${\O}$ and $\Omega_{\O}$ with their images in $\Mfw\df 1$, from now on we keep the explicit notation $\jmath$ for the embedding of $\Dg$. 

\subsection{Local Lie algebras}\label{sec: loc lie}
Given any vertex algebra $\mathscr V$ one has the Lie algebra $\L(\mathscr V)$ of formal modes of states in $\mathscr V$.  (See \cite[\S4]{FrenkelBenZvi}.) Namely, 
\be \L(\mathscr V) := \bigl.\mathscr V \otimes {\mathbb C}((t)) \bigr/ \im(T\otimes 1 + \id \otimes \del_t). \label{LVdef}\ee 
It is generated by formal modes $A\fm M$, $A\in \mathscr V$, $M\in {\mathbb Z}$, modulo the relations $(TA)\fm M = -M A\fm{M-1}$.\footnote{Strictly speaking, it is spanned by linear combinations of the form $\sum_{N} f_N A\fm N$, $f_N\in {\mathbb C}$, $A\in \mathscr V$, of these formal modes.} The Lie bracket is given by the same commutator formula \cref{com Am Bn} obeyed by the modes $A\vap M$ (living in $\End(\mathscr V)$), i.e. 
\be\bigl[ A\fm M ,B\fm N  \bigr] = \sum_{K \geq 0} \binom M K \big( A\vap K B \big)\fm{M+N-K}.\label{comf}\ee

Since this formula involves only the non-negative products (i.e., only the singular terms of the OPE), we get a Lie subalgebra $\L(\mathscr{L})$ associated to any subspace $\mathscr{L} \subset \mathscr V$ closed under translation $T$ and all the non-negative products. (Such a subspace $\mathscr{L}$ is called a \emph{vertex Lie subalgebra} of $\mathscr V$ \cite{Primc,DLM}.) 
In fact, we don't need to insist on closure under translation: let $\mathscr{L}$ be any subspace closed under the non-negative products; then $\sum_{n=0}^\8 T^n \mathscr{L}\subset \mathscr V$ is also closed under all the non-negative products\footnote{Indeed, we have $(TA)\vap n B = -n A\vap{n-1} B$ (note the right-hand side is zero when $n=0$) and $A\vap n TB = T(A\vap n B) - (TA)\vap n B$.}, and under translation.

Thus, given any vector subspace $\mathscr{L}\subset \mathscr V$, let
\be \L(\mathscr{L}) := \bigl.\left(\sum_{n=0}^\8 T^n \mathscr{L}\right)\otimes {\mathbb C}((t)) \bigr/ \im(T\otimes 1 + \id \otimes \del_t);\nn\ee
then \cref{comf} defines the structure of a Lie algebra on $\L(\mathscr{L})$ whenever $\mathscr{L}$ closes under all the non-negative products.

Such Lie algebras $\L(\mathscr{L})$ are called \emph{local} Lie algebras. 

For any such Lie algebra $\L(\mathscr{L})$ we have (as one sees from the commutator formula) subalgebras $\L_{\geq 0}(\mathscr{L})$ and $\L_0(\mathscr{L})$ consisting of, respectively, the non-negative and zero modes of states in $\mathscr{L}$. 

\subsection{The extension of $L\Dg$ by $\L(\Og \oplus \Omega_\Og)$}
In our case we have the Lie algebra $\L(\Mfw)$ associated to the vertex algebra $\Mfw$. The following is clear on inspection. 
\begin{lem}\label{Midlem} $ $
\begin{enumerate}[(i)]
\item The subspace $\Mfw\df1$ is closed under all the non-negative products. 
\item The subspace $\Og \oplus \Omega_\Og$ is closed under all the non-negative products and moreover these non-negative products all vanish. 
\item $\Og \oplus \Omega_\Og\subset \Mfw\df 1$ is an ideal, in the sense that $A\vap M B \in \Og \oplus \Omega_\Og$ for all $A\in \Og \oplus \Omega_\Og$, $B\in \Mfw\df 1$ and $M\geq 0$.
\end{enumerate}
\qed\end{lem}
As a result, 
we have the short exact sequence of Lie algebras
\be 0 \to \L(\Og \oplus \Omega_\Og) \to \L(\Mfw\df1) \to \L(\Mfw\df1)\big/\L(\Og \oplus \Omega_\Og) \to 0 \nn\ee
where $\L(\Og \oplus \Omega_\Og)$ is commutative. 

\begin{rem}
We can describe the commutative Lie algebra $\L(\Og \oplus \Omega_\Og)$ more explicitly: since $\del=T: {\O} \to \Omega_{\O}$ is injective and has kernel ${\mathbb C}w_0$, we have that
\begin{align} 
\L(\Og \oplus \Omega_\Og) &\cong \L(\Omega_{\O}) \oplus {\mathbb C}\bm 1
\cong L\Omega_{\O} \oplus {\mathbb C}\bm 1
\nn\end{align}
where $L\Omega_{\O} := \Omega_{\O} \otimes {\mathbb C}((t))$ is the loop algebra of $\Omega_{\O}$, the latter regarded as a commutative Lie algebra, and where
$\bm 1 := w_0\fm{-1} $
is the only nonzero mode of the state $w_0$. 
\end{rem}

Now let $L\Dg := \Dg \otimes {\mathbb C}((t))$ 
denote the loop algebra of $\Dg$.

\begin{lem}\label{LDextlem} 
There is an isomorphism
\be L\Dg \cong \L(\Mfw\df1)\big/ \L(\Og \oplus \Omega_\Og)  \nn\ee 
of Lie algebras, so we have the exact sequence of Lie algebras
\be 0 \to \L(\Og \oplus \Omega_\Og)  \to \L(\Mfw\df1) \to L\Dg \to 0.\label{LDext}\ee 
\end{lem}
\begin{proof}
Checking the definitions, one first sees that at the level of vector spaces we have
\be \L(\Mfw\df 1) \cong_{\mathbb C} \L(\Og \oplus \Omega_\Og) \oplus \L(\jmath(\D(g))) \nn\ee
and 
\be \L(\jmath(\D(g))) \cong_{\mathbb C} L\Dg.\nn\ee
The fact that $L\Dg \cong \L(\Mfw\df1)\big/\L(\Og \oplus \Omega_\Og)$ is also an isomorphism of Lie algebras is a consequence of the following observation.
\end{proof}
\begin{lem}
\label{jotalem}
For any $X,Y\in \Dg$, we have
\be \jmath(X) \vap 0 \jmath(Y) \equiv \jmath([X,Y]) \mod \Omega_{\O} ,\qquad 
    \jmath(X) \vap 0 \jmath(Y) \equiv 0 \mod {\O}. \nn\ee
\end{lem}
\begin{proof}
Let us compute the OPE of two states in $\jmath(\Dg)$. 
Throughout this proof we use summation convention over repeated pairs of indices not only in $\mathcal I$ but also in ${\mathbb Z}$. Let
\be A = P^{a,n}(\upgamma[0]) \upbeta_{a,n}[-1]w_0 + p^{b,n}_a \SS^a_{b,n}[-1] w_0 ,\nn\ee
\be B = Q^{a,n}(\upgamma[0]) \upbeta_{a,n}[-1]w_0 + q^{b,n}_a \SS^a_{b,n}[-1] w_0 .\nn\ee
Then we find
\begin{align}
Y(A,z) Y(B,w) &= \nord{Y(A,z)Y(B,z)} \label{ABope} \\
& + \frac{1}{z-w} 
\nord{Y(P^{a,n}(\upgamma) w_0,z) 
      Y\left(\frac{\del Q^{b,m}}{\del \upgamma^{a,n}[0]} \upbeta_{b,m}[-1]w_0,w\right)}\nn\\
& + \frac{1}{z-w} 
p^{b,n}_a \nord{ 
      Y\left(\frac{\del Q^{c,m}}{\del \upgamma^{b,p}[0]} \upgamma^{a,p-n}[0]\upbeta_{c,m}[-1]w_0,w\right)}\nn\\
& + \frac{1}{z-w} 
p^{b,n}_a \nord{ 
      Y\left(Q^{a,m}(\upgamma) \upbeta_{b,m+n}[-1]w_0,w\right)}\nn\\
& - \frac{1}{z-w} 
\nord{Y\left(\frac{\del P^{a,n}}{\del \upgamma^{b,m}[0]} \upbeta_{a,n}[-1]w_0,z\right) 
      Y\left(Q^{b,m}(\upgamma) w_0,w\right)} \nn\\
& - \frac{1}{z-w} 
q^{b,n}_a \nord{ 
      Y\left(\frac{\del P^{c,m}}{\del \upgamma^{b,p}[0]} \upgamma^{a,p-n}[0]\upbeta_{c,m}[-1]w_0,z\right)}\nn\\
& - \frac{1}{z-w} 
q^{b,n}_a \nord{ 
      Y\left(P^{a,m}(\upgamma) \upbeta_{b,m+n}[-1]w_0,z\right)}\nn\\
& + \frac1{z-w} p^{b,n}_a q^{d,m}_b \left(\delta^c_b \SS^a_{d,n+m}(w)- \delta^a_d \SS^c_{b,n+m}(w)\right)\nn\\
& -  \frac {1}{(z-w)^{2}}  
 \nord{ 
      Y\left(\frac{\del P^{a,n}}{\del \upgamma^{b,m}[0]} w_0,z\right)
      Y\left(\frac{\del Q^{b,m}}{\del \upgamma^{a,n}[0]} w_0,w\right)
}. \nn
\end{align}
All but the final line are modes of states in $\jmath(\Dg)$ and involve only single contractions, and we recognise the terms as correctly reproducing the Lie bracket in $\Dg$. 
\end{proof}

The final line in \cref{ABope} involves a double contraction, and defines the extension of $L\Dg$ by $\L(\Og \oplus \Omega_\Og)$ in \cref{LDextlem}. Namely, we see that
\be [A\fm K, B\fm L ] = [A,B]\fm{K+L} + \omega(A\fm K,B\fm L),\nn\ee
with
\begin{subequations}\label{omegadef}
\begin{multline} \omega(A\fm K,B\fm L) \\:=  -K  \left(\frac{\del P^{a,n}}{\del \upgamma^{b,m}[0]} 
                 \frac{\del Q^{b,m}}{\del \upgamma^{a,n}[0]} w_0\right)\fm{K+L-1}
 - \left(\left[T,\frac{\del P^{a,n}}{\del \upgamma^{b,m}[0]}\right] 
                 \frac{\del Q^{b,m}}{\del \upgamma^{a,n}[0]} w_0\right)\fm{K+L}
\end{multline}
where we continue to employ summation convention over repeated indices.
Let us stress that these implicit sums on $b,m$ and $a,n$ have only finitely many nonzero terms, by virtue of our definition of $\Mfw$; cf. \cref{Mwcond}. 

The formula above defines $\omega$ on the subalgebra $L\!\left(\gl(\oc\g)\ox \CC[t,t^{-1}]\right)\subset L\Dg$. When one of the arguments to $\omega$ is a mode $\mathsf D\fm K$ of $\mathsf D$, there are obviously no double contractions, so 
\be \omega(\mathsf D\fm K,\cdot) = 0.\ee
\end{subequations}

This map $\omega$ defines a cocycle 
\be [\omega] \in H^2( L\Dg, \L(\Og \oplus \Omega_\Og)) \nn\ee 
in the usual Chevalley-Eilenberg cohomology of $L\Dg$ with coefficients in $\L(\Og \oplus \Omega_\Og)$. 
(It is easy to see that this cocycle is non-trivial, as in the case of ${\mathfrak g}$ of finite type in \cite[\S5.5.3]{Fre07}, so the sequence in \cref{LDextlem} does not split.)  


\subsection{Main result}\label{sec: mr} 
The homomorphism $\bm\rho: {\mathfrak g} \to \Dg$ gives rise to a homomorphism of the corresponding loop algebras
\be \widetilde\bm\rho : L{\mathfrak g} \to L\Dg,\label{vfdhatdef}\ee
given by
\be{}\qquad\qquad\qquad \widetilde\bm\rho( A[N] ) :=  \bm\rho(A)[N], \qquad A\in {\mathfrak g}, N\in {\mathbb Z} .\nn\ee
Pulling back the cocycle $\omega \in H^2( L\Dg, \L(\Og \oplus \Omega_\Og))$ from \cref{omegadef} by this homomorphism $\widetilde\bm\rho$, we obtain a cocycle
\be \widetilde\bm\rho^*(\omega) \in  H^2( L{\mathfrak g}, \L(\Og \oplus \Omega_\Og)) \label{pbo}\ee
of $L{\mathfrak g}$ with coefficients in $\L(\Og \oplus \Omega_\Og)$. 
It defines an extension $\widetilde{L{\mathfrak g}}$ of $L{\mathfrak g}$ by $\L(\Og \oplus \Omega_\Og)$,
\be 0 \to \L(\Og \oplus \Omega_\Og) \to \widetilde{L{\mathfrak g}} \to L{\mathfrak g} \to 0.\nn\ee

We can now state the main result of this paper. 
\begin{thm}\label{mainthm}
The cocycle $\widetilde\bm\rho^*(\omega)$ is trivial, so this sequence splits. 

Specifically, there is a linear map
\be \bm\phi:{\mathfrak g} \to \Omega_{\O}\nn\ee
of $Q$-grade 0 and obeying
\be \bm\phi(\h) = 0,\quad \bm\phi(\nmp) \subset \Omega_{\O(\n_\pm)} \quad\text{and}\quad \bm\phi \circ \sigma = \tau \circ \bm\phi,\nn\ee
such that the map
$\jmath\circ\bm\rho + \bm\phi : {\mathfrak g} \to \jmath(\D) \oplus \Omega_{\O} \cong \Mfw[1]$
gives rise to a homomorphism of Lie algebras,
\begin{align} L{\mathfrak g} &\to \L(\Mfw\df 1);\nn\\
{}\qquad\qquad\qquad A\fm N &\mapsto \bigl((\jmath \circ\bm\rho + \bm\phi)(A)\bigr)\fm N, \qquad A\in {\mathfrak g},N\in {\mathbb Z}. \nn
\end{align}
\end{thm}
\begin{proof}
The proof occupies \cref{sec: proof} below.
\end{proof}



To state this result in a more concrete form, we note the map $\bm\phi$ is given by 
\be J_{a,n} \mapsto \sum_{(b,m)\in \mathcal I \times \ZZ} Q_{a,n;b,m}(X) \del X^{b,m} \nn\ee
(and $\mathsf k \mapsto 0;\mathsf d\mapsto 0$) for certain polynomials $Q_{a,n;b,m}(X) \in {\O}$.
We introduce also the generating series of the generators of $L{\mathfrak g}$, 
\be \mathsf k(z) := \sum_N\mathsf k\fm N z^{-N-1},\quad \mathsf d(z) := \sum_N\mathsf d\fm N z^{-N-1},
\quad J_{a,n}(z) := \sum_N J_{a,n}\fm N z^{-N-1}, \nn\ee
and let $\jmath(\mathsf J_{a,n})(z) = \sum_{N\in {\mathbb Z}} \jmath(\mathsf J_{a,n})[N] z^{-N-1}$ with $\mathsf J_{a,n}$ as in \cref{Jdef}. 
Recall the polynomials $R_{a,n}^{b,m}(X)\in {\O}$ from \cref{Rdef}.

\begin{thm}\label{homcor}
There is a homomorphism of ${\mathbb Z}\times Q$-graded Lie algebras  
\be L{\mathfrak g} \to \L(\Mfw\df 1)\nn\ee 
given by
\begin{align} 
\mathsf k(z) &\mapsto 0\nn\\
\mathsf d(z) & \mapsto \jmath(\mathsf D)(z)\nn\\
J_{a,n}(z) &\mapsto \jmath(\mathsf J_{a,n})(z) +  \sum_{(b,m)\in \mathcal I \times \ZZ} Y(R_{a,n}^{b,m}(\upgamma[0]) \upbeta_{b,m}[-1] w_0,z) \nn\\ 
          & \qquad    \qquad  \qquad   + \sum_{(b,m)\in \mathcal I \times \ZZ} Y(Q_{a,n; b,m}(\upgamma[0]) \upgamma^{b,m}[-1]w_0,z) .\nn
\end{align}
Equivalently, there is a homomorphism of ${\mathbb Z}_{\geq 0}\times Q$-graded vertex algebras 
\be \theta: {\mathbb V}_0^{{\mathfrak g},0} \to \Mfw \nn\ee
given by
\begin{align} 
\mathsf k\fm{-1}w_0 &\mapsto 0\nn\\
\mathsf d\fm{-1}w_0 & \mapsto \jmath(\mathsf D)\fm{-1}w_0\nn\\
J_{a,n}\fm{-1}w_0 &\mapsto \jmath(\mathsf J_{a,n})\fm{-1}w_0 +  \sum_{(b,m)\in \mathcal I \times \ZZ} R_{a,n}^{b,m}(\upgamma[0]) \upbeta_{b,m}[-1]w_0  \nn\\ 
          & \qquad    \qquad  \qquad   + \sum_{(b,m)\in \mathcal I \times \ZZ} Q_{a,n; b,m}(\upgamma[0]) \upgamma^{b,m}[-1]w_0 .\nn
\end{align}
\end{thm}
\begin{proof}
The first part is a restatement of \cref{mainthm} in more concrete terms. 
For the equivalence of the statement about vertex algebras, see \cite[\S6.1]{Fre07}.
\end{proof}

Let us give the form of the homomorphism on the Chevalley-Serre generators of ${\mathfrak g}$. 
We write $\upgamma^{e_i} = \upgamma^{\alpha_i,0}$ for $i\in \mathring I$ and $\upgamma^{e_0} = \upgamma^{-\delta+\alpha_0,1}$, cf. \cref{highestrootdef}, and so on.

\begin{prop}\label{CScor}
The homomorphism $\theta: {\mathbb V}_0^{{\mathfrak g},0} \to \Mfw$ from \cref{homcor} is given by
\begin{align}
e_i\fm{-1}w_0 &\mapsto \jmath(\bm\rho(e_i))  
                          + c_i \upgamma^{f_i}\fm{-1}w_0 \nn\\
h\fm{-1}w_0 &\mapsto \jmath(\bm\rho(h)) \nn\\
f_i\fm{-1}w_0 & \mapsto \jmath(\bm\rho(f_i)) + c_i \upgamma^{e_i}\fm{-1}w_0 \nn  
\end{align}
for $i\in I$ and $h\in \h$, where 
\begin{align}
c_i &:=  -2  + \sum_{\substack{j\in I\\ j\prec i}} a_{ij}, \qquad i\in I.\nn
\end{align}
\end{prop}
\begin{proof} On ${\mathbb Z}_{\geq 1} \times Q$-grading grounds, the homomorphism must be of this form for some values of coefficients $c_i$. We compute these values in \cref{sec: cis}.
\end{proof}

\subsection{Action of $L_+{\mathfrak g}$ on $\mathsf M(\np)$}\label{sec: Lpgact}
The vertex algebra $\mathsf M= \mathsf M({\mathfrak g})$ was the vacuum Fock module of the $\upbeta\upgamma$-system associated to the vector space ${\mathfrak g}$. In exactly the same way, one defines $\mathsf M(\npm)$, with
\be \mathsf M(\npm) \cong_{\mathbb C} {\mathbb C}\!\left[ \upgamma^{\ia a n}[N]\right]_{N \leq 0; \ii a n \in \pm\mathsf A} \otimes {\mathbb C}\!\left[\upbeta_{\ia a n}[N-1] \right]_{N \leq 0; \ii a n \in \pm\mathsf A} \nn\ee
as vector spaces. 
These $\mathsf M(\npm)$ are vertex subalgebras of $\mathsf M$. 

We have the subalgebra $\L_{\geq 0}(\Mfw(\df 1)$ of non-negative modes of states in $\Mfw\df 1$, as in \cref{sec: loc lie}. 
For all $A\in \Mfw\df 1$ and $B\in \mathsf M$, $A\vap N B\in \mathsf M$ for all $N\geq 0$. 
Therefore $\L_{\geq 0}(\Mfw\df1)$ acts on $\mathsf M$, via
\be A\fm N v := A\vap N v\nn\ee 
for $A\in \Mfw\df1$, $N\geq 0$ and $v\in \mathsf M$.
The Lie algebra homomorphism $L{\mathfrak g} \to \L(\Mfw\df 1)$ of \cref{mainthm} restricts to a homomorphism $L_+{\mathfrak g} \to \L_{\geq 0}(\Mfw(\df 1)$ from the half-loop algebra 
\be L_+{\mathfrak g} := {\mathfrak g} \otimes {\mathbb C}[[t]]. \nn\ee 
In this way, $L_+{\mathfrak g}$ acts on $\mathsf M$. The following is analogous to \cref{stabprop}. 
\begin{prop}\label{Lpgstab} This action of $L_+{\mathfrak g}$ stabilizes $\mathsf M(\np)$ and $\mathsf M(\nm)$. 
That is, for all $A\in {\mathfrak g}$, $N\geq 0$, and $v\in \mathsf M(\npm)$,
\be \theta(A\fm{-1}w_0)\vap N\, v \in \mathsf M(\npm).\nn\ee
\end{prop}
\begin{proof} Let $N\geq 0$. Suppose without loss that $A=J_{a,n}$. (The result is clear for $A=\mathsf d$ and trivial for $A=\mathsf k$.)

The conditions on $\bm\phi$ given in \cref{mainthm} imply that $\bm\phi(J_{a,n})\vap N$ stabilizes the subspace $M(\npm)$, and annihilates $M(\nmp)$, whenever $J_{a,n} \in \nmp$. And $\bm\phi(\h) = 0$. Hence $\bm\phi(J_{a,n})\vap N$ stabilizes both $M(\npm)$.

The same applies to all terms in $\jmath(\bm\rho(J_{a,n}))$ cubic or higher in the generators $\upbeta$, $\upgamma$. (Recall that these terms are either in $\jmath(\Dw)$ or in $\jmath(\ol{\Der}\,{\O(\nm)})$.)

The term $\jmath(\mathsf J_{a,n})\vap N$ in  $\jmath(\bm\rho(J_{a,n}))\vap N$ stabilizes $\mathsf M(\npm)$ if $a\in \mathring I$ and $n=0$, i.e. if $J_{a,n}\in \h$. Otherwise it does not, but by our construction there is then also a sum of compensating quadratic terms in $\jmath(\bm\rho(J_{a,n}))\vap N$, of the form $\upgamma^{b,m}\vap M\upbeta_{c,p}\vap{N-M}$ with $\{(b,m),(c,p)\} \not\subset \pm\mathsf A$. The latter condition ensures the double contractions between such quadratic terms and states in $\mathsf M(\npm)$ vanish. The single contractions of such compensating quadratic terms ensure that $\mathsf M(\npm)$ is stabilized, just as in \cref{stabprop} and the discussion following. 
\end{proof}


\subsection{Homomorphism to $\Mfw \otimes \pi_0$}\label{sec: pi0}
We have the loop algebra $L\h := \h \otimes {\mathbb C}((t))$ of the Cartan subalgebra $\h\subset {\mathfrak g}$. 
Let $\{b_i\}_{i=1,\dots,\dim\h} = \{H_i\}_{i\in \mathring I} \sqcup\{\mathsf k,\mathsf d\}$ denote a copy of our basis of $\h$
and let $\{b^i\}_{i=1}^{\dim\h}\subset \h$ be its dual basis with respect to the form $\bilin\cdot\cdot$:
\be \bilin{b_i}{b^j} = \delta_i^j .\nn\ee
Then $L\h$ has basis $\{b_i\fm N\}_{i=1,dots,\dim\h;N\in {\mathbb Z}}$. 
Let $\pi_0$ denote the $L\h$-module 
\be \pi_0 := U(L\h) \otimes_{U(\h\otimes {\mathbb C}[[t]])} {\mathbb C} w_0 \nn\ee
induced from the trivial one-dimensional $\h\otimes {\mathbb C}[[t]]$-module ${\mathbb C} w_0$.
There is a linear isomorphism $\pi_0 \cong {\mathbb C}[b_{i,n}]_{i=1,\dots,\dim\h; n<0}$ of 
of vector spaces, and of modules over $U(t^{-1}\h[t^{-1}])\cong {\mathbb C}[b_{i,n}]_{i=1,\dots,\dim\h; n<0}$.

The space $\pi_0$ is a commutative vertex algebra, the state-field map being given by
\be b_i(x) := Y(b_i\fm{-1}w_0,x) =  \sum_{N\in {\mathbb Z}} b_i[N] x^{-N-1},\nn\ee
cf. \cref{sec: vas}. (Like $\mathsf M$, it is a system of free fields.)
It has the depth gradation, in which $b_i\fm N$ contributes grade $-N$, and it inherits the $Q$-gradation from $\h$. 


We continue to write $\upgamma^{e_i} = \upgamma^{\alpha_i,0}$ for $i\in \mathring I$ and $\upgamma^{e_0} = \upgamma^{-\delta+\alpha_0,1}$, etc.


We have the tensor product of vertex algebras $\Mfw \otimes \pi_0$, which is again ${\mathbb Z}_{\geq 0}\times Q$-graded. 

\begin{thm}\label{bthm}
There exists a ${\mathbb Z}_{\geq 0} \otimes Q$-graded homomorphism of vertex algebras
\be w : {\mathbb V}_0^{{\mathfrak g},0} \to \Mfw \otimes \pi_0 \nn\ee
given by
\begin{align}
e_i\fm{-1}w_0 &\mapsto \jmath(\bm\rho(e_i)) 
                          + c_i \upgamma^{f_i}\fm{-1}w_0 + \left< b^j,\check\alpha_i\right>\upgamma^{f_i}\fm0  b_j\fm{-1}w_0\nn\\
h\fm{-1}w_0 &\mapsto \jmath(\bm\rho(h)) + \left< b^i,h\right> b_i\fm{-1}w_0\nn\\
f_i\fm{-1}w_0 & \mapsto \jmath(\bm\rho(f_i)) + c_i \upgamma^{e_i}\fm{-1}w_0
                      + \left< b^j,\check\alpha_i\right> \upgamma^{e_i}\fm0  b_j\fm{-1}w_0   \nn  
\end{align}
for $i\in I$ and $h\in \h$. 
\end{thm}
\begin{proof}
The proof is given in \cref{sec: proofb}.
\end{proof}
Equivalently, there is a ${\mathbb Z}\times Q$-graded homomorphism of Lie algebras
\be L{\mathfrak g} \to \L(\Mfw \otimes \pi_0) \nn\ee
given by
\begin{align}
e_i(z) &\mapsto \jmath(\bm\rho(e_i))(z) 
                 + c_i \del_z\upgamma^{f_i}(z) + \left< b^j,\check\alpha_i\right> \upgamma^{f_i}(z)  b_j(z)\nn\\
h(z) &\mapsto \jmath(\bm\rho(h))(z) + \left< b^i,h\right> b_i(z) \nn\\
f_i(z) & \mapsto \jmath(\bm\rho(f_i))(z) + c_i \del_z\upgamma^{e_i}(z)
                      + \left< b^j,\check\alpha_i\right> \upgamma^{e_i}(z) b_j(z) \nn  
\end{align}
for $i\in I$ and $h\in \h$. 

\subsection{On zero modes}\label{sec: zeromodes}
We have the homomorphism of Lie algebras $\rho:{\mathfrak g} \to \Derc{\O_{\np}}$
from \cref{vfdef}, and the embedding $i:\Derc{\O_{\np}}\hookrightarrow \widetilde\mathsf M(\np) \subset \widetilde\mathsf M$
given by 
\be \sum_{\ii an \in \mathsf A} P^{a,n}(X) D_{a,n} \mapsto \sum_{\ii an\in \mathsf A} P^{a,n}(\upgamma\fm0) \upbeta_{a,n}\fm{-1}w_0, \nn\ee
where $P^{a,n}(X) \in {\O_{\np}}$ for each $(a,n) \in \mathsf A$. 
Let $\phi:{\mathfrak g} \to \Omega_{{\O_{\np}}}$ be the linear map defined by 
\be \phi(x) = \begin{cases} 0 & x\in \b_+\\
                           \bm\phi(x) & x\in \nm 
                         \end{cases}
\nn\ee
where $\bm\phi: {\mathfrak g} \to \Omega_{\O}$ was the splitting map from \cref{mainthm}. We continue to identify $\Omega_{\O_{\np}}$ with a subspace of $\mathsf M(\np)\subset\widetilde\mathsf M(\np)$ (with $f(X) dX^{a,n} \mapsto f(\upgamma\fm0) \upgamma^{a,n}\fm{-1}w_0$).
We get a linear map
\be \vartheta = i\circ\rho + \phi : {\mathfrak g} \cong {\mathbb V}_0^{{\mathfrak g},0}[1] \to \widetilde\mathsf M(\np)[1].\nn\ee
(The kernel is the centre ${\mathbb C}\mathsf k\subset{\mathfrak g}$; if one wanted an embedding, one could introduce a tensor factor $\pi_0$ as in \cref{sec: pi0}.)

The would-be non-negative vertex algebra products $\vartheta(x)\vap N \vartheta(y)$, $x,y\in {\mathfrak g}$, $N\geq 0$, of states in the image of this map are generically ill-defined, i.e. divergent, sums (as we saw in the examples in \cref{sec: zeta}). Thus, we don't get a direct analog in affine types of usual Feigin-Frenkel free-field realization ${\mathbb V}_0^{{\mathfrak g},-h^\vee} \to \mathsf M(\np)$ in finite types. Nonetheless, we do have the following. 

\begin{thm}\label{zeromodethm}
The vertex algebra $0$th product $\vap 0 :\mathsf M(\np)\times \mathsf M(\np) \to \mathsf M(\np)$ extends to a well-defined product 
\be \vap 0 : \vartheta({\mathfrak g}) \times \vartheta({\mathfrak g}) \to \vartheta({\mathfrak g})\nn\ee 
on the image $\vartheta({\mathfrak g})\subset \widetilde\mathsf M(\np)[1]$ of ${\mathfrak g}$ in $\widetilde\mathsf M(\np)$. 

Moreover, we have
\be \vartheta(x) \vap 0 \vartheta(y) = \vartheta([x,y]) \nn\ee
for all $x,y\in {\mathfrak g}$. 
\end{thm}
\begin{proof} Let $x,y\in {\mathfrak g}$. 
We first want to show that $\vartheta(x) \vap 0 \vartheta(y)$ is well-defined. 

Calculating as in the proof of \cref{jotalem}, one sees that for any two $X,Y\in \Der{\O_{\np}}$, we have 
\be i(X)\vap 0 i(Y) = i([X,Y]) + \dd X Y \label{zeroprod}\ee
where we define a (${\mathbb C}$-)bilinear map $\dd\cdot\cdot:\Der{\O_{\np}}\times \Der{\O_{\np}} \to \Omega_{{\O_{\np}}}$ by 
\begin{align}
    \dd{ \sum_{\ii a n \in \mathsf A} P^{\ia a n}(X) D_{\ia a n} }  
       { \sum_{\ii b m \in \mathsf A} Q^{\ia b m}(X) D_{\ia b m} } \nn\\
 := - \sum_{\ii a n,\ii b m \in \mathsf A} \bigl( \del D_{\ia b m} P^{\ia a n}(X)\bigr) 
                                   \bigl(D_{\ia a n} Q^{\ia b m}(X)\bigr).
\end{align}
Now, $\dd\cdot\cdot$ does not extend to a well-defined bilinear form on $\Derc{\O_{\np}}\times\Derc{\O_{\np}}$: for example if $v=  
\sum_{n\in \ZZ_{\geq 1}} X^{\ia a n} D_{\ia a n}$ for some fixed $a\in \mathcal I$, then 
$- \dd {X^{\ia c 1} v} v  = 
 \Bigl( 1 + \sum_{m\in \ZZ_{\geq 1}} 1\Bigr)  \del X^{c,1}
$
is ill-defined. But we can define a Lie subalgebra large enough to contain the image of ${\mathfrak g}$ and small enough that $\dd\cdot\cdot$ remains well-defined, as follows. First let us define a Lie subalgebra $\Dl\subset \Derc{\O_{\np}}$, by stipulating that   
$\sum_{\ii a n \in \mathsf A} P^{\ia a n} (X) D_{\ia a n}$ belongs to $\Dl$ if, for some $K\in \ZZ_{\geq 1}$,  
\be P^{\ia a n}(X) \in \bigoplus_{\substack{\ii b m \in \mathsf A \\ n+K \geq m \geq n- K}} {\mathbb C} X^{\ia b m} \nn\ee
for each $\ii a n \in \mathsf A$. One checks that $\Dw\rtimes \Dl$ is a Lie subalgebra of $\Derc{\O_{\np}}$. According to \cref{linthm}, the image $\rho(x)$ of $x$ belongs to this subalgebra:
\be \rho(x) \in \Dw \rtimes \Dl .\nn\ee 

\begin{lem}\label{ddprop} 
$\dd\cdot\cdot$ extends to a well-defined ${\mathbb C}$-bilinear map
\be \dd\cdot\cdot :\left(\Dw \rtimes \Dl\right) \times \left(\Dw \rtimes \Dl\right) \to \Omega_{\O_{\np}},\nn\ee 
with the property that $ \dd\Dl\cdot  = 0$. 
\end{lem}
\begin{proof}[Proof of \cref{ddprop}]
$\dd\cdot\cdot$ vanishes, summand by summand, whenever its first argument is linear in the generators $\{X^{\ia a n}\}_{\ii a n\in \mathsf A}$, since $\del (D_{\ia a n} X^{\ia b m}) =0$ for all $\ii a n, \ii b m \in \mathsf A$. 
So by linearity it is enough to consider the case when the first argument, $ \sum_{\ii a n \in \mathsf A} P^{\ia a n}(X) D_{\ia a n} $ belongs to $\Dw$, i.e. has widening gap. 
The second argument has bounded grade, so there is some $M$ such that $D_{\ia a n} Q^{\ia b m}(X) =0$ for all $n,m$ such that $n-m \geq M$. 
By the assumption of widening gap, there is some $N$ (depending on $M$) such that, for all $n>N$, $D_{\ia b m}P^{\ia a n}(x)=0$ whenever $n-m < M$.
So at most the first $N$ terms in the sum on $n$ can be nonzero:
\begin{align}  \sum_{\ii a n,\ii b m \in \mathsf A} \bigl(\del D_{\ia b m} P^{\ia a n}(X)\bigr) 
                                  \bigl(D_{\ia a n} Q^{\ia b m}(X)\bigr) \nn\\
= \sum_{\substack{\ii a n,\ii b m \in \mathsf A \\ n\leq N}} \bigl(\del D_{\ia b m} P^{\ia a n}(X)\bigr) 
                                  \bigl(D_{\ia a n} Q^{\ia b m}(X)\bigr),\nn
\end{align}
and then for each $n$ the sum on $m$ is also finite, since $P^{\ia a n}(X)$ is a polynomial. 
\end{proof}

At this stage, we have shown that \cref{zeroprod} holds for all $X,Y\in \Dw \rtimes \Dl$. In particular, it holds for the images $\rho(x),\rho(y)$ of $x,y\in{\mathfrak g}$:
\be  i(\rho(x))\vap 0i(\rho(y)) = i(\rho([x,y])) + \dd{\rho(x)}{\rho(y)}. \nn\ee
It follows that $\vartheta(x) \vap 0 \vartheta(y)$ is well-defined. (There are no possible double contractions, and hence no possible divergences, of the products between the subspaces $\Omega_{{\O_{\np}}}$ and $i(\Derc{\O_{\np}})$ of $\widetilde\mathsf M(\np)$.) 

The ``moreover'' part is then essentially a corollary of \cref{mainthm}. Consider the linear map $\pi:\Mfw[1] \to \widetilde\mathsf M[1]$ which acts as the identity on $\Mw[1]\subset \Mfw[1]$ and sends $\SS^a_{b,n}\fm{-1}w_0 \to \sum_{m\in {\mathbb Z}} \upgamma^{a,m}\fm 0 \upbeta_{b,m+n}\fm{-1}w_0$ and $\mathsf D \to \sum_{(a,m)\in \mathcal I \times \ZZ} m\upgamma^{a,m}\fm 0 \upbeta_{a,m}\fm{-1}w_0$. By construction, for any $x\in {\mathfrak g}$, $\pi(\theta(x\fm{-1}w_0)) = \vartheta(x) + \tau(\vartheta(\sigma(x)))$, where $\vartheta(x) \in \widetilde\mathsf M(\np)[1]$ and $\tau(\vartheta(\sigma(x))) \in \widetilde\mathsf M(\nm)[1]$. (See \cref{Jdif} and the discussion following.) Thus
\be \pi(\theta(x\fm{-1}w_0))\vap 0 \pi(\theta(y\fm{-1}w_0)) = \vartheta(x)\vap 0 \vartheta(y) + \tau(\vartheta(\sigma(x)))\vap0\tau(\vartheta(\sigma(y)))\label{pit1}\ee
for all $x,y\in {\mathfrak g}$. At the same time, for any $X,Y\in \Mfw[1]$, we check that $\pi(X)\vap 0 \pi(Y)$ is well-defined and equal to $\pi(X\vap 0 Y)$. Thus
\begin{align} \pi\bigl(\theta(x\fm{-1}w_0)\bigr)\vap 0 \pi\bigl(\theta(y\fm{-1}w_0)\bigr) 
&= \pi\bigl(\theta(x\fm{-1}w_0)\vap 0 \theta(y\fm{-1}w_0)\bigr)\nn\\
&= \pi(\theta([x,y]\fm{-1}w_0))\nn\\
&= \vartheta([x,y]) + \tau(\vartheta(\sigma([x,y])))\label{pit2}.
\end{align}
On comparing \cref{pit1} and \cref{pit2}, and projecting onto the summand $\widetilde\mathsf M(\np)[1]$ of $\widetilde\mathsf M(\np)[1]\oplus\widetilde\mathsf M(\nm)[1]$, we have the result.
\end{proof}
\begin{cor} There is a well-defined Lie algebra $\L_0(\vartheta({\mathfrak g}))$ of the formal 0-modes of states in the image of $\vartheta$, and the map 
\be {\mathfrak g}\to \L_0(\vartheta({\mathfrak g}));\qquad x \mapsto \vartheta(x)\fm 0 \nn\ee
is a homomorphism of Lie algebras.
\qed\end{cor}
\begin{proof}
This follows from the theorem since, when the Lie bracket formula \cref{comf} for formal modes is specialized to the Lie bracket of formal \emph{zero} modes, only the $0$th product contributes: $[A\fm 0,B\fm 0] = (A\vap 0 B)\fm 0$. 
\end{proof}

\section{Proof of \cref{mainthm}}\label{sec: proof}
In \cref{pbo} we obtained a cocycle $\widetilde\bm\rho^*(\omega) \in  H^2( L{\mathfrak g}, \L(\Og \oplus \Omega_\Og))$.
In fact, we can be rather more precise: recall $\bm\rho(\mathsf k) =0$, $\bm\rho(\mathsf d) = \mathsf D$, and $\omega(\mathsf D\fm N,\cdot) =0$. So we have actually defined a $\L(\Og \oplus \Omega_\Og)$-valued $2$-cocycle on the double-loop algebra 
\be L\!L\oc\g := L(\oc\g[t,t^{-1}]) := \mathring {\mathfrak g}[t,t^{-1}] \otimes{\mathbb C}((s)).\nn\ee 
Our goal is to show that this cocycle is trivial. 

We shall follow closely the strategy of proof due to Feigin and Frenkel \cite{FF1990}, and specifically the treatment in  \cite[\S5.6]{Fre07}, \cite{Frenkel_2005}; cf. also \cite{FeiginBRST,FFGD}. 
The subspace $\Og \oplus \Omega_\Og\subset \Mfw$ is contained in the larger subspace 
\be \mathsf M_0 := {\mathbb C}[\upgamma^{a,n}[-N]]_{a\in \mathcal I, n\in {\mathbb Z}, N\in {\mathbb Z}_{\geq 0}} w_0 \subset \Mfw .\nn\ee
This subspace is a commutative vertex algebra. It is also an ideal for the action of $\Mfw\df1$ in the same sense as in \cref{Midlem}: $A\vap M B \in \mathsf M_0$ for all $A\in \mathsf M_0$, $B\in \Mfw\df 1$ and $M\geq 0$. It follows that
\be \widetilde\bm\rho^*(\omega) \in  H^2( L\!L\oc\g, \L(\mathsf M_0)) ,\nn\ee
and it is convenient to show our cocycle is zero in the latter space. 

To do so, we first show that the cocycle $\widetilde\bm\rho^*(\omega)$ actually belongs to the \emph{local} subcomplex of this CE complex. Let us define this local complex. 

\subsection{$\mathsf b\mathsf c$-system}
Let $\mathsf{Cl}$ denote the Clifford algebra with generators 
\be \mathsf b_{a,n}[N],\quad \mathsf c^{a,n}[N], \nn\ee
with $N\in {\mathbb Z}$ and $\ii a n \in \mathcal I \times \ZZ$, and anticommutation relations 
\be [\mathsf b_{\ia a n}[N],\mathsf b_{\ia b m}[M]]_+ = 0,\quad 
[\mathsf b_{\ia a n}[N],\mathsf c^{\ia b m}[M]]_+ = \delta_{\ia a n}^{\ia b m} \delta_{N,-M} 1,\quad 
[\mathsf c^{\ia a n}[N],\mathsf c^{\ia b m}[M]]_+ = 0,\nn\ee
where we write $[X,Y]_+ := XY + YX$ for the anticommutator. 

Define $\Lambda$ to be the induced $\mathsf{Cl}$-module generated by a vector $w_0$ such that
\be \mathsf b_{\ia a n}[M]w_0 = 0,\quad M\in {\mathbb Z}_{\geq 0}, \qquad 
    \mathsf c^{\ia a n}[M]w_0 = 0,\quad M\in {\mathbb Z}_{\geq 1}. \label{Wdef}\ee
for all ${\ii a n}\in \mathcal I \times \ZZ$. It is ${\mathbb Z}\times Q$-graded just as is $\mathsf M$, cf. \cref{sec: vas}. 

$\mathsf{Cl}$ is a superalgebra (with all generators $\mathsf b$, $\mathsf c$ of odd degree) and its module $\Lambda$ is a vector superspace.
$\Lambda$ is moreover a vertex superalgebra (for the definition of which see e.g. \cite{KacVertexAlgBook,FrenkelBenZvi}). The state-field map $Y(\cdot,x): \Lambda \to  \mathrm{Hom}\left(\Lambda, \Lambda((x))\right)$
is defined as follows. First,  
\begin{alignat}{2}
\mathsf b_{\ia a n}(x) &:= Y\left(\mathsf b_{\ia a n}[-1] w_0,x\right) 
                   &&= \sum_{N\in {\mathbb Z}} \mathsf b_{\ia a n}[N] x^{-N-1},\nn\\
\mathsf c^{\ia a n}(x) &:= Y\left(\mathsf c^{\ia a n}[0] w_0,x\right) 
                   &&= \sum_{N\in {\mathbb Z}} \mathsf c^{\ia a n}[N] x^{-N} ,\nn
\end{alignat}
and then in general if
\be A = \mathsf c^{\ia{a_1}{n_1}}[-N_1]\dots \mathsf c^{\ia{a_r}{n_r}}[-N_r] 
                \mathsf b_{\ia{b_1}{m_1}}[-M_1]\dots \mathsf b_{\ia{b_s}{m_s}}[-M_s] w_0, \label{wonstate}\ee 
then
\begin{multline} A(u) := Y(A,u) =\nord{\mathsf c^{\ia{a_1}{n_1} (N_1)}(u) \dots \mathsf c^{\ia{a_r}{n_r} (N_r)}(u) 
               \mathsf b_{\ia{b_1}{m_1}}^{(M_1-1)}(u)\dots \mathsf b_{\ia{b_s}{m_s}}^{(M_s-1)}(u)}.
\label{WAu}
\end{multline}
The normal-ordering here is defined just as in \cref{sec: vas} only with the addition of signs to allow for the superspace ${\mathbb Z}/2{\mathbb Z}$-grading: we have
\be \nord{Y(A,u) Y(B,v)} \,\,\, := \Biggl(\sum_{M<0} A\vap M u^{-M-1} \Biggr)Y(B,v) + (-1)^{p(A)p(B)} Y(B,v) \Biggl(\sum_{M\geq 0} A\vap M u^{-M-1}\Biggr).\label{supernord}\ee  
whenever $A$ and $B$ are in grades $p(A)$ and $p(B)$ respectively. 

We have the \emph{(super)translation operator} $T\in \End\Lambda$ of the vertex superalgebra $\Lambda$, defined by $TA := A\vap{-2}w_0$. It acts on monomials in the generators of $\mathsf{Cl}$ as a superderivation, according to
\be \left[T, \mathsf b_{a,n}[-N]\right]_+ = -N \mathsf b_{a,n}[N-1] ,\qquad \left[T, \mathsf c^{a,n}[-N]\right]_+ = -(N-1)\mathsf c^{a,n}[N-1], \nn\ee
and we have $Tw_0 = 0$. 


For each $r\geq 0$, let $\Lambda_0^r$ denote the subspace of $\Lambda$ spanned by states of the form 
\be \mathsf c^{a_1,n_1}[-N_1] \dots \mathsf c^{a_r,n_r}[-N_r]w_0, \nn\ee
with $a_1,\dots,a_r\in \mathcal I$, $n_1,\dots,n_r\in {\mathbb Z}$, $N_1,\dots,N_r\in {\mathbb Z}_{\geq 0}$.
The sum, $\Lambda_0 := \bigoplus_{r=0}^\8 \Lambda_0^r$ is a supercommutative vertex superalgebra.


\subsection{Chevalley-Eilenberg cochains for $L_{\!+}L\oc\g$ with coefficients in $\mathsf M_0$}\label{sec: CE}
Let $L_{\!+}L\oc\g$ denote the Lie algebra
\be L_{\!+}L\oc\g := \oc\g[t,t^{-1}] \otimes {\mathbb C}[[s]] .\nn\ee
It is a topological Lie algebra, with the the linear topology coming from the ${\mathbb Z}_{\geq 0}$-grading (i.e. the linear topology in which $\oc\g[t,t^{-1}] \otimes s^N{\mathbb C}[[s]]$, $N\in {\mathbb Z}_{\geq 0}$, are a base of the open neighbourhoods of $0$). 

The space $\mathsf M_0$ is a module over $L_{\!+}L\oc\g$.
Indeed, let us write $\mathbb J_{a,n} := \jmath(\bm\rho(J_{a,n})) \in \Mfw$, that is
\be \mathbb J_{a,n} =   \sum_{(b,m)\in \mathcal I \times \ZZ} R_{a,n}^{b,m}(\upgamma[0]) \upbeta_{b,m}[-1]w_0 + \sum_{(b,c)\in \mathcal I} f_{ba}{}^c \SS^b_{c,n}[-1]w_0,\nn\ee
where we recall the definition \cref{Rdef} of the polynomials $R^{b,m}_{a,n}$ and the definition \cref{jotadef} of the injective map $\jmath$. 
From \cref{jotalem} and the fact that  $\bm\rho:{\mathfrak g} \to \Dg$ is a homomorphism of Lie algebras, it follows that
\begin{align}
    \mathbb J_{a,n} \vap 0 \mathbb J_{b,m} &\equiv f_{ab}{}^c \mathbb J_{c,n+m} \mod \Omega_{\O},\nn\\
    \mathbb J_{a,n} \vap 1 \mathbb J_{b,m} &\equiv 0  \mod {\O}. \label{jopes}
\end{align}
The mode $\mathbb J_{a,n}\vap N$ restricts to a linear map $\mathsf M_0\to \mathsf M_0$ for all non-negative $N$, as in \cref{Midlem}(iii). 
This defines an action of $L_{\!+}L\oc\g$ because, in view the commutator formula \cref{com Am Bn} and \cref{jopes}, we have
\be [\mathbb J_{a,n}\vap N, \mathbb J_{b,m}\vap M] = f_{ab}{}^c \mathbb J_{c,n+m}\vap{N+M} \mod \L(\mathsf M_0), \qquad N,M\geq 0,
\nn\ee
(and equality modulo $\L(\mathsf M_0)$ is enough, cf. \cref{Midlem}(ii)).

As an $L_{\!+}L\oc\g$-module, $\mathsf M_0$ is smooth, which is to say that for all $v\in \mathsf M_0$ and all $a\in {\mathfrak g}$, $a\fm N v =0$ for all sufficiently large $N$. In other words the action is continuous, when we endow $\mathsf M_0$ with the discrete topology. 

We have the $r$th exterior power $\@ifnextchar^\@extp{\@extp^{\,}}^r L_{\!+}L\oc\g$ of the topological vector space $L_{\!+}L\oc\g$, with its natural topology.
The space of $r$-cochains of the Chevalley-Eilenberg complex of $L_{\!+}L\oc\g$ with coefficients in the module $\mathsf M_0$ is the space $C^r(L_{\!+}L\oc\g, \mathsf M_0) := \mathrm{Hom}^{\mathrm{cont}}(\@ifnextchar^\@extp{\@extp^{\,}}^rL_{\!+}L\oc\g,\mathsf M_0)$ of continuous linear maps
\be \lambda: \@ifnextchar^\@extp{\@extp^{\,}}^rL_{\!+}L\oc\g \to \mathsf M_0.\nn\ee
Since $\mathsf M_0$ has the discrete topology, continuity means that for each such $\lambda$ there must be some $N$ such that $\lambda$ kills everything in grades $\geq N$. Thus
\begin{align} \mathrm{Hom}^{\mathrm{cont}}\left(\@ifnextchar^\@extp{\@extp^{\,}}^rL_{\!+}L\oc\g,\mathsf M_0\right) 
&= \bigoplus_{N\geq 0}\mathrm{Hom}\left( \left(\@ifnextchar^\@extp{\@extp^{\,}}^rL_{\!+}L\oc\g\right)_N, \mathsf M_0\right).\label{Homs}
\end{align}

\subsubsection{Case of finite-dimensional ${\mathfrak g}$}\label{sec: fd}
Let us digress to recall what happens when ${\mathfrak g}$ is of finite dimension.
In that case the subspaces $\left(\@ifnextchar^\@extp{\@extp^{\,}}^r L_{\!+}L\oc\g\right)_N$ appearing in \cref{Homs} are also all finite-dimensional, and so 
\begin{align}  
\bigoplus_{N\geq 0} \mathrm{Hom}\left(\left(\@ifnextchar^\@extp{\@extp^{\,}}^rL_{\!+}L\oc\g\right)_N, \mathsf M_0\right) 
  &\cong \mathsf M_0 \otimes \bigoplus_{N\geq 0} \left(\left(\@ifnextchar^\@extp{\@extp^{\,}}^r L_{\!+}L\oc\g\right)_N\right)^*\nn\\
  &\cong \mathsf M_0 \otimes \Lambda_0^r,\nn
\end{align}
where in the second step we identify the restricted dual, $\bigoplus_{N\geq 0} \left(\left(\@ifnextchar^\@extp{\@extp^{\,}}^r L_{\!+}L\oc\g\right)_N\right)^*$, with the space $\Lambda_0^r$ spanned by states of the form $\mathsf c^{a_1}[-N_1]\dots \mathsf c^{a_r}[-N_r]w_0$, by means of the bilinear pairing given by
\begin{multline} \left(\mathsf c^{a_1}[-N_1]\dots \mathsf c^{a_r}[-N_r]w_0 , J_{b_1}[K_1] \wedge \dots \wedge J_{b_r}[K_r] \right) \\\mapsto \begin{cases} \sign(\sigma) & \text{$a_i = b_{\sigma(i)}$ and $N_i = K_{\sigma(i)}$ for each $i$, for some $\sigma\in S_r$} \\ 0 & \text{otherwise} 
\end{cases} 
\nn
\end{multline}
(Here we picked a basis $J_a$ of ${\mathfrak g}$, where $a$ runs over a finite set of indices.)
 
In this way, one has a linear isomorphism $C^\bl(L_{\!+}L\oc\g, \mathsf M_0) \cong \mathsf M_0\otimes \Lambda_0 $.

\subsubsection{Case of infinite-dimensional ${\mathfrak g}$}\label{sec: tox}
Now we return to our case, in which ${\mathfrak g}$ has countably infinite dimension. 
The tensor product $\mathsf M_0\otimes \Lambda_0$ now corresponds only to a subspace of $C^\bl(L_{\!+}L\oc\g,\mathsf M_0)$, and one which will not be large enough for our purposes. 
It is convenient simply to \emph{define}, for each $r$,
\be \mathsf M_0 \,\mathbin{\widetilde\otimes}\, \Lambda^r_0 := \bigoplus_{N\geq 0}\mathrm{Hom}\left( \left(\@ifnextchar^\@extp{\@extp^{\,}}^rL_{\!+}L\oc\g\right)_N, \mathsf M_0\right) = C^r(L_{\!+}L\oc\g,\mathsf M_0) .\nn\ee

An element $\Phi\in \mathsf M_0\,\mathbin{\widetilde\otimes}\, \Lambda_0^r$ can be regarded as a possibly infinite sum of states of the form 
\be \mathsf c^{a_1,n_1}[-N_1]\dots \mathsf c^{a_r,n_r}[-N_r]v \in \mathsf M_0 \otimes \Lambda_0^r,\label{vform}\ee
with $\sum_{i=1}^r N_i\leq N$ for some bound $N$ depending on $\Phi$,\footnote{Note that we have not required these summands to have bounded depth overall, so the depths of the states $v\in \mathsf M_0$ could increase without bound as, say, $n_1$ increases. We shall only ever need elements of bounded depth, though.} and subject to the condition that for any $\lambda\in \@ifnextchar^\@extp{\@extp^{\,}}^r L_{\!+}L\oc\g$, the pairing $(\Phi,\lambda)$, defined as follows, yields a well-defined (i.e. finite) element of $\mathsf M_0$.  
We first define the pairing between a state in $\mathsf M_0\otimes \Lambda_0^r$ of the form \cref{vform} and a vector in $\@ifnextchar^\@extp{\@extp^{\,}}^r L_{\!+}L\oc\g$ of the form
\be J_{b_1,k_1}[K_1] \wedge \dots \wedge J_{b_r,k_r}[K_r] \label{lamform}\ee
by declaring that 
\begin{multline} \left(\mathsf c^{a_1,n_1}[-N_1]\dots \mathsf c^{a_r,n_r}[-N_r]m , J_{b_1,k_1}[K_1] \wedge \dots \wedge J_{b_r,k_r}[K_r] \right) \\\mapsto \begin{cases} \sign(\sigma) m & \text{$a_i = b_{\sigma(i)}$, $n_i= k_{\sigma(i)}$ and $N_i = K_{\sigma(i)}$ for each $i$, for some $\sigma\in S_r$} \\ 0 & \text{otherwise} 
\end{cases} 
\nn
\end{multline}
Then we extend by linearity in both slots.  

\begin{rem}\label{rem: compact}
Neither $L_{\!+}L\oc\g$ nor $\@ifnextchar^\@extp{\@extp^{\,}}^r L_{\!+}L\oc\g$ are complete. For example, pick an $a\in \mathcal I$ and let $s_N = \sum_{n=1}^N J_{a,n}[n]$ for $N=1,2,3,\dots$. This sequence is Cauchy but not convergent (because the infinite sum $\sum_{n=1}^\8 J_{a,n}[n]$ does not belong to $L_{\!+}L\oc\g = {\mathfrak g}\otimes {\mathbb C}[[t]]$). 

By not completing these spaces, we preserve a useful property of ``compact support'': for any $\lambda \in \@ifnextchar^\@extp{\@extp^{\,}}^r L_{\!+}L\oc\g$ there exists some $k$ such that $\lambda$ can be written as a possibly infinite linear combination of terms of the form \cref{lamform} \emph{with $|k_i| < k$ for each $i=1,\dots, r$}.
\end{rem}

  
\subsection{The complex $C^\bl(L_{\!+}L\oc\g,\mathsf M_0)$ and the state $\mathsf Q$}\label{Qrem} Thus, we have the spaces of the Chevalley-Eilenberg complex $C^\bl(L_{\!+}L\oc\g,\mathsf M_0)$ of $L_{\!+}L\oc\g$ with coefficients in the module $\mathsf M_0$. 
The differential $d: C^r(L_{\!+}L\oc\g,\mathsf M_0) \to C^{r+1}(L_{\!+}L\oc\g,\mathsf M_0)$ is given by the usual formula,
\begin{align} (d f)(x_1,\dots,x_{r+1}) := \sum_{p=1}^{r+1} (-1)^{p+1} x_p . f(x_1,\dots,x_{p-1},x_{p+1},\dots,x_{r+1}) \nn\\
+ \sum_{1\leq p< q \leq r+1} (-1)^{p+q} f([x_p,x_q],x_1,\dots,x_{p-1},x_{p+1},\dots,x_{q-1},x_{q+1},\dots,x_{r+1}) .\label{CEdiff}
\end{align}

Informally, we may introduce a state $\mathsf Q$ given by 
\be \mathsf Q := \sum_{(a,n) \in \mathcal I \times \ZZ} \mathsf c^{a,n}[0] \mathbb J_{a,n} 
- \half \sum_{\substack{a,b,c\in \mathcal I\\ n,m\in {\mathbb Z}}} f_{ab}{}^c \mathsf c^{a,m}[0] \mathsf c^{b,n}[0] \mathsf b_{c,n+m}[-1] w_0. \nn\ee
This is by analogy with the definition of $\mathsf Q$ in the case where ${\mathfrak g}$ has finite dimension.
In our case, $\mathsf Q$ does not belong to the tensor product $\Mfw\otimes \Lambda_0$, because of the infinite sums on $n,m$. It belongs to a suitable completion. One should not expect the vertex superalgebra structure to extend to that completion, just as $\widetilde\mathsf M$ was not a vertex algebra in \cref{sec: wtMh}. Since $\mathsf Q$ is the only such state we shall actually need, let us avoid a formal definition. Instead, we shall check that $\mathsf Q$ has the specific properties we need, as they arise.

Here is the first such property. The zero mode $\mathsf Q\vap 0$ unambiguously defines a linear map $\mathsf M_0\,\mathbin{\widetilde\otimes}\,\Lambda_0\to \mathsf M_0\,\mathbin{\widetilde\otimes}\,\Lambda_0$. (It involves only single contractions.) One easily sees that it coincides with the CE differential:
\be d\Phi = \mathsf Q \vap 0 \Phi .\nn\ee

\subsection{The local complex $C_{\mathrm{loc}}^\bl(L_{\mathfrak g},\L(\mathsf M_0))$}
Recall the definition of the local Lie algebra $\L(\mathscr{L})$ from \cref{sec: loc lie}. One sees from \cref{comf} that the formal zero modes generate a Lie subalgebra, which we shall denote by
\be \L_0(\mathscr{L})\subset \L(\mathscr{L}).\label{L0def}\ee 
We can apply this in particular to the subspaces $\mathsf M_0 \otimes \Lambda_0^r$ of the supercommutative vertex superalgebra $\mathsf M_0\otimes\Lambda_0$, to obtain the vector superspaces (in fact, supercommutative Lie superalgebras) $\L_0(\mathsf M_0 \otimes \Lambda_0^r)$. We see that these spaces are given by
\begin{align} 
\L_0(\mathsf M_0 \otimes \Lambda_0^r)
&= \bigl.\left(\sum_{k\geq 0} T^k  ( \mathsf M_0 \otimes \Lambda_0^r) \right)\bigr/ (\im T + {\mathbb C}w_0)\nn\\
&= \bigl.\left(  \mathsf M_0 \otimes \Lambda_0^r\right) \bigr/ (\im T + {\mathbb C}w_0).\nn
\end{align}
(Note that we have to quotient by the subspace ${\mathbb C}w_0= \ker T$ too, not just $\im T$, because the zero mode $w_0\fm 0 = w_0 \otimes t^0 = \del_t(w_0 \otimes t) = (T+ \del_t) (w_0 \otimes t) \equiv 0$ does vanish in $\L(\mathsf M_0 \otimes \Lambda_0^r)$.)

Now, when ${\mathfrak g}$ has finite dimension, the spaces of the local complex are, by definition, precisely these $\L_0(\mathsf M_0 \otimes \Lambda_0^r)$. In our case, in which ${\mathfrak g}$ has countably infinite dimension, we must use the larger spaces $\mathsf M_0 \,\mathbin{\widetilde\otimes}\, \Lambda_0^r$ from \cref{sec: tox}. By analogy with the above, let us define
\be C_{\mathrm{loc}}^r(L\!L\oc\g,\L(\mathsf M_0)) := \bigl.\left(  \mathsf M_0 \,\mathbin{\widetilde\otimes}\, \Lambda_0^r\right) \bigr/ (\im T + {\mathbb C}w_0)\label{Clocdef}\ee
for each $r$. Here we use the fact that the definition of the translation operator extends in a well-defined way to $\mathsf M_0 \,\mathbin{\widetilde\otimes}\, \Lambda_0^r$. 

Let us write $\int$ for the projection map $\int: C^r(L_{\!+}L\oc\g, \mathsf M_0) \to C_{\mathrm{loc}}^r(L\!L\oc\g,\L(\mathsf M_0)) ;\quad \Phi \mapsto \int \Phi := \Phi[0]$. 
Let us attempt to define a differential 
\be d:  C_{\mathrm{loc}}^r(L\!L\oc\g, \L(\mathsf M_0)) \to C_{\mathrm{loc}}^{r+1}(L\!L\oc\g, \L(\mathsf M_0))\nn\ee
by setting 
\be d(\Phi[0]) := (d\Phi)[0] = (\mathsf Q\vap 0 \Phi)[0] .\nn\ee
The fact that this is a consistent definition is a consequence of the following lemma. 
\begin{lem}\label{lem: Cloccd}
We have the commutative diagram
\be\label{Cloccd}
\begin{tikzcd}
C_{\mathrm{loc}}^r(L\!L\oc\g, \L(\mathsf M_0))\rar{d}&C_{\mathrm{loc}}^{r+1}(L\!L\oc\g, \L(\mathsf M_0))\\
C^r(L_{\!+}L\oc\g, \mathsf M_0) \uar{\int}\rar{d} & C^{r+1}(L_{\!+}L\oc\g, \mathsf M_0) \uar{\int} \\
C^r(L_{\!+}L\oc\g, \mathsf M_0)\uar{T}\rar{d}& C^{r+1}(L_{\!+}L\oc\g, \mathsf M_0)\uar{T} .
\end{tikzcd}\ee
\end{lem}
\begin{proof}
What has to be checked is that the lower square is commutative. This is seen by direct calculation: as in \cref{Qrem}, there is a well-defined notion of the zero mode $\mathsf Q\vap 0$ of $\mathsf Q$ acting on $\mathsf M_0\,\mathbin{\widetilde\otimes}\,\Lambda_0$, and we check that 
$Td\Phi = T (\mathsf Q\vap 0 \Phi) = (T\mathsf Q) \vap 0 \Phi + \mathsf Q \vap 0 T\Phi = \mathsf Q \vap 0 T\Phi= d T\Phi$.
\end{proof}

Thus, we obtain a complex, $(C_{\mathrm{loc}}^\bl(L\!L\oc\g,\L(\mathsf M_0)),d)$. This is the \emph{local complex}. 
As the notation suggests (and as we now check) it forms a subcomplex of the usual Chevalley-Eilenberg complex $C^\bl(L\!L\oc\g, \L(\mathsf M_0))$ of $L\!L\oc\g$ with coefficients in $\L(\mathsf M_0)$.

Consider first a state $\Psi \in \mathsf M_0 \otimes \Lambda_0^r \subset \mathsf M_0\,\mathbin{\widetilde\otimes}\, \Lambda_0^r$ of the form 
\be \Psi = \mathsf c^{a_1,n_1}[-N_1]\dots \mathsf c^{a_r,n_r}[-N_r] v. \nn\ee
We can apply the state-field map to this state, and in particular we can take the zero mode $\Psi\vap 0\in \End(\mathsf M\otimes \Lambda)$. This zero mode $\Psi\vap 0$ is a (generically infinite) sum of terms 
\be \mathsf c^{a_1,n_1}[M_1] \dots \mathsf c^{a_r,n_r}[M_r] v[M] \label{typmod}\ee
(Here $v[M] \in\L(\mathsf M_0)$ is the $M$th  mode of the state $v\in \mathsf M_0$.\footnote{Here and in what follows we are equivocating between formal modes $X\fm M\in \L(\mathsf M\otimes\Lambda)$ and modes $X\vap M\in \End(\mathsf M\otimes\Lambda)$ of states in $X\in \mathsf M\otimes\Lambda$. There is no loss in this because the vertex superalgebra $\mathsf M\otimes\Lambda$ of free fields has the property that the Lie algebra homomorphism $\L(\mathsf M\otimes\Lambda) \to \End\mathsf M\otimes\Lambda$ is injective.})

We have the exterior algebra $\@ifnextchar^\@extp{\@extp^{\,}}^r L\!L\oc\g$.
The pairing from \cref{sec: tox} goes over to this setting, and using it we can certainly interpret each term \cref{typmod} as an $r$-cochain in
\be C^r(L\!L\oc\g, \L(\mathsf M_0) := \mathrm{Hom}^{\mathrm{cont}}(\@ifnextchar^\@extp{\@extp^{\,}}^r L\!L\oc\g,\L(\mathsf M_0)).\nn\ee 
Moreover, the infinite sum $\Psi[0]$ is again a well-defined $r$-cochain, i.e. it is continuous, when  $\L(\mathsf M_0)$ gets its natural (i.e. $t$-adic) linear topology. 

These statements are exactly as in the case in which ${\mathfrak g}$ has finite dimension. The only new aspect of the present case is that a general state $\Phi\in \mathsf M_0 \,\mathbin{\widetilde\otimes}\, \Lambda_0^r$ may itself be an infinite sum of such states $\Psi\in \mathsf M_0 \otimes \Lambda_0^r$, subject to the conditions we gave in \cref{sec: tox}. But, for any given $\mu \in \@ifnextchar^\@extp{\@extp^{\,}}^r L\!L\oc\g$, we can arrange that for only finitely many of these summands $\Psi$ does $\Psi[0]$ have nonzero pairing with $\mu$. (This is clear from the  notion of ``compact support'' from \cref{rem: compact}.) In this way, we can indeed interpret $\Phi[0]\in C_{\mathrm{loc}}^r(L\!L\oc\g,\L(\mathsf M_0))$ as an element of $C^r(L\!L\oc\g,\L(\mathsf M_0))$. 

Finally, one checks that the derivative on $C_{\mathrm{loc}}^\bl(L\!L\oc\g,\L(\mathsf M_0))$ coincides with the usual Chevalley-Eilenberg derivative. 

\subsection{The cocycle $\upomega[0]$}
As the relevant example for us, consider the state $\upomega\in \mathsf M_0\,\mathbin{\widetilde\otimes}\, \Lambda_0^2$ given by 
\begin{align} 
\upomega 
&:=
- \mathsf c^{a,n}[-1] \mathsf c^{b,m}[0] 
                 \frac{\del R_{a,n}^{c,p}}{\del \upgamma^{d,q}[0]} 
                 \frac{\del R_{b,m}^{d,q}}{\del \upgamma^{c,p}[0]} w_0
- \mathsf c^{a,n}[0] \mathsf c^{b,m}[0] 
          \left[T,\frac{\del R_{a,n}^{c,p}}{\del \upgamma^{d,q}[0]}\right] 
                 \frac{\del R_{b,m}^{d,q}}{\del \upgamma^{c,p}[0]} w_0 \label{upomegadef}
\end{align}
where the polynomials $R$ are as we defined them in \cref{Rdef}. 

(Here and below we use summation convention, for brevity.)

The formal zero mode $\upomega\fm 0$ is realized in $\End(\mathsf M_0\,\mathbin{\widetilde\otimes}\,\Lambda_0^2)$ as the following infinite sum
\begin{align} \upomega\vap 0 &= -\int  \mathsf c^{a,n\, \prime}(x) \mathsf c^{b,m}(x) 
                 Y\left(\frac{\del R_{a,n}^{c,p}}{\del \upgamma^{d,q}[0]} 
                 \frac{\del R_{b,m}^{d,q}}{\del \upgamma^{c,p}[0]} w_0,x\right)dx\nn\\
&\qquad- \int \mathsf c^{a,n}(x) \mathsf c^{b,m}(x) 
          Y\left(\left[T,\frac{\del R_{a,n}^{c,p}}{\del \upgamma^{d,q}[0]}\right] 
                 \frac{\del R_{b,m}^{d,q}}{\del \upgamma^{c,p}[0]} w_0,x\right)dx\nn\\
&= -\sum_{K,L\in {\mathbb Z}} K \mathsf c^{a,n}[-K] \mathsf c^{b,m}[-L] 
                 \left(\frac{\del R_{a,n}^{c,p}}{\del \upgamma^{d,q}[0]} 
                 \frac{\del R_{b,m}^{d,q}}{\del \upgamma^{c,p}[0]} w_0\right)[K+L-1]\nn\\
&\qquad- \sum_{K,L\in {\mathbb Z}} \mathsf c^{a,n}[-K] \mathsf c^{b,m}[-L] 
          \left(\left[T,\frac{\del R_{a,n}^{c,p}}{\del \upgamma^{d,q}[0]}\right] 
                 \frac{\del R_{b,m}^{d,q}}{\del \upgamma^{c,p}[0]} w_0\right)[K+L].\nn
\end{align}
At the same time, from \cref{omegadef} we have 
\begin{multline} \widetilde\bm\rho^*(\omega)(J_{a,n}\fm K,J_{b,m}\fm L) \\
 = -K \left(\frac{\del R_{a,n}^{c,p}}{\del \upgamma^{d,q}[0]} 
                 \frac{\del R_{b,m}^{d,q}}{\del \upgamma^{c,p}[0]} w_0\right)\fm{K+L-1}
 - \left(\left[T,\frac{\del R_{a,n}^{c,p}}{\del \upgamma^{d,q}[0]}\right] 
                 \frac{\del R_{b,m}^{d,q}}{\del \upgamma^{c,p}[0]} w_0\right)\fm{K+L}.\nn
\end{multline}
We see that $\upomega\fm 0$ is identified with our cocycle $\widetilde\bm\rho^*(\omega)$, and so our cocycle belongs to the local complex. 

\subsection{Submodules $\mathsf M_0(\np)$ and $\mathsf M_0(\nm)$}
To proceed, we need more information about the structure of $\mathsf M_0$ as an $L_{\!+}L\oc\g$-module. 
Recall that
\begin{align}
{\O_{\np}} &= {\mathbb C}[X^{a,n}]_{\ii a n\in \mathsf A},\nn\\
{\O(\nm)} &= {\mathbb C}[X^{a,n}]_{\ii a n\in -\mathsf A}\nn
\end{align}
and that our action of ${\mathfrak g}$ on ${\O}$ stabilizes both of these, as in \cref{stabprop}. 
It follows that if we now define 
\begin{align} 
\mathsf M_0(\np) &:=   {\mathbb C}[\upgamma^{a,n}[-N]]_{\ii a n \in \mathsf A,N\geq 0}w_0,\nn\\
\mathsf M_0(\nm) &:=   {\mathbb C}[\upgamma^{a,n}[-N]]_{\ii a n \in -\mathsf A,N\geq 0}w_0,\nn
\end{align}
then our action of $L_{\!+}L\oc\g$ on $\mathsf M_0$ (given by $J_{a,n}[N] v = \mathbb J_{a,n} \vap N v$, as in \cref{sec: CE}) stabilizes these subspaces (in fact, commutative vertex subalgebras) of $\mathsf M_0$. (Cf. \cref{Lpgstab}.) 

As modules over $L_{\!+}L\oc\g$, these subspaces turn out to be isomorphic to contragredient Verma modules, as we now describe.

\subsection{Contragredient Verma modules}



The \emph{contragredient Verma module} $M_\lambda^*$ over ${\mathfrak g}$ of highest weight $\lambda\in \h^*$ is by definition the coinduced left $U({\mathfrak g})$-module
\be M_\lambda^* = \Coind_{\b_-}^{\mathfrak g} {\mathbb C} v_\lambda := \mathrm{Hom}^{\mathrm{res}}_{U(\b_-)}(U({\mathfrak g}),{\mathbb C} v_\lambda), \nn\ee
where ${\mathbb C} v_\lambda$ denotes the one-dimensional $U(\b_-)$-module defined by $\nm. v_\lambda = 0$ and $h. v_\lambda = \lambda(h) v_\lambda$ for $h\in \h$.
Here $\mathrm{Hom}^{\mathrm{res}}$ means the following: we have the isomorphism of vector spaces
\begin{align} \mathrm{Hom}_{U(\b_-)}(U({\mathfrak g}),{\mathbb C} v_\lambda) &\cong \mathrm{Hom}_{U(\b_-)}(U(\b_-)\otimes U(\np),{\mathbb C} v_\lambda)\nn\\ &\cong \mathrm{Hom}_{{\mathbb C}}(U(\np),{\mathbb C})= U(\np)^*, \nn
\end{align}
and $\mathrm{Hom}^{\mathrm{res}}$ means we allow only maps that, under this isomorphism, belong to the \emph{restricted dual}
$U(\np)^\vee := \bigoplus_{\alpha\in Q} (U(\np)_\alpha)^* \subset U(\np)^*$
of the $Q$-graded vector space $U(\np)$. 
The isomorphism above is also one  of left $U(\np)$ modules. So, as left $U(\np)$-modules,
\be M_\lambda^* \cong U(\np)^\vee. \label{mlu}\ee 

We also have the contragredient Verma modules ``in the opposite category $\mathscr O$'', i.e. the twists of the modules above by the Cartan involution $\sigma$ of \cref{caidef}. 

Define $M_\lambda^{*,\sigma}$ to be the coinduced left $U({\mathfrak g})$-module
\be M_\lambda^{*,\sigma} = \Coind_{\b_+}^{\mathfrak g} {\mathbb C} v^-_\lambda := \mathrm{Hom}^{\mathrm{res}}_{U(\b_+)}(U({\mathfrak g}),{\mathbb C} v^-_\lambda). \nn\ee
where ${\mathbb C} v^-_\lambda$ denotes the one-dimensional $U(\b_+)$-module defined by $\np. v^-_\lambda = 0$ and $h. v^-_\lambda = \lambda(h) v^-_\lambda$ for $h\in \h$.

As vector spaces, and as modules over $U(\nm)$, we have
\be M_\lambda^{*,\sigma} \cong U(\nm)^\vee. \nn\ee

These definitions go over to the half loop algebra $L_+ {\mathfrak g}$ in an obvious way: ${\mathbb C} v_\lambda$ becomes a module over $L_+ \b_-$ if we declare that $(\b_- \otimes t{\mathbb C}[[t]]). v_\lambda = 0$ and then we get the left $U(L_+ {\mathfrak g})$-module $\mathrm{Hom}^{\mathrm{res}}_{U(L_+\b_-)}(U(L_{\!+}L\oc\g),{\mathbb C} v_\lambda)$, and likewise its twist by $\sigma$. 

\begin{prop}\label{asgmods} $ $
\begin{enumerate}[(i)]
\item There are isomorphisms of ${\mathfrak g}$-modules
\begin{align}
    {\O_{\np}} &\cong \mathrm{Hom}^{\mathrm{res}}_{U(\b_-)}(U({\mathfrak g}),{\mathbb C} v_0),\nn\\
    {\O(\nm)} &\cong \mathrm{Hom}^{\mathrm{res}}_{U(\b_+)}(U({\mathfrak g}),{\mathbb C} v_0) .\nn
\end{align}
\item There are isomorphisms of $L_+{\mathfrak g}$-modules
\begin{align}
    \mathsf M_0(\np) &\cong \mathrm{Hom}^{\mathrm{res}}_{U(L_+\b_-)}(U(L_+{\mathfrak g}),{\mathbb C} v_0) \nn\\
    \mathsf M_0(\nm) &\cong \mathrm{Hom}^{\mathrm{res}}_{U(L_+\b_+)}(U(L_+{\mathfrak g}),{\mathbb C} v_0).\nn
\end{align}
\end{enumerate}
\end{prop}
\begin{proof}
The proof is the same as in the case of ${\mathfrak g}$ of finite type in \cite[\S5.2.3,\S5.6.3]{Fre07}. For completeness let us go through the steps.

First we show that ${\O_{\np}} \cong U(\np)^\vee$ as $\np$-modules.
To do that we consider the pairing $U(\np) \times {\O_{\np}} \mapsto {\mathbb C}; (x,P) \mapsto \left< x,P\right> := \left.x. P\right|_{0\in \np}$. It respects the $Q$-gradations of $U(\np)$ and ${\O_{\np}}$, in the sense that $U(\np)_\alpha$ pairs as zero with ${\O_{\np}}_{\beta}$ unless $\alpha+\beta = 0$. Consider the restriction of the pairing to $U(\np)_\alpha \times {\O_{\np}}_{-\alpha}$ for some $\alpha\in Q_{>0}$. Recall our ordered basis $\mc B_+ = \{J_{a,n}\}_{ \ii a n\in \mathsf A}$ of $\np$ from \cref{Bplus} and \cref{Bpdef}. We have the PBW basis of $U(\np)_\alpha$ consisting of ordered monomials these basis elements, and we have the basis of ${\O_{\np}}_{-\alpha}$ consisting of monomials in the $X^{a,n}$, $\ii a n\in \mathsf A$. Both these bases have the lexicographical ordering coming from the ordering of $\mathsf A$. The action of $J_{a,n}$, $(a,n)\in A$, on ${\O_{\np}}$ is by a differential operator of the form
\be D_{a,n} + \sum_{\substack{(b,m) \in \mathsf A\\ \wgt(J_{b,m}) -\wgt(J_{a,n}) \in Q_{>0}}} P^{b,m}_{a,n}(X)D_{b,m} \label{Jact}\ee  
From this one sees that the matrix of the restricted pairing with respect to the two ordered bases above is diagonal with non-zero entries. Thus the restriction of the pairing to $U(\np)_\alpha \times {\O_{\np}}_{-\alpha}$ is non-degenerate, for each $\alpha\in Q_{>0}$. This shows that ${\O_{\np}} \cong U(\np)^\vee$ as a vector space. But the pairing is also manifestly $\np$-invariant: $\left< x e_i, P\right> = \left< x, e_i P\right>$. This shows that ${\O_{\np}} \cong U(\np)^\vee$ as left modules over  $U(\np)$,  where the left $U(\np)$-module structure on $U(\np)^\vee$ is the canonical one, coming from the right  action of $U(\np)$ on itself by right multiplication.  

Thus, given \cref{mlu}, we have ${\O_{\np}} \cong M_0^*$ as $\np$-modules. Now we show it is an isomorphism of ${\mathfrak g}$-modules. 
The coinduced module $M_\lambda^*$ has the following universal property. Suppose $M$ is a ${\mathfrak g}$-module and $N\subset M$ a $\b_-$-submodule of $M$ such that the quotient $M/N$ is isomorphic to ${\mathbb C} v_\lambda$ as a $\b_-$-module. Then there is a homomorphism of ${\mathfrak g}$-modules $M\to M_\lambda^*$ sending $v\mapsto v_\lambda^*$, where $v\in M$ is such that $v+N$ spans $M/N$, and where $v_\lambda^*\in M_\lambda^*$ is a non-zero vector of weight $\lambda$. In our case, as a $\b_-$-module, ${\O_{\np}}$ has the submodule $N = \bigoplus_{\alpha\in Q_{>0}} {\O_{\np}}_{-\alpha}$ (or equivalently, the ideal in ${\O_{\np}}$ generated by $(X^{a,n})_{(a,n)\in\mathsf A}$). The quotient ${\O_{\np}}/N$ is a $\b_-$-module of dimension one, spanned by the class $1+N$ of the vector $1\in {\O_{\np}}$. This vector $1+N$ has weight zero and is annihilated by $\nm$ (since $\nm. 1 \in N$). Hence there exists a homomorphism of ${\mathfrak g}$-modules $\phi: {\O_{\np}} \to M_0^*$ sending $1$ to a non-zero vector $v_0^*\in M_0^*$ of weight zero. Now, for any $P\in {\O_{\np}}$ there exists $x\in U(\np)$ such that $x. P = 1$: indeed, take the last nonzero monomial $m$ of $P$ with respect to the lexicographical ordering and consider the corresponding PBW basis element $m^*$ of $U(\np)$. We see that $m^*. m$ is a nonzero multiple of $1$. Thus $x. \phi(P) = \phi(x. P) = \phi(1) = v_0^*$ is nonzero and hence $\phi(P)$ is also nonzero. That is, $\phi: {\O_{\np}} \to M_0^*$ is injective. But we know ${\O_{\np}} \cong M_0^*$ as an $\np$-module, as above, so in fact $\phi$ must be a bijection. This completes the proof that ${\O_{\np}} \cong M_0^* \equiv \mathrm{Hom}^{\mathrm{res}}_{U(\b_-)}(U({\mathfrak g}),{\mathbb C} v_0)$ as ${\mathfrak g}$-modules. 

The argument for $ {\O(\nm)} \cong \mathrm{Hom}^{\mathrm{res}}_{U(\b_+)}(U({\mathfrak g}),{\mathbb C} v_0)$ is the same, just twisted by the Cartan involution $\sigma$ so that ${\O_{\np}}$ and ${\O(\nm)}$, and $U(\np)$ and $U(\nm)$, are interchanged. (Compare \cref{vfddef}.)

For part (ii), the argument is again essentially the same, with the $Q$-gradation above replaced by the $Q\times {\mathbb Z}_{\geq 0}$ gradation. One shows first that $\mathsf M_0(\np) \cong U(L_+\np)^\vee$ as $L_+\np$-modules, and then uses that fact to show that the canonical homomorphism of $L_+{\mathfrak g}$-modules $\mathsf M_0(\np)\to \mathrm{Hom}^{\mathrm{res}}_{U(L_+\b_-)}(U(L_+{\mathfrak g}),{\mathbb C} v_0)$ is an isomorphism.
\end{proof}

Therefore there is an isomorphism of modules over ${\mathfrak g}'/{\mathbb C}\mathsf k \cong L\mathring{\mathfrak g}:=\oc\g[t,t^{-1}]$,
\begin{align}
    {\O_{\np}} &\cong \mathrm{Hom}^{\mathrm{res}}_{U(\b'_-/{\mathbb C}\mathsf k)}(U({\mathfrak g}'/{\mathbb C}\mathsf k),{\mathbb C} v_0) \nn
\end{align}
(where $\b'_- := {\mathfrak g}' \cap \b_-$) and an isomorphism of modules over $L_+({\mathfrak g}'/{\mathbb C}\mathsf k) \cong L_{\!+}L\oc\g$,
\begin{align}
    \mathsf M_0(\np) &\cong \mathrm{Hom}^{\mathrm{res}}_{U(L_+(\b'_-/{\mathbb C}\mathsf k))}(U(L_+({\mathfrak g}'/{\mathbb C}\mathsf k)),{\mathbb C} v_0).\nn
\end{align}

Given an  $r$-cochain $\@ifnextchar^\@extp{\@extp^{\,}}^r L_{\!+}L\oc\g \to \mathsf M_0(\np)$, we may restrict it to $\@ifnextchar^\@extp{\@extp^{\,}}^r L_+\mathring\h$ and then compose the resulting map $\@ifnextchar^\@extp{\@extp^{\,}}^r L_+\mathring\h \to \mathsf M_0(\np)$ with the canonical projection of $L_{\!+}L\oc\g$-modules $\mathsf M_0(\np) \to {\mathbb C} v_0$. This defines a map of complexes
\be  \mu: C^\bl(L_{\!+}L\oc\g, \mathsf M_0(\np)) \to C^\bl(L_+\mathring\h,{\mathbb C} v_0). \nn\ee
\begin{lem}\label{lem: quasi-isom}
This map $\mu$ is a quasi-isomorphism, i.e. it induces an isomorphism of the cohomologies,
\be H^\bl(L_{\!+}L\oc\g,\mathsf M_0(\np)) \cong H^\bl(L_+\mathring\h, {\mathbb C} v_0).\nn\ee
\end{lem}
\begin{proof}
The proof, using the Serre-Hochschild spectral sequence (see \cite[\S1.5]{Fuks}), is the same as in \cite[Lemma 5.6.6]{Fre07}.
\end{proof}

The following is \cite[Lemma 5.6.7]{Fre07}. 
\begin{lem}\label{keylem} 
If the restriction of a cocycle $\gamma\in C_{\mathrm{loc}}^r(L\!L\oc\g, \L(\mathsf M_0(\np)))$ to $\@ifnextchar^\@extp{\@extp^{\,}}^rL\mathring\h$ is zero, then $\gamma$ represents the zero cohomology class, $[\gamma] = [0]$, in $H_{\mathrm{loc}}^r(L\!L\oc\g,\L(\mathsf M_0(\np)))$. 
\end{lem}
\begin{proof}
We can suppose $r\geq 1$. 

Consider a cocycle $\gamma \in C_{\mathrm{loc}}^r(L\!L\oc\g, \L(\mathsf M_0(\np)))$. We have $\gamma=X[0]$ for some cochain $X \in C^r(L_{\!+}L\oc\g, \mathsf M_0(\np))$. The closure of $\gamma$ implies $dX$ is in the image of $T$: $dX = TY$, say, for some $Y\in C^{r+1}(L_{\!+}L\oc\g,\mathsf M_0(\np))$. We have $TdY = -dTY = -ddX = 0$ and since $T$ has kernel $0$ (for all $r\geq 1$), that implies $dY=0$.

Let $\ol\gamma$ denote the restriction of $\gamma$ to $\@ifnextchar^\@extp{\@extp^{\,}}^r L \mathring\h$. We have $\ol\gamma = \ol X[0]$, where $\ol X$ denotes the restriction of $X$ to $\@ifnextchar^\@extp{\@extp^{\,}}^rL_+\mathring\h$. If $\ol\gamma$ is zero then $\ol X$ is in the image of $T$. Therefore so too is $\mu(X)$. So we have $\mu(X) = Th$, say, for some $h\in C^r(L_+\mathring\h, {\mathbb C} v_0)$. Now, $\mu$ is a map of complexes, so $dTh = d\mu(X) = \mu(dX) = \mu(TY)$. It is clear that $T$ commutes with $\mu$. Thus $-Tdh = T\mu(Y)$ and hence, again since the kernel of $T$ is trivial, $dh = -\mu(Y)$. That is, $\mu(Y)$ is exact. But $\mu$ is a quasi-isomorphism as in \cref{lem: quasi-isom}. So $Y$ must also be exact: $Y = dB$, say, for some $B\in C^r(L_{\!+}L\oc\g, \mathsf M_0(\np))$. 

Let $X' = X+TB$. We see that $\gamma= X'[0]$ and $X'$ is a cocycle: $dX' = dX - TdB = dX - TY = 0$. 

(At this point, effectively we have shown we were at liberty to assume our $X$ -- now called $X'$ -- was not only a cochain, but a cocycle. We now repeat many steps from above, but armed with that extra fact.)

We have $\mu(X') = Th'$ (where $h'= h+\mu(B)$). So $-Tdh'= dTh' = d\mu(X') = \mu(dX') = 0$, and hence $dh'=0$. So $h'$ is a cocycle in $C^r(L_+\mathring\h,{\mathbb C} v_0) = \left(\@ifnextchar^\@extp{\@extp^{\,}}^r L_+ \mathring\h\right)^\vee$. Thus, again since $\mu$ is a quasi-isomorphism, we have $h'= \mu(B')$ for some cocycle $B'\in C^r(L_{\!+}L\oc\g,\mathsf M_0(\np))$. 
Finally, we see that $\mu(X') = T\mu(B') = \mu(TB')$. Hence the cocycles $X'$ and $TB'$ in $C^r(L_{\!+}L\oc\g,\mathsf M_0(\np))$ represent the same cohomology class in $H^r(L_{\!+}L\oc\g,\mathsf M_0(\np))$. Therefore the cocycles $X'[0]$ and $(TB')[0]$ in $C_{\mathrm{loc}}^r(L_{\!+}L\oc\g, \mathsf M_0(\np))$ represent the same cohomology class in $H_{\mathrm{loc}}^r(L_+ {\mathfrak g}, \mathsf M_0(\np))$. (Indeed $X' - TB' = dC$ for some $C\in C^r(L_{\!+}L\oc\g,\mathsf M_0(\np))$ implies $X'[0] - (TB')[0] = (dC)[0] = d(C[0])$.) But $\gamma = X'[0]$ and $0 = (TB')[0]$, so we have shown $\gamma$ is cohomologous to zero, as required.  
\end{proof}

This is the key lemma. However, to use it, we have to get around one final obstacle: our cochain $\upomega[0]$ lives not in $C_{\mathrm{loc}}^2(L\!L\oc\g, \L(\mathsf M_0(\np)))$ but only in the larger space $C_{\mathrm{loc}}^2(L\!L\oc\g, \L(\mathsf M_0))$.  


\subsection{Cohomology equivariant with respect to $\tau$}
Recall the involutive automorphism $\tau$ defined in \cref{sec: cai}. Let us also denote by $\tau$ the involutive automorphism of $\Lambda\otimes \Mfw$ defined by $\tauw_0 = w_0$,
\begin{alignat}{2} 
\tau(\upgamma^{\ia \alpha n})[N] &= \upgamma^{\ia{-\alpha}{-n}}[N],\quad& 
\tau(\upgamma^{\ia i n})[N]      &= - \upgamma^{\ia i {-n}}[N],\nn\\
\tau(\upbeta_{\ia \alpha n})[N] &= \upbeta_{\ia{-\alpha}{-n}}[N],\quad& 
\tau(\upbeta_{\ia i n})[N]      &= - \upbeta_{\ia i {-n}}[N],\nn
\end{alignat}
\begin{alignat}{2} 
\tau(\mathsf c^{\ia \alpha n})[N] &= \mathsf c^{\ia{-\alpha}{-n}}[N],\quad& 
\tau(\mathsf c^{\ia i n})[N]      &= - \mathsf c^{\ia i {-n}}[N],\nn\\
\tau(\mathsf b_{\ia \alpha n})[N] &= \mathsf b_{\ia{-\alpha}{-n}}[N],\quad& 
\tau(\mathsf b_{\ia i n})[N]      &= - \mathsf b_{\ia i {-n}}[N],\nn
\end{alignat}
\begin{alignat}{2} 
\tau(\SS^\alpha_{\beta,n}[N]) &= \SS^{-\alpha}_{-\beta,-n}[N], \quad&
\tau(\SS^\alpha_{i,n}[N]) &= - \SS^{-\alpha}_{i,-n}[N], \nn\\
\tau(\SS^i_{\beta,n}[N]) &= - \SS^{i}_{-\beta,-n}[N], \quad&
\tau(\SS^i_{j,n}[N]) &= \SS^{i}_{j,-n}[N], \nn
\end{alignat}
for $\alpha,\beta\in \mathring\Delta\setminus\{0\}$, $i,j\in \mathring I$, $n\in {\mathbb Z}$, and $N\in {\mathbb Z}$, and $\tau(\mathsf D[N]) = - \mathsf D[N]$.

Let $C_{\mathrm{loc}}^{\tau,\bl}(L\!L\oc\g,\L(\mathsf M_0)) = \L_0\left( \left(\Lambda_0^\bl\otimes \mathsf M_0\right)^\tau\right)$ denote the subspace consisting of zero modes of states $\Phi\in \Lambda_0\otimes\mathsf M_0$ such that $\tau\Phi = 0$. 


\begin{lem}
$\tau\mathsf Q = \mathsf Q$ and hence $C_{\mathrm{loc}}^{\tau,\bl}(L\!L\oc\g,\L(\mathsf M_0))$ is a subcomplex of $C_{\mathrm{loc}}^{\bl}(L\!L\oc\g,\L(\mathsf M_0))$.
\end{lem}
\begin{proof}
The term $\half f_{ab}{}^c \mathsf c^{a,m}[0] \mathsf c^{b,n}[0] \mathsf b_{c,n+m}[-1] w_0$ in $\mathsf Q$ is $\tau$-invariant because $\sigma$ is an automorphism of $\oc\g[t,t^{-1}]$. (More explicitly, this term is equal to 
\begin{multline}  
\sum_{\alpha\in \mathring\Delta_+} \sum_{i\in \mathring I} \sum_{n,m\in {\mathbb Z}}
 f_{\alpha,-\alpha}{}^i \mathsf c^{\alpha,m}[0] \mathsf c^{-\alpha,n}[0] \mathsf b_{i,n+m}[-1] w_0\nn\\
 +  \sum_{\alpha\in \mathring\Delta_+} \sum_{i\in \mathring I} \sum_{n,m\in {\mathbb Z}}  
\left( f_{\alpha i}{}^\alpha \mathsf c^{\alpha,m}[0] \mathsf c^{i,n}[0] \mathsf b_{\alpha,n+m}[-1] w_0
 +     f_{-\alpha, i}{}^{-\alpha} \mathsf c^{-\alpha,m}[0] \mathsf c^{i,n}[0] \mathsf b_{-\alpha,n+m}[-1] w_0\right)
\nn\\
 +   \half \sum_{i,j,k\in \mathring I} \sum_{n,m\in {\mathbb Z}} f_{ij}{}^k \mathsf c^{i,m}[0] \mathsf c^{j,n}[0] \mathsf b_{k,n+m}[-1] w_0 \nn
\end{multline}
and each line of this expression is $\tau$-invariant.) 
The other term in $\mathsf Q$, $\sum_{(a,n)\in \mathcal I \times \ZZ}\mathsf c^{a,n}[0] \mathbb J_{a,n}$, is $\tau$-invariant because, in view of \cref{vfdequi}, 
\be \tau \mathbb J_{a,n} = \tau \jmath(\bm\rho(J_{a,n})) = \jmath(\tau(\bm\rho(J_{a,n}))) = \jmath(\bm\rho(\sigma J_{a,n}))\nn\ee 
and thus
\be \tau \mathbb J_{\alpha,n} = \mathbb J_{-\alpha,-n}, \quad \tau \mathbb J_{i,n} = - \mathbb J_{i,-n} \nn\ee
for $\alpha\in \mathring\Delta\setminus\{0\}$, $i\in\mathring I$ and $n\in {\mathbb Z}$. 
\end{proof}

\begin{lem}
The element $\upomega \in \Lambda_0^2 \otimes \mathsf M_0$ obeys
\be \tau \upomega =0 .\nn\ee 
\end{lem}
\begin{proof}
Indeed, we defined $\upomega$ as in \cref{upomegadef} but one sees (in view of \cref{ABope}) that, equivalently, 
\be \upomega = \mathsf c^{a,n}[0] \mathsf c^{b,m}[0] 
  \left( \mathbb J_{a,n}\vap 0 \mathbb J_{b,m} 
        - f_{ab}{}^c \mathbb J_{c,n+m} \right)
+ \mathsf c^{a,n}[-1] \mathsf c^{b,m}[0] \mathbb J_{a,n}\vap 1 \mathbb J_{b,m}
\nn\ee
(summation convention). The fact that $\tau\upomega=0$ follows, using the statements above and the fact that $\tau$ is an automorphism for all the non-negative products. 
\end{proof}

Thus our cocycle $\upomega[0]$ belongs to the subcomplex $C_{\mathrm{loc}}^{\tau,\bl}(L\!L\oc\g,\L(\mathsf M_0))$.
More is true. We have the subspace $\mathsf M_0(\np) + \mathsf M_0(\nm)$ of $\mathsf M_0$. It is closed (trivially) under all the non-negative products. Therefore $\L(\mathsf M_0)$ has the Lie subalgebra $\L(\mathsf M_0(\np) + \mathsf M_0(\nm))$.  

\begin{lem}
The cocycle $\upomega[0]$ has coefficients in this subalgebra, i.e 
\be \upomega[0] \in C_{\mathrm{loc}}^{\tau,2}(L\!L\oc\g,\L(\mathsf M_0(\np)+ \mathsf M_0(\nm))).\nn\ee
\end{lem}
\begin{proof}
We use summation convention. By definition, \cref{upomegadef},
\be \upomega =
- \mathsf c^{a,n}[-1] \mathsf c^{b,m}[0] 
                 \frac{\del R_{a,n}^{c,p}}{\del \upgamma^{d,q}[0]} 
                 \frac{\del R_{b,m}^{d,q}}{\del \upgamma^{c,p}[0]} w_0
- \mathsf c^{a,n}[0] \mathsf c^{b,m}[0] 
          \left[T,\frac{\del R_{a,n}^{c,p}}{\del \upgamma^{d,q}[0]}\right] 
                 \frac{\del R_{b,m}^{d,q}}{\del \upgamma^{c,p}[0]} w_0 \nn\ee
where $R_{a,n}^{b,m}(X)$ are the polynomials from \cref{Rdef}. 
On recalling \cref{Rpdef} and \cref{Jdif}, we see that for every $\ii a n\in \mathcal I \times \ZZ$, we have that
\be R_{a,n}^{b,m}(X) = A_{a,n}^{b,m}(X) + B_{a,n}^{b,m}(X) \nn\ee
where
\be  A_{a,n}^{b,m}(X) \in {\mathbb C}[X^{c,p}]_{\ii c p \in \pm \mathsf A}, \quad 
     B_{a,n}^{b,m}(X) \in\bigoplus_{\ii c p \in \mp \mathsf A} {\mathbb C} X^{c,p},\quad\text{for all $\ii bm \in \pm \mathsf A$.} \nn\ee
Now we shall argue that
\begin{align} 
\upomega &=
- \mathsf c^{a,n}[-1] \mathsf c^{b,m}[0] 
           \left(      \frac{\del A_{a,n}^{c,p}}{\del \upgamma^{d,q}[0]} 
                       \frac{\del A_{b,m}^{d,q}}{\del \upgamma^{c,p}[0]} w_0
                  +    \frac{\del B_{a,n}^{c,p}}{\del \upgamma^{d,q}[0]} 
                       \frac{\del B_{b,m}^{d,q}}{\del \upgamma^{c,p}[0]} w_0 \right)\nn\\ 
& \qquad \qquad - \mathsf c^{a,n}[0] \mathsf c^{b,m}[0] 
          \left[T,\frac{\del A_{a,n}^{c,p}}{\del \upgamma^{d,q}[0]}\right] 
                 \frac{\del A_{b,m}^{d,q}}{\del \upgamma^{c,p}[0]} w_0. \label{ABeq}
\end{align}
Indeed, we see all $A$-$B$ cross terms are zero just by inspecting the index contractions. The remaining term is 
$ - \mathsf c^{a,n}[0] \mathsf c^{b,m}[0] 
          \left[T,\frac{\del B_{a,n}^{c,p}}{\del \upgamma^{d,q}[0]}\right] 
                 \frac{\del B_{b,m}^{d,q}}{\del \upgamma^{c,p}[0]} w_0$ but this is zero by the linearity of the $B_{a,n}^{b,m}$ and the fact that $[T,1]=0$.
So we have the equality \cref{ABeq}. The term $\frac{\del B_{a,n}^{c,p}}{\del \upgamma^{d,q}[0]} 
                       \frac{\del B_{b,m}^{d,q}}{\del \upgamma^{c,p}[0]} w_0$ is proportional to $w_0$, again by the linearity of $B_{a,n}^{b,m}$. And by definition of the $A_{a,n}^{b,m}$, the $A$-$A$ terms all belong to $\Lambda_0^2\otimes(\mathsf M_0(\np) + \mathsf M_0(\nm))$. So we have established that
\be \upomega \in \Lambda_0^2\otimes(\mathsf M_0(\np) + \mathsf M_0(\nm)) \nn\ee
and hence the result. 
\end{proof} 

\begin{lem}
There is an isomorphism of complexes
\be C_{\mathrm{loc}}^{\tau,\bl}(L\!L\oc\g,\L(\mathsf M_0(\np)+\mathsf M_0(\nm))) \cong C_{\mathrm{loc}}^\bl(L\!L\oc\g,\L(\mathsf M_0(\np)))\nn\ee
\end{lem}
\begin{proof}
There is certainly a linear isomorphism
\begin{align} \Lambda_0 \otimes \mathsf M_0(\np) &\xrightarrow\sim \Lambda_0 \otimes \left( \mathsf M_0(\np) + \mathsf M_0(\nm)\right)\nn\\
    v &\mapsto (1+\tau) v,\nn
\end{align}
and hence a linear isomorphism $\L_0(\Lambda_0 \otimes \mathsf M_0(\np)) \cong \L_0(\Lambda_0 \otimes \left( \mathsf M_0(\np) + \mathsf M_0(\nm)\right))$. 
We have $(1+\tau)(\mathsf Q\vap 0 v) = \mathsf Q\vap 0 v + (\tau\mathsf Q) \vap 0 \tau v = \mathsf Q\vap 0 v + \mathsf Q\vap 0 \tau v = \mathsf Q \vap0 (1+\tau) v$, so this isomorphism commutes with the differential. 
\end{proof}

Finally we can complete the proof of \cref{mainthm}. 

We have shown that our cocycle $\widetilde\bm\rho^*(\omega) = \upomega[0]$ belongs to $C_{\mathrm{loc}}^{\tau,2}(L\!L\oc\g,\L(\mathsf M_0(\np)+\mathsf M_0(\nm)))$ and therefore corresponds to a cocycle $\zeta \in C_{\mathrm{loc}}^2(L\!L\oc\g,\L(\mathsf M_0(\np)))$. By the key lemma, \cref{keylem}, such a cocycle is cohomologous to zero if its restriction to $L\mathring\h$ vanishes. The restriction of $\zeta$ to $L\mathring\h$ is zero if the restriction of $\widetilde\bm\rho^*(\omega)$ to $L\mathring\h$ is zero. And the restriction of $\widetilde\bm\rho^*(\omega)$ to $L\mathring\h$ is indeed zero because, for all $i\in \mathring I$, $\bm\rho(J_{i,0}) = \mathsf J_{i,0}$ (and hence $R_{i,0}^{b,n}(X) = 0$).

Thus there exists a 1-cochain $\xi \in C_{\mathrm{loc}}^1(L\!L\oc\g,\L(\mathsf M_0(\np)))$ such that $\zeta = d\xi$. It may be written in the form
\be \xi = \Xi\fm 0,\quad\text{with}\quad \Xi := \mathsf c^{a,n}\fm 0 \sum_{(b,m) \in \mathsf A} Q_{a,n;b,m}(\upgamma\fm 0) \upgamma^{b,m}\fm{-1}w_0\nn\ee
for some polynomials $Q_{a,n;b,m}(X) \in {\O_{\np}}$, $(b,m)\in \mathsf A$, such that $\Xi$ has $Q$-grade $0$. 

In this way we obtain a 1-cochain, $(1+\tau)\xi \in C_{\mathrm{loc}}^{\tau,1}(L\!L\oc\g,\L(\mathsf M_0(\np) + \mathsf M_0(\nm))$, such that $\widetilde\bm\rho^*(\omega) = d(1+\tau)\xi$, as required. 

\section{Proof of \cref{bthm}}\label{sec: proofb}
In \cref{sec: inft} we studied the infinitesimal right action of ${\widetilde \g}$ on the right coset space $U_0({\mathbb C}_\epsilon):= \exxp{\epsilon\b_-} \!\Big\backslash\! \exxp{{\mathfrak f}_\epsilon}$. In the same way we may consider the right action of ${\widetilde \g}$ on the right coset space $\exxp{\epsilon\n_-} \!\Big\backslash\! \exxp{{\mathfrak f}_\epsilon}$. We get the following analog of \cref{Plem} and \cref{vfdef}.


\begin{lem}
Let $A\in {\widetilde \g}$. 
Then there exist polynomials $\left\{P_A^{\ia b m}(X)\in {\O_{\np}}\right\}_{{\ii b m}\in \mathsf A}$ and $\{p^i_A(X) \in {\O_{\np}}\}_{i\in I}$ (depending linearly on $A$) such that
\begin{align} &\Exp{\epsilon \nm} \left( \Exp{\sum_{i=1}^{\dim\h} y^i b_i} \prodr_{{\ii b m}\in\mathsf A} \Exp{x^{\ia b m} J_{\ia b m}}\right) \Exp{\epsilon A} \nn\\
&\qquad\qquad= \Exp{\epsilon \nm} \Exp{\sum_{i=1}^{\dim\h} \left( y^i + \epsilon p^i_A(x)\right) b_i}
 \prodr_{{\ii b m}\in\mathsf A} \Exp{\left(x^{\ia b m} + \epsilon P_A^{\ia b m}(x)\right)J_{\ia b m}}\nn
\end{align}
for every element $\Exp{\sum_{i=1}^{\dim\h} y^i b_i}\prodr_{{\ii b m}\in\mathsf A} \Exp{x^{\ia b m} J_{\ia b m}}$ of the group $B:= H\ltimes U$. 

Hence, the linear map 
\be {\widetilde \g} \to \Derc{\O_{\np}} \ltimes \bigoplus_{i=1}^{\dim\h} {\O_{\np}} \del_{Y^i} \nn\ee 
given by
\be A \mapsto \sum_{i=1}^{\dim\h} p^i_A(X) \del_{Y^i} + \sum_{{\ii b m}\in \mathsf A} P_A^{\ia b m}(X) D_{\ia b m} \nn\ee
is a homomorphism of Lie algebras.
It respects the $Q$-gradation (where we assign $Q$-grade zero to the generators $\del_{Y^i}$).
 \qed
\end{lem}

Explicitly, this homomorphism sends
\begin{align}
e_i \mapsto \rho(e_i), \nn\qquad
h  \mapsto \rho(h) + \sum_{j=1}^{\dim\h} \left< b^j,h\right> \del_{Y^j},\nn\qquad
f_i  \mapsto \rho(f_i) + \sum_{j=1}^{\dim\h} \left< b^j,\check\alpha_i\right> X^{e_{i}} \del_{Y^j}, \nn
\end{align}
where $X^{e_i} := X^i$ are as in \cref{Xidef}. Let $X^{f_i} := \tau X^{e_i}$. 
It follows that there is a homomorphism of Lie algebras (here, recall \cref{vfddef})
\be \bm\rho' : {\mathfrak g} \to \Dg \ltimes \bigoplus_{i=1}^{\dim\h} {\O} \del_{Y^i} \nn\ee
defined by 
\begin{align}
e_i &\mapsto \bm\rho(e_i)+ \sum_{j=1}^{\dim\h} \left< b^j,\check\alpha_i\right> X^{f_{i}} \del_{Y^j}, \nn\\ 
h  &\mapsto \bm\rho(h) + \sum_{j=1}^{\dim\h} \left< b^j,h\right> \del_{Y^j},\nn\\
f_i  &\mapsto \bm\rho(f_i) + \sum_{j=1}^{\dim\h} \left< b^j,\check\alpha_i\right> X^{e_{i}} \del_{Y^j}, \nn
\end{align}
for $i\in I$ and $h\in \h$.
This yields a homomorphism of the loop algebras, just as in \cref{vfdhatdef},
\be L{\mathfrak g} \to L\left(\Dg \ltimes \bigoplus_{i=1}^{\dim\h} {\O} \del_{Y^i} \right). \nn\ee

Now we note that 
\be (\Mfw\otimes\pi_0)[0] =_{\mathbb C} {\O}\quad\text{and}\quad(\Mfw\otimes\pi_0)[1] =_{\mathbb C} \Omega_\O \oplus \jmath\left(\Dg \ltimes\bigoplus_{i=1}^{\dim\h} {\O} \del_{Y^i} \right)\nn\ee
where we continue to identify ${\O}$ and $\Omega_{\O}$ with subspaces of $\Mfw = \Mfw\otimes {\mathbb C}w_0$ as before, and we extend the definition of the injective linear map $\jmath$, \cref{jotadef}, by setting
\be \jmath\left( \sum_{i=1}^{\dim\h} p^i(X) \del_{Y^i}\right) = \sum_{i=1}^{\dim\h} p^i(\upgamma\fm0) b_i\fm{-1}w_0.\nn\ee

As in \cref{LDextlem} and \cref{jotalem}, we then find that there is an isomorphism of Lie algebras
\be L\left(\Dg \ltimes \bigoplus_{i=1}^{\dim\h} {\O} \del_{Y^i} \right)
\cong \L((\Mfw\otimes \pi_0)\df1)\big/ \L(\Og \oplus \Omega_\Og) .\nn\ee
We get an exact sequence of Lie algebras
\be 0 \to \L(\Og \oplus \Omega_\Og)  \to \L((\Mfw\otimes\pi_0)\df1) \to L\left(\Dg\ltimes \bigoplus_{i=1}^{\dim\h} {\O} \del_{Y^i} \right) \to 0\ee 
As in the proof of \cref{jotalem}, the cocycle defining this extension is given by double contraction terms in the OPE. Following \cite{Fre07}, the key observation is then that there are no possible double contractions between the new terms we have added (which belong to the subspace $\O \otimes \pi_0 \subset \Mfw \otimes \pi_0$) and the existing terms (which each have at most one factor of $\upbeta$ or $\SS$). It follows that the statement of \cref{mainthm} still holds (with the same lifting map $\bm\phi$) when $\bm\rho$ is replaced by the map $\bm\rho'$ above. 


