# Lecture 1: Intro

## hy Study the Theory of Computation?

### Applications of the Theory

• FSMs for parity checkers, vending machines, communication protocols, and building security devices.
• Interactive games as nondeterministic FSMs.
• Programming languages, compilers, and context-free grammars.
• Natural languages are mostly context-free
• Speech understanding systems use probabilistic FSMs.
• Computational Biology - DNA and proteins are strings
• The undecidability of a simple security model
• Artificial intelligence - the undecidability of first-order logic

## Languages and Strings

### TERM DEFINITION

﻿$\Sigma$﻿ - Alphabet

Symbols/Characters - Members of the alphabet

String - Finite sequence of characters from the alphabet

﻿$\epsilon$﻿ - Empty String

﻿$\Sigma^{\cdot}$﻿ - Set of all strings (Sigma with an asterix)

﻿$\left|s\right|$﻿- Number of symbols in s

Example - ﻿$\left|\epsilon\right|=0$﻿ or ﻿$\left|1001101\right|=7$﻿

### Single Framework for Problem Analysis - Language Recognition

Language - Set of finite (possibly infinite) length strings over a finite alphabet.

#### Example: Code Problem

int alpha, beta;

alpha = 3;

beta = (2+5)/10;

### Methods of Solving

#### 1 Lexical Analysis

Break up the problem into variable names, numbers etc.

#### 2 Parsing

Create a tree to represent the sequence of operations that should be executed.

The above example is shown in tree form below

#### 3 Optimization

Optimize information that isn't valuable to the solution.

For the above example, although alpha is defined to be 3, it's never actually used. Beta is found using only constants and so can be solved on its own.

#### 4 Termination

Decide whether the program is guaranteed to halt or not.

#### 5 Interpretation

Figure out the use of the function/codde