0
$\begingroup$

I need help describing a Non-Deterministic Turing Machine (NTM) for the following language:

$L=\{(ww^c)^n | n>1$ and $w,w^c\in\{a,b\}^*\}$. If $w=w_1...w_k$ then $w^c=w_1^c...w_k^c$ where $w_i^c=b$ if $w_i=a$ and $w_i^c=a$ if $w_i=b$

How should I approach writing an informal description for this NTM? Any insight into the necessary non-deterministic steps would be really helpful!

$\endgroup$
4
  • 2
    $\begingroup$ You just asked cs.stackexchange.com/questions/170235/…. This website isn't for doing your homework. $\endgroup$ Commented Nov 3 at 10:13
  • $\begingroup$ What about a TM recognising a single $ww^c$? $\endgroup$
    – greybeard
    Commented Nov 3 at 12:22
  • $\begingroup$ @greybeard thank you for your response, how can we generalize a TM recognizing a single $ww^c$ to a TM recognizing $n$ repetitions of it ? $\endgroup$
    – Fred
    Commented Nov 3 at 23:09
  • $\begingroup$ Can a TM copy a word? $\endgroup$
    – greybeard
    Commented Nov 4 at 4:41

1 Answer 1

0
$\begingroup$

Informal Description of a Non-Deterministic Turing Machine (NTM) for the Language:

The language is given by:

$$ L = \{ (wwc)^n \mid n > 1 \text{ and } w, wc \in \{a, b\}^* \} $$

Where:

  • ( w ) is a string of symbols from ({a, b}),
  • ( wc ) is a transformation of ( w ) such that:
    • If ( w_i = a ), then ( wc_i = b ),
    • If ( w_i = b ), then ( wc_i = a ),
  • The string consists of repeated patterns of ( (wwc) ), where ( n > 1 ) (i.e., at least two repetitions).

Informal Description of the NTM:

  1. Input: The NTM takes an input string of symbols from ({a, b}). The input string is expected to be in the form:

    $$ (wwc)^n $$

    where the machine must verify that the string consists of multiple repetitions of the pattern ( (wwc) ), with ( n > 1 ).

  2. Step 1: Non-Deterministic Guessing of the Split for ( w ): The NTM will non-deterministically guess the position where the first occurrence of ( w ) ends and the second ( w ) begins. It guesses a boundary, dividing the string into potential segments of ( (wwc) ).

    • The machine chooses a point to mark the boundary between the first ( w ) and the second ( w ).
    • This non-deterministic choice is crucial, as it allows the NTM to try different positions for the first ( w ).
  3. Step 2: Checking the Pattern ( ww ): After the NTM guesses where ( w ) ends, it will check if the second ( w ) matches the first ( w ).

    • The machine compares the first half of the string (which it believes to be ( w )) with the second part (which it believes to be another occurrence of ( w )).
    • It ensures that each pair of corresponding characters matches: ( w_1 = w_2, w_3 = w_4, \dots ).
  4. Step 3: Checking the Transformation to ( wc ): The NTM now verifies that the third part of the string follows the transformation rules to form ( wc ) from ( w ). The transformation rule is as follows:

    • If ( w_i = a ), then ( wc_i = b ),
    • If ( w_i = b ), then ( wc_i = a ).

    This involves checking that for each character of ( w ), the corresponding character of ( wc ) satisfies the transformation condition.

  5. Step 4: Repeating the Process for Multiple Repetitions: Since the string is in the form ( (wwc)^n ), where ( n > 1 ), the NTM needs to verify that the pattern repeats multiple times.

    • The NTM will non-deterministically guess the next boundary (the next position where a new ( (wwc) ) pattern starts).
    • It repeats Steps 2 and 3 for each new repetition, ensuring that:
      • The second ( w ) matches the first ( w ),
      • The corresponding characters in ( wc ) follow the transformation rules.
  6. Step 5: Accept or Reject:

    • If the NTM successfully verifies all repetitions, it will accept the input string.
    • If any repetition fails (i.e., the second ( w ) doesn't match the first ( w ), or the transformation rules for ( wc ) are violated), the machine will reject the string.

Summary of Non-Deterministic Steps:

  1. Non-deterministically guess the boundary between the first ( w ) and the second ( w ).
  2. Verify the repetition: Ensure that the second ( w ) matches the first ( w ).
  3. Check the transformation to ( wc ): For each character in ( w ), ensure the corresponding character in ( wc ) follows the transformation rules:
    • ( w_i = a \rightarrow wc_i = b ),
    • ( w_i = b \rightarrow wc_i = a ).
  4. Repeat for subsequent ( (wwc) ) patterns, non-deterministically choosing new boundaries and checking the transformation and repetition rules.
  5. Accept or reject based on whether all repetitions are valid.

Key Insight on Non-Determinism:

The most important non-deterministic step is in Step 1, where the machine guesses where each new repetition of ( (wwc) ) starts. This non-deterministic guess allows the NTM to explore multiple possible ways of dividing the string into repeated ( (wwc) ) patterns. For each guess, the NTM checks the corresponding characters for matching and transformation. If any part of the string doesn’t conform, the machine rejects the input.

$\endgroup$
1
  • $\begingroup$ I find items numerate twice even more distracting where numbered inconsistently: use 0. for the item before Step 1. Oh, and use \rightarrow & co in a math context(enclose in \$\rightarrow\$) - or an XML entity: →. $\endgroup$
    – greybeard
    Commented Nov 6 at 13:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.