Computation
DFA / Regular
A finite automaton is a 5-tuple
where:
- $Q$ is a finite set called the set of states,
- $\Sigma$ is a finite set called the input alphabet,
- $\delta: Q \times \Sigma \to Q$ is the transition function,
- $q_{0}\in Q$ is the start state,
- $F \subseteq Q$ is the set of accepting states.
NFA / Regular
A nondeterministic finite automaton is a 5-tuple
where:
- $Q$ is a finite set of states,
- $\Sigma$ is a finite alphabet,
- $\delta: Q \times \Sigma_{\varepsilon} \to \mathcal{P}(Q)$ is the transition function,
- $q_{0}\in Q$ is the start state,
- $F \subseteq Q$ is the set of accepting states.
$P(Q)$ to be the collection of all subsets of $Q$.
PDA / CFG
A pushdown automaton is a 6-tuple
where:
- $Q$ is a finite set called the set of states,
- $\Sigma$ is a finite set called the input alphabet,
- $\Gamma$ is a finite set called the stack alphabet,
- $\delta: Q \times \Sigma_{\varepsilon} \times \Gamma_{\varepsilon} \to \mathcal{P}(Q \times \Gamma_{\varepsilon})$ is the transition function,
- $q_{0}\in Q$ is the start state,
- $F \subseteq Q$ is the set of accepting states.
DPDA / DCFG
A deterministic pushdown automaton is a 6-tuple
where:
- $Q$ is the set of states,
- $\Sigma$ is the input alphabet,
- $\Gamma$ is the stack alphabet,
- $\delta: Q \times \Sigma_{\varepsilon} \times \Gamma_{\varepsilon} \to (Q \times \Gamma_{\varepsilon}) \cup {\emptyset}$ is the transition function,
- $q_{0}\in Q$ is the start state,
- $F \subseteq Q$ is the set of accept states.
The transition function $\delta$ must satisfy the following condition:
for every $q\in Q$, $a\in \Sigma$, and $x\in \Gamma$, exactly one of
is not $\emptyset$.
Turing Machine
A Turing machine is a 7-tuple
where:
- $Q$ is the set of states,
- $\Sigma$ is the input alphabet not containing the blank symbol $␣$,
- $\Gamma$ is the tape alphabet, where $␣ \in \Gamma$ and $\Sigma \subseteq \Gamma$,
- $\delta: Q \times \Gamma \to Q \times \Gamma \times {L, R}$ is the transition function,
- $q_{0}\in Q$ is the start state,
- $q_{\mathrm{accept}}\in Q$ is the accept state,
- $q_{\mathrm{reject}}\in Q$ is the reject state, where $q_{\mathrm{reject}} \neq q_{\mathrm{accept}}$.
Properties
- Every non-deterministic Turing machine has an equivalent deterministic Turing machine.
- Every multitape Turing machine has an equivalent single-tape Turing machine.
Examples
Regular languages (DFA/NFA)
- $L_{1} = {w\in\{0,1\}^* \mid w\text{ has an even number of 1’s}}$
- $L_{2} = (0\mid1)^0(0\mid1)^$
- $L_{3} = {0^n1^m \mid n,m\ge0}$
- $L_{4} = {w\in\{a,b\}^* \mid \text{the third symbol from the right of }w\text{ is }a}$
Context-free languages but not regular (CFG/PDA)
$L_{5} = {a^n b^n \mid n\ge0}$
$L_{6} = {ww^R \mid w\in\{0,1\}^*}$ (palindromes)
$L_{7} = {\text{balanced parentheses over “(” and “)”}}$
Arithmetic expressions, e.g.
$$ E \to E + E \mid E * E \mid (E) \mid \mathit{id} $$
Non-context-free languages (not CFG/PDA)
- $L_{8} = {a^n b^n c^n \mid n\ge0}$
- $L_{9} = {ww \mid w\in\{0,1\}^*}$ (tandem repeats)
- $L_{10} = {a^p \mid p\text{ is prime}}$
- $L_{11} = {a^n b^n c^m d^m \mid n,m\ge0}$