On Bi-infinite and Conjugate Post Correspondence Problems

We study two modifications of the Post Correspondence Problem (PCP), namely 1) the bi-infinite version, where it is asked whether there exists a bi-infinite word such that two given morphisms agree on it, and 2) the conjugate version, where we require the images of a solution for two given morphisms are conjugates of each other. For the bi-infinite PCP we show that it is in the class $\Sigma_2^0$ of the arithmetical hierarchy and for the conjugate PCP we give an undecidability proof by reducing it to the word problem for a special type of semi-Thue systems.


Introduction
The original formulation of the Post correspondence problem (PCP) by Emil Post in [12] is the following: Problem 1.1 (PCP).Let A be a finite alphabet.Given a finite set of pairs of words over A, say (u 1 , v 1 ), (u 2 , v 2 ), . . ., (u n , v n ), does there exists a nonempty sequence i 1 , . . ., i k of indices such that Post proved that the PCP is undecidable in [12].Since then the PCP and its many variants have been used as a bridge from combinatorial undecidable problems of computational systems and formal rewriting systems to decision problems in algebraic setting.The PCP is usually defined as a problem in free word monoids (as A * is the free monoid of all finite words over A with catenation as the operation).Indeed, the PCP is equivalent to asking for two given morphisms g, h : B * → A * , whether or not there exists a non-empty word w such that g(w) = h(w).
Note that we may choose the set B = {1, . . ., n}, and g(i) = u i , h(i) = v i for all i = 1, . . ., n where (u i , v i ) is a pair in the original formulation of the PCP.The variants of the PCP also reveal the boundary between decidability and undecidability.It is known that the PCP is decidable for n = 2, see [2,7], and undecidable for n = 5, see [11].On the other hand, it is known that the infinite PCP, asking whether there is a (right) infinite sequence i 1 , i 2 , . . . of the indices such that the words agree, is decidable for two pairs of words, see [8], and undecidable for 8 pairs, see [1].It has been proved that the infinite PCP is not "more complex" than the PCP with respect to the arithmetical hierarchy, see [4], where it was proved that the infinite PCP is Π 0 1 -complete as the PCP is known to be Σ 0 1 -complete.In this paper we study two variants of the PCP.The first variant is called the bi-infinite Post correspondence pProblem (ZPCP), where it is asked whether or not there exits a bi-infinite sequence of the indices such that the words agree.The morphic version of the ZPCP is the following: Problem 1.2.Given two morphisms h, g : A * → B * , does the exist a bi-infinite word w such that h(w) = g(w).
Note that already the equality of the images of bi-infinite words needs to be defined properly: for a bi-infinite word w, h(w) = g(w) if and only if there is a constant s ∈ Z such that for all letters h(w)(i) = g(w)(i + s) for all positions i ∈ Z.An instance of the ZPCP is a pair of morphisms (h, g) and a bi-infinite word w satisfying h(w) = g(w) is said to be a solution of the instance (h, g).
Our second variant deals with conjugate words.Two words x and y are conjugates if there exist words u and v such that x = uv and y = vu.
We call the following problem the conjugate-PCP.
Problem 1.3.Given two morphisms h, g : A * → B * , does there exist a word w ∈ A + such that h(w) = uv and g(w) = vu for some words u, v ∈ B * .
The behaviour of the instances of the conjugate-PCP differ vastly from the more traditional variants where a valid presolution (prefix of a candidate solution) can be verified by aligning the matching parts of the images.Working with the possible solutions of the instances of the conjugate-PCP is less intuitive.
For example let us have morphisms h, g and we guess that a solution w begins with the letter a. Then the situation is the following: The validity of the presolution a cannot be verified because there may not be any matching between h(a) and g(a).Moreover the factorization of the images to u and v need not be unique even for minimal solutions: Example 1.4.Let h, g : {a, b} * → {a, b} * be morphisms defined by Now ab is a minimal solution for the conjugate-PCP instance (h, g) having two factorizations: Both variants defined above were originally proved to be undecidable in [13] using linearly bounded automata (LBA) 1 .Indeed, the conjugate-PCP was not directly proved in [13], although it is claimed so in [14].Let us consider the terminology of Ruohonen in [14] in a bit more details: Let u and v be words, and denote u ∼ m v if there exist words u 1 , . . ., u m and a permutation τ on the set {1, . . ., m} such that u Obviously, our formulation of the conjugate-PCP is the (1,2)-permutational PCP of Ruohonen.Now in [14], it is mentioned that (1,2)-permutational PCP was proved to be undecidable in [13], but the problem is not explicitly mentioned there.On the other hand, the (2,2)-permutational PCP is shown to be undecidable in [13] 2 .It is possible that Ruohonen uses the later result without details, because of the following simple lemma, which follows from special cyclic shift property of permutations.
Lemma 1.6.For morphisms g, h : A * → B * , the instance (g, h) has a solution to the (1, 2)-permutational PCP if and only if it has a solution to the (2, 2)-permutational PCP.
Proof.Firstly, a solution to the (1, 2)-permutational PCP is a solution to the (2, 2)-permutational PCP where the first permutation on the pre-image being trivial.
Secondly, assume that there exists a solution u = xy, v = yx, two (2, 2)-permutational PCP.So g(xy) = zw and h(yx) = wz for some w, z ∈ B * .We have two cases, either h(y) is a prefix of w, or vice versa.
In the first case, w = h(y)r for some word r ∈ B * , and h(xy) = rzh(y) and g(xy) = zw = zh(y)r and, therefore, xy is a solution for the (1, 2)-permutational PCP.
We stress that undecidability of the (m, n)-permutational PCP was proved in [14], using the machinery of LBA's used already in [13], for all m and n.This extends the result in [13] where it was shown that the (n, 1)-permutational PCP3 is undecidable for all n.
The proofs in [13] and [14] are rather involved because of the employment of the computations of LBA's, and there is a quest for simpler treatment of the problems.There is a line of new simpler proofs for Ruohonen's results on the permutational PCP's, which uses the word problem of a special type of semi-Thue system: For the case of (2, 1)-permutational PCP a somewhat simpler proof was given in [6], where the problem was called the circular PCP.In [3] a simplified proof for the (n, 1)-permutational PCP (or n-permutational PCP) was given for all positive n.For the ZPCP a simpler proof was given in [9].
In the next section we give a new proof to undecidability of the conjugate-PCP by reducing it to the word problem for a special type of semi-Thue systems.These are indeed the same special semi-Thue systems that were used for proving undecidability of the ZPCP in [9], but the construction here is different due to differences in the ZPCP and the conjugate-PCP.By Lemma 1.6, this also proves undecidability of the (2, 2)-permutational PCP.
In the final section we show that the ZPCP is in the class Σ 0 2 of the arithmetical hierarchy.This should be reflected with the result in [4], where it was proved that the infinite PCP is Π 0 1 -complete as the PCP is known to be Σ 0 1 -complete.At first sight, it may seem that the ZPCP and the conjugate PCP do not have anything in common, but that is not the case.In both of these problems, solutions have a shift, in the ZPCP the shift makes the images, two bi-infinite words, equal and in the conjugate PCP the images are equal over a cyclic shift of the word.Therefore, the construction in the next section for the conjugate PCP has similar ideas as the construction for the ZPCP in [9].

Semi-Thue system for the circular word problem
We shall shortly recall the construction of the semi-Thue system T M in [9].First of all, a semi-Thue system T is a pair (Γ, R) where Γ = {a 1 , a 2 , . . ., a n } is a finite alphabet, the elements of which are called generators of T , and the relation R ⊆ Γ * × Γ is the set of rules of T .We write u − → T v, if there exists a rule (x, y) ∈ R such that u = u 1 xu 2 and v = u 1 yu 2 for some words u 1 , u 2 ∈ Γ * .We denote by − → * T the reflexive and transitive closure of − → T , and by − → + T the transitive closure of − → T .Note that the index T is omitted from the notation, when the semi-Thue system studied is clear from the context.If u − → * v in T , we say that there is a derivation from u to v in T .
In the word problem for semi-Thue systems, it is asked, for a given semi-Thue system T and words w and u, whether w − → * T u.In a circular word problem on the other hand, it is asked whether there exists a word u for a given semi-Thue system T such that u − → + T u.In [9], a special kind of semi-Thue system was constructed which harnesses the structure of a given deterministic Turing machine.A Turing machine, TM for short, M is of the form M = (Q, Σ, Γ, δ, q 0 , F ), where Q is a finite set of states, Σ is a finite input alphabet, Γ is a finite tape alphabet satisfying Σ ⊆ Γ, containing a special blank symbol □ ∈ Γ \ Σ, q 0 is a unique initial state, δ is a transition mapping from Q × Γ to subsets of Q × Γ × {L, R, S}, and F ⊆ Q is the set of accepting states.We assume that in a TM, the transition mapping is a partial function as the TM's are assumed to be deterministic.
For purposes of this section we also assume that F = {H}, that is, there exists a unique accepting state H ∈ Q, called the halting state.It can be assumed that a computation of a TM halts (i.e., no more transitions are applicable) if and only it arrives to state H.We denote a configuration of M by a word uqv□, if the contents of the non-blank part of the tape is uv, and M is reading the first symbol of v□ in state q ∈ Q.
A semi-Thue system S M = (Λ, R S ) imitating the computation of a fixed deterministic TM M is constructed using the following ideas originally given in [10]: Λ = Q ∪ Σ ∪ Γ ∪ {L, R}, where L and R are end markers.Indeed, the initial configuration q 0 w of M corresponds to a word Lq 0 wR ∈ Λ + and the rules of R S are implied by the transition function δ so that, for example, and similarly for the other types of transitions.Now it is straightforward to see that a TM M halts on input w in the configuration uHv for some words u and v if and only if Lq 0 wR − → * S M LuHvR.Since the halting problem of TM's on empty tape is undecidable, we may assume in the above that w = □.
We obtain a simple proof for undecidability of the word problem, see [10], by adding letter-by-letter cancellation rules such that LuHvR − → * LHR to the semi-Thue system S M .Furthermore, by adding a special rule we have a semi-Thue system with undecidable circular word problem.The semi-Thue system constructed is Q-deterministic meaning that in all rules (u, v), both u and v contain exactly one symbol from set Q.

Modifications to the semi-Thue system
In order to prove that the conjugate-PCP is undecidable, we need to modify the above construction a bit.First of all, we take another copy of the alphabet Λ, say Λ = {a | a ∈ Λ} and add also overlined copies of all rules except the rule (2.1) to the system.The special rule (2.1) is replaced by two new rules, (LHR, Lq 0 □R) and (LHR, Lq 0 □R). (3.1) Now the circular derivation Finally, we simplify the alphabet Λ (and Λ).Indeed, we encode injectively the letters in Λ \ (Q ∪ {L, R}) into {a, b} + , and denote the new alphabets A = {a, b, L, R} and B = Q.We have now constructed a semi-Thue system T M = (Σ, R) with the following properties: where none of the symbols are overlined, then the corresponding overlined rule t i , where all symbols are overlined is also in R, and vice versa.(iii) For all words w ∈ (A ∪ A) * (B ∪ B)(A ∪ A) * , if there is a rule in R giving w − → T w ′ then the rule is unique.(iv) There is a single rule from A * BA * × A * BA * and a single rule from A * BA * × A * BA * , moreover these rules are such that they re-write everything between the markers L and R, namely if there are rules giving u − → T M w 0 and u − → T M w 0 for a u ∈ A * BA * then the rules are (u, w 0 ) and (u, w 0 ), respectively.These rules are the rules in (3.1) coded into Σ. 3. T M has an undecidable circular word problem.In particular it is undecidable whether T has a circular derivation w 0 − → * T M w 0 where w 0 ∈ A * BA * is the word appearing in the rules of 2(iv).Note that w 0 and u in the case 2(iv) are fixed words from the construction of the semi-Thue system T M for a particular Turing machine M , and w 0 ̸ = u.
The special (B ∪ B)-determinism of T M can be interpreted as derivations being in two different phases: the normal phase and the overlined phase.Transitioning between phases happens via the unique rules from 2(iv).It is straightforward to see that all derivations do not go through phase changes and that the phase is changed more than once if and only if T has a circular derivation.The system considered is now fixed from the context and we write the derivations omitting the index T simply as − →.We now add a few additional rules to T M : we remove the unique rule (u, w 0 ) and replace it with one extra step by introducing rules (u, s) and (s, w 0 ) where s is a new symbol for the intermediate step.The corresponding overlined rules (u, s) and (s, w 0 ) are added also to replace the rule (u, w 0 ).These new rules are needed in identifying the border between words u and v, and adding them has no effect on the behaviour of T M .

Undecidability of the conjugate-PCP
We are now ready to prove our main result.By the case 3 of the properties of T M we have the following lemma.
Lemma 4.1.Assume that the semi-Thue system T M is constructed as in the above.Then T M has an undecidable individual circular word problem for the word w 0 .
We now reduce the individual circular word problem of the system T M to the conjugate-PCP.
Let R = {t 0 , t 1 , . . ., t h−1 , t h }, where the rules are t i = (u i , v i ).We denote by l x and r x the left and right desynchronizing morphisms defined by In the following we consider the elements of R as letters.Denote by A j the alphabet A where letters are given subscripts j = 1 and 2, respectively.Define the morphisms h, g : {a, b, d, e, f, #, $, £} * according to the following table: Here the re-writing rules are of the form t i = (u i , v i ), for u i , v i .The following rules play important roles: , where u is the unique word such that (u, w 0 ) ∈ R, and t h = (s, w 0 ).
We begin by examining the forms of the images of h and g.The morphisms are modified from the ones in [9] with slight alterations made such that it is possible to have (finite) solutions to the instance of the conjugate-PCP with easily identifiable borders between the factors u and v using special symbols $ and £.The symbols d, e and f function as desynchronizing symbols.The desynchronizing symbols d and e make sure that in the solution w the factors that will represent the configurations of the semi-Thue system T M are of correct form, that is of the form where determinism is kept intact.This follows from the forms of h and g: under g all images are desynchronized by either e 2 (non-overlined letters) or d 2 (overlined letters).To have similarly desynchronized factors in the image under h we note that in the pre-image the words between two #-symbols (similarly for overlined symbols #) are of the form αtβ where α ∈ {a 1 , b 1 }, β ∈ {a 2 , b 2 } and t ∈ R (with end markers L and R omitted from α and β).The symbol f is not really used in desynchronizing but makes sure that the change between phases is carried out correctly.
The following lemma is useful in our proof: Lemma 4.2.The words h(w) and g(w) are conjugates if and only if h(w 1 ) and g(w 2 ) are conjugates for all conjugates w 1 and w 2 of w.
Proof.If h(w 1 ) and g(w 2 ) are conjugates for all conjugates w 1 and w 2 of w then of course h(w) and g(w) are conjugates.
Assume then that h(w) and g(w) are conjugates and let w 1 and w 2 be conjugates of w.There are then suffixes x and y of w such that w 1 = xwx −1 and w 2 = ywy −1 .Denote wx −1 = w ′ and wy −1 = w ′′ .Now ) is a conjugate of g(w ′′ )g(y) = g(w ′′ y) = g(w).By our assumption also h(w 1 ) and g(w 2 ) are conjugates.
Next we will show that a circular derivation beginning from a fixed word w 0 exists in T M if and only if there is a solution to the conjugate-PCP instance (h, g).We prove the claim in the following two lemmata.Lemma 4.3.If there is a circular derivation in T M beginning from w 0 , then there exists a non-empty word w such that h(w) ∼ 2 g(w).
Proof.Assume that a circular derivation exists.The derivation is then of the form , where s and u as defined earlier for T M .This derivation can be coded into a word where w i = α i t i β i for each i, where t i = (u i , v i ) is the unique rewriting rule used in each derivation step.The rules t h−1 and t h appear right before transition to overlined part of the derivation as they correspond to the final and intermediate steps before the transition.Let us consider the images of w under the morphisms h and g defined in the above: and, using the equalities in the derivation for w 0 and (4.1), Clearly, h(w) ∼ 2 g(w), which proves our claim.Lemma 4.4.If there exists a non-empty word w such that h(w) ∼ 2 g(w), then there is a circular derivation in T M beginning from w 0 .
Proof.Firstly we show that the factor f 3 must appear in h(w) and hence t h−1 t h or t h−1 t h has to be a factor in w.Assume on the contrary: there is no factor f 3 in h(w).
From the construction of g we know that also h(w) must be desynchronized so that between the letters there is either a factor d 2 or e 2 .Conjugation of g(w) does not break this property except possibly in the beginning and the end of h(w) (h(w) could start and end in a single desynchronizing symbol).
Take now the first letter c of w.We can assume that it is a non-overlined letter as the considerations are similar for the overlined case.The letter c cannot be t h−1 as it would have to be followed by t h : f 2 does not appear as a factor under g without f 3 , and t h−1 t h produces f 4 , which is uncoverable by g.From the construction of h we see that the letters following c must also be non-overlined, otherwise the desynchronization would be broken.Thus the desynchronizing symbol is the same for all the following letters.But as we can see from the form of the morphisms h and g, we have a different desynchronizing symbols under g for c and its successors.It is clear that h(g) must contain both d and e and so w must have both non-overlined and overlined letters.If there is a change in the desynchronizing symbol in h(w) then it contradicts the form of the images under g.Hence we must have the factor t h−1 t h in w to make the transition without breaking the desynchronization.
The images of the factor t h−1 t h are As we can see the desynchronizing symbols do not match.Hence we also must have the overlined copy of this factor in w, that is a factor t h−1 t h I, the images of which are (the letter I is a forced continuation to the overlined factor to account for the special symbols $ and £): Either one of these factors has one swap between the symbols d and e.From the above we concluded that we need an even number of these swaps as for every factor t h−1 t h we must also have the factor t h−1 t h I and vice versa.It is possible that h(w) ends in the letter f .In this case the swap happens "from the end to the beginning", i.e., the prefix of a factor doing the swap is at the end of w and the remaining suffix is at the beginning of w.The following proposition shows that we can in fact restrict ourselves to the case where the factors t h−1 t h and t h−1 t h are intact, that is, the swap does not happen from the end to the beginning of h(w) as a result of the conjugation between h(w) and g(w).At this point we make an observation.
Observation.It may be assumed that the first and the last symbols of h(w) are $ and £.Indeed, if h(w) is not of the desired form then it has £$ as a factor (by above the symbols from t h−1 t h I are in w).Images of the letters under h do not have £$ as a factor so there is a factorization w = w 1 w 2 such that h(w 1 ) ends in £ and h(w 2 ) begins with $ (w 1 ends in t h and w 2 begins with I).By Lemma 4.2, h(w) and g(w) are conjugates if and only if h(w 2 w 1 ) and g(w 2 w 1 ) are, where now h(w 2 w 1 ) has $ as the first symbol and £ as the last symbol.
Now by the observation we may assume that w begins with I and ends with t h .From this it also follows that if h(w) = uv and g(w) = vu the word u has $ as the first and the last symbol and v has £ as the first and the last symbol.It follows that w where the border between u and v is in the image h(t h ): Here the border between u and v need not be in the image of the same instance of t h .Nevertheless we know by above that in the image under g the word u begins with $l d 2 (w 0 #)d.To get this image as a factor of g(w) we must have t h α 1 t 1 β 1 # in w, where t 1 = (u 1 , v 1 ) is the first rewriting rule used and w where by the (B ∪ B)-determinism of T the rule t 2 ∈ R is the unique rule and α which is also a factor of g(w) and implies that We can see that the words given by this procedure beginning with I or t h (as in 4.2 and 4.3, respectively) contain derivations of the system T M starting from w 0 where configurations are represented as words between #-symbols and consecutive configurations in these words are also consecutive in T M (as is explained in the beginning of the proof), that is, we get from the former to the latter by a single derivation step.
From the finiteness of w it follows that long enough factors of w of the forms 4.2 and 4.3 represent cyclic computations: the configuration s is reached eventually and from there we have the rule (s, w 0 ) which starts a new cycle.We conclude that T M must have a cyclic computation starting from configuration w 0 .This result does not generalize to more complex (1, n))-permutations using the same construction by say, adding more desynchronizing symbols and border markers for each element in the permutation.The generalization of the conjugate-PCP would be the (1, n)-permutational PCP, stated below: Problem (Image Permutation Post Correspondence Problem).Given two morphisms h, g : A * → B * , does there exist a word w ∈ A + and an n-permutation σ such that h(w) = u 1 u 2 • • • u n and g(w) = u σ(1) u σ(2) • • • u σ(n) for some words u 1 , . . ., u n ∈ B * ?
The reason that our construction does not work for the general (1, n)-case is that allowing more factors to be permuted can force solutions that do not describe TM computations.This is because of special cases for different values of n and σ, but also by the fact that the permutated factors may be single letters.In fact any solution w that produces Abelian equivalent words h(w) and g(w) also has a permutation that makes one of the words into the other.A "simple" proof using the techniques in this chapter is for now deemed unlikely, and some other approach may prove to be more fruitful.Note that the undecidability of the Image Permutation PCP follows already from proof of Ruohonen for (m, n)-permutational PCP in [14].
As a related result we note that the PCP for the instances where one of the morphisms is a permutation of the other are undecidable.Indeed, it was shown by Halava and Harju in [5] that the PCP is undecidable for instances (h, hπ), where h : A * → B * is a morphism and π : A * → A * is a permutation.

Complexity of ZPCP
In this section, we will consider the ZPCP defined in the introduction.As mentioned, undecidability of the ZPCP was proved in [9] using similar techniques than in the previous section for the conjugate-PCP.
We will use a new modification of the ZPCP called the fixed shift ZPCP, and denoted by ZPCP S , where S is a fixed integer.Problem 5.1 (ZPCP S ).Given two morphisms h, g : A * → B * , does there exist a bi-infinite word w such that h(w)(i) = g(w)(i + S) for all i ∈ Z.
with pairwise disjoint alphabets A, A, B, B. Notably A = {a, b, L, R} where L, R are markers for the left and right border of the word, respectively.2. T M is (B ∪ B)-deterministic in the following way: l x (a) = xa, r x (a) = ax for all words x.It is clear that for letters a and b and any word u al x (ub) = r x (au)b.(4.1)