automata

Download Automata

If you can't read please download the document

Upload: abhinav-shrivastava

Post on 22-Oct-2015

36 views

Category:

Documents


5 download

DESCRIPTION

Automata

TRANSCRIPT

Automata and Formal Languages - finite automata 5-tuple (Q, Z, o, q0, F) q is set of states, q0 is start state, F is set of final states Z is finite input alphabet o is transition function from QxZ->Q that is o(q,a) returns a state for current state q and input symbol a from Z 1.) DFA: deterministic finite automata 2.) NFA: nondeterminisic finite automata 3.) NFA w/e: nondeterminisic finite automata with epsilon transitions 4.) regular expressions these four have equivalent power to handle regular languages terms language L L accepted by an automata L denoted by an expression two-way finite automata can move head as part of o(q,a) no more powerful moore vs mealy machines application of FA with output moore - output depends on current state mealy - output depends on current state and input symbol moore and mealy are equivalent pumping lemma used to show languages nonregular Let L be a regular set. Then there is a constant n such that if z is any word in L, and |z| >= n, we may write z=uvw in such a way that |uv|=1, and for all i>=0, uv^iw is in L. Furthermore, n is no greater than the number of states of the samllest FA accepting L. regular sets are closed under union, concatenation, kleene closure complement intersection substitution homomorphisms and inverse homomorphisms quotient with arbitrary sets the set of sentences accepted by an FA M with n states is: nonempty iff the FA accepts a sentence of length less than n infinite iff the FA accepts a sentence of length l where n0 uvIwxIy is in L CFLs are closed under: union, concatenation, and Kleene closure substitution homomorphism and inverse homomorphism NOT under intersection NOT under complementation If L is CFL and R is regular set, then L intersect R is a CFL decidability: there are algorithms to determine if a CFL is empty finite infinite there are algorithms to determine if x of L* is part of CFL G - Turing machines M=(Q, Z, L, o, q0, B, F) Q is finite set of states L is finite setof allowable tape symbols B, a symbol of L, is the blank Z = L-B, the input symbols o is the next move function o(QxL) -> (QxLx{L,R}) o may be undefined for some arguments q0 in Q is the start state F (= Q is the set of final states views of TM's class of languages it defines called the recursively enumerable sets recursively enumerable sets, TM will halt if W in L, but may not otherwise halt recursive sets, subset of r.e. sets, TM will halt for all input class of integer functions it computes called the partial recursive function s enumerator: generating device with output tape (see below) extensions (which don't add power) adding finite state to controller multiple tracks (one single tape) two way infinite tape (instead of one way) multiple tapes nondeterminstic multidimensional tape multihead off-line turing machine (read only input) restriced machines that are turing complete a two stack deterministic PDA is equivalent to a turing machine a two-counter machine unlimited alphabeta, but only 3 states and one tape if L (= (0+1)* and L is r.e., then L is accepted by a one-tape TM with tape alphabet {0,1,B} still true if we remove restriction on L alphabet Z, by using binary encod ing of L's Z in fact, every TM can be simulated by an off-line TM having one storage take with two symbols, 0 (blank) and 1. The TM can print a 0 or 1 over a 0, but cannot print a 0 over a 1. common tricks to build machines checking off symbols (on extra track) shifting over parameterless, nonrecursive subroutines church's hypothesis (aka church-turing thesis) the assumption that the intuitive notion of "computable functions" can be indentified with the class of partial recursive functions

lambda calculus Post systems general recursive functions random access machines enumerator: computing output L is an r.e. (recursively enumerable) set iff L is G(M1) for some TM M1 L is recursive iff L is generated in canonical order (e, 0, 1, 00, 01, 10, 1 1, 000, 001,...) - undecidability a problem whose language is recursive is said to be decidable, otherwise und ecidable. a problem is undecidable if there is no algorithm that takes as an input an instance of the problem and determines whether the answer to that instance is "yes" or "no". properties of recursive and recursively enumerable languagse the complement of a recursive languages is recursive: the union of recursive languages is recursive. the union of two recursively enumerable langauges is recursively enumerabl e. if L and its complement are both recursively enumerable => L and it's comple ment are recursive from these, given L and it's complement 1.) either both are recursive 2.) neither are recursive 3.) one is r.e. but not recursive, the other is not r.e univeral turing machine (can be minimalistic: one tape, 5 states, 7 tape symbols see 173) restrict input TM's to M=(Q, {0,1}, {0,1,B}, o, q1, B, {q2} encode in binary format we can show there is a non-r.e. language using a diagonalization proof we can show that the languages accepted by a TM are r.e. but not recursive Rice's Theorm any nontrival property SL of the r.e. languages is undecidable trivial means it's either true of no r.e. or all r.e. languages examples of nontrival emptiness finiteness regularity context-freedom LofSL is r.e. iff 1.) if L is in SL and L (= L', then L' is in SL 2.) if L is an infinite set ifn SL, then there is some finite subset L' of L that is in SL. 3.) the set of finite languages in SL is enumerable Post Correspondence Problem is undecidable It is undecidable whether an arbitrary CFG is ambiguous It is undecidable for arbitrary CFG's G1 and G2 whether L(G1) intersected wi th L(G2) is empty It is undecidable for arbitrary CFG G whether L(G) = Z* Let G1 and G2 be arbitrary CFG's and R an arbitrary regular set. The followi ng are undecidable: 1.) L(G1) = L(G2) 2.) L(G2) (= L(G1) 3.) L(G1) = R 4.) R (= L(G1) Let G1 and G2 be arbitrary CFG's. The following are undecidable: 1.) the compliment of L(G1) is a CFL 2.) L(G1) intersected with L(G2) is a CFL Greibach's theorm (analog of Rice's theorm for CFL) Let C be a class of languages that is effecively closed under

concatenation with regular sets and union, and for which "=Z*" is undecidable for any sufficiently large fixed size Z. Let P be any nontrivial property that is true for all regular sets and that is preserved under /a, where a is a single symbol. (that is if L has P, do does L/a = {w|wa is in L}) Then P is undecidable for C. applications Let F be an arbitrary CFG. The is undecidable wether L(G) is regular. Inherently ambiguity for CFL's is undecidable recrusive function theory Smn-theorm given a partial recursive function g(x,y), there is an algorithm one can use to construct from a TM for g and a value for x, another TM which with input y computes g(x,y) the recursion theorm every total recursive function o mapping indices (integers denoting TMs) of partial recursive functions has a fixed point xo such that Fxo(y) = Fo(xo)(y) app - chomsky hierarchy regular grammars CFG with prodcutions of form A->wB or A->w (w is possibly empty) = right linear A->Bw or A->w (w is possibly empty) = left linear both right and left linear grammars are regular grammars If L has a regular grammar, then L is a regular set If L is regular set, then it is generated by some left linear G and some rig ht linear G unrestricted grammars (aka semi-Thue or type 0 or phrase structure) productions of form alpha->beta where alpha and beta are arbitrary, alpha != epsilon if L is L(G) for unrestricted grammar G = (V,T,P,S), then L is an r.e. langu age converse holds if L is an r.e. language, then L is L(G) for unrestricted grammar G context sensivitve grammars (and context sensivitve languages) productions of form alpha->beta where beta is at least as long as alpha almost any language one can think of is a CSL; all proofs depend on diagon alization linear bounded automata (LBA) match CSLs a nondeterminstic TM with 1.) input alpha contains ^ and $ the left and right endmarkers 2.) the LBA has no moves left of ^ or right of $ (and it cant print over markers) unknown if deterministic LBA = or != to nondeterminstic LBA if L is CSL, the L is accepted by some LBA if L = L(M) for LBA M, then L-{e} is a CSL every CSL is recursive but there is a recursive language that is not CSL the chomsky hierarchy the regular sets are properlycontained in the CFLs the CFLs-{e} are properly contrained in the CSLs the CSLs are properly contained in the r.e. sets - deterministic CFLs (accepted by deterministic PDAs) syntax of many programming languages LR-grammars generate exactly the DCFLs DCFLs are closed under complementation quotient with regular language ( L/R is a DCFL {x|there exists w in R such that xw is in in L}) MIN(L) = {x|x is in L and no w in L is a proper prefix of x}

MAX(L) = {x|x is in L and x is not proper prefix of any word in L} inverse homomorphism intersection with regular set not true for general CFLs DCFL are NOT closed under homomorphism union concatenation Kleene closure undeciable problems of DCFLs L and L' 1.) is L intersected with L' empty? 2.) is L a subset of L'? 3.) is L intersected with L' a DCFL? 4.) is L intersected with L' a CFL? 5.) is L unioned with L' a DCFL? Let L be arbitrary CFL, it is undeciable whether L is a DCFL LR(0) grammars left-to-right scan producing rightmost derivation using 0 look ahead symbols definition of LR(0) 1.) its start symbol does not appear on the right side of any production 2.) for every variable prefix y of G, whenever "A -> alpha . " is a complete item valid for y, then no other complete item with a terminal to the right of the dot is valid for y. If L is L(G) for an LR(0) G, then L is N(M) for a DPDA M Every LR(0) G is unambiguous If M is a DPDA, then G of M is an LR(0) grammar If L has an LR(0) grammer iff L is a DCFL with the prefix property LR(k) grammars left-to-right scan producing rightmost derivation using k look ahead symbols definition of LR(1) 1.) its start symbol does not appear on the right side of any production 2.) whenever the set of items I valid for some viable preix includes some complete item "A -> alpha ., {a1, a2, ..., aN}", then: i.) no aI appears immediately to the right of the dot in any item of I and ii.) if B->beta., {n1,..., bk} is another complete item in I, then ai!=bj for any 1