most recent semester
This Course's Story
14 weeks in 28min
What are the limits of computation?
Once upon a time, some people were wondering
what the limits of computing are —
that is, what problems can a machine solve?
We'll call them Alonzo and Alan.
To think about this precisely, we need to have a model for
(a) what a machine is, and
(b) what a problem is.
This course looks at several different models, and
proves how they have differing (or same) powers (“expressibility”).
examples of problems
Here are some examples of what we’ll consider "problems";
they are simple, and clearly something one would hope a machine should be able to solve:
- state-abbr?:
Is something a valid U.S. state-abbreviation? e.g.
VA
and CA
, but not ZZ
nor hello
.
- b(ba*b)*?:
Does a piece of text match the regular expression b(ba*b)*?
You may have run across regular expressions in your programming courses;
if not, don't worry we’ll introduce (basic) reg.exps in this course.
- balanced-parens?:
Are all a document's parentheses balanced?
- anbncn:
Does a string have an equal-number of a’s, b’s, and c’s in that order, with nothing else?
- Java program syntactic?:
Your Java IDE does this routinely, when you try compiling a Java file:
verify that it's grammatically-legal Java program.
Once verified, it constructs the
syntax tree
for your program.
- Java program type-checks?:
Does a Java program have any static type errors?
Your IDE also does this, right after verifying a program is syntactic.
- Halts?:
Is a Java program free of infinite-loops?
This is a helpful feature that IDEs are missing.
Clearly it'd be helpful if the IDE could warn us before
running our program, that it can get into an infinite loop.
Note what all these have in common:
the input is a string, and the result is a boolean.
Note: Putting it differently: each problem
is a subset of all possible strings — the strings
that have a yes
answer to the question posed.
This is a bit different than what we sometimes think of as a "problem" in computer science,
since it omits things like Compute the square root of a number
or find the shortest path in a graph
.
We'll talk later about how to transform such problems into yes/no decision problems
.
Things that are not problems
, in Alonzo and Alan's formulation:
- How to achieve peace in the Mid-East?
- Is love inherently selfish?
- Make me a sandwich.
a good practice: Whenever you encounter a definition, in your studies,
think up several things that meet the definition,
and
several things that don't.
examples of models-of-computation
We'll discuss these models in detail later (starting with DFA);
- DFA (deterministic finite automaton):
A simple state-machine (
automaton
) which
has bounded number of states/configurations (finite
) it can be in,
and is predictable (deterministic
).
- nDFA (non-deterministic finite automaton):
The device can make guesses, and it's considered correct if: when *any* guess that leads to a “yes” answer,
the correct answer is indeed “yes” (it's able to guess luckily).
- regular grammar:
To be defined, but Alonzo knows these are equivalent to DFAs.
- PDA (push-down automaton):
A DFA with a stack added:
this allows infinite memory (stack-contents),
so it no longer has "finite state",
but with the limitation that you can only push/pop/peek the most recent memory element (top-of-stack).
- CFG (context-free grammar):
To be defined, but Alan knows these are equivalent to PDAs.
- TM (Turing Machine):
A DFA with a memory-tape;
instead of being limited to the top-of-stack, the read-head can scroll anywhere in memory.
(Alonzo says
Hey Alan, isn't Turing
your last name?
.)
Now we're ready to give away all the results from the next 14 weeks.
(However, we'll spend that time proving the entries in this table.)
\Problem Model\ | state-abbr? | b(ba*b)*? | balanced-parens? | Java-program-syntactic? | anbncn | Java-program-type-checks? | Halts? |
DFA | ✔ | ✔ | ✘ | ✘ | ✘ | ✘ | ✘ |
NDFA | ✔ | ✔ | ✘ | ✘ | ✘ | ✘ | ✘ |
PDA | ✔ | ✔ | ✔ | ✔ | ✘ | ✘ | ✘ |
TM | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✘ |
---|
Quick intro:
Examples of regular-expressions:
For b(ba*b)* :
- What are some strings that match this pattern?
- What are some strings that don't match?
- What is the shortest string that matches?
- What is the shortest string that doesn't match?
most recent semester
 This page licensed CC-BY 4.0 Ian Barland Page last generated | Please mail any suggestions (incl. typos, broken links) to ibarland radford.edu |
 |