Theory of Computation

Arik Chen arik.cj@gmail.com

Turing machine M=(Q,E,A,T,q0,qa,qr) Q: a set of state E: input alphabet set. A: tape alphabet set, large than E. T: transition function q0: start state qa: accept state qr:reject state PDA P=(Q,E,A,T,q0,F,) A: the stack alphabet T: transition relation ((state, tape, stack), (state', stack)) q0: the initial state F: a set of final states, accept:(f,e,a) or (q, e, e) FA A={Q,E,T,q0,F} In DFA, T maps input (state, symbol) to one state In NFA, T maps input (state, symbol) to a set of states

Grammar G=(V,T,P,S) V is the alphabet; T is all the terminal S is a special non-terminal start symbol e.g. cAd->aABd

R.E. recursive is a subset of R.E. if L is R.E, ~L may not R.E. If L is recursive, then ~L is also. L is recursive iff both ~L and L are R.E

CFG G=(V, T, P, S) P is the finite set of production. e.g. A->AB

CFL some context free language is not regular ().

regular expression

regular language all regular language are context free language.

Automata and Language

Relation of Languages

Finite Automata
NFA DFA

Finite Automata
NFA vs DFA Theorem: for each NFA, there is and equivalent DFA the key idea is to view a NFA as occupying not a single state but a set of state.

#state of DFA= 2#state of NFA (cause state explosion?) see proof by induction (P71) When state is considered, NFA is exponentially better than NFA

Regular Expression
regular expression to FA Theorem:the class of languages accepted by FA is closed under union, concatenation, * , complementary, intersection. FA to regular expression DFA to regular expression NFA to regular expression proof: L(FA) is regular language Theorem: Accept by FA <=> a language is regular.

State Minimization
remove unreachable state find equivalent classes Theorem: there is a DFA accepts L with the precious number of states as the equivalent classes of L . Theorem: L is regular <=> equivalent classes is finite for example {anbn}, [e],[a],[aa]...

Extreme of FA/regular
pumping lemma if L is regular language then there exists a constant n each w longer than n in L can (exists y) break into three strings w=xyz and satisfy that y is not empty |xy| is not longer than n xykz is also in L when there are finite number of string in language L, pumping lemma is useless. finite equivalent class if we want show a language L is not regular, you should prove that pumping lemma is not satisfied or the number of equivalent class is infinite.

Context Free Grammar
CFL Chomsky Normal Form All production of the form A->BC or A->a step 1: Eliminate nullable production step 2: Elimitnate unit production convert to production of length 2 or length 1 CFL closure property close under union, concatenation, and star not close under intersection or complementation(P147) intersection of CFL and regular language is CFL. parse tree Q: Can we decide whether a language is CFL? CSL can not be decide but semi decide.

Push-Down Automata
NPDA the idea is use stack to remember the first half for further check. PDA FA vs PDA every FA can be viewed as a PDA without operate the stack PDA vs CFL Each CFL is accepted by some PDA. map productions to transition relation if a language is accept by a PDA, it is a CFL. map transition relation to productions. Q: non-deterministic PDA is powerful than deterministic PDA?

Extreme of CFL/PDA
Pumping Theorem G is a CFL Any string longer than Fanout|non-terminal| can be (exist) rewritten as w=uvxyz either v or y is nonempty uvnxynz is also in L(G) to prove not CFL, show non is exist. {anbncn} {an:n is a prime}

CFG vs regular
there are CFL not regular (anbn), but all regular language are context free. state => non-terminal symbol =>terminal arrow=>production Right linear Grammar <=> regular language every regular language can be accept by right linear G Language accept by right linear G is regular. proof by construct CFG<=>NFA

Grammar
The rules decide what L(language) is exactly generated. if not belong to this L, non-terminals can not be erased L(G) iff L is RE L(G)<=>L(M) (q, u1a1w1)|-M (q', u2a2w2) iff u2a2q'w2=>u1a1qw1 If a string can be generate by the grammar, then it can be searched by applying all the rules. If the string cannot, then the search will never stop.

What can/cannot be computed?
Algorithm device excludes non-halt TM. Church-Turing thesis: assert algorithm corresponds to a certain Turing machine Therefore, some computational problem cannot be solved. That is computation task that cannot be performed by Turing machines are impossible, hopeless, undecidable.

How to encoding Turing Machine?
if Turing Machine can receive encoding of Turing Machine then there would be interesting operations.

Universal Turing Machine
U('M', 'W')='M(W)' encode states encode alphabet encode transition function Implement with 3-tape machine

undecidable problem
halt problem diagonal(x) a: if halt(x,x) then goto a else halt Does diagonal(diagonal) halt? d(d) halt when halt(d,d) return no which means d(d) not halt, a contradiction. That is to say, there can be no program halt(P,X) to solve this problem: to tell whether arbitrary program can halt or not

Halt Problem
Exist M semi-decide W, which means halt("M","W") is semidecided.

halt(M, W) recursive? if yes. same contradiction may happen. therefore NOT recursive

Decidable Problem
show decidable (recursive) build a decider (TM) reduction know a solvable problem, and solved by Mk then use Mk to construnct Muk to solve unknown problem. 1. encode(reduce, map) input of Muk to input of MK 2. use Mk to work on the mapped input.

Undecidable Problem
show undecidable reduction find a known problem to be hard (unsolvable) An unknown problem can be assumed decidable, decided by Muk 1. encode instance (input) of known problem to input of Muk 2. show that the problem is solved however, known problem is unsolvable, so Muk is impossible.

Does M halt on empty string?

Sign up to vote on this title
UsefulNot useful