Jump to content

Turing machine to accept words that are same twice


kockasinges

Recommended Posts

I would like to construct a TM, that can accept words like these: tmtm or samesame. I plan to use up 3 tapes for this and copy all the symbols one by one from input to 2nd tape. Don't know, when and how should I examine back the copied characters. How should I know, where is half part?

Link to comment
Share on other sites

I would like to construct a TM, that can accept words like these: tmtm or samesame. I plan to use up 3 tapes for this and copy all the symbols one by one from input to 2nd tape. Don't know, when and how should I examine back the copied characters. How should I know, where is half part?

 

You need to traverse the entire word [tape1] from left to right and keep copying into tape2

 

And then return to the center point [if the length of the word is even sized (is required to be so-if odd Reject)] while doing that write that into the tape3 and clear those letters from tape2.

 

After reaching the halfway mark compare tape2 with tape3 and if that equals Accept else Reject.

Link to comment
Share on other sites

How should I know, where is halfway in the word. These aren't fixed length.

 

 

The following was suggested :

 

 

You need to traverse the entire word [tape1] from left to right and keep copying into tape2

And then return to the center point [if the length of the word is even sized (is required to be so-if odd Reject)] while doing that write that into the tape3 and clear those letters from tape2.

After reaching the halfway mark compare tape2 with tape3 and if that equals Accept else

 

On the step 2 : And then return to the center point [if the length of the word is even sized (is required to be so-if odd Reject)] while doing that write that into the tape3 and clear those letters from tape2.

 

Add here : At each backward step move tape1 two letters back for each letter and at the mid point tape1 would reach its starting point.

 

In any case as you are allowing comparison of the two half strings which needs some external memory/computation you can use that feature to count the number of letters in the first step too.

Edited by Commander
Link to comment
Share on other sites

So, please see this part of the exercise:
moveX are the direction of the moving of tapes.

(state, (sign1, sign2)) -> (state', (sign1', sign2'), (move1', move2', move3'))

(START, (*,U,U)) -> (g1, (*,*,U), (1,1,0))
(g1, (U,U,U)) -> (g2, (*,*,U), (-2,0,0))

(g2, (U,U,U)) -> (STOP, (U,U,1), (0,0,0))

 

So, I have iterating through the tape and after that go back to the start of the tape, then STOP. But first of all, how to count characters on tape3?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.