ormal De niti on of Finite Automaton

ormal De niti on of Finite Automaton - Description

Finite set of states t ypically 2 Alphab et of input symb ols t ypically 3 One state is the startinitial state t ypically 4 Zero or more nalac epting states the set is ypically 5 tr ansition function t ypically This function ak es a stat ID: 27504 Download Pdf

146K - views

ormal De niti on of Finite Automaton

Finite set of states t ypically 2 Alphab et of input symb ols t ypically 3 One state is the startinitial state t ypically 4 Zero or more nalac epting states the set is ypically 5 tr ansition function t ypically This function ak es a stat

Similar presentations


Tags : Finite set states
Download Pdf

ormal De niti on of Finite Automaton




Download Pdf - The PPT/PDF document "ormal De niti on of Finite Automaton" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.



Presentation on theme: "ormal De niti on of Finite Automaton"— Presentation transcript:


Page 1
ormal De niti on of Finite Automaton 1. Finite set of states ,t ypically 2. Alphab et of input symb ols ,t ypically . 3. One state is the start/initial state, t ypically 4. Zero or more nal/ac epting states; the set is ypically 5. tr ansition function ,t ypically . This function: ak es a state and input sym bol as argumen ts. Returns a state. One \rule" of ould b e written q; a )= , where and are states, and is an input sym b ol. In tuitiv ely: if the F A is in state , and input is receiv ed, then the F Agoesto state (note: OK). AF A is represen ted as the v e-tuple: Q; ; ;q

;F ). Example: Clamping Logic ema y think of an accepting state as represen ting a \1" output and nonaccepting states as represen ting \0" out. A \clamping" circuit w aits for a 1 input, and forev er after mak es a 1 output. Ho ev er, to a oid clamping on spurious noise, w e'll design a F A that aits for t o 1's in a ro w, and \clamps" only then. In general, w ema y think of a state as represen ting a summary of the history of what has b een seen on the input so far. The states w e need are: 1. State , the start state, sa ys that the most recen t input (if there w as one) w as not a 1, and w

eha e nev er seen t o 1's in a ro w. 2. State sa ys w eha e nev er seen 11, but the previous input w as 1. 3. State is the only accepting state; it sa ys that w eha e at some time seen 11. Th us, =( ;q ;q ; ;q ), where is giv en b y:
Page 2
By marking the start state with and accepting states with , the tr ansition table that de nes also sp eci es the en tire F A. Con en tions It helps if w e can a oid men tioning the t yp e of ev ery name b y follo wing some rules: Input sym b ols are , etc., or digits. Strings of input sym b ols are u;v;:::;z States are , etc. ransition Diagram AF

A can b e represen ted b y a graph; no des = states; arc from to is lab eled b y the set of input sym b ols suc h that q; a )= No arc if no suc Start state indicated b yw ord \start" and an arro w. Accepting states get double circles. Example or the clamping F A: Start 0,1 Extension of to P aths In tuitiv ely ,a F ac epts a string  if there is a path in the transition diagram that: 1. Begins at the start state, 2. Ends at an accepting states, and 3. Has sequence of lab els ;a ;:::;a ormally ,w e extend transition function to q; w ), where can b e an y string of input sym b ols:
Page

3
Basis: q;  )= (i.e., on no input, the F do esn't go an ywhere. Induction: q; wa )= q; w ;a , where is a string, and a single sym b ol (i.e., see where the F Agoeson , then lo ok for the transition on the last sym b ol from that state). Imp ortan t fact with a straigh tforw ard, inductiv e pro of: really represen ts paths. That is, if  , and ;a )= +1 for all =0 ;:::;n 1, then ;w )= Acceptance of Strings AF =( Q; ; ;q ;F ) accepts string if ;w )isin Language of a F accepts the language )= ;w )is in Aside: T yp e Errors A ma jor source of confusion when dealing with automata (or

mathematics in general) is making \t yp e errors." Example: Don't confuse ,a F A, i.e., a program, with ), whic hisoft yp e \set of strings." Example: the start state is of t yp e \state," but the accepting states is of t yp e \set of states." ric kier example: Is a sym b ol or a string of length 1? Answ er: it dep ends on the con text, e.g., is it used in q; a ), where it is a sym b ol, or q; a ), where it is a string? Nondetermini st ic Finite Automata Allo w (deterministic) F Atoha eac hoice of 0 or more next states for eac h state-input pair. Imp ortan t to ol for designing string pro

cessors, e.g., grep , lexical analyzers. But \imaginary " in the sense that it has to b e implemen ted deterministically Example In this somewhat con triv ed example, w e shall design an NF A to accept strings o er alphab et suc h that the last sym b ol app ears
Page 4
previously , without an yin terv ening higher sym b ol, e.g.,  11,  21112,  312123. ric k: use start state to mean \I guess I ha en't seen the sym b ol that matc hes the ending sym bol y et. Three other states represen t a guess that the matc hing sym b ol has b een seen, and remem b ers what that sym b ol is.

1,2 1,2,3 Start ormal NF =( Q; ; ;q ;F ), where all is as DF A, but: q; a )isa set of states, rather than a single state. Extension to Basis: q;  )= Induction: Let: q; w )= ;p ;:::;p ;a )= for =1 :::;k Then q; wa )= [[ Language of an NF An NF A accepts if any path from the start state to an accepting state is lab eled .F ormally: )= ;w ;g Subset Construction or ev ery NF A there is an quivalent (accepts the same language) DF A. But the DF A can ha e exp onen tially man states.
Page 5
Let ; ;q ;F )beanNF A. The equiv alen tDF A constructed b y the subset construction is =( ; ;F

), where: 1. =2 ;. i.e., is the set of all subsets of 2. is the set of sets in suc h that ;q ;:::;q ;a )= ;a ;a [[ ;a ). Key theorem (induction on , pro of in b o ok): ;w )= ;w ). Consequence: )= ). Example: Subset Construction F rom Previous NF An imp ortan t practical tric k, used in lexical analyzers and other text-pro cessors is to ignore the (often man y) states that are not accessible from the start state (i.e., no path leads there). or the NF A example ab o e, of the 32 p ossible subsets, only 15 are accessible. Computing transitions \on demand" giv es the follo wing pq pr ps pq pq t

pr ps pq t pq t pr ps pr pq r pr t ps pr t pq r pr t ps ps pq s pr s pst pst pq s pr s pst pr s pqrs pr st pst pr st pqrs pr st pst pq s pq st pr s pst pq st pq st pr s pst pq r pqrt pr t ps pqrt pqrt pr t ps pqrs pqrst prst pst pqrst pqrst prst pst