Post's correspondence problem for hyperbolic and virtually nilpotent groups

Post's Correspondence Problem (the PCP) is a classical decision problem in theoretical computer science that asks whether for pairs of free monoid morphisms $g, h\colon\Sigma^*\to\Delta^*$ there exists any non-trivial $x\in\Sigma^*$ such that $g(x)=h(x)$. Post's Correspondence Problem for a group $\Gamma$ takes pairs of group homomorphisms $g, h\colon F(\Sigma)\to \Gamma$ instead, and similarly asks whether there exists an $x$ such that $g(x)=h(x)$ holds for non-elementary reasons. The restrictions imposed on $x$ in order to get non-elementary solutions lead to several interpretations of the problem; we consider the natural restriction asking that $x \notin \ker(g) \cap \ker(h)$ and prove that the resulting interpretation of the PCP is undecidable for arbitrary hyperbolic $\Gamma$, but decidable when $\Gamma$ is virtually nilpotent. We also study this problem for group constructions such as subgroups, direct products and finite extensions. This problem is equivalent to an interpretation due to Myasnikov, Nikolev and Ushakov when one map is injective.


Introduction
Post's Correspondence Problem (the PCP) is a prominent undecidable problem in Computer Science.It takes as input a pair of free monoid morphisms g, h : Σ * → ∆ * , and asks if there exists any non-trivial x ∈ Σ * such that g(x) = h(x).Undecidability was proven by Post, from whom it takes its name [35], and we refer the reader to the survey of Harju and Karhumäki for background and applications [19] (see also the recent article of Neary [32]).The prominence of the PCP is due to its role as a simple source of undecidability: for matrix (semi)group decision problems, tiling problems, questions about context-free grammars, and in many other contexts.
In this paper we consider the PCP for groups, and define it as follows.Let Σ be a finite alphabet and F (Σ) the associated free group, Γ a group, and g, h : F (Σ) → Γ group homomorphisms.The equaliser of g, h is the subgroup Eq(g, h) = {x ∈ F (Σ) | g(x) = h(x)} of F (Σ). Post's Correspondence Problem for Γ asks whether there exists x ∈ Eq(g, h) \ (ker(g) ∩ ker(h)).An equivalent formulation of the PCP and the reason why we remove ker(g) ∩ ker(h) from the equaliser are given in Section 2. We study the PCP for entire classes of groups Γ, and prove the following theorems.
Theorem A. The PCP for hyperbolic groups is undecidable.
The proof uses the undecidability of the subgroup membership problem, via a version of Rips' construction.Our full result is stronger than we state here, proving undecidability of the "binary" PCP for torsion-free hyperbolic groups; see Theorem 3. 3.
One motivation to study the PCP in hyperbolic groups comes from the fact that the PCP for free groups can be traced to Stallings in the 1980s (see [41]), and while recent results settle the PCP for certain classes of free group maps [4,[8][9][10]30], its solubility for general free group maps remains an important open question ( [15,Problem 5.1.4]).
Secondly, we have a decidability result for virtually nilpotent groups.
Theorem B. The PCP is decidable for finitely generated virtually nilpotent groups.
To prove Theorem B we consider the non-homogeneous PCP (NPCP), which is analogous to the generalised PCP (GPCP) in free monoids.Here, we prove that for a group K, the PCP for virtually K groups reduces to the NPCP and PCP for K (Proposition 4.3).This proof is similar to the proof that the conjugacy problem for virtually K groups reduces to the twisted conjugacy problem for K. Indeed, the twisted conjugacy problem itself reduces to the NPCP, suggesting a connection between the PCP and the conjugacy problem.
Turing reduction.Many of our results have the form: the decidability of a certain algorithmic problem, P say, implies the decidability of a different algorithmic problem, Q say.In each case, we actually prove that Q Turing reduces to P, i.e. that we can use an oracle for P to solve Q. Lemma 4.2 further proves that two problems are Turing equivalent.Although the language of Turing reduction is standard in complexity theory, we chose the more informal (but still correct) language on implications of decidability in order to be more accessible to a wider audience.
Outline of the article.In Section 2 we introduce the version of the PCP we are working with.In Section 3 we prove Theorem A. In Section 4 we connect the NPCP for a group K to the PCP for virtually K groups.In Section 5 we consider the NPCP for A groups and the PCP for virtually A groups, where A is the class of recursively presented groups in a variety of groups.These considerations allow us to prove Theorem B.
In Section 6 we consider a different interpretation of the PCP for groups, which we call the verbal PCP and is due to Myasnikov, Nikolaev and Ushakov, and prove decidability of this problem for torsion-free nilpotent groups.
The first and third named authors were partially supported by EPSRC Standard Grant EP/R035814/1.The first named author would like to thank Bettina Eick for helpful discussions.The second named author acknowledges the support of the London Mathematical Society and the Heilbronn Institute for Mathematical Research.The second and third named authors are also grateful to the University of St Andrews, who hosted them while completing this work.All authors thank the anonymous referee for many useful comments and suggestions.

Post's Correspondence Problem for Groups
We will often refer to the PCP for free monoids as the 'classical PCP'.
Here we define our main version of PCP for groups, formally expanding on the initial definition given in the Introduction.A recursive presentation is a presentation with a finite generating set and a recursive (e.g.finite) set of relators.A group is recursively presented if it admits a recursive presentation; recursively presented groups form the largest class of groups for which standard notions of computation are defined, and hence we restrict our definition and studies to this class.
An instance of the PCP is a four-tuple I = (Σ, Γ, g, h), where Σ is a finite alphabet and F (Σ) is the associated free group, Γ is a group given by a recursive (e.g.finite) presentation, and g, h : F (Σ) → Γ are group homomorphisms.The equaliser of g, h is the subgroup Eq(g, h) The (kernel-based) PCP.Post's Correspondence Problem for groups itself, hereafter the PCP or kernel-based PCP, is the decision problem: Given I = (Σ, Γ, g, h), is the group Eq(g, h)/(ker(g) ∩ ker(h)) trivial?By a solution to I we mean an element x ∈ Eq(g, h) \ (ker(g) ∩ ker(h)).Solutions are therefore those elements x ∈ F (Σ) that correspond to nontrivial cosets x(ker(g) ∩ ker(h)) ∈ Eq(g, h)/(ker(g) ∩ ker(h)).
If at least one of g and h is injective we get ker(g) ∩ ker(h) = {1}, so the PCP has the same statement as the classical one ("is there any x = 1 such that g(x) = h(x)?").However, when neither map is injective, ker(g) ∩ ker(h) is always non-trivial as either F (Σ) is cyclic, and here all non-trivial subgroups have non-trivial intersection, or F (Σ) is non-cyclic whence ker(g) ∩ ker(h) contains the non-trivial subgroup [ker(g), ker(h)] (see [9,Lemma 1]), and so while the non-triviality of Eq(g, h) is established, it does not capture the core of the problem.We therefore quotient out by ker(g)∩ ker(h) as we wish to consider the case when neither map is injective.
How we deal with non-injective maps is important, as considering the classical PCP, this is where we expect the undecidability to lie: The standard undecidability proofs are based on pairs of non-injective maps, while all known proofs of undecidability of the PCP for pairs of injective maps proceed via reversible Turing machines and are in comparison extremely technical [25,27,40].We indeed use pairs of non-injective maps in our undecidability proof, Theorem A (non-injectivity is explained after the proof).
Properties of the PCP.We now note a couple of interesting properties of groups with decidable PCP.Firstly, groups with decidable PCP have decidable word problem.
Lemma 2.1.If a recursively presented group has decidable (kernel-based) PCP, then it has decidable word problem.
Proof.Let Γ have recursive presentation X | R , and let w be a word over X.Consider the PCP instance I = ({a}, Γ, g, g), so take as the domain free group the infinite cyclic group Z, generated by a, and let g = h with g(a) = w.Then Eq(g, g) = a , and if there exists a solution to this PCP instance, then Eq(g, g) = a = ker(g), so w = 1 in Γ, while if no solution exists then Eq(g, g) = a = ker(g), so w = 1 in Γ.
Next, the decidability of PCP is preserved under taking subgroups.Lemma 2.2.Suppose H is a finitely generated subgroup of a recursively presented group Γ.If the PCP is decidable for Γ, then it is decidable for H.
Proof.By Higman's Embedding Theorem, H is recursively presented, so the PCP for H makes sense.
The verbal PCP.Myasnikov, Nikolaev and Ushakov have previously defined and studied a version of the PCP for groups [31], which we call the verbal PCP and describe at length in Section 6.In particular, they did not prove undecidability for any classes of groups.
The key difference between our interpretation and theirs is how pairs of non-injective maps are dealt with: the verbal PCP mitigates against ker(g) ∩ ker(h) automatically being non-trivial by considering varieties of groups.However, this mitigation is not robust enough to deal with Γ being non-elementary hyperbolic, or more generally not being contained in any proper variety of groups.We discuss the differences further in Section 6.

Hyperbolic groups
Hyperbolic groups are possibly the most studied class of infinite discrete groups in the last few decades.In particular, there has been significant work on their algorithmic properties, and both decidability and complexity results have been obtained by exploiting their geometry and combinatorics (thin triangles, regular geodesics, etc).For an introduction to hyperbolic groups, [20,Chapter 6] offers an account suitable for algorithmic purposes.The most fundamental results here are that in any hyperbolic group the word and conjugacy problem are solvable in linear time [12].
More recently, important work on algorithms in hyperbolic groups has been inspired by developments in Computer Science.For example, work of Plandowski, Jeż, Diekert and others on PSPACE algorithms to solve equations in free monoids and groups using compression [14] has been applied to prove that the compressed word problem and compressed simultaneous conjugacy problem in hyperbolic groups are solvable in polynomial time [21].Compression techniques, together with the decidability of systems of equations by Dahmani and Guirardel [13], also led to the characterisation of solution sets to such systems from a language-theoretic point of view [6,7].As another example, the knapsack problem is a fundamental algorithmic problem in Computer Science, and Lohrey has recently proven that the analogous problem for hyperbolic groups is LOGSPACE-reducible to a context-free language [29].
However, there are exceptions to the decidability results mentioned above.For example, there is no algorithm to compute finite generating sets for intersections of finitely generated subgroups [37].More pertinent to this paper is the membership problem for subgroups, which for a fixed recursively presented group Γ = X | R and finitely generated subgroup A = a 1 , . . ., a n of Γ, is the problem of determining if a word w ∈ F (X) defines an element of A; the word problem is the special case of A = {1}.We say Γ has undecidable subgroup membership problem if it has a finitely generated subgroup with undecidable membership problem.Again, this problem is undecidable in general for hyperbolic groups [37].The undecidability of the subgroup membership problem will be used in Theorem 3.3 below.
Rips' construction.Our proof on the PCP for hyperbolic groups is based on a version of Rips' construction due to Belegradek and Osin [2].The classical Rips' construction takes as input a finitely presented group Q and constructs a short exact sequence 1 → N → Γ → Q → 1 where Γ is hyperbolic and N is finitely generated; properties of Q impact N , in particular if Q has undecidable word problem then the subgroup N has undecidable membership problem.Belegradek and Osin improved this as follows.

Theorem 3.1 ([2]
).For every finitely presented group Q and hyperbolic group H there exists a short exact sequence We can view this as the diagram in Figure 1.This is stronger than the classical setting as now properties of both Q and H impact N ; in particular, if H has trivial abelianisation then so does N .We now construct the seed group H used in the proof of Theorem 3.3.

Lemma 3.2.
There exists a 2-generated torsion-free hyperbolic group with trivial abelianisation.
Proof.As remarked by Kapovich and Wise [24, page 2], the presentation so defines a hyperbolic group with trivial abelianisation.As the presentation is small cancellation and neither of the two relators are proper powers, the group is torsion-free [23,Theorems 3 & 4].
The PCP for hyperbolic groups.Placing restrictions on the alphabet Σ, group Γ and maps g and h allows us to investigate the boundary between decidability and undecidability.The binary PCP is the PCP restricted to those instances I = (Σ, Γ, g, h) where |Σ| = 2.For X a class of recursively presented groups, the PCP for X is the PCP restricted to those instances I = (Σ, Γ, g, h) where the group Γ is in X.We can intersect such classes of instances, and so for example can consider the binary PCP for torsion-free hyperbolic groups.
It is interesting to contrast this result to the classical binary PCP (for free monoids), which is decidable [17].The binary PCP for free groups remains open.
Theorem 3.3.The binary PCP for torsion-free hyperbolic groups is undecidable.
Proof.Take H in Theorem 3.1 (i.e. in Belegradek-Osin's Rips' construction) to be a 2-generated torsion-free hyperbolic group with trivial abelianisation, which we know exists by Lemma 3.2.As N is a homomorphic image of H, this group is also 2-generated with trivial abelianisation.Now, take Q to be torsion-free with undecidable word problem (such a group exists, see for example [11]).Then Γ is torsion-free [2, Theorem 1.1.d].
For any element y ∈ Γ \ {1}, we define the instance I y = ({a, b}, Γ, g, h) of the binary PCP for Γ by setting g, h : F (a, b) → Γ to be the maps defined by g(a) = 1, g(b) = y and h(a), h(b) to be generators for N ≤ Γ; that is, h(a), h(b) = N .We will now show that y ∈ N if and only if Eq(g, h)/(ker(g) ∩ ker(h)) is non-trivial.
Suppose first that y ∈ N .As Q is torsion-free, we have that y n ∈ N for all n.Therefore, Image(g) ∩ Image(h) = y ∩ N = {1} is trivial, so Eq(g, h)/(ker(g) ∩ ker(h)) is trivial.
Suppose, for the other implication, that y ∈ N ; we will prove that Eq(g, h)/(ker(g) ∩ ker(h)) is non-trivial.Since h(b) ∈ N and y ∈ N , as N has trivial abelianisation, we get y(h(b) ∈ ker(g), we get that Eq(g, h)/(ker(g) ∩ ker(h)) is non-trivial, as claimed.
Therefore, Eq(g, h)/(ker(g) ∩ ker(h)) is trivial if and only if y ∈ N .As Q has undecidable word problem, N has undecidable membership problem.The result follows.
Theorem A follows immediately from Theorem 3.3, as for example the binary PCP is a special case of the PCP.
Note that neither of the maps g, h : F (a, b) → Γ in the proof of Theorem 3.3 are injective.For g, this is because the image is cyclic so clearly not free of rank 2. For h, this is because the image is the group N , which has trivial abelianisation so again not free of rank 2.

Finite index overgroups and the NPCP
Let K be a finitely generated group.A group Γ is virtually K if it contains an embedded copy of K as a finite index subgroup.Then Γ is also finitely generated, so Γ = ∆ with |∆| < ∞.When considering a virtually K group Γ as an input to an algorithm, we shall take a finite generating set ∆ K ⊆ ∆ for K as part of this input.
In this section we give a general theorem for proving decidability of the (kernel-based) PCP for virtually K groups, which we require for Theorem B. This method is based on the non-homogeneous PCP (NPCP).In agreement with how we treat PCP in the rest of the paper, NPCP will ask for nontrivial solutions x = 1.Our main result on the NPCP is Proposition 4.3; our use of the NPCP here is entirely functional and the assumption that x = 1 is required for the proof.The same problem, but allowing solutions x = 1, was defined and studied by Myasnikov, Nikolaev and Ushakov [31], and we denote their version by NPCP 1 .In the context of Proposition 4.3, NPCP is essentially equivalent to NPCP 1 , as Lemma 4.2 shows.
The NPCP.An instance of the NPCP is a tuple with g, h : F (Σ) → Γ group homomorphisms and u 1 , u 2 , v 1 , v 2 ∈ Γ.The NPCP is the decision problem: The identity above can be rewritten in any group as ug 2 , but we keep the statement in terms of u i and v i as this definition corresponds to what is called the "generalised PCP" (GPCP) for free monoids.However, we use the "non-homogeneous" phrasing instead, as for our definition of the (kernel-based) PCP for groups this is a generalisation of the PCP only when one of g or h is injective (under this constraint, one takes Proof.Let Γ be a finitely presented group.By the universal property of free groups, there exists a set Σ with corresponding free group F (Σ), and a surjective homomorphism g : F (Σ) → Γ.Then let g = h, and observe that the instance (Σ, Γ, g, g, u, 1, 1, v) of the NPCP has a solution if and only if u, v ∈ Γ are conjugate.
We end our introduction to the NPCP by connecting it to the NPCP 1 , as defined by Myasnikov, Nikolaev and Ushakov.This lemma means that in the statement of Proposition 4.3, either of NPCP or NPCP 1 can be used.Lemma 4.2.Let Γ be a recursively presented group and suppose the (kernelbased) PCP is decidable for Γ.Then the NPCP is decidable for Γ if and only if NPCP 1 is decidable for Γ.
Proof.Note that the word problem for Γ is decidable by Lemma 2.1, since Γ has decidable PCP.Note also that an instance of the NPCP is also an instance of the NPCP 1 , and vice versa.In the following, we fix an "instance" and write I for it when viewing it as an instance of the NPCP, and I 1 when viewing it as an instance of the NPCP 1 .
Suppose the NPCP is decidable for Γ.Let I 1 be an instance of the NPCP 1 ; by assumption we may solve the associated instance I of the NPCP.If I has a solution x, then this will also be a solution to I 1 .If I has no solutions, then I 1 has a solution if and only if x = 1 is a solution to I 1 ; this is equivalent to the identity u 1 u 2 = v 1 v 2 holding in Γ, which we can check as Γ has decidable word problem.Hence, we may solve I 1 as required.Now suppose the NPCP 1 is decidable for Γ.Consider an instance I = (Σ, Γ, g, h, u 1 , u 2 , v 1 , v 2 ) of the NPCP; by assumption we may solve the associated instance I 1 of the NPCP 1 .Firstly, assume u 1 u 2 = v 1 v 2 in Γ; then x = 1 cannot be a solution, so I 1 and I have the same solution sets, and so we can solve I as we can solve I 1 .Secondly, assume u 1 u 2 = v 1 v 2 in Γ; then I 1 will have solution x = 1 but might not return any other solution.We proceed by determining if g, h are injective (standard algorithms do this for us, e.g.Nielsen reduction or Stallings' folding algorithm).If both g, h are non-injective then any x ∈ ker(g) ∩ ker(h) is also a solution, and moreover {1} = ker(g) ∩ ker(h) (this is clear if ker(g), ker(h) is cyclic, while otherwise {1} = [ker(g), ker(h)] ≤ (ker(g) ∩ ker(h))) so there exists a non-trivial solution; hence we can solve I.If one of g, h is injective, define the word , and the map f : F (Σ) → Γ by f (x) = wg(x)w −1 for all x ∈ F (Σ).This gives an instance J = (Σ, Γ, f, h) of the PCP for Γ and, as g or h is injective, x ∈ F (Σ) is a solution to J if and only if it is a solution to I. By hypothesis we can solve J, so we can solve I as required.
Finite index overgroups.We now apply the NPCP to the problem of solving the PCP in finite index overgroups (Proposition 4.3).Our proof uses coset enumeration; this classical algorithm takes as input a finite presentation of a group Γ and a finite generating set of a finite index subgroup K of Γ, and outputs a representative for each left (say) coset of K in Γ [22,Chapter 5].The group Γ acts on these cosets by left multiplication, and an element x ∈ Γ is contained in K if and only if it fixes the trivial coset 1K.This permutation representation therefore gives a solution to the membership problem for such a subgroup K (as defined in Section 3).Proposition 4.3.Let K be a finitely presented group.If the (kernel-based) PCP and the NPCP are decidable for K, then the (kernel-based) PCP is decidable for virtually K groups.
Proof.Let Γ be a group that contains K as a finite index subgroup and let I = (Σ, Γ, g, h) be an instance of the PCP for Γ.
As K has finite index in Γ, there exists a finite index subgroup N K of F (Σ) such that g(N K ) ≤ K and h(N K ) ≤ K (for example, take N K to be g −1 (K)∩ h −1 (K)).As explained in the preamble, as K has finite index in Γ, we can algorithmically determine membership in K, and so by enumerating all finite index subgroups of F (Σ) and then computing a basis for each, we can compute a finite basis Σ K for some such subgroup N K (this basis is used implicitly throughout the following) as well as a set of coset representatives p 1 , . . ., p n for N K in F (Σ) (via coset enumeration).
We therefore have an instance I ′ = (Σ K , K, g| N K , h| N K ) of the PCP for K.By assumption, this problem is decidable.Moreover, its solutions correspond precisely to solutions to I that are contained in N K , as supposing x ∈ N K , then g| N K (x) = h| N K (x) if and only if g(x) = h(x), and x ∈ ker(g| N K ) ∩ ker(h| N K ) if and only if x ∈ ker(g) ∩ ker(h).Therefore, we can determine if there exists some solution x ∈ N K to I. Our next step is therefore to run the PCP algorithm for I ′ , and if such a solution exists then we output that I has a solution for Γ.Now assume that there are no solutions to I belonging to N K .We consider potential solutions x ∈ Eq(g, h) \ N K ; every potential solution x decomposes as p i q, where p i ∈ N K , i ∈ {1, . . ., n}, is one of the pre-computed coset representatives of N K and q ∈ N K , and so every potential solution x is of one of two forms: (1) x = p i for some i (so x belongs to a finite set of known constants), or (2) x = p i q for some i and some q ∈ N K \ {1}.
Consider the potential solutions of type (1).As K has decidable NPCP, it has decidable word problem.As we can determine membership of K for elements of Γ, the group Γ also has decidable word problem.Hence, for each p i we can determine if p i ∈ Eq(g, h).Therefore, for each p i we can determine if there exists a potential solution of type (1).
Consider the potential solutions of type (2).If p i N K contains a potential solution x = p i q then h(p i ) −1 g(p i ) = h(q)g(q) −1 ∈ K, and so ) is an instance of the NPCP for K (as the constants are in K).Then, by rearranging g(p i )g(q) = h(p i )h(q) and noting that q ∈ N K \ {1}, we see that x = p i q is a potential solution of type (2) if and only if q is a solution to I (i) NPCP .By assumption, we can determine if the instance I (i) NPCP of the NPCP has a solution.Therefore, for each p i we can determine if there exists a potential solution of type (2), first by determining if h(p i ) −1 g(p i ) ∈ K, and then by determining if NPCP has a solution.Now, suppose x i , x ′ i ∈ Eq(g, h) ∩ p i N K are potential solutions corresponding to the same p i .Then x ′ i is a solution to I if and only if x i is a solution to I, and to see this note that them being potential solutions gives us that g(x i ) = h(x i ), g(x ′ i ) = h(x ′ i ), and x −1 i x ′ i = q ∈ N K .These give us that g(q) = h(q), and, by applying the assumption I has no solutions in N K , we have that q ∈ ker(g) ∩ ker(h).Therefore, x ′ i is a solution to I if and only if x ′ i = x i q ∈ ker(g) ∩ ker(h), if and only if x i ∈ ker(g) ∩ ker(h), if and only if x i is a solution to I, as required.
Hence, for fixed i we can determine if there exists some potential solution x ∈ Eq(g, h) ∩ p i N K , and moreover we can find such an element (by first checking if p i is such an element, and if not then by enumerating the nontrivial elements of N K and then using the word problem for K to check if each given element is a solution to I (i) NPCP ).Our algorithm therefore proceeds by looping through the p i , and finding an element x i ∈ Eq(g, h) ∩ p i N K , if one exists, as discussed above.These finitely-many potential solutions (at most one for each p i ) are stored in a list L PS .Crucially, by the above paragraph, I contains a solution if and only if L PS contains a solution.
We now loop through the list L PS .So, let x i be a potential solution in L PS .As the word problem for K is decidable, the word problem for Γ is decidable, so we can determine if x i ∈ ker(g)∩ ker(h).If x i ∈ ker(g)∩ ker(h), then x i is a solution to I, so output that I has a solution and terminate the algorithm.If x i ∈ ker(g) ∩ ker(h), then, by the above paragraph, Eq(g, h) ∩ p i N K contains no solutions to I. Therefore, move on to the next x i in the list.If the loop ends with no solution being detected, I has no solutions and so output this fact and terminate the algorithm.

Virtually nilpotent groups and virtually A groups
In this section we prove Theorem B, on virtually nilpotent groups.Like hyperbolic groups, finitely generated nilpotent groups have decidable word and conjugacy problems [3].However, most similarities with hyperbolic groups end here.Unlike with hyperbolic groups, the satisfiability of systems of equations in (free) nilpotent groups is undecidable [38], and many papers have followed this discussing different types of equations in various nilpotent groups [16,18,36,39].In addition, the knapsack problem is undecidable [26].On the other hand, and again contrasting with hyperbolic groups, the subgroup membership problem is decidable, and there exists an algorithm to compute generating sets for intersections of finitely generated subgroups [1,28] (many similar positive results extend to polycyclic groups).
Therefore, from an algorithmic viewpoint, hyperbolicity and nilpotency are somewhat opposite.Since the PCP is undecidable for hyperbolic groups, this intuition suggests it is decidable for nilpotent groups.This is indeed the case, with Myasnikov, Nikolaev and Ushakov proving decidability [31,Theorem 5.8] (their proof actually addresses our definition of the PCP, rather than theirs, which is a mistake in their exposition).The purpose of this section is to extend Myasnikov, Nikolaev and Ushakov's result to virtually nilpotent groups (i.e.groups containing a nilpotent subgroup of finite index).

Varieties of groups.
A variety of groups is a class of groups A closed under taking subgroups, homomorphic images and unrestricted direct products.Equivalently, a class of groups A is a variety if for all free groups F there exists a subset w A ⊂ F such that the elements of A which are homomorphic images of F are precisely the groups G such that for every homomorphism φ : F → G, we have w A ⊆ ker(φ).We call the set of words w A the laws (or identities) for A. A variety is proper if it is not simply the class of all groups.
Given a group Γ, we can define its "laws" as follows.For some infinite set of variables Σ ∞ = {X 1 , X 2 , . ..} and a finite word w = w(X 1 , . . ., X k ) ∈ F (Σ ∞ ) on these variables, denote by Γ w the set of all the values w takes in Γ; that is, Γ w = {w(g 1 , . . ., g k ) | g i ∈ Γ}.A word w = w(X 1 , . . ., X k ) as above is a law (or identity) in Γ if Γ w = {1}, or equivalently, w(g 1 , . . ., g k ) = 1 in Γ for any choice of g 1 , . . ., g k ∈ Γ.A variety A is then simply the class of all those groups Γ for which w A are laws in Γ.
For example, the commutator [X 1 , X 2 ] is a law in any abelian group, and higher commutators are laws in the appropriate class nilpotent groups.Thus the classes of all groups, abelian groups, nilpotent groups (of arbitrary class or of fixed class c), soluble groups (of arbitrary derived length or of fixed derived length d), and periodic groups (of arbitrary exponent or fixed exponent e) each form a variety.
Varieties have free objects: If F (Σ) is a free group, we write w A for the minimal normal subgroup of F (Σ) such that F (Σ)/ w A is in A, and so the quotient F A (Σ) := F (Σ)/ w A is free of rank |Σ| in this variety.
Most of our proof of Theorem B is in the setting of the very general world of varieties of groups; as nilpotent groups form a variety, the results we prove are immediately applicable to nilpotent groups.We refer the reader to H. Neumann's classic text for background and definitions on varieties of groups [33], but a reader interested in just nilpotent groups can simply take A in the following to be the class of nilpotent groups.
Varieties of recursively/finitely presented groups.The PCP is only defined for finitely generated recursively presented groups, while non-trivial varieties necessarily contain non-finitely generated groups.The following definitions are therefore needed to discuss the PCP for varieties of groups.By the weak variety of recursively (finitely) presented groups A we mean all the recursively (finitely) presented groups in a given variety B; we further call A a variety of recursively (finitely) presented groups, i.e. we drop the "weak", if for all |Σ| < ∞ the free objects F B (Σ) are contained in A. In this case, we associate both the laws of A and B, i.e. w A := w B , and the free objects of A and B, i.e.F A (Σ) := F B (Σ).
We consider virtually A groups, for A a variety of recursively presented groups, and prove that if we can solve two specific algorithmic problems for A groups then we can solve the PCP for virtually A groups.In particular, we can solve these problems in nilpotent groups, so Theorem B follows.
Like in Section 4, when considering a virtually A group Γ as an input to an algorithm, we shall take a finite generating set ∆ K ⊆ ∆ for the finite index subgroup K ∈ A as part of this input.
For A a variety of recursively presented groups, the PCP for A, written A-PCP, is the PCP restricted to those instances I = (Σ, Γ, g, h) where the group Γ is in A. We define the non-homogeneous PCP (see Section 4) NPCP for A, written A-NPCP, analogously.

5.1.
The NPCP for varieties of groups.In this section we give certain conditions which imply that the NPCP is decidable for a variety of recursively presented groups.
Our conditions which imply that the A-NPCP is decidable are as follows.These conditions do not hold for the varieties of all recursively or finitely presented groups, thus we may assume the word "proper" in the statement.Note also that for any instance I of the A-PCP, the subgroup w A ≤ F (Σ) generated by the laws of A is contained in Eq(g, h) and so (1) may be viewed as requesting a finite generating set for the quotient Eq(g, h)/ w A .Proposition 5.1.Let A be a (proper) variety of recursively or finitely presented groups.Suppose the following hold.
(1) There exists an algorithm with input an instance I = (Σ, K, g, h) of the A-PCP, and output a finite set S ⊂ F (Σ) such that Eq(g, h) = S, w A .(2) There exists an algorithm with input a group K ∈ A, a pair of finitely generated subgroups A, B < K, and an element x ∈ K, and which determines if x is contained in the product of the subgroups A and B, i.e. if x ∈ AB.
Then the A-NPCP is decidable.
Our proof of Proposition 5.1 needs a preliminary setup.
The verbal product V P A (A, B) of groups A, B ∈ A, as defined by H. Neumann [33,Definition 18.31], plays the role of a free product in the variety A. In particular, the group V P A (A, B) is contained in A if A, B ∈ A, and both A and B embed into this group.If A is instead a variety of recursively/finitely presented groups, then V P A (A, B) is contained in A if A, B ∈ A as the verbal product is the quotient of the free product A * B by (the subgroup generated by) the laws of A and so is recursively/finitely presented.In particular, writing F A (α, ω) for the free group in the variety A over the alphabet {α, ω}, if We start with an instance I NPCP = (Σ, K, g, h, u 1 , u 2 , v 1 , v 2 ) of the A-NPCP and consider the instance of the A-PCP, where g ′ and h ′ are defined as follows.
We now connect the solutions of I NPCP to those of I PCP .
Lemma 5.2.A word y ∈ F (Σ) \ {1} is a solution to I NPCP if and only if the word αyω is a solution to I PCP .
Proof.Note first that the element αkω of V P A (K, F A (α, ω)) is non-trivial for all k ∈ K.This is because there is a natural projection V P A (K, F A (α, ω)) ։ F A (α, ω) taking αkω to αω = 1 [33,Paragraph 18.33].It follows that αyω ∈ ker(g ′ ) ∩ ker(h ′ ) for all y ∈ F (Σ), because the images of αyω under g ′ and h ′ have the required form αkω, k ∈ K. Therefore, it is sufficient to prove that y is a solution to I NPCP if and only if αyω ∈ Eq(g ′ , h ′ ).
Starting with y being a solution to I NPCP , we obtain the following sequence of equivalent identities: Therefore αyω is a solution to I PCP , so the claimed equivalence follows.
We now prove Proposition 5.1.Recalling that w A denotes the minimal normal subgroup of F (Σ) such that F A (Σ) = F (Σ)/ w A is in A, we write π (Σ,A) : F (Σ) → F A (Σ) for the associated homomorphism.For an instance I = (Σ ′ , K ′ , g ′ , h ′ ) of the A-PCP, we have w A ≤ ker(g ′ ) ∩ ker(h ′ ) and so there exist maps g ′ A , h ′ A : F A (Σ ′ ) → K ′ such that g ′ and h ′ decompose as ′ A π (Σ ′ ,A) and h ′ A π (Σ ′ ,A) , respectively.In the following proof, we consider the equaliser Eq(g ′ A , h ′ A ), which is equal to the quotient Eq(g ′ , h ′ )/ w A .Proof of Proposition 5.1.Let I NPCP = (Σ, K, g, h, u 1 , u 2 , v 1 , v 2 ) be a given instance of the A-NPCP.The algorithm begins by computing the instance I PCP as in the preliminary setup.By construction, I PCP is an instance of the A-PCP, and so next apply the algorithm of (1) to compute a finite subset S of F (Σ ′ ), where Σ ′ = Σ ⊔ {α, ω}, such that Eq(g ′ , h ′ ) = S, w A .Consider the subgroups P := Eq(g ′ A , h ′ A ) and Q := F A (Σ) of F A (Σ ′ ), which are given in terms of the explicit finite generating sets S ′ = {s w A | s ∈ S} and Σ.Finally, writing P ω for ωP ω −1 , use the algorithm of (2) to determine if the element ωα is contained in the product of subgroups P ω Q ⊆ F A (Σ ′ ).
The result now follows from the following claim: The element αω ∈ F A (Σ ′ ) is contained in the product P ω Q if and only if I NPCP has a solution.To prove the claim, note that ωα ∈ P ω Q if and only if there exist some p ∈ P, q ∈ Q such that ωα = ωpω −1 q, or equivalently, αq −1 ω = p ∈ Eq(g ′ A , h ′ A ).By taking y A := q −1 , this holds if and only if there exists some y A ∈ F A (Σ) such that αy A ω ∈ Eq(g ′ A , h ′ A ).By taking y ∈ π −1 (Σ,A) (y A ) with y = 1, which we may do as π (Σ,A) is non-injective as A is proper, we see that this holds if and only if there exists some y ∈ F (Σ) \ {1} such that αyω ∈ Eq(g ′ , h ′ ).By Lemma 5.2 such a y ∈ F (Σ) \ {1} exists if and only if I NPCP has a solution, as claimed.Proof.Note that, by Proposition 5.1 (2), groups in A have decidable word problem (take A and B to be trivial).
Let I = (Σ, K, g, h) be an instance of the A-PCP.We start by producing a finite set S ⊂ F (Σ) such that S, w A = Eq(g, h)/ w A , which we can do by Proposition 5.1 (1).Then Eq(g, h)/(ker(g) ∩ ker(h)) is trivial if and only if S ⊆ ker(g) ∩ ker(h); since S is finite and K has decidable word problem, we can determine if S ⊆ ker(g) ∩ ker(h) and thus solve the A-PCP.
The assumptions of this theorem match the assumptions of Proposition 5.1, so the A-NPCP is also decidable.The result now follows from Proposition 4.3.
We can now prove Theorem B.
Proof of Theorem B. Both problems required for Theorem 5.3 are decidable for nilpotent groups [31, Theorem 5.7] [28, Algorithms 6.2 and 6.1], so the result follows from Theorem 5.3, along with the fact that finitely generated nilpotent groups are finitely presented [1,Theorem 3.4].
Remark 5.4.It can be noted that the algorithm in Theorem 5.3 is uniform, in the sense that there is one algorithm that works for all virtually A groups, modulo uniform solutions to the two problems in Proposition 5.1 for A. These problems are uniformly decidable for finitely generated nilpotent groups, and so Theorem B gives solution to the uniform PCP for finitely generated nilpotent groups.

The verbal PCP
In this section we consider the version of the PCP defined by Myasnikov, Nikolaev and Ushakov [31], which we call the verbal PCP because it looks for solutions outside a verbal subgroup, as explained below.To differentiate, recall that we refer to the prevalent version of PCP in this paper (as defined in Section 2) as the kernel-based PCP.
Recall from Section 5 that the values of a word w = w(X 1 , . . ., X k ) ∈ F (Σ ∞ ) in a group G is the set G w = {w(g 1 , . . ., g k ) | g i ∈ G}.A verbal subgroup of G is a subgroup generated by the values of a set of words w ⊂ F (Σ ∞ ).As the set w is typically given, we write w(G) for this subgroup, so w(G) = G w | w ∈ w .Recalling that a word w ∈ F (Σ ∞ ) is a law in Γ if Γ w = {1}, we are particularly interested in the verbal subgroup w Γ (F (Σ)), shortened to w Γ when F (Σ) is implicit, where w Γ is the set of laws of Γ. Equivalently, w Γ is the maximal normal subgroup of F (Σ) such that every homomorphism F (Σ) → Γ factors through F (Σ)/ w Γ .
The definition of the verbal PCP we give now is equivalent to Myasnikov, Nikolaev and Ushakov's definition, but has been rephrased to mirror the definition of the kernel-based PCP: An instance of the verbal PCP is an instance of the kernel-based PCP, so a four-tuple I = (Σ, Γ, g, h) with g, h : F (Σ) → Γ.The verbal PCP itself is the decision problem: Given I = (Σ, Γ, g, h), is the group Eq(g, h)/ w Γ trivial?Note that w Γ ≤ ker(g) ∩ ker(h), so for a fixed instance I, the verbal PCP may have solutions when the kernel-based PCP does not.Hyperbolic groups.Suppose Γ is non-elementary hyperbolic.Then Γ contains a non-abelian free group, so w Γ is trivial.Hence, the verbal PCP for non-elementary hyperbolic groups is simply asking if the equaliser Eq(g, h) is trivial.This compares with the kernel-based PCP as follows: (1) If either g or h is injective then ker(g)∩ker(h) = w Γ = {1}.Hence, the verbal PCP and the kernel-based PCP ask the same question and so have identical solution sets.Decidability when g or h is injective is unknown.(2) If both g and h are non-injective then ker(g) ∩ ker(h) is non-trivial (as it contains the non-trivial subgroup [ker(g), ker(h)]).Hence, the verbal PCP necessarily has a solution, and so is trivially decidable.However, by Theorem A, the kernel-based PCP is undecidable.
Nilpotent groups.As noted in Section 5, Myasnikov, Nikolaev and Ushakov [31] proved the kernel-based PCP for nilpotent groups, rather than the verbal PCP as their theorem incorrectly states.We now rectify this situation and prove that the verbal PCP is decidable for torsion-free nilpotent groups.
We need the following background on torsion-free nilpotent groups (see [5,34]).Let Γ be a finitely generated torsion-free nilpotent group.Then Γ has a central series with Γ i /Γ i+1 infinite cyclic for every 1 ≤ i ≤ n, and one can choose a 1 , . . ., a n ∈ Γ such that Γ i−1 = a i , Γ i .Such a sequence is called a nilpotent generating sequence for Γ, and gives rise to a nilpotent presentation where c i,j,k ∈ Z.This presentation is called consistent in the literature (see [22,Chapter 8]) and in particular every element in Γ can be written uniquely as a x 1 1 . . .a xn n , x i ∈ Z.If we write x = (x 1 , . . ., x n ) and y = (y 1 , . . ., y n ), the multiplication of two elements can be expressed as Recall that we denote by w Γ the verbal subgroup of F (Σ) generated by the set w Γ of laws of Γ. Lemma 6.1.Let F (Σ) be a free group as above, let w ∈ F (Σ), and let Γ be a finitely generated, torsion-free, nilpotent group.Then there is an algorithm that can determine whether w ∈ w Γ , that is, whether w is a law of Γ.
Proof.Suppose Σ = {X 1 , . . ., X k }, with k ≥ 1, and write w = w(X 1 , . . ., X k ) = X E 1 i 1 . . .X E ℓ i ℓ , where i j ∈ {1, . . ., ℓ} for 1 ≤ j ≤ ℓ, and E j ∈ Z.Let {a 1 , . . ., a n } be the nilpotent generating sequence of Γ as in (1).Then, writing w(Γ) for the minimal verbal subgroup of Γ containing w, we have n ) E ℓ | e i,j ∈ Z}.Since the Hall polynomials can be extended to capture the multiplication of any fixed number of elements, and the E i are fixed, there exist rational polynomials P 1 , . . ., P n : Z nℓ → Z to give the exponents of the nilpotent generating sequence.Writing e j = (e j,1 , . . ., e j,n ), one gets w(Γ) = {a Since the Hall polynomials for the product of two elements can be explicitly, algorithmically, computed, the polynomials P i for the multiplication within w(Γ) can also be explicitly determined by induction.
To see that w is a law of Γ it suffices to check that w(Γ) = {1}.As expressing group elements in Γ over the nilpotent generators a i is done uniquely, w(Γ) = {1} if and only if the P i are all equal to the zero polynomial.This is easily checked as the Hall polynomials for w(Γ) were explicitly computed.This allows us to solve the verbal PCP for torsion-free nilpotent groups.Theorem 6.2.The verbal PCP is decidable for torsion-free nilpotent groups.
Then Eq(g, h)/ w Γ is trivial if and only if S ⊆ w Γ .Given any x ∈ F (Σ), we can check if x ∈ w Γ by Lemma 6.1.Hence, as S is finite, we can determine if S ⊆ w Γ .Therefore, we can solve the verbal PCP for Γ.
Extending Theorem 6.2 to general nilpotent groups would require an extension of Lemma 6.1 to general nilpotent groups, which seems possible.However, extending Theorem 6.2 to virtually nilpotent groups, as in Theorem B, seems difficult, essentially because the varieties change with the groups involved.For example, in the proof of Proposition 4.3, given I = (Σ, Γ, g, h) we use the finite index subgroup K < Γ to construct a new instance I ′ of the kernel-based PCP such that "it's solutions correspond precisely to the solutions to I which are contained in N K ", N K a finite index subgroup of F (Σ).This holds because N K /(ker(g) ∩ ker(h)) embeds into F (Σ)/(ker(g) ∩ ker(h)).For the verbal PCP we would require N K /w K (N K ) to embed into F (Σ)/w Γ (F (Σ)), which does not happen in general.

5. 2 .
The PCP in virtually A groups.Applying Proposition 4.3 to Proposition 5.1 gives the following.Theorem 5.3.Let A be a variety of finitely presented groups.Suppose (1) and (2) of Proposition 5.1 hold.Then the PCP is decidable for virtually A groups.
classical result of Hall the functions δ i : Z n ⊕ Z n → Z are rational polynomials depending on the group only, and not on the elements involved.The polynomials δ i on 2n variables are called Hall polynomials in the literature and can easily be extended to capture the multiplication of a fixed number (not just two) of elements.
1 to get the PCP for Γ).By Lemma 2.1, the PCP generalises the word problem.Similarly, the NPCP generalises the conjugacy problem.It also generalises the "twisted conjugacy problem for pairs of endomorphisms" [31, Proposition 3.2].Lemma 4.1.If a recursively presented group has decidable NPCP, then it has decidable conjugacy problem.