TITLE: Generalization of the Lefschetz fixed point theorem
QUESTION [9 upvotes]: I have encountered a certain generalization of the Lefschetz fixed point theorem as folklore, and I am hoping that someone out there knows its provenance or can otherwise refer me to a source where it is discussed or proved.  The statement of the theorem should look vaguely like this:
Let $X$ be a smooth, complete variety over $\mathbb{C}$ and $g$ an automorphism of $X$.  Suppose also that the fixed locus of $g$ is smooth and complete (but not necessarily discrete), and let $e(g)$ denote the Euler characteristic of this fixed locus.   Then
$$
e(g)=\sum _{i=0}^{\dim L} (-1)^i Tr (g | H^i(X)). 
$$
Any help or advice you can offer is much appreciated!

REPLY [9 votes]: One of the standard proofs of the Lefschetz formula proceeds by showing that the RHS of your equation computes the intersection number between the graph of $f$ and the diagonal inside $X \times X$. The usual case is when this intersection has expected dimension. The general case requires the excess intersection formula. Now, the normal bundle of the diagonal $\Delta$ in $X \times X$ is the tangent bundle of $\Delta = X$. After dividing by the normal bundle of $X^g$ in $X$, the excess intersection formula shows that the intersection number is given by the top Chern class of the tangent bundle of $X^g$. But this is just the topological Euler characteristic of $X^g$, $e(g)$. (This last fact is just the special case of your formula when $g = \mathrm{id}$!)