The Timpson Lyceum · Computation Theory
Lecture 3 (Computation Theory) Graph Theory and Finite Automata
Overview
This lecture builds up the mathematical machinery needed for computation theory by working through progressively richer models. It opens by reviewing set operations, relations, and functions, then introduces graph theory (undirected and directed graphs) as a gentle first example of a formal mathematical model. After a short detour into proof technique — De Morgan's laws for sets and proof by induction with sigma notation — it arrives at the central object of the course: the finite automaton. Using a door-controller story and two recognizers over the binary alphabet, the lecture shows how a state diagram and a formal five-tuple are two equivalent descriptions of the same machine, and how a machine's language is the set of strings it accepts.
Key Concepts
Set operations (review). For sets and :
- Union — everything in or : .
- Intersection — everything in and : .
- Set difference — everything in not in : . Order matters: .
- Complement — everything not in . Only meaningful relative to a stated universe; if the universe is the positive integers, .
Relations and functions.
- A relation is a set of ordered pairs.
- A function is a relation in which every left-hand element is paired with exactly one right-hand element.
- The notation tells you three things at once: is a function, is its domain (every element of is a left-hand element), and the image (set of right-hand elements) is a subset of — not necessarily all of .
Graphs.
- A graph is an ordered pair where is a non-empty finite set of vertices (nodes) and is a set of two-element subsets of called edges. may be empty (vacuously satisfying the definition).
- A graph is drawn by placing each vertex as a labeled circle and drawing a line segment between the two vertices of each edge. The picture and the set-theoretic definition are interchangeable.
- A directed graph is where is again a non-empty finite set but is a relation on — a set of ordered pairs. Each edge becomes an arrow; reversing a pair reverses the arrow. (Example: the "beats" relation on .)
- The degree of a node is the number of edges connected to it.
De Morgan's laws for sets. Mirroring the logical laws and :
Sigma notation. A compact way to write a sum: . The bottom gives the dummy variable and starting value; the top gives the ending value; you substitute each integer in turn and add. E.g. .
Proof by induction. To prove a predicate holds for every natural number:
- Base case — show is true (or if starting at 1).
- Inductive step — assume (the inductive hypothesis) and show it forces .
- Conclude holds for all . Intuition: a set containing and closed under "" must contain all of .
Strings and languages.
- An alphabet is a non-empty finite set; common ones are (the binary alphabet) and .
- A symbol is a member of an alphabet.
- A string is a finite sequence of symbols (e.g. , length ). The empty string is written .
- A language is a set of strings.
Finite automaton (DFA). A finite automaton is a five-tuple :
- — a finite set of states.
- — the input alphabet.
- — the transition function ; it takes a current state and an input symbol and returns the next state. It must be defined for every (state, symbol) pair.
- — the single start state (marked by an incoming arrow from nowhere).
- — the set of accept states (drawn as double circles); there may be several.
A string is accepted if, reading its symbols one at a time from the start state, the machine ends in an accept state. The language of , written , is the set of all strings accepts — equivalently, " recognizes ." The state diagram and the five-tuple are equivalent descriptions of the same machine.
Worked Example
Prove by induction that for all .
Let ; the goal is to show .
Base case (): the left side is the single term , and the right side is , so .
Inductive step: assume , i.e. . Then split off the last term and substitute the hypothesis:
This is exactly the formula with , so . By induction , and the identity holds for every natural number.
A finite automaton: even number of 0s. Over , build a DFA recognizing all binary strings with an even number of 0s. Use two states: (even count so far, the start and accept state) and (odd count). On input , toggle between the states; on input , stay put. Tracing ends back in — accepted; tracing ends in — rejected. Formally .
Summary
- Set operations (union, intersection, difference, complement), relations, and functions are the vocabulary underlying every later model; encodes "function," "domain ," and "image ."
- A graph is with edges as two-element subsets of vertices; a directed graph replaces with a relation (ordered pairs / arrows). The picture and the formal definition carry the same information.
- The sum of all node degrees in any graph is even, because each edge contributes exactly : with edges the degree sum is .
- De Morgan's laws transfer from logic to sets: and .
- Proof by induction (base case + inductive step) proves a statement for infinitely many in one stroke; sigma notation compactly expresses the sums it is most often used on.
- A finite automaton is described equivalently by a state diagram or a five-tuple; its language is the set of strings that drive it from the start state into an accept state.