Turing machines are computational models, most universal and powerful. It is used to accept languages, compute functions, and solve problems.
M = (Q, \Sigma, \Gamma, \delta, q_0, B, F)
|a_1|a_2|\cdots|a_n|B|B|\cdots
\delta(q, X) = (p, Y, D) produces the next state where q is the current state, X is the current symbol read by the head, p is the new state, Y is the printed symbol, D is the direction (D \in \{L, R\}).
Design a turing machine which computes the following function, f : \mathbb N \to \mathbb N, f(n) = \lceil\frac{n}{3}\rceil
We can use unary system, that is, n is represented as the digit repeated n times (5_{10} \equiv 00000_1). Walk along the tape, turn the first leading zero into a new symbol, ie A, go to the end of the tape, remove 2 trailing zeros. Repeat. Print all A as a number.
Transition function as a table:
\delta | 0 | A | X | B |
---|---|---|---|---|
q_0 | (q_2, X, R) | (q_6, B, R) | ||
q_1 | (q_2, A, R) | (q_6, B, L) | ||
q_2 | (q_2, 0, R) | (q_3, B, L) | ||
q_3 | (q_4, B, L) | (q_6, 0, L) | (q_6, 0, R) | |
q_4 | (q_L, B, L) | (q_6, 0, L) | (q_6, 0, R) | |
q_L | (q_L, 0, L) | (q_1, A, R) | (q_1, X, R) | |
q_6 | (q_A, 0, L) | (q_6, 0, L) | (q_6, 0, R) | (q_A, B, L) |
Empty spaces indicated states that will never happen.
Thus, M = (\{q_0, q_1, 1_2, q_3, q_4, q_L, q_6, q_A\}, \{0\}, \{0, A, X, B\}, \delta, q_0, B, \{q_A\})
tape content
state of control unit
head position
\alpha, left of the head
\beta, from head to the right to the last non-blank symbol
q
Sequence of configurations in which,
Example from above:
\begin{aligned} &q_0 0000000 \vdash X q_2 000000 \vdash X0 q_2 00000 \vdash X00 q_2 0000 \stackrel{3}{\vdash} X00000 q_2 0 \vdash \\ &\vdash X000000 q_2 \vdash X00000 q_3 0 \vdash X0000 q_4 0 \vdash X000 q_L 0 \vdash X00 q_L 00 \vdash X0 q_L 0000 \vdash \\ &\vdash q_L X 0000 \vdash X q_1 0000 \vdash XA q_2 000 \stackrel{3}{\vdash} XA000 q_2 \vdash XA00 q_3 0 \vdash XA0 q_4 0 \vdash \\ &\vdash XA q_L 0 \vdash X q_L A0 \vdash XA q_1 0 \vdash XAA q_2 \vdash XA q_3 A \vdash X q_6 A 0 \vdash q_6 X00 \vdash 0 q_6 00 \vdash q_A 000 \end{aligned}
First cell of the tape is a guard symbol \#. This symbol can only be stored there.
\delta(q, \#) = (p, \#, R)
Turing machines in basic model are equivalent to Turing machines with guard.
M = (Q, \Sigma, \Gamma, \delta, q_0, B, \{ACC\}), where ACC is the accepting state with stop condition.
M = (Q, \Sigma, \Gamma, \delta, q_0, B, \{ACC\}, \{REJ\}), where REJ is the rejecting state with stop condition. Computation is finished iff the machine switches to ACC.
The tape has several tracks. M = (Q, \Sigma, \Gamma, \delta, q_0, B, F). Input configuration: input data are stored on the first track. All other tracks are filled in with the blank symbol. \delta: Q \times \Gamma^k \to Q \times \Gamma^k \times \{L, R\} where k is the amount of tracks. Again, multitrack turing machines are equivalent to basic models.
\cdots|B|B|a_1|a_2|\cdots|a_n|B|B|\cdots
M = (Q, \Sigma, \Gamma, \delta, q_0, B, F)
For some configurations there may be more than one possible move. Machine picks the move which leads to the acceptation of input.
In general empty entry in transition table means beginning of infinite computation. For sake of simplicity in some cases we might interpret empty entries as rejecting the input. In fact in each empty entry we should start the cleaning procedure and rejecting the input.
Our interpretation of non-determinism relies on interpreting computation as a tree. A non-deterministic machine accepts iff at least one leaf accepts.
Maximal amount of options is called the degree of non-determinism.
The number of children in the computation tree cannot be bigger than the degree of non-determinism.
The class of non-deterministic TM is equivalent to the class of deterministic TM (in terms of problems they solve).
Given is a non-deterministic TM and some input date. Consider the computation tree for this input. This is a k-tree. k-degree of non-determinism. At each level we have a finite number of nodes. Let’s visit this tree with BFS, if there is an accepting leaf we will come to this leaf after final number of steps. Based on this observation we will construct a deterministic machine which is equivalent to this non-deterministic one.
A TM with a input tape guarded from both sides of the input. Used to accept CSL.
It has a stack and input tape. A = (Q, \Sigma, \Gamma, \delta, q_0, \vdash, F)
Configuration \gamma q w:
Computation of push down automata is always finite. It is used only for acceptation of languages, not for computing functions.
A move of a push down automaton is done as follows:
Push down automata is deterministic iff:
For a given push down automaton we can construct a TM which will be equivalent. The opposite is not always true.
Reads input word letter by letter switching between states. State at the end of the input is the final output. Used to accept/reject regular languages and only those. Transition function is \delta: Q \times \Gamma \to Q
The transition function can read empty words, ie change states without consuming letter: \delta: Q \times (\Sigma \cup \{\varepsilon\}) \to 2^Q. \varepsilon-NFA is equivalent to DFA.
All states that can be reached only with \varepsilon: \varepsilon\text{-}Cl(q) = \{p : p \in \delta(q, \varepsilon)\}
Generated DFA from the following methods is minimal (with respect to states ie has the smallest amount of states).
Each state is represented as an equivalence class of the R_L relation. Transition between states is reflected by transitions between equivalence classes when concatenating a letter. Accepting states are those whose equivalence classes contain words in the language.
Of languages: L_1 \backslash L_2 = \{y \in \Sigma^* : (\exists_{x\in L_2})xy \in L_1\}