text:
\section{Introduction}

Given two real separable Hilbert spaces $H$ and $K$, let us consider  the nonlinear stochastic differential equation (SDE)  on $H$ in the form:
\begin{align} \label{SDEintro}
dX_t =  A X_t dt +  b_t(X,\mathbb{P}_{X_{\cdot\wedge t}},\alpha_t,\mathbb{P}_{\alpha_t}) dt + \sigma_t(X,\mathbb{P}_{X_{\cdot\wedge t}},\alpha_t,\mathbb{P}_{\alpha_t}) dB_t,
\end{align}
over a finite interval $[0,T]$.  Here,  $A\colon \mathcal{D}(A)\subset H\rightarrow H$ is
the generator of a $C_0$-semigroup of contractions in $H$,
and $B=(B_t)_{t\geq 0}$
is a $K$-valued cylindrical Brownian motion on a  complete probability space $(\Omega,{\cal F},\mathbb{P})$ with $\mathbb{F}^B$ its completed natural filtration.
The coefficients  $b$ and $\sigma$,  valued respectively in $H$ and ${\cal L}_2(K;H)$ (the space of Hilbert-Schmidt operators from $K$ to $H$), depend on time, on the whole path of the state process $X$, on an input
control process $\alpha$, that is an $\mathbb{F}^B$-adapted process valued in  some Borel space $U$,  and furthermore on the distribution of the state/control  process.

Equation \eqref{SDEintro} is referred to as controlled McKean-Vlasov SDE in Hilbert spaces, and we are interested in the optimal control for \eqref{SDEintro} by minimizing, over control processes $\alpha$, a functional in the form
\begin{equation*}
J(X_0,\alpha) =  \mathbb{E} \Big[ \int_0^T f_t(X,\mathbb{P}_{X_{\cdot\wedge t}},\alpha_t,\mathbb{P}_{\alpha_t}) dt + g(X,\mathbb{P}_{X}) \Big],
\end{equation*}
given running cost and terminal cost functions $f$ and $g$.

When the coefficients $b,\sigma,f,g$ do not depend on the law of the state process, the control of equation \eqref{SDEintro} is
motivated by various kinds of stochastic partial differential equations (SPDEs) like
stochastic heat equations (see e.g. \cite{CannarsaDaPrato91,Gozzi95,
Gozzi96,Masiero05,FuhrmanTessitore02-ann})
stochastic reaction-diffusion equations (see e.g.\cite{Cerrai01,Cerrai01-40}), stochastic porous media equations (see e.g. \cite{barroc19}), singular stochastic dissipative equations (see e.g. \cite{daproc02}),
stochastic Burgers and Navier-Stokes equations (see e.g. \cite{DaPratoDebussche99,dapdeb00,GozziSritharanSwiech05}),
Zakai equation in filtering (see e.g. \cite{GozziSwiech00}),
stochastic first-order equations (see e.g. \cite{GoldysGozzi06}),
stochastic delay equations (see e.g. \cite{FuhrmanMasieroTessitore11}\cite{RosestolatoSwiech15},
\cite{GozziMasiero17,GozziMasiero17bis}
\cite{BiffisGozziProsdocimi20}).  We refer also to the lecture notes and monographs \cite{DPZ}, \cite{bardaproc16}, \cite{FabbriGozziSwiech}, for an account on this topic.

The main novelty of this paper is to consider a mean-field dependence on the coefficients of the infinite-dimensional stochastic differential equation \eqref{SDEintro}, and to study the corresponding control problem. Mean-field diffusion processes, also called McKean-Vlasov equations,  in finite dimension have a long history with  the pioneering works \cite{kac}, \cite{mackean}, and later on with the seminal paper \cite{S89} in the framework of propagation of chaos. The control of such equations has attracted an increasing interest since the emergence of mean-field game theory initiated independently  in \cite{laslio07} and \cite{huacaimal06}, aiming at describing control of large systems or population of interacting particles, and  has generated over the last few years numerous contributions, see e.g.  \cite{phawei17}, \cite{CossoPham19}, \cite{DjetePossamaiTan19}, and the reference monographs  \cite{benetal13} and \cite{cardelbook}.

In addition to the infinite-dimensional feature of the McKean-Vlasov equation \eqref{SDEintro}, we emphasize the  path-dependency (in a nonanticipative way)
of the coefficients $b,\sigma,f,g$, on the state process as well as on its distribution.
This general setting, which is motivated by various applications, see e.g. Example \ref{ex:SE}, seems to be considered for the first time in the present paper.

Our basic objective here is to extend to our infinite-dimensional path-dependent setting the tools required in the dynamic programming approach for  McKean-Vlasov control problems.

In the finite-dimensional case, i.e. $H=\mathbb{R}^d$, and in the Markovian case, i.e. without path-dependency of the coefficients, the Wasserstein derivative in the lifted sense of Lions \cite{lio12}, turns out to be a convenient notion of measure derivative when combined with It\^o's formula along the flow of probability measures (see \cite{bucetal17}) in order to  define
the Master equation in mean-field game/control. These concepts have been recently extended to the path-dependent case in  \cite{WuZhang18PPDE} with a functional It\^o formula in the McKean-Vlasov setting.

\vspace{2mm}

\noindent {\bf Our contributions.}
Our first main result is to prove  the crucial law invariance property of the value function to the control problem (see Theorem \ref{T:id-law}), which implies that the value function can be considered  as a function on the Wasserstein space of probability measures on  $C([0,T];H)$. We also state and provide a direct proof of the dynamic programming principle  in this context (see Theorem \ref{T:DPP} and Corollary \ref{C:DPP}).  Next, we introduce a notion of pathwise derivative in Wasserstein space and a related functional It\^o formula in our infinite-dimensional McKean-Vlasov context that extend the concepts in \cite{WuZhang18PPDE}.  Equipped with these tools, we can then derive from the dynamic programming principle the associated Master HJB equation, which is a PDE
where the  state variable is a probability measure on $C([0,T];H)$.  For such PDE, we provide equivalent formulations and simplifications,
notably in the special case when there is no dependence of the coefficients on the law of the control. We  define an intrinsic notion of viscosity solution in ${\cal P}_2(C([0,T];H))$, the space of square-integrable probability measures on $C([0,T];H)$,
together with the viscosity property of the value function. Comparison principle for Master Bellman equation is postponed to further investigation, as it is already a challenging issue in the finite-dimensional case where only partial results exist in the literature, see \cite{WuZhang18PPDE} and \cite{buretal19}.

We also point out that our results clarify and improve in particular some statements from  the finite-dimensional case, like the law invariance property (see Remark \ref{R:Aliprantis})
and the dynamic programming principle.

The outline of the paper is organized as follows.  In Section \ref{sec-descr}, we present the notations and formulate the McKean-Vlasov state equation valued in Hilbert space: due to the generality of the setting basic results on
well-posedness and approximation of this equation are not known and are carefully proved.
Section \ref{S:ControlPb} is devoted to the formulation of the optimal control problem, the dynamic programming principle and law invariance property of the associated value function.
We introduce in Section \ref{S:Ito}  the notion of pathwise derivative in Wasserstein space and the related functional It\^o formula.
Section \ref{S:HJB}  is concerned with the derivation of the Master Bellman equation and the viscosity property of the value function.
Finally, Appendices \ref{App:StateEquation}, \ref{App:LawInvariance}, \ref{App:PathDeriv}, \ref{App:Consistency}, \ref{App:HJB} collect some technical results used throughout the paper.

\section{Controlled path-dependent McKean-Vlasov SDEs
in\\ Hilbert spaces}\label{sec-descr}

\subsection{Notations and assumptions}
\label{Subs:Notations}

\paragraph{State space and functional analytic setting.}
We fix two real separable Hilbert spaces $H$ and $K$, with inner products
$\<\cdot,\cdot\>_H$,$\<\cdot,\cdot\>_K$  and induced norms $|\cdot|_H$,$|\cdot|_K$, respectively, omitting the subscripts $H$ or $K$ when clear from the context. We denote by ${\cal L}(K;H)$ (resp.\ ${\cal L}(H)$) the space of bounded linear operators from $K$ to $H$ (resp.\ $H$ to $H$). We endow ${\cal L}(K;H)$ with the operator norm $\|\cdot\|_{{\cal L}(K;H)}$ defined by
\[
\|{F}\|_{{\cal L}(K;H)} = \sup_{k\in K,\;k\neq 0} {|{F}k|_H\over|k|_K}\,, \qquad {F}\in {\cal L}(K;H).
\]
Similarly, we endow ${\cal L}(H)$ with the corresponding norm $\|\cdot\|_{{\cal L}(H)}$. We also denote by ${\cal L}_2(K;H)$ the space of Hilbert-Schmidt operators from $K$ to $H$, that is the set of all
${F}\in {\cal L}(K;H)$ such that
\[
\sum_{n\in\mathbb{N}}|{F}e_n|^2_H < +\infty
\]
for some orthonormal basis $\{e_n\}_{n\in\mathbb{N}}$ of $K$. We endow ${\cal L}_2(K;H)$ with the  norm $\|\cdot\|_{{\cal L}_2(K;H)}$ defined by
\[
\|{F}\|_{{\cal L}_2(K;H)}  =  \sqrt{ \sum_{n\in\mathbb{N}}|{F}e_n|^2_H}\,,  \qquad {F}\in{\cal L}_2(K;H).
\]
We recall that the definitions of ${\cal L}_2(K;H)$ and $\|\cdot\|_{{\cal L}_2(K;H)}$ do not depend on the choice of the orthonormal basis $\{e_n\}_{n\in\mathbb{N}}$ of $K$.

We now fix a finite time horizon $T > 0$ and consider the \emph{state space} of our optimal control problem which is given by the set $C([0,T];H)$ of continuous $H$-valued functions on $[0,T]$. Given $x\in C([0,T];H)$ and $t\in[0,T]$, we denote by $x_t$ the value of $x$ at time $t$ and we set $x_{\cdot\wedge t}\coloneqq (x_{s\wedge t})_{s\in[0,T]}$. Notice that $x_t\in H$, while $x_{\cdot\wedge t}\in C([0,T];H)$. We endow $C([0,T];H)$ with the uniform norm $\|\cdot\|_T$ defined as
\[
\|x\|_T = \sup_{s\in[0,T]} |x_s|_H\,, \qquad x\in C([0,T];H).
\]
Notice that $(C([0,T];H),\|\cdot\|_T)$ is a Banach space. We denote by $\mathscr B$ the Borel $\sigma$-algebra of $C([0,T];H)$. Finally, for every $t\in[0,T]$ we introduce the seminorm $\|\cdot\|_t$ defined as
\[
\|x\|_t = \| x_{\cdot\wedge t}\|_T\,, \qquad x\in C([0,T];H).
\]

\paragraph{Spaces of probability measures and Wasserstein distance.} Given a metric space $M$, if $\mathscr{M}$ denotes its Borel $\sigma$-algebra,
 we denote by ${\cal P}(M)$ the set of all probability measures on $(M,\mathscr M)$. We endow ${\cal P}(M)$ with the topology of weak convergence. When $M$ is a
Polish space $\rm S$, with metric $d_{\rm S}$, we also define, for $q\geq 1$,
\[
{\cal P}_q({\rm S}) \coloneqq  \left\{\mu \in {\cal P}({\rm S})\colon \int_{\rm S} d_{\rm S}(x_0,x)^q \mu(dx)<+\infty\right\} ,
\]
where $x_0\in\rm S$ is arbitrary. This set is endowed with the $q$-Wasserstein distance defined as
\begin{align*}
{\cal W}_q(\mu,\mu') &\coloneqq  \inf\bigg\{\int_{{\rm S}\times{\rm S}}d_{\rm S}(x,y)^q \pi(dx,dy)\colon
  \pi \in {\cal P}({\rm S}\times{\rm S})\\
 & \hspace{2cm} \text{ such that } \pi(\cdot\times{\rm S})= \mu \mbox{ and }\pi({\rm S}\times\cdot)=\mu'\bigg\}^{1\over q}\,,\qquad q\geq 1,
\end{align*}
for every $\mu,\mu'\in {\cal P}_q({\rm S})$. The space $\big({\cal P}_q({\rm S}),{\cal W}_q)$ turns out to be a Polish space (see for instance \cite[Theorem 6.18]{Vi09}).

\paragraph{Probabilistic setting.}

We fix a complete probability space $(\Omega,{\cal F},\mathbb{P})$ on which a $K$-valued cylindrical Brownian motion $B=(B_t)_{t\geq0}$ is defined (see e.g.
\cite[Section 4.1]{DPZ} and \cite[Remark 1.89]{FabbriGozziSwiech} on the definition of cylindrical Brownian motion).
We denote by $\mathbb{F}^B=({\cal F}_t^B)_{t\geq0}$ the $\mathbb{P}$-completion of the filtration generated by $B$\footnote{Notice that it may be not obvious to define the natural filtration for cylindrical Brownian motion as, in principle, it may depend on the choice of the reference system where such process is considered, which, in general, is not unique. However, as noted in \cite[Remark 1.89]{FabbriGozziSwiech}) this will not affect the class of integrable processes and, consequently, the filtration.}. Notice that $\mathbb{F}^B$ is also right-continuous (see~\cite[Lemma 1.94]{FabbriGozziSwiech}), so, in particular, it satisfies the usual conditions. We assume that there exists a sub-$\sigma$-algebra ${\cal G}$ of ${\cal F}$ satisfying the following standing assumptions.
\begin{StandingAssumption}{\bf(A$_{\cal G}$)}\label{A_G}\quad
{\begin{enumerate}[\upshape i)]
\item ${\cal G}$ and ${\cal F}_\infty^B$ are independent;
\item ${\cal G}$ is ``rich enough'' in the sense that the following property holds:
\begin{align*}
{\cal P}_2\big(C([0,T];H)\big) &= \big\{\mathbb{P}_\xi\text{ with }\xi\colon[0,T]\times\Omega\rightarrow H\text{ continuous and} \\
&\qquad \hspace{1mm} \text{${\cal B}([0,T])\otimes{\cal G}$-measurable process satisfying }\mathbb{E}\big[\|\xi\|_T^2\big] < \infty\big\},
\end{align*}
i.e. for every $\mu\in{\cal P}_2(C([0,T];H))$ there exists a continuous and ${\cal B}([0,T])\otimes{\cal G}$-measurable process $\xi\colon[0,T]\times\Omega\rightarrow H$, satisfying $\mathbb{E}\|\xi\|_T^2<\infty$, such that $\xi$ has law equal to $\mu$.
\end{enumerate}}
\end{StandingAssumption}

\noindent As stated in the following lemma (take ${\cal H}={\cal G}$ in Lemma \ref{L:U_G}), property \textup{\ref{A_G}}-ii) holds if and only if there exists a ${\cal G}$-measurable random variable $U_{\cal G}\colon\Omega\rightarrow\mathbb{R}$ having uniform distribution on $[0,1]$ (see also Remark \ref{R:Atomless}).

\begin{Lemma}\label{L:U_G}
On the probability space $(\Omega,{\cal F},\mathbb{P})$ consider a sub-$\sigma$-algebra ${\cal H}\subset{\cal F}$. The following statements are equivalent.
\begin{enumerate}[\upshape 1)]
\item There exists a ${\cal H}$-measurable random variable $U_{\cal H}\colon\Omega\rightarrow\mathbb{R}$ having uniform distribution on $[0,1]$.
\item ${\cal H}$ is ``rich enough'' in the sense that the following property holds:
\begin{align*}
{\cal P}_2\big(C([0,T];H)\big) &= \big\{\mathbb{P}_\xi\text{ with }\xi\colon[0,T]\times\Omega\rightarrow H\text{ continuous and} \\
&\qquad \hspace{1mm} \text{${\cal B}([0,T])\otimes{\cal H}$-measurable process satisfying }\mathbb{E}\big[\|\xi\|_T^2\big] < \infty\big\}.
\end{align*}
\end{enumerate}
\end{Lemma}
\begin{Remark}\label{R:Atomless}
Using the same notations as in Lemma \ref{L:U_G}, if the probability space $(\Omega,{\cal H},\mathbb{P})$ is \emph{atomless} (namely, for any $E\in{\cal H}$ such that $\mathbb{P}(E)>0$ there exists $F\in{\cal H}$, $F\subset E$, such that $0<\mathbb{P}(F)<\mathbb{P}(E)$) then property 1), or equivalently 2), of Lemma \ref{L:U_G} holds (see for instance \cite[vol.\ I, p.\ 352]{cardelbook}).
\end{Remark}
\begin{Remark}\label{R:G}
The additional randomness (other than $B$) coming from the $\sigma$-algebra ${\cal G}$ is used for the initial condition $\xi$ of the state equation \eqref{cont-MKV-differential} (notice that it is necessary to consider \emph{random} initial conditions in order to state and prove the dynamic programming principle, Theorem \ref{T:DPP}, where for instance the initial condition at time $s$ is given by the random variable $X^{t,\xi,\alpha}$). However, we remark that whenever $t>0$ the $\sigma$-algebra ${\cal G}$ can be replaced by ${\cal F}_t^B$; in other words, the initial condition $\xi$ can be taken only ${\cal F}_t^B$-measurable.  As a matter of fact, for every $t>0$, it holds that:
\begin{enumerate}[i)]
\item ${\cal F}_t^B$ and $\sigma(B_s-B_t,\ s\geq t)$ are independent (in item \textup{i}) of \textup{\ref{A_G}} we have imposed the stronger condition that ${\cal G}$ and ${\cal F}_\infty^B$ have to be independent; however, if we consider only the control problem with initial time $t$, then the assumption imposed here is enough.
\item ${\cal F}_t^B$ satisfies the property of being ``rich enough'' or, equivalently, it satisfies property 1) of Lemma \ref{L:U_G}.
\end{enumerate}
Therefore, the $\sigma$-algebra ${\cal G}$ is really necessary only for the control problem with initial time $t=0$. In fact, this allows to define the value function $v$ (see \eqref{v}) for every pair $(t,\mu)$ in $[0,T]\times{\cal P}_2(C([0,T];H))$, with $\mu$ being the law of $\xi$. On the other hand, if we do not use ${\cal G}$, $v$ is defined on $(0,T]\times{\cal P}_2(C([0,T];H))$ and for $t=0$ is defined only at the Dirac measures.
\end{Remark}
\begin{proof}[\textbf{Proof of Lemma \ref{L:U_G}.}]
\noindent 1) $\Longrightarrow$ 2). Fix $\mu\in{\cal P}_2(C([0,T];H))$. Our aim is to find a process $\xi\colon[0,T]\times\Omega\rightarrow H$ continuous and ${\cal B}([0,T])\otimes{\cal H}$-measurable with law equal to $\mu$. To this end, consider the probability space $([0,1],{\cal B}([0,1]),\lambda)$, where $\lambda$ denotes the Lebesgue measure on the unit interval. Given such a $\mu$, it follows from Theorem 3.19 in \cite{Kallenberg} that there exists a measurable function $\Xi\colon[0,1]\rightarrow C([0,T];H)$ such that the image (or push forward)  measure of $\lambda$ by $\Xi$ is equal to $\mu$. Now, denote
\[
\xi_t(\omega) \coloneqq  \Xi(U_{\cal H}(\omega))_t, \qquad \forall\ (t,\omega)\in[0,T]\times\Omega,
\]
where the subscript in $\Xi(U_{\cal H}(\omega))_t$ denotes the valuation at time $t$ of the continuous function $\Xi(U_{\cal H}(\omega))$.

Notice that $\xi$ is a continuous process with law equal to $\mu$. Moreover, for every fixed $t\in[0,T]$, $\xi_t$ is ${\cal H}$-measurable.
Since $\xi$ has continuous paths, it follows that $\xi$ is also ${\cal B}([0,T])\otimes{\cal H}$-measurable (see for instance \cite{DM}, Chapter IV, Theorem 15). This concludes the proof of the implication 1) $\Longrightarrow$ 2).

\vspace{2mm}

\noindent 2) $\Longrightarrow$ 1). Consider again the probability space $([0,1],{\cal B}([0,1]),\lambda)$. Fix an orthonormal basis $\{e_n\}_{n\in\mathbb{N}}$ of $H$. Let $\mathcal I\colon[0,1]\rightarrow C([0,T];H)$ be the map defined as
\[
\mathcal I(r) \coloneqq  re_1, \qquad \forall\ r\in[0,1],
\]
where $re_1$ is the constant path of $C([0,T];H)$ identically equal to $re_1$.
Clearly $\mathcal{I}$ is  continuous, hence measurable.
Let $\tilde\mu$ denote the image measure of $\lambda$ by $\mathcal I$. Notice that $\tilde\mu\in{\cal P}_2(C([0,T];H))$. From 2) it follows that there exists a continuous and ${\cal B}([0,T])\otimes{\cal H}$-measurable process $\tilde\xi\colon[0,T]\times\Omega\rightarrow H$ with law equal to $\tilde\mu$.

Now, define the map $\Pi\colon C([0,T];H)\rightarrow\mathbb{R}$ as
\[
\Pi(x) \coloneqq  \langle x_0,e_1\rangle_H, \qquad \forall\,x\in C([0,T];H),
\]
where we recall that $x_0$ is the value of the path $x$ at time $t=0$. Consider the random variable $U_{\cal H}\colon\Omega\rightarrow\mathbb{R}$ given by $U_{\cal H}\coloneqq \Pi(\tilde\xi)$. Notice that $U_{\cal H}$ is ${\cal H}$-measurable. Moreover, $U_{\cal H}$ has uniform distribution on $[0,1]$. As a matter of fact, it holds that
\begin{equation*}
  \begin{split}
    \mathbb{P}\big(U_{\cal H}\in  \mathfrak B \big) = \mathbb{P}\big(\Pi(\tilde\xi)\in \mathfrak B \big) &= \mathbb{P}\big(\langle\tilde\xi_0,e_1\rangle_H\in \mathfrak B \big) = {\tilde\mu}\big(\big\{x\in C([0,T];H)\colon\langle x_0,e_1\rangle_H\in\mathfrak B \big\}\big) \\
&= \lambda\big(\big\{r\in[0,1]\colon\langle re_1,e_1\rangle_H\in \mathfrak B\big\}\big) = \lambda(\mathfrak B\cap [0,1]),
\end{split}
\end{equation*}
for every Borel subset $\mathfrak B$ of $\mathbb{R}$.
\end{proof}

\noindent We denote by $\mathbb{F}=({\cal F}_t)_{t\geq0}$ the filtration defined as
\[
{\cal F}_t = {\cal G}\vee{\cal F}_t^B\,, \qquad t\geq0 .
\]
Notice that $\mathbb{F}$ satisfies the usual conditions of completeness and right-continuity. We then denote by $\mathbf{S}_2(\mathbb{F})$ (resp.\ $\mathbf{S}_2({\cal G})$) the set of $H$-valued continuous $\mathbb{F}$-progressively measurable (resp.\ ${\cal B}([0,T])\otimes{\cal G}$-measurable) processes $\xi$ such that
\[
\|\xi\|_{\mathbf{S}_2} \coloneqq  \mathbb{E}\big[\|\xi\|_T^{2}\big]^{\frac{1}{2}} < \infty .
\]

\paragraph{Control processes.} {The \emph{space of control actions}, denoted by ${\rm U}$, satisfies the following standing assumption.}

\begin{StandingAssumption}{\bf(A$_{\rm U}$)}\label{A_U}\quad
{${\rm U}$ is a Borel space (see for instance Definition 7.7 in \cite{BertsekasShreve}), namely a Borel subset of some Polish space $E$.
$\mathscr U$ denotes its Borel $\sigma$-algebra.}
\end{StandingAssumption}

\begin{Remark}\label{R:Polish}
Our Assumption \textup{\ref{A_U}} is quite general. Indeed in most applications it is enough that ${\rm U}$ is a Polish space or even a Hilbert space, as in the examples of  Example \ref{ex:SE}.
\end{Remark}

Finally, we denote by ${\cal U}$ the \emph{space of control processes}, namely the family of all $\mathbb{F}$-progressively measurable processes $\alpha\colon[0,T]\times\Omega\rightarrow{\rm U}$.

\paragraph{Assumptions on the coefficients of the state equation.}
We consider a linear, possibly unbounded, operator $A:{\cal D}(A)\subset H \to H$ and two functions
\[
b,\;\sigma :~[0,T]\times C([0,T];H)\times {\cal P}_2\big(C([0,T];H)\big)\times{\rm U}\times{\cal P}({\rm U}) \longrightarrow
\ H,\;{\cal L}_2(K;H),
\]
where we recall that ${\cal P}({\rm U})$ is endowed with the topology of weak convergence. We impose the following assumptions on $A$, $b$, $\sigma$.

\begin{Assumption}{\bf(A$_{A,b,\sigma}$)}\label{A_A,b,sigma}\quad
\begin{enumerate}[(i)]
\item $A$ generates a $C_0$-semigroup of  pseudo-contractions  $\{e^{tA}, \; t \ge 0\}$ in $H$. Hence, there exists and $\eta\in \mathbb{R}$ such that
\begin{equation}\label{eq:Meta}
\|e^{tA}\|_{{\cal L}(H)} \leq e^{\eta t}.
\end{equation}
\item The functions $b$ and $\sigma$ are measurable.
\item\label{2020-06-20:01} There exists a constant $L$ such that
\begin{equation*}
  \begin{split}
    |b_t(x,\mu,u,\nu)-b_t(x',\mu',u,\nu)|_H &\leq L \big(\|x-x'\|_t + {\cal W}_2(\mu,\mu')\big), \\
\|\sigma_t(x,\mu,u,\nu)-\sigma_t(x',\mu',u,\nu)\|_{{\cal L}_2(K;H)} &\leq L \big(\|x-x'\|_t + {\cal W}_2(\mu,\mu')\big), \\
|b_t(0,\delta_0,u,\nu)|_H + \|\sigma_t(0,\delta_0,u,\nu)\|_{{\cal L}_2(K;H)} &\leq L,
\end{split}
\end{equation*}
for all $(t,u,\nu)\in[0,T]\times{\rm U}\times{\cal P}({\rm U})$, $(x,\mu),(x',\mu')\in C([0,T];H)\times{\cal P}_2(C([0,T];H))$, with $\delta_0$ being the Dirac measure at $0$, namely the probability measure on $C([0,T];H)$ putting mass equal to $1$ to the constant path $0$.
\end{enumerate}
\end{Assumption}

\begin{Remark}
Notice that, from the Lipschitz property of $b$ and $\sigma$ with respect to the variable $x\in C([0,T];H)$, it follows that $b$ and $\sigma$ satisfies the following \emph{non-anticipativity property:}
\[
b_t(x,\mu,u,\nu) = b_t(x_{\cdot\wedge t},\mu,u,\nu), \qquad\qquad \sigma_t(x,\mu,u,\nu) = \sigma_t(x_{\cdot\wedge t},\mu,u,\nu),
\]
for every $(t,x,\mu,u,\nu)\in[0,T]\times C([0,T];H)\times{\cal P}_2(C([0,T];H))\times{\rm U}\times{\cal P}({\rm U})$.
\end{Remark}

\begin{Remark}
The optimal control problem of McKean-Vlasov SDEs is sometimes called \emph{extended} or \emph{generalized} (see \cite{Acciaio19,CossoPham19}) when the coefficients also depend on the law of the control process $\mathbb{P}_{\alpha_s}$ (as in the present framework, see equation \eqref{cont-MKV-differential} below) or, more generally, on the joint law $\mathbb{P}_{(X_{\cdot\wedge s},\alpha_s)}$. Notice however that, under ``standard'' assumptions, the latter case is only apparently more general than our framework. As a matter of fact, consider for simplicity only the drift coefficient $b$ and suppose that it is replaced by a function $\bar b$ from $[0,T]\times C([0,T];H)\times{\rm U}\times{\cal P}(C([0,T];H)\times{\rm U})$ to $H$. Recall from \textup{\ref{A_A,b,sigma}} that the Lipschitz continuity of $b$ with respect to the law of the path reads as
\[
|b_t(x,\mu,u,\nu)-b_t(x,\mu',u,\nu)|_H \leq L {\cal W}_2(\mu,\mu'),
\]
for all $(t,x,u,\nu)\in[0,T]\times C([0,T];H)\times{\rm U}\times{\cal P}({\rm U})$, $\mu,\mu'\in{\cal P}_2(C([0,T];H))$. Then, it is reasonable to impose on $\bar b$ the following Lipschitz continuity with respect to the law of the path:
\[
|\bar b_t(x,u,\pi)-\bar b_t(x,u,\pi')|_H \leq L {\cal W}_2\big(\pi(\cdot\times{\rm U}),\pi'(\cdot\times{\rm U})\big),
\]
for every $(t,x,u)\in[0,T]\times C([0,T];H)\times{\rm U}$, $\pi,\pi'\in{\cal P}(C([0,T];H)\times{\rm U})$ with $\pi(\cdot\times{\rm U}),\pi'(\cdot\times{\rm U})\in{\cal P}_2(C([0,T];H))$ and $\pi(C([0,T];H)\times\cdot)=\pi'(C([0,T];H)\times\cdot)$. It follows directly from this assumption that $\bar b_t(x,u,\pi)=\bar b_t(x,u,\pi')$ whenever the marginals of $\pi$ and $\pi'$ coincide: $\pi(\cdot\times{\rm U})=\pi'(\cdot\times{\rm U})$ and $\pi(C([0,T];H)\times\cdot)=\pi'(C([0,T];H)\times\cdot)$. This shows that $\bar b$ depends on $\pi$ only through its marginals.
\end{Remark}

\subsection{State equation}

Given an initial time $t\in[0,T]$, an initial path $\xi\in\mathbf{S}_2(\mathbb{F})$, a control process $\alpha\in{\cal U}$, the state process evolves according to the following controlled path-dependent McKean-Vlasov stochastic differential equation:
\begin{equation}\label{cont-MKV-differential}
\begin{cases}
dX_s = AX_s+ b_s\big(X,\mathbb{P}_X,\alpha_s,\mathbb{P}_{\alpha_s}\big)ds
+\sigma_s\big(X,\mathbb{P}_X,\alpha_s,\mathbb{P}_{\alpha_s}\big)dB_s &s>t \\
X_s = \xi_s & s\leq t.
\end{cases}
\end{equation}

\begin{Definition}
Fix $t\in[0,T]$, $\xi\in\mathbf{S}_2(\mathbb{F})$, $\alpha\in{\cal U}$. A \textbf{mild solution} of \eqref{cont-MKV-differential} is a process $X=(X_s)_{s\in[0,T]}$ in $\mathbf{S}_2(\mathbb{F})$ satisfying
  \begin{multline*}
X_s = e^{((s-t)\vee 0)A}\,\xi_{s\wedge t}+\int_t^{s\vee t}
e^{(s-r)A}\,b_r\big(X,\mathbb{P}_{X_{\cdot\wedge r}},\alpha_r,\mathbb{P}_{\alpha_r}\big)\,dr\nonumber \\
 + \int_t^{s\vee t}
e^{(s-r)A}\,\sigma_r\big(X,\mathbb{P}_{X_{\cdot\wedge r}},\alpha_r,\mathbb{P}_{\alpha_r}\big)\,dB_r\qquad \forall s\in[0,T],\,\mathbb{P}\text{-a.s.}
\end{multline*}
\end{Definition}

\begin{Proposition}\label{Prop-diff-MKVPD}
Fix $t\in[0,T]$, $\xi\in\mathbf{S}_2(\mathbb{F})$, $\alpha\in{\cal U}$. Under \textup{\ref{A_A,b,sigma}}, equation \eqref{cont-MKV-differential} admits a unique mild solution
$X^{t,\xi,\alpha}\in\mathbf{S}_2(\mathbb{F})$.
The map
\[
    [0,T]\times\mathbf{S}_2(\mathbb{F}) \rightarrow \mathbf{S}_2(\mathbb{F}),
(t,\xi) \mapsto  X^{t,\xi,\alpha}
\]
is jointly continuous in $(t,\xi)$, uniformly with respect to $\alpha\in{\cal U}$, and Lipschitz continuous in $\xi$, uniformly in $t$ and $\alpha$.
 Moreover, $X^{t,\xi,\alpha}=X^{t,\xi_{\cdot\wedge t},\alpha}$ and there exists a constant $C$, independent of $t,\xi,\alpha$, such that
\begin{equation}\label{EstimateX}
\big\|X^{t,\xi,\alpha}\big\|_{\mathbf{S}_2} \leq C\,\big(1 + \|\xi_{\cdot\wedge t}\|_{\mathbf{S}_2}\big).
\end{equation}
\end{Proposition}
\begin{proof}[\textbf{Proof.}]
See Appendix \ref{App:StateEquation}.
\end{proof}

\begin{Remark}\label{rm:convSEinitialdatum}
From Proposition~\ref{Prop-diff-MKVPD} we have, in particular, for $r,t\in[0,T], \xi\in \mathbf{S}_2(\mathbb{F})$,
\begin{equation}
  \label{2020-10-11:03}
  \begin{split}
      \lim_{r\rightarrow t} \sup_{\alpha\in \mathcal{U}}  \|X^{\alpha,t,\xi}_{r\wedge \cdot}-\xi_{t\wedge \cdot}\|_{\mathbf{S}_2}
  \ &\leq \
  \lim_{r\rightarrow t}
   \left(
\sup_{\alpha\in \mathcal{U}}  \|X^{\alpha,t,\xi}_{r\wedge \cdot}-
  X^{\alpha,r,\xi}_{r\wedge \cdot}\|_{\mathbf{S}_2}
+\|\xi_{r\wedge \cdot}
-\xi_{t\wedge \cdot}\|_{\mathbf{S}_2} \right)\\
&\leq \
\lim_{r\rightarrow t}
\left(
  \sup_{\alpha\in \mathcal{U}}
  \|X^{\alpha,t,\xi}-
  X^{\alpha,r,\xi}\|_{\mathbf{S}_2}
+\|\xi_{r\wedge \cdot}
  -\xi_{t\wedge \cdot}\|_{\mathbf{S}_2} \right) \ = \ 0,
\end{split}
\end{equation}
where we have used the fact that
$X^{\alpha,r,\xi}_{r\wedge \cdot}=\xi_{r\wedge \cdot}$.
\end{Remark}

Let $\{A_n\}_{n\in\mathbb{N}}$ be the Yosida approximation of $A$, i.e. $A_n=nA(n-A)^{-1}$, for $n\in \mathbb{N},n> \eta$, with $\eta$ as in \eqref{eq:Meta}. Denote by $S^n$ the uniformly continuous semigroup generated by $A_n$.
Notice that
$S^n$ is a pseudo-contraction semigroup for all $n\in \mathbb{N}$, $n> \eta$, and that, for some $\tilde \eta>0$, $\|S^n_t\|_{\mathcal{L}(H)}\leq e^{\tilde{\eta}t}$
uniformly for $n\in \mathbb{N}, t\geq 0$.
In particular,
we can apply Proposition~\ref{Prop-diff-MKVPD} to obtain existence of a unique mild solution
 $X^{n,t,\xi,\alpha}$
to the following equation:
\begin{equation}\label{cont-MKV-differential-An}
\begin{cases}
dX^n_s = A_nX^n_s+ b_s\big(X^n,\mathbb{P}_{X^n},\alpha_s,\mathbb{P}_{\alpha_s}\big)ds
+\sigma_s\big(X^n,\mathbb{P}_{X^n},\alpha_s,\mathbb{P}_{\alpha_s}\big)dB_s, &\qquad s>t, \\
X^n_s = \xi_s, &\qquad s\leq  t.
\end{cases}
\end{equation}

\begin{Proposition}\label{Prop-diff-MKVPD-An}
  There exists a constant $C>0$ such that
  \begin{equation}
    \label{2020-10-11:07}
    \sup_{\substack{\alpha\in \mathcal{U}\\n\in \mathbb{N}\\t\in[0,T]}}
    \|X^{n,t,\xi,\alpha}-X^{n,t,\xi',\alpha}\|_{\mathbf{S}_2} \ \leq \ C\|\xi-\xi'\|_{\mathbf{S}_2},\qquad \forall\,\xi,\xi' \in \mathbf{S}_2(\mathbb{F}).
  \end{equation}
  Moreover,
  \begin{equation}
    \label{2020-10-11:08}
    \lim_{\substack{t\rightarrow t'\\n\rightarrow \infty}}
    \|X^{n,t,\xi,\alpha}-X^{t',\xi,\alpha}\|_{\mathbf{S}_2} \ = \ 0,\qquad \forall\,\alpha\in \mathcal{U},\,\xi\in \mathbf{S}_2(\mathbb{F}),\,t'\in [0,T].
  \end{equation}
\end{Proposition}

\begin{proof}[\textbf{Proof.}]
See Appendix \ref{App:StateEquation}.
\end{proof}

\begin{Remark}\label{rm:unboundedcontrol}
In the third inequality of Assumption \ref{A_A,b,sigma}-(iv) we assume, for simplicity, the boundedness of $b$ and $\sigma$ with respect to the controls.
In many applications (e.g. in linear quadratic control cases see Example \ref{ex:SE} below) the state equation contains unbounded control terms. It is therefore interesting to understand what happens in such cases.
Assume that ${\rm U}$ is a closed subset of a Hilbert space and that the right-hand side of the third inequality of Assumption \ref{A_A,b,sigma}-(iv) is replaced by
$L(1+|u|_{{\rm U}})$. In this case Proposition \ref{Prop-diff-MKVPD} still holds, assuming that $\alpha_{\cdot} \in L^2([0,T]\times \Omega;{\rm U})$, with the estimate \eqref{EstimateX} replaced by
\begin{equation}\label{EstimateXnew}
\big\|X^{t,\xi,\alpha}\big\|_{\mathbf{S}_2} \leq C\,\left[1 + \|\xi_{\cdot\wedge t}\|_{\mathbf{S}_2} +\ \left(\mathbb{E}\int_t^T |\alpha_{s}|^2_{{\rm U}} ds\right)\right].
\end{equation}
The only difference is that the joint continuity in $(t,\xi)$ is uniform only with respect to $\alpha$ belonging to the bounded sets of $L^2([0,T]\times \Omega;{\rm U})$. Consequently also the limit in \eqref{2020-10-11:03}
is uniform only in the same sense.
Similarly, also  Proposition \ref{Prop-diff-MKVPD-An} still holds but with the supremum in $\alpha$ belonging to the bounded sets of $L^2([0,T]\times \Omega;{\rm U})$.
\end{Remark}

\begin{Example}\label{ex:SE}
Examples of problems where the state equation has the above structure.
\begin{itemize}
  \item[(i)] Lifecycle optimal portfolio problem. In such problems (as it is done in \cite{BiffisGozziProsdocimi20,DjeicheGozziZancoZanella20}),
      it is natural to model the dynamics of the labor income ``$y$'' (which is one of the state equations\footnote{The equation for $y$ is not controlled, however $y$ is part of the state as it appears in the wealth dynamics, which is controlled.}
      of the optimal portfolio problem) using one-dimensional stochastic delay ODE of McKean-Vlasov type as follows (here $\phi\in L^2(-d,0)$ is a given datum and $Z$ is a one-dimensional Brownian motion).
      $$
      dy(t) \ = \ \left[b_0\big(\mathbb{P}_{y(t)}\big) +
      \int_{-d}^{0}y(t+\xi)\,\phi(\xi)\,d\xi\right]dt + \sigma\,y(t)\,dZ(t).
      $$
      Such equations can be rephrased as SDEs in the Hilbert space $\mathbb{R}\times L^2(-d,0)$ and the resulting dynamics falls into the class treated in the present section.
\item[(ii)] Optimal investment with vintage capital.
In such problems (see e.g. \cite{BarucciGozzi98,BarucciGozzi01,Feichtingeretal06JET,FaggianGozzi10})
the state variable ``$x$'' is the capital and the control variable is the investment ``$u$'' both depending on time and vintage. In the above papers $x$ is required to satisfy a first-order PDE which is rewritten as an ODE in the space $L^2(0,\bar s)$ for some given $\bar s>0$ (the maximum vintage).
If one wants to take into  account stochastic disturbances,  the state equation, written in $L^2(0,\bar s)$, becomes
(here $B$ is a cylindrical Wiener process):
$$
dx(t) \ = \ \left[Ax(t) + \delta x(t) +Cu(t)\right]dt + \sigma\,dB(t),
$$
for suitable linear operators $A$ and $C$ and real parameters $\delta$ and $\sigma$.
If one aims to take account of the behavior of the other investors one has to require that the coefficients of such SPDE (as $\delta$ or the ones hidden in $A$ and $C$ here) depend  on the distribution of $k$ and $u$ and, possibly, on their past values.
If the path-dependency arises only for the state variable $k$, such an equation falls in the class treated here.
A simple way of including the above features would be to require the discount factor $\delta$ to depend on both the path of $k$ and its law, i.e.
$\delta=\delta \left(k(\cdot\wedge t), \mathbb{P}_{k(\cdot\wedge t)} \right)$.
\end{itemize}
\end{Example}

\section{The optimal control problem}
\label{S:ControlPb}

\subsection{Reward functional and lifted value function}

We are given two functions
\begin{align*}
f\colon[0,T]\times C([0,T];H)\times {\cal P}_2\big(C([0,T];H)\big)\times{\rm U}\times{\cal P}({\rm U}) &\longrightarrow \mathbb{R} \\
g\colon C([0,T];H)\times {\cal P}_2\big(C([0,T];H)\big) &\longrightarrow \mathbb{R}
\end{align*}
on which we impose the following assumptions.

\begin{Assumption}{\bf(A$_{f,g}$)}\label{A_f,g}\quad
\begin{enumerate}[(i)]
\item The functions $f$ and $g$ are measurable.
\item The function $f$ satisfies the non-anticipativity property:
\[
f_t(x,\mu,u,\nu) = f_t(x_{\cdot\wedge t},\mu,u,\nu),
\]
for all $(t,x,\mu,u,\nu)\in[0,T]\times C([0,T];H)\times{\cal P}_2(C([0,T];H))\times{\rm U}\times{\cal P}({\rm U})$.
\item There exists a locally bounded function $h\colon[0,\infty)\rightarrow[0,\infty)$ such that
\[
|f_t(x,\mu,u,\nu)| \leq h\big({\cal W}_2(\mu,\delta_0)\big)\big(1 + \|x\|^2_t\big), \qquad |g(x,\mu)| \leq h\big({\cal W}_2(\mu,\delta_0)\big)\big(1 + \|x\|^2_T\big),
\]
for all $(t,x,\mu,u,\nu)\in[0,T]\times C([0,T];H)\times{\cal P}_2(C([0,T];H))\times{\rm U}\times{\cal P}({\rm U})$.
\end{enumerate}
\end{Assumption}

\noindent We will also need the following continuity assumption on $f$ and $g$.

\begin{Assumption}{{\bf(A}$_{f,g}${\bf)}$_\text{\textnormal{cont}}$}\label{A_f,g_cont}
The function $f$ is locally uniformly continuous in $(x,\mu)$ uniformly with respect to $(t,u,\nu)$. Similarly, $g$ is locally uniformly continuous. More precisely, it holds that: for every $\varepsilon>0$ and $n\in\mathbb{N}$ there exists $\delta=\delta(\varepsilon,n)>0$ such that, for every $(t,u,\nu)\in[0,T]\times{\rm U}\times{\cal P}({\rm U})$, $(x,\mu),(x',\mu')\in C([0,T];H)\times{\cal P}_2(C([0,T];H))$, with $\|x\|_T+{\cal W}_2(\mu,\delta_0)\leq n$ and $\|x'\|_T+{\cal W}_2(\mu',\delta_0)\leq n$,
\begin{align*}
&\|x - x'\|_t + {\cal W}_2(\mu,\mu') \leq \delta \\
&\hspace{2cm}\Longrightarrow \quad |f(t,x,\mu,u,\nu) - f(t,x',\mu',u,\nu)| \leq \varepsilon \; \text{ and } \; |g(x,\mu) - g(x',\mu')| \leq \varepsilon.
\end{align*}
\end{Assumption}

Under Assumptions \textup{\ref{A_A,b,sigma}} and \textup{\ref{A_f,g}}, from Proposition \ref{Prop-diff-MKVPD} we get that the \emph{reward functional} $J$, given by
\[
J(t,\xi,\alpha) = \mathbb{E}\bigg[\int_t^Tf_s\big(X^{t,\xi,\alpha},\mathbb{P}_{X^{t,\xi,\alpha}_{\cdot\wedge s}},\alpha_s,\mathbb{P}_{\alpha_s}\big)\,ds + g\big(X^{t,\xi,\alpha},\mathbb{P}_{X^{t,\xi,\alpha}}\big)\bigg],
\]
is well-defined for any $(t,\xi,\alpha)\in [0,T]\times\mathbf{S}_2(\mathbb{F})\times{\cal U}$. We then consider the function $V\colon[0,T]\times\mathbf{S}_2(\mathbb{F})\longrightarrow\mathbb{R}$, to which we refer as the \emph{lifted value function}, defined as
\begin{equation}\label{V_aux}
V(t,\xi) = \sup_{\alpha\in {\cal U}} J(t,\xi,\alpha)\,, \qquad \forall\,(t,\xi)\in[0,T]\times\mathbf{S}_2(\mathbb{F})\,.
\end{equation}

\begin{Remark}\label{R:V_non_ant}
Recall from Proposition \ref{Prop-diff-MKVPD} that $X^{t,\xi,\alpha}$ only involves the values of $\xi$ up to time $t$, namely it holds that $X^{t,\xi,\alpha}=X^{t,\xi_{\cdot\wedge t},\alpha}$. As a consequence, both $J$ and $V$ satisfy the \emph{non-anticipativity property:}
\[
J(t,\xi,\alpha) = J(t,\xi_{\cdot\wedge t},\alpha), \qquad\qquad V(t,\xi) = V(t,\xi_{\cdot\wedge t}),
\]
for every $(t,\xi)\in[0,T]\times\mathbf{S}_2(\mathbb{F})$, $\alpha\in{\cal U}$.
\end{Remark}

\begin{Remark}\label{rm:quadraticreward}
In Remark \ref{rm:unboundedcontrol} we looked at the case when ${\rm U}$ is a Hilbert space and the coefficients of the state equation have linear growth in the controls. In such a case, in order to have a well-defined reward functional $J$, we need some compensating term in the current reward $f$. A typical assumption which guarantees that $J$ is well-defined is that the first inequality of Assumption \ref{A_f,g}-(iii) is replaced by
\[
f_t(x,\mu,u,\nu) \ \leq \ h\big(\mathcal{W}_2(\mu,\delta_0)\big)\,\big(1+\|x\|_t^2\big) - C |u|_{{\rm U}}^\theta,
\]
for some $\theta>1$ and $C$ $>$ $0$.  This would include some typical linear-quadratic control cases. For example in the case of optimal investment problems mentioned in Example \ref{ex:SE}
a typical form of $f$ would be (recall that here $H=L^2(0,\bar s)$)
\begin{equation}\label{eq:costinvest}
f_t(x,\mu,u,\nu) \ = \ f_t(x,u) \ = \ e^{-rt}[\<a_1,x(t)\>_H-\<a_2,u(t)\>_H-
\<Mu(t),u(t)\>_H],
\end{equation}
where $r$ is the interest rate, $a_1,a_2\in L^2(0,\bar s)$,
and $M$ is a suitable multiplication operator
in $L^2(0,\bar s)$.
\end{Remark}

\begin{Proposition}\label{P:Cont}
Suppose that \textup{\ref{A_A,b,sigma}} and \textup{\ref{A_f,g}} hold. The function $V$ satisfies a quadratic growth condition: there exists a constant $C$ such that
\begin{equation}\label{EstimateV}
|V(t,\xi)| \leq C\,\big(1 + \|\xi_{\cdot\wedge t}\|_{\mathbf{S}_2}^2\big),
\end{equation}
for every $(t,\xi)\in[0,T]\times\mathbf{S}_2(\mathbb{F})$. Moreover, if in addition \textup{\ref{A_f,g_cont}} holds, the map $V\colon[0,T]\times\mathbf{S}_2(\mathbb{F})\rightarrow\mathbb{R}$ is jointly continuous.
\end{Proposition}
\begin{proof}[\textbf{Proof.}]
We split the proof into two steps.

\vspace{1mm}

\noindent\emph{\textbf{Step 1}. Proof of estimate \eqref{EstimateV}.} From the definition of $J$, we have
\[
|J(t,\xi,\alpha)| \leq \mathbb{E}\bigg[\int_t^T\big|f_s\big(X^{t,\xi,\alpha},\mathbb{P}_{X^{t,\xi,\alpha}_{\cdot\wedge s}},\alpha_s,\mathbb{P}_{\alpha_s}\big)\big|\,ds\bigg] + \mathbb{E}\big[\big|g\big(X^{t,\xi,\alpha},\mathbb{P}_{X^{t,\xi,\alpha}}\big)\big|\big].
\]
By the quadratic growth of $f$ and $g$, together with estimate \eqref{EstimateX}, we see that there exists a constant $C$ such that
\begin{equation}\label{EstimateJ}
|J(t,\xi,\alpha)| \leq C\,\big(1 + \|\xi_{\cdot\wedge t}\|_{\mathbf{S}_2}^2\big),
\end{equation}
for every $(t,\xi,\alpha)\in[0,T]\times\mathbf{S}_2(\mathbb{F})\times{\cal U}$. Then, estimate \eqref{EstimateV} follows directly from the definition of $V$ and the fact that \eqref{EstimateJ} holds uniformly with respect to $\alpha\in{\cal U}$.

\vspace{1mm}

\noindent\emph{\textbf{Step 2}. Continuity of $V$.} We begin noticing that, for every $(t,\xi),(s,\eta)\in[0,T]\times\mathbf{S}_2(\mathbb{F})$,
\[
|V(t,\xi) - V(s,\eta)| \leq \sup_{\alpha\in{\cal U}} |J(t,\xi,\alpha) - J(s,\eta,\alpha)|.
\]
Then, the continuity of $V$ follows once we prove that $J$ is continuous in $(t,\xi)$ uniformly with respect to $\alpha$, namely that the following property holds: for every $\varepsilon>0$ and every $(t,\xi)\in[0,T]\times\mathbf{S}_2(\mathbb{F})$, there exists $\delta=\delta(\varepsilon,t,\xi)>0$ such that, for every $(s,\eta,\alpha)\in[0,T]\times\mathbf{S}_2(\mathbb{F})\times{\cal U}$,
\[
|t - s|\,\leq\,\delta \quad \text{ and } \quad \|\xi - \eta\|_{\mathbf{S}_2} \leq \delta \qquad \Longrightarrow \qquad |J(t,\xi,\alpha) - J(s,\eta,\alpha)| \leq \varepsilon.
\]
Such a property is a straightforward consequence of the last statement of Proposition \ref{Prop-diff-MKVPD} and of assumption
\textup{\ref{A_f,g_cont}}.
\end{proof}

\subsection{Dynamic programming principle for $V$}

In this section we prove the dynamic programming principle for the lifted value function $V$ defined in \eqref{V_aux}.

\begin{Theorem}\label{T:DPP}
Suppose that \textup{\ref{A_A,b,sigma}} and \textup{\ref{A_f,g}} hold. The lifted value function $V$ satisfies the \textbf{dynamic programming principle}: for every $t,s\in[0,T]$, with $t\leq s$, and every $\xi\in\mathbf{S}_2(\mathbb{F})$ it holds that
\[
V(t,\xi) = \sup_{\alpha\in{\cal U}}\bigg\{\mathbb{E}\bigg[\int_t^s f_r\big(X^{t,\xi,\alpha},\mathbb{P}_{X^{t,\xi,\alpha}_{\cdot\wedge r}},\alpha_r,\mathbb{P}_{\alpha_r}\big)\,dr\bigg] + V\big(s, X^{t,\xi,\alpha}\big)\bigg\}.
\]
\end{Theorem}

\begin{proof}[\textbf{Proof.}]
Set
\[
\Lambda(t,\xi) \coloneqq  \sup_{\alpha\in{\cal U}}\bigg\{\mathbb{E}\bigg[\int_t^s f_r\big(X^{t,\xi,\alpha},\mathbb{P}_{X^{t,\xi,\alpha}_{\cdot\wedge r}},\alpha_r,\mathbb{P}_{\alpha_r}\big)\,dr\bigg] + V\big(s, X^{t,\xi,\alpha}\big)\bigg\}.
\]
\emph{\textbf{Step 1}. Proof of the inequality $\Lambda(t,\xi)\geq V(t,\xi)$.} For every fixed $\alpha\in{\cal U}$, the lifted value function at $(s,X^{t,\xi,\alpha})$ is given by
\[
V(s,X^{t,\xi,\alpha}) = \sup_{\beta\in{\cal U}}\mathbb{E}\bigg[\int_s^T f_r\Big(X^{s,X^{t,\xi,\alpha},\beta},\mathbb{P}_{X^{s,X^{t,\xi,\alpha},\beta}_{\cdot\wedge r}},\beta_r,\mathbb{P}_{\beta_r}\Big)\,dr + g\Big(X^{s,X^{t,\xi,\alpha},\beta},\mathbb{P}_{X^{s,X^{t,\xi,\alpha},\beta}}\Big)\bigg].
\]
Choosing $\beta=\alpha$, we find
\[
V(s,X^{t,\xi,\alpha}) \geq \mathbb{E}\bigg[\int_s^T f_r\Big(X^{s,X^{t,\xi,\alpha},\alpha},\mathbb{P}_{X^{s,X^{t,\xi,\alpha},\alpha}_{\cdot\wedge r}},\alpha_r,\mathbb{P}_{\alpha_r}\Big)\,dr + g\Big(X^{s,X^{t,\xi,\alpha},\alpha},\mathbb{P}_{X^{s,X^{t,\xi,\alpha},\alpha}}\Big)\bigg].
\]
By the uniqueness property for equation \eqref{cont-MKV-differential} stated in Proposition \ref{Prop-diff-MKVPD}, we obtain the flow property
\[
X^{t,\xi,\alpha} = X^{s,X^{t,\xi,\alpha},\alpha}.
\]
Hence
\[
V(s,X^{t,\xi,\alpha}) \geq \mathbb{E}\bigg[\int_s^T f_r\big(X^{t,\xi,\alpha},\mathbb{P}_{X^{t,\xi,\alpha}_{\cdot\wedge r}},\alpha_r,\mathbb{P}_{\alpha_r}\big)\,dr + g\big(X^{t,\xi,\alpha},\mathbb{P}_{X^{t,\xi,\alpha}}\big)\bigg].
\]
Adding to both sides the quantity $\mathbb{E}\int_t^s f_r(X^{t,\xi,\alpha},\mathbb{P}_{X^{t,\xi,\alpha}_{\cdot\wedge r}},\alpha_r,\mathbb{P}_{\alpha_r})\,dr$, we get
\[
\Lambda(t,\xi) \geq \mathbb{E}\bigg[\int_t^T f_r\big(X^{t,\xi,\alpha},\mathbb{P}_{X^{t,\xi,\alpha}_{\cdot\wedge r}},\alpha_r,\mathbb{P}_{\alpha_r}\big)\,dr + g\big(X^{t,\xi,\alpha},\mathbb{P}_{X^{t,\xi,\alpha}}\big)\bigg].
\]
As the latter inequality holds true for every $\alpha\in{\cal U}$, we conclude that $\Lambda(t,\xi)\geq V(t,\xi)$.

\vspace{1mm}

\noindent\emph{\textbf{Step 2}. Proof of the inequality $\Lambda(t,\xi)\leq V(t,\xi)$.} For every $\varepsilon>0$, let $\alpha^\varepsilon\in{\cal U}$ be such that
\begin{equation}\label{DPP_proof1}
\Lambda(t,\xi) \leq  \mathbb{E}\bigg[\int_t^s f_r\big(X^{t,\xi,\alpha^\varepsilon},\mathbb{P}_{X^{t,\xi,\alpha^\varepsilon}_{\cdot\wedge r}},\alpha_r^\varepsilon,\mathbb{P}_{\alpha_r^\varepsilon}\big)\,dr\bigg] + V(s,X^{t,\xi,\alpha^\varepsilon}) + \varepsilon.
\end{equation}
From the definition of $V(s,X^{t,\xi,\alpha^\varepsilon})$, it follows that there exists $\beta^\varepsilon\in{\cal U}$ such that
\begin{align}\label{DPP_proof2}
V(s,X^{t,\xi,\alpha^\varepsilon}) &\leq \mathbb{E}\bigg[\int_s^T f_r\Big(X^{s,X^{t,\xi,\alpha^\varepsilon},\beta^\varepsilon},\mathbb{P}_{X^{s,X^{t,\xi,\alpha^\varepsilon},\beta^\varepsilon}_{\cdot\wedge r}},\beta_r^\varepsilon,\mathbb{P}_{\beta_r^\varepsilon}\Big)\,dr \\
&\quad + \, g\Big(X^{s,X^{t,\xi,\alpha^\varepsilon},\beta^\varepsilon},\mathbb{P}_{X^{s,X^{t,\xi,\alpha^\varepsilon},\beta^\varepsilon}}\Big)\bigg] + \varepsilon. \notag
\end{align}
Set
\[
\gamma^\varepsilon = \alpha^\varepsilon\,\mathds{1}_{[0,s]} + \beta^\varepsilon\,\mathds{1}_{(s,T]}.
\]
Notice that $\gamma^\varepsilon\in{\cal U}$. Using again the uniqueness property for equation \eqref{cont-MKV-differential}, we get
\[
X^{s,X^{t,\xi,\alpha^\varepsilon},\beta^\varepsilon} = X^{t,\xi,\gamma^\varepsilon}.
\]
Hence, \eqref{DPP_proof2} becomes
\[
V(s,X^{t,\xi,\alpha^\varepsilon}) \leq \mathbb{E}\bigg[\int_s^T f_r\big(X^{t,\xi,\gamma^\varepsilon},\mathbb{P}_{X^{t,\xi,\gamma^\varepsilon}_{\cdot\wedge r}},\gamma_r^\varepsilon,\mathbb{P}_{\gamma_r^\varepsilon}\big)\,dr + g\big(X^{t,\xi,\gamma^\varepsilon},\mathbb{P}_{X^{t,\xi,\gamma^\varepsilon}}\big)\bigg] + \varepsilon.
\]
Then, by \eqref{DPP_proof1} it follows that
\begin{align}\label{DPP_proof3}
\Lambda(t,\xi) \leq \mathbb{E}\bigg[\int_t^s f_r\big(X^{t,\xi,\alpha^\varepsilon},\mathbb{P}_{X^{t,\xi,\alpha^\varepsilon}_{\cdot\wedge r}},\alpha_r^\varepsilon,\mathbb{P}_{\alpha_r^\varepsilon}\big)\,dr &+ \int_s^T f_r\big(X^{t,\xi,\gamma^\varepsilon},\mathbb{P}_{X^{t,\xi,\gamma^\varepsilon}_{\cdot\wedge r}},\gamma_r^\varepsilon,\mathbb{P}_{\gamma_r^\varepsilon}\big)\,dr \notag \\
&+ g\big(X^{t,\xi,\gamma^\varepsilon},\mathbb{P}_{X^{t,\xi,\gamma^\varepsilon}}\big)\bigg] + 2\varepsilon.
\end{align}
From the definition of $\gamma^\varepsilon$, we see that
\[
X^{t,\xi,\alpha^\varepsilon}_{\cdot\wedge s} = X^{t,\xi,\gamma^\varepsilon}_{\cdot\wedge s}.
\]
As a consequence, we can rewrite \eqref{DPP_proof3} in terms of the only process $X^{t,\xi,\gamma^\varepsilon}$ as
\[
\Lambda(t,\xi) \leq \mathbb{E}\bigg[\int_t^T \!\! f_r\big(X^{t,\xi,\gamma^\varepsilon},\mathbb{P}_{X^{t,\xi,\gamma^\varepsilon}_{\cdot\wedge r}},\gamma_r^\varepsilon,\mathbb{P}_{\gamma_r^\varepsilon}\big)dr + g\big(X^{t,\xi,\gamma^\varepsilon},\mathbb{P}_{X^{t,\xi,\gamma^\varepsilon}}\big)\bigg] + 2\varepsilon \leq V(t,\xi) + 2\varepsilon.
\]
The claim follows from the arbitrariness of $\varepsilon$.
\end{proof}

\subsection{Law invariance property of the lifted value function $V$}

In the present section we introduce the \emph{value function} of the optimal control problem, which is a real-valued map defined on $[0,T]\times{\cal P}_2(C([0,T];H))$ (see \eqref{v}). In order to define such a value function, it is necessary to prove that the map $V$ satisfies the following \emph{law invariance property:} for every $t\in[0,T]$ and every $\xi,\eta\in\mathbf{S}_2(\mathbb{F})$ it holds that
\[
V(t,\xi) = V(t,\eta).
\]
This is the subject of the next theorem.

\begin{Theorem}\label{T:id-law}
Suppose that \textup{\ref{A_A,b,sigma}} and \textup{\ref{A_f,g}} hold. Fix $t\in[0,T]$ and $\xi,\eta\in\mathbf{S}_2(\mathbb{F})$, with $\mathbb{P}_\xi=\mathbb{P}_\eta$. Suppose that there exist two random variables $U_\xi$ and $U_\eta$ having uniform distribution on $[0,1]$, being ${\cal F}_t$-measurable and such that $\xi$ and $U_\xi$ (resp.\ $\eta$ and $U_\eta$) are independent. Then, it holds that
\[
V(t,\xi) = V(t,\eta).
\]
If in addition \textup{\ref{A_f,g_cont}} holds, the map $V$ satisfies the \textbf{law invariance property}: for every $t\in[0,T]$ and every $\xi,\eta\in\mathbf{S}_2(\mathbb{F})$, with $\mathbb{P}_\xi=\mathbb{P}_\eta$, it holds that
\[
V(t,\xi) = V(t,\eta).
\]
\end{Theorem}
\begin{proof}[\textbf{Proof.}]
We split the proof into two steps.

\vspace{1mm}

\noindent\textbf{\emph{Step 1.}} \emph{Only \textup{\ref{A_A,b,sigma}} and \textup{\ref{A_f,g}} hold.} Fix $t\in[0,T]$, $\xi,\eta\in\mathbf{S}_2(\mathbb{F})$, with $\mathbb{P}_\xi=\mathbb{P}_\eta$, and let $U_\xi$, $U_\eta$ be ${\cal F}_t$-measurable random variables with uniform distribution on $[0,1]$, such that $\xi$ and $U_\xi$ (resp.\ $\eta$ and $U_\eta$) are independent.

By Remark \ref{R:V_non_ant} we can assume that $\xi=\xi_{\cdot\wedge t}$ and $\eta=\eta_{\cdot\wedge t}$, so, in particular, both $\xi$ and $\eta$ are ${\cal B}([0,T])\otimes{\cal F}_t$-measurable (this is needed in order to apply Lemma \ref{L:alpha=a} of Appendix \ref{App:LawInvariance}). Now, given $\alpha\in{\cal U}$ consider the function $\mathrm a\colon[0,T]\times\Omega\times C([0,T];H)\times[0,1]\rightarrow{\rm U}$ introduced in Lemma \ref{L:alpha=a}. Recall from \eqref{EqLaw_bis} that
\[
\Big((\xi_s)_{s\in[0,T]},(\mathrm a_s(\xi,U_\xi))_{s\in[t,T]},(B_s-B_t)_{s\in[t,T]}\Big) \overset{\mathscr L}{=} \Big((\xi_s)_{s\in[0,T]},(\alpha_s)_{s\in[t,T]},(B_s-B_t)_{s\in[t,T]}\Big),
\]
where $\overset{\mathscr L}{=}$ stands for equality in law (between random objects defined on $(\Omega,{\cal F},\mathbb{P})$). Then, notice that (here we use again that $\xi$ and $\eta$ are ${\cal B}([0,T])\otimes{\cal F}_t$-measurable, so, in particular, they are independent of $(B_s-B_t)_{s\in[t,T]}$)
\begin{equation}\label{Equality_in_law}
\Big((\xi_s)_{s\in[0,T]},(\alpha_s)_{s\in[t,T]},(B_s-B_t)_{s\in[t,T]}\Big) \overset{\mathscr L}{=} \Big((\eta_s)_{s\in[0,T]},(\beta_s)_{s\in[t,T]},(B_s-B_t)_{s\in[t,T]}\Big),
\end{equation}
where
\[
\beta \coloneqq  \big(\mathrm a_s(\eta,U_\eta)\big)_{s\in[0,T]}.
\]
Observe that $\beta\in{\cal U}$ and, by \eqref{Equality_in_law},
\[
\big((X_s^{t,\xi,\alpha})_{s\in[t,T]},(\alpha_s)_{s\in[t,T]}\big) \overset{\mathscr L}{=} \big((X_s^{t,\eta,\beta})_{s\in[t,T]},(\beta_s)_{s\in[t,T]}\big),
\]
where the above equality in law can be deduced from \eqref{Equality_in_law} proceeding along the same lines as in the proof of Proposition 1.137 in \cite{FabbriGozziSwiech}. As a consequence, it holds that
\[
J(t,\xi,\alpha) = J(t,\eta,\beta).
\]
Hence $J(t,\xi,\alpha)\leq V(t,\eta)$. From the arbitrariness of $\alpha$, we deduce that $V(t,\xi)\leq V(t,\eta)$. Changing the roles of $\xi$ and $\eta$ we get the opposite inequality, from which we deduce that $V(t,\xi)=V(t,\eta)$.

\vspace{1mm}

\noindent\textbf{\emph{Step 2.}} \emph{Assumptions \textup{\ref{A_A,b,sigma}}, \textup{\ref{A_f,g}}, \textup{\ref{A_f,g_cont}} hold.} Fix $t\in[0,T]$ and $\xi,\eta\in\mathbf{S}_2(\mathbb{F})$, with $\mathbb{P}_\xi=\mathbb{P}_\eta$. As in the previous step, we exploit Remark \ref{R:V_non_ant} and take $\xi=\xi_{\cdot\wedge t}$ , $\eta=\eta_{\cdot\wedge t}$ (so, in particular, both $\xi$ and $\eta$ are ${\cal B}([0,T])\otimes{\cal F}_t$-measurable; this is needed in order to apply Lemma \ref{L:ExistUnif}).

\vspace{1mm}

\noindent\textbf{\emph{Substep 2.1.}} \emph{The discrete case.} Suppose that
\[
\mathbb{P}_{\xi} = \sum_{i=1}^m p_i\,\delta_{x_i},
\]
for some $\{x_1,\ldots,x_m\}\subset C([0,T];H)$, with $x_i\neq x_j$ if $i\neq j$, where $\delta_{x_i}$ is the Dirac measure at $x_i$ and $p_i>0$, with $\sum_{i=1}^m p_i=1$. Then, by Lemma \ref{L:ExistUnif} there exist two ${\cal F}_t$-measurable random variables $U_\xi$ and $U_\eta$, with uniform distribution on $[0,1]$, such that $\xi$ and $U_\xi$ (resp.\ $\eta$ and $U_\eta$) are independent. The claim then follows from \textbf{\emph{Step 1}}\!.

\vspace{1mm}

\noindent\textbf{\emph{Substep 2.2.}} \emph{The general case.} In the general case, we rely on the continuity of the map $\xi\mapsto V(t,\xi)$, defined from $\mathbf{S}_2(\mathbb{F})$ into $\mathbb{R}$, which follows from Proposition \ref{P:Cont}. More precisely, we proceed by approximating $\xi$ and $\eta$. For $n\in \mathbb{N}$, let $\{C^n_i\}_{i\in \mathbb{N}}$ be a partition of $C([0,T];H)$ of Borel sets such that $\operatorname{diam}(C^n_i)<2^{-n}$. For each $i\in \mathbb{N}$, choose $x^n_i\in C^n_i$. Then, define
\[
\tilde\xi_n \coloneqq  \sum_{i=1}^\infty x^n_{i}\,\mathds{1}_{C^n_i}(\xi), \qquad\qquad \tilde\eta_n \coloneqq  \sum_{i=0}^\infty x^n_{i}\, \mathds{1}_{C^n_i}(\eta).
\]
Notice that $\tilde\xi_n,\tilde\eta_n\in\mathbf{S}_2(\mathbb{F})$ and $\tilde\xi_n\rightarrow \xi$, $\tilde\eta_n\rightarrow\eta$ uniformly with respect to $\omega\in\Omega$. Moreover, $\tilde\xi_n$ and $\tilde\eta_n$ have the same law. By a diagonal argument, we can choose $N_n\in \mathbb{N}$ such that the sequences
$\{\xi_n\}_{n\in \mathbb{N}}$ and $\{\eta_n\}_{n\in \mathbb{N}}$, defined by
\begin{equation}\label{xi_n}
\xi_n \coloneqq  \sum_{i=1}^{N_n} x^n_i\, \mathds{1}_{C^n_i}(\xi), \qquad\qquad \eta_n \coloneqq  \sum_{i=1}^{N_n} x^n_i\, \mathds{1}_{C^n_i}(\eta),
\end{equation}
converge respectively to $\xi$ and $\eta$, both $\mathbb{P}$-a.s. and in $L^2(\Omega;C([0,T];H))$.
From \textbf{\emph{Substep 2.1}} we have
\[
V(t,\xi_n) = V(t,\eta_n), \qquad \forall\,n\in\mathbb{N}.
\]
Then, using the continuity of $V$, we can pass to the limit as $n\rightarrow\infty$ and conclude that $V(t,\xi)=V(t,\eta)$.
\end{proof}

\begin{Remark}\label{R:GinsteadF}
Suppose that \textup{\ref{A_A,b,sigma}}, \textup{\ref{A_f,g}}, \textup{\ref{A_f,g_cont}} hold. Thanks to the law invariance property stated in Theorem \ref{T:id-law}, in the definition of $V$ we can consider only $\xi\in\mathbf{S}_2({\cal G})$ rather than $\xi\in\mathbf{S}_2(\mathbb{F})$ (recall that it was necessary to take $\xi\in\mathbf{S}_2(\mathbb{F})$ in order to state and prove the dynamic programming principle, Theorem \ref{T:DPP}, where for instance the initial condition at time $s$ is $X^{t,\xi,\alpha}$ and $X^{t,\xi,\alpha}\in\mathbf{S}_2(\mathbb{F})$ but, in general, $X^{t,\xi,\alpha}\notin\mathbf{S}_2({\cal G})$).
\end{Remark}

\begin{Remark}\label{R:Aliprantis}
In the finite-dimensional and non-path-dependent case, the law invariance property was already addressed in \cite{CossoPham19}, Proposition 3.1, under only \textup{\ref{A_A,b,sigma}} and \textup{\ref{A_f,g}}. Notice however that the proof of such a proposition is based on the measurable selection theorem stated in \cite{AliprantisBorder}, Corollary 18.23, which is unfortunately not true. For this reason, Theorem \ref{T:id-law} is also relevant in the finite-dimensional and non-path-dependent setting. Moreover, we emphasize that assuming only \textup{\ref{A_A,b,sigma}} and \textup{\ref{A_f,g}} is not enough for the validity of the law invariance property. To this regard, we give the following example.\\
\textbf{Example.} Let $T=1$, $H=\mathbb{R}^3$, $K=\mathbb{R}$, ${\rm U}=[0,1]$. We consider a non-path-dependent setting. The coefficients
\[
b,\,\sigma,\,f\colon[0,T]\times\mathbb{R}^3\times{\cal P}_2(\mathbb{R}^3)\times[0,1]\times{\cal P}([0,1]) \longrightarrow \mathbb{R}^3,\,\mathbb{R}^3,\,\mathbb{R}
\]
and $g\colon\mathbb{R}^3\times{\cal P}_2(\mathbb{R}^3)\rightarrow\mathbb{R}$ are given by
\[
b_t(x,\mu,u,\nu) \coloneqq
\left(\begin{array}{c}
0 \\
u \\
0
\end{array}\right), \quad \sigma_t(x,\mu,u,\nu) \coloneqq
\left(\begin{array}{c}
0 \\
0 \\
1
\end{array}\right), \quad
f_t(x,\mu,u,\nu) \coloneqq  0, \quad
g(x,\mu) \coloneqq  \mathds{1}_{\{\mu=\mu_0\}}
\]
for every $(t,x,\mu,u,\nu)\in[0,T]\times\mathbb{R}^3\times{\cal P}_2(\mathbb{R}^3)\times[0,1]\times{\cal P}([0,1])$, where $\mu_0\in{\cal P}_2(\mathbb{R}^3)$ is the probability measure defined as
\[
\mu_0 \coloneqq  \textup{Unif}\,(0,1)\otimes\textup{Bern}(1/2)\otimes{\cal N}(0,1),
\]
with $\textup{Unif}\,(0,1)$ being the uniform distribution on $[0,1]$, $\textup{Bern}(1/2)$ the Bernoulli distribution with parameter $1/2$, ${\cal N}(0,1)$ the standard Gaussian distribution.

We now fix the probabilistic setting. Consider the probability spaces $(\Omega^\circ,{\cal F}^\circ,\mathbb{P}^\circ)$ and  $(\Omega^\text{\tiny\rm 1},{\cal F}^\text{\tiny\rm 1},\mathbb{P}^\text{\tiny\rm 1})$ where $\Omega^\circ=[0,1]$, ${\cal F}^\circ$ its Borel $\sigma$-algebra and  $\mathbb{P}^\circ$ is the Lebesgue measure on the unit interval, while $\Omega^\text{\tiny\rm 1}=\{\omega^\text{\tiny\rm 1}\in C([0,1];\mathbb{R})\colon\omega^\text{\tiny\rm 1}_0=0\}$, ${\cal F}^\text{\tiny\rm 1}$ its Borel $\sigma$-algebra and $\mathbb{P}^\text{\tiny\rm 1}$ is the Wiener measure on $(\Omega^\text{\tiny\rm 1},{\cal F}^\text{\tiny\rm 1})$. We then define $\Omega\coloneqq \Omega^\circ\times\Omega^{\text{\tiny\rm 1}}$, ${\cal F}$ the completion of ${\cal F}^\circ\otimes{\cal F}^{\text{\tiny\rm 1}}$ with respect to $\mathbb{P}^\circ\otimes\mathbb{P}^{\text{\tiny\rm 1}}$ and by $\mathbb{P}$ the extension of $\mathbb{P}^\circ\otimes\mathbb{P}^{\text{\tiny\rm 1}}$ to ${\cal F}$. We also denote by ${\cal G}\coloneqq {\cal F}^\circ\otimes\{\emptyset,\Omega^\text{\tiny\rm 1}\}$ the canonical extension of ${\cal F}^\circ$ to the product space $\Omega$. Finally, we denote by $B=(B_t)_{t\in[0,1]}$ the canonical process $B_t(\omega^\circ,\omega^\text{\tiny\rm 1})\coloneqq \omega^\text{\tiny\rm 1}_t$, $\forall\,t\in[0,1]$. Notice that, under the probability measure $\mathbb{P}$, the process $B$ is a real-valued Brownian motion. Then, in the present context the lifted value function is given by
\[
V(t,\xi) = \sup_{\alpha\in{\cal U}} \mathbb{E}\Big[\mathds{1}_{\big\{\mathbb{P}_{X_1^{t,\xi,\alpha}}=\mu_0\big\}}\Big], \qquad \forall\,(t,\xi)\in[0,1]\times L^2(\Omega,{\cal F}_t,\mathbb{P};\mathbb{R}^3),
\]
where
\[
\xi = \
\left(\begin{array}{c}
\xi^1 \\
\xi^2 \\
\xi^3
\end{array}\right)
\qquad
\text{ and }
\qquad
X_1^{t,\xi,\alpha} = \
\left(\begin{array}{c}
\vspace{1mm}\xi^1 \\
\vspace{1mm}\displaystyle\xi^2 + \int_t^1 \alpha_s\,ds \\
\xi^3 + B_1 - B_t
\end{array}\right).
\]
Now, let $\xi\colon\Omega\rightarrow\mathbb{R}^3$ be given by
\[
\xi(\omega^\circ,\omega^\text{\tiny\rm 1}) \coloneqq  \
\left(\begin{array}{c}
\,\,\,\omega^\circ \\
0 \\
0
\end{array}\right),
\qquad \forall\,(\omega^\circ,\omega^\text{\tiny\rm 1})\in\Omega.
\]
Notice that $\xi^1$ has distribution $\textup{Unif}\,(0,1)$. Moreover, $\xi$ is ${\cal G}$-measurable and generates the $\sigma$-algebra ${\cal G}$ itself, namely ${\cal G}=\sigma(\xi)$. Define $\eta\colon\Omega\rightarrow\mathbb{R}^3$ and $Z\colon\Omega\rightarrow[0,1]$ by
\[
\eta \coloneqq  \
\left(\begin{array}{c}
2\xi\,\mathds{1}_{\{\xi\leq1/2\}} + (2\xi-1)\,\mathds{1}_{\{\xi>1/2\}} \\
0 \\
0
\end{array}\right),
\qquad\qquad
Z \coloneqq  \mathds{1}_{\{\xi\leq1/2\}}.
\]
Notice that $\eta$ and $Z$ are ${\cal G}$-measurable and independent. Moreover, the first component of $\eta$, namely $\eta^1$, has distribution $\textup{Unif}\,(0,1)$, while $Z$ has distribution $\textup{Bern}(1/2)$.

Let us prove that $V(0,\xi)\neq V(0,\eta)$ and, in particular, $V(0,\xi)=0$ while $V(0,\eta)=1$. If the initial condition at time $t=0$ is $\eta$, then taking the control process $\alpha_s^*=Z$, $\forall\,s\in[0,T]$, we get
\[
X_1^{0,\eta,\alpha^*} = \
\left(\begin{array}{c}
\eta^1 \\
Z \\
B_1
\end{array}\right).
\]
Notice that $\mathbb{P}_{X_1^{0,\eta,\alpha^
*}}=\mu_0$, which proves that $V(0,\eta)=1$. On the other hand, when the initial condition is $\xi$, for every $\alpha\in{\cal U}$ we have
\[
X_1^{0,\xi,\alpha}(\omega^\circ,\omega^\text{\tiny\rm 1}) = \
\left(\begin{array}{c}
\vspace{1mm}\omega^\circ \\
\vspace{1mm}\displaystyle\int_0^1 \alpha_s(\omega^\circ,\omega^\text{\tiny\rm 1})\,ds \\
\omega_1^\text{\tiny\rm 1}
\end{array}\right),
\qquad \forall\,(\omega^\circ,\omega^\text{\tiny\rm 1})\in\Omega.
\]
Observe that the random variable $I\coloneqq \int_0^1\alpha_s\,ds$ cannot be independent of $(\xi,B_1)$, unless it is a constant. This implies that $\mathbb{P}_{X_1^{0,\xi,\alpha}}\neq\mu_0$, $\forall\,\alpha\in{\cal U}$, therefore $V(0,\xi)=0$.
\end{Remark}

In conclusion, under assumptions \textup{\ref{A_A,b,sigma}}, \textup{\ref{A_f,g}}, \textup{\ref{A_f,g_cont}}, we can define the \emph{value function} $v\colon[0,T]\times{\cal P}_2(C([0,T];H))\rightarrow\mathbb{R}$ as
\begin{equation}\label{v}
v(t,\mu) = V(t,\xi), \qquad \forall\,(t,\mu)\in[0,T]\times{\cal P}_2(C([0,T];H)),
\end{equation}
for any $\xi\in\mathbf{S}_2(\mathbb{F})$ with $\mathbb{P}_\xi=\mu$. By Theorem \ref{T:DPP} we immediately deduce the dynamic programming principle for $v$.

\begin{Corollary}\label{C:DPP}
Suppose that \textup{\ref{A_A,b,sigma}}, \textup{\ref{A_f,g}}, \textup{\ref{A_f,g_cont}} hold. The value function $v$ satisfies the \textbf{dynamic programming principle}: for every $t,s\in[0,T]$, with $t\leq s$, and every $\mu\in{\cal P}_2(C([0,T];H))$ it holds that
\[
v(t,\mu) = \sup_{\alpha\in{\cal U}}\bigg\{\mathbb{E}\bigg[\int_t^s f_r\big(X^{t,\xi,\alpha},\mathbb{P}_{X^{t,\xi,\alpha}_{\cdot\wedge r}},\alpha_r,\mathbb{P}_{\alpha_r}\big)\,dr\bigg] + v\big(s,\mathbb{P}_{X^{t,\xi,\alpha}}\big)\bigg\},
\]
for any $\xi\in\mathbf{S}_2(\mathbb{F})$ with $\mathbb{P}_\xi=\mu$.
\end{Corollary}

\begin{Remark}
Recall from Remark \ref{R:V_non_ant} that $V$ is non-anticipative, namely $V(t,\xi)=V(t,\xi_{\cdot\wedge t})$, for every $(t,\xi)\in[0,T]\times\mathbf{S}_2(\mathbb{F})$. As a consequence, the value function $v$ satisfies the following \emph{non-anticipativity property:}
\[
v(t,\mu) = v(t,\mu_{[0,t]}),
\]
for every $(t,\mu)\in[0,T]\times C([0,T];H)$, where we denote by $\mu_{[0,t]}$ the measure $\mu\circ\big( (x_s)_{s\in[0,T]}\mapsto (x_{s\wedge t})_{s\in[0,T]} \big)^{-1}$.
\end{Remark}

\section{Pathwise derivatives in the Wasserstein space and It\^o's formula}
\label{S:Ito}

This section is devoted to the proof of It\^o's formula for a real-valued function $\varphi$ defined on $[0,T]\times{\cal P}_2(C([0,T];H))$. Such a formula involves the so-called pathwise derivatives in the Wasserstein space that we now define. In the present section we substantially follow \cite[Section 2]{WuZhang18PPDE} (see also \cite{WuZhang18}), extending their framework to our more general setting with $H$ being a real separable Hilbert space (not necessarily a Euclidean space as in \cite{WuZhang18PPDE}).

\subsection{Notations}

In order to define the pathwise derivatives, we need to extend the canonical space $C([0,T];H)$ to the space of c\`adl\`ag paths $D([0,T];H)$, which we endow with the Skorokhod distance (in what follows, we denote paths in $D([0,T];H)$ using $\hat\cdot$ in order to distinguish them from paths in $C([0,T];H)$; we do the same with other mathematical objects)
\[
d_{\textup{Sk}}(\hat x,\hat x') \coloneqq  \inf_{\boldsymbol\lambda\in\mathbf\Lambda}\sup_{t\in[0,T]}\big(|t - \boldsymbol\lambda(t)| + |\hat x_t - \hat x_{\boldsymbol\lambda(t)}'|_H\big),
\]
where $\mathbf\Lambda$ denotes the set of strictly increasing and continuous maps $\boldsymbol\lambda\colon[0,T]\rightarrow[0,T]$, satisfying $\boldsymbol\lambda(0)=0$ and $\boldsymbol\lambda(T)=T$. We recall that $(D([0,T];H),d_{\textup{Sk}})$ is a Polish space. We define the spaces
\[
\mathscr{H} \coloneqq  [0,T]\times {\cal P}_2\big(C([0,T];H)\big), \qquad\qquad \mathscr{\hat H} \coloneqq  [0,T]\times {\cal P}_2\big(D([0,T];H)\big).
\]
For every $(t,\mu)\in \mathscr{H}$, we denote by $\mu_{[0,t]}$ the measure $\mu\circ\big( (x_s)_{s\in[0,T]}\mapsto (x_{s\wedge t})_{s\in[0,T]} \big)^{-1}$. We define similarly $\hat\mu_{[0,t]}$, for every $(t,\hat\mu)\in\mathscr{\hat H}$. We then equip $\mathscr{H}$ and $\mathscr{\hat H}$ with the following pseudo-distances, respectively:
\begin{align*}
d_{\mathscr{H}}\big((t,\mu),(t',\mu')\big) &\coloneqq  \Big(|t-t'|^2+{\cal W}_2\big(\mu_{[0,t]},\mu_{[0,t']}'\big)^2\Big)^{\frac{1}{2}}\,, \qquad (t,\mu),(t',\mu')\in \mathscr{H}, \\
d_{\mathscr{\hat H}}\big((t,\hat\mu),(t',\hat\mu')\big) &\coloneqq  \Big(|t-t'|^2+{\cal W}_2\big(\hat\mu_{[0,t]},\hat\mu_{[0,t']}'\big)^2\Big)^{\frac{1}{2}}\,, \qquad (t,\hat\mu),(t',\hat\mu')\in \mathscr{\hat H}.
\end{align*}
\begin{Remark}
  Notice that a function $\varphi\colon\mathscr{H}\rightarrow\mathbb{R}$ (resp.\ $\hat\varphi\colon\mathscr{\hat H}\rightarrow\mathbb{R}$) that is
  measurable with respect to $d_{\mathscr{H}}$ (resp.\ $d_{\mathscr{\hat H}}$) satisfies the \textup{non-anticipativity property:}
\[
\varphi(t,\mu) = \varphi(t,\mu_{[0,t]}), \quad \forall\,(t,\mu)\in\mathscr{H} \qquad \big(\text{\textup{resp.\ $\hat\varphi(t,\hat\mu)=\hat\varphi(t,\hat\mu_{[0,t]})$, \quad $\forall\,(t,\hat\mu)\in\mathscr{\hat H}$}}\big).
\]
\end{Remark}

\noindent We also introduce the lifted spaces
\[
\mathfrak{H} \coloneqq  [0,T]\times L^2\big(\Omega;C([0,T];H)\big), \qquad\qquad \mathfrak{\hat H} \coloneqq  [0,T]\times L^2\big(\Omega;D([0,T];H)\big).
\]
\begin{Remark}\label{R:U_tilde}
To alleviate notation, in the present Section \ref{S:Ito} we work on the same probability space $(\Omega,{\cal F},\mathbb{P})$ adopted in the rest of the paper. Notice however that, for the definition of pathwise derivatives, $(\Omega,{\cal F},\mathbb{P})$ can be replaced by any other probability space which supports a random variable having uniform distribution on $[0,1]$. See also Remark \ref{R:Atomless}.
\end{Remark}

\noindent Finally, we introduce the following notation.

\begin{Notation}{\bf(Ntn$_{\hat{\mathbb P}}$)}\label{Ntn_P}
For every $\xi\in L^2(\Omega;C([0,T];H))$, we denote by $\hat\mathbb{P}_\xi$ the law of $\xi$ on $D([0,T];H)$, while we recall that $\mathbb{P}_\xi$ denotes the law of $\xi$ on $C([0,T];H)$. So, in particular, $\hat\mathbb{P}_\xi\in{\cal P}_2(D([0,T];H))$, while $\mathbb{P}_\xi\in{\cal P}_2(C([0,T];H))$. Clearly, it holds that $\hat\mathbb{P}_\xi(\mathfrak B)=\mathbb{P}_\xi(\mathfrak B)$, for every Borel subset $\mathfrak B$ of $C([0,T];H)$. Notice that in \cite{WuZhang18PPDE} the probability $\hat\mathbb{P}_\xi$ is denoted simply by $\mathbb{P}_\xi$ (see the beginning of Section 2.4 in \cite{WuZhang18PPDE}).
\end{Notation}

\subsection{Pathwise derivatives for a map $\hat\varphi\colon\mathscr{\hat H}\rightarrow\mathbb{R}$ and It\^o's formula}

We start with the definition of pathwise time derivative for a map $\hat\varphi\colon\mathscr{\hat H}\rightarrow\mathbb{R}$.

\begin{Definition}\label{Def:HorizontalDer}
Let $\hat\varphi\colon\mathscr{\hat H}\rightarrow\mathbb{R}$ be a non-anticipative function. We say that $\hat\varphi$ is pathwise differentiable in time at $(t,\hat\mu)\in\mathscr{\hat H}$, with $t<T$, if the following limit exists and is finite:
\[
\partial_t \hat\varphi(t,\hat\mu) \coloneqq  \lim_{\delta\rightarrow 0^+}\frac{\hat\varphi(t+\delta,\hat\mu_{[0,t]})-\hat\varphi(t,\hat \mu)}{\delta}.
\]
At time $t=T$, we define
\[
\partial_t \hat\varphi(t,\hat\mu) \coloneqq  \lim_{t\rightarrow T^-}\partial_t \hat\varphi(t,\hat\mu),
\]
when the limit exists and is finite. We refer to $\partial_t \hat\varphi$ as the \textbf{pathwise time derivative} (or \textbf{horizontal derivative}) \textbf{of $\hat\varphi$ at $(t,\hat\mu)$}.
If $ \partial _t\hat{\varphi}$ exists everywhere as a function $\mathscr{\hat{H}}\rightarrow \mathbb{R}$, we refer to it as the \textbf{pathwise time derivative of $\hat{\varphi}$}.
\end{Definition}

\begin{Remark}\label{R:NA-time_deriv}
Notice that $\partial_t\hat\varphi$ is a non-anticipative function, namely $\partial_t\hat\varphi(t,\hat\mu)=\partial_t\hat\varphi(t,\hat\mu_{[0,t]})$, for every $(t,\hat\mu)\in\mathscr{\hat H}$.
\end{Remark}

In order to define the pathwise measure derivative, we need to consider the lifting of $\hat\varphi$.

\begin{Definition}
Given $\hat\varphi\colon\mathscr{\hat H}\to \mathbb{R}$, we say that $\hat\Phi\colon\mathfrak{\hat H}\to\mathbb{R}$ is a \textbf{lifting} of $\hat\varphi$ if
\[
\hat\Phi(t,\hat\xi) = \hat\varphi(t,\mathbb{P}_{\hat\xi}), \qquad \forall\,(t,\hat\xi)\in\mathfrak{\hat H},
\]
where we recall that $\mathbb{P}_{\hat\xi}$ stands for the law of the random variable $\hat\xi\in L^2(\Omega;D([0,T];H))$.
\end{Definition}

\begin{Definition}\label{D:PathSpaceDeriv}
Let $\hat\Phi\colon\mathfrak{\hat H}\rightarrow\mathbb{R}$ be a non-anticipative function, namely $\hat\Phi(t,\hat\xi)=\hat\Phi(t,\hat\xi_{\cdot\wedge t})$, for every $(t,\hat\xi)\in\mathfrak{\hat H}$. We say that $\hat\Phi$ is \textbf{pathwise differentiable in space} at $(t,\hat\xi)\in\mathfrak{\hat H}$ if there exists $D\hat\Phi(t,\hat\xi)\in L^2(\Omega;H)$ such that
\[
  \lim_{Y\rightarrow 0}
  \frac{\left| \hat\Phi(t,\hat\xi+Y\mathds{1}_{[t,T]})-\hat\Phi(t,\hat\xi)
  -\mathbb{E}\big[\langle D\hat\Phi(t,\hat\xi),Y\rangle_H\big]\right|}{|Y|_{L^2(\Omega;H)}}=0.

\]
We refer to $D\hat\Phi(t,\hat\xi)$ as the \textbf{pathwise space derivative} (or \textbf{vertical derivative}) \textbf{of $\hat\Phi$ at $(t,\hat\xi)$}.
If $ D\hat{\Phi}$ exists everywhere as a function $\mathfrak{\hat{H}}\rightarrow L^2(\Omega;H)$, we refer to it as the \textbf{pathwise space derivative of $\hat{\varphi}$}.
\end{Definition}

\begin{Remark}\label{R:NA-DPhi}
Notice that, if $\hat{\Phi}$ is pathwise differentiable in space at $(t,\hat\xi)$, then it is pathwise differentiable in space at $(t,\hat{\xi}')$ for every $\hat{\xi}'\in L^2(\Omega; D([0,T];H))$ such that
$\hat{\xi}_{t\wedge \cdot}=\hat{\xi}'_{t\wedge \cdot}$ $\mathbb{P}$-a.s., and, in such a case,
$D\hat\Phi(t,\hat\xi)=D\hat\Phi(t,\hat\xi')$ $\mathbb{P}$-a.s.

\end{Remark}

We can then give, similarly to \cite[Definition 5.22]{CD14},
the following definition.

\begin{Definition}\label{D:MeasureDerivative}
Let $\hat\varphi\colon\mathscr{\hat H}\rightarrow\mathbb{R}$ be a non-anticipative function and $(t,\hat\mu)\in\mathscr{\hat H}$.
We say that $\hat\varphi$ is \textbf{pathwise differentiable in measure} at $(t,\hat\mu)$ if its lifting $\hat\Phi$ is pathwise differentiable in space at some $(t,\hat\xi)\in\mathfrak{\hat H}$ such that $\mathbb{P}_{\hat\xi}=\hat\mu$.

Moreover, we say that $\hat\varphi$ admits
\textbf{pathwise measure derivative}
at $(t,\hat\mu)$
if its lifting $\hat \Phi$ is pathwise differentiable in space
at every $(t,\hat{\xi})\in \mathfrak{\hat H}$ such that $\mathbb{P}_{\hat{\xi}}=\hat{ \mu}$
and if there exists a masurable function
$\hat{g}\colon D([0,T];H)\rightarrow H$
such that,
for all $(t,\hat{\xi})\in \mathfrak{\hat H}$ with $\mathbb{P}_{\hat{\xi}}=\hat{ \mu}$,
\begin{equation}\label{DPhi=partial_mu}
D\hat\Phi(t,\hat\xi) = \hat g(\hat\xi)
  \qquad \mathbb{P}\text{-a.s.}
\end{equation}
 The map $\hat g$ (which is $\hat{\mu}$-a.s.\ uniquely determined)
 is called \textbf{pathwise measure derivative of $\hat\varphi$ at $(t,\hat\mu)$}\footnote{Notice that, if a function is pathwise differentiable in measure at some point and the related pathwise space derivative is continuous (at least in a neighborhood), then it admits the pathwise measure derivative at that point, see e.g.\ \cite[Theorem 6.5]{carda12} or \cite[Proposition 5.25]{cardelbook} in finite dimension and our Lemma \ref{L:General}. Without the continuity assumption of the pathwise space derivative such a result is not obvious.}.

 Finally, if $\hat \varphi$ admits pathwise measure derivative at every $(t,\hat{\mu})\in \mathfrak{\hat{H}}$, then the function
 \begin{equation*}
   \partial _\mu \hat\varphi\colon \mathscr{\hat H}\times D([0,T];H) \longrightarrow H, \qquad\qquad (t,\hat\mu, \hat x) \longmapsto   \partial _\mu\hat{\varphi} (t,\hat\mu,\hat x)
 \end{equation*}
 such that, for every $(t,\hat{\xi}) \in \mathfrak{\hat H}$,
 $\partial _\mu\hat{\varphi}(t,\mathbb{P}_{\hat{\xi}},\cdot)$ is measurable and
 $D\hat\Phi(t,\hat\xi) = \partial _\mu\hat{\varphi}(t,\mathbb{P}_{\hat{\xi}},\hat\xi)$
 $\mathbb{P}$-a.s., is called the \textbf{pathwise measure derivative of $\hat{\varphi}$}\footnote{We stress the fact that $ \partial _\mu\hat{\varphi}(t,\mathbb{P}_{\hat{\xi}},\cdot)$ is \emph{a-priori} uniquely determined only $\mathbb{P}_{\hat{\xi}}$-a.s.}.
\end{Definition}

  In the following lemma we state, under general conditions,
  the existence of the pathwise measure derivative.

In order to do it, we proceed similarly to what is done in \cite[Section 2.3]{WuZhang18PPDE} (see also \cite[Section 5.3]{CD14}) in the finite-dimensional case.
The proof of the lemma is postponed in Appendix \ref{App:PathDeriv}.

\begin{Lemma}\label{L:General}
Fix $(t,\hat\xi)\in\mathfrak{\hat H}$. Let $\hat\varphi\colon \mathscr{\hat H}\to\mathbb{R}$ be such that its lifting
$\hat\Phi$ admits a continuous pathwise space derivative $D\hat\Phi$ on the set $\{t\}\times \mathcal O_{\hat\xi}$, where $\mathcal O_{\hat\xi}$ is a neighborhood of $\hat\xi$ in $L^2(\Omega;D([0,T];H))$. Then, there exists a measurable function
$\hat g\colon D([0,T];H)\rightarrow H$
and
\begin{equation}
  \label{2018-11-06:10}
  D\hat\Phi(t,\hat\xi) = \hat g(\hat\xi),
  \qquad \mathbb{P}\text{-a.s.}
\end{equation}
Let $\hat\xi'$ be such that $\mathbb{P}_{\hat\xi'}=\mathbb{P}_{\hat\xi}$. If in addition $\hat\Phi$ admits a continuous pathwise space derivative on the set $\{t\}\times \mathcal O_{\hat\xi'}$, with $\mathcal O_{\hat\xi'}$ being a neighborhood of $\hat\xi'$, then \eqref{2018-11-06:10} holds true with $\hat\xi$ replaced by $\hat\xi'$.

Hence,
if the pathwise space derivative $D\hat\Phi(t,\hat \xi)$ at $(t,\hat\xi)$ exists
for every $(t,\hat \xi)\in\mathfrak{\hat H}$ and if $D\hat{\Phi}$ is continuous,
then there exists
the pathwise measure derivative $ \partial _\mu\hat{\varphi}$ of $\hat{\varphi}$.

If in addition
the map $ \partial _\mu \hat\varphi(t,\cdot,\cdot)\colon{\cal P}_2(D([0,T];H))\times D([0,T];H)\rightarrow\mathbb{R}$ is continuous
for every $t\in[0,T]$, then $ \partial _\mu\hat \varphi$ is uniquely defined.

Finally,assume that
the pathwise space derivative $D\hat\Phi$ exists everywhere and is uniformly continuous. Then
$ \partial _\mu\hat{\varphi}$ is measurable.
\end{Lemma}

\begin{Remark}[\textbf{Non-anticipativity property of $\partial_\mu\hat\varphi$.}]\label{R:NA-measure-deriv}
Let $\hat\varphi\colon\mathscr{\hat H}\rightarrow\mathbb{R}$ be a non-anticipative function. Suppose that
  there exists

  the pathwise measure derivative
of $\hat{\varphi}$.
Then, thanks to Remark \ref{R:NA-DPhi} and equality \eqref{DPhi=partial_mu}, $\partial_\mu\hat\varphi$ is a \textup{non-anticipative function} in the sense that,
for every $(t,\hat{\xi})\in  \mathfrak{\hat H}$,
\begin{equation*}
  \partial_\mu \hat\varphi(t,\mathbb{P}_{\hat{\xi}})(\hat\xi)=
\partial_\mu \hat\varphi(t,(\mathbb{P}_{\hat{\xi}})_{[0,t]})(\hat\xi_{\cdot\wedge t})\qquad\mathbb{P}\textrm{-a.s.}
\end{equation*}
or, equivalently,
\[
\partial_\mu\hat\varphi(t,\hat\mu)(\hat x) = \partial_\mu \hat\varphi(t,\hat\mu_{[0,t]})(\hat{x}_{\cdot\wedge t}),
\qquad\hat\mu\text{-a.e.}
\]
for every
$(t,\hat\mu,\hat x)\in\mathscr{\hat H}\times D([0,T];H)$.
\end{Remark}

Finally, we define the pathwise derivative of second-order $\partial_x\partial_{\mu}\hat\varphi$.

\begin{Definition}\label{D:2nd-measure-deriv}
   Let $\hat\varphi\colon\mathscr{\hat H}\rightarrow\mathbb{R}$ be a non-anticipative function and $(t,\hat\mu)\in\mathscr{\hat H}$.

  Suppose that:

\begin{enumerate}[1)]
\item there exists the pathwise measure derivative $\partial_\mu\hat\varphi$;
\item for every $t\in[0,T]$, the map $\partial_\mu\hat\varphi(t,\cdot)(\cdot)\colon{\cal P}_2(D([0,T];H))\times D([0,T];H)\rightarrow H$ is continuous (hence, by Lemma~\ref{L:General}, $ \partial _\mu\hat{\varphi}$ is uniquely determined).
\end{enumerate}
Given $\hat x\in D([0,T];H)$, we say that $\hat\varphi$ is \textbf{pathwise differentiable in measure and space at $(t,\hat\mu,\hat x)$} if there exists an operator $\partial_x\partial_\mu\hat\varphi(t,\hat\mu)(\hat x)\in{\cal L}(H)$ such that
\begin{equation*}
  \lim_{h\rightarrow 0}
  \frac{\big|\partial_\mu\hat\varphi(t,\hat\mu)(\hat x + h\,\mathds{1}_{[t,T]}) - \partial_\mu \hat\varphi(t,\hat\mu)(\hat x) - \partial_x\partial_\mu \hat\varphi(t,\hat\mu)(\hat x)h\big|_H }{|h|_H}= 0.

\end{equation*}
We refer to $\partial_x\partial_\mu\hat\varphi(t,\hat\mu)(\hat x)$ as the \textbf{second-order pathwise derivative in measure and space of $\hat\varphi$ at $(t,\hat\mu,\hat x)$}.

If $ \partial _x \partial _\mu\hat{\varphi}$ exists everywhere as function
$\mathscr{\hat H}\times D([0,T];H)\rightarrow{\cal L}(H)$,
we refer to it as the \textbf{pathwise derivative in measure and space of $\hat{\varphi}$}.
\end{Definition}

\begin{Remark}\label{R:NA-2nd-measure-deriv}
Recalling Remark \ref{R:NA-measure-deriv}, we see that $\partial_x\partial_\mu\hat\varphi$ is a non-anticipative function, namely it holds that $\partial_x\partial_\mu\hat\varphi(t,\hat\mu)(\hat\xi)=\partial_x\partial_\mu\hat\varphi(t,\hat\mu_{[0,t]})(\hat\xi_{\cdot\wedge t})$, $\mathbb{P}$-a.s., for every $(t,\hat\xi)\in\mathfrak{\hat H}$, with $\mathbb{P}_{\hat\xi}=\hat\mu$, or, equivalently,
\[
\partial_x \partial_\mu\hat\varphi(t,\hat\mu)(\hat x) = \partial_x \partial_\mu \hat\varphi(t,\hat\mu_{[0,t]})(\hat{x}_{\cdot\wedge t}),
\qquad\hat\mu\text{-a.e.}
\]
for every
$(t,\hat\mu,\hat x)\in\mathscr{\hat H}\times D([0,T];H)$.

\end{Remark}

\begin{Definition}\label{D:C1,2}
We denote by $\boldsymbol C^{1,2}(\mathscr{\hat H})$ the set of non-anticipative functions $\hat\varphi\colon\mathscr{\hat H}\rightarrow\mathbb{R}$ such that:
\begin{enumerate}[\upshape 1)]
\item
  the lifting $\hat\Phi$ of $\hat\varphi$ admits a continuous pathwise space derivative $D\hat\Phi$ on $\mathfrak{\hat H}$ (hence, by Lemma~\ref{L:General}, there exists the pathwise measure derivative $ \partial _\mu \hat{\varphi}$);
\item $\hat{\varphi}, \partial _\mu\hat{\varphi}$ are continuous;
\item

  there exist
the pathwise time derivative $ \partial _t\hat{\varphi}$, the second-order pathwise derivative in measure and space $ \partial _x \partial _\mu\hat{\varphi}$, and $ \partial _t\hat{\varphi}, \partial _x \partial _\mu\hat{\varphi}$ are continuous.
\end{enumerate}
\end{Definition}

\begin{Definition}
We denote by $\boldsymbol C_b^{1,2}(\mathscr{\hat H})$ the set of $\hat\varphi\in\boldsymbol C^{1,2}(\mathscr{\hat H})$ such that
$\hat\varphi$, $\partial_t\hat\varphi$, $\partial_\mu\hat\varphi$, $\partial_x\partial_\mu\hat\varphi$ are bounded.
\end{Definition}

We end this section with the It\^o formula.
The proof is postponed in Appendix~\ref{ItoProof}.

\begin{Theorem}\label{T:ItoD}
Fix $t\in[0,T]$ and let $\xi\in\mathbf{S}_2(\mathbb{F})$.
Let also  $F\colon[0,T]\times\Omega\rightarrow H$, $G\colon[0,T]\times\Omega\rightarrow\mathcal{L}_2(K;H)$ be square-integrable and $\mathbb{F}$-progressively measurable processes, so, in particular,
\[
\int_0^T \mathbb{E}[|F_s|^2_H]\,ds < \infty, \qquad\qquad \int_0^T \mathbb{E}\big[\textup{Tr}(G_sG_s^*)\big]\,ds < \infty.
\]
Consider the process $X=(X_s)_{s\in[0,T]}$ given by\footnote{In what follows, we will always implicitly
refer to   It\^o processes only by  continuous versions.}
\begin{equation}\label{2020-12-04:02}
X_s = \xi_{s\wedge t} + \int_t^{s\vee t} F_r\,dr + \int_t^{s\vee t} G_r\,dB_r, \qquad \forall\,s\in[0,T].
\end{equation}
If $\hat\varphi\colon\mathscr{\hat H}\rightarrow\mathbb{R}$ is in $\boldsymbol C_b^{1,2}(\mathscr{\hat H})$, then the following \textbf{It\^o formula} holds:
\begin{align}\label{ItoD}
\hat\varphi(s,\hat\mathbb{P}_{X_{\cdot\wedge s}}) &= \hat\varphi(t,\hat\mathbb{P}_{\xi_{\cdot\wedge t}}) + \int_t^s \partial_t \hat\varphi(r,\hat\mathbb{P}_{X_{\cdot\wedge r}})\,dr + \int_t^s
\mathbb{E}
 \left[   \langle F_r,\partial_\mu \hat\varphi(r,\hat\mathbb{P}_{X_{\cdot\wedge r}})(X_{\cdot\wedge r})\rangle_H
 \right]dr \notag \\
&\quad + \frac{1}{2}\int_t^s\mathbb{E}
 \left[
   {\rm Tr} \left(
        G_r G_r^* \partial _x\partial_\mu
       \hat\varphi(r,\hat\mathbb{P}_{X_{\cdot\wedge r}})(X_{\cdot\wedge r})
   \right)
 \right]dr,
\end{align}
for every $s\in[t,T]$ (for the definition of $\hat\mathbb{P}_{X_{\cdot\wedge r}}$ see \ref{Ntn_P}).
\end{Theorem}
\begin{Remark}\label{rm:ITOunbounded1}
  Proceeding along the same lines as in the proof of Theorem \ref{T:ItoD}, it is possible to prove It\^o's formula for a larger class of functions than $\boldsymbol C_b^{1,2}(\mathscr{\hat H})$,
  for example
  weakening the boundedness assumption of $\partial_\mu\hat\varphi$ by assuming linear growth with respect to $\hat\xi$.
\end{Remark}

\begin{Remark}\label{R:Sym}
Following \cite{WuZhang18PPDE}, we notice that in the last term of It\^o's formula \eqref{ItoD} we can replace $\partial_x\partial_\mu\hat\varphi(r,\hat\mathbb{P}_{X_{\cdot\wedge r}})(X_{\cdot\wedge r})$ by its {symmetrization} $\partial_x^{\textup{sym}}\partial_\mu\hat\varphi(r,\hat\mathbb{P}_{X_{\cdot\wedge r}})(X_{\cdot\wedge r})$, where $\partial_x^{\textup{sym}}\partial_\mu\hat\varphi\colon\mathscr{\hat H}\times D([0,T];H)\rightarrow{\cal L}(H)$ is defined as
\begin{equation}\label{Sym}
\partial_x^{\textup{sym}}\partial_\mu\hat\varphi(t,\hat\mu)(\hat x) \coloneqq  \frac{1}{2}\Big(\partial_x\partial_\mu\hat\varphi(t,\hat\mu)(\hat x) + \big(\partial_x\partial_\mu\hat\varphi(t,\hat\mu)(\hat x)\big)^*\Big),
\end{equation}
for every $(t,\hat\mu,\hat x)\in\mathscr{\hat H}\times D([0,T];H)$.
\end{Remark}

\subsection{Pathwise derivatives for a map $\varphi\colon\mathscr H\rightarrow\mathbb{R}$ and It\^o's formula}

In the present section we use several times the notation \ref{Ntn_P}, namely we use the superscript $\hat\cdot$ to denote the natural extension to $D([0,T];H)$ of a probability measure on $C([0,T];H)$.

\begin{Definition}\label{D:Consistent}
Given $\varphi\colon\mathscr H\rightarrow\mathbb{R}$ and a non-anticipative map $\hat\varphi\colon\mathscr{\hat H}\rightarrow\mathbb{R}$, we say that $\hat\varphi$ is \textbf{consistent} with $\varphi$ if (for the definition of $\hat\mathbb{P}_\xi$ see \ref{Ntn_P})
\begin{equation}\label{Consistency}
\varphi(t,\mathbb{P}_\xi) = \hat\varphi(t,\hat\mathbb{P}_\xi),
\end{equation}
for every $(t,\xi)\in\mathfrak H$, with $\xi\in\mathbf{S}_2(\mathbb{F})$ (namely, $\xi\in L^2(\Omega;C([0,T];H))$ and it is $\mathbb{F}$-progressively measurable).
\end{Definition}
\begin{Remark}
Notice that we can replace $\mathbf{S}_2(\mathbb{F})$ with $\mathbf{S}_2({\cal G})$ in Definition \ref{D:Consistent}, as a matter of fact the sets $\{\mathbb{P}_\xi\colon\xi\in\mathbf{S}_2(\mathbb{F})\}$ and $\{\mathbb{P}_\xi\colon\xi\in\mathbf{S}_2({\cal G})\}$ are equal and coincide with ${\cal P}_2(C([0,T];H))$, as it follows from property  \textup{\ref{A_G}}-ii). This also shows that equality \eqref{Consistency} characterizes $\varphi$ in terms of $\hat\varphi$ for every pair $(t,\mu)\in\mathscr H$.
\end{Remark}

Next result is crucial in order to define pathwise derivatives for a map $\varphi\colon\mathscr H\rightarrow\mathbb{R}$, as it states a consistency property for the pathwise derivatives themselves.

\begin{Lemma}\label{L:Consistency}
Let $\hat\varphi_1,\hat\varphi_2\in\boldsymbol C_b^{1,2}(\mathscr{\hat H})$. If (for the definition of $\hat\mathbb{P}_\xi$ see \ref{Ntn_P})
\[
\hat\varphi_1(t,\hat\mathbb{P}_\xi) = \hat\varphi_2(t,\hat\mathbb{P}_\xi), \qquad \forall\,(t,\xi)\in\mathfrak H,\;\text{with }\xi\in\mathbf{S}_2(\mathbb{F}),
\]
then
\begin{align}
\partial_t\hat\varphi_1(t,\hat\mathbb{P}_\xi) &= \partial_t\hat\varphi_2(t,\hat\mathbb{P}_\xi), \label{Cons-time-deriv} \\
\partial_\mu\hat\varphi_1(t,\hat\mathbb{P}_\xi)(\xi) &= \partial_\mu\hat\varphi_2(t,\hat\mathbb{P}_\xi)(\xi), \qquad\qquad\! \mathbb{P}\text{\textup{-a.s.}} \label{Cons-measure-deriv} \\
\partial_x^{{\textup{sym}}}\partial_\mu\hat\varphi_1(t,\hat\mathbb{P}_\xi)(\xi) &= \partial_x^{{\textup{sym}}}\partial_\mu\hat\varphi_2(t,\hat\mathbb{P}_\xi)(\xi), \qquad \mathbb{P}\text{\textup{-a.s.}} \label{Cons-2nd-measure-deriv}
\end{align}
for every $(t,\xi)\in\mathfrak H$, with $\xi\in\mathbf{S}_2(\mathbb{F})${, where $\partial_x^{\textup{sym}}\partial_\mu\hat\varphi$ is defined by \eqref{Sym}.}
\end{Lemma}
\begin{proof}[\textbf{Proof.}]
See Appendix \ref{App:Consistency}.
\end{proof}
\begin{Remark}\label{R:2nd-measure-deriv}
{We do not address here the consistency property of $\partial_x\partial_\mu\hat\varphi$ (for hints on its proof we refer to \cite{WuZhang18PPDE}, see the paragraph just after Theorem 2.9), as It\^o's formula (and hence the Hamilton-Jacobi-Bellman equation) only depends on $\partial_x^{\textup{sym}}\partial_\mu\hat\varphi$, see Remark \ref{R:Sym}.}
\end{Remark}
\begin{Remark}\label{R:NA-Consistency}
By the non-anticipativity property of the pathwise derivatives (see Remarks \ref{R:NA-time_deriv}, \ref{R:NA-measure-deriv}, \ref{R:NA-2nd-measure-deriv}), it follows that equalities \eqref{Cons-time-deriv}-\eqref{Cons-measure-deriv}-\eqref{Cons-2nd-measure-deriv} hold if and only if
\begin{align*}
\partial_t\hat\varphi_1(t,\hat\mathbb{P}_{\xi_{\cdot\wedge t}}) &= \partial_t\hat\varphi_2(t,\hat\mathbb{P}_{\xi_{\cdot\wedge t}}), \\
\partial_\mu\hat\varphi_1(t,\hat\mathbb{P}_{\xi_{\cdot\wedge t}})(\xi_{\cdot\wedge t}) &= \partial_\mu\hat\varphi_2(t,\hat\mathbb{P}_{\xi_{\cdot\wedge t}})(\xi_{\cdot\wedge t}), \qquad\qquad\! \mathbb{P}\text{\textup{-a.s.}} \\
\partial_x^{{\textup{sym}}}\partial_\mu\hat\varphi_1(t,\hat\mathbb{P}_{\xi_{\cdot\wedge t}})(\xi_{\cdot\wedge t}) &= \partial_x^{{\textup{sym}}}\partial_\mu\hat\varphi_2(t,\hat\mathbb{P}_{\xi_{\cdot\wedge t}})(\xi_{\cdot\wedge t}), \qquad \mathbb{P}\text{\textup{-a.s.}}
\end{align*}
for every $(t,\xi)\in\mathfrak H$, with $\xi\in\mathbf{S}_2(\mathbb{F})$.
\end{Remark}

Using Lemma \ref{L:Consistency}, we can now define the class $\boldsymbol C_b^{1,2}(\mathscr H)$.

\begin{Definition}\label{D:C12}
{We denote by $\boldsymbol C^{1,2}(\mathscr H)$ (respectively $\boldsymbol C_b^{1,2}(\mathscr H)$) the set of maps $\varphi\colon\mathscr H\rightarrow\mathbb{R}$ for which there exists $\hat\varphi\colon\mathscr{\hat H}\rightarrow\mathbb{R}$ such that $\hat\varphi$ is consistent with $\varphi$ and $\hat\varphi\in\boldsymbol C^{1,2}(\mathscr{\hat H})$
(respectively $\boldsymbol C_b^{1,2}(\mathscr{\hat H})$).} Then, we define (for the definition of $\hat\mathbb{P}_\xi$ see \ref{Ntn_P})
\begin{align*}
\partial_t\varphi(t,\mathbb{P}_\xi) &\coloneqq  \partial_t\hat\varphi(t,\hat\mathbb{P}_\xi), \\
\partial_\mu\varphi(t,\mathbb{P}_\xi)(\cdot) &\coloneqq  \partial_\mu\hat\varphi(t,\hat\mathbb{P}_\xi)(\cdot), \\
\partial_x^{{\textup{sym}}}\partial_\mu\varphi(t,\mathbb{P}_\xi)(\cdot) &\coloneqq  \partial_x^{{\textup{sym}}}\partial_\mu\hat\varphi(t,\hat\mathbb{P}_\xi)(\cdot),
\end{align*}
for every $(t,\xi)\in\mathfrak H$, with $\xi\in\mathbf{S}_2(\mathbb{F})$.
\end{Definition}

We can finally state the It\^o formula.

\begin{Theorem}\label{T:Ito}
  Fix $t\in[0,T]$ and let $\xi\in\mathbf{S}_2(\mathbb{F})$.

  Let also $F\colon[0,T]\times\Omega\rightarrow H$, $G\colon[0,T]\times\Omega\rightarrow\mathcal{L}_2(K;H)$ be square integrable
   and $\mathbb{F}$-progressively measurable process, so, in particular,
\[
\int_0^T \mathbb{E}[|F_s|^2_H]\,ds < \infty, \qquad\qquad \int_0^T \mathbb{E}\big[\textup{Tr}(G_sG_s^*)\big]\,ds < \infty.
\]
Consider the process $X=(X_s)_{s\in[0,T]}$ given by
\begin{equation*}
X_s = \xi_{s\wedge t} + \int_t^{s\vee t} F_r\,dr + \int_t^{s\vee t} G_r\,dB_r, \qquad \forall\,s\in[0,T].
\end{equation*}
If $\varphi\colon\mathscr H\rightarrow\mathbb{R}$ is in $\boldsymbol C_b^{1,2}(\mathscr H)$, then the following \textbf{It\^o formula} holds:
\begin{align}\label{Ito}
\varphi(s,\mathbb{P}_{X_{\cdot\wedge s}}) &= \varphi(t,\mathbb{P}_{\xi_{\cdot\wedge t}}) + \int_t^s \partial_t \varphi(r,\mathbb{P}_{X_{\cdot\wedge r}})\,dr + \int_t^s
\mathbb{E}
 \left[   \langle F_r,\partial_\mu \varphi(r,\mathbb{P}_{X_{\cdot\wedge r}})(X_{\cdot\wedge r})\rangle_H
 \right]dr \notag \\
&\quad + \frac{1}{2}\int_t^s\mathbb{E}
 \left[
   {\rm Tr} \left(
        G_r G_r^* \partial _x\partial_\mu
       \varphi(r,\mathbb{P}_{X_{\cdot\wedge r}})(X_{\cdot\wedge r})
   \right)
 \right]dr,
\end{align}
for every $s\in[t,T]$.
\end{Theorem}
\begin{proof}[\textbf{Proof.}]
By Definition \ref{D:C12} there exists $\hat\varphi\colon\mathscr{\hat H}\rightarrow\mathbb{R}$ such that $\hat\varphi$ is consistent with $\varphi$ and $\hat\varphi\in\boldsymbol C_b^{1,2}(\mathscr{\hat H})$. As a consequence, by Theorem \ref{T:ItoD} we have the It\^o formula
\begin{align*}
\hat\varphi(s,\hat\mathbb{P}_{X_{\cdot\wedge s}}) &= \hat\varphi(t,\hat\mathbb{P}_{\xi_{\cdot\wedge t}}) + \int_t^s \partial_t \hat\varphi(r,\hat\mathbb{P}_{X_{\cdot\wedge r}})\,dr + \int_t^s
\mathbb{E}
 \left[   \langle F_r,\partial_\mu \hat\varphi(r,\hat\mathbb{P}_{X_{\cdot\wedge r}})(X_{\cdot\wedge r})\rangle_H
 \right]dr \notag \\
&\quad + \frac{1}{2}\int_t^s\mathbb{E}
 \left[
   {\rm Tr} \left(
        G_r G_r^* \partial _x\partial_\mu
       \hat\varphi(r,\hat\mathbb{P}_{X_{\cdot\wedge r}})(X_{\cdot\wedge r})
   \right)
 \right]dr,
\end{align*}
for every $s\in[t,T]$. Using the fact that $\hat\varphi$ is consistent with $\varphi$ and recalling the definition of pathwise derivatives of $\varphi$ (see Definition \ref{D:C12}), we obtain the claimed It\^o formula for $\varphi$.
\end{proof}

{In order to apply It\^o's formula to our case we need the following variant of
Theorem \ref{T:Ito} (for a similar result, see Proposition 1.165 in \cite{FabbriGozziSwiech}).}

\begin{Theorem}\label{T:ItoForTest}
{Fix $t\in[0,T]$ and let $\xi\in\mathbf{S}_2(\mathbb{F})$ (namely, $\xi\in L^2(\Omega;C([0,T];H))$ and it is $\mathbb{F}$-progressively measurable). Let $A,b,\sigma$ be as in Assumption \ref{A_A,b,sigma}.
Let $X=X^{t,\xi,\alpha}$ be the unique mild solution of \eqref{cont-MKV-differential}.
Let $\varphi\colon\mathscr H\rightarrow\mathbb{R}$ belong to $\boldsymbol C_b^{1,2}(\mathscr H)$. Assume also that, for all
$(t,\mu,x)\in \mathscr H\times C([0,T];H)$,
$\partial_\mu \varphi(t,\mu)(x)\in D(A^*)$
and that the map
\[
\mathscr H \times C([0,T];H) \longrightarrow H
\qquad\qquad (t,\mu,x) \longmapsto A^*\partial\varphi_\mu(t,\mu)(x)
\]
is continuous and bounded
\footnote{ Indeed, in view of \eqref{EstimateX} here
    we could ask only
linear growth of $ \partial _\mu \varphi$ in $x$}..
Then the following variant of \textbf{It\^o formula} holds:
\begin{align}\label{Itonew}
\varphi(s,\mathbb{P}_{X_{\cdot\wedge s}}) &= \varphi(t,\mathbb{P}_{\xi_{\cdot\wedge t}}) +
\int_t^s \partial_t \varphi(r,\mathbb{P}_{X_{\cdot\wedge r}})\,dr +
\int_t^s\mathbb{E}
 \left[   \langle X_r,
A^* \partial_\mu \varphi(r,\mathbb{P}_{X_{\cdot\wedge r}})
 (X_{\cdot\wedge r})\rangle_H
 \right]dr \notag \\
&+\int_t^s\mathbb{E}\left[\langle
b_r\left(X,\mathbb{P}_{X_{\cdot\wedge r}}, \alpha_r,\mathbb{P}_{\alpha_r}\right),
 \partial_\mu \varphi(r,\mathbb{P}_{X_{\cdot\wedge r}})
 (X_{\cdot\wedge r})\rangle_H
 \right]dr \\
&+ \frac{1}{2}\int_t^s\mathbb{E}
 \left[{\rm Tr} \left(
\sigma_r\left(X,\mathbb{P}_{X_{\cdot\wedge r}},\alpha_r,\mathbb{P}_{\alpha_r}\right)
\sigma^*_r\left(X,\mathbb{P}_{X_{\cdot\wedge r}}, \alpha_r,\mathbb{P}_{\alpha_r}\right) \partial _x\partial_\mu
       \varphi(r,\mathbb{P}_{X_{\cdot\wedge r}})(X_{\cdot\wedge r})
   \right)
 \right]dr, \notag
\end{align}
for every $s\in[t,T]$.}
\end{Theorem}
\begin{proof}[\textbf{Proof.}]
  {The proof can be done proceeding along the same lines as in the proof of Proposition 1.165 in \cite{FabbriGozziSwiech}. We provide a sketch of proof.

\\
First of all if $A$ is a bounded operator from Theorem \ref{T:Ito} we immediately get \eqref{Itonew}.
Now take $A$ possibly unbounded and consider its Yosida approximations $A_n$, for $n\in \mathbb{N}$. Call, as in \eqref{cont-MKV-differential-An}, $X^n$ the solution of the state equation when $A$ is replaced by $A_n$. Then, from  \eqref{Itonew} we get
\begin{align*
\varphi(s,\mathbb{P}_{X^n_{\cdot\wedge s}}) &= \varphi(t,\mathbb{P}_{\xi_{\cdot\wedge t}}) +
\int_t^s \partial_t \varphi(r,\mathbb{P}_{X^n_{\cdot\wedge r}})\,dr +
\int_t^s\mathbb{E}
 \left[   \langle X^n_r,
A_n^* \partial_\mu \varphi(r,\mathbb{P}_{X^n_{\cdot\wedge r}})
 (X^n_{\cdot\wedge r})\rangle_H
 \right]dr \notag \\
&+\int_t^s\mathbb{E}\left[\langle
b_r\left(X^n,\mathbb{P}_{X^n_{\cdot\wedge r}}, \alpha_r,\mathbb{P}_{\alpha_r}\right),
 \partial_\mu \varphi(r,\mathbb{P}_{X^n_{\cdot\wedge r}})
 (X^n_{\cdot\wedge r})\rangle_H
 \right]dr \\
&+ \frac{1}{2}\int_t^s\mathbb{E}
 \left[{\rm Tr} \left(
\sigma_r\left(X^n,\mathbb{P}_{X^n_{\cdot\wedge r}},\alpha_r,\mathbb{P}_{\alpha_r}\right)
\sigma^*_r\left(X^n,\mathbb{P}_{X^n_{\cdot\wedge r}}, \alpha_r,\mathbb{P}_{\alpha_r}\right) \partial _x\partial_\mu
       \varphi(r,\mathbb{P}_{X^n_{\cdot\wedge r}})(X^n_{\cdot\wedge r})
   \right)
 \right]dr, \notag
\end{align*}
for every $s\in[t,T]$.
Now the convergence of all terms above follows applying, in a straightforward way,
the result of Proposition \ref{Prop-diff-MKVPD-An}.}
\end{proof}

\section{Hamilton-Jacobi-Bellman equation}
\label{S:HJB}

\subsection{Viscosity properties of the value function}

\label{sub:HJBviscosity}

For every $t\in[0,T]$, we introduce the set
\[
{\cal M}_t \coloneqq  \big\{\mathfrak a\colon\Omega\rightarrow{\rm U}\colon\mathfrak a\text{ is ${\cal F}_t$-measurable}\big\}.
\]
Note that, since the filtration ${\cal F}_t$ is right-continuous, we have
${\cal M}_{t}=\cap_{\varepsilon>0} {\cal M}_{t+\varepsilon}$.
We now consider the following Hamilton-Jacobi-Bellman (HJB) equation:
\begin{align}\label{HJB}
0 \ &= \ \partial_t w(t,\mu) + \mathbb{E}\langle \xi_t,A^*\partial_\mu w(t,\mu)(\xi)\rangle_H \notag \\
&\quad \ + \sup_{\mathfrak a\in{\cal M}_t}\bigg\{\mathbb{E}\big[f_t\big(\xi,\mu,\mathfrak a,\mathbb{P}_{\mathfrak a}\big) + \big\langle b_t\big(\xi,\mu,{\mathfrak a},\mathbb{P}_{\mathfrak a}\big),\partial_\mu w(t,\mu)(\xi)\big\rangle_H\big] \\
&\quad \ + \dfrac{1}{2}\,\mathbb{E}\Big[\textup{Tr}\Big(\sigma_t\big(\xi,\mu,{\mathfrak a},\mathbb{P}_{\mathfrak a}\big)\sigma_t^*\big(\xi,\mu,{\mathfrak a},\mathbb{P}_{\mathfrak a}\big)\partial_x\partial_\mu w(t,\mu)(\xi)\Big)\Big]\bigg\},  \notag
\end{align}
for $(t,\mu)\in\mathscr H$, $t<T$, $\xi\in\mathbf{S}_2({\cal G})$ such that $\mathbb{P}_\xi=\mu$,
with terminal condition
\begin{equation}\label{eq:TCHJB}
w(T,\mu) \ = \ \mathbb{E}[g(\xi,\mu)], \qquad
\hbox{for $\mu\in{\cal P}_2(C([0,T];H))$, $\xi\in\mathbf{S}_2({\cal G})$ such that $\mathbb{P}_\xi=\mu$}.
\end{equation}

\begin{Definition}
We say that a function $w\colon\mathscr H\to \mathbb{R}$ belongs to the space $\boldsymbol C_{b,A^*}^{1,2}(\mathscr H)$
if it satisfies the following regularity assumptions:
\begin{itemize}
  \item[(i)] $w\colon\mathscr H\rightarrow\mathbb{R}$ belongs to $\boldsymbol C_b^{1,2}(\mathscr H)$;
  \item[(ii)] for all
$(t,\mu,\xi)\in \mathscr H\times \mathbf{S}_2(\mathbb{F})$,
$\partial_\mu \varphi(t,\mu)(\xi)\in L^2(\Omega;D(A^*))$
and the map
\[
\mathscr H \times \mathbf{S}_2(\mathbb{F}) \longrightarrow L^2(\Omega;H), \qquad\qquad (t,\mu,\xi) \longmapsto A^*\varphi(t,\mu)(\xi)
\]
is continuous and bounded.
\end{itemize}
\end{Definition}

\begin{Definition}
We say that a function $w\colon\mathscr H\to \mathbb{R}$
is a classical solution to the HJB equation \eqref{HJB}
with terminal condition \eqref{eq:TCHJB},
if it belongs to the space
$\boldsymbol C_{b,A^*}^{1,2}(\mathscr H)$
and satisfies \eqref{HJB}-\eqref{eq:TCHJB}.
\end{Definition}

Using Theorem \ref{T:ItoForTest} and Corollary \ref{C:DPP} we are able to prove the following result.

\begin{Theorem}\label{T:HJBreg}
Let Assumptions \ref{A_A,b,sigma} and \ref{A_f,g_cont} hold. Assume also that $b,\sigma,f$ are uniformly continuous in $t$, uniformly with respect to the other variables.
Assume that the value function $v$ (see \eqref{v}) belongs to the space
$\boldsymbol C_{b,A^*}^{1,2}(\mathscr H)$.
Then $v$ is a classical solution of \eqref{HJB}-\eqref{eq:TCHJB}.
\end{Theorem}

\begin{proof}[\textbf{Proof.}]
From Corollary \ref{C:DPP} we know that, for every $(t,\mu) \in \mathscr{H}$, for every $\xi \in\mathbf{S}_2(\mathbb{F})$ such $\mathbb{P}_\xi=\mu$, for every $\alpha \in {\cal U}$, and for every $h>0$ sufficiently small,
\begin{equation}\label{eq:DPPforHJB}
0 = \sup_{\alpha\in{\cal U}}\bigg\{\mathbb{E}\bigg[
\frac{1}{h}\int_t^{t+h}
f_r\big(X,\mathbb{P}_{X_{\cdot\wedge r}},
\alpha_r,\mathbb{P}_{\alpha_r}\big)\,dr\bigg] + \frac{1}{h}\left[v\big(t+h,\mathbb{P}_{X}\big)-v(t,\mu)
\right]\bigg\},
\end{equation}
where, for simplicity, we wrote simply $X$ in place of $X^{t,\xi,\alpha}$.
Now we use \eqref{Itonew} getting
\begin{align}\label{Itonewbis}
&\frac{1}{h}\left[v\big(t+h,\mathbb{P}_{X^{t,\xi,\alpha}}\big)-v(t,\mu) \right]
=
\frac{1}{h}\int_t^{t+h} \partial_t v(r,\mathbb{P}_{X_{\cdot\wedge r}})\,dr
+
\frac{1}{h}\int_t^{t+h}\mathbb{E}
 \left[   \langle X_r,
A^* \partial_\mu v(r,\mathbb{P}_{X_{\cdot\wedge r}})
 (X_{\cdot\wedge r})\rangle_H
 \right]dr
 \notag \\
&\qquad +\frac{1}{h}\int_t^{t+h}\mathbb{E}\left[\langle
b_r\left(X,\mathbb{P}_{X_{\cdot\wedge r}}, \alpha_r,\mathbb{P}_{\alpha_r}\right),
 \partial_\mu v(r,\mathbb{P}_{X_{\cdot\wedge r}})
 (X_{\cdot\wedge r})\rangle_H
 \right]dr
  \\
 \notag
&\qquad +\frac{1}{2h}\int_t^{t+h}\mathbb{E}
 \left[{\rm Tr} \left(
\sigma_r\left(X,\mathbb{P}_{X_{\cdot\wedge r}},\alpha_r,\mathbb{P}_{\alpha_r}\right)
\sigma^*_r\left(X,\mathbb{P}_{X_{\cdot\wedge r}}, \alpha_r,\mathbb{P}_{\alpha_r}\right) \partial _x\partial_\mu
       v(r,\mathbb{P}_{X_{\cdot\wedge r}})(X_{\cdot\wedge r})
   \right)
 \right]dr,
\end{align}
We now show, as in the typical proof of this result, the two inequalities.
First take any ${\mathfrak a}\in {\cal M}_t$ and consider the control
$\alpha\in {\cal U}$ defined as
$$
\alpha_s=0, \quad s\in [0,t), \qquad
\alpha_s={\mathfrak a}, \quad s\in [t,T]
$$
Then, from \eqref{eq:DPPforHJB} and \eqref{Itonewbis} we get
\begin{align}\label{Itonewter}
&0 \ge
\frac{1}{h}\int_t^{t+h}
\mathbb{E} f_r\big(X,\mathbb{P}_{X_{\cdot\wedge r}},
{\mathfrak a},\mathbb{P}_{{\mathfrak a}}\big)\,dr
+
\frac{1}{h}\int_t^{t+h} \partial_t v(r,\mathbb{P}_{X_{\cdot\wedge r}})\,dr
 \notag \\
&\qquad +
\frac{1}{h}\int_t^{t+h}\mathbb{E}
 \left[   \langle X_r,
A^* \partial_\mu v(r,\mathbb{P}_{X_{\cdot\wedge r}})
 (X_{\cdot\wedge r})\rangle_H
 \right]dr
 \notag \\
&\qquad +\frac{1}{h}\int_t^{t+h}\mathbb{E}\left[\langle
b_r\left(X,\mathbb{P}_{X_{\cdot\wedge r}}, {\mathfrak a},\mathbb{P}_{{\mathfrak a}}\right),
 \partial_\mu v(r,\mathbb{P}_{X_{\cdot\wedge r}})
 (X_{\cdot\wedge r})\rangle_H
 \right]dr
 \\ \notag
&\qquad +\frac{1}{2h}\int_t^{t+h}\mathbb{E}
 \left[{\rm Tr} \left(
\sigma_r\left(X,\mathbb{P}_{X_{\cdot\wedge r}},{\mathfrak a},\mathbb{P}_{{\mathfrak a}}\right)
\sigma^*_r\left(X,\mathbb{P}_{X_{\cdot\wedge r}}, {\mathfrak a},\mathbb{P}_{{\mathfrak a}}\right) \partial _x\partial_\mu
       v(r,\mathbb{P}_{X_{\cdot\wedge r}})(X_{\cdot\wedge r})
   \right)
 \right]dr,
\end{align}
Using the regularity of $v$ and the continuity properties of $b,\sigma,f$ we get, passing to the limit for $h \to 0^+$
\begin{align}\label{Itonew4}
0 \ge \
&\partial_t v(t,\mu) + \mathbb{E}\langle \xi_t,A^*\partial_\mu v(t,\mu)(\xi)\rangle_H
\mathbb{E}\big[f_t\big(\xi,\mu,\mathfrak a,\mathbb{P}_{\mathfrak a}\big) + \big\langle b_t\big(\xi,\mu,{\mathfrak a},\mathbb{P}_{\mathfrak a}\big),\partial_\mu v(t,\mu)(\xi)\big\rangle_H\big]
\notag
\\
&+\,\dfrac{1}{2}\mathbb{E}\Big[\textup{Tr}\Big(\sigma_t\big(\xi,\mu,{\mathfrak a},\mathbb{P}_{\mathfrak a}\big)\sigma_t^*\big(\xi,\mu,{\mathfrak a},\mathbb{P}_{\mathfrak a}\big)\partial_x\partial_\mu v(t,\mu)(\xi)\Big)\Big]
\end{align}
Then the inequality $\ge$ follows by the arbitrariness of ${\mathfrak a}$.
We now prove the opposite inequality. For every $\varepsilon>0$ we take  $\alpha^\varepsilon\in {\cal U}$ such that, denoting by $X^\varepsilon$ the corresponding state trajectory,
\begin{equation}\label{eq:DPPforHJBeps}
-\varepsilon \le \mathbb{E}\bigg[
\frac{1}{\varepsilon}\int_t^{t+\varepsilon}
f_r\big(X^\varepsilon,\mathbb{P}_{X^\varepsilon_{\cdot\wedge r}},
\alpha^\varepsilon_r,\mathbb{P}_{\alpha^\varepsilon_r}\big)\,dr\bigg] + \frac{1}{\varepsilon}\left[v\big(t+\varepsilon,\mathbb{P}_{X^\varepsilon}\big)-v(t,\mu)
\right]\bigg\},
\end{equation}
Now we apply Ito's formula \eqref{Itonewbis} above, for $h=\varepsilon$, getting
\begin{align}\label{eq:DPPforHJBepsnew}
&-\varepsilon \le \mathbb{E}\bigg[
\frac{1}{\varepsilon}\int_t^{t+\varepsilon}
f_r\big(X^\varepsilon,\mathbb{P}_{X^\varepsilon_{\cdot\wedge r}},
\alpha^\varepsilon_r,\mathbb{P}_{\alpha^\varepsilon_r}\big)\,dr\bigg] +
\frac{1}{\varepsilon}\int_t^{t+\varepsilon}
\partial_t v(r,\mathbb{P}_{X^\varepsilon_{\cdot\wedge r}})\,dr
\notag\\
&+
\frac{1}{\varepsilon}\int_t^{t+\varepsilon}\mathbb{E}
 \left[   \langle X^\varepsilon_r,
A^* \partial_\mu v(r,\mathbb{P}_{X^\varepsilon_{\cdot\wedge r}})
 (X^\varepsilon_{\cdot\wedge r})\rangle_H
 \right]dr
 \notag \\
&\qquad +\frac{1}{\varepsilon}\int_t^{t+\varepsilon}\mathbb{E}\left[
\langle
b_r\left(X^\varepsilon,\mathbb{P}_{X^\varepsilon_{\cdot\wedge r}}, \alpha_r,\mathbb{P}_{\alpha_r}\right),
 \partial_\mu v(r,\mathbb{P}_{X^\varepsilon_{\cdot\wedge r}})
 (X^\varepsilon_{\cdot\wedge r})\rangle_H
 \right]dr
  \\
 \notag
&\qquad +\frac{1}{2\varepsilon}\int_t^{t+\varepsilon}\mathbb{E}
 \left[{\rm Tr} \left(
\sigma_r\left(X^\varepsilon,\mathbb{P}_{X^\varepsilon_{\cdot\wedge r}},\alpha_r,\mathbb{P}_{\alpha_r}\right)
\sigma^*_r\left(X^\varepsilon,\mathbb{P}_{X^\varepsilon_{\cdot\wedge r}}, \alpha_r,\mathbb{P}_{\alpha_r}\right) \partial _x\partial_\mu
       v(r,\mathbb{P}_{X^\varepsilon_{\cdot\wedge r}})(X^\varepsilon_{\cdot\wedge r})
   \right)
 \right]dr,
\end{align}
By Remark \ref{rm:convSEinitialdatum} we obtain that, as $\varepsilon \to 0$,
$X^\varepsilon_{\cdot\wedge r} \to \xi_{\cdot\wedge t}$  and $\mathbb{P}_{X^\varepsilon_{\cdot\wedge r}} \to \mathbb{P}_{\xi_{\cdot\wedge t}}$, hence
the second and third integrals of the above right-hand side converge to
$$
\partial_t v(t,\mu)
+\mathbb{E}\left[\langle \xi_t,
A^* \partial_\mu v(t,\mu)(\xi)\rangle_H\right]
$$
The remaining integrals of the right-hand side of
\eqref{eq:DPPforHJBepsnew} can be rewritten as
\begin{align}\label{eq:DPPforHJBepsnewbis}
\frac{1}{\varepsilon}\int_t^{t+\varepsilon}
\bigg(\mathbb{E}\left[
f_r\big(X^\varepsilon,\mathbb{P}_{X^\varepsilon_{\cdot\wedge r}},
\alpha^\varepsilon_r,\mathbb{P}_{\alpha^\varepsilon_r}\big)
+
\langle
b_r\left(X^\varepsilon,\mathbb{P}_{X^\varepsilon_{\cdot\wedge r}}, \alpha_r,\mathbb{P}_{\alpha_r}\right),
 \partial_\mu v(r,\mathbb{P}_{X^\varepsilon_{\cdot\wedge r}})
 (X^\varepsilon_{\cdot\wedge r})\rangle_H
 \right]
\\
\notag
\mathbb{E}
 \left[{\rm Tr} \left(
\sigma_r\left(X^\varepsilon,\mathbb{P}_{X^\varepsilon_{\cdot\wedge r}},\alpha_r,\mathbb{P}_{\alpha_r}\right)
\sigma^*_r\left(X^\varepsilon,\mathbb{P}_{X^\varepsilon_{\cdot\wedge r}}, \alpha_r,\mathbb{P}_{\alpha_r}\right) \partial _x\partial_\mu
       v(r,\mathbb{P}_{X^\varepsilon_{\cdot\wedge r}})(X^\varepsilon_{\cdot\wedge r})
   \right)
 \right]\bigg)dr
\end{align}
Recall now that, by our assumptions, $b$ and $\sigma$ are uniformly continuous in $(t,x,\mu)$ uniformly with respect to the other variables and that $f$ is locally uniformly continuous in $(x,\mu)$ uniformly with respect to the other variables.
Hence, using again Remark \ref{rm:convSEinitialdatum} we obtain that
\eqref{eq:DPPforHJBepsnewbis} can be rewritten as
\begin{align}\label{eq:DPPforHJBepsnewter}
\frac{1}{\varepsilon}\int_t^{t+\varepsilon}
\bigg(\mathbb{E}\left[
f_t\big(\xi,\mu,
\alpha^\varepsilon_r,\mathbb{P}_{\alpha^\varepsilon_r}\big)
+
\langle
b_t\left(\xi,\mu, \alpha_r,\mathbb{P}_{\alpha_r}\right),
 \partial_\mu v(t,\mu)
 (\xi)\rangle_H
 \right]
\\
\notag
\mathbb{E}
 \left[{\rm Tr} \left(
\sigma_t\left(\xi,\mu,\alpha_r,\mathbb{P}_{\alpha_r}\right)
\sigma^*_r\left(\xi,\mu, \alpha_r,\mathbb{P}_{\alpha_r}\right) \partial_x\partial_\mu
       v(t,\mu)(\xi)
   \right)
 \right]\bigg)dr + \rho (\varepsilon)
\end{align}
where $\rho (\varepsilon)\to 0$ as $\varepsilon \to 0$.
It follows
\begin{align}\label{HJBeps}
&0\le \varepsilon + \rho (\varepsilon) +\partial_t v(t,\mu) + \mathbb{E}\langle \xi_t,A^*\partial_\mu v(t,\mu)(\xi)\rangle_H \notag \\
&+\,\sup_{\mathfrak a\in{\cal M}_{t+\varepsilon}}\bigg\{\mathbb{E}\big[f_t\big(\xi,\mu,\mathfrak a,\mathbb{P}_{\mathfrak a}\big) + \big\langle b_t\big(\xi,\mu,{\mathfrak a},\mathbb{P}_{\mathfrak a}\big),\partial_\mu v(t,\mu)(\xi)\big\rangle_H\big] \\
&+\,\dfrac{1}{2}\,\mathbb{E}\Big[\textup{Tr}\Big(\sigma_t\big(\xi,\mu,{\mathfrak a},\mathbb{P}_{\mathfrak a}\big)\sigma_t^*\big(\xi,\mu,{\mathfrak a},\mathbb{P}_{\mathfrak a}\big)\partial_x\partial_\mu v(t,\mu)(\xi)\Big)\Big]\bigg\}  \notag
\end{align}
Since $\cap_{\varepsilon>0} {\cal M}_{t+\varepsilon}={\cal M}_{t}$ the claim follows sending $\varepsilon \to 0$.
\end{proof}

Now, we provide the definition of viscosity solution that we shall  use.

\begin{Definition}
We say that a function $w\colon\mathscr H\to \mathbb{R}$
is a viscosity subsolution (respectively supersolution) to the HJB equation \eqref{HJB}
with terminal condition \eqref{eq:TCHJB},
if:
\begin{itemize}
\item $w(T,\mu)\leq(\text{respectively $\geq$})\,\mathbb{E}[g(\xi,\mu)]$, for $\mu\in{\cal P}_2(C([0,T];H))$, $\xi\in\mathbf{S}_2({\cal G})$ such that $\mathbb{P}_\xi=\mu$;
\item for $(t,\mu) \in \mathscr H$ and for every test function $\varphi\in \boldsymbol C_{b,A^*}^{1,2}(\mathscr H)$
such that $w-\varphi$ has a maximum at $(t,\mu)$ (with value $0$), one has that \eqref{HJB}-\eqref{eq:TCHJB} is satisfied with the inequality $\le$ $($respectively $\ge$$)$ in place of the equality and with $\varphi$ in place of $w$.
\end{itemize}
Moreover, $w$ is called a viscosity solution of
\eqref{HJB}-\eqref{eq:TCHJB} if it is both a viscosity subsolution and a viscosity supersolution.
\end{Definition}

\begin{Theorem}\label{T:HJBvisc}
Let Assumptions \ref{A_A,b,sigma} and \ref{A_f,g_cont} hold. Assume also that $b,\sigma,f$ are uniformly continuous in $t$, uniformly with respect to the other variables.
Then, the value function $v$ is a viscosity solution of \eqref{HJB}-\eqref{eq:TCHJB}.
\end{Theorem}

\begin{proof}[\textbf{Proof.}]
The proof follows exactly the same lines as in the proof of Theorem \ref{T:HJBreg}, simply replacing $v$ with $\varphi$.
\end{proof}

\color{black}

\subsection{Alternative forms of the HJB equation}
\label{sub:alterHJBviscosity}

We derive alternative forms of the Hamilton-Jacobi-Bellman equation \eqref{HJB} relying on technical results reported in Appendix \ref{App:HJB}. We first need to introduce the following sets:
\begin{itemize}
\item ${\cal M}_{\cal G}$ is the set
\[
{\cal M}_{\cal G} \coloneqq  \big\{\mathfrak a\colon\Omega\rightarrow{\rm U}\colon\mathfrak a\text{ is ${\cal G}$-measurable}\big\};
\]
\item $\check{\cal M}$ is the set of Borel-measurable maps $\mathrm{\check a}\colon C([0,T];H)\times[0,1]\rightarrow{\rm U}$;
\item ${\cal M}$ is the set of Borel-measurable maps $\mathrm a\colon C([0,T];H)\rightarrow{\rm U}$.
\end{itemize}
The technical results reported in Appendix \ref{App:HJB} provides the following key proposition.

\begin{Proposition}\label{P:AlternativeHJB}
{Suppose that \textup{\ref{A_A,b,sigma}} and \textup{\ref{A_f,g}} hold}. Let $(t,\mu)\in\mathscr H$, $w\in\boldsymbol C_b^{1,2}(\mathscr H)$, and define $F\colon C([0,T];H)\times{\rm U}\times{\cal P}({\rm U})\rightarrow\mathbb{R}$ by
\begin{align*}
F(x,u,\nu) &\coloneqq  f_t(x,\mu,u,\nu) + \big\langle b_t(x,\mu,u,\nu),\partial_\mu w(t,\mu)(x)\big\rangle_H \\
&\quad \ + \dfrac{1}{2}\,\textup{Tr}\Big(\sigma_t(x,\mu,u,\nu)\sigma_t^*(x,\mu,u,\nu)\partial_x\partial_\mu w(t,\mu)(x)\Big),
\end{align*}
for every $(x,u,\nu)\in C([0,T];H)\times{\rm U}\times{\cal P}({\rm U})$. Let also $\xi\in\mathbf{S}_2({\cal G})$ with $\mathbb{P}_\xi=\mu$.
\begin{enumerate}[\upshape 1)]
\item Suppose that $\xi$ is such that there exists a ${\cal G}$-measurable random variable $U_\xi$ having uniform distribution on $[0,1]$ and being independent of $\xi$ (by Lemma \ref{L:xi_U_indep} we know that for each $\mu$ there exist at least one $\xi$, with $\mathbb{P}_\xi=\mu$, satisfying this property). Then, it holds that
\begin{equation}\label{Formula_F_HJB}
\sup_{{\mathfrak a}\in{\cal M}_t} \mathbb{E}\big[F\big(\xi,{\mathfrak a},\mathbb{P}_{\mathfrak a}\big)\big] = \sup_{{\mathfrak a}\in{\cal M}_{\cal G}} \mathbb{E}\big[F\big(\xi,{\mathfrak a},\mathbb{P}_{\mathfrak a}\big)\big] = \sup_{\mathrm{\check a}\in\check{\cal M}} \mathbb{E}\big[F\big(\xi,\mathrm{\check a}(\xi,U_\xi),\mathbb{P}_{\mathrm{\check a}(\xi,U_\xi)}\big)\big].
\end{equation}
\item Suppose that $F$ does not depend on its last argument, namely $F=F(x,u)$. Then, it holds that
\begin{equation}\label{Formula_F_bis_HJB}
\sup_{{\mathfrak a}\in{\cal M}_t} \mathbb{E}\big[F\big(\xi,{\mathfrak a}\big)\big] = \sup_{\mathrm a\in{\cal M}} \mathbb{E}\big[F(\xi,\mathrm a(\xi))\big] = \mathbb{E}\Big[\esssup_{u\in{\rm U}}F(\xi,u)\Big].
\end{equation}
\end{enumerate}
\end{Proposition}
\begin{proof}[\textbf{Proof.}]
Equalities \eqref{Formula_F_HJB} are a direct consequence of Lemma \ref{L:Formula_F}, while \eqref{Formula_F_bis_HJB} follows directly from equalities \eqref{Formula_F_bis} and \eqref{Formula_F_ter} of Lemma \ref{L:Formula_F_bis}.
\end{proof}

\begin{Remark}
{Notice that the requirement that $F$ does not depend on $\nu$ in item 2) of Proposition \ref{P:AlternativeHJB} is necessary for the validity of the first equality in \eqref{Formula_F_bis_HJB} (we do not consider the second equality in \eqref{Formula_F_bis_HJB} in this case, as it is not clear how to write the last quantity in \eqref{Formula_F_bis_HJB} when $F$ depends also on $\nu$). As a matter of fact, consider the following example.\\
\textbf{Example.} Take ${\rm U}=[0,1]$, endowed with its Borel $\sigma$-algebra, and let $F$ be given by
\[
F(x,u,\nu) = -\,{\cal W}_2(\nu,\lambda), \qquad \forall\,(x,u,\nu)\in C([0,T];H)\times[0,1]\times{\cal P}([0,1]),
\]
with $\lambda$ being the Lebesgue measure on the unit interval. Let also $\xi$ be constant and identically equal to some fixed path $\bar x\in C([0,T];H)$. Moreover, denote by $U_{\cal G}$ a ${\cal G}$-measurable random variable having distribution $\lambda$, whose existence follows from Lemma \ref{L:U_G}. Then, for every $t\in[0,T]$,
\[
\sup_{{\mathfrak a}\in{\cal M}_t} \big(- {\cal W}_2\big(\mathbb{P}_{\mathfrak a},\lambda\big)\big) = 0
\]
and the supremum is attained at ${\mathfrak a}^*$, where ${\mathfrak a}^*\coloneqq U_{\cal G}$. On the other hand, if $\mathrm a\in{\cal M}$ then $\mathrm a(\xi)$ is equal to the constant $\mathrm a(\bar x)$, so, in particular, $\mathbb{P}_{\mathrm a(\xi)}=\delta_{\mathrm a(\bar x)}$. This implies that
\begin{align*}
\sup_{\mathrm a\in{\cal M}} \big(- {\cal W}_2(\mathbb{P}_{\mathrm a(\xi)},\lambda)\big) = \sup_{c\in[0,1]} \big(- {\cal W}_2(\delta_c,\lambda)\big) &= - \inf_{c\in[0,1]}\bigg(\int_0^1 |c - r|^2\,dr\bigg)^{\frac{1}{2}} \\
&= - \inf_{c\in[0,1]} \sqrt{c^2 - c + \frac{1}{3}} = - \frac{1}{12}.
\end{align*}}
\end{Remark}

\begin{Remark}\label{R:esssup=sup}
Suppose that $F=F(x,u)$ and define $F^*\colon C([0,T];H)\rightarrow\mathbb{R}\cup\{+\infty\}$ as
\[
F^*(x) \coloneqq  \sup_{u\in{\rm U}} F(x,u), \qquad \forall\,x\in C([0,T];H).
\]
If $F^*$ is measurable, then $\esssup_{u\in{\rm U}}F(\xi,u)=F^*(\xi)$, $\mathbb{P}$-a.s., and the \emph{essential supremum} appearing in \eqref{Formula_F_bis_HJB} can be replaced with the \emph{supremum}, so that we obtain
\[
\sup_{{\mathfrak a}\in{\cal M}_t} \mathbb{E}\big[F(\xi,{\mathfrak a})\big] = \mathbb{E}\Big[\sup_{u\in{\rm U}}F(\xi,u)\Big].
\]
{Notice that, under assumptions \textup{\ref{A_A,b,sigma}} and \textup{\ref{A_f,g}},} it follows from Proposition 7.47 in \cite{BertsekasShreve} that $F^*$ is lower semi-analytic (see Definition 7.21 in \cite{BertsekasShreve} for the definition of \emph{lower semi-analytic}). However, we cannot in general say that $F^*$ is measurable (see for instance the discussion at the end of Section B.5 in \cite{BertsekasShreve}). Sufficient conditions ensuring the measurability of $F^*$ are given for instance in Proposition 7.32 of \cite{BertsekasShreve} and read as follows:
\begin{enumerate}[\upshape (a)]
\item If $F\colon C([0,T];H)\times{\rm U}\rightarrow\mathbb{R}$ is lower semi-continuous and ${\rm U}$ is compact, then $F^*$ is lower semi-continuous.
\item If $F\colon C([0,T];H)\times{\rm U}\rightarrow\mathbb{R}$ is upper semi-continuous, then $F^*$ is upper semi-continuous.
\end{enumerate}
\end{Remark}

\vspace{3mm}

\noindent It follows from Proposition \ref{P:AlternativeHJB} that, under \textup{\ref{A_A,b,sigma}} and \textup{\ref{A_f,g}}, the Hamilton-Jacobi-Bellman equation \eqref{HJB} can also be written in the following two alternative forms:
\begin{equation}\label{HJB_M_Gc}
\hspace{-4.3mm}\begin{cases}
\partial_t w(t,\mu) + \mathbb{E}\langle \xi_t,A^*\partial_\mu w(t,\mu)(\xi)\rangle_H \\
+\,\sup_{\mathfrak a\in{\cal M}_{\cal G}}\bigg\{\mathbb{E}\big[f_t\big(\xi,\mu,\mathfrak a,\mathbb{P}_{\mathfrak a}\big) + \big\langle b_t\big(\xi,\mu,{\mathfrak a},\mathbb{P}_{\mathfrak a}\big),\partial_\mu w(t,\mu)(\xi)\big\rangle_H\big] \\
+\,\dfrac{1}{2}\mathbb{E}\Big[\textup{Tr}\Big(\sigma_t\big(\xi,\mu,{\mathfrak a},\mathbb{P}_{\mathfrak a}\big)\sigma_t^*\big(\xi,\mu,{\mathfrak a},\mathbb{P}_{\mathfrak a}\big)\partial_x\partial_\mu w(t,\mu)(\xi)\Big)\Big]\bigg\} = 0, \hspace{3.35mm} (t,\mu)\in\mathscr H,\,t<T, \\
w(T,\mu) = \mathbb{E}[g(\xi,\mu)], \hspace{6.875cm} \mu\in\mathscr P_2(C([0,T];H)),
\end{cases}
\end{equation}
or, alternatively,
\begin{equation}\label{HJB_checkM}
\hspace{-4mm}\begin{cases}
\vspace{1mm}\partial_t w(t,\mu) + \mathbb{E}\langle \xi_t,A^*\partial_\mu w(t,\mu)(\xi)\rangle_H + \sup_{\mathrm{\check a}\in\check{\cal M}}\bigg\{\mathbb{E}\big[f_t\big(\xi,\mu,\mathrm{\check a}(\xi,U_\xi),\mathbb{P}_{\mathrm{\check a}(\xi,U_\xi)}\big) \\
\vspace{1mm}+ \big\langle b_t\big(\xi,\mu,\mathrm{\check a}(\xi,U_\xi),\mathbb{P}_{\mathrm{\check a}(\xi,U_\xi)}\big),\partial_\mu w(t,\mu)(\xi)\big\rangle_H\big] \\
\vspace{1mm}+ \dfrac{1}{2}\mathbb{E}\Big[\textup{Tr}\Big(\sigma_t\sigma_t^*\big(\xi,\mu,\mathrm{\check a}(\xi,U_\xi),\mathbb{P}_{\mathrm{\check a}(\xi,U_\xi)}\big)\partial_x\partial_\mu w(t,\mu)(\xi)\Big)\Big]\bigg\} = 0, \hspace{3mm} (t,\mu)\in\mathscr H,\,t<T, \\
w(T,\mu) = \mathbb{E}[g(\xi,\mu)], \hspace{6.825cm} \mu\in\mathscr P_2(C([0,T];H)),
\end{cases}
\end{equation}
where, in both \eqref{HJB_M_Gc} and \eqref{HJB_checkM}, $\xi\in\mathbf{S}_2({\cal G})$, with $\mathbb{P}_\xi=\mu$, is such that there exists a ${\cal G}$-measurable random variable $U_\xi$ having uniform distribution on $[0,1]$ and being independent of $\xi$ (we recall that, by Lemma \ref{L:xi_U_indep}, for each $\mu$ there exists at least one $\xi$, with $\mathbb{P}_\xi=\mu$, satisfying this latter property).

{Now, suppose that \textup{\ref{A_A,b,sigma}}, \textup{\ref{A_f,g}}} hold and also that the coefficients $b$, $\sigma$, $f$ do not depend on their last argument (namely, $b=b_t(x,\mu,u)$, $\sigma=\sigma_t(x,\mu,u)$, $f=f_t(x,\mu,u)$). Then, by Proposition \ref{P:AlternativeHJB} we deduce that the Hamilton-Jacobi-Bellman equation \eqref{HJB} can also be written in the following two alternative forms:
\begin{equation}\label{HJB_M}
\hspace{-4.6mm}\begin{cases}
\partial_t w(t,\mu) + \mathbb{E}\langle \xi_t,A^*\partial_\mu w(t,\mu)(\xi)\rangle_H \\
+ \sup_{\mathrm a\in{\cal M}}\bigg\{\mathbb{E}\big[f_t\big(\xi,\mu,\mathrm a(\xi)\big) + \big\langle b_t\big(\xi,\mu,\mathrm a(\xi)\big),\partial_\mu w(t,\mu)(\xi)\big\rangle_H\big] \\
+ \dfrac{1}{2}\mathbb{E}\Big[\textup{Tr}\Big(\sigma_t\big(\xi,\mu,\mathrm a(\xi)\big)\sigma_t^*\big(\xi,\mu,\mathrm a(\xi)\big)\partial_x\partial_\mu w(t,\mu)(\xi)\Big)\Big]\bigg\} = 0, \hspace{6mm} (t,\mu)\in\mathscr H,\,t<T, \\
w(T,\mu) = \mathbb{E}[g(\xi,\mu)], \hspace{6.9cm} \mu\in\mathscr P_2(C([0,T];H)),
\end{cases}
\end{equation}
for every $\xi\in\mathbf{S}_2({\cal G})$ with $\mathbb{P}_\xi=\mu$, or, alternatively:
\begin{equation}\label{HJB_esssup}
\hspace{-4.2mm}\begin{cases}
\partial_t w(t,\mu) + \mathbb{E}\langle \xi_t,A^*\partial_\mu w(t,\mu)(\xi)\rangle_H \\
+ \mathbb{E}\bigg[\esssup_{u\in{\rm U}}\bigg[f_t(\xi,\mu,u) + \big\langle b_t(\xi,\mu,u),\partial_\mu w(t,\mu)(\xi)\big\rangle_H \\
+ \dfrac{1}{2}\textup{Tr}\Big(\sigma_t(\xi,\mu,u)\sigma_t^*(\xi,\mu,u)\partial_x\partial_\mu w(t,\mu)(\xi)\Big)\bigg]\bigg] = 0, \hspace{2.05cm} (t,\mu)\in\mathscr H,\,t<T, \\
w(T,\mu) = \mathbb{E}[g(\xi,\mu)], \hspace{6.85cm} \mu\in\mathscr P_2(C([0,T];H)),
\end{cases}
\end{equation}
for every $\xi\in\mathbf{S}_2({\cal G})$ with $\mathbb{P}_\xi=\mu$.

\begin{Remark}
  \label{rm:HJBinv}
  In the case of the optimal investment problem outlined in Example \ref{ex:SE}-(ii) and in Remark \ref{rm:quadraticreward}, equation \eqref{eq:costinvest},
the HJB equation can be written as follows.
\begin{equation}\label{HJBInvestmentfinal}
\hspace{-4.2mm}\begin{cases}
\partial_t w(t,\mu) + \mathbb{E}\langle \xi_t,A^*\partial_\mu w(t,\mu)(\xi)\rangle_H \\
+ \mathbb{E}\bigg[e^{-rt}\<a_1,\xi_t\>_H
+\delta(\xi,\mu)\<\xi_t,\partial_\mu w(t,\mu)(\xi)\>_H
\\
+\esssup_{u\in{\rm U}}\Big[
\<Cu,\partial_\mu w(t,\mu)(\xi)\>_H -e^{-rt}(\<a_1,u\>_H + \<M u,u\>_H)\Big] \\
+ \dfrac{1}{2}\sigma^2\textup{Tr}
\Big(
\partial_x\partial_\mu w(t,\mu)(\xi)\Big)\bigg]
 = 0,  \hspace{5.9cm} (t,\mu)\in\mathscr H,\,t<T, \\
w(T,\mu) = \mathbb{E}[g(\xi,\mu)], \hspace{7.55cm} \mu\in\mathscr P_2(C([0,T];H)),
\end{cases}
\end{equation}
for every $\xi\in\mathbf{S}_2({\cal G})$ with $\mathbb{P}_\xi=\mu$.
Note that in the above case the $\esssup$ appearing in the Hamiltonian can be explicitly computed.
\end{Remark}

redpajama_set_name: RedPajamaArXiv