User blog comment:LittlePeng9/Random Turing machines/@comment-5529393-20130408132904/@comment-1605058-20130408141301

I'll explain it for first 3-state machine: after reaching end of hydra, we delete rightmost ). State 3 checks if second-to-right symbol was ( - if it was, rightmost head was child of root, so parentheses you mentioned don't exist. Here is example of other case: (()). State 3 reduces to this: (((. Now, rightmost ( is changed to ) and we start checking for rightmost set of balanced parentheses. I hope you can see this is (). This isn't obvious that this is always set of parentheses we are looking for. To see that it is right, note that changing ( to ) is equivalent to deleting head and repairing pair enclosing this head