(チューリング機器)

http://www.sw.it.aoyama.ac.jp/2016/Compiler/lecture12.html

© 2005-15 Martin J. Dürst 青山学院大学

- Summary of last lecture
- Example solution for
`bison`

homework - Turing Machines

- Error processing in a parser has many requirements and difficulties
- In
`bison`

, errors can be caught with an`error`

token - The output of a parser includes the symbol table and an abstract parse tree as intermediate representations
- Semantic analysis is mostly concerned with type checking and type inference

`bison`

Homework(paper only)

(Chomsky hierarchy)

Grammar | Type | Language (family) | Automaton |

phrase structure grammar (psg) | 0 | phrase structure language | Turing machine |

context-sensitive grammar (csg) | 1 | context-sensitive language | linear bounded automaton |

context-free grammar (cfg) | 2 | context-free language | pushdown automaton |

regular grammar (rg) | 3 | regular language | finite state automaton |

- Alan Turing, British Mathematician, 1912-1954
- "On computable numbers, with an application to the Entscheidungsproblem" published in 1936
- Turing worked on en/decription during World War II
- Turing test: test whether a machine can 'think', 1950
- Turing Prize: Most famous prize in Computer Science

- (finite set of) states
- (finite set of) transitions between states
- Start state
- Accepting state(s)
- Deterministic or nondeterministic

- Finite state automaton: No memory
- Pushdown automaton: Memory stack
- (Linear bounded automaton: Finite-length tape)
- Turing machine: Infinite length tape

(can be simulated with two stacks)

- 'Infinite' tape with symbols
- Special 'blank' symbol (␣ or _),

used outside actual work area - Start at first non-blank symbol from the right

(or some other convenient position) - Read/write head:
- Reads a tape symbol from present position
- Decides on symbol to write and next state
- Writes symbol at present position
- Moves to the right (R) or to the left (L)
- Changes to new state

- Start state and accept state(s)

- Adding 1 to a binary number
- Tape symbols: 0, 1 (+blank)
- Three states:
- Adding/carry
- Move to left
- Accept

6-tuple:

- Finite, non-empty set of states
`Q` - Finite, non-empty set of tape symbols
`Σ` - Transition function
- Blank symbol (∈
`Σ`) - Initial state (∈
`Q`) - Set of final states (⊂
`Q`)

- Interleave data fields and control fields
- Use special symbols as markers
- Use special states to move across tape to different locations

- Nondeterminism
- Parallel tapes
- 2-dimensional tape
- Subroutines

It can be shown that all these extensions can be simulated on a plain Turing machine

- It is possible to design a Turing machine that can simulate any Turing machine (even itself)
- Encode states (e.g. as binary or unary numbers)
- Encode tape symbols (e.g. as binary or unary numbers)
- Create different sections on tape for:
- Data (encoded tape symbols)
- State transition table (program)
- Internal state

- Main problems:
- Construction is tedious
- Execution is very slow

It turns out that there are many other mechanisms that can simulate an (universal) Turing machine:

- Lambda calculus (everything is a function)
- Partial recursive functions
- SKI Combinator Calculus
- ι (iota) Calculus
- (Cyclic) tag systems
- Conway's game of life
- Wolfram's Rule 110 cellular automaton
- Wolfram's 2,3 Turing machine

(Turing machine with only 2 states and three symbols)

All these mechanisms can simulate each other and have the same power.

- Anything (any function on natural numbers) that can be calculated can be calculated by a Turing machine
- Anything that cannot be calculated by a Turing machine cannot be calculated

It is unclear whether this applies to Physics in general.

- Von Neumann style architecture: Current computer architecture closely
follows Turing machine

(main difference: Random Acccess Memory) - Entscheidungsproblem: There are some Mathematical facts that cannot be proven
- Computable numbers: There are real numbers that cannot be computed
- Halting problem: There is no general way to decide whether a program will terminate (halt) or not

- The Annotated Turing, Charles Petzold, Wiley, 2008
- Understanding Computation, Tom Stuart, O'Reilly, 2013

(also available in Japanese) - A New Kind of Science, Stephen Wolfram, Wolfram Media, 2002
- To Mock a Mockingbird, Raymond M. Smullyan, Oxford University Press, 2000

Deadline: June 30, 2016 (Thursday), 19:00

Where to submit: Box in front of room O-529 (building O, 5th floor)

Format: A4 single page (using both sides is okay; NO cover page, staple in top left corner if more than one page is necessary), easily readable handwriting (NO printouts), name (kanji and kana) and student number at the top right

For the Turing machine given by the following state transition table:

Current state | Current tape symbol | New tape symbol | Movement direction | Next state |

→1 | 0 | 1 | L | 1 |

→1 | 1 | 0 | L | 2 |

→1 | _ | _ | L | 4* |

2 | 0 | 0 | L | 2 |

2 | 1 | 1 | L | 2 |

2 | _ | _ | R | 3 |

3 | 0 | _ | R | 3 |

3 | 1 | 1 | L | 4* |

- Draw the state transition diagram for this machine
- Show in detail how this machine processes the input ..._1100100_...
- Guess and explain what kind of calculation this machine does if the tape contains only a single contiguous sequence of '0'es and '1'es with at least one '1' (surrounded by blanks)

(The Turing machine always starts on the rightmost non-blank symbol)

- commonalities
- 共通点
- nondeterminism
- 非決定性
- universal turing machine
- 万能チューリング機器