Finitely presented implies all homomorphisms to any finite group can be listed in finite time

Statement
Suppose $$G$$ is a finitely presented group having a finite presentation using a generating set $$S$$ and relation set $$R$$. Then, for any finite group $$K$$ and any set map from $$S$$ to $$K$$, it is possible to determine in finite time whether the set map extends to a homomorphism from $$G$$ to $$K$$.

Note that this implies that all homomorphisms to $$K$$ can be listed in finite time, because there are only finitely many candidate set maps from $$S$$ to $$K$$.

Similar facts

 * Finitely generated implies finitely many homomorphisms to any finite group

Applications

 * Finitely presented and residually finite implies solvable word problem
 * Finitely presented and conjugacy-separable implies solvable conjugacy problem

Proof idea
The idea is as follows: for any relation word (i.e., every element of $$R$$) check whether the image of that word, viewed as an element of $$K$$, is the identity element of $$K$$.