# Legitimacy of reducing mod p a complex multiplication action of an elliptic curve?

I scoured Silverman's two books on arithmetic of elliptic curves to find an answer to the following question, and did not find an answer:

Given an elliptic curve E defined over H, a number field, with complex multiplication by R, and P is a prime ideal in the maximal order of H and E has good reduction at P. Is it legitimate to reduce an endomorphism of E mod P?

In the chapter "Complex Multiplication" of the advanced arithmetic topics book by Silverman, a few propositions and theorems mention reducing an endomorphism mod P.

A priori, this doesn't seem trivial to me. Sure, the endomorphism is comprised of two polynomials with coefficients in H. But I still don't see why if a point Q is in the kernel of reduction mod P, why is phi(Q) also there. When I put Q inside the two polynomials, how can I be sure that P is still in the "denominator" of phi(Q)?

(*) I looked at the curves with CM by sqrt(-1), sqrt(-2) and sqrt(-3), and it seems convincing that one can reduce the CM action mod every prime, except maybe in the case of sqrt(-2) at the ramified prime.

I'm not sure if there's a trivial way to see this. One answer is to use the fact that every rational map from a variety X / $\mathbb{Z}_p$ to an abelian scheme is actually defined on all of X (see for instance Milne's abelian varieties notes). Here, since the generic fiber is open in X you can apply this by viewing the map you started with as a rational map.
Let $\mathcal{E}$ denote the Neron model of $E$ over $R$ and $k=R/P$. Thus $\mathcal{E}$ is the unique (up to isomorphism) smooth commutative group scheme over $R$ with generic fiber $E$ such that for any smooth $X/R$ the natural map $\mathcal{E}(X)\to E(X_H)$ is an isomorphism. Then "$E$ mod $P$" is the special fiber $\mathcal{E}_k = \mathcal{E}\times_R k$. (This makes sense and is canonical even if $E$ has bad reduction at $P$.) Now take $X=\mathcal{E}$ in the definition of Neron model. Your endomorphism $\varphi$ is just an element of $E(E) = \mathcal{E}(\mathcal{E})$, so extends uniquely to a morphism $\tilde{\varphi}:\mathcal{E} \to \mathcal{E}$. Base extending $\tilde{\varphi}$ by $k$ yields the reduction $\overline{\varphi}: \mathcal{E}_k \to \mathcal{E}_k$. In particular, $\overline{\varphi}$ is defined (it is "legitimate"). It even makes sense when the reduction is bad at $P$, but of course then it is a map on special fibers of Neron models.