Sie sind auf Seite 1von 3

Type-2 Context-free grammars/Languages Push-Down Automata Grammar A::=V combination terminal and non-terminal or Empty Language No wordsEmpty Infinite

e Language Cycles can be reached from axiominfinte Well-formed 1. Unnecessary Rules A::=Amake ambiguous so delete 2. Unreachable 3. Useless Rules: Dont contribute to formation words-backward iteration 4. Not-generating rules A::= (AS) a. Delete rule and for every B::=xAy add B::=xy 5. Unit productions/redenomination rules A::=B a. Delete rule and for every B::=X add A::=X CNF A::=BC or S::= or A::=a Example =({0,1,2},{A,B,C},A,P) P={A::=CB2|1B| , B::=BC|1,C::=2} A::=1BA::=EB A::=CB2CBCCD E::=1 D::=BC GNF A::=aX or S::= Well-formedDelete left recursionGNF Example G=({ },{a,b},A,R) R={ ::= , ::=b , ::= |a} ::= b , | , Delete left Recursion ::=b |b |a |a ::= | Since start with terminal, replace Instantaneous Description: (q,x,z) where qQ, x*, z * Movement (q,ay,AX)(p,y,YX) L{ |i,j,k0 and i=j or i=k} Type-1 Context-sensitive grammars/language Linear-bounded automata xAy::=xvy x,y * A n Not allowed compressor rules except S::= Type-0 Unrestriced grammars/phase structured Recursively enumerable languages Turning machine -Unrestricted au -Phase-structure xAy::=xuy x,y * A nt v* Compressor rules allowed

Turning Machine (,,b,Q,q0,f,F) RLS Infinite tape Transducer or recognizer All variations equivalent TM binary {0,1}

Submachine of Turing Universal: simulates the execution of every turning machine Halting problem: not know if TM will stop Formalizes concept of algorithm Formal model of computer Every non-deterministic TM has an equivalent deterministic TM NDTM and DTMhave same computing capacity Computational Complexity Polynomial time Decidable: TM solve problem, TM stops for every element in A Partially :TM solve problem, Tm included in language recognized by TM Non- : No TM Class: P: deterministic TM arrays NP: non-deterministic TM factoring NP-complete: is P and all other NP reduce DTM polynomial time graph 3 coloring NP-hard: halting problem Bonus: PDA possible change state or modify stack without reading or advancing Grammar: formal entity to specify the set of strings with symbols that make up a language Direct derivation vw Derivation of length u v+w The relationship v*w if v+w and v=w Equivalence G1 G2 if L(G1)=L(G2) Sentence only terminal Recursion Not known if ambiguous or not Right v+xV If language infinite then grammar recursive. Type-3 Regular grammar Regular language Finite automata Regular expression FA=(, Q, f, q0, F) F(q,a)=qq,qQ a NFA when transitions More than one edge with same label DFA L={x/x* and f(q0,x) F} Connected: every state reachable from q0 Non-connectedConnected: delete non-reachable states Minimization Equivalence 2 DFAs are equivalent if their initial state are equivalent q0Eq0 2 DFAs are isomorphic if each state is equivalent 2 Isomorphic DFAs are also equivalent and recognize the same language 2 DFAs are equivalent if their minimum FA are isomorphic NFA L={x/x*and q0F} NFAs are not more powerful than DFAs For every NFA there is an equivalent DFA

NFA to DFA 1. The initial state of DFA is result of -closure q0 A=-closure {q0}=q0 2. Transitions with input symbols Ae-closure {q1}={q2,q3,q5,q8}=B 3. Repeat 2 each time a state is created Bd-closure, {q6,q7,q8}=C Be-closure, {q4,q7,q8}=D Cd-closure {q6}=C Ce-closure {q4}=D Dd-closure {q6}=C De-closure {q4}=D 4. Final states are ones containing final states of NFA 2 type grammars for type-3 Left-linearA::=a, A::=Va, S::= Right-linearA::=a, A::=aV, S::= S is the axiom Equivalent Grammars G=({0,1},{S,B},S, P) P={S::=1B|1, B::=0S} -Equivalent without A::=aS 1. Add new state S 2. For every rules S::=X add S::=x 3. Transform B::=aS into B::=aS S::= are not affected P={S::=1B|1, S::=1B|1, B::=0S} Right-LinearLeft-Linear 0. No rules A::=aS 1. Node for each NF and 2. a. For A::=aB b. For A::=a c. For S::= 3. Change S and and invert axiom 4. For

Das könnte Ihnen auch gefallen