This question comes more from curiosity than a specific research problem. Let G be a group and S a finite symmetric generating set. By the WP(G,S) I mean the set of all words in the free monoid on S mapping to the identity of G. 


A classical result of Anissimov says that WP(G,S) is a regular language iff G is finite. Regular languages have rational generating functions, so I am asking:



> 
> Dooes rationality of the generating function of WP(G,S) imply G is finite?
> 
> 
> 


I believe, but didn't check, that rationality doesn't depend on the choice do S. 


I guess that my motivation is when is the generating function for probability of return to the origin at step n of a random walk rational?



Groups with a rational generating function for the word problem
I hope I'm also not misinterpreting the question, but it seems to me that the answer is yes. In fact the property of having a rational "walk generating function" characterizes finite graphs not only among Cayley graphs as in your question but also among the larger class of regular quasitransitive connected graphs (quasitransitive here means that the automorphism group acts with finitely many orbits). This is theorem 3.10 in ["Counting Paths in Graphs"](http://arxiv.org/abs/math/0012161) by L. Bartholdi, published in Enseign. Math. 45 (1999) 83-131. It is mentioned in the paper that the analogous question for *arbitrary* connected regular graphs is open.


