WorksComputer Science
A detailed verification of Neary's PCP(5) construction
Abstract
Neary proved that the Post correspondence problem remains undecidable for instances with five pairs of words. We give a detailed verification of his construction. We first verify the undecidability of the restricted binary tag-system halting problem used in the reduction. We then prove both directions of the reduction to the five-pair problem, using the longer closing pair proposed by Rote. In particular, we show that every solution of the constructed PCP instance yields a halting computation of the simulated tag system.
Introduction
An instance of the Post correspondence problem [5] consists of a finite list of pairs of words over a common alphabet. A solution is a nonempty sequence , with repetitions allowed, such that
We write for the restriction to instances containing exactly pairs. This article concerns the undecidability of , already over the binary alphabet .
Matiyasevich and Sénizergues established undecidability for a three-rule semi-Thue system and thereby obtained a construction [2]. They used Claus’s reduction from the word problem of -rule semi-Thue systems to [1]. Neary proved undecidable using binary tag systems [3]. The purpose of this article is to give a detailed verification of Neary’s construction.
Neary’s construction uses an encoding principle similar to that of Matiyasevich and Sénizergues. The program of the simulated system is encoded in a single production. In Neary’s binary tag system, the right-hand side of the rule encodes the entire cyclic tag program, while the other rule is . The track at which is read selects the appropriate instruction.
Several readers have asked about the reverse implication in Neary’s proof, which is difficult to reconstruct from the short published argument. § 2 verifies the restricted tag-system construction used in the reduction. We identify the halt instruction in the cyclic simulation, show how the binary tag system detects it, and verify the length congruence that makes the unique terminal word on the designated computations. Sections 3 and 4 verify both directions of Neary’s five-pair reduction using Rote’s longer closing pair [6 Section 2.8, footnote 3].
The restricted binary tag systems
We index the positions of a word from zero. Thus, for a word of length , denotes the symbol at position , where .
A tag system is a triple , where is a finite alphabet, assigns a production word to each letter, and is the deletion number. A configuration is a word over , called the dataword. If the dataword is with , one step gives
The system halts when the dataword has length less than . It is binary when its alphabet has two letters.
We construct the family used in the PCP reduction by simulating a Turing machine first with a cyclic tag system and then with a binary tag system. The cyclic simulation supplies a distinguished instruction that signals halting. A Turing machine is deterministic and has a single tape indexed by . It has a finite state set, an initial state, a designated halting state, and a finite tape alphabet with a blank symbol. For every nonhalting state and scanned symbol, the transition function specifies a new state, a symbol to write, and a move one cell to the left or right. On input , the letters of occupy consecutive cells starting at cell 0, all other cells are blank, and the head starts at cell 0 in the initial state. The machine halts upon entering its halting state.
The cyclic halt signal
Clockwise Turing machines. A binary clockwise Turing machine is a tuple , where is a finite state set, is the tape alphabet, and are the initial and halting states. Its transition function is
Represent a configuration by , where is the nonempty tape word in clockwise order, starting at the scanned symbol . If , the next configuration is . This replaces the scanned cell by the one or two letters of and places the head immediately after the replacement in clockwise order. The machine halts in . The construction of Neary and Woods gives a binary clockwise simulator of . For each input , let denote the initial tape word that this construction gives for , written in clockwise order starting at the scanned cell. Thus halts from if and only if halts on [4 Section 2 and Lemma 1].
Cyclic tag systems. A cyclic tag program is a nonempty list of binary words . A configuration is a pair , where is the current instruction index and is the queue, with its front at the left. Put . For each binary word , the step relation is
Thus a step reads and deletes the leftmost bit. If that bit is 1, it appends at the right end, using the index before the step. An empty queue admits no step. Instruction fires precisely on a step from .
Lemma 1. Given an ordinary single-tape Turing machine and an input word , one can effectively construct a cyclic tag program , a nonempty initial queue at index zero, and a distinguished index with the following properties.
Instruction fires if and only if halts on . If does not halt, the cyclic computation has infinitely many steps.
If the queue is just before the first firing of , then does not fire during the next steps after that firing, which consume the bits of .
Proof. First construct and the initial tape word as above. The cyclic tag program simulates this clockwise machine. We use the construction in the proof of [4 Section 3.1, Lemma 2]. Put , , and . Number the states so that .
The (initial) configuration is encoded to the tag-system in the following way. The ordinary state and tape codewords and the counter word are
Extend to words by concatenating the tape codewords. For a nonempty tape word , let be the least power of two at least . For , the initial cyclic configuration is
This is equation (3) of Neary and Woods.
From [4] we get the following details: For every , use the following rule. At the reserved index set , as in the halting case of Neary and Woods. For all other indices use the assignments in their Tables 1.1, 1.2, 2.1, 3.1 and 3.2, substituting the states and transitions of . Each row specifies the index of the appendant and the binary word to assign to it. In Table 3.1 choose the transition row with the write length specified by for the indicated state and tape symbol. Assign the empty word to every index left unassigned. These rules give the entire program effectively.
Neary and Woods simulate a clockwise transition in three stages. The first two use the counter to mark and isolate the scanned tape symbol. The third uses the current state and the isolated symbol to select the transition of , writes the replacement symbols and the new state, and restores the ordinary tape codewords. If the tape grows beyond the current counter value, Table 3.2 doubles that value. Each simulated transition takes finitely many cyclic tag steps and returns the instruction index to zero.
For example, starting from , a transition gives the boundary configuration
Reading the tape codewords in circular order from gives the tape word , starting at the new scanned cell.
In the halting case of the simulation [4 Section 3.1, end of the proof of Lemma 2], the ordinary codeword for is entered at index zero. Its unique 1 therefore fires instruction , since
To see that cannot fire earlier, consider a cyclic step that reads a 1 during the simulation of a nonhalting transition. For each encoded object, Tables 1.1–3.2 of Neary and Woods give both the marker index on entry and the appendant index at which the object’s 1 is read. Thus it suffices to check the appendant-index column. Among the state-dependent indices below , the only ones congruent to 20 modulo 30 are of the form . These occur when an ordinary state word is entered at index zero. The fixed indices below are at most , and every index at least exceeds . In particular, when Table 3.2 copies a new state word during counter doubling, the selected index is . Thus fires exactly when the simulation reaches the halting state. If runs forever, its successive transitions give infinitely many cyclic tag steps.
At the transition boundary where the halt state is first represented, the queue contains a single state word . Any tape words preceding are read at index zero and copied to the rear before is entered. When its unique 1 fires instruction , the unread suffix therefore consists of the trailing zeros of followed by complete tape and counter words. After the trailing zeros the index is zero. Each tape word has length and has its 1 at offset 1 or 2. Each counter word is and has length . Consequently the object boundaries are entered at index 0 or , and the 1’s in these objects occur only at indices in , all distinct from . The new copy of is appended behind , so no bit of that copy is read during the next steps. This proves the second property.
The restricted halting problem
The following construction uses the track method from Lemma 9 of [3] and the length congruence used in Neary’s Theorem 11.
Lemma 2. Given a Turing machine and input , one can effectively construct a deletion number and a binary tag system with productions , ,
where . On the designated input
the system halts if and only if halts on . For the constructed , one may prescribe for every sufficiently large .
Proof. We use Neary’s method of storing the cyclic tag program in the tracks of one production word. We give every ordinary output the same initial padding. This allows a single track formula even for an empty cyclic appendant.
Take the cyclic program , initial word , and halt instruction from Lemma 1.
Put and write for the production word to be constructed, of length . For , define its -th track by
These tracks partition the positions of . A prescription for every therefore determines . Extend the productions to a morphism by , . If a traversal first reads position of a copy of , it reads and appends . More generally, the first read position in a block is called its offset. On leaving a block of length entered at offset , the offset into the next block is , since consecutive read positions differ by . Offsets in what follows are least nonnegative residues.
Let , and define three further blocks and their short encodings by
| padding | short encoding | block |
| 0 | ||
| 0 | ||
| 1 |
Table 1.
For a bit word , write and for the corresponding concatenations. Thus and . We use and complete groups as padding. The offset representing program index is
Reading preserves the offset. Each of , , has length , so it takes to . In particular preserves the incoming index.
We now prescribe the tracks used by the ordinary blocks. Take and enter at offset . Inside the track is , where . For , the offset is 1, so the traversal reads one leading followed by . For , the offset is at least 11 and it reads exactly . Indeed the block contains sampled positions when , and when . In both cases the samples inside exhaust all reads after the possible leading .
Let when , and 0 otherwise. Take for and , and for with . Prescribe the word read across the whole block as
The short encodings have length 11, so has length . It begins with . For put ; for remove the first of to obtain . In either case the block appends precisely
Thus even an empty produces only complete padding. For itself put , giving the output .
For at index prescribe . As , the whole block reads this track and appends . Set all even tracks equal to . Finally put
The residues modulo 10 of the tracks for , , , are 1, 7, 5, 3, respectively. Within each class the program indices give distinct tracks modulo . The input track has residue 9; all the even tracks are separate. The exceptional track takes the place of the track at . Fill remaining tracks with . These assignments are effective. Take any large enough that , , and every ordinary exponent is nonnegative. The last letter of is the last letter of , namely . Hence as required.
We are ready to study the computation of the binary tag system defined. Deleting the first letters of gives exactly . A traversal of this suffix reads and appends . The suffix has length , so the last deletion extends places into the output. It consumes the prefix and one letter of . The first encoded bit is therefore entered at .
To justify this and all subsequent block traversals, consider even the case in which no further block is waiting behind the current one. The initial suffix and every ordinary block, at every entry offset used here, contain at least sampled positions. Up to the last sample each deletion fits inside the block, since another sample lies positions ahead. By the last sample at least letters have already been appended. They supply the at most additional letters required by that deletion. This also applies to each copy of traversed inside .
Before the exceptional track is used, consider a boundary between successive traversals of units , , , , treating each complete group as one unit. The preceding deletion may already have consumed a prefix of the first pending unit. Its entry offset records the length of that prefix.
The simulation invariant is that the pending units, with each and omitted and each replaced by , give the current cyclic queue. If the current instruction is , the entry offset at the boundary is . Initialization establishes the invariant with queue and offset . Traversing or preserves the offset and appends only padding. Traversing advances the offset to and appends, apart from padding, the encoding of if and of the empty word if , provided . This proves the invariant by induction over the traversed units.
Every pending encoded bit is reached after finitely many traversals. Only finitely many units precede it, and their outputs are appended behind it. Thus an infinite cyclic computation gives infinitely many legal binary tag steps.
When instruction first fires, the exceptional track appends . The encoded bits already ahead of are precisely the bits of the suffix in Lemma 1. Their instruction indices and actions are unaffected by the replacement of the cyclic output at the rear by . Lemma 1 ensures that none of these bits fires . Only finitely many units precede , and their outputs are appended behind it, so is reached after finitely many traversals. All the units then waiting behind are ordinary ones.
The entry offset of is odd, since all ordinary block lengths are even and all normal offsets are odd. Its initial is skipped, so the offset in its first is one less and hence even. All remaining copies of in are also entered at even offsets. They read only ’s and append only ’s. The ordinary blocks waiting behind all have even length, and the padding before their internal has even length. Each therefore preserves even parity and reads only ’s, both inside and in its padding. After this finite traversal the dataword consists entirely of ’s. Every further step shortens it by , so it halts. This proves the equivalence and hence the undecidability of halting on the designated family. □
Lemma 3. Every dataword reachable from is nonempty, ends in , and has length congruent to modulo . The computation halts if and only if it reaches the one-letter word .
Proof. The initial length is . A -step changes it by , and a -step by . Both changes preserve the congruence. The initial word and both productions end in , so every reachable word is nonempty and ends in . Its only possible length below is therefore 1. □
The PCP(5) instance
The PCP(5) simulation uses only as a word over . It does not decode the cyclic program stored in that word. Define the morphism
by
and extend it by concatenation:
In particular, is obtained by encoding each letter of . The PCP pairs reproduce the tag steps using this encoding, independently of the interpretation of the individual letters inside . The converse shows that every PCP solution yields a halting tag computation.
A block of a symbol is a nonempty word consisting only of copies of that symbol. A block occurring in a word is maximal if it cannot be extended to either side by another occurrence of the same symbol.
For the closing pair , we use Rote’s longer block of 1’s [6 Section 2.8, footnote 3]. Every block of ’s in either production word has length at most , since the production words are and , both ending in . The same bound holds in every reachable dataword: the initial word is a suffix of , deleting a prefix cannot lengthen a block of ’s, and any remaining suffix ends in . Thus no block of ’s can extend across the boundary with the appended production word.
Set
We form exactly five binary pairs, displayed as (upper word, lower word):
The first four pairs are Neary’s. The longer closing pair , suggested by Rote [6], replaces his , without increasing the pair count. The proof of Lemma 7 uses only the inequality . To see the issue with the original exponent 4, consider a word beginning with . Its overhang begins with , so the upper word of the original closing pair matches this prefix. The pair initializes and later represents a -rule; represents a -rule; delete letters.
For , where , define
In particular, . The final is represented by a truncated . Let and be the upper and lower concatenations corresponding to a prefix of a PCP solution. If , then the unmatched suffix of the lower concatenation is called the lower overhang. It represents the tag dataword .
Starting with leaves the lower overhang . For , use if , and if . Their upper words consume the first encoded letters of , and their lower words extend the terminal to . The resulting lower overhang is
where .
At a nonhalting word, use or according as its first letter is or ; then delete the following letters with or . Lemma 6 verifies the exact word identity. At the halting word , ; using makes the two concatenations equal since . Thus every halting computation yields a PCP solution. This forward simulation is due to Neary [3 proof of Theorem 11]; the word identities for each simulated tag step are verified in Lemma 6 below. Here we use Rote’s longer closing pair [6].
The converse: a PCP solution yields halting
In any PCP solution, the upper and lower concatenations of every prefix are prefixes of the eventual common word. Thus one is a prefix of the other. When the current lower concatenation is the upper concatenation followed by , and a pair has as a prefix of , the new lower overhang is
More generally, if is the next pair in a solution, then and must be prefix-comparable, since both are prefixes of the remaining part of the eventual common word. Hence a disagreement within their common range cannot be repaired by later pairs.
We first establish the form of any PCP solution up to its first occurrence of .
Lemma 4. Every solution starts with and ends with . Up through its first occurrence of , it has the form
where and .
Proof. Only can start an equality. Both its words begin with 1, whereas the lower words of start with 0, and those of start with 11 while their upper words start with 10. Every upper word ends in 1, whereas only the lower word of ends in 1. Hence every complete match ends in .
Every maximal block of zeros in an upper word has length . Since every upper word begins and ends in 1, the same holds for every concatenation of upper words. Every maximal block of zeros in has length . The lower word of each or ends in 10, starting a zero block of length 1. Each deletion pair contributes one zero and no production or closing pair can contribute a zero at this boundary. Exactly deletion pairs must therefore follow each occurrence of or before the next occurrence of , , or . Apply this from the initial up to the first . A solution may continue after its first occurrence of ; only the prefix through that occurrence is considered here.
The next lemma shows that the initial group of pairs produces the encoding of the prescribed tag input.
Lemma 5. Assume that a PCP solution has the form (4). After its initial sequence
the lower overhang is . Moreover, for , the pair is uniquely determined by :
:::`
Proof. Immediately after , the lower overhang is , where . By (4), the next pairs are , each belonging to .
We show successively that is determined by , for . After the first deletion pairs have been applied as prescribed, the lower overhang is
If , the upper word of consumes . Choosing instead would consume only its first , leaving a leading zero. Since every upper word begins in , this choice is incompatible with a PCP solution.
If , the overhang begins in : the first encodes , and the second begins the next code, or the terminal . Thus , whose upper word begins in , cannot be used, and is forced.
In either case the chosen pair consumes and appends one zero to the lower concatenation. Consequently, after , the lower overhang is
as required.
The next lemma shows that each subsequent group represents exactly one tag step.
Lemma 6. Assume that a PCP solution has the form (4), and let . Suppose that immediately before the occurrence of , the lower overhang is , where
is a reachable tag dataword with . Then the pairs in the sequence
are uniquely determined by the first letters of . Specifically,
After this sequence, the lower overhang is , where
is the tag successor of . When , the suffix is empty.
Proof. Since is reachable, its last letter is . Thus , and
By (4), is either or .
If , the lower overhang begins with 11: the first 1 encodes , and the second begins the representation of the next letter. The upper word of begins with 10, so is forced. If , the lower overhang begins with . Choosing would consume only its first 1, leaving a leading zero. Since every upper word begins in 1, this would be incompatible with a PCP solution. Hence is forced.
To treat both cases together, put
Then . In either case the upper word of is , and its lower word is . Immediately after , the lower overhang is therefore
Here the first 1 of the appended lower word completes the truncated representation of the old final to its full code .
The deletion pairs are now forced by the same argument as in the proof of Lemma 5: for , we must use if , and if . Indeed, each of these symbols has its full code in the overhang, including the final when .
Each deletion pair consumes and appends one zero. Hence, after all deletion pairs, the lower overhang is
Here is understood to be empty when . Thus the sequence represents exactly one tag step in every case.
The same identities also show that, starting with , the prescribed pairs can always be appended to obtain , without assuming a complete PCP solution.
Lemma 7. Assume that a PCP solution has the form (4). Suppose that immediately before its first , the lower overhang is for a reachable tag word . Then , and this occurrence of makes the upper and lower concatenations equal. Conversely, if the lower overhang is , applying gives equality.
Proof. Recall that the upper and lower words of are and , respectively, where .
If starts with , then begins with 11, since ends in . This is incompatible with the upper word of , which begins with 10.
Suppose that starts with and . Since ends in , write for some . The run bound in § 3 gives . After the initial in , there are exactly consecutive 1’s: one ending the first -code, encoding the intervening ’s, and one beginning the next -code. The next symbol is 0, including when that second is the final letter of . Since
this 0 already disagrees with the upper word of . The disagreement lies within the existing overhang.
The only remaining possibility is . In this case , and
which is exactly the upper word of . Hence applying makes the two concatenations equal.
Now we are ready to give a full proof for the result of Neary.
Theorem 1. is undecidable over the binary alphabet.
Proof. Consider the restricted family of binary tag systems described in Lemma 2, whose halting problem is undecidable. Given a system in this family, with deletion number , productions
and prescribed initial word , form the five pairs in (1). All their words are binary, and they can be computed effectively from and . We prove that the resulting PCP instance has a solution if and only if the tag system halts from .
Suppose first that the tag computation halts. By Lemma 3, its final word is . Write the computation as
As shown in § 3, starting with and appending the deletion pairs prescribed there leaves the lower overhang . For each step , append the production pair determined by the first symbol of , followed by the deletion pairs determined by its next symbols. The word identities in the proof of Lemma 6 show that this changes the lower overhang from to . After all steps, the lower overhang is therefore . Appending makes the upper and lower concatenations equal, since
Thus the PCP instance has a solution.
Conversely, suppose that the PCP instance has a solution. By Lemma 4, its prefix through the first occurrence of has the form (4). By Lemma 5, the initial group
leaves exactly the lower overhang .
Proceed through the remaining groups in this factorization. Whenever the current overhang is for a reachable nonhalting word , Lemma 6 forces the next production pair and its deletion pairs, and shows that the resulting overhang is , where is the genuine tag successor of . Consequently, these groups represent successive steps of the computation starting from .
If any word reached in this way is , the tag computation has halted. Otherwise, since there are only finitely many groups before the first , this induction reaches the prefix immediately before that occurrence of . Its lower overhang is for a reachable tag word . Lemma 7 then forces , so the tag computation halts in this case as well.
We have therefore obtained an effective reduction of the restricted tag-system halting problem to PCP(5) over the binary alphabet. Since the former problem is undecidable, so is the latter.
Conclusion
Neary’s construction establishes the undecidability of PCP(5) over the binary alphabet. Our purpose has been to give a detailed verification of this result, with particular attention to the converse: every PCP solution yields a halting computation of the simulated tag system.
Lemmas 4–7 make this implication explicit. The lengths of maximal blocks of zeros force the form (4); comparison with the lower overhang then forces the initialization and each successive tag step. Finally, the closing pair can be applied only when the represented tag word is .
We use Rote’s longer closing pair [6], with , in place of the four consecutive 1’s in Neary’s original pair. Its required property follows from the bound on the lengths of blocks of c’s in reachable tag words.
The undecidability of the restricted tag-system family rests on Neary’s construction. The PCP verification uses the tag-system properties established in § 2. The internal structure of is used only in the proof of the restricted halting problem. The construction is due to Neary, with the modification of the closing pair due to Rote; the contribution here is a detailed exposition and verification of the resulting reduction in both directions.
Acknowledgements. I thank Turlough Neary for explaining his construction to me during a visit to Turku many years ago. That discussion was an important source of my confidence in the result and helped motivate the present exposition.
I used OpenAI’s ChatGPT to assist with drafting, revising the exposition, and checking details of the arguments. I have reviewed the resulting text and take full responsibility for its mathematical content and any remaining errors.
References
- [1]V. Claus. Some remarks on PCP(k) and related problems. Bullet. EATCS, 12:54–61, 1980. URL: https://page.mi.fu-berlin.de/rote/Kram/Volker_Claus-Some_remarks_on_PCP(k)_and_related_problems-1980-Bull-EATCS-12.pdf.
- [2]Y. Matiyasevich and G. Sénizergues. Decision problems for semi-Thue systems with a few rules. Theoret. Comput. Sci., 330(1):145–169, 2005. doi:10.1016/j.tcs.2004-09.016.
- [3]T. Neary. Undecidability in binary tag systems and the Post correspondence problem for five pairs of words. In STACS 2015, volume 30 of LIPIcs, pages 649–661, 2015. doi:10.4230/LIPIcs.STACS.2015.649.DOI
- [4]Turlough Neary and Damien Woods. P-completeness of cellular automaton Rule 110. Technical Report 04/2006, Boole Centre for Research in Informatics, University College Cork, 2006. URL: https://dna.hamilton.ie/assets/dw/NearyWoodsBCRI-04-06.pdf.
- [5]E. L. Post. A variant of a recursively unsolvable problem. Bull. Amer. Math. Soc., 52:264–268, 1946. doi:10.1090/S0002-9904-1946-08555-9.DOI
- [6]G. Rote. Probabilistic finite automaton emptiness is undecidable for a fixed automaton. In MFCS 2025, volume 345 of LIPIcs, pages 86:1–86:18, 2025. doi:10.4230/LIPIcs.MFCS.2025.86.DOI