Download - study note of theory of computation
![Page 2: study note of theory of computation](https://reader031.vdocuments.mx/reader031/viewer/2022013121/546ad208b4af9f7f2c8b4912/html5/thumbnails/2.jpg)
Automata and Language
Turing machineM=(Q,E,A,T,q0,qa,qr)Q: a set of stateE: input alphabet set.A: tape alphabet set, large than E.T: transition functionq0: start state qa: accept stateqr:reject state
GrammarG=(V,T,P,S)V is the alphabet;T is all the terminalS is a special non-terminal start symbole.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
PDAP=(Q,E,A,T,q0,F,) A: the stack alphabetT: transition relation ((state, tape, stack), (state', stack)) q0: the initial stateF: a set of final states,accept:(f,e,a) or (q, e, e)
CFGG=(V, T, P, S)P is the finite set of production.e.g. A->AB
CFLsome context free language is not regular ().
FAA={Q,E,T,q0,F}In DFA, T maps input (state, symbol) to one stateIn NFA, T maps input (state, symbol) to a set of states
regular expression regular languageall regular language are context free language.
![Page 3: study note of theory of computation](https://reader031.vdocuments.mx/reader031/viewer/2022013121/546ad208b4af9f7f2c8b4912/html5/thumbnails/3.jpg)
Relation of Languages
![Page 4: study note of theory of computation](https://reader031.vdocuments.mx/reader031/viewer/2022013121/546ad208b4af9f7f2c8b4912/html5/thumbnails/4.jpg)
Finite Automata
NFADFA
![Page 5: study note of theory of computation](https://reader031.vdocuments.mx/reader031/viewer/2022013121/546ad208b4af9f7f2c8b4912/html5/thumbnails/5.jpg)
Finite AutomataNFA vs DFA
Theorem: for each NFA, there is and equivalent DFAthe 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
![Page 6: study note of theory of computation](https://reader031.vdocuments.mx/reader031/viewer/2022013121/546ad208b4af9f7f2c8b4912/html5/thumbnails/6.jpg)
Regular Expression
regular expression to FA Theorem:the class of languages accepted by FA is closed under union, concatenation, * , complementary, intersection.
FA to regular expressionDFA to regular expression NFA to regular expressionproof: L(FA) is regular language
Theorem: Accept by FA <=> a language is regular.
![Page 7: study note of theory of computation](https://reader031.vdocuments.mx/reader031/viewer/2022013121/546ad208b4af9f7f2c8b4912/html5/thumbnails/7.jpg)
State Minimization
remove unreachable statefind 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 finitefor example {anbn}, [e],[a],[aa]...
![Page 8: study note of theory of computation](https://reader031.vdocuments.mx/reader031/viewer/2022013121/546ad208b4af9f7f2c8b4912/html5/thumbnails/8.jpg)
Extreme of FA/regularpumping lemma
if L is regular languagethen there exists a constant neach 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 nxykz 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.
![Page 9: study note of theory of computation](https://reader031.vdocuments.mx/reader031/viewer/2022013121/546ad208b4af9f7f2c8b4912/html5/thumbnails/9.jpg)
Context Free Grammar
CFLChomsky Normal Form
All production of the form A->BC or A->astep 1: Eliminate nullable productionstep 2: Elimitnate unit productionconvert to production of length 2 or length 1
CFL closure propertyclose under union, concatenation, and starnot close under intersection or complementation(P147)intersection of CFL and regular language is CFL.
parse treeQ: Can we decide whether a language is CFL? CSL can not be decide but semi decide.
![Page 10: study note of theory of computation](https://reader031.vdocuments.mx/reader031/viewer/2022013121/546ad208b4af9f7f2c8b4912/html5/thumbnails/10.jpg)
Push-Down Automata
NPDAthe idea is use stack to remember the first half for further check.
PDAFA vs PDA
every FA can be viewed as a PDA without operate the stack
PDA vs CFLEach CFL is accepted by some PDA.
map productions to transition relationif 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?
![Page 11: study note of theory of computation](https://reader031.vdocuments.mx/reader031/viewer/2022013121/546ad208b4af9f7f2c8b4912/html5/thumbnails/11.jpg)
Extreme of CFL/PDA
Pumping TheoremG is a CFLAny string longer than Fanout|non-terminal|
can be (exist) rewritten as w=uvxyzeither v or y is nonemptyuvnxynz is also in L(G)
to prove not CFL, show non is exist.{anbncn} {an:n is a prime}
![Page 12: study note of theory of computation](https://reader031.vdocuments.mx/reader031/viewer/2022013121/546ad208b4af9f7f2c8b4912/html5/thumbnails/12.jpg)
CFG vs regular
there are CFL not regular (anbn), but all regular language are context free.
state => non-terminalsymbol =>terminalarrow=>production
Right linear Grammar <=> regular language
every regular language can be accept by right linear GLanguage accept by right linear G is regular.proof by construct CFG<=>NFA
![Page 13: study note of theory of computation](https://reader031.vdocuments.mx/reader031/viewer/2022013121/546ad208b4af9f7f2c8b4912/html5/thumbnails/13.jpg)
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 REL(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.
![Page 14: study note of theory of computation](https://reader031.vdocuments.mx/reader031/viewer/2022013121/546ad208b4af9f7f2c8b4912/html5/thumbnails/14.jpg)
What can/cannot be computed?
Algorithm device excludes non-halt TM.Church-Turing thesis: assert algorithm corresponds to a certain Turing machineTherefore, some computational problem cannot be solved. That is computation task that cannot be performed by Turing machines are impossible, hopeless, undecidable.
![Page 15: study note of theory of computation](https://reader031.vdocuments.mx/reader031/viewer/2022013121/546ad208b4af9f7f2c8b4912/html5/thumbnails/15.jpg)
How to encoding Turing Machine?
if Turing Machine can receive encoding of Turing Machine then there would be interesting operations.
![Page 16: study note of theory of computation](https://reader031.vdocuments.mx/reader031/viewer/2022013121/546ad208b4af9f7f2c8b4912/html5/thumbnails/16.jpg)
Universal Turing Machine
U('M', 'W')='M(W)'encode statesencode alphabetencode transition function
Implement with 3-tape machine
![Page 17: study note of theory of computation](https://reader031.vdocuments.mx/reader031/viewer/2022013121/546ad208b4af9f7f2c8b4912/html5/thumbnails/17.jpg)
undecidable problem
halt problem
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
diagonal(x)a: if halt(x,x) then goto a else halt
![Page 18: study note of theory of computation](https://reader031.vdocuments.mx/reader031/viewer/2022013121/546ad208b4af9f7f2c8b4912/html5/thumbnails/18.jpg)
Halt Problem
Exist M semi-decide W, which means halt("M","W") is semi-decided.
halt(M, W) recursive?if yes. same contradiction may happen.therefore NOT recursive
![Page 19: study note of theory of computation](https://reader031.vdocuments.mx/reader031/viewer/2022013121/546ad208b4af9f7f2c8b4912/html5/thumbnails/19.jpg)
Decidable Problem show decidable (recursive)
build a decider (TM) reduction
know a solvable problem, and solved by Mkthen use Mk to construnct Muk to solve unknown problem.1. encode(reduce, map) input of Muk to input of MK2. use Mk to work on the mapped input.
![Page 20: study note of theory of computation](https://reader031.vdocuments.mx/reader031/viewer/2022013121/546ad208b4af9f7f2c8b4912/html5/thumbnails/20.jpg)
Undecidable Problem
show undecidablereduction
find a known problem to be hard (unsolvable)An unknown problem can be assumed decidable, decided by Muk1. 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.
![Page 21: study note of theory of computation](https://reader031.vdocuments.mx/reader031/viewer/2022013121/546ad208b4af9f7f2c8b4912/html5/thumbnails/21.jpg)
Does M halt on empty string?