# Lecture 09

Finite Languages $$\subset$$ Regular Languages $$\subset$$ Context-free Languages $$\subset$$ Decidable Languages $$\subset$$ Recognizable Languages

## Power of Turning Machines

Theorem Every regular languages is decidable.

Proof Let $$M=\{Q,\Sigma,\delta,q_0,F\}$$ be a DFA that recognizes the regular language $$L$$.

Let $$T=\{Q',\Sigma',\Gamma',\delta',q_0',q_{acc},q_{rej}\}$$ be the Turning Machine by

• $$Q'= Q\cup\{q_{acc},q_{rej}\}$$
• $$q_0'=q_0$$
• $$\Sigma'=\Sigma$$
• $$\Gamma'=\Sigma\cup\{\_\}$$
• $$\delta'(q,a)=(\delta(q,a),a,R)$$ for every $$a\in\Sigma$$.
• $$\delta'(q,\_)=(q_{rej},\_,R)$$ if $$q\not\in\Sigma$$.
• $$\delta'(q,\_)=(q_{acc},\_,R)$$ if $$q\in\Sigma$$.

Theorem Every context-free languages is decidable.

Proof Wrong approach: simulate a PDA.

Right approach: simulate/implement the CFG that generates the CFL $$L$$.

Key Idea Implement a CFG in Chomsky Normal form for $$L$$. Let you enumerate all possible strings of length equal to the input generated by the grammar in finite time.

## Variants of Turning Machines

### VarTM

Definition Let VarTM be the extension of TM model where we have a finite number of variables that take values in $$\Gamma$$.

Theorem Every language decidable by VarTMs is also decidable by TMs.

Proof $$Q'=Q\times\Gamma^m$$ where $$m$$ is the number of variables in the VarTM.

### SubTM

Definition Let SubTM be the extension of TM model where we can call other TMs and run them as a black box.

Theorem Every language decidable by SubTMs is also decidable by TMs.

Proof

### StackTM

Definition Let StackTM be the extension of TM model where the TMs have a stack.

Theorem Every language decidable by StackTMs is also decidable by TMs.

### MultiTM

Definition Let MultiTM be the extension of TM model where TMs have a constant number $$k$$ of tapes.

Theorem Every language decidable by MultiTMs is also decidable by TMs.

## Non-deterministic Turning Machines

Definition A non-deterministic TM is a 7-tuple $$(Q,\Sigma,\Gamma,\delta,q_0,q_{acc},q_{rej})$$ where $$\delta:Q\times\Gamma\rightarrow\mathcal{P}(Q\times\Gamma\times\{L,R\})$$

Definition The non-deterministic TM $$M$$ decides $$L$$ if

1. For every $$x\in L$$, at least one path leads to the accept state.
2. For every $$x\not\in L$$, no path leads to the accept states.
3. For every $$x\in\Sigma^*$$, all possible paths terminate (at $$q_{acc}$$ or $$q_{rej}$$ in a dead end).

Definition The non-deterministic TM $$M$$ recognizes $$L$$ if

1. For every $$x\in L$$, at least one path leads to the accept state.
2. For every $$x\not\in L$$, no path leads to the accept states.

Theorem If $$L$$ is decidable (recognizable) by a NTM, then it is also decidable(recognizable) by a TM.