Valiant defined $ \#P$ in terms of a *counting TM*, which is a NTM that outputs the number of solutions [1].

I am a bit stuck with the following two questions: Let’s say I have a decision problem $ X$ , the corresponding counting problem $ \#X$ , and an enumeration algorithm $ E$ that enumerates the solutions of $ X$ in polynomial output complexity.

- If $ w$ is a witness for $ X$ that I can verify in polynomial time, does this imply that $ \#X$ is in $ \#P$ ?
- Does the existence of $ E$ imply that $ \#X$ is in $ \#P$ ?

For both questions, I think the answer is yes because they imply that there is a NTM which could be modified to count the number of witnesses. However, I feel like I cannot argue this properly and that I might miss something.

[1] Leslie G. Valiant: The Complexity of Computing the Permanent. Theor. Comput. Sci. 8: 189-201 (1979)