[MOVED HERE FROM MSE.]


The statement of the Grothendieck-Lefschetz fixed point theorem is well-known. For a proper algebraic variety $X$ over $\mathbb F\_q$,
$$\#X(\mathbb F\_q) =\sum\_i (−1)^i Tr(Fr\_X, H^i\_c(X, \mathbb Q\_l)).$$
Also known is the version for general constructible l-adic sheaves $\mathcal F$:
$$\sum\_{x\in X(\mathbb F\_q)} Tr(Fr\_x,\mathcal F\_x)=\sum\_i (−1)^i Tr(Fr\_X, H^i\_c(X, \mathcal F)).$$
Thirdly, K. Behrend proved an analog for the first formula in the context of algebraic stacks (replacing the scheme $X$ by a Noetherian algebraic stack $\mathcal X$).



> 
> Now my question is: is there a version of the second formula for an
>  algebraic stack $\mathcal X$ (with nice hypotheses if necessary)?
> 
> 
> 


It would seem natural, since the second formula is a generalization of the first, and the first is true in the context of algebraic stacks by Behrend's work. However, the second formula does not follow directly from the first in the case of schemes (as far as I know: I would be glad if it were true!), so I am not in the position to easily extend the proof of the second formula in the more general context of stacks.


Thank you in advance.


ADDED QUESTION: Moreover, why is the sum on the left of the second formula finite when the scheme (or stack) is not of finite type? Behrend speaks about this problem, but I do not find where he solves it, if he does.



Generalized Behrend version for Grothendieck-Lefschetz trace formula
This is Theorem 4.2 of Shenghao Sun's paper *$L$-Series of Artin stacks over finite fields*, Algebra & Number Theory **6** (2012) pp 47–122, doi:[10.2140/ant.2012.6.47](https://doi.org/10.2140/ant.2012.6.47), arXiv:[1008.3689](https://arxiv.org/abs/1008.3689).



> 
> Let $f:\mathscr X\_0\to\mathscr Y\_0$ be a morphism of $\mathbb F\_q$-algebraic stacks, and let $K\_0\in W^{-,stra}\_m(\mathscr X\_0,\overline{\mathbb Q}\_{\ell})$ be a convergent complex of sheaves.
>  Then 
> 
> 
> (i) (Finiteness) $f\_!K\_0$ is a convergent complex of sheaves on
>  $\mathscr Y\_0,$ and 
> 
> 
> (ii) (Trace formula) $c\_v(\mathscr X\_0,K\_0)=c\_v(\mathscr Y\_0,f\_!K\_0)$
>  for every integer $v\ge1.$
> 
> 
> 


Here $c\_v$ is the sum of the trace of the $v$th power of Frobenius. Applying this in the case where $\mathscr Y\_0$ is a point gets you what you want.


