Introduction to the Theory of Computing [cpsc421/intro]

Overview of the course [cpsc421/overview]

Broad categories of lectures:

Why study models of computation? [cpsc421/motivation]

  1. This helps us understand what is/isn’t possible.
  2. This helps us think about unconventional computing methods (brains, molecules, etc).

Class Logistics [cpsc421/logistics]

Prerequisites [cpsc421/prereqs]

  • Proofs, by induction especially
  • CPSC 213 and 221 (kind of)
  • Sets, graphs, discrete math, a little bit of linear algebra

Assignments [cpsc421/assignments]

  • Assignments available on Piazza
  • Assignment #1 should take an hour
  • In total: 10 assignments
  • Typically hard, include bonus questions
  • Groups of 2 allowed
  • LaTeX, Gradescope

Main concepts of the course [cpsc421/concepts]

Computational Problems. We want to understand things like: can I solve this problem? can I solve it fast?

  1. ex. Given a list, sort it.
  2. ex. Given an integer, find its prime factors.
  3. ex. Given a polynomial, find its roots.

Some Notation [cpsc421/notation]

Representation: We’ll consider everything to be a string.

To first talk about strings, we need to define an alphabet.

Definition 1. Alphabet [alphabet]

An alphabet is any finite non-empty set.

It is usually represented as Σ\Sigma or Γ\Gamma. Often Σ={0,1}\Sigma = \left\{ {0,1} \right\}, or Σ=ASCII\Sigma = \text{ASCII}, or Σ=Unicode\Sigma = \text{Unicode}.

Definition 2. String [string]

Computer science.
A string is a finite sequence of 0+0 + characters from an alphabet.
Programming.
A string is a UTF-8…

Definition 3. Empty string [empty-string]

We often will talk about the empty string, so we have a special symbol for it: ε\varepsilon.

Definition 4. sigma [sigma]

Σ*\Sigma \ast is the set of all strings with alphabet Σ\Sigma.

Definition 5. Language [language]

A language is any set LL (including infinite sets) such that LΣ*L \subset \Sigma \ast. Even L=L = \varnothing is okay.

Definition 6. Computational Problem [problem]

A computational problem is a function mapping strings to strings.

Example.

f(6)=2,3f(6) = \text{2,3}

Example.

f(z8sst)=errorf\left( \text{z8sst} \right) = \text{error}

Note that the definition of a computational problem does not specify how to produce the outputs from the inputs. There is no algorithm here.

We’re often interested in a specific type of computational problem: decision problems.

Definition 7. decision problem [decision-problem]

A decision problem is a computational problem with a Boolean / binary / n-ary output.

We can usually tweak computational problems to become decision problems: e.g. given (x,y)\left( {x,y} \right), does xx have a prime factor that is <y< y?

Important Idea: decision problems are equivalent to languages.

Example.

Let ff be a decision problem. Let LL be the set of all strings that ff maps to “Yes”.

L={xΣ*:f(x)=Yes}L = \left\{ {x \in \Sigma \ast :f(x) = \text{Yes}} \right\}T={xΣ*:f(x)=No}T = \left\{ {x \in \Sigma \ast :f(x) = \text{No}} \right\}

LL and TT are complementary sets: no element is in both, and every element (of the overarching language) is in one or the other.

Example.

L={xΣ*:xis prime}L = \left\{ {x \in \Sigma \ast :x\ \text{is prime}} \right\}

The decision problem is f(x)={Yes ifxis prime; No otherwise}f(x) = \left\{ {\text{Yes if}\ x\ \text{is prime; No otherwise}} \right\}

Definition 8. Set builder notation [set-builder]

{xΣ*:f(x)=Yes}\left\{ {x \in \Sigma \ast :f(x) = \text{Yes}} \right\}
reads as for all XX in Σ*\Sigma \ast such that f(x)f(x) is equal to “Yes”

Recap: Learning Goals [cpsc421/intro-goals]

Note
This course and its slides were created for a MWF class, haven’t yet been adapted for TT
  1. What is the theory of computation about?
  2. What is a computational problem?
  3. What is computation?

Our definitions thus far: Alphabet, Computational problem, Decision problem, Finite Automaton (of DFA), Language-accepted-by, Regular Languages

Definitions: alphabet, string, computational problem, decision problem, language, Finite Automaton (of DFA), “Language Accepted By”, Regular Language