Title: Computation, Computers, and Programs Cook's Theorem
1Term summary
- Finite automata
- Deterministice FA
- Nondeterministic FA, with e-transitions
- Regular expressions
- Equivalence of Regex, eNFA, NFA, DFA
- Pumping Lemma
2Determistic Finite Automata
3Transition diagrams
4A finite automaton
5Regex-gteNFA
- Prove by structural induction induction on the
size of the regular expression - Base cases
- Show the empty RE has an e-NFA
- Show the e RE has an e-NFA
- Show the a (symbol) RE has an e-NFA
- Induction
- Show (xy) has an e-NFA
- Show (x y) has an e-NFA
- Show x has an e-NFA
6Choice
7Equivalence classes of RM
8Myhill-Nerode
9Regular languages
- Intuition if a FA accepts a string that is long
enough, it must repeat a state - But it cant remember that the state was repeated
- So it can be forced to repeat the state over and
over
10Pumping lemma
11Term summary
- Context-free languages
- Context-free grammars
- Grammar simplification
- Pushdown automata
- Equivalence of CFGs and PDAs
12Sentence diagramming derivation trees
13CFG formal definition
14Ambiguity
15Ambiguity
- A leftmost-derivation is a derivation in which a
production is always applied to the leftmost
symbol - A rightmost derivation applies to the rightmost
symbol - In general, a string may have multiple left and
rightmost derivations - A grammar in which some word has two parse trees
is said to be ambiguous
16Simplification
- A nonterminal A isuseless iff
- S ? xAy ? xzy
- Otherwise, it is useless
17Eliminating epsilon-productions
18PDA machine
19PDA formal definition
20Balanced parentheses
21Empty stack vs final state
- Final state PDA -gt empty stack PDA
- Simulate whenever the PDA reaches a final state,
empty the stack - Empty stack PDA -gt final state PDA
- Add a special marker at the bottom of the stack
- Add transitions delta(q, epsilon, S) ? qf for
some new state qf in F
22Compiling a CFG to a PDA
23Building the PDA from the GNF
24Building a CFG from a PDA
25Pumping lemma for CFL
26Pumping
27Ogdens lemma
28Building the path
29Term summary Turing Machines
- Turing Machines
- Executions
- Diagonalization
- The halting problem
- Rices theorem
30Turing machines
31Turing machine formal definition
32Instantaneous descriptions
33Universal Turing Machines
34Another diagonalization argument
35Halting problem
- Problem determine entries in the matrix
- Find a recursive machine K, given Mx
- K halts and accepts if M accepts x
- K halts and rejects if M does not terminate
- Is there such a machine?
- Suppose so, then build a new machine N, that,
given x, runs K on Mxx and - Accepts if K rejects
- Loops forever of K accepts
- If K exists, then N does too let N My
- Ny halts and accepts if Ny does not halt
- Ny loops forever if Ny halts
36Halting problem
37Rices theorem
- A property P is a set of r.e. languages (so it is
a set containing sets of strings) - For any r.e. language L, we say P(L) is true iff
L is a member of P - Theorem Any nontrivial property of the r.e.
languages is undecidable - Nontrivial means the property is neither always
true nor always false
38Proof of Rices theorem
- Consider a property P
- Assume P() false, otherwise invert P
- Since P is nontrivial, there is a language L in P
- Let ML be a TM accepting L
- To determine if M halts on input w, build M
- Ignore the input, and simulate M on w
- If M halts, then start ML on the input string
- So P(M) iff M halts on w
39Term summary alternate models
- Primitive and partial recursive programs
- For-programs
- While-programs
- Godel numbering
- The recursion theorem
- Rices theorem
40Primitive recursion
41For-programs
42For programs and primitive recursion
43Partial recursive functions (Godel)
- To capture r.e. computations, we need more
- A partial recursive computation includes the
prim-rec computations, plus unbounded minimization
44Unbounded minimization
45While-programs
46Godel numbering
47Recursion theorem
48Rices theorem
49Term summary lambda calculus
- Syntax
- Substitution
- Reduction
50Lambda calculus
- A starting point for reasoning about functions
- The foundation of most functional programming
languages, including the Lisp and ML languages
51Single-step evaluation
- A single-step reduction is just a substitution
- Called beta-reduction
52Term summary logic
- Propositional logic
- Predicate calculus
- Godels incompleteness theorem (Rices theorem in
disguise)
53Defining the syntax
54Standard syntax definition
55Rule table
56Pierces law
57Formalizing arithmetic
58Indexing the arithmetic formulas
59Fixpoint theorem for arithmetic
60Godels Incompleteness Theorem
61Term summary complexity
- Time space bounded machines
- NP computations
- SAT
62Space-bounded TMs
- Input tape is read-only
- The number of storage tapes is an arbitrary
constant k - M is DSPACE(T(n)) if
- M is deterministic
- For any input of length n, M scans at most T(n)
cells on any storage tape - NSPACE(T(n)) is the nondeterministic bound
63Time-bounded TMs
- All tapes are 2-way infinite
- M is DTIME(T(n)) if
- M is deterministic
- For any input of length n, M takes at most T(n)
steps - M is NTIME(T(n))
- Nondeterministic case
64Asymptotic complexity big-Oh notation
65CNF satisfiability
66Satisfiability phase transition (Selman)
- Using modern algorithms, plot how long it takes
to solve a SAT formula as ratio of
clauses/literals
67Term summary
- Graph theory
- Undirected, directed graphs
- Storngly-connected components
- Solving 2SAT in linear time
68Formal definition of graphs
69Path example
70Graph components
71DFS Finalize
72DFS backedges
73Compute low values
74Term summary
- Reductions
- 3SAT ? Clique
- 3SAT ? Coloring
- Cooks theorem
- NP ? SAT
75Conflict graph for 3SAT
76SAT/clique example
77More NP problems graph coloring
78Unsatisfiable clause
79Satisfiable clause
80Cooks theorem
81Boolean variables
82Boolean variables