\section{Introduction}
The {\it Cremona group in $d$-variables} over a field ${\bf k}$ is the group of birational transformations of the projective $d$-space  $\operatorname{\mathbb{P}}^d_{{\bf k}}$ over ${\bf k}$. Equivalently, it can be seen as the group of ${\bf k}$-automorphisms of the field ${\bf k}(x_1,\dots, x_d)$. Cremona groups have been the object of research for over 150 years and considerable progress in the understanding of their structure has been achieved recently. This article concerns  group automorphisms of $\operatorname{Cr}_d({\bf k})$.

An important subgroup of $\operatorname{Cr}_d({\bf k})$ is the automorphism group $\operatorname{Aut}(\operatorname{\mathbb{P}}_{{\bf k}}^d)$, which is isomorphic to $\operatorname{PGL}_{d+1}({\bf k})$.  Every field automorphism $\alpha$ of ${\bf k}$ naturally induces a group automorphism on both, $\operatorname{Cr}_d({\bf k})$ and $\operatorname{PGL}_d({\bf k})$, which we denote by $g\mapsto {}^\alpha\!g$. The group automorphisms of $\operatorname{PGL}_d({\bf k})$ are well-known: every automorphism of $\operatorname{PGL}_{d+1}({\bf k})$ is the composition of an inner automorphism with an automorphism of the form $g\mapsto {}^\alpha\!g$ or $g\mapsto  {}^\alpha\!g^\vee$, where $\alpha$ is a field automorphism of ${\bf k}$ and $g^\vee$ denotes the inverse of the transpose of $g$. Note that this result implies in particular, that all group automorphisms of $\operatorname{PGL}_{d+1}({\bf k})$ are Zariski continuous.

In \cite{MR2278755}, D\'eserti showed  that every group automorphism  of  $\operatorname{Cr}_2(\operatorname{\mathbb{C}})$ is inner up to automorphisms induced by a field automorphism of $\operatorname{\mathbb{C}}$.
It is a natural question, whether the theorem of D\'eserti holds in all dimensions and for all fields. A difficulty in studying group automorphisms of $\operatorname{Cr}_d({\bf k})$ for $d>0$ is that no easy to handle set of generators of the group is known. However, $\operatorname{Cr}_d({\bf k})$ can be endowed with the {\it Zariski topology}, a topology that extends the Zariski topology of $\operatorname{PGL}_{d+1}({\bf k})$ (see Section~\ref{sec:Zariski}). We generalize D\'eserti's theorem to arbitrary dimensions and arbitrary fields of chracteristic $0$ under the additional assumption that the group automorphisms are also homeomorphisms with respect to the Zariski topology.

\begin{theorem}\label{main:cremona}
	Let ${\bf k}$ be a field of characteristic $0$ and let $\varphi\colon\operatorname{Cr}_d({\bf k})\to\operatorname{Cr}_d({\bf k})$ be a  group automorphism  that is a homeomorphism with respect to the Zariski topology, where $d\geq 2$. Then there exists a field automorphism $\alpha$ of ${\bf k}$ and an element $f\in\operatorname{Cr}_d({\bf k})$ such that $\varphi(g)=f\, ({}^\alpha\! g) f^{-1}$ for all $g\in\operatorname{Cr}_d({\bf k})$.
\end{theorem}

If ${\bf k}={\operatorname{\mathbb{R}}}$ or ${\bf k}=\operatorname{\mathbb{C}}$, then $\operatorname{Cr}_d({\bf k})$ can moreover be equipped with the Euclidean topology - a topology that makes $\operatorname{Cr}_d({\bf k})$  a Hausdorff topological group and which restricts to the standard Euclidean topology on $\operatorname{Aut}(\operatorname{\mathbb{P}}^d_{{\bf k}})$ (see Section~\ref{sec:Euclidean}). In this setting, Theorem~\ref{main:cremona} also holds if we consider the Euclidean topology instead of the Zariski topology:

\begin{theorem}\label{main:euclidean}
	Let ${\bf k}=\operatorname{\mathbb{C}}$ or ${\bf k}={\operatorname{\mathbb{R}}}$ and let $\varphi\colon\operatorname{Cr}_d({\bf k})\to\operatorname{Cr}_d({\bf k})$ be a  group automorphism  that is a homeomorphism with respect to the Euclidean topology, where $d\geq 2$. Then there exists a field-automorphism $\alpha$ of ${\bf k}$ that is Euclidean continuous and an element $f\in\operatorname{Cr}_d({\bf k})$ such that $\varphi(g)=f\, ({}^\alpha\! g) f^{-1}$ for all $g\in\operatorname{Cr}_d({\bf k})$.
\end{theorem}

The main ingredients for the proof of Theorem~\ref{main:cremona} and Theorem~\ref{main:euclidean} are a result of Cantat and Xie about embeddings of finite index subgroups of $\operatorname{SL}_{d+1}(\operatorname{\mathbb{Z}})$, the classification of automorphisms of $\operatorname{PGL}_{d+1}({\bf k})$, and a topological deformation  argument.

D\'eserti's theorem implies that every group automorphism of $\operatorname{Cr}_2(\operatorname{\mathbb{C}})$ is Zariski continuous. It is therefore a natural question whether every group automorphism  of $\operatorname{Cr}_d({\bf k})$ is Zariski continuous.

Observe that Theorem \ref{main:cremona} implies in particular, that if ${\bf k}$ doesn't have any non-trivial field automorphisms (for instance, if ${\bf k}=\operatorname{\mathbb{Q}}$ or ${\bf k}={\operatorname{\mathbb{R}}}$), then every continuous isomorphism of $\operatorname{Cr}_d({\bf k})$ is inner.  In this setting, Theorem~\ref{main:euclidean} can be seen as an algebraic analogue of  \cite{filipkiewicz1982isomorphisms}, where it is shown that all group automorphisms of diffeomorphism groups are inner. Following this theme, we look in Section~\ref{sec:birdiff} at continuous automorphisms of the group of diffeomorphisms of $\operatorname{\mathbb{P}}^d_{{\operatorname{\mathbb{R}}}}({\operatorname{\mathbb{R}}})$ that are induced by birational transformations.

In Section~\ref{sec:poly}, we consider instead of $\operatorname{Cr}_d({\bf k})$ its sister, the group of polynomial automorphisms $\operatorname{Aut}(\operatorname{\mathbb{A}}^d_{\bf k})$, and obtain the following result:

\begin{theorem}\label{main:aut}
		Let ${\bf k}$ be an infinite perfect field and let $\varphi\colon\operatorname{Aut}(\operatorname{\mathbb{A}}^d_{\bf k})\to\operatorname{Aut}(\operatorname{\mathbb{A}}^d_{\bf k})$ be a group automorphism that is a homeomorphism with respect to the Zariski topology. Then there exists a field automorphism $\alpha$ of ${\bf k}$ and an element $f\in\operatorname{Aut}(\operatorname{\mathbb{A}}^d_{\bf k})$ such that $\varphi(g)=f\, ({}^\alpha\! g) f^{-1}$ for all $g\in\operatorname{Aut}(\operatorname{\mathbb{A}}^d_{\bf k})$.
\end{theorem}

The group $\operatorname{Aut}(\operatorname{\mathbb{A}}^d_{\bf k})$ has the additional structure of an {\it ind-group} (see \cite{furterkraft} for details). Theorem \ref{main:aut} implies in particular that every ind-group automorphism of $\operatorname{Aut}(\operatorname{\mathbb{A}}^d_{\bf k})$ is inner, if ${\bf k}$ is an infinite perfect field. In the case where ${\bf k}$ is of characteristic zero and algebraically closed, this fact was proven by Kanel-Belov, Yu, and Elishev \cite{kanel2018augmentation}. Again, one can ask the question, whether all group automorphisms of $\operatorname{Aut}(\operatorname{\mathbb{A}}^d_{\bf k})$ are Zariski continuous. In dimension 2, the question has a positive answer if ${\bf k}$ is uncountable \cite{MR2209276}. A partial generalization of \cite{MR2209276} to higher dimensions has been obtained in \cite{kraftstampfli}, \cite{stampfli}, \cite{urech2013automorphisms}.

It could be interesting to generalize D\'eserti's theorem as well as the results of this paper to more general fields, in particular to finite fields. Another natural question is in as far similar results hold if we drop either the condition of surjectivity or injectivity of the group endomorphisms; these questions have been raised in \cite{MR2292279}, \cite{MR3985695}, and also \cite{balnclamyzimmermann}.

\vskip\baselineskip

{\bf Acknowledgements:} The authors would like to thank
Jean-Philippe Furter,
Hanspeter Kraft, and
Immanuel van Santen (n\'e Stampfli) for interesting discussions related to this project.

\section{Topologies on the Cremona groups}
 Cremona groups carry the so-called {\it Zariski topology}, which was introduced by M. Demazure \cite{MR0284446}. Over local fields, this topology can be refined to the {\it Euclidean topology} - a construction due to J. Blanc and J.-P. Furter \cite{BlancFurter}. Both topologies restrict to the usual Zariski or Euclidean topology on the group $\operatorname{Aut}(\operatorname{\mathbb{P}}^d_{{\bf k}})$. In this section we will briefly recall the definitions and main properties of those topologies.

\subsection{The Zariski topology}\label{sec:Zariski}

Let ${\bf k}$ be a field and $X$ and $A$ irreducible algebraic varieties defined over ${\bf k}$. Consider a birational map $f\colon A\times X\dashrightarrow A\times X$ inducing an isomorphism between open dense subsets $U$ and $V$, where $U,V\subset A\times X$ have the property that the restriction of the first projection to $U$ and $V$ induces a surjective morphism onto  $A$. Every ${\bf k}$-point $a\in A({\bf k})$ induces a birational transformation $f_a$ of $X$ by mapping $x\in X$ to $p_2(f(a,x))$, where $p_2\colon A\times X\to X$ is the second projection. The map from $A({\bf k})$ to $\operatorname{Bir}(X)$ given by $a\mapsto f_a$ is called a {\em morphism} (or {\em ${\bf k}$-morphism}) from $A$ to $\operatorname{Bir}(X)$, and is denoted by $A\to\operatorname{Bir}(X)$.

The Zariski topology is now the finest topology such that the preimages of closed subsets by morphisms are closed:

\begin{definition}
A subset $F\subset\operatorname{Bir}(X)$ is closed in the {\em Zariski topology} if for any algebraic ${\bf k}$-variety $A$ and any ${\bf k}$-morphism $A\to \operatorname{Bir}(X)$ the preimage of $F$ is closed in $A({\bf k})$.
\end{definition}

Recall that, once we choose coordinates of $\operatorname{\mathbb{P}}^d_{{\bf k}}$, a Cremona transformation is given by $[x_0:\dots:x_d]\mapstochar\dashrightarrow [f_0:\dots:f_d]$, where the $f_i\in{\bf k}[x_0,\dots, x_d]$ are homogeneous polynomials of the same degree without a non-constant common factor. The {\it degree} of $f$ is then defined to be the degree of the $f_i$. We denote by $\operatorname{Cr}_d({\bf k})_{\leq n}$ the set of Cremona transformations of degree $\leq n$ and  by $\operatorname{Cr}_d({\bf k})_{n}$ the set of those of degree~$n$.

J. Blanc and J.-P. Furter give an equivalent construction of the Zariski topology on the Cremona groups \cite[\S2]{BlancFurter}
by defining a topology on $\operatorname{Cr}_d({\bf k})_{\leq n}$ and extending it to $\operatorname{Cr}_d({\bf k})$ as the inductive limit topology. The sets $\operatorname{Cr}_d({\bf k})_n$ can be equipped canonically with the structure of a ${\bf k}$-variety such that the elements in $\operatorname{Cr}_d({\bf k})_n$ are exactly its ${\bf k}$-points. However, the sets $\operatorname{Cr}_d({\bf k})_{\leq n}$, while being closed, can not be given in any reasonable way the structure of an algebraic variety. This is part of the obstruction that $\operatorname{Cr}_d({\bf k})$ can not be equipped with the structure of an ind-variety when endowed with the Zariski topology \cite[Theorem 2]{BlancFurter}.

Let $G$ be an algebraic group and $G\to\operatorname{Cr}_d({\bf k})$ a morphism which is also a group homomorphism from the group $G({\bf k})$ of ${\bf k}$-points of $G$ to $\operatorname{Cr}_d({\bf k})$. The image is called an {\it algebraic subgroup }of $\operatorname{Cr}_d({\bf k})$. A subgroup of $\operatorname{Cr}_d({\bf k})$ is an algebraic subgroup if and only if it Zariski closed and of bounded degree \cite[Corollary 2.18, Lemma 2.19]{BlancFurter}.

Note that ${\bf k}$-morphisms of varieties into $\operatorname{Cr}_d({\bf k})$ induce Zariski continuous maps from the ${\bf k}$-points to $\operatorname{Cr}_d({\bf k})$ by definition. Their image is of bounded degree, more generally, we have:

\begin{lemma}\label{lem:bounded_degree}
Let $A$ be an algebraic variety over  a field ${\bf k}$ and $\varphi\colon A\to\operatorname{Cr}_d({\bf k})$ a Zariski continuous map. Then $\varphi(A({\bf k}))$ is of bounded degree.
\end{lemma}
\begin{proof}
Assume, for a contradiction, that $\varphi(A({\bf k}))$ is of unbounded degree. Then there exists an infinite sequence of elements $\{f_n\}_{n\in\operatorname{\mathbb{Z}}_{>0}}\subset\varphi(A({\bf k}))$ such that all the $f_i$ are of different degree. This implies that the induced topology on  $\{f_n\}_{n\in\operatorname{\mathbb{Z}}_{>0}}$ is discrete and so in particular not noetherian. But this yields that the induced topology on $\varphi^{-1}(\{f_n\}_{n\in\operatorname{\mathbb{Z}}_{>0}})$ is not noetherian, which is a contradiction, since a subspace of a noetherian space is noetherian.
\end{proof}

\subsection{The Euclidean topology}\label{sec:Euclidean}
We now introduce the Euclidean topology on $\operatorname{Cr}_n({\bf k})$ as defined in \cite[\S 5]{BlancFurter}.

Let ${\bf k}[x_0,\dots,x_d]_n$ be the ${\bf k}$-vector space of homogeneous polynomials of degree $n$ and consider the projectivisation $W_n({\bf k})=\operatorname{\mathbb{P}}(({\bf k}[x_0,\dots,x_d]_n)^{d+1})$, which is the set of ${\bf k}$-rational points of a projective space $W_n$ of dimension $r=(d+1){d+n \choose d} -1$.
An element $h=[h_0:\dots:h_d]\in W_n({\bf k})$ induces the rational map of $\operatorname{\mathbb{P}}_{\bf k}^d$ given by $\psi_h\colon [x_0:\dots:x_d]\mapstochar\dashrightarrow[h_0(x_0,\dots,x_d):\dots:h_d(x_0,\dots,x_d)]$, and
the set $H_n({\bf k})\subset W_n({\bf k})$ of elements inducing a birational map of $\operatorname{\mathbb{P}}_{\bf k}^d$ is locally closed in $W_n({\bf k})$. There exists a locally closed subvariety  $H_n\subset W_n$ such that $H_n({\bf k})$ is exactly the set of ${\bf k}$-points of $H_n$  \cite[Lemma~2.4(2)]{BlancFurter}.
The map $\pi_n\colon H_n({\bf k})\to\operatorname{Cr}_d({\bf k})_{\leq n}$, $h\mapsto \psi_h$ corresponds to a morphism $H_n\to\operatorname{Cr}_d({\bf k})$. It is surjective, continuous and closed with respect to the Zariski topology, and is thus a topological quotient \cite[Corollary 2.9]{BlancFurter}.  It turns out that the Zariski topology on $\operatorname{Cr}_d({\bf k})$ is the inductive limit topology given by the closed sets $\operatorname{Cr}_d({\bf k})_{\leq d}$ endowed with the quotient topology \cite[Proposition~2.20]{BlancFurter}.

\begin{definition}
If ${\bf k}$ is a local field, we endow the $W_n({\bf k})$ and $H_n({\bf k})$ with the Euclidean topology and define the {\it Euclidean topology} on $\operatorname{Cr}_d({\bf k})$ to be the inductive limit topology given by the $\operatorname{Cr}_d({\bf k})_{\leq n}$ endowed with the quotient topology $\pi_n\colon H_n({\bf k})\to\operatorname{Cr}_d({\bf k})_{\leq n}$.
\end{definition}

Endowed with the Euclidean topology, $\operatorname{Cr}_d({\bf k})$ is a Hausdorff topological group which is not metrisable, and any compact subset is of bounded degree \cite[Theorem~3, Lemma 5.16, Lemma 5.13]{BlancFurter}. By definition, the Euclidean topology is finer than the Zariski topology and we have the following property:

\begin{lemma}[{\cite[Lemma 2.11]{Blanc:2015ab}}]\label{lem:morph_eucl_cont}
Let $A$ be an algebraic variety over a local field ${\bf k}$ and $\rho\colon A\to \operatorname{Cr}_d({\bf k})$ a ${\bf k}$-morphism. Then the corresponding map $A({\bf k})\to\operatorname{Cr}_d({\bf k})$ is Euclidean continuous.
\end{lemma}

\section{A homomorphism of $\operatorname{Cr}_d({\bf k})$ is determined by its restriction to $\operatorname{Aut}(\operatorname{\mathbb{P}}^n_{\bf k})$}

In this section, we show that for infinite fields a surjective Zariski or Euclidean continuous homomorphism of $\operatorname{Cr}_d({\bf k})$ is determined by its restriction to $\operatorname{Aut}(\operatorname{\mathbb{P}}^d_{\bf k})$. The main ingredients for this result are continuous deformations of arbitrary Cremona transformations to linear maps. Consider the following example:

\begin{example}\label{ex:deformation}
Let ${\bf k}$ be a field and pick $f\in\operatorname{Cr}_d({\bf k})$ of degree $e$.
With respect to affine coordinates on the chart $x_0\neq0$ we can write
\[
f\colon(x_1,\dots,x_d)
\dashrightarrow
\left(F_1,\dots, F_d\right),
\]
where \[
F_i=\frac{P_{i0}+P_{i1}(x)+\cdots+P_{ie}(x)}{Q_{i0}+Q_{i1}(x)+\cdots+Q_{ie}(x)},
\]
for some homogeneous $P_{ij},Q_{ij}\in{\bf k}[x_1,\dots,x_d]$ of degree $j$.

For $t\in{\bf k}\setminus\{0\}$, we define $\beta_t\in\operatorname{Aut}(\operatorname{\mathbb{P}}^d_{\bf k})$  by
\[
\beta_t\colon(x_1,\dots,x_n)\mapsto (tx_1,\dots,tx_d).
\]
The map $t\mapsto\beta_t^{-1} f\beta_t$ defines a ${\bf k}$-morphism $\rho\colon\operatorname{\mathbb{A}}_{\bf k}^1\setminus\{0\}\to\operatorname{Cr}_d({\bf k})$ whose image consists of conjugates of $f$ by linear maps.
\end{example}

\begin{lemma}\label{lem:deformation_exists}
Let ${\bf k}$ be an infinite field.
The ${\bf k}$-morphism $\rho\colon\operatorname{\mathbb{A}}_{\bf k}^1\setminus\{0\}\to\operatorname{Cr}_d({\bf k})$ from Example~\ref{ex:deformation} extends to a Zariski continuous map $\hat{\rho}\colon\operatorname{\mathbb{A}}_{\bf k}^1({\bf k})\to\operatorname{Cr}_d({\bf k})$ with $\hat{\rho}_0\in\operatorname{Aut}(\operatorname{\mathbb{P}}^n_{\bf k})$ if and only if $f$ is a local isomorphism at the point $p=[1:0:\cdots:0]$ and $f(p)=p$.

The same statement holds if ${\bf k}$ a local field and if we consider the Euclidean instead of the Zariski topology.
\end{lemma}

\begin{proof}
With respect to affine coordinates $x=(x_1,\dots, x_d)$ on the chart $x_0\neq0$ we can write
\[
\rho_t(x)=\beta_t^{-1} f\beta_t(x_1,\dots,x_d)=\left(F^t_1,\dots, F^t_d\right),
\]
where
\[
F_i^t=\frac{t^{-1}P_{i0}+P_{i1}(x)+tP_{i2}(x)+\cdots t^{e-1}P_{ie}(x)}{Q_{i0}+tQ_{i1}(x)+\cdots t^eQ_{ie}(x)}.
\]

First, suppose that $f$ fixes $p=[1:0:\cdots:0]$ and is a local isomorphism at $p$. Then $P_{i0}=0$ and $Q_{i0}\neq0$ for $i=1,\dots,d$ and hence $\rho_0$ corresponds to the derivative (the linear part) of $f$ at $[1:0:\cdots:0]$. Thus $\rho$ extends to a ${\bf k}$-morphism $\hat{\rho}\colon\operatorname{\mathbb{A}}^1\to\operatorname{Cr}_d$ with $\hat{\rho}_0\in\operatorname{Aut}(\operatorname{\mathbb{P}}^d_{\bf k})$, which is in particular Zariski continuous. If ${\bf k}$ is a local field then $\hat{\rho}$ is Euclidean continuous by Lemma~\ref{lem:morph_eucl_cont}.

Now, suppose that $\rho$ extends according to our hypothesis and $\hat{\rho}_0\in\operatorname{Aut}(\operatorname{\mathbb{P}}^d_{\bf k})$. In particular, the limit of $F_i^t$ for $t\to 0$ is a rational map for all $i=1,\dots,d$, which implies that $P_{i0}=0$ and $Q_{i0}\neq0$.
Hence $f$ fixes $[1:0:\cdots:0]$, and $\hat{\rho}_0$ corresponds to the derivative of $f$ at $[1:0:\cdots:0]$, so $f$ is a local isomorphism at $p$.
\end{proof}

\begin{proposition}\label{pro:determined_by_aut}
Let ${\bf k}$ be an infinite field and $\varphi\colon\operatorname{Cr}_d({\bf k})\to\operatorname{Cr}_d({\bf k})$ a group homomorphism which is Zariski continuous. If $\varphi|_{\operatorname{Aut}(\operatorname{\mathbb{P}}^d_{\bf k})}=\operatorname{id}_{\operatorname{Aut}(\operatorname{\mathbb{P}}^d_{\bf k})}$, then $\varphi=\operatorname{id}_{\operatorname{Cr}_d({\bf k})}$.

The same statement holds for any local field ${\bf k}$ and $\varphi$ Euclidean continuous.
\end{proposition}

\begin{proof}
Let $f\in\operatorname{Cr}_d({\bf k})$ and $p\in\operatorname{\mathbb{P}}^d_{{\bf k}}({\bf k})$ any point such that both $f$ and $\varphi(f)$ are local isomorphisms at $p$. We will prove that  $\varphi(f)(p)=f(p)$ or $\varphi(f)(p)=p$, which implies that $\varphi(f)=f$ or $\varphi(\operatorname{id})$, since ${\bf k}$ is infinite. From this we will then deduce the claim.

We denote $q:=f(p)\in\operatorname{\mathbb{P}}^d_{{\bf k}}({\bf k})$. There exists an automorphism $\alpha\in\operatorname{Aut}(\operatorname{\mathbb{P}}^d_{\bf k})$ whose only fixed points in $\operatorname{\mathbb{P}}^d_{{\bf k}}({\bf k})$ are $p$ and $q$.
Let us observe that the birational transformation $\alpha^{-1}f^{-1}\alpha f$ fixes $p$ and is a local isomorphism at $p$.
Denote by $\rho\colon\operatorname{\mathbb{A}}_{\bf k}^1\setminus\{0\}\to\operatorname{Cr}_d({\bf k})$ the morphism defined in Example~\ref{ex:deformation} with respect to the map $\alpha^{-1}f^{-1}\alpha f$, i.e. $\rho_t=\beta_t^{-1}( \alpha^{-1}f^{-1}\alpha f)\beta_t$.
By Lemma~\ref{lem:deformation_exists}, $\rho$ extends to a morphism $\hat{\rho}\colon\operatorname{\mathbb{A}}^1\to\operatorname{Cr}_d({\bf k})$ and $\hat{\rho}_0$ is the derivative of $(\alpha^{-1}f^{-1}\alpha f)$ at $p$.
Lemma~\ref{lem:morph_eucl_cont} yields that the corresponding map $\operatorname{\mathbb{A}}_{\bf k}^1({\bf k})\to\operatorname{Cr}_d({\bf k})$ is also Euclidean continuous.

Since $\varphi$ is Zariski (respectively Euclidean) continuous, the map $\varphi\circ\hat{\rho}\colon\operatorname{\mathbb{A}}^1({\bf k})\to\operatorname{Cr}_d({\bf k})$ is also Zariski (respectively Euclidean) continuous. By hypothesis, the restriction of $\varphi$ to $\operatorname{Aut}(\operatorname{\mathbb{P}}^d_{\bf k})$ is the identity, and so
\begin{align*}
&\varphi(\rho_t)=\beta_t^{-1} \varphi(\alpha^{-1}f^{-1}\alpha f)\beta_t=\beta_t^{-1} \alpha^{-1}\varphi(f)^{-1}\alpha\varphi(f)\beta_t,\quad t\neq0\\
&\varphi(\hat{\rho}_0)=\hat{\rho}_0 \in\operatorname{Aut}(\operatorname{\mathbb{P}}^d_{\bf k})
\end{align*}
Lemma~\ref{lem:deformation_exists} implies that the map $(\alpha^{-1}\varphi(f)^{-1}\alpha\varphi(f))$ fixes $p$ and is a local isomorphism at $p$. In particular, since $\varphi(f)$ is a local isomorphism at $p$, we have
\[\alpha(\varphi(f)(p))=\varphi(f)(\alpha(p))=\varphi(f)(p).\]
By hypothesis, $p$ and $q=f(p)$ are the only fixed points of $\alpha$, hence
\[\varphi(f)(p)=p\quad\text{or}\quad\varphi(f)(p)=f(p).\]
This holds for any $p$ in an open dense subset of $\operatorname{\mathbb{P}}^d_{{\bf k}}({\bf k})$.
As ${\bf k}$ is infinite, $\varphi(f)$ coincides thus with $\operatorname{id}_{\operatorname{\mathbb{P}}^d_{\bf k}}$ or with $f$. This holds for any $f\in\operatorname{Cr}_d({\bf k})$, so in particular for $\gamma f$, for any non-trivial $\gamma\in\operatorname{Aut}(\operatorname{\mathbb{P}}^d_{\bf k})$.
Suppose that $\varphi(f)=\operatorname{id}$. Then $\operatorname{id}\neq\gamma=\varphi(\gamma)=\varphi(\gamma f)$. Since we have by  the same argument again that either $\varphi(\gamma f)=\gamma f$ or $\varphi(\gamma f)=\operatorname{id}$, we obtain that  $\varphi(\gamma f)=\gamma f$, which implies $f=\operatorname{id}$.
It follows that $\varphi(f)=f$ for any $f\in\operatorname{Cr}_d({\bf k})$.
\end{proof}

We can repeat the proof of Proposition~\ref{pro:determined_by_aut} word by word by considering $\operatorname{Aut}(\operatorname{\mathbb{A}}^d_{\bf k})$ instead of $\operatorname{Cr}_d({\bf k})$ and its subgroup $\operatorname{Aff}_d({\bf k})$ instead of $\operatorname{PGL}_{d+1}({\bf k})$. This way, we obtain the following statement:

\begin{proposition}\label{pro:determined_by_aff}
Let ${\bf k}$ be an infinite field and $\varphi\colon\operatorname{Aut}(\operatorname{\mathbb{A}}^d_{\bf k})\to\operatorname{Aut}(\operatorname{\mathbb{A}}^d_{\bf k})$ a surjective homomorphism which is  Zariski continuous. If $\varphi|_{\operatorname{Aff}_d({\bf k})}=\operatorname{id}_{\operatorname{Aff}_d({\bf k})}$, then $\varphi=\operatorname{id}_{\operatorname{Aut}(\operatorname{\mathbb{A}}^d_{\bf k})}$.
\end{proposition}

\section{Proofs of the main theorems}

Group automorphisms of classical groups are well-understood. In \cite{MR0310083} J. Dieu\-donn\'e gives a complete classification in the case of fields,
and we need the classification of group automorphisms of $\operatorname{PGL}_{d+1}({\bf k})$.

\begin{theorem}[{\cite[IV.\S1.I--III, p.85--89 and IV.\S6, p.98]{MR0310083}}]\label{thm:dieudonne}
Let $d\geq1$ and ${\bf k}$ a field.
Let $G$ be $\operatorname{PGL}_{d+1}({\bf k})$ or $\operatorname{GL}_{d+1}({\bf k})$.
For any group automorphism $\varphi\colon G\to G$ there exists an element $h\in G$ and a field automorphism $\alpha$ of ${\bf k}$ such that $\varphi$ is of the form
\[\varphi(g)=h({}^{\alpha}\!g^{\vee})h^{-1}\quad\text{or}\quad \varphi(g)= h({}^{\alpha}\!g)h^{-1}\]
where $g^{\vee}={}^t(g^{-1})$ is the inverse of the transpose of $g$.
\end{theorem}

Not all automorphisms of $\operatorname{PGL}_{d+1}({\bf k})$ can be extended to an automorphism of the Cremona group:

\begin{lemma}\cite[Corollary A.12]{longversion}
\label{lem:extension}
For any field ${\bf k}$,
	the automorphism of $\operatorname{PGL}_{d+1}({\bf k})$ given by $g\mapsto {}^\alpha\!g^\vee$ does not extend to an automorphism of $\operatorname{Cr}_d({\bf k})$.
\end{lemma}

\begin{theorem}[{\cite[Theorem A, Corollary 8.5]{cantat2014algebraic}}]\label{thm:cantatxie}
	Let $d\geq 1$ and $\Gamma\subset\operatorname{SL}_{d+1}(\operatorname{\mathbb{Z}})$ a finite index subgroup. Let $X_{\operatorname{\mathbb{C}}}$ be an irreducible complex quasi-projective variety of dimension $\dim(X)=n$.
	\begin{enumerate}
		\item If there is an injective group homomorphism  $\varphi\colon\Gamma\to \operatorname{Aut}(X_{\operatorname{\mathbb{C}}})$, then \hbox{$n\geq d$.} \\
		If $n=d$ then there is an isomorphism $f\colon X_{\operatorname{\mathbb{C}}}\to \operatorname{\mathbb{P}}^{d}_{\operatorname{\mathbb{C}}}$ such that $f\varphi(\Gamma) f^{-1}\subset\operatorname{Aut}(\operatorname{\mathbb{P}}^d_{\operatorname{\mathbb{C}}})$.

		\item If there is an injective group homomorphism  $\psi\colon\Gamma\to \operatorname{Bir}(X_{\operatorname{\mathbb{C}}})$, then $n\geq d$. \\
		If $n=d$ then there is a birational transformation $f\colon X_{\operatorname{\mathbb{C}}}\dashrightarrow \operatorname{\mathbb{P}}^d_{\operatorname{\mathbb{C}}}$ such that $f\varphi(\Gamma) f^{-1}\subset\operatorname{Aut}(\operatorname{\mathbb{P}}^d_{\operatorname{\mathbb{C}}})$.
	\end{enumerate}
\end{theorem}

Let $p$ be an odd prime. We denote by $\Gamma_p\subset\operatorname{SL}_{d+1}(\operatorname{\mathbb{Z}})$ the congruence subgroup mod $p$, i.e. the kernel of the homomorphism $\rho\colon\operatorname{SL}_{d+1}(\operatorname{\mathbb{Z}})\to\operatorname{SL}_{d+1}(\operatorname{\mathbb{F}}_p)$ given by reduction modulo $p$. Since $p$ is odd by assumption, $\Gamma_p$ intersects the center of $\operatorname{SL}_{d+1}(\operatorname{\mathbb{Z}})$ only in the identity and hence, the restriction of the quotient homomorphism $\operatorname{GL}_{d+1}({\bf k})\to\operatorname{PGL}_{d+1}({\bf k})$ to $\Gamma_p$ is injective and we can consider $\Gamma_p$ as a subgroup of $\operatorname{PGL}_{d+1}({\bf k})$. We can now apply Theorem~\ref{thm:cantatxie} to $\Gamma_p$ and obtain the following:
\vskip\baselineskip

\begin{corollary}\label{cor:cantatxie}
Let $d\geq2$, ${\bf k}$ a field of characteristic $0$ and $\varphi\colon\Gamma_p\to\operatorname{Cr}_d({\bf k})$ an injective group homomorphism. Then the degree of the elements $\varphi(\Gamma_p)$ is bounded.
\end{corollary}

\begin{proof}
	Let $F\subset{\bf k}$ be the smallest subfield over which $\varphi(\Gamma_p)$ is defined.  We can consider $\varphi(G)$ as a subgroup of $\operatorname{Cr}_d(F)\subset\operatorname{Cr}_d({\bf k})$. Since $\Gamma_p$ is finitely generated, $F$ is a finitely generated extension of $\operatorname{\mathbb{Q}}$ and as such embeds into $\operatorname{\mathbb{C}}$ and we may consider $\varphi(G)$ as a subgroup of $\operatorname{Cr}_d(F)\subset\operatorname{Cr}_d(\operatorname{\mathbb{C}})$. By Theorem~\ref{thm:cantatxie}, $\varphi(G)$ is conjugate in $\operatorname{Cr}_d(\operatorname{\mathbb{C}})$ to a subgroup of $\operatorname{Aut}(\operatorname{\mathbb{P}}^d_{\operatorname{\mathbb{C}}})$. In particular, $\varphi(\Gamma_p)$ is of bounded degree.
\end{proof}

Now, we study continuous embeddings of $\operatorname{PGL}_{d+1}({\bf k})$ into $\operatorname{Cr}_d({\bf k})$.

\begin{lemma}\label{lem:PSL}
	Let  ${\bf k}$ be either the field of real numbers ${\operatorname{\mathbb{R}}}$ or the field of complex numbers $\operatorname{\mathbb{C}}$ and $d\geq 1$.  Let $\varphi\colon\operatorname{PSL}_{d+1}({\bf k})\to\operatorname{Cr}_d({\bf k})$ be an injective group homomorphism that is Euclidean continuous. Then there exists an element $f\in\operatorname{Cr}_d({\bf k})$ such that the group $f\varphi(\operatorname{PSL}_{d+1}({\bf k}))f^{-1}$ is contained in $\operatorname{Aut}(\operatorname{\mathbb{P}}^d_{{\bf k}})$.
\end{lemma}

\begin{proof}
	The statement is trivial for $d=1$, hence we can assume that $d\geq2$.

	Let $p$ be an odd prime and $\Gamma_p\subset\operatorname{SL}_{d+1}(\operatorname{\mathbb{Z}})$ the congruence subgroup mod $p$. We consider $\Gamma_p$ as a subgroup of $\operatorname{PGL}_{d+1}({\bf k})$. In particular, $\Gamma_p$ contains the subgroup of elements of the form
	\[[x_0:\dots:x_d]\mapsto[x_0+kpx_1:x_1:\dots: x_d], \quad k\in\operatorname{\mathbb{Z}}.\]

	For $i,j=0,\dots,d$, $i\neq j$, define the elementary subgroups
	\[
	U_{ij}:=\left\{[x_0:\dots:x_d]\mapsto[x_0:\dots:x_i+cx_j:x_{i+1}:\dots: x_d]\mid c\in{\bf k}\right\}\subset\operatorname{PGL}_{d+1}({\bf k}).
	\]

	Consider the Euclidean compact subset
	$$E_{01}:=\{[x_0:\dots:x_d]\mapsto[x_0+cx_1:x_1:\dots: x_d]\mid ||c||\leq p\}\subset\operatorname{PGL}_{d+1}({\bf k})$$ where $||\cdot||$ denotes the Euclidean norm on ${\bf k}$. Every element in the subgroup $U_{01}$ can be written as a product of an element in $\Gamma_p$ and an element in $E_{01}$.
	Since $E_{01}$ is compact, $\varphi(E_{01})$ is of bounded degree \cite[Lemma 5.13]{BlancFurter}.
	By Corollary~\ref{cor:cantatxie}, the image $\varphi(\Gamma_p)$ is of bounded degree as well and we conclude that $\varphi(U_{00})$ is of bounded degree. Since all the elementary subgroups $U_{ij}$ are conjugate to $U_{00}$ in $\operatorname{PGL}_{d+1}({\bf k})$ it follows that $\varphi(U_{ij})$ is of bounded degree for any $i,j$.

	Using the Gauss-Algorithm one can see that there exists an integer $K\geq1$ only depending on $d$ such that every element in $\operatorname{PSL}_{d+1}({\bf k})$ can be written as the product of at most $K$ elements contained in some the subgroups $U_{ij}$. Therefore, $\varphi(\operatorname{PSL}_{d+1}({\bf k}))$ is of bounded degree and hence is regularisable, i.e. there exists a quasi-projective ${\bf k}$-variety $X_{{\bf k}}$ and a birational transformation $ \operatorname{\mathbb{P}}^d_{{\bf k}}\dashrightarrow X_{{\bf k}}$ that conjugates $\varphi(\operatorname{PSL}_{d+1}({\bf k}))$ to a subgroup of $\operatorname{Aut}(X_{{\bf k}})$ \cite[Theorem 1]{Rosenlicht}\footnote{\label{note} In fact, we apply \cite[Theorem 1]{Rosenlicht} to the Zariski closure of $\varphi(\operatorname{PSL}_{d+1}({\bf k}))$ in $\operatorname{Cr}_d({\bf k})$, which is an algebraic subgroup of $\operatorname{Cr}_d({\bf k})$.}.
	By Theorem~\ref{thm:cantatxie}, we have $X_{\operatorname{\mathbb{C}}}\simeq\operatorname{\mathbb{P}}^d_{\operatorname{\mathbb{C}}}$ and
	hence, by Ch\^atelet's theorem, $X_{{\bf k}}\simeq \operatorname{\mathbb{P}}^d_{{\bf k}}$ \cite[§IV.I, p.283]{chatelet}.
\end{proof}

\begin{proposition}\label{prop:emb_PGL}
	Let ${\bf k}$ be a field of characteristic $0$ and let $\varphi\colon \operatorname{PGL}_{d+1}({\bf k})\to\operatorname{Cr}_d({\bf k})$ be an injective group homomorphism.
	 If either $\varphi$ is Zariski continuous, or  if ${\bf k}={\operatorname{\mathbb{R}}}$ or ${\bf k}=\operatorname{\mathbb{C}}$ and $\varphi$ is Euclidean continuous,
	then $\varphi(\operatorname{PGL}_{d+1}({\bf k}))$ is conjugate in $\operatorname{Cr}_d({\bf k})$ to a subgroup of $\operatorname{Aut}(\operatorname{\mathbb{P}}^d_{{\bf k}})$.
\end{proposition}

\begin{proof}
	If $\varphi$ is Zariski continuous, then $\varphi(\operatorname{PGL}_{d+1}({\bf k}))$  is of bounded degree by Lemma~\ref{lem:bounded_degree}.
	If ${\bf k}={\operatorname{\mathbb{R}}}$ or ${\bf k}=\operatorname{\mathbb{C}}$ and $\varphi$ is Euclidean continuous,  then Lemma~\ref{lem:PSL} implies that $\varphi(\operatorname{PSL}_{d+1}({\bf k}))$ has bounded degree in $\operatorname{Cr}_d({\bf k})$. Since $\operatorname{PSL}_{d+1}({\bf k})$ has finite index in $\operatorname{PGL}_{d+1}({\bf k})$, hence also $\varphi(\operatorname{PGL}_{d+1}({\bf k}))$ is of bounded degree.

	In either case there exists a quasi-projective ${\bf k}$-variety $X_{{\bf k}}$ and a birational map $\operatorname{\mathbb{P}}^d_{{\bf k}}\dashrightarrow X_{\bf k}$ which conjugates $\varphi(\operatorname{PGL}_{d+1}({\bf k}))$ to a subgroup of $\operatorname{Aut}(X_{{\bf k}})$ \cite[Theorem 1]{Rosenlicht}\footref{note}.
	By Theorem~\ref{thm:cantatxie}, $X_{\overline{{\bf k}}}\simeq\operatorname{\mathbb{P}}^d_{\overline{{\bf k}}}$, where $\overline{{\bf k}}$ is the algebraic closure of ${\bf k}$, and hence, by Ch\^atelet's theorem, $X_{{\bf k}}\simeq\operatorname{\mathbb{P}}^d_{{\bf k}}$ \cite[§IV.I, p.283]{chatelet}.
\end{proof}

\begin{proof}[Proof of Theorem~\ref{main:cremona} and Theorem~\ref{main:euclidean}]
The group automorphism  $\varphi\colon\operatorname{Cr}_d({\bf k})\to\operatorname{Cr}_d({\bf k})$ induces an injective group  homomorphism $\varphi|_{\operatorname{Aut}(\operatorname{\mathbb{P}}^d_{{\bf k}})}\colon \operatorname{Aut}(\operatorname{\mathbb{P}}^d_{{\bf k}})\hookrightarrow\operatorname{Cr}_d({\bf k})$.
	Since $\varphi$ is continuous, Proposition~\ref{prop:emb_PGL} implies that up to conjugation in $\operatorname{Cr}_d({\bf k})$, we may assume that $\varphi(\operatorname{Aut}(\operatorname{\mathbb{P}}^d_{{\bf k}}))\subset\operatorname{Aut}(\operatorname{\mathbb{P}}^d_{{\bf k}})$.
	As by assumption $\varphi^{-1}$ is a continuous group homomorphism as well, we argue analogously that there exists $f\in\operatorname{Cr}_d({\bf k})$ such that $f\varphi^{-1}(\operatorname{Aut}(\operatorname{\mathbb{P}}^d_{{\bf k}}))f^{-1}\subset\operatorname{Aut}(\operatorname{\mathbb{P}}^d_{{\bf k}})$.
	In particular, we have $f\operatorname{Aut}(\operatorname{\mathbb{P}}^d_{{\bf k}})f^{-1}\subset\operatorname{Aut}(\operatorname{\mathbb{P}}^d_{{\bf k}})$ and so
	 $f$ normalizes $\operatorname{Aut}(\operatorname{\mathbb{P}}^d_{{\bf k}})$ and hence $f\in\operatorname{Aut}(\operatorname{\mathbb{P}}^d_{{\bf k}})$, i.e. $\varphi^{-1}(\operatorname{Aut}(\operatorname{\mathbb{P}}^d_{{\bf k}}))=\operatorname{Aut}(\operatorname{\mathbb{P}}^d_{{\bf k}})$.
	With Theorem~\ref{thm:dieudonne} and Lemma~\ref{lem:extension} we conclude that, up to conjuation in $\operatorname{Aut}(\operatorname{\mathbb{P}}^d_{{\bf k}})$ and up to a field automorphism of ${\bf k}$, we have $\varphi|_{\operatorname{Aut}(\operatorname{\mathbb{P}}^d_{{\bf k}})}=\operatorname{id}_{\operatorname{Aut}(\operatorname{\mathbb{P}}^d_{{\bf k}})}$.
	Since $\varphi$ is continuous, Proposition~\ref{pro:determined_by_aut} implies that $\varphi=\operatorname{id}_{\operatorname{Cr}_d({\bf k})}$, which yields the claim.

\end{proof}

\section{Polynomial automorphisms}\label{sec:poly}
Denote by $\operatorname{Aut}(\operatorname{\mathbb{A}}_{\bf k}^d)$ the {\it group of polynomial automorphisms} of the affine $d$-space $\operatorname{\mathbb{A}}_{\bf k}^d$ over a field ${\bf k}$. The goal of this section is to prove Theorem~\ref{main:aut}. If we choose an embedding of $\operatorname{\mathbb{A}}_{\bf k}^d$ into $\operatorname{\mathbb{P}}_{\bf k}^d$, we can naturally consider $\operatorname{Aut}(\operatorname{\mathbb{A}}_{\bf k}^d)$ as a subgroup of $\operatorname{Cr}_d({\bf k})$.  The {\it Zariski topology on $\operatorname{Aut}(\operatorname{\mathbb{A}}_{\bf k}^d)$} is the induced topology of the Zariski topology on $\operatorname{Cr}_d({\bf k})$.

It can be shown that if ${\bf k}$ is algebraically closed, then $\operatorname{Aut}(\operatorname{\mathbb{A}}_{\bf k}^d)$ can be naturally equipped with the additional structure of a so-called {\it ind-group}, which induces the {\it ind-topology} on $\operatorname{Aut}(\operatorname{\mathbb{A}}_{\bf k}^d)$. We refer to \cite{furterkraft} for a definition and details about this notion. We will only need that an ind-closed subgroup of bounded degree of $\operatorname{Aut}(\operatorname{\mathbb{A}}_{\bf k}^d)$ has the structure of an affine algebraic group such that the induced action on $\operatorname{\mathbb{A}}_{\bf k}^d$ is algebraic \cite[Proposition~3.7]{stampfli2013contributions}.

Denote by $T_d({\bf k})\subset\operatorname{Aut}(\operatorname{\mathbb{A}}^d_{\bf k})$ the diagonal linear transformations.
Let ${\overline{\bf{k}}}$ be the algebraic closure of a field ${\bf k}$. In what follows, we always consider $\operatorname{Aut}(\operatorname{\mathbb{A}}_{\bf k}^d)$ as a subgroup of $\operatorname{Aut}(\operatorname{\mathbb{A}}^d_{\overline{\bf{k}}})$ through the obvious inclusion.

\begin{lemma}
\label{lem:torus}
Let ${\bf k}$ be an infinite field and $\varphi\colon\operatorname{Aut}(\operatorname{\mathbb{A}}^d_{{\bf k}})\to\operatorname{Aut}(\operatorname{\mathbb{A}}^d_{{\bf k}})$ a group automorphism that is a homeomorphism with respect to the Zariski topology.
Then there exists $f\in\operatorname{Aut}(\operatorname{\mathbb{A}}^d_{{\overline{\bf{k}}}})$ such that $f\varphi(T_d({\bf k}))f^{-1}\subset T_d({\overline{\bf{k}}})$ is a dense subgroup.
\end{lemma}

\begin{proof}
	Let $D_{{\overline{\bf{k}}}}$ be the  closure  of $\varphi(T_d({\bf k}))$ in $\operatorname{Aut}(\operatorname{\mathbb{A}}^d_{{\overline{\bf{k}}}})$ with respect to the ind-topology. Since $\varphi(T_d({\bf k}))$ and hence  $D_{{\overline{\bf{k}}}}$ are of bounded degree, we obtain that $D_{{\overline{\bf{k}}}}$ is an affine algebraic group acting algebraically on $\operatorname{\mathbb{A}}^d_{\overline{\bf{k}}}$. By the structure theorem for commutative affine algebraic groups over algebraically closed fields (see \cite[Théorème~XVII.7.2.1]{MR0274459}), $D_{{\overline{\bf{k}}}}$ is isomorphic over ${\overline{\bf{k}}}$ to $T_r({\overline{\bf{k}}})\times U_s({\overline{\bf{k}}})$, where $T_r$ is a split torus of dimension $r\geq0$ and $U_s$ a unipotent group of dimension $s\geq0$.

	First, suppose that $\operatorname{char}({\bf k})\neq 2$.
	The image $\varphi(T_d({\bf k}))$ contains $2^d$ elements of order two, hence  $D_{{\overline{\bf{k}}}}$ contains at least $2^d$ elements of order two, and it follows that $r\geq d$.
	Thus $D_{{\overline{\bf{k}}}}$ contains a maximal torus in $\operatorname{Aut}(\operatorname{\mathbb{A}}_{{\overline{\bf{k}}}}^d)$ and as such coincides with its centraliser. So we obtain that $s=0$.

	Now, if $\operatorname{char}({\bf k})=2$, as $\varphi$ is a homeomorphism with respect to the Zariski topology by hypothesis, and since $T_d({\bf k})^2$ is Zariski dense in $T_d({\bf k})$, we have that $\varphi(T_d({\bf k}))^2$ is dense in $\varphi(T_d({\bf k}))$ and hence in $\overline{\varphi(T_d({\bf k}))}$. This implies in particular that $\overline{\varphi(T_d({\bf k}))}^2$ is dense in $\overline{\varphi(T_d({\bf k}))}$, i.e. $(D_{\overline{\bf{k}}})^2$ is dense in $D_{\overline{\bf{k}}}$.
	Now, at the same time, $\operatorname{char}({\bf k})=2$ implies that $(D_{{\overline{\bf{k}}}})^2\simeq T_r({\overline{\bf{k}}})$, and we obtain  $s=0$. Since $\varphi$ is a homeomorphism, it preserves the Krull dimension, therefore $\varphi(T_d({\bf k}))$ and hence also $D_{{\overline{\bf{k}}}}$ has Krull dimension $d$, it follows also that $d=r$.

	So we have that $D_{{\overline{\bf{k}}}}$ is a torus of rank $d$. From
	\cite[Theorem 2]{MR0200279} it follows that $D_{{\overline{\bf{k}}}}$ is conjugate in $\operatorname{Aut}(\operatorname{\mathbb{A}}_{{\overline{\bf{k}}}}^d)$ to the standard torus $T_d({\overline{\bf{k}}})$ in $\operatorname{Aut}(\operatorname{\mathbb{A}}_{{\overline{\bf{k}}}}^d)$. In particular, there exists an element $f\in\operatorname{Aut}(\operatorname{\mathbb{A}}_{{\overline{\bf{k}}}}^d)$ such that $f\varphi(T_d({\bf k}))f^{-1}\subset T_d({\overline{\bf{k}}})$. Since $\varphi(T_d({\bf k}))$ is dense in $D_{{\overline{\bf{k}}}}$, we obtain that $f\varphi(T_d({\bf k}))f^{-1}$ is dense in $T_d({\overline{\bf{k}}})$.
\end{proof}

Let us denote by $\operatorname{GL}_d({\bf k})\subset \operatorname{Aut}(\operatorname{\mathbb{A}}^d)$ the subgroup of linear automorphisms, by $\operatorname{Aff}_d({\bf k})$ the subgroup of affine transformations, and by $\mathcal{S}_d\subset\operatorname{GL}_d({\bf k})$ the subgroup of coordinate permutations.
For a group $G$ we denote by  $\operatorname{Center}(G)$ the center of $G$, and for a set $A\subset G$ we denote by $\cent_G(A)$  and by $\operatorname{Norm}_G(A)$ the centraliser and normaliser of $A$ in $G$, respectively.

We leave it as an exercise to the reader to verify that for an infinite field ${\bf k}$ the centralizer of $\operatorname{Center}(\operatorname{GL}_d({\bf k}))$ in $\operatorname{Aut}(\operatorname{\mathbb{A}}_{\bf k}^d)$  is $\operatorname{GL}_d({\bf k})$, that $\operatorname{Norm}_{\operatorname{Aut}(\operatorname{\mathbb{A}}^d_{\bf k})}(T_d({\bf k})) =T_d({\bf k})\rtimes \mathcal{S}_d$ and $C(T_d({\bf k})\rtimes\mathcal{S}_d))=\operatorname{Center}(\operatorname{GL}_d({\bf k}))$.

\begin{lemma}
\label{lem:GL}
Let ${\bf k}$ be an infinite field and $\varphi\colon\operatorname{Aut}(\operatorname{\mathbb{A}}^d_{{\bf k}})\to\operatorname{Aut}(\operatorname{\mathbb{A}}^d_{{\overline{\bf{k}}}})$ an injective group endomorphism. Assume that $\varphi(T_d({\bf k}))$ is contained in $T_d({\overline{\bf{k}}})$ as a dense subgroup.
Then $\varphi(\operatorname{GL}_d({\bf k}))$ is contained in $\operatorname{GL}_d({\overline{\bf{k}}})$. Moreover, this image is dense.
\end{lemma}

\begin{proof}
Since $\varphi(T_d({\bf k}))$ is dense in $T_d({\overline{\bf{k}}})$ by assumption, we have
\[
\operatorname{Norm}_{\operatorname{Aut}(\operatorname{\mathbb{A}}^d_{\overline{\bf{k}}})}(\varphi(T_d({\bf k})))=\operatorname{Norm}_{\operatorname{Aut}(\operatorname{\mathbb{A}}^d_{\overline{\bf{k}}})}(T_d({\overline{\bf{k}}}))=T_d({\overline{\bf{k}}})\rtimes\mathcal{S}_d.
\]
As the image of the normaliser is contained in the normaliser of the image, this implies that $\varphi(\mathcal{S}_d)\subset T_d({\overline{\bf{k}}})\rtimes\mathcal{S}_d$.
Consider the natural projection $\pi\colonT_d({\overline{\bf{k}}})\rtimes\mathcal{S}_d\to\mathcal{S}_d$. Its kernel is equal to $T_d({\overline{\bf{k}}})$, which is equal to $\cent_{\operatorname{Aut}(\operatorname{\mathbb{A}}^d_{\overline{\bf{k}}})}(T_d({\bf k}))$.
Then
\[
\varphi(\mathcal{S}_d)\capT_d({\overline{\bf{k}}})=\varphi(\mathcal{S}_d)\cap\cent_{\operatorname{Aut}(\operatorname{\mathbb{A}}^d_{\overline{\bf{k}}})}(T_d({\overline{\bf{k}}}))=\varphi(\mathcal{S}_d\capT_d({\overline{\bf{k}}}))=\{\operatorname{id}\}
\]
implies that up to an automorphism of $\mathcal{S}_d$ the restriction $\varphi|_{\mathcal{S}_d}$ is a section of $\pi$.
Therefore, $\cent_{T_d({\overline{\bf{k}}})\rtimes\mathcal{S}_d}(\varphi(\mathcal{S}_d))=\operatorname{Center}(\operatorname{GL}_d({\overline{\bf{k}}}))$.
It follows that
\[
\varphi(\operatorname{Center}(\operatorname{GL}_d({\bf k}))=\varphi\left(\cent_{T_d({\bf k})\rtimes\mathcal{S}_d}(\mathcal{S}_d)\right)\subset\cent_{T_d({\overline{\bf{k}}})\rtimes\mathcal{S}_d}(\varphi(\mathcal{S}_d))=\operatorname{Center}(\operatorname{GL}_d({\overline{\bf{k}}})).
\]
As ${\bf k}$ is infinite and $\varphi$ is injective, the image $\varphi(\operatorname{Center}(\operatorname{GL}_d({\bf k})))$ is dense in $\operatorname{Center}(\operatorname{GL}_d({\overline{\bf{k}}}))$.
It follows that
\begin{align*}
\varphi(\operatorname{GL}_d({\bf k}))&=\varphi\left(\cent_{\operatorname{Aut}(\operatorname{\mathbb{A}}^d_{{\bf k}})}(\operatorname{Center}(\operatorname{GL}_d({\bf k})))\right)\\
&\subseteq\cent_{\operatorname{Aut}(\operatorname{\mathbb{A}}^d_{{\overline{\bf{k}}}})}(\varphi(\operatorname{Center}(\operatorname{GL}_d({\bf k}))))\\
&=\cent_{\operatorname{Aut}(\operatorname{\mathbb{A}}^d_{{\overline{\bf{k}}}})}(\operatorname{Center}(\operatorname{GL}_d({\overline{\bf{k}}})))=\operatorname{GL}_d({\overline{\bf{k}}}).
\end{align*}
It remains to show that $\varphi(\operatorname{GL}_d({\bf k}))$ is dense in $\operatorname{GL}_d({\overline{\bf{k}}})$.
For $i,j=1,\dots,d$, $i\neq j$, we define the elementary subgroups
	\[
	U_{ij}({\overline{\bf{k}}}):=\left\{(x_1,\dots,x_d)\mapsto(x_1,\dots,x_i+cx_j,x_{i+1},\dots,x_d)\mid c\in{\overline{\bf{k}}}\right\}\subset\operatorname{GL}_d({\overline{\bf{k}}}).
	\]
	and
	\[
	U_{ij}({\overline{\bf{k}}})\ni E_{ij}\colon (x_1,\dots,x_d)\mapsto(x_1,\dots,x_i+x_j,x_{i+1},\dots,x_d)
	\]
	Observe that
	\[\{tE_{ij}t^{-1}\mid t\in\varphi(T_d({\bf k}))\}\subseteq \{tE_{ij}t^{-1}\mid t\in T_d({\overline{\bf{k}}})\}=U_{ij}({\overline{\bf{k}}}) \]
	is a dense subset which is also contained in $\varphi(\operatorname{GL}_d({\bf k}))$.
	Recall that there exists an integer $N\geq 1$ and a surjective morphism $V_1\times\dots\times V_N\to\operatorname{GL}_d({\overline{\bf{k}}})$, $(v_1,\dots,v_N)\mapsto v_1v_2\cdots v_N$, where each $V_l$ is equal to $T_d({\overline{\bf{k}}})$ or to $U_{ij}({\overline{\bf{k}}})$ for some $i,j$.
	Since $V_l':=V_l\cap\varphi(\operatorname{GL}_d({\bf k}))$ is dense in $V_l$ as remarked above, this implies that $\varphi(\operatorname{GL}_d({\bf k}))$ is dense in $\operatorname{GL}_d({\overline{\bf{k}}})$.
\end{proof}

Let $G$ be a group acting on a group $A$ by $\sigma\colon a\mapsto {}^\sigma\! a$ for $\sigma\in G, a\in A$. Recall that the first Galois cohomology $H^1(G,A)$ is defined as the set of {\it cocycles}, i.e. maps $\nu\colon G\to A$ satisfying $\nu(\sigma\tau)=\nu(\sigma)\ {}^\sigma\!\nu(\tau)$ for all $\sigma, \tau\in G$, up to the following equivalence relation: two cocycles $\nu$ and $\eta$ from $G$ to $A$ are equivalent if there exists an element $a\in A$ such that $\eta(\sigma)=a^{-1}\nu(\sigma)\ {}^\sigma\!a$ for all $\sigma\in G$.

\begin{lemma}
\label{lem:Hilbert}
	Let ${\bf k}$ be a perfect field and $\varphi\colon \operatorname{GL}_d({\bf k})\to\operatorname{Aut}(\operatorname{\mathbb{A}}^d_{\bf k})$ an injective homomorphism. Assume that there is an element $f\in\operatorname{Aut}(\operatorname{\mathbb{A}}^d_{{\overline{\bf{k}}}})$ such that $f\varphi(\operatorname{GL}_d({\bf k}))f^{-1}\subset \operatorname{GL}_d({\overline{\bf{k}}})$ as a dense subgroup, then there exists an element $g\in\operatorname{Aut}(\operatorname{\mathbb{A}}^d_{{\bf k}})$ such that $g\varphi(\operatorname{GL}_d({\bf k}))g^{-1}\subset \operatorname{GL}_d({\bf k})$.
\end{lemma}

\begin{proof}
	Let $L$ be the finite field extension such that $f$ is defined over $L$. In particular, $H=f\varphi(\operatorname{GL}_d({\bf k}))f^{-1}\subset\operatorname{GL}_d(L)\subset\operatorname{Aut}(\operatorname{\mathbb{A}}^d_L)$ as a dense subgroup. Let $\sigma\in G=\operatorname{Gal}(L/{\bf k})$ be any element of the Galois group of $L$ over ${\bf k}$. Then
	\[
	{}^\sigma\!H={}^\sigma\!(f\varphi(\operatorname{GL}_d({\bf k}))f^{-1})={}^\sigma\!f(\varphi(\operatorname{GL}_d({\bf k})){}^\sigma\! f^{-1}={}^\sigma\!ff^{-1}Hf({}^\sigma\!f)^{-1}.
	\]
	 Using that $H$ and hence also ${}^\sigma\! H$ is dense in $\operatorname{GL}_d(L)$, we may conclude that ${}^\sigma\!f f^{-1}$ normalizes $\operatorname{GL}_d(L)$ and therefore that ${}^\sigma\!f f^{-1}\in\operatorname{GL}_d(L)$. In other words, there exists an element $g_\sigma\in \operatorname{GL}_d(L)$ such that ${}^\sigma\!f =g_\sigma f$.

	We define now the map $\mu\colon G\to\operatorname{GL}_d(L)$ by $\mu(\sigma):=g_\sigma^{-1}$. It is straightforward to check that $\mu$ satisfies the cocycle condition with respect to the Galois action of $G$ on $\operatorname{GL}_d(L)$. By Hilbert 90 (see for example \cite[Lemma~1, Chapter~III.1.1]{MR1466966}) the first cohomology $H^1(G,\operatorname{GL}_d({\bf k}))$ is trivial, i.e. every cocycle is  equivalent to the cocycle that is given by mapping every element in $G$ to the identity in $\operatorname{GL}_d(L)$. In other words, there exists an element $a\in\operatorname{GL}_d(L)$ satisfying
	$a^{-1}\mu(\sigma) {}^\sigma\! a=\operatorname{id}$ for all $\sigma\in G$. Consider now the polynomial automorphism $h=a^{-1}f$. Clearly we
	have $h\varphi(\operatorname{GL}_d(L))h^{-1}\subset \operatorname{GL}_d(L)$. It remains to show that $h$ is defined over ${\bf k}$. Since ${\bf k}$ is perfect, it is equivalent to prove ${}^\sigma\! h=h$ for all $\sigma\in G$. For any $\sigma\in G$ one calculates ${}^\sigma\! h={}^\sigma\! a^{-1}{}^\sigma\! f=a^{-1}\mu(\sigma){}^\sigma\! f=a^{-1}\mu(\sigma)\mu(\sigma)^{-1} f=h$. As $h$ and $\varphi(\operatorname{GL}_d({\bf k}))$ are both defined over ${\bf k}$, the group $h\varphi(\operatorname{GL}_d({\bf k}))h^{-1}$ is defined over ${\bf k}$ as well, so $h\varphi(\operatorname{GL}_d({\bf k}))h^{-1}\subset\operatorname{GL}_d({\bf k})$.
\end{proof}

\begin{lemma}
\label{lem:GLtoGL}
	Let ${\bf k}$ be an infinite perfect field and $\varphi\colon \operatorname{Aut}(\operatorname{\mathbb{A}}^d_{\bf k})\to\operatorname{Aut}(\operatorname{\mathbb{A}}^d_{\bf k})$ a group automorphism that is a homeomorphism with respect to the Zariski topology. Then there exists an element $f\in\operatorname{Aut}(\operatorname{\mathbb{A}}^d_{\bf k})$ such that $f\varphi(\operatorname{GL}_d({\bf k}))f^{-1}=\operatorname{GL}_d({\bf k})$.
\end{lemma}

\begin{proof}
From Lemma~\ref{lem:torus}, Lemma~\ref{lem:GL} and Lemma~\ref{lem:Hilbert} we obtain that there exists $f\in\operatorname{Aut}(\operatorname{\mathbb{A}}^d_{\bf k})$ such that $f\varphi(\operatorname{GL}_d({\bf k}))f^{-1}\subseteq\operatorname{GL}_d({\bf k})$. Since, by assumption, $\varphi$ is a homeomorphism, Lemma~\ref{lem:bounded_degree} implies that $\varphi^{-1}(f^{-1}\operatorname{GL}_d({\bf k})f)$ is of bounded degree and closed, and is hence an affine algebraic group containing $\operatorname{GL}_d({\bf k})$. The Krull-dimension is preserved by a homeomorphism, thus $\operatorname{GL}_d({\bf k})=\varphi^{-1}(f^{-1}\operatorname{GL}_d({\bf k})f)$.
\end{proof}

\begin{lemma}
\label{lem:aff_id}
Let ${\bf k}$ be an infinite perfect field and $\varphi\colon \operatorname{Aut}(\operatorname{\mathbb{A}}^d_{\bf k})\to\operatorname{Aut}(\operatorname{\mathbb{A}}^d_{\bf k})$ a group automorphism and suppose that $\varphi(\operatorname{GL}_d({\bf k}))=\operatorname{GL}_d({\bf k})$.
Then $\varphi(\operatorname{Aff}_d({\bf k}))=\operatorname{Aff}_d({\bf k})$ and there exists a field automorphism $\alpha$ of ${\bf k}$ and an element $h\in\operatorname{GL}_d({\bf k})$ such that $\varphi(g)=h({}^{\alpha}\!g)h^{-1}$ for all $g\in\operatorname{Aff}_d({\bf k})$.
\end{lemma}

\begin{proof}
By Theorem~\ref{thm:dieudonne}, up to conjugation in $\operatorname{GL}_d({\bf k})$ and up to a field automorphism of ${\bf k}$, we can assume that $\varphi|_{\operatorname{GL}_d({\bf k})}$ is the identity on $\operatorname{GL}_d({\bf k})$ or given by $g\mapsto g^{\vee}$.

Let $f\colon(x_1,\dots,x_d)\mapsto (x_1+a,x_2,\dots,x_d)$ for some $a\in{\bf k}^*$.
Consider $\operatorname{GL}_{d-1}({\bf k})$ as a subgroup of $\operatorname{GL}_d({\bf k})$ embedded as $g\mapsto[(x_1,\dots,x_d)\mapsto(x_1,g(x_2,\dots,x_d))]$.
We write $\varphi(f)\colon x\mapsto(p_1(x),\dots,p_d(x))$ for $x=(x_1,\dots,x_d)$ and polynomials $p_1,\dots,p_d\in{\bf k}[x_1,\dots,x_d]$.
Observe that $f$ commutes with every element of $\operatorname{GL}_{d-1}({\bf k})$.
As $\varphi(\operatorname{GL}_{d-1}({\bf k}))=\operatorname{GL}_{d-1}({\bf k})$, it follows that the same is true for $\varphi(f)$, and hence $p_i(x)=x_ib$ for some $b\in{\bf k}^*$ for $i=2,\dots,d$.
Moreover, $p_1(x)$ is of the form $cx_1+d$ for some $c,d\in{\bf k}$. Note that $d\neq0$ because $\varphi$ is injective. It follows in particular, that $\varphi(\operatorname{Aff}_d({\bf k}))=\operatorname{Aff}_d({\bf k})$.

Consider $h\colon(x_1,\dots,x_d)\mapsto(x_1+x_2,x_2,x_3,\dots,x_d)$. Then $f$ commutes with $h$ but $\varphi(f)$ does not commute with $h^{\vee}$. It follows that $\varphi|_{\operatorname{GL}_d({\bf k})}$ is the identity on $\operatorname{GL}_d({\bf k})$. Then $\varphi(f)h=h\varphi(f)$, which implies that $d=b$.

If $\operatorname{char}({\bf k})=2$, then $f^2=\operatorname{id}$ and hence $\varphi(f)^2=\operatorname{id}$, which implies that $b=1$.
Now, suppose that $\operatorname{char}({\bf k})\neq2$ and consider $t\colon(x_1,\dots,x_d)\mapsto(2x_1,x_2,\dots,x_d)$. We have $tft^{-1}=f^2$, so also $t\varphi(f)t^{-1}=\varphi(f)^2$, which again implies $b=1$.

After conjugating $\varphi$ with a suitable element of the center of $\operatorname{GL}_d({\bf k})$, we obtain $\varphi(f)=f$.
The group $\operatorname{GL}_d({\bf k})$ acts transitively by conjugation on the set of translations different from $\operatorname{id}$, therefore $\varphi|_{\operatorname{Aff}_d({\bf k})}=\operatorname{id}_{\operatorname{Aff}_d({\bf k})}$.
\end{proof}

\begin{proof}[Proof of Theorem~\ref{main:aut}]
The theorem follows from Lemma~\ref{lem:GLtoGL}, Lemma~\ref{lem:aff_id} and
Proposition~\ref{pro:determined_by_aff}.
\end{proof}

\section{Birational diffeomorphisms}\label{sec:birdiff}

Let $X_{\operatorname{\mathbb{R}}}$ be a real projective rational variety, such that the set of ${\operatorname{\mathbb{R}}}$-points $X_{\operatorname{\mathbb{R}}}({\operatorname{\mathbb{R}}})$ is non-empty. We can now consider the subgroup $\operatorname{BirDiff}({X_{\operatorname{\mathbb{R}}}({\operatorname{\mathbb{R}}})})\subset\operatorname{Bir}(X)$ of {\it birational diffeomorphisms}, which is the subgroup of birational transformations without any real indeterminacy points. In \cite{MR2531367} it is shown that $\operatorname{BirDiff}({\operatorname{\mathbb{P}}_{\operatorname{\mathbb{R}}}^2({\operatorname{\mathbb{R}}})})$ and $\operatorname{BirDiff}({\operatorname{\mathbb{P}}_{\operatorname{\mathbb{R}}}^1({\operatorname{\mathbb{R}}})\times\operatorname{\mathbb{P}}_{\operatorname{\mathbb{R}}}^1({\operatorname{\mathbb{R}}})})$ are dense subgroups of the diffeomorphism groups $\mathcal{C}^\infty(\operatorname{\mathbb{P}}^2({\operatorname{\mathbb{R}}}))$ and $\mathcal{C}^\infty({\operatorname{\mathbb{P}}_{\operatorname{\mathbb{R}}}^1({\operatorname{\mathbb{R}}})\times\operatorname{\mathbb{P}}_{\operatorname{\mathbb{R}}}^1({\operatorname{\mathbb{R}}})})$ respectively, with respect to the $\mathcal{C}^\infty$-topology.

The Zariski (resp. Euclidean) topology on $\operatorname{Cr}_d({\operatorname{\mathbb{R}}})$ induces the {\em Zariski} (resp. {\em Euclidean}) topology on $\operatorname{BirDiff}(\operatorname{\mathbb{P}}_{\operatorname{\mathbb{R}}}^d({\operatorname{\mathbb{R}}}))$.

\begin{remark}
\label{rmk:approx_R}
The proofs of Lemma~\ref{lem:deformation_exists} and Proposition~\ref{pro:determined_by_aut} can be repeated word by word for $\operatorname{BirDiff}(\operatorname{\mathbb{P}}_{\operatorname{\mathbb{R}}}^d({\operatorname{\mathbb{R}}}))$ instead of $\operatorname{Cr}_d({\operatorname{\mathbb{R}}})$. We obtain that any
group homomorphism of $\operatorname{BirDiff}(\operatorname{\mathbb{P}}_{\operatorname{\mathbb{R}}}^d({\operatorname{\mathbb{R}}}))$ that is Zariski or Euclidean continuous is uniquely determined by its restriction to $\operatorname{PGL}_{d+1}({\operatorname{\mathbb{R}}})$.
\end{remark}

\begin{proposition}\label{main:birdiff}
	Let $\varphi\colon\operatorname{BirDiff}(\operatorname{\mathbb{P}}_{\operatorname{\mathbb{R}}}^d({\operatorname{\mathbb{R}}}))\to\operatorname{BirDiff}(\operatorname{\mathbb{P}}_{\operatorname{\mathbb{R}}}^d({\operatorname{\mathbb{R}}}))$ be a group automorphism  that is a homeomorphism with respect to the Zariski topology on the group $\operatorname{BirDiff}(\operatorname{\mathbb{P}}_{\operatorname{\mathbb{R}}}^d({\operatorname{\mathbb{R}}}))$.
	Then either $\varphi$ is an inner automorphism, or
	there exists $f\in\operatorname{BirDiff}(\operatorname{\mathbb{P}}_{\operatorname{\mathbb{R}}}^d({\operatorname{\mathbb{R}}}))$ such that $\varphi(g)=fg^{\vee}f^{-1}$ for all $g\in\operatorname{PGL}_{d+1}({\operatorname{\mathbb{R}}})$ and this defines $\varphi$ uniquely.
\end{proposition}

\begin{proof}
By Proposition~\ref{prop:emb_PGL}, there exists $f\in\operatorname{Cr}_d({\operatorname{\mathbb{R}}})$ such that $f\varphi(\operatorname{PGL}_{d+1}({\operatorname{\mathbb{R}}}))f^{-1}\subset\operatorname{PGL}_{d+1}({\operatorname{\mathbb{R}}})$.
Since $\operatorname{PGL}_{d+1}({\operatorname{\mathbb{R}}})$ acts transitively on $\operatorname{\mathbb{P}}_{\operatorname{\mathbb{R}}}^d({\operatorname{\mathbb{R}}})$, the maps $f$ and $f^{-1}$ have no base-points in $\operatorname{\mathbb{P}}_{\operatorname{\mathbb{R}}}^d({\operatorname{\mathbb{R}}})$, and hence $f\in\operatorname{BirDiff}(\operatorname{\mathbb{P}}_{\operatorname{\mathbb{R}}}^d({\operatorname{\mathbb{R}}}))$.
So, we can assume that $\varphi(\operatorname{PGL}_{d+1}({\operatorname{\mathbb{R}}}))=\operatorname{PGL}_{d+1}({\operatorname{\mathbb{R}}})$.
By Theorem~\ref{thm:dieudonne}, up to conjugation in $\operatorname{PGL}_{d+1}({\operatorname{\mathbb{R}}})$, we have that $\varphi|_{\operatorname{PGL}_{d+1}({\operatorname{\mathbb{R}}})}=\operatorname{id}_{\operatorname{PGL}_{d+1}({\operatorname{\mathbb{R}}})}$ or $\varphi(g)=g^{\vee}$ for all $g\in\operatorname{PGL}_{d+1}({\operatorname{\mathbb{R}}})$.
By Remark~\ref{rmk:approx_R}, $\varphi$ is uniquely determined by its restriction on $\operatorname{PGL}_{d+1}({\operatorname{\mathbb{R}}})$.
\end{proof}

Despite best efforts, the authors were not able to determine whether the automorphism $\operatorname{PGL}_{d+1}({\operatorname{\mathbb{R}}})$ given by $g\mapsto {}^\alpha\!g^\vee$ extends to an endomorphism of $\operatorname{BirDiff}(\operatorname{\mathbb{P}}_{\operatorname{\mathbb{R}}}^d({\operatorname{\mathbb{R}}}))$.

\begin{remark}
For any field ${\bf k}$, we can define the group $\mathrm{Bireg}(\operatorname{\mathbb{P}}_{\bf k}^d({\bf k}))$ as the group of elements $f\in\operatorname{Cr}_d({\bf k})$ such that $f$ and $f^{-1}$ have no base-points in $\operatorname{\mathbb{P}}_{\bf k}^d({\bf k})$.
If ${\bf k}$ is of characteristic zero, the analogous statement of Proposition~\ref{main:birdiff} for $\mathrm{Bireg}(\operatorname{\mathbb{P}}_{\bf k}^d({\bf k}))$ holds with the same proof as for $\operatorname{BirDiff}(\operatorname{\mathbb{P}}_{\operatorname{\mathbb{R}}}^d({\operatorname{\mathbb{R}}}))$.
\end{remark}

\bibliographystyle{abbrv}


\section{Anharmonic energy level structure of artificial atoms}

The cavity, which is designed for phase-matching condition that enables
non-degenerate $\chi^{(2)}$ interaction $\omega_{a}+\omega_{b}\rightarrow\omega_{c}$,
has a Hamiltonian of
\begin{eqnarray}
H & = & \omega_{\mathrm{a}}a^{\dagger}a+\omega_{\mathrm{b}}b^{\dagger}b+\omega_{\mathrm{c}}c^{\dagger}c+g_{\mathrm{nd}}\left(a^{\dagger}b^{\dagger}c+abc^{\dagger}\right),
\end{eqnarray}
where $a,b,c$ represents the bosonic operator for modes, $g_{\mathrm{nd}}$
is the nonlinear coupling strength. In the strong coupling regime
$g_{\mathrm{nd}}\gtrsim\kappa_{\mathrm{a}},\kappa_{\mathrm{b}},\kappa_{\mathrm{c}}$,
the system shows strong anhamonicity. For example, the state $|1_{\mathrm{a}}1_{\mathrm{b}}0_{\mathrm{c}}\rangle$
will couple to $|0_{\mathrm{a}}0_{\mathrm{b}}1_{\mathrm{c}}\rangle$
with a strength of $g_{\mathrm{nd}}$, and these two states will be
hybridized with each other, leading to a splitting of $2g_{\mathrm{nd}}$.
In this nonlinear cavity system, the eigenstates and eigenvalues in
each $N$-photon subspace could be solved independently. The energy
conversation requires
\begin{eqnarray}
N & = & N_{a}+N_{b}+2N_{c},
\end{eqnarray}
where $N_{i}$ is the number of excitation in mode $i$ ($i\in\left\{ \mathrm{a},\mathrm{b},\mathrm{c}\right\} $).
Therefore, the basis $\left\{ |\Psi_{N,m,n}\rangle=|m-1,n-1,N-m-n+2\rangle\right\} _{N}$
spans the $N$-photon subspace $H^{\left(N\right)}$, where $m,n\leq N$
are integers with $m+n-2<N$. The Hamiltonian is written in the matrix
form as
\begin{eqnarray}
H^{\left(N\right)} & = & \sum H_{m,n;m',n'}^{\left(N\right)}|\Psi_{N,m,n}\rangle\langle\Psi_{N,m',n'}|,
\end{eqnarray}
with the matrix element
\begin{eqnarray}
H_{m,n;m',n'}^{\left(N\right)} & = & \langle\Psi_{N,m',n'}|H|\Psi_{N,m,n}\rangle.
\end{eqnarray}
The eigenstates and eigenenergies are solved by diagonalizing the
matrix. Specially, we only consider the interaction between two photons,
thus truncate the dimension of the Fock state space to $2$ is enough.
The Hamiltonian in $2$-photon excitation is spanned by the eigenstate
$|\tilde{j}\rangle\in\left\{ \begin{array}{cc}
|1,1,0\rangle, & |0,0,1\rangle\end{array}\right\} $. For perfect phase matching, an appropriate rotating frame can be
chosen to transform $H$ to $H=g\left(a^{\dagger}b^{\dagger}c+abc^{\dagger}\right),$
\begin{eqnarray}
H_{ij}^{2} & = & \langle\tilde{j}|H|\tilde{i}\rangle_{2}\\
 & = & g_{\mathrm{nd}}\left(\delta(i-1,j)+\delta(i,j-1)\right),
\end{eqnarray}
where $\delta(x,y)$ is the Kronecker delta function. The energy levels
are obtained by diagolizing the matrix of the Hamiltonian. Therefore,
the degeneracy of the two-excitation states is removed by the nonlinear
interaction with energy levels split by $2g_{nd}$. If the cavity
is initially prepared in the state $|1_{a}0_{b}0_{c}\rangle$, the
photon resonant with mode $b$ can no longer efficiently induce the
transition from $|1_{a}0_{b}0_{c}\rangle$ to $|0_{a}0_{b}1_{c}\rangle$,
which is known as the photon-blockade effect. The energy levels of
second-harmonic generation $g_{\mathrm{d}}\left(a^{\dagger2}c+a^{2}c^{\dagger}\right)$
can be obtained following a similar calculation.

\section{Two-photon scattering by the artificial atom}

In this section, we investigate the two-photon transport through a
waveguide side-coupled to a cavity supporting $\chi^{(2)}$ interaction.
Figure 2(a) in the main text schematically illustrates a doubly-resonant
microcavity coupled with a bus waveguide. The two resonant modes in
the cavity are the fundamental (FM) mode $a$ and the second-harmonic
(SH) mode $c$ with frequency $\omega_{i}$ ($i\in\{a,c\}$). The
waveguide supports continuum states both in the fundamental and SH
frequency bands. Inside the cavity, modes $a$ and $c$ couple with
each other via the process of SH generation. The Hamiltonian of whole
system includes, the continuum states in the waveguide
\begin{eqnarray}
H_{W} & = & \int dxf^{\dagger}(x)\frac{1}{i}\frac{d}{dx}f(x)+\int dxs^{\dagger}(x)\frac{1}{i}\frac{d}{dx}s(x),
\end{eqnarray}
the localized states in the cavity
\begin{eqnarray}
H_{C} & = & \left(\omega_{a}-i\kappa_{a,0}\right)a^{\dagger}a+\left(\omega_{c}-i\kappa_{c,0}\right)c^{\dagger}c,
\end{eqnarray}
the nonlinear coupling inside the cavity
\begin{eqnarray}
H_{nl} & = & g_{\mathrm{d}}\left(a^{\dagger2}c+a^{2}c^{\dagger}\right),
\end{eqnarray}
the linear coupling between the waveguide and cavity
\begin{eqnarray}
H_{l} & = & V_{a}\int dx\delta(x)[f^{\dagger}(x)a+f(x)a^{\dagger}]+V_{c}\int dx\delta(x)[s^{\dagger}(x)c+s(x)c^{\dagger}],
\end{eqnarray}
where $x$ is coordinate along the waveguide, $f(x)$ ($s(x)$) and
$f^{\dagger}(x)$ ($s^{\dagger}(x)$) are the annihilation and creation
operators at position $x$ in the waveguide, $g_{\mathrm{d}}$ is
the nonlinear coupling strength of SH generation, $V_{a}$ ($V_{c}$)
is the coupling strength between waveguide and cavity in the fundamental
(SH) frequency band, $\kappa_{a,0}$ ($\kappa_{c,0}$) is the intrinsic
decay rates of the cavity mode. Since the coupling near the narrow
resonant frequency window is considered, the dispersions of the coupling
strengths $g_{\mathrm{d}}$, $V_{a}$ and $V_{c}$ are neglected.
The input state is initially prepared in a two-photon state at the
fundamental frequencies. A general form of two-excitation state can
be written as
\begin{eqnarray}
|E_{2}\rangle & = & \int dx_{1}dx_{2}g(x_{1},x_{2})f^{\dagger}(x_{1})f^{\dagger}(x_{2})|0\rangle+\int dxm(x)f^{\dagger}(x)|0\rangle+\nonumber \\
 &  & \int dxh(x)s^{\dagger}(x)|0\rangle+f_{a}\frac{1}{\sqrt{2}}a^{\dagger}a^{\dagger}|0\rangle+f_{c}c^{\dagger}|0\rangle.
\end{eqnarray}
Following the Schrodinger equation $H|E_{2}\rangle=E_{2}|E_{2}\rangle$
($E_{2}=k_{1}+k_{2}$, $k_{i}$ is the frequency of the $i$-th photon),
one gets
\begin{eqnarray}
\left(-i\frac{\partial}{\partial x_{1}}-i\frac{\partial}{\partial x_{2}}-E_{2}\right)g(x_{1},x_{2})+\frac{V_{a}}{2}[\delta(x_{1})m(x_{2})+\delta(x_{2})m(x_{1})] & = & 0,\label{eq:two-ea-1}\\
\left(-i\frac{d}{dx}+\omega_{a}-i\kappa_{a,0}-E_{2}\right)m(x)+V_{a}[g(x,0)+g(0,x)]+\sqrt{2}V_{a}f_{a}\delta(x) & = & 0,\\
\left(-i\frac{d}{dx}-E_{2}\right)h(x)+V_{c}f_{c}\delta(x) & = & 0,\label{eq:two-ea}\\
\left(2\omega_{a}-2i\kappa_{a,0}-E_{2}\right)f_{a}+\sqrt{2}g_{\mathrm{d}}f_{c}+\sqrt{2}V_{a}m(0) & = & 0,\\
\left(\omega_{c}-i\kappa_{c,0}-E_{2}\right)f_{c}+\sqrt{2}g_{\mathrm{d}}f_{a}+V_{c}h(0) & = & 0.\label{eq:two-ea-5}
\end{eqnarray}
The discontinuous functions fulfills
\begin{eqnarray}
g(x,0) & = & g(0,x),\\
g(x,0) & = & [g(x,0^{+})+g(x,0^{-})]/2,\\
m(0) & = & [m(0^{+})+m(0^{-})]/2,\\
h(0) & = & [h(0^{+})+h(0^{-})]/2,\\
\frac{d}{dx}m(x)|_{x=0} & = & [m(0^{+})-m(0^{-})]\delta(x).
\end{eqnarray}
Then Eqs.(\ref{eq:two-ea-1})-(\ref{eq:two-ea-5}) are equivalent
to
\begin{eqnarray}
\left(-i\frac{\partial}{\partial x_{1}}-i\frac{\partial}{\partial x_{2}}-E_{2}\right)g(x_{1},x_{2}) & = & 0,\\
\frac{2i}{V_{a}}[g(0^{+},x)-g(0^{-},x)] & = & m(x),\label{eq:2}\\
\left(-i\frac{d}{dx}+\omega_{a}-i\kappa_{a,0}-E_{2}\right)m(x)+V_{a}[g(x,0^{+})+g(0^{-},x)] & = & 0,\label{eq:3}\\
\frac{i}{\sqrt{2}V_{a}}[m(0^{+})-m(0^{-})] & = & f_{a},\\
\left(-i\frac{d}{dx}-E_{2}\right)h(x) & = & 0,\\
\frac{i}{V_{c}}[h(0^{+})-h(0^{-})] & = & f_{c},\\
\left(2\omega_{a}-2i\kappa_{a,0}-E_{2}\right)f_{a}+\sqrt{2}g_{\mathrm{d}}f_{c}+\sqrt{2}V_{a}m(0) & = & 0,\\
\left(\omega_{c}-i\kappa_{c,0}-E_{2}\right)f_{c}+\sqrt{2}g_{\mathrm{d}}f_{a}+V_{c}h(0) & = & 0.
\end{eqnarray}
Combine Eqs.$\,$(\ref{eq:2}) and (\ref{eq:3}), we get
\begin{eqnarray}
\left(-i\frac{d}{dx}+\omega_{a}-i\kappa_{a,0}-i\kappa_{a,1}-E_{2}\right)g(0^{+},x) & = & \left(-i\frac{d}{dx}+\omega_{a}-i\kappa_{a,0}+i\kappa_{a,1}-E_{2}\right)g(0^{-},x).\label{eq:region}
\end{eqnarray}
Adopting the method in Ref.$\,$\cite{Zheng2013}, $g(x_{1},x_{2})$
is divided to three regions: $g_{1}(x_{1},x_{2})$ for $x_{1}\leq x_{2}<0$,
$g_{2}(x_{1},x_{2})$ for $x_{1}<0<x_{2}$ and $g_{3}(x_{1},x_{2})$
for $0<x_{1}\leq x_{2}$. For two-photon monochromatic wave input
state
\begin{eqnarray}
g_{1}(x_{1},x_{2}) & = & \frac{1}{2\text{\ensuremath{\sqrt{2}\pi}}}\left(e^{ik_{1}x_{1}}e^{ik_{2}x_{2}}+e^{ik_{2}x_{1}}e^{ik_{1}x_{2}}\right),
\end{eqnarray}
$g(x_{1},x_{2})$ in the other two regions are derived from Eq.$\,$(\ref{eq:region})
as
\begin{eqnarray}
g_{2}(x_{1},x_{2}) & = & \frac{1}{2\text{\ensuremath{\sqrt{2}\pi}}}\left(t_{k_{2}}e^{i(k_{1}x_{1}+k_{2}x_{2})}+t_{k_{1}}e^{i(k_{2}x_{1}+k_{1}x_{2})}\right),\\
g_{3}(x_{1},x_{2}) & = & \frac{1}{2\text{\ensuremath{\sqrt{2}\pi}}}t_{k_{1}}t_{k_{2}}\left(e^{i(k_{1}x_{1}+k_{2}x_{2})}+e^{i(k_{2}x_{1}+k_{1}x_{2})}\right)+Be^{-i(\omega_{a}-i\kappa_{a,0}-i\kappa_{a,1})(x_{2}-x_{1})}e^{i(k_{1}+k_{2})x_{2}},
\end{eqnarray}
with
\begin{eqnarray}
t_{k} & = & \frac{k-\omega_{a}+i\kappa_{a,0}-i\kappa_{a,1}}{k-\omega_{a}+i\kappa_{a,0}+i\kappa_{a,1}}.
\end{eqnarray}
Eliminating $f_{a}$ and $f_{c}$ ,
\begin{eqnarray}
\frac{2i}{V_{a}}[\alpha_{a}^{-}g(0^{+},0^{+})-(\alpha_{a}^{-}+\alpha_{a}^{+})g(0^{-},0^{+})+\alpha_{a}^{+}g(0^{-},0^{-})]+2g_{\mathrm{d}}\frac{V_{a}}{V_{c}}[h(0^{+})-h(0^{-})] & = & 0,\\
\alpha_{b}^{-}h(0^{+})-\alpha_{b}^{+}h(0^{-})+\frac{2ig_{\mathrm{d}}V_{c}}{V_{a}^{2}}[g(0^{+},0^{+})-2g(0^{-},0^{+})+g(0^{-},0^{-})] & = & 0,
\end{eqnarray}
with $\alpha_{a}^{\pm}=2\left(\omega_{a}-i\kappa_{a,0}\pm i\kappa_{a,1}\right)-k_{1}-k_{2}$,
$\alpha_{c}^{\pm}=\left(\omega_{c}-i\kappa_{c,0}\pm i\kappa_{c,1}\right)-k_{1}-k_{2}$,
$\kappa_{i,1}=V_{i}^{2}/2$. Using the values at the discontinuous
points,
\begin{eqnarray}
g(0^{+},0^{+})=g_{3}(0,0) & = & \frac{1}{\sqrt{2}\pi}t_{k_{1}}t_{k_{2}}+B,\\
g(0^{-},0^{+})=g_{2}(0,0) & = & \frac{1}{2\sqrt{2}\pi}(t_{k_{1}}+t_{k_{2}}),\\
g(0^{-},0^{-})=g_{1}(0,0) & = & \frac{1}{\sqrt{2}\pi},\\
h(0^{+}) & = & \frac{1}{\sqrt{2\pi}}C,\\
h(0^{-}) & = & 0,
\end{eqnarray}
one finally obtains
\begin{eqnarray}
C & = & \frac{ig_{\mathrm{d}}\sqrt{2\kappa_{c,1}}\left(\alpha_{a}^{+}-\alpha_{a}^{-}\right)\left(2-t_{k_{1}}-t_{k_{2}}\right)}{2\sqrt{\pi}\kappa_{a,1}\left(\alpha_{a}^{-}\alpha_{c}^{-}-2g_{d}^{2}\right)}\nonumber \\
 & = & -\frac{2g_{\mathrm{d}}\sqrt{2\kappa_{c,1}}\left(2-t_{k_{1}}-t_{k_{2}}\right)}{\sqrt{\pi}\left(\alpha_{a}^{-}\alpha_{c}^{-}-2g_{\mathrm{d}}^{2}\right)},\\
B & = & \frac{4g_{\mathrm{d}}^{2}\left(t_{k_{1}}-1\right)\left(t_{k_{2}}-1\right)+\alpha_{a}^{+}\alpha_{c}^{-}\left(t_{k_{1}}+t_{k_{2}}-2\right)+\alpha_{a}^{-}\alpha_{c}^{-}\left(t_{k_{1}}+t_{k_{2}}-2t_{k_{1}}t_{k_{2}}\right)}{2\sqrt{2}\pi\left(\alpha_{a}^{-}\alpha_{c}^{-}-2g_{\mathrm{d}}^{2}\right)}\nonumber \\
 & = & \frac{\sqrt{2}g_{\mathrm{d}}^{2}\left(1-t_{k_{1}}\right)\left(1-t_{k_{2}}\right)}{\pi\left(\alpha_{a}^{-}\alpha_{c}^{-}-2g_{\mathrm{d}}^{2}\right)}.
\end{eqnarray}
The expressions can be simplified as
\begin{eqnarray}
C & = & -\frac{2g_{\mathrm{d}}\sqrt{2\kappa_{c,1}}}{\sqrt{\pi}\left[2\omega_{a}-k_{1}-k_{2}-2i\kappa_{a,tot}\right]\left[\omega_{c}-k_{1}-k_{2}-i\kappa_{c,tot}\right]-2g_{d}^{2}}\left(\frac{2i\kappa_{a,1}}{k_{1}-\omega_{a}+i\kappa_{a,tot}}+\frac{2i\kappa_{a,1}}{k_{2}-\omega_{a}+i\kappa_{a,tot}}\right),\\
B & = & \frac{\sqrt{2}g_{d}^{2}}{\pi\left[2\omega_{a}-k_{1}-k_{2}-2i\kappa_{a,tot}\right]\left[\omega_{c}-k_{1}-k_{2}-i\kappa_{c,tot}\right]-2g_{\mathrm{d}}^{2}}\frac{2i\kappa_{a,1}}{k_{1}-\omega_{a}+i\kappa_{a,tot}}\frac{2i\kappa_{a,1}}{k_{2}-\omega_{a}+i\kappa_{a,tot}}.
\end{eqnarray}
where $\kappa_{i,tot}=\kappa_{i,0}+\kappa_{i,1}$. The wave-functions
of two-photon input and output states are computed by the Lippmann-Schwinger
equations$\:$\cite{lipp},
\begin{eqnarray}
\phi_{in}(x_{1},x_{2}) & = & \langle x_{1},x_{2}|E_{2}\rangle-\langle x_{1},x_{2}|\frac{1}{k_{1}+k_{2}-H_{0}+i0^{+}}H_{int}|E_{2}\rangle\nonumber \\
 & = & g_{1}(x_{1},x_{2})\theta(x_{2}-x_{1})+g_{1}(x_{2},x_{1})\theta(x_{1}-x_{2}),\\
\phi_{out}(x_{1},x_{2}) & = & \langle x_{1},x_{2}|E_{2}\rangle-\langle x_{1},x_{2}|\frac{1}{k_{1}+k_{2}-H_{0}-i0^{+}}H_{int}|E_{2}\rangle\nonumber \\
 & = & g_{3}(x_{1},x_{2})\theta(x_{2}-x_{1})+g_{3}(x_{2},x_{1})\theta(x_{1}-x_{2}).
\end{eqnarray}
Then the two-photon scattering matrix is obtained by calculating the
wave-function overlap between the output state and the two photon
plain wave state,
\begin{eqnarray}
S(p_{1},p_{2};k_{1},k_{2}) & = & \int dx_{1}dx_{2}\frac{1}{2\sqrt{2}\pi}[e^{-i(p_{1}x_{1}+p_{2}x_{2})}+e^{-i(p_{2}x_{1}+p_{1}x_{2})}]\phi_{out}(x_{1},x_{2}).
\end{eqnarray}
The transmission plane wave term is
\begin{eqnarray}
S_{plane} & = & \frac{1}{8\pi^{2}}\int dx_{1}dx_{2}[e^{-i(p_{1}-k_{1})x_{1}}e^{-i(p_{2}-k_{2})x_{2}}+e^{-i(p_{1}-k_{2})x_{1}}e^{-i(p_{2}-k_{1})x_{2}}\nonumber \\
 &  & +e^{-i(p_{1}-k_{2})x_{2}}e^{-i(p_{2}-k_{1})x_{1}}+e^{-i(p_{2}-k_{2})x_{1}}e^{-i(p_{1}-k_{1})x_{2}}]\nonumber \\
 & = & t_{k_{1}}t_{k_{2}}[\delta(p_{1}-k_{1})\delta(p_{2}-k_{2})+\delta(p_{1}-k_{2})\delta(p_{2}-k_{1})]\nonumber \\
 & = & S_{p_{1}k_{1}}S_{p_{2}k_{2}}+S_{p_{1}k_{2}}S_{p_{2}k_{1}}.
\end{eqnarray}
The bound state term is
\begin{eqnarray}
S_{bound} & = & \frac{B}{2\sqrt{2}\pi}\int dx_{1}dx_{2}[e^{-i(p_{1}x_{1}+p_{2}x_{2})}+e^{-i(p_{2}x_{1}+p_{1}x_{2})}]e^{-i(\omega_{a}-i\kappa_{a,0}-i\kappa_{a,1})(x_{2}-x_{1})}e^{i(k_{1}+k_{2})x_{2}}\theta(x_{2}-x_{1})+\nonumber \\
 &  & \frac{B}{2\sqrt{2}\pi}\int dx_{1}dx_{2}[e^{-i(p_{1}x_{1}+p_{2}x_{2})}+e^{-i(p_{2}x_{1}+p_{1}x_{2})}]e^{-i(\omega_{a}-i\kappa_{a,0}-i\kappa_{a,1})(x_{1}-x_{2})}e^{i(k_{1}+k_{2})x_{1}}\theta(x_{1}-x_{2}).
\end{eqnarray}
The integral of the first term is simplified by replacing $x_{2}$
by $x_{3}+x_{1}$ and similar for the second term. We get
\begin{eqnarray}
S_{bound,1} & = & \frac{B}{2\sqrt{2}\pi}\int dx_{1}dx_{3}e^{-(\kappa_{a,0}+\kappa_{a,1})x_{3}}[e^{-i(p_{1}+p_{2}-k_{1}-k_{2})x_{1}}e^{-i(p_{2}+\omega_{a}-k_{1}-k_{2})x_{3}}\nonumber \\
 &  & +e^{-i(p_{1}+p_{2}-k_{1}-k_{2})x_{1}}e^{-i(p_{1}+\omega_{a}-k_{1}-k_{2})x_{3}}]\theta(x_{3})\nonumber \\
 & = & \frac{B}{2\sqrt{2}\pi}\times2\pi[\frac{1}{(\kappa_{a,0}+\kappa_{a,1})+i(p_{2}+\omega_{a}-k_{1}-k_{2})}\delta(p_{1}+p_{2}-k_{1}-k_{2})\nonumber \\
 &  & +\frac{1}{(\kappa_{a,0}+\kappa_{a,1})+i(p_{1}+\omega_{a}-k_{1}-k_{2})}\delta(p_{1}+p_{2}-k_{1}-k_{2})]\nonumber \\
 & = & \frac{B}{\sqrt{2}}[\frac{i}{p_{1}-\omega_{a}+i(\kappa_{a,0}+\kappa_{a,1})}+\frac{i}{p_{2}-\omega_{a}+i(\kappa_{a,0}+\kappa_{a,1})}]\delta(p_{1}+p_{2}-k_{1}-k_{2}).
\end{eqnarray}
Due to the symmetry of the wavefunction
\begin{eqnarray}
S_{bound} & = & 2S_{bound,1}\nonumber \\
 & = & \sqrt{2}B[\frac{i}{p_{1}-\omega_{a}+i(\kappa_{a,0}+\kappa_{a,1})}+\frac{i}{p_{2}-\omega_{a}+i(\kappa_{a,0}+\kappa_{a,1})}]\delta(p_{1}+p_{2}-k_{1}-k_{2})\nonumber \\
 & = & \sqrt{2}B[\frac{i}{p_{1}-\omega_{a}+i(\kappa_{a,0}+\kappa_{a,1})}+\frac{i}{p_{2}-\omega_{a}+i(\kappa_{a,0}+\kappa_{a,1})}]\delta(p_{1}+p_{2}-k_{1}-k_{2})\nonumber \\
 & = & \frac{B}{\sqrt{2}\kappa_{a,1}}(2-t_{p_{1}}-t_{p_{2}})\delta(p_{1}+p_{2}-k_{1}-k_{2}).
\end{eqnarray}
The total scattering matrix is
\begin{eqnarray}
S(p_{1},p_{2};k_{1},k_{2}) & = & t_{k_{1}}t_{k_{2}}[\delta(p_{1}-k_{1})\delta(p_{2}-k_{2})+\delta(p_{1}-k_{2})\delta(p_{2}-k_{1})]\\
 &  & +\frac{B}{\sqrt{2}\kappa_{a,1}}(2-t_{p_{1}}-t_{p_{2}})\delta(p_{1}+p_{2}-k_{1}-k_{2}).
\end{eqnarray}
According to the scattering matrix, one can compute the output spectrum
of the two-photon state as
\begin{eqnarray}
\alpha_{out}(p_{1},p_{2}) & = & \int\int\alpha_{in}(k_{1},k_{2})S(p_{1},p_{2};k_{1},k_{2})dk_{1}dk_{2},
\end{eqnarray}
where $\alpha_{in}(k_{1},k_{2})$ is the input spectrum.

From the frequency conversion point of view, one might care about
the conversion efficiency of the two-photon second-harmonic generation.
The two-photon to one-photon conversion matrix is
\begin{eqnarray}
S(p;k_{1},k_{2}) & = & \int dxe^{-ipx}\frac{1}{\sqrt{2\pi}}C(k_{1}+k_{2})e^{i(k_{1}+k_{x})x}\nonumber \\
 & = & \frac{1}{\sqrt{2\pi}}C(k_{1}+k_{2})\int dxe^{-i(p-k_{1}-k_{2})x}\nonumber \\
 & = & C(k_{1}+k_{2})\delta(p-k_{1}-k_{2}).
\end{eqnarray}
The output spectrum of the second-harmonic photon is
\begin{eqnarray}
\beta_{out}(p) & = & \int\int\alpha_{in}(k_{1},k_{2})S(p;k_{1},k_{2})dk_{1}dk_{2}\nonumber \\
 &  & \int\int\alpha_{in}(k_{1},k_{2})C(k_{1}+k_{2})\delta(p-k_{1}-k_{2})dk_{1}dk_{2}.
\end{eqnarray}
Then, we get the conversion efficiency
\begin{eqnarray}
\eta & = & \frac{\int|\beta_{out}(p)|^{2}dp}{2\int\int|\alpha_{in}(k_{1},k_{2})|^{2}dk_{1}dk_{2}}.
\end{eqnarray}

\section{Control phase gate via photonic molecule}

\subsection{Coupled microresonator}

In our scheme, an active antenna is used to couple the traveling photons
and the artificial atom, as shown by Fig.$\:$3 in the main text.
For artificial atom supporting mode $a,b$ (with resonant frequency
$\omega_{\mathrm{a}},\omega_{\mathrm{b}}$), drive field with frequency
$\omega_{\mathrm{EO}}=\omega_{A}-\omega_{0}$ can be used to induce
the coupling between photons of frequency $\omega_{0}$ and the mode
$A$ ($A\in\left\{ \mathrm{a},\mathrm{b}\right\} $). Such an antenna
can be physically realized with a microcavity and electro-optic (EO)
effect \cite{Zhang2019}. A microwave driving is applied on the two
cavities which shifts the two cavity resonant frequencies to opposite
directions, with the photonic molecular Hamiltonian as
\begin{eqnarray}
H & = & \omega_{m,1}m_{1}^{\dagger}m_{1}+\omega_{m,2}m_{2}^{\dagger}m_{2}+J\left(m_{1}^{\dagger}m_{2}+m_{1}m_{2}^{\dagger}\right)+G\cos(\omega_{\mathrm{EO}}t)\left(m_{1}^{\dagger}m_{1}-m_{2}^{\dagger}m_{2}\right),
\end{eqnarray}
where $\omega_{m,i}$ is the resonant frequency of the cavity mode
$m_{i}$, $J$ is the linear coupling strength between the two cavities,
$G$ is the coupling strength due to $\chi^{(2)}$ interaction between
photonic mode and electric field, i.e. the EO drive. Denoting $\omega_{0}=\frac{\omega_{m,1}+\omega_{m,2}}{2}$,
$\delta\omega=\frac{\omega_{m,1}-\omega_{m,2}}{2}$, $\tan\theta=\frac{J}{\delta\omega}$
and making the linear transformation
\begin{eqnarray}
b & = & \cos\frac{\theta}{2}m_{1}+\sin\frac{\theta}{2}m_{2},\\
d & = & -\sin\frac{\theta}{2}m_{1}+\cos\frac{\theta}{2}m_{2},
\end{eqnarray}
the Hamiltonian transforms to
\begin{eqnarray}
H & = & \omega_{b}b^{\dagger}b+\omega_{d}d^{\dagger}d+G\cos(\omega_{\mathrm{EO}}t)\sin\theta\left(b^{\dagger}d+bd^{\dagger}\right)+G\cos(\omega_{\mathrm{EO}}t)\cos\theta\left(b^{\dagger}b-d^{\dagger}d\right),
\end{eqnarray}
where $\omega_{b}=\omega_{0}+\sqrt{\delta\omega^{2}+J^{2}}$, $\omega_{d}=\omega_{0}-\sqrt{\delta\omega^{2}+J^{2}}$.
For modulation frequency $\omega_{m}$ much larger than the cavity
decay rates $\kappa_{b},\kappa_{d}$ of the supermodes $b,d$, the
sidebands of mode $b$ and $d$ generated by the frequency modulated
term $\Omega\cos(\omega_{\mathrm{EO}}t)\cos\theta\left(b^{\dagger}b-dd^{\dagger}\right)$
are no longer on resonance, which can be neglected safely. Therefore,
the Hamiltonian reduces to
\begin{eqnarray}
H & = & \omega_{b}b^{\dagger}b+\omega_{d}d^{\dagger}d+G\cos(\omega_{\mathrm{EO}}t)\sin\theta\left(b^{\dagger}d+bd^{\dagger}\right).
\end{eqnarray}
 If only mode $m_{2}$ couples with the waveguide with rate $\sqrt{2\kappa_{m,2}}$,
mode $b$ and $d$ experiences effective coupling strength of $\sqrt{2\kappa_{m,2}}\cos\frac{\theta}{2}$
and $\sqrt{2\kappa_{m,2}}\sin\frac{\theta}{2}$, respectively. For
the case of large detuning $\delta\omega\gg\left\{ J,\:\kappa\right\} $,
$b\approx m_{1}$, $d\approx m_{2}$, mode $b$ is approximately decoupled
from the waveguide and its lifetime is only limited by the intrinsic
loss. In the rotating frame of $\omega_{b}b^{\dagger}b+\omega_{d}d^{\dagger}d$
and apply the rotating wave approximation, the Hamiltonian is
\begin{eqnarray}
H & = & \frac{1}{2}\Omega\sin\theta\left(b^{\dagger}de^{i\delta}+bd^{\dagger}e^{-i\delta}\right),
\end{eqnarray}
where $\delta=\omega_{d}-(\omega_{b}-\omega_{d})$. Transforming the
Hamiltonian further to the frame of $\frac{\delta}{2}c^{\dagger}c-\frac{\delta}{2}d^{\dagger}d$,
we obtain the time-independent form
\begin{eqnarray}
H & = & -\frac{\delta}{2}b^{\dagger}b+\frac{\delta}{2}d^{\dagger}d+\frac{1}{2}G\sin\theta\left(b^{\dagger}d+bd^{\dagger}\right).
\end{eqnarray}
In this way, we obtain the coupling between mode $b$ ($m_{1}$) in
the artificial atom cavity and the mode $d$ ($m_{2}$) in the antenna
cavity. The frequency difference between mode $d$ and $b$ is compensated
by the frequency of the EO drive. For input photon with pulse shape
$A_{in}\left(t\right)$, it is rapidly coupled into the antenna cavity
due to the large waveguide-cavity coupling rate and then coupled to
the artificial atom by a time-dependent $G\left(t\right)$.For two
incident photons with the same frequency, we use different $\omega_{\mathrm{EO}}$
to couple them with energy levels of different frequencies without
crosstalk.

\subsection{Quantum storage of control photon pulse}

We use the photonic molecule introduced in the last section for the
storage and readout of the control photon from the waveguide to the
artificial atom. The total Hamiltonian of the system is
\begin{eqnarray}
H & = & \sum_{j}\omega_{j}j^{\dagger}j+g_{\mathrm{nd}}abc^{\dagger}+\Omega\left(t\right)bd^{\dagger}+h.c.
\end{eqnarray}
where $j\in\{a,b\}$ represents the mode in the atomic cavity in the
fundamental frequency band, $c$ is the mode in the atomic cavity
in the SH frequency band, $d$ is the mode in the antenna cavity.
The dynamics of the cavity field operator $A$ follow
\begin{eqnarray}
\frac{d}{dt}A & = & -i\left[A,H\right]-\kappa_{A}A+\sqrt{2\kappa_{A,1}}A_{in}\left(t\right).
\end{eqnarray}
The information of the pulse shape is contained in the time dependent
term $A_{in}\left(t\right)$.

Here, we investigate the quantum storage of single photon with the
photonic molecule. Without the control photon, the strong $\chi^{(2)}$
interaction is forbidden, the Hamiltonian for photon storage is
\begin{eqnarray}
H & = & \delta_{b}b^{\dagger}b+\delta_{d}d^{\dagger}d+\Omega b^{\dagger}d+\Omega^{*}bd^{\dagger}.\label{eq:storage}
\end{eqnarray}
For single-photon excitation, the state can be described by a pure
state with a general form of the superposition of Fock states. The
single-photon state is expressed as
\begin{eqnarray}
|\psi\rangle_{db} & = & c_{10}|10\rangle+c_{01}|01\rangle,
\end{eqnarray}
where $|mn\rangle=|m\rangle_{d}\otimes|n\rangle_{b}$. The dynamics
follows
\begin{eqnarray}
\frac{d}{dt}c_{mn} & = & \frac{d}{dt}\langle mn|\psi\rangle\nonumber \\
 & = & \langle mn|\frac{d}{dt}\psi\rangle\nonumber \\
 & = & -i\langle mn|H_{\mathrm{eff}}|\psi\rangle\nonumber \\
 & = & \left(-i\delta_{b}-\kappa_{b}\right)\sum_{m'n'}c_{m'n'}\langle mn|b^{\dagger}b|m'n'\rangle+\left(-i\delta_{d}-\kappa_{d}\right)\sum_{m'n'}c_{m'n'}\langle mn|d^{\dagger}d|m'n'\rangle\nonumber \\
 &  & -i\left(\Omega\sum_{m'n'}c_{m'n'}\langle mn|b^{\dagger}d|m'n'\rangle+\Omega^{*}\sum_{m'n'}c_{m'n'}\langle mn|bd^{\dagger}|m'n'\rangle\right)\nonumber \\
 & = & \alpha_{b}nc_{mn}+\alpha_{d}mc_{mn}-i\Omega\sqrt{(m+1)n}c_{m+1,n-1}-i\Omega^{*}\sqrt{m(n+1)}c_{m-1,n+1},
\end{eqnarray}
where $\alpha_{i}=-i\delta_{i}-\kappa_{i}$, $H_{\mathrm{eff}}$ is
the effective Hamiltonian that includes the mode dissipation, which
is obtained by replacing $\delta_{i}$ by $\alpha_{i}$ in Eq.$\:$\ref{eq:storage}.
Under single-photon pulse excitation of a perfectly phase-matched
cavity $\alpha_{i}=\kappa_{i}$, the dynamics of the intracavity and
output fields follow
\begin{eqnarray}
\frac{d}{dt}c_{10} & = & -\kappa_{d}c_{10}-i\Omega^{*}\left(t\right)c_{01}+\sqrt{2\kappa_{d,1}}\phi_{in}(t),\label{eq:cme1-1}\\
\frac{d}{dt}c_{01} & = & -\kappa_{b}c_{01}-i\Omega\left(t\right)c_{10},\label{eq:cme1-2}\\
\phi_{out} & = & \phi_{in}-\sqrt{2\kappa_{c,1}}c_{10},\label{eq:cme1-3}
\end{eqnarray}
where $\phi_{in}(t)$ ($\phi_{out}(t)$) represents the pulse shape
of the input (output) single photon.

\subsubsection{Figure of merit}

We assume that both cavities are in the ground state, so $c_{10}=c_{01}=0$
at $t=0$. We also assume that the input field excitation $\phi_{in}(t)$
only has nonzero values in time interval $[0,T]$. Our goal is to
store the input field to $|01\rangle$ and retrieve the photon out
of the cavity after. During the storage process, $c_{10}(0)=c_{01}(0)=0$
and the input field fulfills $\int_{0}^{T}dt|\phi_{in}(t)|^{2}=1$.
The storage efficiency is given by
\begin{eqnarray}
\eta_{s} & = & \frac{\mathrm{Population}\:\mathrm{of\:|01\rangle}}{\mathrm{Number\:\mathrm{of\:\mathrm{incoming}\:\mathrm{photons}}}}\nonumber \\
 & = & |c_{01}(T)|^{2}.
\end{eqnarray}
For the retrieval process, we set $c_{10}(t_{r})=0$, $c_{01}(t_{r})=1$
with $t_{r}$ being the start time of the retrieve. The retrieval
efficiency is given by
\begin{eqnarray}
\eta_{r} & = & \frac{\mathrm{Number}\:\mathrm{of\:\mathrm{retrieved}\:\mathrm{photons}}}{\mathrm{Population}\:\mathrm{of\:|01\rangle}}\nonumber \\
 & = & \int_{t_{r}}^{\infty}|\phi_{out}(t)|^{2}dt.\label{eq:retrive}
\end{eqnarray}

\subsubsection{Photon Retrieval}

First, we investigate the retrieval process with $\phi_{in}(t)=0$
for $t>t_{r}$. In our case, we have assumed that the second cavity
has a quality factor much larger than the first one which couples
with a bus waveguide, thus it is reasonable to make a approximation
$\kappa_{b}\approx0$. From Eqs.~(\ref{eq:cme1-1})-(\ref{eq:cme1-2}),
\begin{eqnarray}
\frac{d}{dt}\left(|c_{10}|^{2}+|c_{01}|^{2}\right) & = & -2\kappa_{d}|c_{10}|^{2}.
\end{eqnarray}
Using Eq.~(\ref{eq:cme1-3}) and Eq.~(\ref{eq:retrive}), the retrieval
efficiency is derived as
\begin{eqnarray}
\eta_{s} & = & 2\kappa_{d,1}\int_{t_{r}}^{\infty}dt|c_{10}|^{2}\nonumber \\
 & = & -\frac{\kappa_{d,1}}{\kappa_{d}}\int_{t_{r}}^{\infty}dt\frac{d}{dt}\left(|c_{10}|^{2}+|c_{01}|^{2}\right)\nonumber \\
 & = & \frac{\kappa_{d,1}}{\kappa_{d,0}+\kappa_{d,1}}\left(|c_{10}(t_{r})|^{2}+|c_{01}(t_{r})|^{2}-|c_{10}(\infty)|^{2}-|c_{01}(\infty)|^{2}\right).
\end{eqnarray}
If there is no excitation in the cavity after the retrieval process,
$|c_{10}(\infty)|^{2}=|c_{01}(\infty)|^{2}=0$, the efficiency reduces
to
\begin{equation}
\eta_{s}=\frac{\kappa_{d,1}}{\kappa_{d,0}+\kappa_{d,1}}.
\end{equation}
Therefore, the retrieval efficiency is independent of the pulse shape
of the driving fields, provided that the driving field pumps all excitation
out of the cavity completely. To achieve high retrieval efficiency,
over-coupled condition of the waveguide-cavity system is required.

In the following, we derive the relationship between the pulse shapes
of the driving field and the output field. For adiabatic retrieval
process, the input and driving fields are smooth. It is reasonable
to adiabatically eliminate $c_{10}$, the population of state $|10\rangle$,
in the coupled equations, if $\kappa_{d}\gg g/T$. Then Eq.~(\ref{eq:cme1-1})
transforms to
\begin{eqnarray}
-\kappa_{d}c_{10}-i\Omega c_{01} & = & 0.
\end{eqnarray}
Combining it with Eq.~(\ref{eq:cme1-2}), we get
\begin{eqnarray}
\frac{d}{dt}c_{01} & = & -\frac{|\Omega(t)|^{2}}{\kappa_{d}}c_{01}.
\end{eqnarray}
Solving this differential equation and using the boundary condition
$c_{01}(0)=1$ (the start time of the retrieval process is set to
be $0$ for simplicity),
\begin{eqnarray}
c_{01}(t) & = & e^{-\frac{1}{\kappa_{d}}\int_{0}^{t}|g(t')|^{2}dt'}.
\end{eqnarray}
Denote $h(t,t')=\int_{t}^{t'}|\Omega(t^{''})|^{2}dt^{''}$ and submit
is into Eq.~(\ref{eq:cme1-3}), the output field is derived as
\begin{eqnarray}
\phi_{out}(t) & = & i\frac{\sqrt{2\kappa_{d.1}}}{\kappa_{d}}\Omega(t)e^{-\frac{1}{\kappa_{d}}h(0,t)}.\label{eq:out}
\end{eqnarray}
Computing the retrieval efficiency using Eq.~(\ref{eq:out}),
\begin{eqnarray}
\eta_{r} & = & \int_{0}^{\infty}dt|\phi_{out}|^{2}\nonumber \\
 & = & \frac{2\kappa_{d,1}}{\kappa_{d}^{2}}\int_{0}^{\infty}dt|\Omega(t)|^{2}e^{-\frac{2}{\kappa_{d}}\int_{0}^{t}dt'|g(t')|^{2}}\nonumber \\
 & = & \frac{\kappa_{d,1}}{\kappa_{d}}\left(e^{-\frac{2}{\kappa_{d}}h(0,0)}-e^{-\frac{2}{\kappa_{d}}h(0,\infty)}\right)\nonumber \\
 & = & \frac{\kappa_{d,1}}{\kappa_{d,0}+\kappa_{d,1}}\left(1-e^{-\frac{2}{\kappa_{d}}h(0,\infty)}\right).\label{eq:out-prac}
\end{eqnarray}
For strong or long driving pulse, $h(0,\infty)\gg1,$\textbf{ }the
retrieval efficiency reduces to the previously derived form $\frac{\kappa_{d,1}}{\kappa_{d,0}+\kappa_{d,1}}$.

To be more practical, we consider the case that not all excitation
are driven out of the cavity, which means either $c_{01}(\infty)$
or $c_{10}(\infty)$ does not equal to zero. The efficiency can be
obtained by giving $h(0,\infty)$ an finite value. Here, we shape
the driving field $\Omega(t)$ to retrieve the photon to the desired
mode $A_{in}(t)$ (the input shpae). Equaling $\sqrt{\frac{\kappa_{d,1}}{\kappa_{d,0}+\kappa_{d,1}}}A_{in}(t)$
and eq.\ref{eq:out} and their norm square integrals,
\begin{eqnarray}
\sqrt{\frac{\kappa_{d,1}}{\kappa_{d,0}+\kappa_{d,1}}}A_{in}(t) & = & i\frac{\sqrt{2\kappa_{d.1}}}{\kappa_{d}}\Omega(t)e^{-\frac{1}{\kappa_{d}}h(0,t)},
\end{eqnarray}
so
\begin{eqnarray}
\int_{0}^{t}dt'|A_{in}(t)|^{2} & = & 1-e^{-\frac{2}{\kappa_{d}}h(0,t)}.
\end{eqnarray}
We derive the optimal retrieval pulse shape
\begin{eqnarray}
\Omega(t) & = & -i\sqrt{\frac{\kappa_{d}}{2}}e^{h(0,t)/\kappa_{c}}A_{in}(t)\nonumber \\
 & = & -i\sqrt{\frac{\kappa_{d}}{2}}\frac{A_{in}(t)}{\sqrt{\int_{t}^{\infty}dt'|A_{in}(t')|^{2}}}.
\end{eqnarray}
For photon storage, it is the time reverse of the retrieve process
\cite{storage}. One can use driving pulse $\Omega^{*}(t_{r}-t)$
to store input pulse of shape $A_{in}\left(t\right)$ with maximal
efficiency.

\subsection{Transmission of the target photon}

The target photon ($a_{in}\left(t\right)$) can also be coupled to
the artificial atom mediated by the antenna under an EO drive. However,
when the two modes $a$ and $b$ in the artificial atom are designed
to fulfill phase-match condition with mode $c$, whether the target
photon can enter into mode $b$ of the artificial atom ($|1_{a}1_{b}\rangle$)
strongly depends on the quantum state of mode $a$. For sufficiently
large nonlinear coupling strength $g_{\mathrm{nd}}$, the degeneracy
of two-excitation states $|1_{a}1_{b}0_{c}\rangle$ and $|0_{a}0_{b}1_{c}\rangle$
will be removed, resulting in two new eigenstates with the form of
superposition of $|1_{a}1_{b}0_{c}\rangle$ and $|0_{a}0_{b}1_{c}\rangle$
and eigenenergiessplited by $2g_{\mathrm{nd}}$. The sum of the two
photon frequencies no longer equals to the resonant frequency of two-excitation
states. If the control photon has already been stored into mode $b$,
the target photon is no longer resonant with the transition from $|0_{a}1_{b}0_{c}\rangle$
to $|1_{a}1_{b}0_{c}\rangle$, thus will be blocked. Accordingly,
the phase of the target photon is controlled by the state of the stored
control photon in the artificial atom.

In this work, we take the artificial atom based on non-degenerate
three-wave mixing for constructing quantum phase gate, thus the total
system Hamiltonian is
\begin{eqnarray}
H & = & \omega_{\mathrm{d}}d^{\dagger}d+\omega_{\mathrm{a}}a^{\dagger}a+\omega_{\mathrm{a}}b^{\dagger}b+\delta_{c}c^{\dagger}c+\Omega a^{\dagger}d+g_{nd}abc^{\dagger}+h.c.
\end{eqnarray}
 For EO driving strength $\kappa_{A}\ll\Omega\ll g_{nd}$, the waveguide
is effectively over-coupled with the atom. The target photon couples
into and out from the atom for the control photon in state $|0\rangle$,
whereas transmit directly without entering the atom for control photon
in state $|1\rangle$. In this case, it is no longer necessary to
design the shape of the EO drive, but requires carefully choosing
an appropriate strength.

In the two-excitation subspace, the state can be described by a pure
state with a general form of the superposition of Fock states. For
mode $a$ in state $|1\rangle$ and very long lifetime, the single-photon
state is expressed as
\begin{eqnarray}
|\psi\rangle_{dbac} & = & c_{1010}|1010\rangle+c_{0110}|0110\rangle+c_{0001}|0001\rangle,
\end{eqnarray}
where $|mnkl\rangle=|m\rangle_{d}\otimes|n\rangle_{a}\otimes|k\rangle_{b}\otimes|l\rangle_{c}$.
The dynamics follows
\begin{eqnarray}
\frac{d}{dt}c_{mnkl} & = & \frac{d}{dt}\langle mnkl|\psi\rangle\nonumber \\
 & = & \langle mnkl|\frac{d}{dt}\psi\rangle\nonumber \\
 & = & -i\langle mnkl|H_{eff}|\psi\rangle\nonumber \\
 & = & \alpha_{d}\sum_{m'n'k'l'}c_{m'n'k'l'}\langle mnkl|d^{\dagger}d|m'n'k'l'\rangle+\alpha_{b}\sum_{m'n'k'l'}c_{m'n'k'l'}\langle mnkl|b^{\dagger}b|m'n'k'l'\rangle\nonumber \\
 &  & +\alpha_{a}\sum_{m'n'k'l'}c_{m'n'k'l'}\langle mnkl|a^{\dagger}a|m'n'k'l'\rangle+\alpha_{c}\sum_{m'n'k'l'}c_{m'n'k'l'}\langle mnkl|c^{\dagger}c|m'n'k'l'\rangle\nonumber \\
 &  & -i\Omega\left(\sum_{m'n'k'l'}c_{m'n'k'l'}\langle mnkl|a^{\dagger}d|m'n'k'l'\rangle+\sum_{m'n'k'l'}c_{m'n'k'l'}\langle mnkl|ad^{\dagger}|m'n'k'l'\rangle\right)\nonumber \\
 &  & -ig_{nd}\left(\sum_{m'n'k'l'}c_{m'n'k'l'}\langle mnkl|a^{\dagger}b^{\dagger}c|m'n'k'l'\rangle+\sum_{m'n'k'l'}c_{m'n'k'l'}\langle mnkl|abc^{\dagger}|m'n'k'l'\rangle\right)\nonumber \\
 & = & \alpha_{d}mc_{mnkl}+\alpha_{a}nc_{mnkl}+\alpha_{b}kc_{mnkl}+\alpha_{c}lc_{mnkl}\nonumber \\
 &  & -i\Omega\sqrt{m(n+1)}c_{(m-1)(n+1)kl}-i\Omega\sqrt{(m+1)n}c_{(m+1)(n-1)kl}\nonumber \\
 &  & -ig_{nd}\sqrt{nk(l+1)}c_{m(n-1)(k-1)(l+1)}-ig_{nd}\sqrt{(n+1)(k+1)l}c_{m(n+1)(k+1)(l-1)}.
\end{eqnarray}
For our two-photon case
\begin{eqnarray}
\frac{d}{dt}c_{1010} & = & \alpha_{d}c_{1010}+\alpha_{b}c_{1010}-i\Omega c_{0110}-i\phi_{in}(t),\label{eq:cme2-1}\\
\frac{d}{dt}c_{0110} & = & \alpha_{b}c_{0110}+\alpha_{a}c_{0110}-i\Omega c_{1010}-ig_{nd}c_{0001},\label{eq:cme2-2}\\
\frac{d}{dt}c_{0001} & = & \alpha_{c}c_{0001}-ig_{nd}c_{0110}.\label{eq:cme2-3}
\end{eqnarray}
The dynamics of the system depends on the initial state of the system.
Initially, we set $c_{1010}=c_{0110}=c_{0001}=0$ to solve the dynamics
of the system.
\end{document}