2016-12-01 6 views

답변

2

테이프 알파벳을 0, 1 및 - (공백)로만 구성한다고 가정합니다. 우리의 전략은 단일 테이프 튜링 기계로 작업 할 때 유익한 전략입니다. 중간에 0을 중심으로 앞뒤로 튀어 오를 것이며, 우리가 그들을 발견 할 때 1 초를 넘을 것입니다. 우리는 1을 다 쓸 때까지 계속해서 공란에 도달 할 것입니다. 이 시점에서 테이프에 남아있는 것은 모두 1^| m-n | n + m + 1- | m-n | 0. 마지막으로, 우리는 테이프의 시작 부분에 결과를 복사합니다 (이미있는 경우가 아니라면, 즉 m> n). 그리고 0을 지 웁니다.

Q s s' D Q' 

// read past 1^n 
q0 1 1 R q0 

// read through zeroes 
q0 0 0 R q1 
q1 0 0 R q1 

// mark out the first 1 remaining in 1^m 
q1 1 0 L q2 

// read through zeros backwards 
q2 0 0 L q2 

// mark out the last 1 remaining in 1^n 
q2 1 0 R q1 

// we were reading through zeroes forward 
// and didn't find another 1. n >= m and 
// we have deleted the same number from 
// the first and last parts so just delete 
// zeroes 
q1 - - L q3 
q3 0 - L q3 
q3 1 1 L halt_accept 

// we were reading through zeroes backwards 
// and didn't find another 1. n < m and we 
// accidentally deleted one too many symbols 
// from the 1^m part. write it back and start 
// copying the 1s from after the 0s back to 
// the beginning of the tape. then, clear zeroes. 
q2 - - R q4 
q4 0 1 R q5 
q5 0 0 R q5 
q5 1 0 L q6 
q6 0 0 L q6 
q6 1 1 R q4 
q5 - - L q7 
q7 0 - L q7 
q7 1 1 L halt_accept 

자연스럽게 TM 예제는 실행 예제없이 완료되지 않습니다.

-111110111- => -111110111- => -111110111- 
^     ^    ^
q0     q0     q0 

=> -111110111- => -111110111- => -111110111- 
     ^    ^    ^
     q0     q0     q0 

=> -111110111- => -111110011- => -111110011- 
      ^    ^    ^
      q1    q2    q2 

=> -111100011- => -111100011- => -111100011- 
     ^    ^    ^
      q1     q1     q1 

=> -111100001- => -111100001- => -111100001- 
      ^    ^    ^
      q2    q2    q2 

=> -111100001- => -111000001- => -111000001- 
     ^    ^    ^
     q1     q1     q1 

=> -111000001- => -111000001- => -111000001- 
      ^    ^    ^
      q1     q1     q1 

=> -111000000- => -111000000- => -111000000- 
      ^    ^    ^
      q2     q2    q2 

=> -111000000- => -111000000- => -111000000- 
     ^    ^    ^
      q2     q2    q2 

=> -110000000- => -110000000- => -110000000- 
     ^    ^    ^
     q1     q1     q1 

=> -110000000- => -110000000- => -110000000- 
      ^    ^    ^
      q1     q1     q1 

=> -110000000- => -110000000- => -11000000-- 
      ^    ^    ^
       q1    q3    q3 

=> -1100000--- => -110000---- => -11000----- 
      ^    ^    ^
      q1    q3    q3 

=> -1100------ => -110------- => -11-------- 
     ^    ^    ^
     q1    q3    q3 

=> -11-------- 
    ^
     halt_accept