\documentclass[10pt]{article}
\parindent=14.5pt

\setlength{\oddsidemargin}{-0.08in}
\setlength{\textheight}{9.0in}
\setlength{\textwidth}{6.7in}
\setlength{\topmargin}{-0.5in}

%\usepackage[notref,notcite]{showkeys}

\usepackage{color,latexsym,amsfonts,amssymb}
\usepackage{amsmath,amsthm}
\usepackage{mathrsfs}
\usepackage{amsfonts,amsmath,epsfig,subfigure,cite}
\usepackage{pstricks}

\makeatletter
\@addtoreset{equation}{section}
\renewcommand{\thesection}{\arabic{section}}
\renewcommand{\theequation}{\thesection.\arabic{equation}}
%\renewcommand{\theequation}{\arabic{section}.\arabic{equation}}
\newcommand{\beq}[1]{\begin{equation} \label{#1}}
\newcommand{\eeq}{\end{equation}}
\newcommand{\bed}{\begin{displaymath}}
\newcommand{\eed}{\end{displaymath}}
\newcommand{\bea}{\bed\begin{array}{rl}}
\newcommand{\eea}{\end{array}\eed}
\newcommand{\disp}{\displaystyle}
\newcommand{\ad}{&\!\!\!\disp}
\newcommand{\aad}{&\disp}
\newcommand{\barray}{\begin{array}{ll}}
\newcommand{\earray}{\end{array}}
\allowdisplaybreaks

\newcommand{\wdt}{\widetilde}
\newcommand{\wdh}{\widehat}
\newcommand{\lbar}{\overline}
\newcommand{\bigO}{{\mathcal O}}
\newcommand{\rr}{{\mathbb R}}
\newcommand{\R}{{\mathbb R}}
\newcommand{\diag}{\hbox{diag}}

\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{hypothesis}[theorem]{Hypothesis}
\newtheorem{assumption}{Assumption}[section]
\newtheorem{definition}{Definition}[section]
\newtheorem{rem}[theorem]{Remark}
\newtheorem{exm}[theorem]{Example}
\newcommand{\thmref}[1]{Theorem~{\rm \ref{#1}}}
\newcommand{\lemref}[1]{Lemma~{\rm \ref{#1}}}
\newcommand{\corref}[1]{Corollary~{\rm \ref{#1}}}
\newcommand{\propref}[1]{Proposition~{\rm \ref{#1}}}
\newcommand{\defref}[1]{Definition~{\rm \ref{#1}}}
\newcommand{\remref}[1]{Remark~{\rm \ref{#1}}}
\newcommand{\exmref}[1]{Example~{\rm \ref{#1}}}
\newcommand{\nd}{\noindent}
\newcommand{\e}{\varepsilon}
\newcommand{\sss}{\mathbb{S}}
\newcommand{\E}{\mathbb{E}}
\newcommand{\PP}{\mathbb{P}}
\newcommand{\cd}{(\cdot)}

\begin{document}
 \title{ Approximation for stochastic functional differential equation with past-dependent switching}
\author{ Liting Gui,Jiayan Zhang, Shaobo Zhou\thanks{Corresponding author. zhoushaobowls@hust.edu.cn(S. Zhou).
The research of this author was supported  by the National Natural Science Foundation of China (Grant No. 12471279).} \\
\small School of Mathematics and Statistics, Huazhong University of Science and Technology, Wuhan\\
\small 430074,  China; Hubei Key Laboratory of Engineering Modeling and Scientific  Computing, \\ \small
  Huazhong University of Science and Technology, Wuhan 430074,  China.}

\maketitle
\noindent{\bf Abstract}\  This work is devoted to the convergence of the Euler-Maruyama approximation for stochastic functional differential equation with past-dependent random switching. Based on the Skorokhod representation of switching, we examine the existence and uniqueness of the exact solution as well as its moment boundedness. The weak convergence of the approximate solution is established by using the martingale problem formulation. Furthermore, we reveal the strong convergence in the $L^1$-norm, and give the convergence rate close to 0.5 order under bounded conditions. Two numerical examples are also provided to illustrate our results. \\
\noindent{\bf Key words} Stochastic functional differential equation; Past-dependent switching; Euler-Maruyama's approximation.


\renewcommand\baselinestretch{1.2}
\setlength{\baselineskip}{0.25in}
\section{Introduction and Motivation}\label{Intr}
In practical applications,  numerous complex systems that are influenced  by both internal factors and external environment simultaneously involve discrete and continuous processes. It is often inadequate to use only the classical deterministic differential equations and stochastic differential equations to describe this phenomenon. Owing to the coexistence and interaction of continuous dynamics and discrete events, the switching diffusion processes have attracted growing attention recently, such as stochastic control and optimization, biological and ecological systems, manufacturing systems, storage modelling, wire and wireless communication, two-time-scale systems, financial engineering.
See the monograph \cite{YinZhu2010,Mao2006} and reference therein for a more detailed and comprehensive introduction. Some examples in \cite{Mao2006,Pinsky1992} reveal that the random switching plays an important role in determining the properties of the overall system, including stability and recurrence. Thus the dynamical behavior of the systems with or without switching is quite different.

A switching diffusion is a two-component process $(x(t),\alpha(t))$, where $x(t)$ is the continuous component dependent on the state of $\alpha(t)$ describing the dynamic evolution of the system,  and $\alpha(t)$ is the discrete component taking values in discrete state space with finite or countably infinite points.
At present, there are a significant number of papers devoted to the study of switching and some meaningful results have been achieved. The existing research mostly focuses on Markovian switching and state-dependent switching. For Markovian switching, the discrete component of the system is a continuous-time Markov chain and does not depend on the continuous components, see \cite{Mao2006} for details. However, continuous dynamics and discrete events are intertwined in many cases. The  state-dependent switching allows the discrete component to be dependent on the current state of continuous component. The basic properties, recurrence, ergodicity, numerical approximations, stability and applications of this process have been studied in \cite{YinZhu2010}. Furthermore, in recent years, the switching systems are extended to be able to depend on the past history of the continuous component, see \cite{Dang2016,Dang2018a,Dang2018c,Dang2024}.
In general, most books and papers discuss situations where the state of switching is finite, like \cite{Pinsky1993,YinZhu2010,Mao2006,Yin2010,Cloez2015,Shao2023,Wang2024}, but a few papers also begin to be concerned with infinite-state switching, for instance, \cite{Xi2017,Dang2018b,MaoYH2024}.

Since it is difficult to obtain explicit solutions for most deterministic systems and stochastic systems, the numerical approximation is also an important problem that many scholars pay attention to, among which Euler-Maruyama (EM) approximation is one of the most commonly used numerical schemes. There are a number of works investigating the numerical approximation of stochastic differential equations (SDEs) or stochastic functional differential equations (SFDEs), e.g. \cite{Kloeden1992,Wu2008,Mao2015,Zhou2017,Li2019,Li2024}.
The properties of numerical solutions for SDEs with Markovian switching have been well studied in \cite{Zong2016,Li2018,Bao2016a}.
Nevertheless, due to the difficulty that the transition probability matrices in each step are different caused by the dependence of switching and continuous component, relatively few results are available for numerical solutions with state-dependent switching. In addition to \cite{Yin2010}, the weak and strong convergence of the numerical solutions and the convergence rate are obtained by using the first-order expansion $I+\varepsilon Q(x)$ approximating transition matrix $\exp(Q(x)\varepsilon)$, and in \cite{Shao2018}, through the utilization of Skorokhod's representation of switching and direct discretization of the transition matrix, the paper deals with the strong convergence of this numerical approximation and get 1/2 order of error estimate in additive noise cases for finite-state switching.
To the best of our knowledge, the study on the numerical approximation of SFDEs with switching is still under exploration. The numerical ergodicity of EM and backward EM sequences for SFDEs with finite-state Markovian switching are considered in \cite{Bao2023,Dang2021} and \cite{Shi2022}, respectively, and \cite{Tran2023} has established the mean square convergence and convergence rate of the EM approximations for SFDEs with impulsive perturbations and Markovian switching. But the results on numerical approximation of SFDEs with state-dependent switching are little, except that \cite{Shao2021} proves the strong convergence of EM approximations and gives the order of error for the case where the diffusion coefficient is 1.

Motivated by the above, this paper will consider the EM approximations for SFDEs with past-dependent switching where both continuous and discrete are affected by the past history.
The high coupling and delay of the whole systems make the analysis challenging.
Compared with the existing literature, our main contributions can be summarized as follows:
\begin{itemize}
 \item [(1)] With reference to the construction of Poisson random measure in \cite{Shao2021}, we examine the existence and uniqueness of the exact solution and show some basic properties of the solution. Based on Euler-Maruyama's approximations of SFDEs and Skorokhod's representation of switching, the EM approximations for SFDEs with past-dependent switching is proposed.
 \item [(2)] By proving the tightness of the switching approximation sequence, we show the existence of its limit. The weak convergence of the approximation sequence to the exact solution of the whole system is then illustrated by characterizing the limit process through martingale problem formulation with appropriate operators.
 \item [(3)] We also reveal the strong convergence in the $L^1$-norm, and we furter give the convergence rate close to 1/2 order under the condition that the coefficients are both bounded by more delicate estimates and sophisticated calculations, which is more general than in the existing literature.
\end{itemize}

The rest of the paper is organized as follows. Section 2 gives some notations, assumptions and preliminary results on the exact solution of the SFDEs with past-dependent random switching. Section 3 proposes Euler-Maruyama approximation for the system and studies the weak convergence and convergence rate of the EM approximation under different conditions. Section 4 presents two examples to illustrate our results.


\section{Preliminaries, Notation, and Assumptions}\label{Pre}
Throughout the paper, let $(\Omega, \mathcal{F}, {\{\mathcal{F}_t }\}_{t\geq0} ,\mathbb{P})$ be a complete probability space with a filtration ${\{\mathcal{F}_t }\}_{t\geq0}$ satisfying the usual conditions, i.e., it is increasing and right continuous while $\mathcal{F}_0$ contains all $\mathbb{P}$ -null sets. Let $w(t)$ be a d-dimensional standard Brownian motion defined on the complete probability space. Denote by $|x|$ the Euclidean norm of $x\in \mathbb{R}^{n}$ and $\|A\|_{\rm HS}$ is the Hilbert-Schmidt norm of matrix $A$. For a vector or matrix $A$, denote its transpose by $A^T$. Denote $\mathbb{R}_+=[0, \infty)$ and $\mathcal{S}=\{1,2,\cdots,N\}$, where $N$ is a positive integer. The segment function of $x(t):R_+\rightarrow \mathbb{R}^{n}$, $x_t=\{x(t+\theta): -\tau\leq\theta\leq0\}\in C([-\tau,0]; \mathbb{R}^n)$, where $C([-\tau,0]; \mathbb{R}^n)$ represents the space of $\mathbb{R}^{n}$-valued continuous functions defined on $[-\tau,0]$ with the norm $\|\phi\|=\sup_{t\in[-\tau,0]}|\phi(t)|$ for $\phi\in C([-\tau,0]; \mathbb{R}^n).$ The spaces $D([0, T];\mathcal{S})$ denotes the sets of all right-continuous functions with left limits defined on $[0,T]$ and taking values in $\mathcal{S}$, endowed with the Skorokhod topology. Throughout the paper, $c$ denotes a generic positive constant, whose value may change for different usage.
 Let $f(\cdot,\cdot):C([-\tau,0];\mathbb{R}^n)\times\mathcal{S}\rightarrow\mathbb{R}^{n}$ and $g(\cdot,\cdot):C([-\tau,0];\mathbb{R}^n)\times\mathcal{S}\rightarrow\mathbb{R}^{n\times d}$ be Borel measurable. Consider the following stochastic functional differential equation with random switching
\begin{equation}\label{main equation}
dx(t)=f(x_t,\alpha(t))dt+g(x_t,\alpha(t))dw(t)
\end{equation}
with initial data $x_0=\xi\in C([-\tau,0];\mathbb{R}^n),\alpha(0)=i_0\in\mathcal{S},$
where $\xi$ is an $\mathcal{F}_0$-measurable random variable such that $\mathbb{E}\|\xi\|^p<\infty$ for some $p>2$,
 where $\mathbb{E}$ denotes the expectation with respect to the probability measure $\mathbb{P}$.
  Moreover, assume that $\xi(\theta)$ is a H\"{o}lder continuous function, i.e. there exist constants $c>0$ and $\gamma_0>0$ such that for any $\theta_1,\theta_2\in[-\tau, 0]$,
 we have $|\xi(\theta_1)-\xi(\theta_2)|^2\leq c|\theta_1-\theta_2|^{\gamma_0}$.
 Assume that $\alpha(t)$ is a jump process taking values in the state space $\mathcal{S}$,
 and the switching intensity of $\alpha(t)$ depends on the segment process $x_t$,  that is, for $h>0$, the transition rate is given by
\begin{equation}\label{tranProb}
\mathbb{P}\{\alpha(t+h)=j|\alpha(t)=i,x_s,\alpha(s),s\leq t\}=
\left\{
\begin{array}{ll}
q_{ij}(x_t)h+o(h), &{\rm if}\ i\neq j,\\
1+q_{ii}(x_t)h+o(h), &{\rm if}\ i=j,
\end{array}
 \right.
\end{equation}
where $q_{ij}(\cdot):C([-\tau,0]; \mathbb{R}^n)\rightarrow \mathbb{R}$ for $i,j\in\mathcal{S}$ satisfies $q_{ij}(\phi)\geq 0$ for each $i\neq j$ and $\sum_{j\in\mathcal{S}}q_{ij}(\phi)=0$ for all $\phi\in C([-\tau,0]; \mathbb{R}^n)$. Denote by the transition rate matrix $Q(\cdot)=(q_{ij}(\cdot))_{i,j\in \mathcal{S}}$ and $q_{i}(\phi):=\sum_{j\in \mathcal{S},j\neq i}q_{ij}(\phi).$
To proceed, let us impose the following assumptions on the transition rate in (\ref{tranProb}).
\begin{itemize}
\item[\textbf{(A1)}] $M:=\sup_{i\in \mathcal{S}}\sum_{j\in \mathcal{S}, j\neq i}\sup_{\phi\in C([-\tau,0]; \mathbb{R}^n)}q_{ij}(\phi)<\infty$.
\end{itemize}
\begin{itemize}
\item[\textbf{(A2)}] For each $\phi_1,\phi_2\in C([-\tau,0]; \mathbb{R}^n)$, there exists a constant $\bar{c}>0$ such that
$$\|Q(\phi_1)-Q(\phi_2)\|_{l_1}:=\sup_{i\in \mathcal{S}}\sum_{j\neq i}|q_{ij}(\phi_1)-q_{ij}(\phi_2)|\leq\bar{c}\|\phi_1-\phi_2\|.$$
\end{itemize}
According to Skorokhod's representation of jumping processes, the evolution of the random switching $\alpha(t)$ can be expressed as the solution to a stochastic differential equation with respect to a Poisson random measure (see, e.g.\cite{Skorokhod1989,Dang2016,Shao2021,MaoYH2024,Shao2015a}).
For each function $\phi\in C([-\tau,0]; \mathbb{R}^n)$, we construct a sequence of consecutive left-closed and right-open intervals $\{\Gamma_{ij}(\phi):i,j\in\mathcal{S},i\neq j\}$ on the half-line as follows
\begin{eqnarray*}
&&\Gamma_{12}(\phi)=\big[0,q_{12}(\phi)\big),\\
&&\Gamma_{13}(\phi)=\big[q_{12}(\phi),q_{12}(\phi)+q_{13}(\phi)\big),\\
&&\cdots\\
&&\Gamma_{1N}(\phi)=\Big[\sum_{j=1}^{N-1}q_{1j}(\phi),q_{1}(\phi)\Big),\\
&&\Gamma_{21}(\phi)=\big[q_{1}(\phi),q_{1}(\phi)+q_{21}(\phi)\big),\\
&&\Gamma_{23}(\phi)=\big[q_{1}(\phi)+q_{21}(\phi),q_{1}(\phi)+q_{21}(\phi)+q_{23}(\phi)\big),\\
&&\cdots\\
&&\Gamma_{ij}(\phi)=\Big[\sum_{k=1}^{i-1}q_{k}(\phi)+\sum_{k=1,k\neq i}^{j-1}q_{ik}(\phi),\sum_{k=1}^{i-1}q_{k}(\phi)+\sum_{k=1,k\neq i}^{j}q_{ik}(\phi)\Big),\ j>1,\ j\neq i,\\
&&\cdots
\end{eqnarray*}
where the length of each interval is $q_{ij}(\phi)$. For convenience of notation, we set $\Gamma_{ii}(\phi)=\emptyset$ and $\Gamma_{ij}(\phi)=\emptyset$ if $q_{ij}(\phi)=0$.

Next, we introduce the concrete construction of Poisson random measure. Due to assumption (A1), $H=N(N-1)M$ is an upper bound of the total length of interval sequences $\{\Gamma_{ij}(\phi):i,j\in\mathcal{S}\}$.
Let $\xi_k(k=1,2,\cdots)$ be a sequence of random variable taking values in $[0,H]$ with $\mathbb{P}(\xi_k\in dx)=\frac{\mathfrak{m}(dx)}{H}$, where $\mathfrak{m}(dx)$ denotes the Lebesgue measure on $\mathbb{R}_+.$ Let $\tau_k(k=1,2,\cdots)$ be nonnegative random variables such that $\mathbb{P}(\tau_k>t)=\exp(-tH)$ for $t\geq 0.$ Suppose all $\xi_k(k=1,2,\cdots)$ and $\tau_k(k=1,2,\cdots)$ to be mutually independent. Set $\zeta_0=0, \ \zeta_1=\tau_1, \ \zeta_2=\tau_1+\tau_2, \ \cdots, \ \zeta_k=\tau_1+\tau_2+\cdots+\tau_k,\ \cdots.$ Take
$D_p=\bigcup_{k\geq0}\{\zeta_k\}$ and $p(t)=\sum_{0\leq s<t}\Delta p(s),\ \Delta p(s)=0 \ \ {\rm for}\ s\notin D_p,\ \Delta p(\zeta_k)=\xi_k, \ k=1,2,\cdots.$
Then $p(\cdot)$ is a Poisson point process which is independent of the Brownian motion $w(\cdot)$ and the jumping height at the jumping time $\zeta_k$ is $\xi_k$.
Now  we define a counting measure $\mathcal{N}(dt,dz)$ on $(0,\infty)\times\mathbb{R}_+$ by
$\mathcal{N}((0,t]\times A)=\#\{s\in D_p:0<s\leq t,\ \Delta p(s)\in A\},\ t>0,\ A\in\mathscr{B}([0,\infty)).$
 Moreover, the associated Poisson random measure is $\mathcal{N}(dt,dz)$ with intensity $dt\times \mathfrak{m}(dz)$.
 Define a function $h:C([-\tau,0];\mathbb{R}^n)\times \mathcal{S}\times \mathbb{R}$ by
$$h(\phi,i,z)=\sum_{j\in\mathcal{S}, j\neq i}(j-i)\mathbf{1}_{\{\Gamma_{ij}(\phi)\}}(z).$$
That is, for each $i\in\mathcal{S}$, if $z\in\Gamma_{ij}(\phi)$, $h(\phi,i,z)=j-i$ with $i\neq j$, otherwise $h(\phi,i,z)=0$.
Then the Skorokhod's representation gives that the process $\alpha(t)$ is a solution to
\begin{equation}\label{SkorokRepre}
d\alpha(t)=\int_\mathbb{R}h(x_t,\alpha(t-),z)\,\mathcal{N}(dt,dz),
\end{equation}
where $\alpha(t-)=\lim_{s<t, s\rightarrow t}\alpha(s)$ and $\mathcal{N}(dt,dz)$ is independent of $w(\cdot)$.
It follows that
\begin{equation}\label{SkoDiffer}
\alpha(t+h)=\alpha(t)+\sum_{\substack{t \leq s\leq t+h \\ s \in D_p}}\sum_{j\in\mathcal{S}}(j-\alpha(s-))\mathbf{1}_{\Gamma_{\alpha(s-)j}(x_s)}(\Delta p(s)).
\end{equation}
In particular, if $\alpha(t)=i$ and $\zeta_{k-1}^i\leq t<\zeta_k^i$ for some $k$, then
\begin{equation}
\alpha(\zeta_k^i)=i+\sum_{j\in\mathcal{S}}(j-i)\mathbf{1}_{\Gamma_{ij}(x_{\zeta_k^i})}(\Delta p(\zeta_k^i))=i+\sum_{j\in\mathcal{S}}(j-i)\mathbf{1}_{\Gamma_{ij}(x_{\zeta_k^i})}(\xi_k^i).
\end{equation}
 This means that the first jumping time of the point process $p(t)$ after time $t$ is $\zeta_k^i$ and the corresponding jumping height is $\xi_k^i$. The pair $(x(t),\alpha(t))$ is therefore a solution to the stochastic differential equations
\begin{equation}\label{SkorSDE}
\left\{
\begin{array}{ll}
dx(t)=f(x_t,\alpha(t))dt+g(x_t,\alpha(t))dw(t),\\
d\alpha(t)=\int_\mathbb{R}h(x_t,\alpha(t-),z)\,\mathcal{N}(dt,dz).
\end{array}
 \right.
\end{equation}
For each $i\in\mathcal{S}$, let $V(\cdot,i)\in C^2(\mathbb{R}^n;\mathbb{R})$, the space of twice continuously differentiable functions. Define an operator $(\mathcal{L}V)(\cdot,\cdot):C([-\tau,0]; \mathbb{R}^n)\times \mathcal{S}\rightarrow\mathbb{R}$ associated with (\ref{main equation}) by
\begin{eqnarray}\label{Loperator}
\mathcal{L}V(\phi,i)=\sum_{k=1}^nf_k(\phi,i)V_k(\phi(0),i)+\frac{1}{2}\sum_{k,l=1}^na_{kl}(\phi,i)V_{kl}(\phi(0),i)+\sum_{j\neq i}q_{ij}(\phi)[V(\phi(0),j)-V(\phi(0),i)]
\end{eqnarray}
for $\phi\in C([-\tau,0]; \mathbb{R}^n)$, where $A(\phi,i)=(a_{ij}(\phi,i))_{n\times n}=g(\phi,i)g^T(\phi,i).$
Suppose that $(x(t),\alpha(t))$ satisfies (\ref{SkorSDE}), applying the generalized It\^{o}'s formula (see\cite[p.29]{YinZhu2010} or \cite[Theorem 1.45]{Mao2006}) leads to
\begin{equation}\label{fItoFormu}
V(x(t),\alpha(t))-V(x(0),\alpha(0))=\int_0^t(\mathcal{L}V)(x_s,\alpha(s))ds+M_1(t)+M_2(t), %\ \ a.s.,
\end{equation}
where $M_1(t)=\int_0^t\nabla V(x(s),\alpha(s))g(x_s,\alpha(s))dw(s)$ and
\begin{equation}
M_2(t)=\int_0^t\int_{\mathbb{R}}[V(x(s),\alpha(0)+h(x_s,\alpha(s),z))-V(x(s),\alpha(s))\mu(ds,dz)
\end{equation}
and $\mu(ds,dz)=\mathcal{N}(dt,dz)-dt\times\mathfrak{m}(dz)$ is the compensated Poisson random measure.
As a result,
\begin{equation}\label{Mf}
M_V(t):=V(x(t),\alpha(t))-V(x(0),\alpha(0))-\int_0^t(\mathcal{L}V)(x_s,\alpha(s))\,ds
\end{equation}
is a local martingale.

By applying the Skorokhod's representation (\ref{SkorokRepre}) and considering the concrete construction of Poisson random measure, we will demonstrate the wellposedness of the system (\ref{SkorSDE}) with given initial data in the strong sense and give the moment estimation of the solution. Meanwhile, the solution $(x(t),\alpha(t))$ to (\ref{SkorSDE}) satisfiing (\ref{tranProb}) is proved to show the equivalence between the two representations. To this end, we make the following assumption on the coefficients of (\ref{main equation}).
\begin{itemize}
\item[\textbf{(A3)}] For each $\phi_1,\phi_2\in C([-\tau,0]; \mathbb{R}^n)$ and $i\in \mathcal{S}$, there exists a constant $L>0$ such that
$$|f(\phi_1,i)-f(\phi_2,i)|\vee|g(\phi_1,i)-g(\phi_2,i)|\leq L\|\phi_1-\phi_2\|.$$
\end{itemize}
The global Lipschitz condition (A3) implies the linear growth condition of $f(\cdot,i)$
and $g(\cdot,i)$, i.e. for each $\phi\in C([-\tau,0];\mathbb{R}^n)$ and $i\in \mathcal{S}$, there is a constant $L_1>0$ such that
\begin{equation}\label{linear}
|f(\phi,i)|^2\vee|g(\phi,i)|^2\leq L_1(1+\|\phi\|^2).
\end{equation}

\begin{theorem}\label{ExisUniq}
Assume {\rm (A1)}-{\rm (A3)} hold, for each initial value $(x_0,\alpha(0))=(\xi,i_0)\in C([-\tau,0];\mathbb{R}^n)\times\mathcal{S}$, there exists a unique  strong solution $(x(t),\alpha(t))$ to {\rm(\ref{SkorSDE})} and the solution satisfies {\rm(\ref{tranProb})}, and the process $(x_t,\alpha(t))$ is a Markov process.
Moreover, for any $T>0$ and $p\geq 2$, there is a constant $c_{p,T}$, which is only dependent on $p$ and $T$, such that
\begin{equation}\label{moBound}
\mathbb{E}\Big[\sup_{-\tau\leq t\leq T}|x(t)|^p\Big]\leq c_{p,T}.
\end{equation}
\end{theorem}
The proof  will be given in the appendix.


\section{Euler-Maruyama's Approximation}\label{EM}
Let $\tau/m=h\in(0,1)$ be a time stepsize for some integer $m$, denote by $t_k=kh$ for $k=0,1,2,\cdots.$
 Consider the discretized EM scheme associated with (\ref{main equation}) and (\ref{tranProb})
\begin{align}\label{EMYkDelta}
y(t_{k+1})=y(t_k)+f(y_{t_k},\alpha'(t_k))h+g(y_{t_k},\alpha'(t_k))\Delta w(k)
\end{align}
 with the initial data $(y_0,\alpha'(0))=(\xi,i_0)$, where $\Delta w(t_k)=w(t_{k+1})-w(t_k),$ and
the discretized segment process $y_{t_k}=\{y_{t_k} (\theta):-\tau\leq\theta\leq0\}\in C([-\tau,0];\mathbb{R}^n)$ is defined by
\begin{equation}\label{stepYkDelta}
   y_{t_k}(\theta)=y(t_{k+i})+\frac{\theta-ih}{h}[y(t_{k+i+1})-y(t_{k+i})]
\end{equation}
for $\theta\in[t_i, t_{i+1}], i=-m,\cdots,-1$, namely, $y_{t_k}(\cdot)$ is the linear interpolation of $y(t_{k-m}),\cdots, y(t_k)$.
Obviously
\begin{equation}\label{stepYkDelta2}
   \|y_{t_k}\|=\max_{-m\leq i\leq 0}|y(t_{k+i})|\ \ \ k=0,1,2,\cdots.
\end{equation}
Assume that $\{\alpha'(t_k):k=0,1,2,\cdots\}$ is a discrete-time random switching. For each $k\geq0$
and  $y_{t_k}=\phi\in C([-\tau,0];\mathbb{R}^n)$, $\alpha'(t_k)$ has the transition probability matrix $\exp(Q(\phi)h)$ satisfying
\begin{equation}\label{trProbalphapri}
\mathbb{P}\{\alpha^\prime(t_{k+1})=j|\alpha^\prime(t_k)=i,y_{t_l},\alpha^\prime(t_l), 0\leq l<k\} =
\left\{
\begin{array}{ll}
q_{ij}(y_{t_k})h+o(h), &i\neq j\\
1+q_{ii}(y_{t_k})h+o(h), &i=j
\end{array}
 \right.
\end{equation}
for $h>0$. The numerical simulation of $\{\alpha'(t_k):k=0,1,\cdots\}$ can be implemented in a way as in \cite{YinZhang2012} and \cite{Zhang2023}.
For $t\in[t_k,t_{k+1})$,  a sequence of continuous-time piecewise interpolation is defined by
\begin{equation}\label{stepEM}
\bar{y}(t)=y(t_k),\bar{\alpha}(t)=\alpha'(t_k),
\end{equation}
and define the continuous EM approximation
\begin{equation}\label{intContiEMY}
\widetilde{y}(t)=\xi(0)+\int_0^tf(\bar{y}_s,\bar{\alpha}(s))ds+\int_0^tg(\bar{y}_s,\bar{\alpha}(s))dw(s),
\end{equation}
Note that $\widetilde{y}(t_k)=\bar{y}(t_k)=y(t_k).$ That is, $\widetilde{y}(t)$ and $\bar{y}(t)$ coincide
with the discrete scheme (\ref{EMYkDelta}) at the grid points. According to the Skorokhod's representation, define the process
\begin{equation}\label{ContiEMAlpha}
\widetilde{\alpha}(t)=i_0+\int_0^t\int_\mathbb{R}h(\bar{y}_s,\bar{\alpha}(s-),z)\,\mathcal{N}(ds,dz).
\end{equation}
From the definition of $\alpha'(t_k)$  and the Skorokhod's representation of $\widetilde{\alpha}(t)$,
$\alpha'(0)=\widetilde{\alpha}(0)=i_0$ and
$$\alpha'(t_{k+1})=\alpha'(t_k)+\sum_{\substack{t_k\leq s\leq t_{k+1} \\ s\in D_p}}\sum_{j\in\mathcal{S}}(j-\bar{\alpha}(s-))\mathbf{1}_{\Gamma_{\bar{\alpha}(s-)j}(y_{t_k})}(p(s)),$$
$$\widetilde{\alpha}(t_{k+1})=\widetilde{\alpha}(t_k)+\sum_{\substack{t_k\leq s\leq t_{k+1} \\ s\in D_p}}\sum_{j\in\mathcal{S}}(j-\bar{\alpha}(s-))\mathbf{1}_{\Gamma_{\bar{\alpha}(s-)j}(y_{t_k})}(p(s)).$$
Then $\alpha'(t_k)=\bar{\alpha}(t_k)=\widetilde{\alpha}(t_k)$, that is $\bar{\alpha}(t)$ and $\widetilde{\alpha}(t)$ coincide at the gridpoints.

Next, we prepare a lemma to show the uniform boundedness and continuity of the discretized segment process  with respect to $h$ in the sense of $p$th moment.
\begin{lemma}\label{YkDeltaBound}
Assume that {\rm (A1)-(A3)} hold, then for any $T>0,p\geq2$ and for any $0\leq s\leq t\leq T$
$$\sup_{0\leq t_k\leq T}\mathbb{E}\|y_{t_k}\|^p\leq c_{p,T},\ \  \sup_{h\in(0,1)}\mathbb{E}\big|\widetilde{y}(t)-\widetilde{y}(s)\big|^p\leq c(t-s)^{\frac{p}{2}}.$$
\end{lemma}
\begin{proof}
According to (\ref{stepYkDelta2}), it is easy to see
\begin{eqnarray}\label{transitYtilde}
\sup_{0\leq t_k\leq T}\mathbb{E}\|y_{t_k}\|^p\leq\mathbb{E}\Big[\sup_{-m\leq k\leq [T/h]}|y(t_k)|^p\Big]\leq\mathbb{E}\|\xi\|^p+\mathbb{E}\Big[\sup_{0\leq k\leq [T/h]}|y(t_k)|^p\Big].
\end{eqnarray}
For given $k$, the bounds of $y(t_k)$ will not exceed the bounds of $\widetilde{y}(t)$ for $t\in[t_k,t_{k+1}),$
so it is only necessary to consider moment estimation of $\widetilde{y}(t)$. Taking the same technique as  in (\ref{moBound}),yields
\begin{align*}
\mathbb{E}\big[\sup_{0\leq t\leq T}|\widetilde{y}(t)|^p\big]
\leq&c\big[\mathbb{E}\|\xi\|^p+T^{p-1}\mathbb{E}\int_0^T|f(\bar{y}_r,\bar{\alpha}(r))|^pdr+T^{\frac{p-2}{2}}\mathbb{E}\int_0^T|g(\bar{y}_r,\bar{\alpha}(r))|^pdr\big] \nonumber\\
\leq&c \mathbb{E}\|\xi\|^p+c\big(T^{p-1}+T^{\frac{p-2}{2}}\big)\int_0^T\big[1+\mathbb{E}\big(\sup_{-\tau\leq u\leq r}|\widetilde{y}(u)|^p\big)\big]dr.
\end{align*}
The Gronwall inequality implies
\begin{equation}\label{YtildemoBdd}
\mathbb{E}\big[\sup_{0\leq t\leq T}|\widetilde{y}(t)|^p\big]\leq(1+c_T\mathbb{E}\|\xi\|^p)e^{c\big(T^{p-1}+T^{\frac{p-2}{2}}\big)T}\leq c_{p,T}.
\end{equation}
The combination of (\ref{transitYtilde}) and (\ref{YtildemoBdd}) leads to
\begin{eqnarray}\label{stepYkBdd}
\sup_{0\leq t_k\leq T}\mathbb{E}\|y_{t_k}\|^p\leq\mathbb{E}\|\xi\|^p+\mathbb{E}\big[\sup_{0\leq t\leq T}|\widetilde{y}(t)|^p\big]\leq c_{p,T}.
\end{eqnarray}
For any $p\geq2$, by (\ref{intContiEMY}),the H\"{o}lder inequality and the Burkholder-Davis-Gundy inequality,it is easy to get
\begin{align*}
\mathbb{E}\big|\widetilde{y}(t)-\widetilde{y}(s)\big|^p
\leq&c\left[\mathbb{E}\left(\left|\int_s^tf(\bar{y}_r,\bar{\alpha}(r))dr\right|^p\right)
+\mathbb{E}\left(\left|\int_s^tg(\bar{y}_r,\bar{\alpha}(r))dw(r)\right|^p\right)\right]\\
\leq&c(t-s)^{p-1}\int_s^t(1+\mathbb{E}\|\bar{y}_r\|^p)dr+c(t-s)^{\frac{p-2}{2}}\int_s^t(1+\mathbb{E}\|\bar{y}_r\|^p)dr.
\end{align*}
Substituting (\ref{stepYkBdd}) into the above inequality, we can deduce
\begin{equation*}
\sup_{h\in(0,1)}\mathbb{E}|\widetilde{y}(t)-\widetilde{y}(s)|^p\leq c(t-s)^{\frac{p}{2}}.
\end{equation*}
\end{proof}

\begin{rem}\label{RemYkDeltaBound}
{\rm
In fact, in the proof of lemma \ref{YkDeltaBound}, we also get the $p$th moment boundedness of the process $\widetilde{y}(t)$ as shown by (\ref{YtildemoBdd}).
}
\end{rem}

Applying [9 Theorem 2.8, p.53] yields the following corollary:
\begin{corollary}\label{YHolder}
{\rm
Under the conditions of Lemma \ref{YkDeltaBound}, for $p>2$, process $\widetilde{y}(\cdot)$ is locally H\"{o}lder-continuous with exponent $\gamma$ with probability 1 for any $\gamma\in(0,1/2-1/p)$. That is
$$\mathbb{P}\big(\omega:\sup_{s,t\in[0,T], 0<|t-s|<h(\omega)}|\widetilde{y}(\omega,t)-\widetilde{y}(\omega,s)|<\kappa|t-s|^\gamma\big)=1,$$
where $h(\omega)$ is an almost surely positive random variable, and $\kappa>0$ is an appropriate constant.
}
\end{corollary}

Referring to[40 Corollary 3.6], we can obtain continuity of the segment process $\widetilde{y}_t=\{\widetilde{y}_t(\theta):-\tau\leq\theta\leq0\}$ in the sense of almost sure and $p$th moment.
\begin{corollary}\label{segYHolder}
{\rm
Under the conditions of Lemma \ref{YkDeltaBound}, for $p>2$, $\widetilde{y}_{\cdot}$ is locally H\"{o}lder-continuous with exponent $\gamma\wedge\gamma_0$ with probability one for $\gamma$ defined in Corollary \ref{YHolder}, and
$$\lim_{\eta\rightarrow0}\mathbb{E}\big(\sup_{s,t\in[0,T],|t-s|\leq\eta}\|\widetilde{y}_t-\widetilde{y}_s\|^p\big)=0.$$
}
\end{corollary}


\subsection{Weak Convergence}
To prove the convergence of the EM approximation, we refer to the idea in \cite{YinZhu2010,Yin2010} to establish weak convergence of the algorithms by a martingale problem formulation first. Using weak convergence theory is usually divided into two steps: checking whether the limit of the sequence under consideration exists and then characterizing the limit process by appropriate operator. To demonstrate the existence of the limit of the sequence $(\widetilde{y}(\cdot),\widetilde{\alpha}(\cdot))$, we need to prove the tightness of the sequence in suitable function spaces.
First, we show the tightness of the continuous component $\{\widetilde{y}(\cdot)\}$ and the segment process $\{\widetilde{y}_\cdot\}$. In fact, the tightness of $\{\widetilde{y}_\cdot\}$ implies the tightness of $\{\widetilde{y}(\cdot)\}$ because of the uniform norm endowed on space $C([-\tau,0];\mathbb{R}^n)$. Hence, we need only establish the tightness of the segment process $\{\widetilde{y}_\cdot\}$. We will introduce the following lemma (see\cite[Lemma 5.1]{Wu2022}).

\begin{lemma}\label{RefYtightness}
Let $\{\widetilde{y}_\cdot\}\in C([0,T]; C([-\tau,0];\mathbb{R}^n))$ be a sequence of $\mathcal{F}_t^h$-measurable processes taking values in $C([-\tau,0];\mathbb{R}^n)$, which satisfies that
\begin{itemize}
\item[\rm{(i)}] for any $\epsilon>0$, there exists a positive constant $M$ such that
$$\sup_{0<h<1}\mathbb{P}\Big(\sup_{t\in[0,T]}|\widetilde{y}(t)|>M\Big)\leq\frac{\epsilon}{2};$$
\item[\rm{(ii)}] for any $n\in\mathbb{N}$ and $\epsilon>0$, there exists a constant $\eta_n>0$ such that
$$\sup_{0<h<1}\mathbb{P}\Big(\sup_{t\in[0,T]}\max_{\substack{\theta_1,\theta_2\in[-\tau,0] \\ |\theta_1-\theta_2|\leq\eta_n}}|\widetilde{y}_t(\theta_1)-\widetilde{y}_t(\theta_2)|>\frac{1}{n}\Big)\leq\frac{\epsilon}{2^{T+n+2}};$$
\item[\rm{(iii)}] for any $n\in\mathbb{N}$ and $\epsilon>0$, there exists a constant $\eta_n>0$ such that
$$\sup_{0<h<1}\mathbb{P}\Big(\max_{\substack{t,s\in[0,T] \\ |t-s|\leq\eta_n}}\|\widetilde{y}_t-\widetilde{y}_s\|>\frac{1}{n}\Big)\leq\frac{\epsilon}{2^{T+n+2}},$$
\end{itemize}
where $\mathcal{F}_t^h$ denotes the $\sigma$-algebra generated by $\{(\widetilde{y}(s),\widetilde{\alpha}(s)):s\leq t\}$.
Then $\{\widetilde{y}_\cdot\}$ is tight in $C([0,T];C([-\tau,0];\mathbb{R}^n))$.
\end{lemma}

\begin{lemma}\label{segYtightness}
Assume that {\rm (A1)-(A3)} hold, then $\{\widetilde{y}_\cdot\}$ is tight in $C([0,T];C([-\tau,0]; \mathbb{R}^n))$.
\end{lemma}
\begin{proof}
 According to Lemma \ref{RefYtightness}, we only need to verify the conditions (i)-(iii). For any $\epsilon>0$, by the Chebyshev inequality and (\ref{YtildemoBdd}), there exists $M>(2c_{p,T})^{1/p}/\epsilon^{1/p}$ such that
 $$\mathbb{P}\Big(\sup_{t\in[0,T]}|\widetilde{y}(t)|>M\Big)\leq\frac{\mathbb{E}\big[\sup_{t\in[0,T]}|\widetilde{y}(t)|^p\big]}{M^p}\leq\frac{c_{p,T}}{M^p}\leq\frac{\epsilon}{2}.$$
This shows that the condition (i) is satisfied. Corollary \ref{YHolder} indicates that for any $n>0$,
$$\lim_{\eta\rightarrow0}\mathbb{P}\Big(\sup_{\substack{s,t\in[0,T] \\ |t-s|\leq\eta}}|\widetilde{y}(t)-\widetilde{y}(s)|>\frac{1}{n}\Big)=0,$$
which means that for any $\epsilon>0$, there exists a constant $\eta_n>0$ such that
$$\mathbb{P}\Big(\sup_{\substack{s,t\in[0,T] \\ |t-s|\leq\eta_n}}|\widetilde{y}(t)-\widetilde{y}(s)|>\frac{1}{n}\Big)\leq\frac{\epsilon}{2^{T+n+2}}.$$
This implies that
\begin{align*}
\mathbb{P}\Big(\sup_{t\in[0,T]}\max_{\substack{\theta_1,\theta_2\in[-\tau,0] \\ |\theta_1-\theta_2|\leq\eta_n}}|\widetilde{y}_t(\theta_1)-\widetilde{y}_t(\theta_2)|>\frac{1}{n}\Big)
\leq\mathbb{P}\Big(\sup_{\substack{t,s\in[-\tau,T] \\ |t-s|\leq\eta_n}}|\widetilde{y}(t)-\widetilde{y}(s)|>\frac{1}{n}\Big)\leq\frac{\epsilon}{2^{T+n+2}}.
\end{align*}
This shows that the condition (ii) is satisfied.  Corollary \ref{segYHolder} follows that for any $n>0$,
$$\lim_{\eta\rightarrow0}\mathbb{P}\Big(\sup_{\substack{s,t\in[0,T] \\ |t-s|\leq\eta_n}}\|\widetilde{y}_t-\widetilde{y}_s\|>\frac{1}{n}\Big)=0,$$
which means that for any $\epsilon>0$, there exists a constant $\eta_n>0$ such that
$$\mathbb{P}\Big(\sup_{\substack{s,t\in[0,T] \\ |t-s|\leq\eta_n}}\|\widetilde{y}_t-\widetilde{y}_s\|>\frac{1}{n}\Big)\leq\frac{\epsilon}{2^{T+n+2}}.$$
Hence the condition (iii) is satisfied. The tightness of $\{\widetilde{y}_\cdot\}$  follows from Lemma \ref{RefYtightness}.
\end{proof}

\begin{lemma}\label{AlphaTightness}
Assume that {\rm (A2)} holds, then $\{\widetilde{\alpha}(\cdot)\}$ is tight in $D([0,T]; \mathcal{S})$.
\end{lemma}
\begin{proof}
Define $\widetilde{\chi}(t)=\big(\mathbf{1}_{\{\widetilde{\alpha}(t)=1\}},\mathbf{1}_{\{\widetilde{\alpha}(t)=2\}},\cdots,\mathbf{1}_{\{\widetilde{\alpha}(t)=N\}}\big)^T\in\mathbb{R}^N.$
For any given $\eta\in(0,1)$ and $0\leq s<t\leq s+\eta\leq T$, we have
\begin{align}\label{AlphatildeTight}
\mathbb{E}\big[|\widetilde{\chi}(t)-\widetilde{\chi}(s)|^2\big|\mathcal{F}_s^h\big]
=&\mathbb{E}\big[\big(\widetilde{\chi}(t)\big)^T\widetilde{\chi}(t)-\big(\widetilde{\chi}(t)\big)^T\widetilde{\chi}(s)-\big(\widetilde{\chi}(s)\big)^T\widetilde{\chi}(t)+\big(\widetilde{\chi}(s)\big)^T\widetilde{\chi}(s)\big|\mathcal{F}_s^h\big]
\nonumber\\
={}&\sum_{i=1}^N \mathbb{E}\big[\mathbf{1}_{\{\widetilde{\alpha}(t)=i\}}-2\mathbf{1}_{\{\widetilde{\alpha}(t)=i\}}\mathbf{1}_{\{\widetilde{\alpha}(s)=i\}}+\mathbf{1}_{\{\widetilde{\alpha}(s)=i\}}\big|\mathcal{F}_s^h\big],
\end{align}
where $\mathcal{F}_s^h$ denotes the $\sigma$-algebra generated by $\{(\widetilde{y}(u),\widetilde{\alpha}(u)):u\leq s\}$.
Note that
\begin{equation}\label{indicator}
\sum_{i=1}^N \mathbf{1}_{\{\widetilde{\alpha}(t)=i\}}=1,\ \ \ \sum_{i=1}^N\mathbf{1}_{\{\widetilde{\alpha}(s)=i\}}=1,\ \ \  \sum_{i=1}^N \mathbf{1}_{\{\widetilde{\alpha}(t)=i\}}\mathbf{1}_{\{\widetilde{\alpha}(s)=i\}}=\mathbf{1}_{\{\widetilde{\alpha}(t)=\widetilde{\alpha}(s)\}}
\end{equation}
for any fixed $s, t$. Combining (\ref{AlphatildeTight}) and (\ref{indicator}), we can obtain
\begin{align*}
&\mathbb{E}\big[|\widetilde{\chi}(t)-\widetilde{\chi}(s)|^2\big|\mathcal{F}_s^h\big]
=2-2\mathbb{E}\big[\mathbf{1}_{\{\widetilde{\alpha}(t)=\widetilde{\alpha}(s)\}}\big|\mathcal{F}_s^h\big]
=2\mathbb{E}\big[\mathbf{1}_{\{\widetilde{\alpha}(t)\neq\widetilde{\alpha}(s)\}}\big|\mathcal{F}_s^h\big]
=\mathbb{P}\big(\widetilde{\alpha}(t)\neq\widetilde{\alpha}(s)\big|\mathcal{F}_s^h\big)\\
=&\mathbb{P}\big(\widetilde{\alpha}(t)\neq\widetilde{\alpha}(s),\mathcal{N}((s,t])=1\big|\mathcal{F}_s^h\big)
+\mathbb{P}\big(\widetilde{\alpha}(t)\neq\widetilde{\alpha}(s),\mathcal{N}((s,t])\geq2\big|\mathcal{F}_s^h\big)\\
\leq&\mathbb{P}\big(\mathcal{N}((s,t])=1\big|\mathcal{F}_s^h\big)+\mathbb{P}\big(\mathcal{N}((s,t])\geq2\big|\mathcal{F}_s^h\big)
\leq\mathbb{E}\big[\mathbf{1}_{\{\mathcal{N}((s,t])=1\}}+\mathbf{1}_{\{\mathcal{N}((s,t])\geq2\}}|\mathcal{F}_s^h\big],
\end{align*}
where $\mathcal{N}((s,t])$ stands for the total number of jumps of Poisson point process $p(\cdot)$ during the time interval $(s,t]$.
By the construction of the Poisson random measure and the stationarity of Poisson point process, we can choose a sufficiently small $\eta$ such that
$\mathbb{P}\big(\mathcal{N}((s,t])=1\big)=H(t-s)e^{-H(t-s)}\leq H(t-s),$ and
$$\mathbb{P}\big(\mathcal{N}((s,t])\geq2\big)=\sum_{k=2}^{\infty}\frac{(H(t-s))^k}{k!}e^{-H(t-s)}\leq H^2(t-s)^2.$$
Thus
$$\mathbb{E}\big[\mathbf{1}_{\{\mathcal{N}((s,t])=1\}}+\mathbf{1}_{\{\mathcal{N}((s,t])\geq2\}}\big]\leq H(t-s)+H^2(t-s)^2\leq O(t-s).$$
The tightness criterion in [7] yields that $\{\widetilde{\chi}(\cdot)\}$ is tight. Consequently, $\{\widetilde{\alpha}(\cdot)\}$ is tight in $D([0,T];\mathcal{S})$.
\end{proof}

In the proof of Lemma \ref{AlphaTightness}, we simultaneously obtain an estimate of the probability that the switch $\widetilde{\alpha}(t)$ takes values in different states at different times when the time difference $t-s$ is sufficiently small. That is
$$\mathbb{E}\big[\mathbf{1}_{\{\widetilde{\alpha}(t)\neq\widetilde{\alpha}(s)\}}\big]=\mathbb{P}\big(\widetilde{\alpha}(t)\neq\widetilde{\alpha}(s)\big)\leq c(t-s).$$
Then it is easy to get the desired tightness result as follows.
\begin{lemma}\label{YAlphaTightness}
Assume  {\rm (A1)-(A3)} hold, then $\{\widetilde{y}_\cdot,\widetilde{\alpha}(\cdot)\}$ is tight in  $C([0,T];C([-\tau,0]; \mathbb{R}^n))\times D([0,T];\mathcal{S})$.
\end{lemma}

Since $\{\widetilde{y}_\cdot,\widetilde{\alpha}(\cdot)\}$ is tight, by Prohorov's theorem (see\cite{Shiryaev1996}), we can extract a weakly convergent subsequence. For simplicity, we still denote the subsequence by $\{\widetilde{y}_\cdot,\widetilde{\alpha}(\cdot)\}$ with the limit denoted by $(\widetilde{y}^0_{\cdot},\widetilde{\alpha}_0(\cdot))$. Since the distribution of $\widetilde{y}(t)$ is the marginal distribution of $\widetilde{y}_t$, $\widetilde{y}(t)$ converges to $\widetilde{y}^0(t)$ weakly.
By virtue of the Skorohod representation \cite[p.354]{Shiryaev1996}, without loss of generality and without changing notation, we may assume that $(\widetilde{y}_\cdot,\widetilde{\alpha}(\cdot))$ converges to $(\widetilde{y}^0_{\cdot},\widetilde{\alpha}_0(\cdot))$ almost surely. Noting that $\widetilde{y}_t\in C([0,T];C([-\tau,0];\mathbb{R}^n))$ with the uniform norm $\|\cdot\|$, $\widetilde{y}(\cdot)$ also converges to $\widetilde{y}^0(\cdot)$ almost surely.

Before we establish the weak convergence, we prepare several preliminary estimates that will be needed later.
Referring to \cite{Wu2008} and \cite{Shi2024}, we estimate the moment of difference between the discreted and continuous segment process now.
\begin{lemma}\label{segmentDC}
Assume that {\rm (A1)-(A3)} hold, then for any integer $l>1$, it holds
\begin{equation}\label{stepEst}
\mathbb{E}\Big(\sup_{0\leq s\leq T}\|\bar{y}_s-\widetilde{y}_s\|^2\Big)\leq c_{l,T}h^{\gamma_0\wedge\frac{l-1}{l}},
\end{equation}
where $c_{l,T}$ is a constant dependent on $l$ and $T$ but independent on $h$.
\end{lemma}
\begin{proof}
For any $\theta\in[-\tau,0]$ and $s\in[0,T]$, denote $k_\theta=[\theta/h]\in\{-m,\cdots,-1\}$ and $k_s=[s/h]$
such that $\theta\in[k_\theta h,(k_\theta+1)h]$ and $s\in[k_sh,(k_s+1)h)$. Let $\theta_h=k_\theta h$ and $s_h=k_sh$. Then $0\leq \theta-\theta_h\leq h$ and $0\leq s-s_h<h$.Thus
\begin{equation}\label{splustheta}
 0\leq s+\theta-(s_h+\theta_h)<2h.
\end{equation}
By the definition of $y_{t_k}(\theta)$ in (\ref{stepYkDelta}), we can obtain
\begin{equation}\label{YsDeltatheta}
\bar{y}_s(\theta)=y_{s_h}(\theta)=y(s_h+\theta_h)+\frac{\theta-\theta_h}{h}[y(s_h+\theta_h+h)-y(s_h+\theta_h)].
\end{equation}
From  the coincidence of $\bar{y}(t)$, $\widetilde{y}(t)$ and $y(t_k)$ at the grid points $t_k,$ it can be derived
\begin{align}\label{estStep}
&\mathbb{E}\Big(\sup_{0\leq s\leq T}\|\bar{y}_s-\widetilde{y}_s\|^2\Big)
=\mathbb{E}\Big(\sup_{\substack{-\tau\leq\theta\leq0\\ 0\leq s\leq T}}|y(s_h+\theta)-\widetilde{y}(s+\theta)|^2\Big)\nonumber\\
\leq&2\mathbb{E}\Big(\sup_{\substack{-\tau\leq\theta\leq0\\ 0\leq s\leq T}}|y(s_h+\theta_h+h)-y(s_h+\theta_h)|^2\Big)+2\mathbb{E}\Big(\sup_{\substack{-\tau\leq\theta\leq0\\ 0\leq s\leq T}}|y(s_h+\theta_h)-\widetilde{y}(s+\theta)|^2\Big).
\end{align}
We denote the integer part of $T/h$ as $[T/h]=\widehat{c}$, and $(\widehat{c}+1)h=T$. Noting that
\begin{eqnarray*}
&&\mathbb{E}\big(\sup_{-\tau\leq\theta\leq0,0\leq s\leq T}|y(s_h+\theta_h+h)-y(s_h+\theta_h)|^2\big)\\
&\leq&\mathbb{E}\big(\sup_{-\tau\leq\theta\leq0,0\leq s\leq T,s_h+\theta_h\leq-h}|y(s_h+\theta_h+h)-y(s_h+\theta_h)|^2\big)\\
&&+\mathbb{E}\big(\sup_{-\tau\leq\theta\leq0,0\leq s\leq T,s_h+\theta_h\geq0}|y(s_h+\theta_h+h)-y(s_h+\theta_h)|^2\big)\\
&\leq&\mathbb{E}\big(\sup_{-m\leq k\leq-1}|y(t_{k+1})-y(t_{k})|^2\Big)+\mathbb{E}\Big(\sup_{0\leq k\leq\widehat{c}}|y(t_{k+1})-y(t_k)|^2\big)\\
&\leq&ch^{\gamma_0}+\mathbb{E}\Big(\sup_{0\leq k\leq\widehat{c}}|y(t_{k+1})-y(t_k)|^2\big).
\end{eqnarray*}
According to the EM scheme (\ref{EMYkDelta}), we have
$$\mathbb{E}\Big(\sup_{0\leq k\leq\widehat{c}}|y(t_{k+1})-y(t_k)|^2\Big)
\leq2h^2\mathbb{E}\Big(\sup_{0\leq k\leq\widehat{c}}|f(y_{t_k},\alpha'(t_k))|^2\Big)+2\mathbb{E}\Big(\sup_{0\leq k\leq\widehat{c}}|g(y_{t_k},\alpha'(t_k))\Delta w(t_k)|^2\Big).$$
Using the linear growth condition (\ref{linear}), (\ref{stepYkDelta2}) and (\ref{YtildemoBdd}) leads to
$$\mathbb{E}\Big(\sup_{0\leq k\leq\widehat{c}}|f(y_{t_k},\alpha'(t_k))|^2\Big)
\leq L_1\Big[1+\mathbb{E}\Big(\sup_{0\leq k\leq\widehat{c}}\max_{-m\leq i\leq 0}|y(t_{k+i})|^2\Big)\Big]
\leq L_1\Big[1+\mathbb{E}\Big(\sup_{-m\leq k\leq\widehat{c}}|y(t_k)|^2\Big)\Big]\leq c_T.$$
By the H\"{o}lder's inequality, for any integer $l>1$,
\begin{align}\label{E22}
\mathbb{E}\Big(\sup_{0\leq k\leq \widehat{c}}|g(y_{t_k},\alpha'(t_k))\Delta w(t_k)|^2\Big)
\leq&\Big[\mathbb{E}\Big(\sup_{0\leq k\leq\widehat{c}}|g(y_{t_k},\alpha'(t_k))|^\frac{2l}{l-1}\Big)\Big]^\frac{l-1}{l}\Big[\mathbb{E}\Big(\sup_{0\leq k\leq\widehat{c}}|\Delta w(t_k)|^{2l}\Big)\Big]^\frac{1}{l}\nonumber\\
\leq&\Big[\mathbb{E}\Big(\sup_{0\leq k\leq\widehat{h}}L_1(1+\|y_{t_k}\|^2)\Big)^\frac{l}{l-1}\Big]^\frac{l-1}{l}\Big[\mathbb{E}\Big(\sum_{k=0}^{\widehat{c}}|\Delta w(t_k)|^{2l}\Big)\Big]^\frac{1}{l}\nonumber\\
\leq&L_1\Big[2^\frac{1}{l-1}\mathbb{E}\Big(1+\sup_{0\leq k\leq\widehat{c}}\|y_{t_k}\|^2\Big)^\frac{l}{l-1}\Big]^\frac{l-1}{l}\Big[\sum_{k=0}^{\widehat{c}}\big(\mathbb{E}|\Delta w(t_k)|^{2l}\big)\Big]^\frac{1}{l}\nonumber\\
\leq&L_1\Big[2^\frac{1}{l-1}\Big(1+\mathbb{E}\Big(\sup_{0\leq k\leq\widehat{c}}\|y_{t_k}\|^\frac{2l}{l-1}\Big)\Big)\Big]^\frac{l-1}{l}\Big[\sum_{k=0}^{\widehat{c}}(2l-1)!!h^l\Big]^\frac{1}{l}\nonumber\\
\leq&L_1\Big[2^\frac{1}{l-1}\Big(1+\mathbb{E}\Big(\sup_{-m\leq k\leq\widehat{c}}|y(t_k)|^\frac{2l}{l-1}\Big)\Big)\Big]^\frac{l-1}{l}\big[(2l-1)!!Th^{l-1}\big]^\frac{1}{l}\nonumber\\
\leq&c_{l,T}h^\frac{l-1}{l},
\end{align}
where $c_{l,T}$ is a constant dependent on $l$ and $T$. These shows
$$\mathbb{E}\Big(\sup_{0\leq k\leq\widehat{c}}|y(t_{k+1})-y(t_k)|^2\big)\leq c_{l,T}h^{(l-1)/l}.$$
Therefore we may obtain
$$\mathbb{E}\big(\sup_{-\tau\leq\theta\leq0,0\leq s\leq T}|y(s_h+\theta_h+h)-y(s_h+\theta_h)|^2\big)\leq c_{l,T} h^{\gamma_0\wedge(l-1)/l}.$$
Next, we denote by $I=\mathbb{E}\Big(\sup_{-\tau\leq\theta\leq0,0\leq s\leq T}|y(s_h+\theta_h)-\widetilde{y}(s+\theta)|^2\Big),$
  and $\{s,\theta: 0\leq s\leq T,-\tau\leq\theta\leq0\}\equiv\Omega_1\cup\Omega_2\cup\Omega_3\cup\Omega_4\cup\Omega_5,$ where
\begin{eqnarray*}
\Omega_1&=&\{s,\theta:0\leq s\leq T,-\tau\leq\theta\leq0,k_s+k_\theta\geq0,0\leq s+\theta-(s_h+\theta_h)<h\},\\
 \Omega_2&=&\{s,\theta:0\leq s\leq T,-\tau\leq\theta\leq0,k_s+k_\theta\geq0, h\leq s+\theta-(s_h+\theta_h)<2h\},\\
 \Omega_3&=&\{s,\theta:0\leq s\leq T,-\tau\leq\theta\leq0,k_s+k_\theta=-1,0\leq s+\theta-(s_h+\theta_h)<h\},\\
    \Omega_4&=&\{s,\theta:0\leq s\leq T,-\tau\leq\theta\leq0,k_s+k_\theta=-1,h\leq s+\theta-(s_h+\theta_h)<2h\},\\
  \Omega_5&=&\{s,\theta:0\leq s\leq T,-\tau\leq\theta\leq0,k_s+k_\theta\leq-2\}.
  \end{eqnarray*}
We will discuss the five different cases in the following.

Case 1: $s,\theta\in\Omega_1$. In this case, $[\frac{s+\theta}{h}]h=s_h+\theta_h$. Denote $[\frac{s+\theta}{h}]=k_{s+\theta}$, then $k_{s+\theta}=k_s+k_\theta$. Taking the same technique above
\begin{align*}
I\leq2\mathbb{E}\Big(\sup_{s,\theta\in\Omega_1}\Big|\int_{s_h+\theta_h}^{s+\theta}f(\bar{y}_r,\bar{\alpha}(r))dr\Big|^2\Big)
+2\mathbb{E}\Big(\sup_{s,\theta\in\Omega_1}\Big|\int_{s_h+\theta_h}^{s+\theta}g(\bar{y}_r,\bar{\alpha}(r))dw(r)\Big|^2\Big)\leq c_{l,T}h^{\frac{l-1}{l}}
\end{align*}
Case 2:  $s,\theta\in\Omega_2$. In this case, $[\frac{s+\theta}{h}]h=s_h+\theta_h+h$, then $k_{s+\theta}=k_s+k_\theta+1$, and
\begin{eqnarray}\label{E32}
I\leq2\mathbb{E}\Big(\sup_{s,\theta\in\Omega_2}\Big|\widetilde{y}(s+\theta)-y(s_h+\theta_h+h)\Big|^2\Big)
+2\mathbb{E}\Big(\sup_{s,\theta\in\Omega_2}\Big|y(s_h+\theta_h+h)-y(s_h+\theta_h)\Big|^2\Big).
\end{eqnarray}
In the same way as in Case 1, we may obtain $I\leq c_{l,T}h^{\frac{l-1}{l}}.$

Case 3: $s,\theta\in\Omega_3$. In this case,$-h=s_h+\theta_h\leq s+\theta<s_h+\theta_h+h=0,$
$$I=\mathbb{E}\Big(\sup_{s,\theta\in\Omega_3}|\xi(s+\theta)-\xi(-h)|^2\Big)\leq ch^{\gamma_0}.$$

Case 4: $s,\theta\in\Omega_4$. In this case, $0=s_h+\theta_h+h\leq s+\theta<s_h+\theta_h+2h=h.$
According to the derivation in Case 1, it can be obtained that
\begin{align*}
I\leq 2\mathbb{E}\Big(\sup_{s,\theta\in\Omega_4}|\widetilde{y}(s+\theta)-\widetilde{y}(0)|^2\Big)+2\mathbb{E}\Big(\sup_{s,\theta\in\Omega_4}|\widetilde{y}(0)-\widetilde{y}(-h)|^2\Big)
\leq c_{l,T}h^{\frac{l-1}{l}}+ch^{\gamma_0}.
\end{align*}

Case 5: $s,\theta\in\Omega_5$. In this case, $s+\theta\leq0$, and
\begin{align*}
I\leq 2\mathbb{E}\Big(\sup_{s,\theta\in\Omega_4}\big(|\xi(s+\theta)-\xi(k_{s+\theta}h)|^2+|\xi(k_{s+\theta}h)-\xi(s_h+\theta_h)|^2\big)\Big)\leq ch^{\gamma_0}.
\end{align*}
Based on the above cases, it can be concluded that $E_3\leq ch^{\gamma_0}+c_{l,T}h^{\frac{l-1}{l}}.$
As a result,
$$\mathbb{E}\Big(\sup_{0\leq s\leq T}\|\bar{y}_s-\widetilde{y}_s\|^2\Big)\leq ch^{\gamma_0}+c_{l,T}h^{\frac{l-1}{l}} \leq c_{l,T}h^{\gamma_0\wedge\frac{l-1}{l}}.$$
\end{proof}

\begin{rem}\label{remSegDC}
{\rm
Applying Lyapunov's inequality and (\ref{stepEst}), we obtain the estimate
\begin{eqnarray*}
\mathbb{E}\Big(\sup_{0\leq s\leq T}\|\bar{y}_s-\widetilde{y}_s\|\Big)\leq\Big[\mathbb{E}\Big(\sup_{0\leq s\leq T}\|\bar{y}_s-\widetilde{y}_s\|^2\Big)\Big]^{\frac{1}{2}}\leq c_{l,T}h^{\frac{\gamma_0}{2}\wedge\frac{l-1}{2l}}.
\end{eqnarray*}
}
\end{rem}
Next we will give the estimation  about the switching, which plays an important role below.
\begin{lemma}\label{estimSwitch}
Assume that {\rm (A1)-(A3)} hold, let $\widetilde{\alpha}(t)$ and $\alpha(t)$ be defined by {\rm(\ref{ContiEMAlpha})} and {\rm(\ref{SkorSDE})} respectively.
Then for $0\leq t\leq T$,
\begin{equation}\label{estSwit}
\int_0^t\mathbb{P}{\{\widetilde{\alpha}(s)\neq\alpha(s)\}}\,ds\leq c_T\int_0^t\mathbb{E}\|\bar{y}_s-x_s\|ds+c_Th.
\end{equation}
\end{lemma}
\begin{proof}
We proof by induction and divide it into three steps.

Step 1: For $0< t\leq h$, we will estimate $\mathbb{P}\big(\widetilde{\alpha}(t)\neq\alpha(t)\big)$. Noting  $\alpha'(0)=\widetilde{\alpha}(0)=\alpha(0)=i_0$,
\begin{align*}
\mathbb{P}\big(\widetilde{\alpha}(t)\neq\alpha(t)\big)=\mathbb{P}\big(\widetilde{\alpha}(t))\neq\alpha(t), \mathcal{N}((0,t])=1\big)
+\mathbb{P}\big(\widetilde{\alpha}(t))\neq\alpha(t),\mathcal{N}((0,t])\geq2\big).
\end{align*}
It is easy to get from the construction of the Poisson random measure that
\begin{eqnarray*}
\mathbb{P}\big(\widetilde{\alpha}(t))\neq\alpha(t), \mathcal{N}((0,t])\geq2\big)\leq\mathbb{P}\big(\mathcal{N}((0,h])\geq2\big)\leq H^2h^2.
\end{eqnarray*}
By virtue of the independence between $\xi_1,\zeta_1,\zeta_2-\zeta_1$ and $\{w(t)\}_{t\geq0}$ and {\rm (A3)}
\begin{align*}
\mathbb{P}\big(\widetilde{\alpha}(t))\neq\alpha(t),\mathcal{N}((0,t])=1\big)
 =&\mathbb{P}\Big(\zeta_1\leq t,\zeta_2>t,\xi_1\in\bigcup_{j\neq i_0,j\in\mathcal{S}}\big(\Gamma_{i_0 j}(\bar{y}_{{\zeta_1}})\triangle\Gamma_{i_0 j}(x_{\zeta_1})\big)\Big)\\
 =&\int_0^t\mathbb{P}\Big(\zeta_1\in ds,\zeta_2>t,\xi_1\in\bigcup_{j\neq i_0,j\in\mathcal{S}}\big(\Gamma_{i_0 j}(\bar{y}_s)\triangle\Gamma_{i_0j}(x_s)\big)\Big)\\
 =&\int_0^t\mathbb{P}\Big(\zeta_1\in ds,\xi_1\in\bigcup_{j\neq i_0,j\in\mathcal{S}}\big(\Gamma_{i_0 j}(\bar{y}_s)\triangle\Gamma_{i_0 j}(x_{s})\big)\Big)e^{-H(t-s)},
\end{align*}
where $A\triangle B$ represents $(A\setminus B)\cup(B\setminus A)$ for any Borel measurable sets $A$ and $B$.
By virtue of the definition of $\Gamma_{ij}(\phi)$ and
 {\rm (A3)}, the Lebesgue measure of the set $\Gamma_{i_0 j}(\bar{y}_s)\triangle\Gamma_{i_0 j}(x_{s})$ satisfies
\begin{align*}
m\big(\Gamma_{i_0 j}(\bar{y}_s)\triangle\Gamma_{i_0 j}(x_{s})\big)
\leq&\Big|\sum_{k=1}^{i_0-1}q_k(\bar{y}_s)+\sum_{k=1,k\neq i_0}^{j-1}q_{i_0k}(\bar{y}_s)-\sum_{k=1}^{i_0-1}q_k(x_{s})-\sum_{k=1,k\neq i_0}^{j-1}q_{i_0k}(x_{s})\Big|\\
&+\Big|\sum_{k=1}^{i_0-1}q_k(\bar{y}_s)+\sum_{k=1,k\neq i_0}^{j}q_{i_0k}(\bar{y}_s)-\sum_{k=1}^{i_0-1}q_k(x_{s})-\sum_{k=1,k\neq i_0}^{j}q_{i_0k}(x_{s})\Big|\\
\leq&2\sum_{k=1}^{i_0-1}\big|q_k(\bar{y}_s)-q_k(x_{s})\big|+2\sum_{k=1,k\neq i_0}^{j}\big|q_{i_0k}(\bar{y}_s)-q_{i_0k}(x_{s})\big|\\
\leq&2\sum_{k=1}^{i_0-1}\sum_{l=1,l\neq k}^N\big|q_{kl}(\bar{y}_s)-q_{kl}(x_{s})\big|+2\sum_{k=1,k\neq i_0}^{j}\big|q_{i_0k}(\bar{y}_s)-q_{i_0k}(x_{s})\big|\\
\leq&2N\|Q(\bar{y}_s)-Q(x_{s})\|_{l_1}\leq2cN\|\bar{y}_s-x_{s}\|.
\end{align*}
Using the independence between $\xi_1, \zeta_1, \zeta_2-\zeta_1$ and $\{w(t)\}_{t\geq0}$, we have
\begin{align*}
\mathbb{P}\big(\widetilde{\alpha}(t))\neq\alpha(t),\mathcal{N}([0,t))= 1\big)
\leq&\int_0^t \mathbb{E}\Big[\frac{1}{H}\sum_{j=1,j\neq i_0}^{N}m\big(\Gamma_{i_0 j}(\bar{y}_s)\triangle\Gamma_{i_0 j}(x_{s})\big)\Big]e^{-H(t-s)}He^{-Hs}ds  \\
 \leq&\int_0^t 2CN(N-1)\mathbb{E}\|\bar{y}_s-x_{s}\|e^{-Ht}ds
 \leq c\int_0^t\mathbb{E}\|\bar{y}_s-x_{s}\|\,ds.
\end{align*}
Hence, for $t\in(0,h]$,
\begin{eqnarray}\label{alphaEst1}
\mathbb{P}\big(\widetilde{\alpha}(t))\neq\alpha(t)\big)\leq H^2h^2+c\int_0^h\mathbb{E}\|\bar{y}_s-x_{s}\|\,ds.
\end{eqnarray}

Step 2: We will estimate $\mathbb{P}\big(\widetilde{\alpha}(t_k)\neq\alpha(t_k)\big)$ for $k\geq2$.
\begin{align}\label{alphaEst2}
\mathbb{P}\big(\widetilde{\alpha}(2h)\neq\alpha(2h)\big)
=&\mathbb{P}\big(\widetilde{\alpha}(2h)\neq\alpha(2h),\widetilde{\alpha}(h)\neq\alpha(h)\big)
+\mathbb{P}\big(\widetilde{\alpha}(2h)\neq\alpha(2h),\widetilde{\alpha}(h)=\alpha(h)\big)\nonumber\\
\leq&\mathbb{P}\big(\widetilde{\alpha}(h)\neq\alpha(h)\big)
+\mathbb{P}\big(\widetilde{\alpha}(2h)\neq\alpha(2h),\widetilde{\alpha}(h)=\alpha(h)\big)
\end{align}
Noting that $\{p(t)\}_{t\geq0}$ is a stationary point process and similar to the estimate in Step 1, we obtain
\begin{align}\label{alpha2Delta}
&\mathbb{P}\big(\widetilde{\alpha}(2h)\neq\alpha(2h),\widetilde{\alpha}(h)=\alpha(h)\big)=\mathbb{P}\big(\widetilde{\alpha}(2h)\neq\alpha(2h),\mathcal{N}((h,2h])=1,\widetilde{\alpha}(h)=\alpha(h)\big)\nonumber\\
&+\mathbb{P}\big(\widetilde{\alpha}(2h)\neq\alpha(2h),\mathcal{N}((h,2h])\geq2,\widetilde{\alpha}(h)=\alpha(h)\big)\nonumber\\
\leq&\mathbb{P}\big(\widetilde{\alpha}(2h)\neq\alpha(2h),\mathcal{N}((h,2h])=1|\widetilde{\alpha}(h)=\alpha(h)\big)+\mathbb{P}\big(\mathcal{N}((h,2h])\geq2\big)\nonumber\\
\leq&\int_h^{2h}\mathbb{P}\Big(\zeta_1\in ds,\zeta_2>2h,\xi_1\in\bigcup_{j\neq\alpha(h),j\in\mathcal{S}}\big(\Gamma_{\tilde{\alpha}(h) j}(y_{s_h})\triangle\Gamma_{\alpha(h)j}(x_s)\big)\Big)+\mathbb{P}\big(\mathcal{N}((h,2h])\geq2\big)\nonumber\\
\leq&c\int_h^{2h}\mathbb{E}\|\bar{y}_s-x_{s}\|ds+H^2h^2.
\end{align}
Inserting (\ref{alphaEst1}) and (\ref{alpha2Delta}) into (\ref{alphaEst2}) yields
$$\mathbb{P}\big(\widetilde{\alpha}(2h)\neq\alpha(2h)\big)\leq2H^2h^2+c\int_0^{2h}\mathbb{E}\|\bar{y}_s-x_{s}\|ds.$$
Recursively, we get for $k\geq1$,
\begin{equation}\label{alpahkDelta}
\mathbb{P}\big(\widetilde{\alpha}(t_k)\neq\alpha(t_k)\big)\leq kH^2h^2+c\int_0^{t_k} \mathbb{E}\|\bar{y}_s-x_{s}\|\,ds.
\end{equation}

Step 3: For $t\in[0,T]$, let $[\frac{t}{h}]=c(t)$ and $t_{c(t)+1}=t$. Combining the estimates in Step 1 and Step 2 gives
\begin{align*}
\int_0^t\mathbb{P}\big(\widetilde{\alpha}(s)\neq\alpha(s)\big)ds
\leq&\sum_{k=0}^{c(t)}\int_{t_k}^{t_{k+1}}\big(\mathbb{P}\big(\widetilde{\alpha}(s)\neq\alpha(s),\widetilde{\alpha}(t_k)=\alpha(t_k)\big)+\mathbb{P}\big(\widetilde{\alpha}(t_k)\neq\alpha(t_k)\big)\big)ds\\
\leq&\sum_{k=0}^{c(t)}h\Big[\Big(H^2h^2+c\int_{t_k}^{t_{k+1}}\mathbb{E}\|\bar{y}_s-x_{s}\|ds\Big)+\Big(kH^2h^2+c\int_0^{t_k}\mathbb{E}\|\bar{y}_s-x_{s}\|ds\Big)\Big]\\
\leq&\sum_{k=0}^{c(t)}\Big[(k+1)H^2h^3+ch\int_{0}^{t_{k+1}}\mathbb{E}\|\bar{y}_s-x_{s}\|ds\Big]\\
\leq&H^2h^2t+\frac{c(t)(c(t)+1)}{2}H^2h^3+c(c(t)+1)h\int_0^t\mathbb{E}\|\bar{y}_s-x_{s}\|ds\\
\leq&H^2h^2t+\frac{t(t+h)}{2}H^2h+c(t+h)\int_0^t\mathbb{E}\|\bar{y}_s-x_{s}\|ds\\
\leq&c_T\int_0^t\mathbb{E}\|\bar{y}_s-x_{s}\|ds+c_Th.
\end{align*}
Thus the estimate (\ref{estSwit}) is obtained.
\end{proof}

We will establish the weak convergence of the tight sequence $\{\widetilde{y}\cdot),\widetilde{\alpha}(\cdot)\}$ in the following.
\begin{theorem}\label{weakConverge}
If assumptions {\rm (A1)-(A3)} hold,  then $(\widetilde{y}(\cdot),\widetilde{\alpha}(\cdot))$ converges weakly to $(x(\cdot),\alpha(\cdot))$, which is a process with operator given by (\ref{Loperator}).
\end{theorem}
\begin{proof}
Now we will devote to characterizing the limit process. We divide the proof into three steps.

Step 1: Characterize the limit of the switching component $\widetilde{\alpha}(\cdot)$. The weak convergence of $\widetilde{\alpha}(\cdot)$ to $\widetilde{\alpha}_0(\cdot)$ implies the weak convergence of $\widetilde{\chi}(\cdot)$ to $\widetilde{\chi}_0(\cdot)$ for $h\rightarrow0$.
Recall that $\mathcal{F}_s^h=\sigma\{(\widetilde{y}(u),\widetilde{\alpha}(u)):u\leq s\}$, it follows from (\ref{ContiEMAlpha}) and the generalized It\^{o}'s formula that $\{\widetilde{\chi}(t)-\widetilde{\chi}(s)-\int_s^tQ(\bar{y}_r)\widetilde{\chi}(r)\,dr, \mathcal{F}_s^h: 0\leq s<\infty\}$ is a martingale.
With references to the techniques in [7], we know for each $s,t>0$, each positive integer k, each $0\leq t_1<t_2<\cdots<t_k\leq s<t$ and each bounded and continuous function $\rho(\cdot,i)$ for each $i\in\mathcal{S}$, %it follows from (\ref{ContiEMAlpha}) and the generalized It\^{o}'s formula that
\begin{equation}\label{chiDelta}
\mathbb{E}\Big[\rho\big(\widetilde{y}(t_l),\widetilde{\alpha}(t_l),l\leq k\big)\Big(\widetilde{\chi}(t)-\widetilde{\chi}(s)-\int_s^tQ(\bar{y}_r)\widetilde{\chi}(r)\,dr\Big)\Big]=0.
\end{equation}
In terms of the weak convergence and the Skorohod representation, we know that $\widetilde{\chi}(t)\rightarrow \widetilde{\chi}_0(t)$ holds almost surely when $h\rightarrow0$ and
\begin{equation}\label{chiconverge}
\lim_{h\rightarrow0}\mathbb{E}\Big[\rho\big(\widetilde{y}(t_l),\widetilde{\alpha}(t_l),l\leq k\big)\big(\widetilde{\chi}(t)-\widetilde{\chi}(s)\big)\Big]
=\mathbb{E}\Big[\rho\big(\widetilde{y}^0(t_l),\widetilde{\alpha}_0(t_l),l\leq k\big)\big(\widetilde{\chi}_0(t)-\widetilde{\chi}_0(s)\big)\Big].
\end{equation}
Inserting a middle term and applying the Cauchy-Schwartz inequality, (A2) and (A3), we have
\begin{align}\label{chiGener}
\mathbb{E}\Big[\int_s^t\big|Q(\bar{y}_r)\widetilde{\chi}(r)-Q(\widetilde{y}^0_r)\widetilde{\chi}_0(r)\big|dr\Big]
\leq&\mathbb{E}\int_s^t\|Q(\bar{y}_r)\|_{HS}|\widetilde{\chi}(r)-\widetilde{\chi}_0(r)|dr
+\mathbb{E}\int_s^t\|Q(\bar{y}_r)-Q(\widetilde{y}_r^0)\|_{HS}|\widetilde{\chi}_0(r)|dr\nonumber\\
\leq&cM\int_s^t\mathbb{E}|\widetilde{\chi}(r)-\widetilde{\chi}_0(r)|\,dr+c\int_s^t\mathbb{E}\|\bar{y}_r-\widetilde{y}^0_r\|dr.
\end{align}
The first term on the last line of (\ref{chiGener}) tends towards 0 by the convergence of $\widetilde{\chi}(r)$ to $\widetilde{\chi}_0(r)$ as $h\rightarrow0$.
By virtue of Remark \ref{remSegDC}, the integrand in the second term satisfies
\begin{eqnarray}\label{2term}
\mathbb{E}\|\bar{y}_r-\widetilde{y}^0_r\|\leq\mathbb{E}\|\bar{y}_r-\widetilde{y}_r\|+\mathbb{E}\|\widetilde{y}_r-\widetilde{y}^0_r\|
\leq c_{l,T}h^{\frac{\gamma_0}{2}\wedge\frac{l-1}{2l}}+\mathbb{E}\varphi_h,
\end{eqnarray}
where $\varphi_h:=\sup_{0\leq r\leq T}\|\widetilde{y}_r-\widetilde{y}^0_r\|$.
Noting that $\widetilde{y}_\cdot$ converges to $\widetilde{y}^0_{\cdot}$ almost surely, i.e., $\varphi_h\rightarrow 0$ holds almost surely. We can see from the Vitali convergence theorem in \cite[Theorem 4.5.4]{Chung2001} and Remark \ref{RemYkDeltaBound} that as $h\rightarrow 0$,
$$\mathbb{E}\Big[\sup_{0\leq r\leq T}|\widetilde{y}(r)|^p\Big]\rightarrow\mathbb{E}\Big[\sup_{0\leq r\leq T}|\widetilde{y}^0(r)|^p\Big]\leq c_{p,T}$$
for $p\geq2$.
Then
\begin{equation}\label{YtildeBound}
 \mathbb{E}\big[\sup_{0\leq r\leq T}\|\widetilde{y}^0_r\|^p\big]\leq\mathbb{E}\|\widetilde{y}_0\|^p+c_{p,T}\leq c_{p,T}.
\end{equation}
The Lebesgue dominated convergence theorem gives that as $h\rightarrow 0$,
\begin{equation}\label{segYconvergence}
 \mathbb{E}\varphi_h=\mathbb{E}\Big[\sup_{0\leq r\leq T}\|\widetilde{y}_r-\widetilde{y}_r^0\|\Big]\rightarrow 0
\end{equation}
and for $p\geq2$,
$$\mathbb{E}\varphi_h^p=\mathbb{E}\Big[\sup_{0\leq r\leq T}\|\widetilde{y}_r-\widetilde{y}^0_r\|^p\Big]\rightarrow 0.$$
Since $c_{l,T}h^{\frac{\gamma_0}{2}\wedge\frac{l-1}{2l}}\rightarrow0$ as $h\rightarrow0$,
$\mathbb{E}\|\bar{y}_r-\widetilde{y}^0_r\|\rightarrow0,\ \ {\rm as}\  h\rightarrow0,$
then the first line of (\ref{chiGener}) tends towards 0 as $h$ tends towards 0, which implies
\begin{eqnarray}\label{QdelConverge}
\lim_{h\rightarrow0}\mathbb{E}\Big[\rho\big(\widetilde{y}(t_l),\widetilde{\alpha}(t_l),l\leq k\big)\int_s^tQ(\bar{y}_r)\widetilde{\chi}(r)dr\Big]
=\mathbb{E}\Big[\rho\big(\widetilde{y}^0(t_l),\widetilde{\alpha}_0(t_l),l\leq k\big)\int_s^tQ(\widetilde{y}^0_r)\widetilde{\chi}_0(r)dr\Big].
\end{eqnarray}
Combining (\ref{chiDelta}), (\ref{chiconverge}) and (\ref{QdelConverge}), we obtain
$$\mathbb{E}\Big[\rho\big(\widetilde{y}^0(t_l),\widetilde{\alpha}_0(t_l),l\leq k\big)\Big(\widetilde{\chi}_0(t)-\widetilde{\chi}_0(s)-\int_s^tQ(\widetilde{y}^0_r)\widetilde{\chi}_0(r)dr\Big)\Big]=0,$$
which yields that the limit process $\widetilde{\alpha}_0(t)$ has a generator $Q(\widetilde{y}^0_{t})$.

Step 2: For each $s>0$ and $t>0$,  positive integer $k,$ each $0\leq t_1<t_2<\cdots<t_k\leq s<t$,  bounded and continuous function $\rho(\cdot,i)$, and for each twice continuously differential function with compact support $V(\cdot,i)\in C_0^2$ for each $i\in\mathcal{S}$, we shall show that
\begin{equation}\label{LimitYAlpha}
\mathbb{E}\Big[\rho\big(\widetilde{y}^0(t_l),\widetilde{\alpha}_0(t_l),l\leq k\big)\Big(V(\widetilde{y}^0(t),\widetilde{\alpha}_0(t))-V(\widetilde{y}^0(s),\widetilde{\alpha}_0(s))
-\int_s^t(\mathcal{L}V)(\widetilde{y}^0_r,\widetilde{\alpha}_0(r))\,dr\Big)\Big]=0,
\end{equation}
which implies that $V(\widetilde{y}^0(t),\widetilde{\alpha}_0(t))-V(\widetilde{y}^0(0),\widetilde{\alpha}_0(0))-\int_0^t(\mathcal{L}V)(\widetilde{y}^0_r,\widetilde{\alpha}_0(r))\,dr$ is a martingale, where
\begin{align}\label{Lfoperator}
(\mathcal{L}V)(\widetilde{y}^0_r,\widetilde{\alpha}_0(r))
=&\sum_{k=1}^nV_k(\widetilde{y}^0_r,\widetilde{\alpha}_0(r))V_k(\widetilde{y}^0(r),\widetilde{\alpha}_0(r))+\frac{1}{2}\sum_{k,l=1}^na_{kl}(\widetilde{y}^0_r,\widetilde{\alpha}_0(r))V_{kl}(\widetilde{y}^0(r),\widetilde{\alpha}_0(r))
\nonumber\\
&+\sum_{j\in\mathcal{S},j\neq i} q_{ij}(\widetilde{y}^0_r)\big[V(\widetilde{y}^0(r),j)-V(\widetilde{y}^0(r),\widetilde{\alpha}_0(r))\big].
\end{align}
Then we can conclude that the process $(\widetilde{y}^0(\cdot),\widetilde{\alpha}_0(\cdot))$ solves the martingale problem with operator $\mathcal{L}$ defined in (\ref{Loperator}).

To verify that (\ref{LimitYAlpha}) is true, we consider working with the sequence $\{\widetilde{y}(\cdot),\widetilde{\alpha}(\cdot)\}$.
Using (\ref{ContiEMAlpha}) and applying generalized It\^{o}'s formula to $V(\widetilde{y}(t),\widetilde{\alpha}(t))$ implies that
\begin{eqnarray*}
M_V^h(t)\triangleq V(\widetilde{y}(t),\widetilde{\alpha}(t))-V(\widetilde{y}(0),\widetilde{\alpha}(0))
-\int_0^t(\mathcal{L}^h V)(\bar{y}_r,\bar{\alpha}(r))dr=M_1^h(t)+M_2^h(t)
\end{eqnarray*}
is a martingale, where
\begin{align}\label{LDeltaOper}
(\mathcal{L}^h V)(\bar{y}_r,\bar{\alpha}(r))=&\sum_{k=1}^nf_k(\bar{y}_r,\bar{\alpha}(r))V_k(\widetilde{y}(r),\widetilde{\alpha}(r))
+\frac{1}{2}\sum_{k,l=1}^na_{kl}(\bar{y}_r,\bar{\alpha}(r))V_{kl}(\widetilde{y}(r),\widetilde{\alpha}(r))\nonumber\\
&+\sum_{j\in\mathcal{S},j\neq i}q_{ij}(\bar{y}_r)\big[V(\widetilde{y}(r),j)-V(\widetilde{y}(r),\bar{\alpha}(r))\big],
\end{align}
and $M_1^h(t)=\int_0^t\nabla V(\widetilde{y}(r),\widetilde{\alpha}(r))g(\bar{y}_r,\bar{\alpha}(r))dw(r),$
$$M_2^h(t)=\int_0^t\int_{\mathbb{R}}\big[V(\widetilde{y}(r),\widetilde{\alpha}(0)+h(\bar{y}_r,\bar{\alpha}(r),z))-V(\bar{y}_r,\bar{\alpha}(r))\big]\mu(dr,dz).$$
This is equivalent to
\begin{align}\label{marYAlphaDelta}
\mathbb{E}\Big[\rho\big(\widetilde{y}(t_l),\widetilde{\alpha}(t_l),l\leq k\big)\Big(V(\widetilde{y}(t),\widetilde{\alpha}(t))-V(\widetilde{y}(s),\widetilde{\alpha}(s))
-\int_s^t\mathcal{L}^hV(\bar{y}_r,\bar{\alpha}(r))dr\Big)\Big]=0.
\end{align}
Due to the weak convergence and the Skorohod representation, we have
\begin{align}\label{fYAlphaconverge}
&\lim_{h\rightarrow0}\mathbb{E}\Big[\rho\big(\widetilde{y}(t_l),\widetilde{\alpha}(t_l),l\leq k\big)\Big(V(\widetilde{y}(t),\widetilde{\alpha}(t))-f(\widetilde{y}(s),\widetilde{\alpha}(s))\Big)\Big]
\nonumber\\
=&\mathbb{E}\Big[\rho\big(\widetilde{y}^0(t_l),\widetilde{\alpha}_0(t_l),l\leq k\big)\Big(V(\widetilde{y}^0(t),\widetilde{\alpha}_0(t))-V(\widetilde{y}^0(s),\widetilde{\alpha}_0(s))\Big)\Big].
\end{align}
Combining (\ref{LimitYAlpha}), (\ref{marYAlphaDelta}) and (\ref{fYAlphaconverge}), it is only necessary to show that
\begin{align}\label{Lconverge}
\lim_{h\rightarrow0}\mathbb{E}\Big[\rho\big(\widetilde{y}(t_l),\widetilde{\alpha}(t_l),l\leq k\big)\int_s^t(\mathcal{L}^hV)(\bar{y}_r,\bar{\alpha}(r))dr\Big]
=\mathbb{E}\Big[\rho\big(\widetilde{y}^0(t_l),\widetilde{\alpha}_0(t_l),l\leq k\big)\int_s^t(\mathcal{L}V)(\widetilde{y}^0_r,\widetilde{\alpha}_0(r))dr\Big]
\end{align}
is valid. According to the definition of $\mathcal{L}^h$ and $\mathcal{L}$ in (\ref{LDeltaOper}) and (\ref{Lfoperator}), we only need to consider
$$I_1=\sum_{k=1}^n\mathbb{E}\int_s^t\big|V_k(\widetilde{y}(r),\widetilde{\alpha}(r))f_k(\bar{y}_r,\bar{\alpha}(r))
-V_k(\widetilde{y}^0(r),\widetilde{\alpha}_0(r))f_k(\widetilde{y}^0_r,\widetilde{\alpha}_0(r))\big|dr=:\sum_{k=1}^n I_1^k,$$
$$I_2=\sum_{k,l=1}^n\mathbb{E}\int_s^t\big|V_{kl}(\widetilde{y}(r),\widetilde{\alpha}(r))g_k(\bar{y}_r,\bar{\alpha}(r))
g_l(\bar{y}_r,\bar{\alpha}(r))-V_{kl}(\widetilde{y}^0(r),\widetilde{\alpha}_0(r))g_k(\widetilde{y}^0_r,\widetilde{\alpha}_0(r))g_l(\widetilde{y}^0_r,\widetilde{\alpha}_0(r))\big|dr,$$
$$I_3=\mathbb{E}\int_s^t\big|\sum_{j\in\mathcal{S},j\neq\widetilde{\alpha}(r)}q_{\widetilde{\alpha}(r)j}(\bar{y}_r)\big[V(\widetilde{y}(r),j)-V(\widetilde{y}(r),\widetilde{\alpha}(r))\big]
-\sum_{j\in\mathcal{S},j\neq\widetilde{\alpha}_0(r)}q_{\widetilde{\alpha}_0(r)j}(\widetilde{y}^0_r)\big[V(\widetilde{y}^0(r),j)-f(\widetilde{y}^0(r),\widetilde{\alpha}_0(r))\big]\big|dr.$$
Denote $I_2=:\sum_{k,l=1}^n I_2^{k,l}$. For $h>0$, let $[\frac{t-s}{h}]=N_1$, $s_j=s+jh$, $j=0,1,\cdots,N_1$, we have
\begin{align*}
I_1^k&\leq\mathbb{E}\sum_{j=0}^{N_1}\int_{s_j}^{s_{j+1}}\big|V_k(\widetilde{y}(r),\widetilde{\alpha}(r))f_k(\bar{y}_r,\bar{\alpha}(r))
-V_k(\widetilde{y}^0(r),\widetilde{\alpha}(r))f_k(\bar{y}_r,\bar{\alpha}(r))\big|dr\\
&+\mathbb{E}\sum_{j=0}^{N_1}\int_{s_j}^{s_{j+1}}\big|V_k(\widetilde{y}^0(r),\widetilde{\alpha}(r))f_k(\bar{y}_r,\bar{\alpha}(r))
-V_k(\widetilde{y}^0(r),\widetilde{\alpha}_0(r))f_k(\bar{y}_r,\bar{\alpha}(r))\big|dr\\
&+\mathbb{E}\sum_{j=0}^{N_1}\int_{s_j}^{s_{j+1}}\big|V_k(\widetilde{y}^0(r),\widetilde{\alpha}_0(r))f_k(\bar{y}_r,\bar{\alpha}(r))
-V_k(\widetilde{y}^0(r),\widetilde{\alpha}_0(r))f_k(\widetilde{y}^0_r,\bar{\alpha}(r))\big|dr\\
&+\mathbb{E}\sum_{j=0}^{N_1}\int_{s_j}^{s_{j+1}}\big|V_k(\widetilde{y}_0(r),\widetilde{\alpha}_0(r))f_k(\widetilde{y}^0_r,\bar{\alpha}(r))
-V_k(\widetilde{y}^0(r),\widetilde{\alpha}_0(r))f_k(\widetilde{y}^0_r,\widetilde{\alpha}_0(r))\big|dr\\
&=: I_{11}+I_{12}+I_{13}+I_{14}.
\end{align*}
Recalling $V\in C_0^2$, using (\ref{linear}),the H\"{o}lder's inequality and Lemma \ref{YkDeltaBound}, we derive
\begin{align}\label{I11}
I_{11}&\leq c\sum_{j=0}^{N_1}\int_{s_j}^{s_{j+1}}\mathbb{E}\big[\big|\widetilde{y}(r)-\widetilde{y}^0(r)\big|(1+\|\bar{y}_r\|)\big]dr
\leq c\sum_{j=0}^{N_1}\int_{s_j}^{s_{j+1}}\big[\mathbb{E}|\widetilde{y}(r)-\widetilde{y}^0(r)|^2\big]^{\frac{1}{2}}\big[\mathbb{E}(1+\|\bar{y}_r\|^2)\big]^{\frac{1}{2}}dr \nonumber\\
&\leq c\sum_{j=0}^{N_1}\int_{s_j}^{s_{j+1}}\big[\mathbb{E}|\widetilde{y}(r)-\widetilde{y}^0(r)|^2\big]^{\frac{1}{2}}dr
\leq c(N_1+1){h}(\mathbb{E}\varphi_h^2)^{\frac{1}{2}}\rightarrow 0,\ {\rm as}\  h\rightarrow 0.
\end{align}
Similarly, by virtue of the boundedness of $V_k$ and the estimates in Lemma \ref{YkDeltaBound}, we have
\begin{align*}
I_{12}&\leq \mathbb{E}\sum_{j=0}^{N_1}\int_{s_j}^{s_{j+1}}\big|V_k(\widetilde{y}^0(r),\widetilde{\alpha}(r))
-V_k(\widetilde{y}^0(r),\widetilde{\alpha}_0(r))\big|\mathbf{1}_{\{\widetilde{\alpha}(r)\neq\widetilde{\alpha}_0(r)\}}\big(1+\|\bar{y}_r\|\big)dr\\
&\leq\mathbb{E}\sum_{j=0}^{N_1}\Big[\Big(\int_{s_j}^{s_{j+1}}\big|V_k(\widetilde{y}^0(r),\widetilde{\alpha}(r))
-V_k(\widetilde{y}^0(r),\widetilde{\alpha}_0(r))\big|^2\big(1+\|\bar{y}_r\|\big)^2dr\Big)^{\frac{1}{2}}\Big(\int_{s_j}^{s_{j+1}}\mathbf{1}_{\{\widetilde{\alpha}(r)\neq\widetilde{\alpha}_0(r)\}}dr\Big)^{\frac{1}{2}}\Big]\\
&\leq\sum_{j=0}^{N_1}\Big[\Big(\mathbb{E}\int_{s_j}^{s_{j+1}}\big|V_k(\widetilde{y}^0(r),\widetilde{\alpha}(r))
-V_k(\widetilde{y}^0(r),\widetilde{\alpha}_0(r))\big|^2\big(1+\|\bar{y}_r\|\big)^2dr\Big)^{\frac{1}{2}}\Big(\mathbb{E}\int_{s_j}^{s_{j+1}}\mathbf{1}_{\{\widetilde{\alpha}(r)\neq \widetilde{\alpha}_0(r)\}}dr\Big)^{\frac{1}{2}}\Big].
\end{align*}
It can be obtained from (\ref{alpahkDelta}) in the second step of Lemma \ref{estimSwitch} and (\ref{2term}) that
\begin{align}\label{I12}
I_{12}&\leq\sum_{j=0}^{N_1}\Big[ch^{\frac{1}{2}}\Big((j+1)H^2h^3+ch\int_{0}^{s_{j+1}}\mathbb{E}\|\bar{y}_r-\widetilde{y}^0_r\|dr\Big)^{\frac{1}{2}}\Big]\nonumber\\
&\leq\sum_{j=0}^{N_1}\Big[ch^{\frac{1}{2}}\Big(H^2(t-s)h^2+c(j+2)h^2\big(c_{l,T}h^{\frac{\gamma_0}{2}\wedge\frac{l-1}{2l}}+\mathbb{E}\varphi_h\big)\Big)^{\frac{1}{2}}\Big]\nonumber\\
&\leq\sum_{j=0}^{N_1}\Big[ch^{\frac{1}{2}}\Big(H(t-s)^{\frac{1}{2}}h+(c(t-s))^{\frac{1}{2}}h^{\frac{1}{2}}\big(c_{l,T}h^{\frac{\gamma_0}{4}\wedge\frac{l-1}{4l}}+(\mathbb{E}\varphi_h)^{\frac{1}{2}}\big)\Big)\Big]
\rightarrow0, \  {\rm as}\ \ h\rightarrow 0.
\end{align}
Since $f$ satisfies the Lipschitz condition (A3),
\begin{eqnarray*}
I_{13}\leq\mathbb{E}\sum_{j=0}^{N_1}\int_{s_j}^{s_{j+1}}\big|V_k(\widetilde{y}^0(r),\widetilde{\alpha}_0(r))\big|\big|f_k(\bar{y}_{r},\bar{\alpha}(r))
-f_k(\widetilde{y}^0_r,\bar{\alpha}(r))\big|dr\leq c\sum_{j=0}^{N_1}\int_{s_j}^{s_{j+1}}\mathbb{E}\|\bar{y}_r-\widetilde{y}^0_r\|dr,
\end{eqnarray*}
 and substituting (\ref{2term}) into above, we have
\begin{equation}\label{I13}
I_{13}\leq c_{l,T}(N_1+1){h}\big(h^{\frac{\gamma_0}{2}\wedge\frac{l-1}{2l}}+\mathbb{E}\varphi_h\big)\rightarrow0, \ {\rm as} \ h\rightarrow0.
\end{equation}
Likewise,
\begin{align*}
I_{14}&\leq c\mathbb{E}\sum_{j=0}^{N_1}\int_{s_j}^{s_{j+1}}\big|f_k(\widetilde{y}^0_r,\bar{\alpha}(r))
-f_k(\widetilde{y}^0_r,\widetilde{\alpha}(r))\big|\mathbf{1}_{\{\bar{\alpha}(r)\neq\widetilde{\alpha}(r)\}}dr\\
&+c\mathbb{E}\sum_{j=0}^{N_1}\int_{s_j}^{s_{j+1}}\big|f_k(\widetilde{y}^0_r,\widetilde{\alpha}(r))
-f_k(\widetilde{y}^0_r,\widetilde{\alpha}_0(r))\big|\mathbf{1}_{\{\widetilde{\alpha}(r)\neq\widetilde{\alpha}_0(r)\}}dr\\
&\leq c\sum_{j=0}^{N_1}\Big[\Big(\mathbb{E}\int_{s_j}^{s_{j+1}}\big|f_k(\widetilde{y}^0_r,\bar{\alpha}(r))-f_k(\widetilde{y}^0_r,\widetilde{\alpha}(r))\big|^2dr\Big)^{\frac{1}{2}}
\Big(\mathbb{E}\int_{s_j}^{s_{j+1}}\mathbf{1}_{\{\bar{\alpha}(r)\neq\widetilde{\alpha}(r)\}}dr\Big)^{\frac{1}{2}}\Big]\\
&+c\sum_{j=0}^{N_1}\Big[\Big(\mathbb{E}\int_{s_j}^{s_{j+1}}\big|f_k(\widetilde{y}^0_r,\widetilde{\alpha}(r))-f_k(\widetilde{y}^0_r,\widetilde{\alpha}_0(r))\big|^2dr\Big)^{\frac{1}{2}}
\Big(\mathbb{E}\int_{s_j}^{s_{j+1}}\mathbf{1}_{\{\widetilde{\alpha}(r)\neq\widetilde{\alpha}_0(r)\}}dr\Big)^{\frac{1}{2}}\Big]\\
&\leq c\sum_{j=0}^{N_1}\Big[\Big(\mathbb{E}\int_{s_j}^{s_{j+1}}(1+\|\widetilde{y}^0_r\|^2)dr\Big)^{\frac{1}{2}}\Big(\mathbb{E}\int_{s_j}^{s_{j+1}}\mathbf{1}_{\{\bar{\alpha}(r)\neq \widetilde{\alpha}(r)\}}dr\Big)^{\frac{1}{2}}\Big]\\
&+c\sum_{j=0}^{N_1}\Big[\Big(\mathbb{E}\int_{s_j}^{s_{j+1}}(1+\|\widetilde{y}_r\|^2)dr\Big)^{\frac{1}{2}}\Big(\mathbb{E}\int_{s_j}^{s_{j+1}}\mathbf{1}_{\{\widetilde{\alpha}(r)\neq \widetilde{\alpha}_0(r)\}}dr\Big)^{\frac{1}{2}}\Big].
\end{align*}
Hence we have from (\ref{YtildeBound}), (\ref{alpahkDelta}) and (\ref{I12}) that as $h\rightarrow0$,
\begin{align}\label{I14}
I_{14}&\leq c_{T}(N_1+1)h^{\frac{3}{2}}+\sum_{j=0}^{N_1}\Big[c_{T}{h}^{\frac{1}{2}}\Big((j+1)H^2h^3+ch\int_{0}^{s_{j+1}}\mathbb{E}\|\bar{y}_r-\widetilde{y}^0_{r}\|dr\Big)^{\frac{1}{2}}\Big]\nonumber\\
&\leq c_{T}(t-s)h^{\frac{1}{2}}+c_{T}H(t-s)^{\frac{3}{2}}{h}^{\frac{1}{2}}+c_{l,T}(t-s)^{\frac{3}{2}}\big[h^{\frac{\gamma_0}{2}\wedge\frac{l-1}{4l}}+(\mathbb{E}\varphi_h)^{\frac{1}{2}}\big]\rightarrow0
\end{align}
Combining (\ref{I11}), (\ref{I12}), (\ref{I13}) and (\ref{I14}), we get $I_1\rightarrow0$ as $h\rightarrow0$.

Similarly,  we consider the term $I_2$. It is clear to see that
\begin{align*}
I_2^{k,l}
&\leq\mathbb{E}\sum_{j=0}^{N_1}\int_{s_j}^{s_{j+1}}\big|V_{kl}(\widetilde{y}(r),\widetilde{\alpha}(r))g_k(\bar{y}_r,\bar{\alpha}(r))g_l(\bar{y}_r,\bar{\alpha}(r))
-V_{kl}(\widetilde{y}(r),\widetilde{\alpha}(r))g_k(\bar{y}_r,\bar{\alpha}(r))g_l(\widetilde{y}^0_r,\widetilde{\alpha}_0(r))\big|dr\\
&+\mathbb{E}\sum_{j=0}^{N_1}\int_{s_j}^{s_{j+1}}\big|V_{kl}(\widetilde{y}(r),\widetilde{\alpha}(r))g_k(\bar{y}_r,\bar{\alpha}(r))g_l(\widetilde{y}^0_r,\widetilde{\alpha}_0(r))
-V_{kl}(\widetilde{y}(r),\widetilde{\alpha}(r))g_k(\widetilde{y}^0_r,\widetilde{\alpha}_0(r))g_l(\widetilde{y}^0_r,\widetilde{\alpha}_0(r))\big|dr\\
&+\mathbb{E}\sum_{j=0}^{N_1}\int_{s_j}^{s_{j+1}}\big|V_{kl}(\widetilde{y}(r),\widetilde{\alpha}(r))g_k(\widetilde{y}^0_r,\widetilde{\alpha}_0(r))g_l(\widetilde{y}^0_r,\widetilde{\alpha}_0(r))
-V_{kl}(\widetilde{y}^0(r),\widetilde{\alpha}_0(r))g_k(\widetilde{y}^0_r,\widetilde{\alpha}_0(r))g_l(\widetilde{y}^0_r,\widetilde{\alpha}_0(r))\big|dr\\
&=:I_{21}+I_{22}+I_{23}.
\end{align*}
By the boundedness of $V_{kl}$, $g$ satisfies the Lipschitz condition and linear growth condition, combining H\"{o}lder's inequality, Lemma \ref{YkDeltaBound}, (\ref{YtildeBound}), and Lemma \ref{estimSwitch}, we get
\begin{align*}
I_{21}&\leq \mathbb{E}\sum_{j=0}^{N_1}\int_{s_j}^{s_{j+1}}\big|V_{kl}(\widetilde{y}(r),\widetilde{\alpha}(r))\big|\big|g_k(\bar{y}_r,\bar{\alpha}(r))\big|\big|g_l(\bar{y}_r,\bar{\alpha}(r))-g_l(\widetilde{y}^0_r,\bar{\alpha}(r))\big|dr\\
&+\mathbb{E}\sum_{j=0}^{N_1}\int_{s_j}^{s_{j+1}}\big|V_{kl}(\widetilde{y}(r),\widetilde{\alpha}(r))\big|\big|g_k(\bar{y}_r,\bar{\alpha}(r))\big|\big|g_l(\bar{y}^0_r,\bar{\alpha}(r))-g_l(\widetilde{y}^0_r,\widetilde{\alpha}_0(r))\big|dr\\
&\leq c\mathbb{E}\sum_{j=0}^{N_1}\int_{s_j}^{s_{j+1}}\big(1+\|\bar{y}_r\|\big)[\|\bar{y}_r-\widetilde{y}^0_r\|
+\big|g_l(\widetilde{y}^0_r,\bar{\alpha}(r))-g_l(\widetilde{y}^0_r,\widetilde{\alpha}_0(r))\big|\mathbf{1}_{\{\bar{\alpha}(r)\neq\widetilde{\alpha}_0(r)\}}]dr\\
&\leq c\sum_{j=0}^{N_1}\Big[\int_{s_j}^{s_{j+1}}\Big(\mathbb{E}(1+\|\bar{y}_r\|)^2\Big)^\frac{1}{2}\Big(\mathbb{E}\|\bar{y}_r-\widetilde{y}^0_r\|^2\Big)^\frac{1}{2}dr
+\Big(\mathbb{E}\int_{s_j}^{s_{j+1}}\mathbf{1}_{\{\bar{\alpha}(r)\neq\widetilde{\alpha}_0(r)\}}dr\Big)^\frac{1}{2}\\
&\times\Big(\mathbb{E}\int_{s_j}^{s_{j+1}}\big(1+\|\bar{y}_r\|\big)^2\big|g_l(\widetilde{y}^0_r,\bar{\alpha}(r))-g_l(\widetilde{y}^0_r,\widetilde{\alpha}_0(r))\big|^2dr\Big)^\frac{1}{2}\Big]\nonumber\\
&\leq c\sum_{j=0}^{N_1}\Big[\int_{s_j}^{s_{j+1}}\Big(\mathbb{E}\big(1+\|\bar{y}_r\|^2\big)\Big)^\frac{1}{2}\Big(2\mathbb{E}\|\bar{y}_r-\widetilde{y}_{r}\|^2 +2\mathbb{E}\|\widetilde{y}_r-\widetilde{y}^0_r\|^2\Big)^\frac{1}{2}dr\\
&+\Big(\mathbb{E}\int_{s_j}^{s_{j+1}}\mathbf{1}_{\{\bar{\alpha}(r)\neq\widetilde{\alpha}_0(r)\}}\,dr\Big)^\frac{1}{2}\Big(\mathbb{E}\int_{s_j}^{s_{j+1}}\big(1+\|\bar{y}_{r}\|^2\big)\big(1+\|\widetilde{y}^0_r\|^2\big)dr\Big)^\frac{1}{2}\Big]\\
&\leq c\sum_{j=0}^{N_1}\Big[\int_{s_j}^{s_{j+1}}\Big(\big(\mathbb{E}\|\bar{y}_r-\widetilde{y}_{r}\|^2\big)^\frac{1}{2}+\big(\mathbb{E}\|\widetilde{y}_r-\widetilde{y}^0_r\|^2\big)^\frac{1}{2}\Big)dr\\
&+\Big(\mathbb{E}\int_{s_j}^{s_{j+1}}\mathbf{1}_{\{\bar{\alpha}(r)\neq\widetilde{\alpha}_0(r)\}}dr\Big)^\frac{1}{2}\Big(\int_{s_j}^{s_{j+1}}\big(\mathbb{E}(1+\|\bar{y}_r\|^4)\big)^\frac{1}{2}\big(\mathbb{E}(1+\|\widetilde{y}^0_r\|^4)\big)^\frac{1}{2}dr\Big)^\frac{1}{2}\Big]\\
&\leq c_{T}\sum_{j=0}^{N_1}\Big[\int_{s_j}^{s_{j+1}}\big(c_{l,T}h^{\gamma_0\wedge\frac{l-1}{2l}}+(\mathbb{E}\varphi_h^2)^\frac{1}{2}\big)dr+h^{\frac{1}{2}}\Big((j+1)H^2h^3+ch\int_{0}^{s_{j+1}}\mathbb{E}\|\bar{y}_r-\widetilde{y}^0_{r}\|dr\Big)^{\frac{1}{2}}\Big].
\end{align*}
Note that $\sum_{j=0}^{N_1}(s_{j+1}-s_j)=t-s$, then as $h\rightarrow0$,
\begin{eqnarray*}
I_{21}\leq c_{l,T}(t-s)\big[h^{\gamma_0\wedge\frac{l-1}{2l}}+(\mathbb{E}\varphi_h^2)^\frac{1}{2}\big]+c_{T}H(t-s)^{\frac{3}{2}}h^{\frac{1}{2}}
+c_{l,T}(t-s)^{\frac{3}{2}}\big[h^{\frac{\gamma_0}{2}\wedge\frac{l-1}{4l}}+(\mathbb{E}\varphi_h)^{\frac{1}{2}}\big]\rightarrow0.
\end{eqnarray*}
Similarly, $I_{22}\rightarrow0$ as $h\rightarrow0$.
Also,
\begin{align*}
I_{23}&\leq\mathbb{E}\sum_{j=0}^{N_1}\int_{s_j}^{s_{j+1}}\big|V_{kl}(\widetilde{y}(r),\widetilde{\alpha}(r))g_k(\widetilde{y}^0_r,\widetilde{\alpha}_0(r))g_l(\widetilde{y}^0_r,\widetilde{\alpha}_0(r))
-V_{kl}(\widetilde{y}^0(r),\widetilde{\alpha}_0(r))g_k(\widetilde{y}^0_r,\widetilde{\alpha}_0(r))g_l(\widetilde{y}^0_r,\widetilde{\alpha}_0(r))\big|dr\\
&\leq\mathbb{E}\sum_{j=0}^{N_1}\int_{s_j}^{s_{j+1}}\big|V_{kl}(\widetilde{y}(r),\widetilde{\alpha}(r))
-V_{kl}(\widetilde{y}^0(r),\widetilde{\alpha}(r))\big|\big|g_k(\widetilde{y}^0_r,\widetilde{\alpha}_0(r))\big|\big|g_l(\widetilde{y}^0_r,\widetilde{\alpha}_0(r))\big|dr\\
&+\mathbb{E}\sum_{j=0}^{N_1}\int_{s_j}^{s_{j+1}}\big|V_{kl}(\widetilde{y}^0(r),\widetilde{\alpha}(r))
-V_{kl}(\widetilde{y}^0(r),\widetilde{\alpha}_0(r))\big|\big|g_k(\widetilde{y}^0_r,\widetilde{\alpha}_0(r))\big|\big|g_l(\widetilde{y}^0_r,\widetilde{\alpha}_0(r))\big|dr\\
&\leq c\mathbb{E}\sum_{j=0}^{N_1}\int_{s_j}^{s_{j+1}}[\big|\widetilde{y}(r)-\widetilde{y}^0(r)\big|+\big|V_{kl}(\widetilde{y}^0(r),\widetilde{\alpha}(r))
-V_{kl}(\widetilde{y}^0(r),\widetilde{\alpha}_0(r))\big|\mathbf{1}_{\{\widetilde{\alpha}(r)\neq\widetilde{\alpha}_0(r)\}}]\big(1+\|\bar{y}_r\|^2\big)]dr.
\end{align*}
Following the same line as the estimations in $I_{11}$ and $I_{12}$, we have
\begin{align*}
I_{23}&\leq c\sum_{j=0}^{N_1}\int_{s_j}^{s_{j+1}}\big(\mathbb{E}\big|\widetilde{y}(r)-\widetilde{y}^0(r)\big|^2\big)^{\frac{1}{2}}\mathbb{E}(1+\|\widetilde{y}^0_r\|^4)^{\frac{1}{2}}dr
+ \sum_{j=0}^{N_1}\Big[\Big(\mathbb{E}\int_{s_j}^{s_{j+1}}\mathbf{1}_{\{\widetilde{\alpha}(r)\neq\widetilde{\alpha}_0(r)\}}dr\Big)^{\frac{1}{2}}\\
&\times\Big(\mathbb{E}\int_{s_j}^{s_{j+1}}\big|V_{kl}(\widetilde{y}^0(r),\widetilde{\alpha}(r))-V_{kl}(\widetilde{y}^0(r),\widetilde{\alpha}_0(r))\big|^2\big(1+\|\bar{y}_{r}\|\big)^4dr\Big)^{\frac{1}{2}}\Big]\\
&\leq c(N_1+1)h(\mathbb{E}\varphi_h^2)^{\frac{1}{2}}
+cH(t-s)^{\frac{3}{2}}{h}^{\frac{1}{2}}+c_{l,T}(t-s)^{\frac{3}{2}}\big[h^{\frac{\gamma_0}{2}\wedge\frac{l-1}{4l}}+(\mathbb{E}\varphi_h)^{\frac{1}{2}}\big]\rightarrow0(h\rightarrow0).
\end{align*}
Thus $I_2$ tends to zero as $h$ approaches to zero. In the following, we consider the term $I_3.$
\begin{align*}
I_3&\leq\mathbb{E}\sum_{j=0}^{N_1}\int_{s_j}^{s_{j+1}}\sum_{i\in\mathcal{S}}\big|q_{\widetilde{\alpha}(r)i}(\bar{y}_r)V(\widetilde{y}(r),i)-q_{\widetilde{\alpha}_0(r)i}(\widetilde{y}^0_r)V(\widetilde{y}^0(r),i)\big|dr\\
&\leq\mathbb{E}\sum_{j=0}^{N_1}\int_{s_j}^{s_{j+1}}\sum_{i\in\mathcal{S}}\big|q_{\widetilde{\alpha}(r)i}(\bar{y}_r)V(\widetilde{y}(r),i)-q_{\widetilde{\alpha}(r)i}(\bar{y}_r)V(\widetilde{y}^0(r),i)\big|dr\\
&+\mathbb{E}\sum_{j=0}^{N_1}\int_{s_j}^{s_{j+1}}\sum_{i\in\mathcal{S}}\big|q_{\widetilde{\alpha}(r)i}(\bar{y}_r)V(\widetilde{y}^0(r),i)-q_{\widetilde{\alpha}(r)i}(\widetilde{y}^0_r)V(\widetilde{y}^0(r),i)\big|dr\\
&+\mathbb{E}\sum_{j=0}^{N_1}\int_{s_j}^{s_{j+1}}\sum_{i\in\mathcal{S}}\big|q_{\widetilde{\alpha}(r)i}(\widetilde{y}^0_r)V(\widetilde{y}^0(r),i)-q_{\widetilde{\alpha}_0(r)i}(\widetilde{y}^0_r)V(\widetilde{y}^0(r),i)\big|dr=:I_{31}+I_{32}+I_{33}.
\end{align*}
By the assumption (A2),
\begin{align*}
I_{31}&\leq\mathbb{E}\sum_{j=0}^{N_1}\int_{s_j}^{s_{j+1}}\sum_{i\in\mathcal{S}}\big|q_{\widetilde{\alpha}(r)i}(\bar{y}_r)\big|\big|V(\widetilde{y}(r),i)-V(\widetilde{y}^0(r),i)\big|dr\\
&\leq cM\sum_{j=0}^{N_1}\int_{s_j}^{s_{j+1}}\mathbb{E}\big|\widetilde{y}(r)-\widetilde{y}^0(r)\big|dr
\leq cM(t-s)\mathbb{E}\varphi_h\rightarrow0,\ {\rm as} \ h\rightarrow0. %+KCN(t-s)\big(R^\frac{1}{2}(\Delta)+(\mathbb{E}\varphi_\Delta ^2)^\frac{1}{2}\big)\\
\end{align*}
Applying the assumption (A3) and (\ref{2term}),
\begin{align*}
I_{32}&\leq
\mathbb{E}\sum_{j=0}^{N_1}\int_{s_j}^{s_{j+1}}\sum_{i\in\mathcal{S}}\big|q_{\widetilde{\alpha}(r)i}(\bar{y}_r)-q_{\widetilde{\alpha}(r)i}(\widetilde{y}^0_r)\big|\big|V(\widetilde{y}^0(r),i)\big|dr\\
&\leq cC\sum_{j=0}^{N_1}\int_{s_j}^{s_{j+1}}\mathbb{E}\|\bar{y}_r-\widetilde{y}^0_r\|dr
\leq c_{l,T}(t-s)\big(h^{\gamma_0\wedge\frac{l-1}{2l}}+\mathbb{E}\varphi_h\big)\rightarrow0,\ {\rm as} \ h\rightarrow0.
\end{align*}
Similar to the estimate of $I_{12}$,
\begin{align*}
I_{33}&\leq\mathbb{E}\sum_{j=0}^{N_1}\int_{s_j}^{s_{j+1}}\sum_{i\in\mathcal{S}}\big|q_{\widetilde{\alpha}(r)i}(\widetilde{y}^0_r)-q_{\widetilde{\alpha}_0(r)i}(\widetilde{y}^0_r)\big|\big|f(\widetilde{y}(r),i)\big|dr\\
&\leq c\mathbb{E}\sum_{j=0}^{N_1}\int_{s_j}^{s_{j+1}}\sum_{i\in\mathcal{S}}\big|q_{\widetilde{\alpha}(r)i}(\widetilde{y}^0_r)-q_{\widetilde{\alpha}(r)i}(\widetilde{y}^0_r)\big|\mathbf{1}_{\{\widetilde{\alpha}(r)\neq\widetilde{\alpha}_0(r)\}}\,dr\\
&\leq c\sum_{j=0}^{N_1}\Big[\mathbb{E}\int_{s_j}^{s_{j+1}}\Big(\sum_{i\in\mathcal{S}}\big|q_{\widetilde{\alpha}(r)i}(\widetilde{y}^0_r)-q_{\widetilde{\alpha}(r)i}(\widetilde{y}^0_r)\big|\Big)^2dr\Big]^\frac{1}{2}\Big(\mathbb{E}\int_{s_j}^{s_{j+1}}\mathbf{1}_{\{\widetilde{\alpha}(r)\neq\widetilde{\alpha}_0(r)\}}dr\Big)^\frac{1}{2}\\
&\leq cM\sum_{j=0}^{N_1}\Big[h^\frac{1}{2}\Big((j+1)H^2h^3+ch\int_{0}^{s_{j+1}}\mathbb{E}\|\bar{y}_r-\widetilde{y}^0_{r}\|dr\Big)^{\frac{1}{2}}\Big]\\
&\leq cMH(t-s)^{\frac{3}{2}}{h}^{\frac{1}{2}}+c_{l,T}M(t-s)^{\frac{3}{2}}\big[h^{\frac{\gamma_0}{2}\wedge\frac{l-1}{4l}}+(\mathbb{E}\varphi_h)^{\frac{1}{2}}\big]\rightarrow0,\ {\rm as} \ h\rightarrow0.
\end{align*}
Hence, the third term $I_3\rightarrow0$ as $h\rightarrow0$. Then (\ref{Lconverge}) is verified.

Step 3: In view of Step 1 and Step 2, we know $(\widetilde{y}^0(\cdot),\widetilde{\alpha}_0(\cdot))$, the weak limit of $(\widetilde{y}(\cdot),\widetilde{\alpha}(\cdot))$ is a solution of the martingale problem with operator $\mathcal{L}$ defined in (\ref{Loperator}).
Since the solution of the martingale problem with operator $\mathcal{L}$ is unique in distribution, $(\widetilde{y}(\cdot),\widetilde{\alpha}(\cdot))$ converges to $(x(\cdot),\alpha(\cdot))$ weakly.
\end{proof}


\subsection{Strong Convergence}
In this section, we further discuss the uniform convergence in the sense of $L^1$ and associated convergence rate.
To consider the strong convergence of the EM approximation, we need to impose the following additional conditions on the initial data, drift coefficient and diffusion coefficient.
\begin{itemize}
\item[\textbf{(A4)}] There exists a positive constant $\lambda$ such that
$$\mathbb{E}\Big[\sup_{\substack{-\tau\leq s\leq t\leq0\\ t-s\leq h}}|\xi(t)-\xi(s)|^2\Big]\leq\lambda h.$$
\end{itemize}

\begin{itemize}
\item[\textbf{(A5)}] There exists a constant $C_1>0$ such that for any $\phi\in C([-\tau,0];\mathbb{R}^n)$ and $i\in\mathcal{S}$
$$|f(\phi,i)|\vee|g(\phi,i)|\leq C_1.$$
\end{itemize}

We will give the strong convergence result in the following.
\begin{theorem}\label{Rate}
If assumptions {\rm (A1)}-{\rm (A5)} hold, then for any positive constant $\epsilon\in(0,1)$,
$$\mathbb{E}\big[\sup_{0\leq t\leq T}|\widetilde{y}(t)-x(t)|\big]\leq\textrm{O}(h^{\frac{1}{2}-\epsilon}).$$
\end{theorem}
\begin{proof}
It is easy to see that
$$
\mathbb{E}\Big[\sup_{0\leq t\leq T}|\widetilde{y}(t)-x(t)|\Big]\leq\mathbb{E}\int_0^T|f(\bar{y}_s,\bar{\alpha}(s))-f(x_s,\alpha(s))|ds+\mathbb{E}\Big[\sup_{0\leq t\leq T}\Big|\int_0^tg(\bar{y}_s,\bar{\alpha}(s))-g(x_s,\alpha(s))dw(s)\Big|\Big].$$
By (A1), (A5),  Lemma \ref{estimSwitch}, and (\ref{1segmEst}), we derive
\begin{align}\label{drift}
&\mathbb{E}\int_0^T|f(\bar{y}_s,\bar{\alpha}(s)-f(x_s,\alpha(s))|ds\nonumber\\
\leq&\mathbb{E}\int_0^T(|f(\bar{y}_s,\bar{\alpha}(s))-f(\bar{y}_s,\widetilde{\alpha}(s))|+|f(\bar{y}_s,\widetilde{\alpha}(s))-f(\bar{y}_s,\alpha(s))|+|f(\bar{y}_s,\alpha(s))-f(x_s,\alpha(s))|)ds\nonumber\\
\leq&\mathbb{E}\int_0^T|f(\bar{y}_s,\bar{\alpha}(s))-f(\bar{y}_s,\widetilde{\alpha}(s))|\mathbf{1}_{\{\bar{\alpha}(s)\neq\widetilde{\alpha}(s)\}}ds+c\mathbb{E}\int_0^T\|\bar{y}_s-x_s\|ds\nonumber\\
&+\mathbb{E}\int_0^T|f(\bar{y}_s,\widetilde{\alpha}(s))-f(\bar{y}_s,\alpha(s))|\mathbf{1}_{\{\widetilde{\alpha}(s)\neq\alpha(s)\}}ds\nonumber\\
\leq&2c_1\Big(\int_0^T\mathbb{E}\mathbf{1}_{\{\bar{\alpha}(s)\neq\widetilde{\alpha}(s)\}}ds
+\int_0^T\mathbb{E}\mathbf{1}_{\{\widetilde{\alpha}(s)\neq\alpha(s)\}}ds\Big)+c\mathbb{E}\int_0^T\|\bar{y}_s-x_s\|ds\nonumber\\
\leq&c_Th+\big(c_T\int_0^T\mathbb{E}\|\bar{y}_s-x_s\|ds+c_Th\Big)+c\mathbb{E}\int_0^T\|\bar{y}_s-x_s\|ds\nonumber\\
\leq&c_T\int_0^T\mathbb{E}\big[\|\bar{y}_s-\widetilde{y}_s\|+\|\widetilde{y}_s-x_s\|\big]ds+c_Th\nonumber\\
\leq&\Big[c_{l,T}h^{\frac{1}{2}-\frac{1}{2l}}+c_T\mathbb{E}\Big(\int_0^T\sup_{0\leq r\leq s}|\widetilde{y}(r)-x(r)|ds\Big)\Big]+c_Th\nonumber\\
\leq&c_T\mathbb{E}\Big(\int_0^T\sup_{0\leq r\leq s}|\widetilde{y}(r)-x(r)|ds\Big)+c_{l,T}h^{\frac{1}{2}-\frac{1}{2l}}.
\end{align}
For the diffusion term, in view of Burkholder-Davis-Gundy's inequality and the elementary inequality $(a+b+c)^\frac{1}{2}\leq a^\frac{1}{2}+b^\frac{1}{2}+c^\frac{1}{2}$ for $a,b\geq0$, we get
\begin{align*}
&\mathbb{E}\Big[\sup_{0\leq t\leq T}\Big|\int_0^tg(\bar{y}_s,\bar{\alpha}(s))-g(x_s,\alpha(s))dw(s)\Big|\Big]
\leq c\mathbb{E}\Big(\int_0^T|g(\bar{y}_s,\bar{\alpha}(s))-g(x_s,\alpha(s))|^2ds\Big)^\frac{1}{2}\\
&\leq c\mathbb{E}\Big(\int_0^T|g(\bar{y}_s,\bar{\alpha}(s))-g(\bar{y}_s,\widetilde{\alpha}(s))|^2ds\Big)^\frac{1}{2}
+c\mathbb{E}\Big(\int_0^T|g(\bar{y}_s,\widetilde{\alpha}(s))-g(\bar{y}_s,\alpha(s))|^2ds\Big)^\frac{1}{2}\\
&+c\mathbb{E}\Big(\int_0^T|g(\bar{y}_s,\alpha(s))-g(x_s,\alpha(s))|^2ds\Big)^\frac{1}{2}.
\end{align*}
Taking the same techniqueas in the estimates in the drift term and combining with H\"{o}lder's inequality leads to
\begin{align}\label{diffu1}
&\mathbb{E}\Big(\int_0^T|g(\bar{y}_s,\bar{\alpha}(s))-g(\bar{y}_s,\widetilde{\alpha}(s))|^2ds\Big)^\frac{1}{2}
=\mathbb{E}\Big(\int_0^T|g(\bar{y}_s,\bar{\alpha}(s))-g(\bar{y}_s,\widetilde{\alpha}(s))|^2\mathbf{1}_{\{\bar{\alpha}(s)\neq\widetilde{\alpha}(s)\}}ds\Big)^\frac{1}{2}\nonumber\\
\leq&2c_1\mathbb{E}\Big(\int_0^T\mathbf{1}_{\{\bar{\alpha}(s)\neq\widetilde{\alpha}(s)\}}ds\Big)^\frac{1}{2}
\leq2c_1\Big(\mathbb{E}\int_0^T\mathbf{1}_{\{\bar{\alpha}(s)\neq\widetilde{\alpha}(s)\}}ds\Big)^\frac{1}{2}\leq c_Th^\frac{1}{2}.
\end{align}
For the second term, using the inequality $(ab)^\frac{1}{2}\leq\frac{1}{2}(a+b)$ for $a,b\geq0$
\begin{align*}
&\mathbb{E}\Big(\int_0^T|g(\bar{y}_s,\widetilde{\alpha}(s))-g(\bar{y}_s,\alpha(s))|^2ds\Big)^\frac{1}{2}\\
\leq&\mathbb{E}\Big[\frac{1}{2}\Big(\sup_{0\leq s\leq T}|g(\bar{y}_s,\widetilde{\alpha}(s))-g(\bar{y}_s,\alpha(s))|
+\int_0^T|g(\bar{y}_s,\widetilde{\alpha}(s))-g(\bar{y}_s,\alpha(s))|ds\Big)\Big]\\
\leq&c_1\mathbb{E}\Big[\sup_{0\leq s\leq T}\mathbf{1}_{\{\widetilde{\alpha}(s)\neq\alpha(s)\}}\Big]+2C_1c\mathbb{E}\int_0^T\mathbf{1}_{\{\widetilde{\alpha}(s)\neq\alpha(s)\}}ds\\
\leq&c_1\mathbb{E}\Big[\sup_{0\leq s\leq T}\mathbf{1}_{\{\widetilde{\alpha}(s)\neq\alpha(s)\}}\Big]+2C_1\Big(c_T\int_0^T\mathbb{E}\|\bar{y}_s-x_s\|ds+c_Th\Big)\\
\leq&c\mathbb{E}\Big[\sup_{0\leq s\leq T}\mathbf{1}_{\{\widetilde{\alpha}(s)\neq\alpha(s)\}}\Big]+\Big[c_T\mathbb{E}\Big(\int_0^T\sup_{0\leq r\leq s}|\bar{y}(r)-x(r)|ds\Big)+c_{l,T}h^{\frac{1}{2}-\frac{1}{2l}}\Big].
\end{align*}
Now we are in a position to estimate $\mathbb{E}\big[\sup_{0\leq s\leq T}\mathbf{1}_{\{\widetilde{\alpha}(s)\neq\alpha(s)\}}\big]$. Recall that the integer part of $T/h$ is denoted as $[T/h]=\widehat{c}$. Similar to the estimates in Lemma \ref{estimSwitch} and (\ref{drift}), we derive
\begin{align}\label{supAlpha}
&\mathbb{E}\Big[\sup_{0\leq s\leq T}\mathbf{1}_{\{\widetilde{\alpha}(s)\neq\alpha(s)\}}\Big]=\mathbb{P}\big(\exists s\in[0,T],\widetilde{\alpha}(s)\neq\alpha(s)\big)\nonumber\\
=&\mathbb{P}\Big(\bigcup_{k=0}^{\widehat{c}}\big(\{\exists s\in(t_k,t_{k+1}],\widetilde{\alpha}(s)\neq\alpha(s)\}\cap\{\forall t\in[0,t_{k}],\widetilde{\alpha}(t)=\alpha(t)\}\big)\Big)\nonumber\\
\leq&\mathbb{P}\Big(\bigcup_{k=0}^{\widehat{c}}\big(\exists s\in(t_k,t_{k+1}],\widetilde{\alpha}(s)\neq\alpha(s),\widetilde{\alpha}(t_k)=\alpha(t_k)\big)\Big)\nonumber\\
\leq&\sum_{k=0}^{\widehat{c}}\mathbb{P}\big(\exists s\in(t_k,t_{k+1}],\widetilde{\alpha}(s)\neq\alpha(s),\widetilde{\alpha}(t_k)=\alpha(t_{k})\big)\nonumber\\
=&\sum_{k=0}^{\widehat{c}}\mathbb{P}\big(\exists s\in(t_k,t_{k+1}],\widetilde{\alpha}(s)\neq\alpha(s),\widetilde{\alpha}(t_k)=\alpha(t_k),\mathcal{N}((t_k,t_{k+1}])=1\big)\nonumber\\
&+\sum_{k=0}^{\widehat{c}}\mathbb{P}\big(\exists s\in(t_k,t_{k+1}],\widetilde{\alpha}(s)\neq\alpha(s),\widetilde{\alpha}(t_{k})=\alpha(t_{k}),\mathcal{N}((t_k,t_{k+1}])\geq2\big)\nonumber\\
\leq&\sum_{k=0}^{\widehat{c}}\mathbb{P}\big(\widetilde{\alpha}(\zeta_1)\neq\alpha(\zeta_1),t_{k}<\zeta_1\leq t_{k+1},\zeta_2>t_{k+1}|\widetilde{\alpha}(t_k)=\alpha(t_{k})\big)
+\sum_{k=0}^{\widehat{c}}\mathbb{P}\big(\mathcal{N}((t_k,t_{k+1}])\geq2\big)\nonumber\\
\leq&\sum_{k=0}^{\widehat{c}}\int_{t_{k}}^{t_{k+1}}\mathbb{P}\Big(\xi_1\in\bigcup_{\substack{j\neq\widetilde{\alpha}(t_k)\nonumber\\ j\in\mathcal{S}}}\big(\Gamma_{\widetilde{\alpha}(t_{k})j}(\bar{y}_s)\triangle\Gamma_{\widetilde{\alpha}(t_k)j}(x_s)\big),\zeta_1\in ds,\zeta_2>t_{k+1}\Big)
+\sum_{k=0}^{\widehat{c}}\mathbb{P}\big(\mathcal{N}((t_k,t_{k+1}])\geq2\big)\nonumber\\
\leq&\sum_{k=0}^{\widehat{c}}\int_{t_k}^{t_{k+1}}2CN(N-1)\mathbb{E}\|\bar{y}_s-x_s\|e^{-H(k+1)h}\,ds+\sum_{k=0}^{\widehat{K}}H^2h^2\nonumber\\
\leq&\sum_{k=0}^{\widehat{c}}\int_{t_k}^{t_{k+1}}c\mathbb{E}\|\bar{y}_s-x_s\|\,ds+H^2Th
\leq c\int_0^T\mathbb{E}\|\bar{y}_s-x_s\|ds+H^2Th\nonumber\\
\leq&\Big[c_{l,T}h^{\frac{1}{2}-\frac{1}{2l}}+c\mathbb{E}\Big(\int_0^T\sup_{0\leq r\leq s}|\widetilde{y}(r)-x(r)|ds\Big)\Big]+H^2Th\nonumber\\
\leq&c\mathbb{E}\Big(\int_0^T\sup_{0\leq r\leq s}|\widetilde{y}(r)-x(r)|ds\Big)+c_{l,T}h^{\frac{1}{2}-\frac{1}{2l}}.
\end{align}
Therefore we obtain
\begin{align}\label{diffu2}
\mathbb{E}\Big(\int_0^T|g(\bar{y}_s,\widetilde{\alpha}(s))-g(\bar{y}_s,\alpha(s))|^2ds\Big)^\frac{1}{2}
\leq c_T\mathbb{E}\Big(\int_0^T\sup_{0\leq r\leq s}|\widetilde{y}(r)-x(r)|ds\Big)+c_{l,T}h^{\frac{1}{2}-\frac{1}{2l}}.
\end{align}
Recalling the estimates in Lemma \ref{segmentDC} and Remark \ref{remSegDC}, and by the assumption (A4), we have
\begin{eqnarray}\label{2segmEst}
\mathbb{E}\Big(\sup_{0\leq s\leq T}\|\bar{y}_s-\widetilde{y}^0_s\|^2\Big)\leq c\lambda h+c_{l,T}h^{\frac{l-1}{l}}\leq c_{l,T}h^{\frac{l-1}{l}},
\end{eqnarray}
\begin{eqnarray}\label{1segmEst}
\mathbb{E}\Big(\sup_{0\leq s\leq T}\|\bar{y}_s-\widetilde{y}^0_s\|\Big)
\leq\Big[\mathbb{E}\Big(\sup_{0\leq s\leq T}\|\bar{y}_s-\widetilde{y}^0_s\|^2\Big)\Big]^{\frac{1}{2}}
\leq c_{l,T}h^{\frac{1}{2}-\frac{1}{2l}}.
\end{eqnarray}
For the third term, by (A1) and  $(ab)^\frac{1}{2}\leq\frac{1}{2}(a+b)$ for $a,b\geq0$
\begin{align}\label{diffu3}
&\mathbb{E}\Big(\int_0^T|g(\bar{y}_s,\alpha(s))-g(x_s,\alpha(s))|^2ds\Big)^\frac{1}{2}\leq c\mathbb{E}\Big(\int_0^T\|\bar{y}_s-x_s\|^2ds\Big)^\frac{1}{2}\nonumber\\
\leq&\frac{1}{2}\mathbb{E}\Big(\sup_{0\leq s\leq T}\|\bar{y}_s-x_s\|\Big)+\int_0^T\mathbb{E}\|\bar{y}_s-x_s\|ds\nonumber\\
\leq&\frac{1}{2}\mathbb{E}\Big[\Big(\sup_{0\leq s\leq T}\|\bar{y}_s-\widetilde{y}_s\|\Big)+\Big(\sup_{0\leq s\leq T}\|\widetilde{y}_s-x_s\|\Big)\Big]
+\Big[c_{l,T}h^{\frac{1}{2}-\frac{1}{2l}}+c\mathbb{E}\Big(\int_0^T\sup_{0\leq r\leq s}|\widetilde{y}(r)-x(r)|ds\Big)\Big]\nonumber\\
\leq&\frac{1}{2}\mathbb{E}\Big[\sup_{0\leq s\leq T}|\widetilde{y}(s)-x(s)|\Big]+c\mathbb{E}\Big[\int_0^T\sup_{0\leq r\leq s}|\widetilde{y}(r)-x(r)|ds\Big]+c_{l,T}h^{\frac{1}{2}-\frac{1}{2l}}.
\end{align}
Combining the estimates in (\ref{diffu1}), (\ref{diffu2}) and (\ref{diffu3}), we know that the diffusion term satisfies
\begin{align}\label{diffu}
&\mathbb{E}\Big[\sup_{0\leq t\leq T}\Big|\int_0^tg(\bar{y}_s,\bar{\alpha}(s)))-g(x_s,\alpha(s))dw(s)\Big|\Big]\nonumber\\
\leq{}& \frac{1}{2}\mathbb{E}\big[\sup_{0\leq s\leq T}|\widetilde{y}(s)-x(s)|\big]+c_T\mathbb{E}\Big[\int_0^T\sup_{0\leq r\leq s}|\widetilde{y}(r)-x(r)|\,ds\Big]+c_{l,T}h^{\frac{1}{2}-\frac{1}{2l}}.
\end{align}
 (\ref{drift}) and (\ref{diffu}) gives
\begin{align*}
\mathbb{E}\big[\sup_{0\leq t\leq T}|\widetilde{y}(t)-x(t)|\big]
\leq\frac{1}{2}\mathbb{E}\big[\sup_{0\leq s\leq T}|\widetilde{y}(s)-x(s)|\big]+c_T\mathbb{E}\Big[\int_0^T\sup_{0\leq r\leq s}|\widetilde{y}(r)-x(r)|ds\Big]+c_{l,T}h^{\frac{1}{2}-\frac{1}{2l}}.
\end{align*}
This implies
$$\mathbb{E}\big[\sup_{0\leq t\leq T}|\widetilde{y}(t)-x(t)|\big]\leq c_T\mathbb{E}\Big[\int_0^T\sup_{0\leq r\leq s}|\widetilde{y}(r)-x(r)|\,ds\Big]+c_{l,T}h^{\frac{1}{2}-\frac{1}{2l}}.$$
The Gronwall inequality gives
$$\mathbb{E}\big[\sup_{0\leq t\leq T}|\widetilde{y}(t)-x(t)|\big]\leq c_{l,T}h^{\frac{1}{2}-\frac{1}{2l}}e^{c_T}\leq c_{l,T}h^{\frac{1}{2}-\frac{1}{2l}}.$$
For any positive $\epsilon\in(0,1)$, choosing $l>1/{2\epsilon}$ yields the required assertion.
\end{proof}

\begin{rem}\label{}
{\rm
Theorem \ref{Rate} just implies the order of convergence in the sense of $L^1$ is close to 1/2. Noting that the coefficient $c_{l,T}$ may tend to infinity as $l\rightarrow\infty$, so we cannot directly let $l\rightarrow\infty$ to get the convergence order to be exactly 1/2.
}
\end{rem}

\section{Numerical Examples}\label{EX}
In this section, we shall present a example and numerical experiment to illustrate the performance of the algorithms in the previous sections.
\begin{exm}
\rm{
Let $r(t)$ be a right-continuous and left-limit random switch taking values in $\mathcal{S}=\{1,2\}$ with past-dependent generator
$$
Q(\phi)=
\begin{pmatrix}
-5\cos^2(\frac{1}{\tau}\int_{-\tau}^0\phi(\theta)d\theta) & 5\cos^2(\frac{1}{\tau}\int_{-\tau}^0\phi(\theta)d\theta)\\
10\cos^2(\frac{1}{\tau}\int_{-\tau}^0\phi(\theta)d\theta) & -10\cos^2(\frac{1}{\tau}\int_{-\tau}^0\phi(\theta)d\theta)
\end{pmatrix}.
$$
Consider a scalar stochastic functional differential equation with the switching $r(t)$
$$dx(t)=f(x_t,r(t))\,dt+g(x_t,r(t))dw(t),$$
where
$$f(x_t,1)=-\frac{3.3}{\tau}\int_{-\tau}^0x(t+\theta)d\theta,\ \
f(x_t,2)=-\frac{2.7}{\tau}\int_{-\tau}^0x(t+\theta)d\theta,
$$
$$g(x_t,1)=\frac{2}{\tau}\int_{-\tau}^0x(t+\theta)d\theta,\ \
g(x_t,2)=\frac{1}{\tau}\int_{-\tau}^0x(t+\theta)d\theta.$$
Suppose the initial conditions $x_0(\theta)=5$ for $\theta\in[-\tau,0]$ and $r(0)=1$. In our numerical experiment, we take $\tau=0.5$, $T=20$ and use stepsize $h=0.0001$ . Then it is easy to verify the required conditions in Theorem \ref{weakConverge} are satisfied. The sample paths of $x(t)$ and $r(t)$ produced by Euler-Maruyama scheme are depicted in Figure (a) and (b).
\begin{figure}[t]
	\centering
	\vspace{-0.15in}
	\begin{minipage}{1\linewidth}
		\subfigure[]{
			\label{fig:52}
			\includegraphics[width=0.32\linewidth]{1.eps}
		}\noindent
		\subfigure[ ]{
			\label{fig:53}
			\includegraphics[width=0.32\linewidth]{2.eps}
		}\noindent
\subfigure[ ]{
			\label{fig:53}
			\includegraphics[width=0.32\linewidth]{3.eps}
		}\noindent
	\end{minipage}
	\vskip -0.2cm
	\caption{sample paths of $x(t)$ and $r(t)$ produced by Euler-Maruyama scheme.}
	\label{fig 2}
\end{figure}
}
\end{exm}
\begin{exm}
\rm{
We give this example to explain the convergence rate of the approximation. Consider a stochastic functional differential equation with random switching, where the switching and the initial data are defined the same as in the previous example, but the drift and diffusion coefficients are replaced by
\begin{eqnarray*}
f(x_t,1)=-\Big[2+\sin\Big(\frac{1}{\tau}\int_{-\tau}^0x(t+\theta)d\theta\Big)\Big],
f(x_t,2)=-\Big[1+\Big(\sin\Big(\frac{1}{\tau}\int_{-\tau}^0x(t+\theta)d\theta\Big)\Big)\Big(\cos\Big(\frac{1}{\tau}\int_{-\tau}^0x(t+\theta)d\theta\Big)\Big)\Big],
\end{eqnarray*}
\begin{equation*}
g(x_t,1)=
\begin{cases}
  a, & \mbox{if } \frac{0.5}{\tau}\int_{-\tau}^0x(t+\theta)d\theta>a \\
 -a, & \mbox{if } \frac{0.5}{\tau}\int_{-\tau}^0x(t+\theta)d\theta< -a\\
  \frac{0.5}{\tau}\int_{-\tau}^0x_t(\theta)d\theta, & \mbox{otherwise},
\end{cases}
\end{equation*}
\begin{equation*}
g(x_t,2)=
\begin{cases}
  a, & \mbox{if } \frac{0.2}{\tau}\int_{-\tau}^0x(t+\theta)d\theta>a \\
 -a, & \mbox{if } \frac{0.2}{\tau}\int_{-\tau}^0x(t+\theta)d\theta<-a\\
  \frac{0.2}{\tau}\int_{-\tau}^0x(t+\theta)d\theta, & \mbox{otherwise}.
\end{cases}
\end{equation*}
We take $\tau=0.125$, $T=1$, $a=10000$. It is obvious that the assumptions (A1)-(A5) are satisfied. Hence, according to Theorem \ref{Rate}, the EM approximate solution converges to the exact solution with the error $\mathbb{E}\big[\sup_{0\leq t\leq T}|\widetilde{y}(t)-x(t)|\big]\leq\textrm{O}(h^{\frac{1}{2}-\epsilon})$. Since it is hard to find the explicit form of solution, we consider the EM approximation with the smaller stepsize $h=2^{-18}$ as the exact solution. As shown by the log-log error plot in Figure (c),
we simulate the error between the exact solution and the EM approximations with different stepsizes $h=2^{-6},2^{-7},2^{-8},2^{-9},2^{-10},2^{-11}$ for 1000 sample  paths, while the green dashed line represents the reference line with slope $1/2$.
}
\end{exm}

\appendix
\section{Appendix}
\setcounter{equation}{0}
\renewcommand\theequation{A.\arabic{equation}}

\begin{proof}[Proof of Theorem {\rm\ref{ExisUniq}}]
First, let us show the existence and uniqueness of the solution to the system (\ref{SkorSDE}).
 It follows from \cite{Mao2008} that the following stochastic functional equation has a unique strong solution
$$dx(t)=f(x_t,i)dt+g(x_t,i)dw(t)$$
with initial time $t_0$ and initial value $x_{t_0}=\phi\in C([-\tau,0]; \mathbb{R}^n)$ for each fixed $i\in\mathcal{S}$. Furthermore,  the conclusion is still valid when the initial time $t_0$ is a stopping time (see \cite[Remark 3.10]{Mao2006}). We can now construct the solution to (\ref{main equation}) and (\ref{tranProb}) with initial value $(\xi,i_0)$ by interlacing procedure similar to \cite{Dang2016}. Let $\widetilde{x}^{(0)}(t),t\geq 0$ be the solution with initial value $\widetilde{x}^{(0)}(t)=\xi(t), t\in[-\tau,0]$ to
$$d\widetilde{x}^{(0)}(t)=f(\widetilde{x}^{(0)}_t,i_0)dt+g(\widetilde{x}^{(0)}_t,i_0)dw(t).$$
Set
$$\sigma_1=\inf\Big\{t>0:\int_0^t\int_\mathbb{R}h(\widetilde{x}^{(0)}_s,i_0,z)\,\mathcal{N}(ds,dz)\neq0\Big\},
i_1=i_0+\int_0^{\sigma_1}\int_\mathbb{R}h(\widetilde{x}^{(0)}_s,i_0,z)\mathcal{N}(ds,dz).$$
We assume that $\widetilde{x}^{(1)}(t),t\geq\sigma_1$ is the solution with initial value $\widetilde{x}^{(1)}(t)=\widetilde{x}^{(0)}(t), t\in[\sigma_1-\tau,\sigma_1]$ to
$$d\widetilde{x}^{(1)}(t)=f(\widetilde{x}^{(1)}_t,i_1)dt+g(\widetilde{x}^{(1)}_t,i_1)dw(t).$$
Define
$$\sigma_2=\inf\Big\{t>\sigma_1:\int_{\sigma_1}^t\int_\mathbb{R}h(\widetilde{x}^{(1)}_s,i_1,z)\,\mathcal{N}(ds,dz)\neq 0\Big\},
i_2=i_1+\int_{\sigma_1}^{\sigma_2}\int_\mathbb{R}h(\widetilde{x}^{(1)}_s,i_1,z)\,\mathcal{N}(ds,dz).$$
Continuing this procedure, let $\widetilde{x}^{(k)}(t),t\geq \sigma_{k}$ be the solution with initial value $\widetilde{x}^{(k)}(t)=\widetilde{x}^{(k-1)}(t), t\in[\sigma_{k-1}-\tau,\sigma_{k-1}]$ to
$$d\widetilde{x}^{(k)}(t)=f(\widetilde{x}^{(k)}_t,i_k)dt+g(\widetilde{x}^{(k)}_t,i_k)dw(t).$$
Set
$$\sigma_{k+1}=\inf\Big\{t>\sigma_{k}:\int_{\sigma_{k}}^t\int_\mathbb{R}h(\widetilde{x}^{(k)}_s,i_k,z)\,\mathcal{N}(ds,dz)\neq0\Big\},
i_{k+1}=i_k+\int_{\sigma_{k}}^{\sigma_{k+1}}\int_\mathbb{R}h(\widetilde{x}^{(k)}_s,i_k,z)\,\mathcal{N}(ds,dz).$$
Hence we can obtain the following process
$x(t)=\widetilde{x}^{(k)}(t),\  \alpha(t)=i_k \ {\rm if}\ \sigma_{k}\leq t<\sigma_{k+1},$
and $x(t)$ satisfies
\begin{equation*}
\left\{
\begin{array}{ll}
x(t\wedge\sigma_{k})=\xi(0)+\int_0^{t\wedge\sigma_{k}}f(x_s,\alpha(s))ds+\int_0^{t\wedge\sigma_{k}}g(x_s,\alpha(s))dw(s)\\
\alpha(t\wedge\sigma_{k})=i_0+\int_0^{t\wedge\sigma_{k}}\int_\mathbb{R}h(x_s,\alpha(s-),z)\,\mathcal{N}(ds,dz)
\end{array}
 \right.
\end{equation*}
for every $t\geq 0$. Let $\sigma_\infty=\lim_{k\rightarrow\infty}\sigma_{k}$. To show that $x(t)$ is a global solution, we only need to prove that $\sigma_\infty=\infty$ a.s. For any $T>0$, we have
\begin{eqnarray*}
&&\mathbb{P}\{\sigma_k\leq T\}=\mathbb{P}\Big\{\int_{0}^{\sigma_k\wedge T}\int_\mathbb{R}\mathbf{1}_{[0,\sum_{j\in\mathcal{S}}q_j(x_s))}(z)\,\mathcal{N}(ds,dz)=k\Big\}\\
&\leq&\mathbb{P}\Big\{\int_{0}^{\sigma_k\wedge T}\int_\mathbb{R}\mathbf{1}_{[0,H]}(z)\,\mathcal{N}(ds,dz)\geq k\Big\}
\leq\mathbb{P}\{\mathcal{N}((0,T]\times [0,H])\geq k\}=e^{-HT}\sum_{l=k}^{\infty}\frac{(HT)^l}{l!}
\end{eqnarray*}
This implies that $\mathbb{P}\{\sigma_k\leq T\}\rightarrow 0$ as $k\rightarrow\infty$. Therefore we get $\sigma_\infty=\infty$ a.s.. The uniqueness of $(x(t),\alpha(t))$ follows from the uniqueness of $\widetilde{x}^{(k)}(t)$ on $[\sigma_{k},\sigma_{k+1}]$ and the uniqueness of $i_k$ defined by (\ref{interlacingAlpha}).

Next, we illustrate that  the solution $(x(t),\alpha(t))$ also satisfies (\ref{tranProb}). Before that, by using the standard technique (see \cite[Proposition 3.3]{Reiss2006} or \cite[Proposition 4.1]{Butkovsky2017}), we can derive from the strong uniqueness of the solution that the process $(x_t,\alpha(t))$ is Markov.
For a fixed $s\geq 0$, define $\mathcal{G}_s=\sigma\{w(u)-w(s),\mathcal{N}((0,u]\times A)-\mathcal{N}((0,s]\times A):u\geq s, A\in \mathscr{B}([0,\infty)\}$, which is independent of $\mathcal{F}_s$.
Consider the equation for $0\leq s\leq t\leq T$,
\begin{equation}\label{stUniqEqu}
\left\{
\begin{array}{ll}
x^s(t;\xi,i)=\xi(0)+\int_s^{t}f(x_u^s(\xi,i),\alpha^s(u;\xi,i))du+\int_s^{t}g(x_u^s(\xi,i),\alpha^s(u;\xi,i))dw(u)\\
\alpha^s(t;\xi,i)=i+\int_s^{t}\int_\mathbb{R}h(x_u^s(\xi,i),\alpha^s(u-;\xi,i),z)\,\mathcal{N}(du,dz).
\end{array}
 \right.
\end{equation}
It is easy to see that for each fixed $\xi\in C([-\tau,0]; \mathbb{R}^n)$ and $i\in\mathcal{S}$, equation (\ref{stUniqEqu}) has a unique solution and the solution $(x^s(t;\xi,i),\alpha^s(t;\xi,i))$ is $\mathcal{G}_s$-measurable, thus %similar to \cite[Proposition 3.3]{Reiss2006},
$(x_t^s(\xi,i),\alpha^s(t;\xi,i))$ is $\mathcal{G}_s$-measurable as well and independent of $\mathcal{F}_s$. Define a mapping $\Phi: C([-\tau,0]; \mathbb{R}^n)\times\mathcal{S}\times\Omega\rightarrow C([-\tau,0]; \mathbb{R}^n)\times\mathcal{S}$, $(\xi,i,\omega)\mapsto(x_t^s(\xi,i),\alpha^s(t;\xi,i))(\omega)$. Then $\Phi(\xi,i,\cdot)$ is $\mathcal{G}_s$-measurable for any fixed $(\xi,i)\in C([-\tau,0]; \mathbb{R}^n)\times\mathcal{S}$. Introduce the distance on the space $C([-\tau,0]; \mathbb{R}^n)\times\mathcal{S}$ by
$$d((\xi,i),(\eta,j))=\|\xi-\eta\|+\mathbf{1}_{\{i\neq j\}},\ \ \ \xi, \eta\in C([-\tau,0]; \mathbb{R}^n),\ i, j\in \mathcal{S}.$$
For any $0<\epsilon<1$, there exists a positive constant $0<\varrho<1$ such that $d((\xi,i),(\eta,j))<\varrho$, which implies $\|\xi-\eta\|<\varrho$ and $i=j$, so that
\begin{align}\label{distance}
 &\mathbb{P}{\{d((x_t^s(\xi,i),\alpha^s(t;\xi,i)),(x_t^s(\eta,j),\alpha^s(t;\eta,j)))>\epsilon\}}
 =\mathbb{P}{\{\|x_t^s(\xi,i)-x_t^s(\eta,i)\|+\mathbf{1}_{\{\alpha^s(t;\xi,i)\neq \alpha^s(t;\eta,i)\}}>\epsilon\}}\nonumber\\
 \leq&\mathbb{P}{\{\|x_t^s(\xi,i)-x_t^s(\eta,i)\|>\epsilon,\mathbf{1}_{\{\alpha^s(t;\xi,i)\neq\alpha^s(t;\eta,i)\}}=0\}}+\mathbb{P}{\{\mathbf{1}_{\{\alpha^s(t;\xi,i)\neq \alpha^s(t;\eta,i)\}}=1\}}\nonumber\\
 \leq&\mathbb{P}{\{\|x_t^s(\xi,i)-x_t^s(\eta,i)\|>\epsilon\}}+\mathbb{P}{\{\exists r\in[s,t],\alpha^s(r;\xi,i)\neq\alpha^s(r;\eta,i)\}}\nonumber\\
 \leq&\mathbb{E}\|x_t^s(\xi,i)-x_t^s(\eta,i)\|/\epsilon+\mathbb{E}\Big[{\sup_{s\leq r\leq t}\mathbf{1}_{\{\alpha^s(r;\xi,i)\neq\alpha^s(r;\eta,i)\}}}\Big].
\end{align}
Note that $\mathbb{E}\|x_t^s(\xi,i)-x_t^s(\eta,i)\|\leq\|\xi-\eta\|+\mathbb{E}\Big[\sup_{s\leq u\leq t}\big|x^s(u;\xi,i)-x^s(u;\eta,i)\big|\Big],$
define a set $D$ and its complement $D^c$ as
$$D=\{\forall r\in[s,t], \alpha^s(r;\xi,i)=\alpha^s(r;\eta,i)\},\ \ D^c=\{\exists r\in[s,t], \alpha^s(r;\xi,i)\neq\alpha^s(r;\eta,i)\}.$$
By (\ref{stUniqEqu}), we have
\begin{align}\label{D}
&\mathbb{E}\Big[\sup_{s\leq u \leq t}\big|x^s(u;\xi,i)-x^s(u;\eta,i)\big|\mathbf{1}_{D}\Big]\nonumber\\
\leq&\|\xi-\eta\|+\mathbb{E}\Big[\sup_{s\leq u\leq t}\Big|\int_s^{u}f(x_r^s(\xi,i),\alpha^s(r;\xi,i))-f(x_r^s(\eta,i),\alpha^s(r;\eta,i))du\Big|\mathbf{1}_{D}\Big]\nonumber\\
&+\mathbb{E}\Big[\sup_{s\leq u \leq t}\Big|\int_s^ug(x_r^s(\xi,i),\alpha^s(r;\xi,i))-g(x_r^s(\eta,i),\alpha^s(r;\eta,i))dw(u)\Big|\mathbf{1}_{D}\Big]\nonumber\\
\leq&\|\xi-\eta\|+\mathbb{E}\Big[\sup_{s\leq u\leq t}\Big|\int_s^{u}f(x_r^s(\xi,i),\alpha^s(r;\xi,i))-f(x_r^s(\eta,i),\alpha^s(r;\xi,i))du\Big|\mathbf{1}_{D}\Big]\nonumber\\
&+\mathbb{E}\Big[\sup_{s\leq u\leq t}\Big|\int_s^ug(x_r^s(\xi,i),\alpha^s(r;\xi,i))-g(x_r^s(\eta,i),\alpha^s(r;\xi,i))dw(u)\Big|\mathbf{1}_{D}\Big]\nonumber\\
\leq&\|\xi-\eta\|+\mathbb{E}\Big[\sup_{s\leq u\leq t}\Big|\int_s^{u}f(x_r^s(\xi,i),\alpha^s(r;\xi,i))-f(x_r^s(\eta,i),\alpha^s(r;\xi,i))du\Big| \Big]\nonumber\\
&+\mathbb{E}\Big[\sup_{s\leq u\leq t}\Big|\int_s^ug(x_r^s(\xi,i),\alpha^s(r;\xi,i))-g(x_r^s(\eta,i),\alpha^s(r;\xi,i))dw(u)\Big|\Big]\nonumber\\
\leq&\|\xi-\eta\|+c\int_s^t\mathbb{E}\|x_r^s(\xi,i)-x_r^s(\eta,i)\|dr+c\mathbb{E}\Big(\int_s^t\|x_r^s(\xi,i)-x_r^s(\eta,i)\|^2dr\Big)^\frac{1}{2}\nonumber\\
\leq&\|\xi-\eta\|+c\int_s^t\mathbb{E}\|x_r^s(\xi,i)-x_r^s(\eta,i)\|dr+\frac{1}{2}\mathbb{E}\Big[\sup_{s\leq r\leq t}\|x_r^s(\xi,i)-x_r^s(\eta,i)\|\Big]\nonumber\\
\leq& c_T\|\xi-\eta\|+c\int_s^t\mathbb{E}\Big[\sup_{s\leq u\leq r}|x^s(u;\xi,i)-x^s(u;\eta,i)|\Big]dr+\frac{1}{2}\mathbb{E}\Big[\sup_{s\leq u\leq t}|x^s(u;\xi,i)-x^s(u;\eta,i)|\Big].
\end{align}
Using H\"{o}lder's inequality, we obtain
$$\mathbb{E}\Big[\sup_{s\leq u\leq t}\big|x^s(u;\xi,i)-x^s(u;\eta,i)\big|\mathbf{1}_{D^c}\Big]\leq\Big[\mathbb{E}\Big(\sup_{s\leq u\leq t}\big|x^s(u;\xi,i)-x^s(u;\eta,i)\big|^2\Big)\Big]^\frac{1}{2}\Big[\mathbb{E}\mathbf{1}_{D^c}\Big]^\frac{1}{2}
\leq c_T\big(\mathbb{P}(D^c)\big)^\frac{1}{2}.$$
Therefore, it is a key point to estimate $\mathbb{P}(D^c)$. For any fixed $h>0$, we divide the interval $[s,t]$ by $h$ and $N_1=[\frac{t-s}{h}]$.
In the similar way as (\ref{supAlpha}), we can obtain
\begin{eqnarray*}
\mathbb{P}(D^c)&=&\mathbb{P}\Big(\bigcup_{k=0}^{N_1}\big(\{\exists r\in(s+t_k,s+t_{k+1}], \alpha^s(r;\xi,i)\neq\alpha^s(r;\eta,i)\}
\cap\{\forall r\in[s,s+t_k],\alpha^s(r;\xi,i)=\alpha^s(r;\eta,i)\}\big)\Big)\nonumber\\
&\leq&\sum_{k=0}^{N_1}\mathbb{P}\big(\{\exists r\in(s+t_k,s+t_{k+1}], \alpha^s(r;\xi,i)\neq\alpha^s(r;\eta,i)\}\cap\{\forall u\in[s,s+t_k],\alpha^s(u;\xi,i)=\alpha^s(u;\eta,i)\}\nonumber\\
&&\cap\{\mathcal{N}((s+t_k,s+t_{k+1}])=1\}\big)+\sum_{k=0}^{N_1}\mathbb{P}\big(\mathcal{N}((s+t_k,s+t_{k+1}])\geq2\big)\nonumber\\
&\leq&\sum_{k=0}^{N_1}\mathbb{P}\big(\alpha^s(\zeta_1;\xi,i)\neq\alpha^s(\zeta_1;\eta,i),s+t_k<\zeta_1\leq s+t_{k+1},\zeta_2>s+t_{k+1},\nonumber\\
&&\qquad\forall u\in[s,s+t_k],\alpha^s(u;\xi,i)=\alpha^s(u;\eta,i)\big)+H^2(t-s)h\nonumber\\
&\leq&\sum_{k=0}^{N_1}\mathbb{P}\Big(\xi_1\in\bigcup_{\substack{j\neq \alpha^s(s+t_k;\xi,i)\nonumber\\ j\in\mathcal{S}}}\{\Gamma_{\alpha^s(s+t_k;\xi,i)j}(x_{\zeta_1}^s(\xi,i))\triangle\Gamma_{\alpha^s(s+t_k;\xi,i)j}(x_{\zeta_1}^s(\eta,i))\},\nonumber\\
&&\zeta_1\in (s+t_k,s+t_{k+1}],\zeta_2>s+t_{k+1}, \forall u\in[s,s+t_k],\alpha^s(u;\xi,i)=\alpha^s(u;\eta,i)\Big) +H^2(t-s)h  \nonumber\\
&\leq& \sum_{k=0}^{N_1}\int_{s+t_k}^{s+t_{k+1}}\mathbb{P}\Big(\xi_1\in\bigcup_{\substack{j\neq\alpha^s(s+t_k;\xi,i)\nonumber\\ j\in\mathcal{S}}}\{\Gamma_{\alpha^s(s+t_{k};\xi,i)j}(x_r^{\alpha^s(s+t_k;\xi,i)}(\xi,i))\triangle\Gamma_{\alpha^s(s+t_k;\xi,i)j}\nonumber\\
&&\qquad\ \ (x_r^{\alpha^s(s+t_k;\xi,i)}(\eta,i))\},\zeta_1\in dr,\zeta_2>s+t_{k+1}\Big) +H^2(t-s)h,
\end{eqnarray*}
where $x^{\alpha^s(s+t_k;\xi,i)}(r;\xi,i)$ and $x^{\alpha^s(s+t_k;\xi,i)}(r;\eta,i)$ on the interval $[s,\zeta_1]$ satisfy the equations
$$ dx^{\alpha^s(s+t_k;\xi,i)}(r;\xi,i)=f(x_r^{\alpha^s(s+t_k;\xi,i)}(\xi,i),\alpha^s(r;\xi,i))dr+g(x_r^{\alpha^s(s+t_k;\xi,i)}(\xi,i),\alpha^s(r;\xi,i))dw(r),$$
 $$dx^{\alpha^s(s+t_{k};\xi,i)}(r;\eta,i)=f(x_r^{\alpha^s(s+t_k;\xi,i)}(\eta,i),\alpha^s(r;\xi,i))dr+g(x_r^{\alpha^s(s+t_k;\xi,i)}(\eta,i),\alpha^s(r;\xi,i))dw(r)$$
with initial data $\xi$ and $\eta$. Thus
\begin{equation}\label{sup1}
\mathbb{P}(D^c)\leq\sum_{k=0}^{N_1}\int_{s+t_{k}}^{s+(t_{k+1}}c\mathbb{E}\|x_r^{\alpha^s(s+t_{k};\xi,i)}(\xi,i)-x_r^{\alpha^s(s+t_{k};\xi,i)}(\eta,i)\|dr+H^2(t-s)h.
\end{equation}
It is easy to get
\begin{align}\label{segXxieta}
\mathbb{E}\|x_r^{\alpha^s(s+t_{k};\xi,i)}(\xi,i)-x_r^{\alpha^s(s+t_k;\xi,i)}(\eta,i)\|
\leq&\|\xi-\eta\|+\mathbb{E}\Big[\sup_{s\leq u\leq r}\big|x^{\alpha^s(s+t_k;\xi,i)}(u;\xi,i)-x^{\alpha^s(s+t_k;\xi,i)}(u;\eta,i)\big|\Big],
\end{align}
\begin{align*}
&\mathbb{E}\Big[\sup_{s\leq u\leq r}\big|x^{\alpha^s(s+t_k;\xi,i)}(u;\xi,i)-x^{\alpha^s(s+t_k;\xi,i)}(u;\eta,i)\big|^2\Big]\nonumber\\
\leq& c\|\xi-\eta\|^2+c\mathbb{E}\Big(\sup_{s\leq u\leq r}\Big|\int_{s}^u f(x_v^{\alpha^s(s+t_k;\xi,i)}(\xi,i),\alpha^s(v;\xi,i))
-f(x_v^{\alpha^s(s+t_k;\xi,i)}(\eta,i),\alpha^s(v;\xi,i))dv\Big|^2\Big)\nonumber\\
&+c\mathbb{E}\Big(\sup_{s\leq u\leq r}\Big|\int_{s}^ug(x_v^{\alpha^s(s+t_k;\xi,i)}(\xi,i),\alpha^s(v;\xi,i))
-g(x_v^{\alpha^s(s+t_k;\xi,i)}(\eta,i),\alpha^s(v;\xi,i))dw(v)\Big|^2\Big)\nonumber\\
\leq&c\|\xi-\eta\|^2+c_T\mathbb{E}\Big(\int_{s}^{r}\big|f(x_r^{\alpha^s(s+t_k;\xi,i)}(\xi,i),\alpha^s(s+t_k;\xi,i))
-f(x_r^{\alpha^s(s+t_k;\xi,i)}(\eta,i),\alpha^s(s+t_k;\xi,i))\big|^2dr\Big)\nonumber\\
&+c\mathbb{E}\Big(\int_{s}^r\big|g(x_v^{\alpha^s(s+t_k;\xi,i)}(\xi,i),\alpha^s(v;\xi,i))-g(x_v^{\alpha^s(s+t_k;\xi,i)}(\eta,i),\alpha^s(v;\xi,i))\big|^2dr\Big)\nonumber\\
\leq&c\|\xi-\eta\|^2+c_T\int_{s}^r\mathbb{E}\|x_v^{\alpha^s(s+t_k;\xi,i)}(\xi,i)-x_v^{\alpha^s(s+t_k;\xi,i)}(\eta,i)\|^2dr\nonumber\\
\leq&c_T\|\xi-\eta\|^2+c_T\int_{s}^r\mathbb{E}\Big[\sup_{s\leq u\leq v}\big|x^{\alpha^s(s+t_k;\xi,i)}(u;\xi,i)-x^{\alpha^s(s+t_k;\xi,i)}(u;\eta,i)\big|^2\Big]dr.
\end{align*}
The Gronwall inequality implies
$$\mathbb{E}\Big[\sup_{s\leq u\leq r}\big|x^{\alpha^s(s+t_k;\xi,i)}(u;\xi,i)-x^{\alpha^s(s+t_k;\xi,i)}(u;\eta,i)\big|^2 \Big]\leq c_T\|\xi-\eta\|^2e^{c_T(r-s)},$$
then by the Lyapunov inequality, we get
\begin{equation}\label{sup1Xxieta}
\mathbb{E}\Big[\sup_{s\leq u\leq r}\big|x^{\alpha^s(s+t_k;\xi,i)}(u;\xi,i)-x^{\alpha^s(s+t_k;\xi,i)}(u;\eta,i)\big| \Big]\leq c_T\|\xi-\eta\|e^{K_T(t-s)}.
\end{equation}
Substituting (\ref{sup1Xxieta}) into (\ref{segXxieta}) gives
\begin{equation}\label{segrXxieta}
\mathbb{E}\|x_r^{\alpha^s(s+t_k;\xi,i)}(\xi,i)-x_r^{\alpha^s(s+t_k;\xi,i)}(\eta,i)\|\leq c_T\|\xi-\eta\|e^{c_T(t-s)}.
\end{equation}
Combining (\ref{sup1}) and (\ref{segrXxieta}), we obtain
\begin{equation}\label{PDc}
\mathbb{P}(D^c)=\mathbb{E}\Big[{\sup_{s\leq r\leq t}\mathbf{1}_{\{\alpha^s(r;\xi,i)\neq\alpha^s(r;\eta,i)\}}}\Big]\leq c_T(t-s)\|\xi-\eta\|e^{c_T(t-s)}+H^2(t-s)h.
\end{equation}
As a consequence of (\ref{PDc}),
\begin{equation}\label{sup1Dc0}
\mathbb{E}\Big[\sup_{s\leq u \leq t}\big|x^s(u;\xi,i)-x^s(u;\eta,i)\big|\mathbf{1}_{D^c}\Big]\leq c_T(t-s)^\frac{1}{2}\|\xi-\eta\|^\frac{1}{2}e^{c_T(t-s)}+c_TH(t-s)^\frac{1}{2}h^\frac{1}{2}.
\end{equation}
Hence, we can derive from (\ref{sup1Dc0}) that
\begin{align*}
\mathbb{E}\Big[\sup_{s\leq u\leq t}\big|x^s(u;\xi,i)-x^s(u;\eta,i)\big|\Big]
\leq&c\int_s^t \mathbb{E}\Big[\sup_{s\leq u \leq r}|x^s(u;\xi,i)-x^s(u;\eta,i)|\Big]dr+c_T(t-s)^\frac{1}{2}\|\xi-\eta\|^\frac{1}{2}e^{c_T(t-s)}\nonumber\\
&+\frac{1}{2}\mathbb{E}\Big[\sup_{s\leq u \leq t}|x^s(u;\xi,i)-x^s(u;\eta,i)|\Big]+c_T\|\xi-\eta\|+c_TH(t-s)^\frac{1}{2}h^\frac{1}{2}.
\end{align*}
Applying the Gronwall inequality gives
\begin{align*}
\mathbb{E}\Big[\sup_{s\leq u \leq t}\big|x^s(u;\xi,i)-x^s(u;\eta,i)\big|\Big]
\leq\big[c_T\|\xi-\eta\|+c_T(t-s)^\frac{1}{2}\|\xi-\eta\|^\frac{1}{2}e^{c_T(t-s)}+c_TH(t-s)^\frac{1}{2}h^\frac{1}{2}\big]e^{c(t-s)}.
\end{align*}
Then
\begin{align}\label{segXtxieta}
\mathbb{E}\|x_t^s(\xi,i)-x_t^s(\eta,i)\|\leq\big[c_T\|\xi-\eta\|+c_T(t-s)^\frac{1}{2}\|\xi-\eta\|^\frac{1}{2}e^{c_T(t-s)}+c_TH(t-s)^\frac{1}{2}h^\frac{1}{2}\big]e^{c(t-s)}.
\end{align}
It follows from (\ref{distance}), (\ref{PDc}) and (\ref{segXtxieta}) that
\begin{align*}
 &\mathbb{P}{\{d((x_t^s(\xi,i),\alpha^s(t;\xi,i)),(x_t^s(\eta,j),\alpha^s(t;\eta,j)))>\epsilon\}}\\
 \leq&\big[c_T\|\xi-\eta\|+c_T(t-s)^\frac{1}{2}\|\xi-\eta\|^\frac{1}{2}e^{c_T(t-s)}+c_TH(t-s)^\frac{1}{2}h^\frac{1}{2}\big]e^{c(t-s)}/\epsilon+c_T(t-s)\|\xi-\eta\|e^{c_T(t-s)}+H^2(t-s)h\\
 \leq{}& c_T\|\xi-\eta\|^\frac{1}{2}/\epsilon+c_Th^\frac{1}{2}/\epsilon\leq c_T\varrho^\frac{1}{2}/\epsilon+c_Th^\frac{1}{2}/\epsilon.
\end{align*}
Now, for any given $\epsilon>0$, we can choose $\varrho$ sufficiently small for $c_T\varrho^\frac{1}{2}/\epsilon<\epsilon/2$, and choose $\Delta>0$ such that $c_T\Delta^\frac{1}{2}/\epsilon<\epsilon/2$, so that
$$\mathbb{P}{\{d((x_t^s(\xi,i),\alpha^s(t;\xi,i)),(x_t^s(\eta,j),\alpha^s(t;\eta,j)))>\epsilon\}}<\epsilon.$$
Since $\epsilon$ is arbitrary, $(x_t^s(\xi,i),\alpha^s(t;\xi,i))$ is continuous in probability with respect to $(\xi,i)$. Furthermore, because the space $C([-\tau,0];\mathbb{R}^n)\times\mathcal{S}$ is a Polish space, it follows from \cite[Theorem 3.1]{Gusak2010} that the function $\Phi$ has a $\mathscr{B}(C([-\tau,0]; \mathbb{R}^n))\otimes\mathscr{B}(\mathcal{S})\otimes\mathcal{G}_s$ measurable modification $\widetilde{\Phi}$.
In addition, note that the solution $(x_s,\alpha(s))$ is $\mathcal{F}_s$-measurable and independent of $\mathcal{G}_s$.
The uniqueness of the solution implies that
$$(x_t,\alpha(t))(\omega)=(x_t^s(x_s,\alpha(s)),\alpha^s(t;x_s,\alpha(s)))(\omega)=\widetilde{\Phi}(x_s,\alpha(s),\omega) \ \ \ \ \    a.s..$$
Now for any $A\in\mathscr{B}(C([-\tau,0]; \mathbb{R}^n))$, $j\in\mathcal{S}$, we can apply \cite[Lemma 3.2, p.104]{Mao2006} to derive
\begin{align*}
\mathbb{P}((x_t,\alpha(t))\in A\times\{j\}|\mathcal{F}_s)&=\mathbb{E}(\mathbf{1}_{A\times\{j\}}(x_t,\alpha(t))|\mathcal{F}_s)
=\mathbb{E}\big(\mathbf{1}_{A\times\{j\}}(\widetilde{\Phi}(x_s,\alpha(s),\cdot))|\mathcal{F}_s\big)\nonumber\\
&=\mathbb{E}\big[\mathbf{1}_{A\times\{j\}}(\widetilde{\Phi}(\xi,i,\cdot))\big]\big|_{(\xi,i)=(x_s,\alpha(s))}
=\mathbb{P}((x_t,\alpha(t))\in A\times\{j\}|x_s,\alpha(s)).
\end{align*}

For $j\in\mathcal{S}$, take $V(i)=\mathbf{1}_{\{j\}}(i)$. Applying the generalized It\^{o}'s formula  for jump-diffusion processes gives
\begin{eqnarray*}
  V(\alpha(t+h))&=&V(\alpha(t))+\int_{t}^{t+h}\int_{\mathbb{R}}V(\alpha(s)+h(x_s,\alpha(s-),z))-V(\alpha(s))\mathcal{N}(ds,dz)\nonumber\\
  &=&V(\alpha(t))+\int_{t}^{t+h}\sum_{k\in\mathcal{S}}q_{\alpha(s)k}(x_s)(V(k)-V(\alpha(s)))ds\nonumber\\
  &&+\int_{t}^{t+h}\int_{\mathbb{R}}V(\alpha(s)+h(x_s,\alpha(s-),z))-V(\alpha(s))\widetilde{\mathcal{N}}(ds,dz),
\end{eqnarray*}
where $\widetilde{\mathcal{N}}(ds,dz)=\mathcal{N}(ds,dz)-dsdz$ denotes the compensator of the Poisson random measure $\mathcal{N}(ds,dz)$. Then
\begin{align*}
&\mathbb{P}{\{\alpha(t+h)=j|\alpha(t)=i,x_t=\phi,x_s,\alpha(s),s\leq t\}}\\
=&\mathbb{E}[V(\alpha(t+h))|\alpha(t)=i,x_t=\phi,x_s,\alpha(s),s\leq t]\\
=&V(i)+\mathbb{E}\Big[\int_t^{t+h}\Sigma_{k\in\mathcal{S}}q_{\alpha(s)k}(x_s)V(k)ds\Big|\alpha(t)=i,x_t=\phi,x_s,\alpha(s),s\leq t\Big]\\
=&V(i)+\int_t^{t+h}\mathbb{E}[\Sigma_{k\in\mathcal{S}}q_{\alpha(s)k}(x_s)V(k)|\alpha(t)=i,x_t=\phi]ds\\
=&V(i)+\int_t^{t+h}\mathbb{E}[q_{\alpha(s)j}(x_s)|\alpha(t)=i,x_t=\phi]ds.
\end{align*}
Recall that $\alpha(t)$ is right continuous, $x(t),q_{ij}(\cdot)$ are continuous, we obtain $\lim_{s\downarrow t}q_{\alpha(s)j}(x_s)=q_{\alpha(t)j}(x_t)$,
and
$$\lim_{h\downarrow0}\frac{1}{h}\int_t^{t+h}q_{\alpha(s)j}(x_s)ds=q_{\alpha(t)j}(x_t),\ a.s..$$
Then in terms of Lebesgue's dominated convergence theorem, we get
$$\lim_{h\downarrow0}\frac{1}{h}\big(\mathbb{P}{\{\alpha(t+h)=j|\alpha(t)=i,x_t=\phi\}}-V(i)\big)-q_{ij}(x_t)=0.$$
Hence (\ref{tranProb}) holds.

Finally, Let us verify the moment boundedness of the solution. For $0\leq t\leq T$, by virtue of (\ref{main equation}), H\"{o}lder's
inequality, Doob's martingale inequality and (\ref{linear}), we have
\begin{align*}
\mathbb{E}\Big[\sup_{0\leq s\leq t}|x(s)|^p\Big]
\leq&c\Big[\mathbb{E}|\xi(0)|^p+\mathbb{E}\Big(\sup_{0\leq s\leq t}\Big|\int_0^sf(x_r,\alpha(r))dr\Big|^p\Big)+\mathbb{E}\Big(\sup_{0\leq s\leq t}\Big|\int_0^sg(x_r,\alpha(r))dw(r)\Big|^p\Big)\Big]\\
\leq&c\Big[\mathbb{E}|\xi(0)|^p+T^{p-1}\mathbb{E}\int_0^t|f(x_r,\alpha(r))|^pdr+T^{\frac{p-2}{2}}\mathbb{E}\int_0^t|g(x_r,\alpha(r))|^pdr\Big]\\
\leq&c\Big[\mathbb{E}|\xi(0)|^p+\big(T^{p-1}+T^{\frac{p-2}{2}}\big)\int_0^t(1+\mathbb{E}\|x_r\|^p)dr\Big]\\
\leq&c\mathbb{E}\|\xi\|^p+c\big(T^{p-1}+T^{\frac{p-2}{2}}\big)\int_0^t\Big[1+\mathbb{E}\Big(\sup_{-\tau\leq u\leq r}|x(u)|^p\Big)\Big]dr.
\end{align*}
Noting that $\sup_{-\tau\leq s\leq t}|x(s)|^p\leq \|\xi\|^p+\sup_{0\leq s\leq t}|x(s)|^p,$ we obtain
$$1+\mathbb{E}\Big[\sup_{-\tau\leq s\leq t}|x(s)|^p\Big]\leq 1+c\mathbb{E}\|\xi\|^p+c\big(T^{p-1}+T^{\frac{p-2}{2}}\big)\int_0^t\Big[1+\mathbb{E}\Big(\sup_{-\tau\leq u\leq r}|x(u)|^p\Big)\Big]dr.$$
The Gronwall inequality implies
$$\mathbb{E}\Big[\sup_{-\tau\leq s\leq t}|x(s)|^p\Big]\leq (1+c\mathbb{E}\|\xi\|^p)e^{c(T^{p-1}+T^{\frac{p-2}{2}})T}=:c_{p,T}.$$
The proof is completed.
\end{proof}

\begin{rem}\label{contidependence}
{\rm
The estimate (\ref{segXtxieta}) indicates the segment process $X_t$ is continuously dependent on the initial value, which is a generalization of \cite[Theorem 3.3]{Shao2021} to the case that the switching dependent on the past, and relaxes the requirement that the drift coefficient of the equation be bounded and the diffusion coefficient constant.
}
\end{rem}



{\small
\setlength{\baselineskip}{0.10in}

\begin{thebibliography}{10}
\parskip=0pt

\bibitem{Bao2016a} J. Bao, J. Shao, C. Yuan. Approximation of invariant measures for regime-switching diffusions. Potential Anal., 2016, 44: 707-727.
\bibitem{Bao2023} J. Bao, J. Shao, C. Yuan. Invariant probability measures for path-dependent random diffusions. Nonlinear Anal., 2023, 228: 113201.
\bibitem{Butkovsky2017} O. Butkovsky, M. Scheutzow, Invariant measures for stochastic functional differential equations. Electron. J. Probab., 2017, 22: 1-23.
\bibitem{Chung2001} K. L. Chung. A course in probability theory. Third ed. New York: Academic Press, 2001.
\bibitem{Cloez2015} B. Cloez, M. Hairer. Exponential ergodicity for Markov processes with random switching. Bernoulli, 2015, 21(1): 505-536.
\bibitem{Gusak2010} D. Gusak, A. Kukush, A. Kulik, Y. Mishura, A. Pilipenko. Theory of stochastic processes: with applications to financial mathematics and risk theory. New York: Springer, 2010.
\bibitem{Kushner1984} H. J. Kushner. Approximation and weak convergence methods for random processes, with applications to stochastic systems theory. Cambridge: MIT Press, 1984.
\bibitem{Kloeden1992} P. E. Kloeden, E. Platen. Numerical Solution of Stochastic Differential Equations. Berlin: Springer, 1992.
\bibitem{Karatzas1991} I. Karatzas, S. E. Shreve. Brownian motion and stochastic calculus, Second ed. New York: Springer-Verlag, 1991.
\bibitem{Li2024} X. Li, X. Mao, G. Song. An explicit approximation for super-linear stochastic functional differential equations. Stochastic Process. Appl., 2024, 169: 104275.
\bibitem{Li2018} X. Li, Q. Ma, H. Yang, C. Yuan. The numerical invariant measure of stochastic differential equations with Markovian switching. SIAM J. Numer. Anal., 2018, 56(3): 1435-1455.
\bibitem{Li2019} X. Li, X. Mao, G. Yin. Explicit numerical approximations for stochastic differential equations in finite and infinite horizons: truncation methods, convergence in $p$th moment and stability. IMA J. Numer. Anal., 2019, 39(2): 847-892.
\bibitem{Mao2008} X. Mao. Stochastic differential equations and applications, Second ed. Chichester: Horwood Publishing Limited, 2008.
\bibitem{Mao2015} X. Mao. The truncated Euler-Maruyama method for stochastic differential equations. J. Comput. Appl. Math., 2015, 290: 370-384.
\bibitem{MaoYH2024} Y. Mao, J. Shao. Averaging principle for two time-scale regime-switching processes. Electron. J. Probab., 2024, 29(14): 1-21.
\bibitem{Mao2006} X. Mao, C. Yuan. Stochastic differential equations with Markovian switching. London: Imperial College Press, 2006.
\bibitem{Dang2021} D. H. Nguyen, D. Nguyen, S. L. Nguyen. Stability in distribution of path-dependent hybrid diffusion. SIAM J. Control Optim., 2021, 59(1): 434-463.
\bibitem{Dang2024} D. H. Nguyen, N. N. Nguyen, T. T. Ta and G. Yin. Stability of Stochastic Functional Differential Equations With Past-Dependent Random Switching Involving Countably Infinite States. IEEE Trans. Automat. Control, 2024, 69(3): 1612-1626.
\bibitem{Dang2016} D. H. Nguyen, G. Yin, Modeling and analysis of switching diffusion systems: past-dependent switching with a countable state space. SIAM J. Control Optim., 2016, 54(5): 2450-2477.
\bibitem{Dang2018a} D. H. Nguyen, G. Yin. Recurrence and ergodicity of switching diffusions with past-dependent switching having a countable state space. Potential Anal., 2018, 48(4): 405-435.
\bibitem{Dang2018b} D. H. Nguyen, G. Yin. Stability of regime-switching diffusion systems with discrete states belonging to a countable set. SIAM J. Control Optim., 2018, 56(5): 3893-3917.
\bibitem{Dang2018c} D. H. Nguyen, G. Yin. Recurrence for switching diffusion with past dependent switching and countable state space. Math. Control Relat. Fields, 2018, 8: 879-897.
\bibitem{Pinsky1993} M. Pinsky, R. G. Pinsky. Transience/recurrence and central limit theorem behavior for diffusions in random temporal environments. Ann. Probab., 1993, 21(1): 433-452.
\bibitem{Pinsky1992} M. Pinsky, M. Scheutzow. Some  remarks  and  examples  concerning  the  transience  andrecurrence of random diffusions. Ann. Inst. Henri Poincar��, 1992, 28: 519-536.
\bibitem{Reiss2006} M. Reiss, M. Riedle, O. van Gaans, Delay differential equations driven by L��vy processes: stationarity and Feller properties. Stoch. Process. Appl., 2006, 116: 1409-1432.
\bibitem{Shao2015a} J. Shao. Strong solutions and strong Feller properties for regime-switching diffusion processes in an infinite state space. SIAM J. Control Optim., 2015, 53(4): 2462-2479.
\bibitem{Shao2018} J. Shao. Invariant measures and Euler--Maruyama's approximations of state-dependent regime-switching diffusions. SIAM J. Control Optim., 2018, 56(5): 3215-3238.
\bibitem{Shi2024} B. Shi, Y. Wang, X. Mao, F. Wu. Approximation of invariant measures of a class of backward Euler-Maruyama scheme for stochastic functional differential equations. J. Differential Equations, 2024, 389: 415-456.
\bibitem{Shi2022} B. Shi, Y. Wang, F. Wu. Ergodicity of regime-switching functional diffusions with infinite delay and application to a numerical algorithm for stochastic optimization. SIAM J. Control Optim., 2022, 60(5): 2658-2683.
\bibitem{Shao2023} J. Shao, L. Wang, Q. Wu. Ergodicity and stability of hybrid systems with piecewise constant type state-dependent switching. Stochastic Process. Appl., 2023, 161: 1-23.
\bibitem{Shao2021} J. Shao, K. Zhao. Continuous dependence for stochastic functional differential equations with state-dependent regime-switching on initial values. Acta Math. Sin. (Engl. Ser.), 2021, 37(3): 389-407.
\bibitem{Skorokhod1989} A. V. Skorokhod. Asymptotic Methods in the Theory of Stochastic Differential Equations, AMS, Providence, RI, 1989.
\bibitem{Shiryaev1996} A. N. Shiryaev. Probability. Second ed. New York: Springer-Verlag, 1996.
\bibitem{Tran2023} K. Q. Tran, G. Yin. Numerical solutions of stochastic functional differential equations with impulsive perturbations and Markovian switching. Nonlinear Anal. Hybrid Syst., 2023, 50: 101409.
\bibitem{Yin2010} G. Yin, X. Mao, C. Yuan, D. Cao, Approximation methods for hybrid diffusion systems with state-dependent switching processes: numerical algorithms and existence and uniqueness of solutions. SIAM J. Math. Anal., 2010, 41(6): 2335-2352.
\bibitem{YinZhu2010} G. Yin, C. Zhu. Hybrid Switching Diffusions, Properties and applications. New York: Springer-Verlag, 2010.
\bibitem{YinZhang2012} G. Yin, Q. Zhang. Continuous-time Markov chains and applications: a two-time-scale approach. Springer Science \& Business Media, 2013.
\bibitem{Xi2017} F. Xi, C. Zhu. On Feller and strong Feller properties and exponential ergodicity of regime-switching jump diffusion processes with countable regimes. SIAM J. Control Optim., 2017, 55(3): 1789-1818.
\bibitem{Wu2008} F. Wu, X. Mao. Numerical solutions of neutral stochastic functional differential equations. SIAM J. Numer. Anal., 2008, 46(4): 1821-1841.
\bibitem{Wu2022} F. Wu, G. Yin. Fast-slow-coupled stochastic functional differential equations. J. Differential Equations, 2022, 323: 1-37.
\bibitem{Wang2024} Y. Wang, F. Wu, G. Yin. Limit theorems of additive functionals for regime-switching diffusions with infinite delay. Stochastic Process. Appl., 2024, 167: 104215.
\bibitem{Zhou2017} S. Zhou, H. Jin. Strong convergence of implicit numerical methods for nonlinear stochastic functional differential equations. J. Comput. Appl. Math., 2017, 324: 241-257.
\bibitem{Zhang2023} Y. Zhang, M. Song, M. Liu. Strong convergence of the tamed Euler method for nonlinear hybrid stochastic differential equations with piecewise continuous arguments. J. Comput. Appl. Math., 2023, 429: 115197.
\bibitem{Zong2016} X. Zong, F. Wu, C. Huang. The moment exponential stability criterion of nonlinear hybrid stochastic differential equations and its discrete approximations. Proc. Roy. Soc. Edinburgh Sect. A, 2016, 146(6): 1303-1328.


\end{thebibliography}

}

\end{document}
