# Help with proof of factorization criterion

In a proof of the factorization criterion regarding sufficient statistics I came across the following derivation: Consider the set $A_s=[(y_1,..,y_n:s(y_1,..,y_n)=s]$ Now somewhere along the only if part of the proof a conditional probability is written as :$$\frac{g(s(y_1,...,y_n);\theta)h(y_1,...,y_n)}{P(S=s)}=$$ $$\frac{g(s(y_1,...,y_n);\theta)h(y_1,...,y_n)}{\sum_{\left(x_1,..,x_n\right)\in A_s} g(s(x_1,...,x_n);\theta)h(x_1,...,x_n)}=$$ $$\frac{g(s;\theta)h(y_1,...,y_n)}{g(s;\theta)\sum_{\left(x_1,..,x_n\right)\in A_s} h(x_1,...,x_n)}$$

Now I dont understand why the term $g(s;\theta)$ can be placed in front of the summation in the denominator as the summation is over all values of $(x_1,...,x_n)\in A_s$ and to me it seems as $g(s;\theta)$ depends on $(x_1,...,x_n)$.

Since $A_s=[x_1,..,x_n:s(x_1,..,x_n)=s]$ and in the denominator we sum over $(x_1,...,x_n) \in A_s$, then $s(x_1,..,x_n)=s$ (constant with respect to x's) for the values of $(x_1,...,x_n)$ involved in the denominator. Hence $g(s;\theta)$ is also constant for $(x_1,...,x_n) \in A_s$ and can be factored out of the summation.