1. Home
  2. Explore
  3. Computer Science
  4. Computability Theory Introduction

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Computability Theory Introduction

Introduction to the Theory of Computing

This course explores the fundamental capabilities and limitations of computers and algorithms. It is divided into two halves.

Course Overview

Computability theory asks what can be computed in principle using an algorithm. This field was largely completed by the 1950s after its major questions were answered. Examples of uncomputable problems include:

  • Automatically verifying whether a program meets its specification.

  • Determining whether an arbitrary mathematical statement is true or false.

Complexity theory shifts focus to what can be computed in practice—that is, within a reasonable amount of time. A central open problem is whether large numbers can be factored quickly, connected to the famous P versus NP problem. The course also examines other measures of complexity such as time and memory (space), and introduces models like probabilistic and interactive computation.

Prerequisites and Expectations

This is a moderate-to-advanced mathematics class. Students are expected to have substantial prior experience with mathematical theorems and proofs. The course begins slowly but ramps up quickly. Homework and exams require producing proofs, so comfort with proof-writing is essential.

The Role of Theory in Computer Science

Theoretical computer science aims to deepen our understanding of computation. Many fundamental questions remain unanswered—for example, how the brain computes, or why creative tasks are so difficult for machines. Understanding the power and limits of computation is a deep and ongoing challenge, and the elegant theory covered in this course has already paid off in applications and will likely continue to do so.


Models of Computation

Real-world computers are too complex to study mathematically. Instead, we use abstract models that capture essential features. The first and simplest model is the finite automaton.

Finite Automata (Informal)

A finite automaton is a machine with a small, limited amount of memory. It processes an input string one symbol at a time and either accepts or rejects the string.

A state diagram represents the automaton:

  • States are circles (e.g., q1,q2,q3q_1, q_2, q_3q1​,q2​,q3​).

  • Transitions are arrows between states, labeled with input symbols.

  • One state is the start state (arrow coming from nowhere).

  • Accepting states are double circles.

Example M1: The automaton below accepts strings that contain the substring 11.

(start) → q1 --0--> q1
          q1 --1--> q2
          q2 --0--> q1
          q2 --1--> q3
          q3 --0,1--> q3

Processing the string 01101:

  • Start at q1q_1q1​.

  • Read 0 → stay at q1q_1q1​.

  • Read 1 → go to q2q_2q2​.

  • Read 1 → go to q3q_3q3​.

  • Read 0 → stay at q3q_3q3​ (since q3q_3q3​ loops on both symbols).

  • Read 1 → stay at q3q_3q3​.

  • End in q3q_3q3​ (accept state) → accept.

Processing 00101 ends in q2q_2q2​ (not accepting) → reject.

The language of a machine MMM is the set of all strings it accepts, denoted L(M)L(M)L(M). For M1, L(M1)={strings containing 11}L(M_1) = \{ \text{strings containing } 11\}L(M1​)={strings containing 11}.

Formal Definition of a Finite Automaton

A finite automaton is a 5-tuple (Q,Σ,δ,q0,F)(Q, \Sigma, \delta, q_0, F)(Q,Σ,δ,q0​,F):

  • QQQ: a finite set of states.

  • Σ\SigmaΣ: a finite set of alphabet symbols.

  • δ\deltaδ: the transition function δ:Q×Σ→Q\delta: Q \times \Sigma \to Qδ:Q×Σ→Q that maps a state and an input symbol to a next state. Represented by a table or diagram.

  • q0∈Qq_0 \in Qq0​∈Q: the start state.

  • F⊆QF \subseteq QF⊆Q: the set of accept states.

Example (M1 formalized):

  • Q={q1,q2,q3}Q = \{q_1, q_2, q_3\}Q={q1​,q2​,q3​}

  • Σ={0,1}\Sigma = \{0,1\}Σ={0,1}

  • δ\deltaδ:

    State

    0

    1

    q1q_1q1​

    q1q_1q1​

    q2q_2q2​

    q2q_2q2​

    q1q_1q1​

    q3q_3q3​

    q3q_3q3​

    q3q_3q3​

    q3q_3q3​

  • q0=q1q_0 = q_1q0​=q1​

  • F={q3}F = \{q_3\}F={q3​}

Strings and Languages

  • A string is a finite sequence of symbols from the alphabet (Σ\SigmaΣ). (Infinite strings are not considered in this course.)

  • A language is a set of strings.

  • The empty string ε\varepsilonε is the string of length 0.

  • The empty language ∅\emptyset∅ is the set containing no strings. These are different objects.

Formal Definition of Acceptance

Let w=w1w2…wnw = w_1 w_2 \dots w_nw=w1​w2​…wn​ be an input string. A finite automaton M=(Q,Σ,δ,q0,F)M = (Q, \Sigma, \delta, q_0, F)M=(Q,Σ,δ,q0​,F) accepts www if there exists a sequence of states r0,r1,…,rnr_0, r_1, \dots, r_nr0​,r1​,…,rn​ such that:

  1. r0=q0r_0 = q_0r0​=q0​ (starts at the start state),

  2. δ(ri−1,wi)=ri\delta(r_{i-1}, w_i) = r_iδ(ri−1​,wi​)=ri​ for i=1,…,ni = 1,\dots,ni=1,…,n (each step follows the transition function),

  3. rn∈Fr_n \in Frn​∈F (ends in an accept state).


Regular Languages

A language is regular if there exists some finite automaton that recognizes it.

Examples:

  • Even number of 1s: The language B={w∈{0,1}∗∣w has an even number of 1s}B = \{ w \in \{0,1\}^* \mid w \text{ has an even number of 1s} \}B={w∈{0,1}∗∣w has an even number of 1s} is regular. A two-state automaton tracking parity can recognize it.

  • Equal number of 0s and 1s: This language is not regular — no finite automaton can recognize it (to be proven later).


Regular Operations

Operations on languages that produce new languages:

Union

The union A∪B={w∣w∈A or w∈B}A \cup B = \{ w \mid w \in A \text{ or } w \in B \}A∪B={w∣w∈A or w∈B}.

Concatenation

The concatenation A∘B={xy∣x∈A and y∈B}A \circ B = \{ xy \mid x \in A \text{ and } y \in B \}A∘B={xy∣x∈A and y∈B}. Often written as ABABAB.

Star (Kleene Star)

The star A∗={x1x2…xk∣k≥0 and each xi∈A}A^* = \{ x_1 x_2 \dots x_k \mid k \ge 0 \text{ and each } x_i \in A \}A∗={x1​x2​…xk​∣k≥0 and each xi​∈A}. This always includes ε\varepsilonε (the empty string) as the case k=0k=0k=0.

Examples (with A={good, bad}A = \{\text{good, bad}\}A={good, bad}, B={boy, girl}B = \{\text{boy, girl}\}B={boy, girl}):

  • A∪B={good, bad, boy, girl}A \cup B = \{\text{good, bad, boy, girl}\}A∪B={good, bad, boy, girl}

  • A∘B={goodboy, goodgirl, badboy, badgirl}A \circ B = \{\text{goodboy, goodgirl, badboy, badgirl}\}A∘B={goodboy, goodgirl, badboy, badgirl}

  • A∗={ε,good, bad, goodgood, goodbad, badgood, badbad, goodgoodgood, … }A^* = \{ \varepsilon, \text{good, bad, goodgood, goodbad, badgood, badbad, goodgoodgood, } \dots\}A∗={ε,good, bad, goodgood, goodbad, badgood, badbad, goodgoodgood, …} (infinite)

If AAA contains any non-empty string, A∗A^*A∗ is infinite. If A=∅A = \emptysetA=∅ or A={ε}A = \{\varepsilon\}A={ε}, then A∗={ε}A^* = \{\varepsilon\}A∗={ε}.


Regular Expressions

Regular expressions describe languages using the regular operations. They consist of:

  • Atomic building blocks: alphabet symbols (e.g., 0,10, 10,1), the empty string ε\varepsilonε, the empty language ∅\emptyset∅.

  • Composite expressions formed by applying union (∪\cup∪), concatenation (juxtaposition), and star (∗^*∗).

Examples (over Σ={0,1}\Sigma = \{0,1\}Σ={0,1}):

  • Σ∗\Sigma^*Σ∗ (or (0∪1)∗(0 \cup 1)^*(0∪1)∗) is the language of all strings.

  • Σ∗1\Sigma^* 1Σ∗1 is the set of all strings ending with 111.

  • Σ∗11Σ∗\Sigma^* 11 \Sigma^*Σ∗11Σ∗ is the set of all strings containing 111111 — exactly the language of M1.

Equivalence: Finite automata and regular expressions are equally powerful — they both describe exactly the regular languages. This will be proved later.


Closure Properties

A class of objects is closed under an operation if applying that operation to objects in the class always yields another object in the same class. The class of regular languages is closed under union, concatenation, and star.

Closure Under Union

Theorem: If A1A_1A1​ and A2A_2A2​ are regular languages, then A1∪A2A_1 \cup A_2A1​∪A2​ is regular.

Proof:

  • Since A1A_1A1​ and A2A_2A2​ are regular, there exist finite automata M1=(Q1,Σ,δ1,q1,F1)M_1 = (Q_1, \Sigma, \delta_1, q_1, F_1)M1​=(Q1​,Σ,δ1​,q1​,F1​) and M2=(Q2,Σ,δ2,q2,F2)M_2 = (Q_2, \Sigma, \delta_2, q_2, F_2)M2​=(Q2​,Σ,δ2​,q2​,F2​) that recognize them. (We assume the same alphabet; the proof is similar otherwise.)

  • Construct a new automaton MMM that simulates M1M_1M1​ and M2M_2M2​ in parallel on the input www. MMM keeps track of which state M1M_1M1​ is in and which state M2M_2M2​ is in simultaneously.

  • State set of MMM: Q=Q1×Q2={(r1,r2)∣r1∈Q1,r2∈Q2}Q = Q_1 \times Q_2 = \{ (r_1, r_2) \mid r_1 \in Q_1, r_2 \in Q_2 \}Q=Q1​×Q2​={(r1​,r2​)∣r1​∈Q1​,r2​∈Q2​}.

  • Start state: (q1,q2)(q_1, q_2)(q1​,q2​).

  • Transition function: δ((r1,r2),a)=(δ1(r1,a),δ2(r2,a))\delta((r_1, r_2), a) = (\delta_1(r_1, a), \delta_2(r_2, a))δ((r1​,r2​),a)=(δ1​(r1​,a),δ2​(r2​,a)) for every a∈Σa \in \Sigmaa∈Σ.

  • Accept states: F={(r1,r2)∣r1∈F1 or r2∈F2}F = \{ (r_1, r_2) \mid r_1 \in F_1 \text{ or } r_2 \in F_2 \}F={(r1​,r2​)∣r1​∈F1​ or r2​∈F2​} — because MMM should accept if either component accepts.

  • Then L(M)=L(M1)∪L(M2)L(M) = L(M_1) \cup L(M_2)L(M)=L(M1​)∪L(M2​), so the union is regular.

Number of states: ∣Q∣=∣Q1∣×∣Q2∣|Q| = |Q_1| \times |Q_2|∣Q∣=∣Q1​∣×∣Q2​∣ (product, not sum).

Note: The same construction using accept states {(r1,r2)∣r1∈F1 and r2∈F2}\{ (r_1, r_2) \mid r_1 \in F_1 \text{ and } r_2 \in F_2 \}{(r1​,r2​)∣r1​∈F1​ and r2​∈F2​} would give closure under intersection.

Closure Under Concatenation (Intuition and Challenge)

Theorem: If A1A_1A1​ and A2A_2A2​ are regular, then A1A2A_1 A_2A1​A2​ is regular.

The natural approach: build an automaton MMM that first simulates M1M_1M1​ (which recognizes A1A_1A1​) and then, when M1M_1M1​ would accept, switches to simulating M2M_2M2​ (which recognizes A2A_2A2​). One might try to connect every accept state of M1M_1M1​ to the start state of M2M_2M2​ via ε\varepsilonε-transitions, making those accept states non-accepting and making accept states of M2M_2M2​ the new accept states.

Why this naive approach fails: The correct split of www into two parts w=xyw = xyw=xy with x∈A1x \in A_1x∈A1​, y∈A2y \in A_2y∈A2​ is unknown. The first time M1M_1M1​ would accept after reading a prefix may not be the correct split; the true split might occur later. Since MMM cannot “look ahead” to see the rest of www, a single deterministic simulation cannot guess the split point.

Nevertheless, the theorem is true. The proof requires a more powerful concept — nondeterminism — which will be introduced next. Closure under concatenation will be proved in a subsequent lecture.


This concludes the first lecture. Upcoming topics include nondeterministic finite automata (NFA), proving the equivalence of regular expressions and finite automata, and establishing closure under all regular operations using these tools.

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent