Finite Automata CSC 361 Finite Automata 1 Formal
- Slides: 33
Finite Automata CSC 361 Finite Automata 1
Formal Specification of Languages n Generators n Grammars n n Regular Expressions Recognizers n Parsers, Push-down Automata n n Context Free Grammar Finite State Automata n n Context-free Regular Grammar A Finite Automata is: n n a mechanism to recognize a set of valid inputs before carrying out an action. a notation for describing a family of language recognition algorithms. CSC 361 Finite Automata 2
Operation of the machine 0 0 1 Input Tape Head Finite Control n n n Read the current letter of input under the tape head. Transit to a new state depending on the current input and the current state, as dictated by the transition function. Halt after consuming the entire input. CSC 361 Finite Automata 3
Operation of the machine n Transitions show the initial state, input, and next state n n Example: n n n Form: (q, a)=b (q 0, 0)=q 1 (q 0, 1)=q 2 Tape head advances to next cell, in state q 1 What happens now? n What is (q 1, 0)? 0 CSC 361 0 1 Finite Automata 4
Associating Language with the DFA n Machine configuration: n Yields relation: n Language: CSC 361 Finite Automata 5
Deterministic Finite Automaton (DFA) Q: Finite set of states : Finite Alphabet : Transition function - a total function from Qx to Q : Initial/Start State F : Set of final/accepting state CSC 361 Finite Automata 6
Finite State Diagram • A graphic representation of a finite automaton • A finite state diagram is a directed graph, where nodes represent elements in Q (i. e. , states) and arrows are characters in such that: qa a qb Indicates: ((qa, a), qb) is a transition in The initial state is marked with: > The final state(s) are marked with: CSC 361 Finite Automata 7
Automata n Deterministic automata – each move is uniquely determined by the current configuration n n Single path Nondeterministic automata – multiple moves possible n n CSC 361 Can’t determine next move accurately May have multiple next moves or paths Finite Automata 8
Automata n An automaton whose output response is limited to yes or no is an acceptor n n Accepts input string and either accepts or rejects it Measures of complexity n n CSC 361 Running time Amount of memory used Finite Automata 9
Automata n Finite automaton n CSC 361 Uses a limited, constant amount of memory Easy to model Limited application Finite Automata 10
Automata Given an automaton A = (Q, , , q 0, F), and a string w *: • w is accepted by A if the configuration (q 0, w) yields the configuration (F, ), where F is an accepting state • the language accepted by A, written L(A), is defined by: L(A) = {w * : w is accepted by A} CSC 361 Finite Automata 11
Automata n Deterministic finite automaton n n Every move is completely determined by the input and its current state Finite control device n n n CSC 361 Can be in any one of the states, q Q May contain trap or dead states Contains accepting state(s) Finite Automata 12
Examples Deterministic CSC 361 Finite Automata 13
Language Acceptor Design a FSA to accept strings of a language • strings of a’s and b’s that start and end with a Q: States are required for the following: • q 0: Start state • qt: Trap for strings that start with a b • Accepting state can’t be reached • Machine only accepts strings that start with an a • qf : State reached after any a in a string that started with an a • The final state • q 1: State reached after any b in a string that started with an a CSC 361 Finite Automata 14
Language Acceptor : {a, b} : (q 0 , a) = qf Is the string a in the language? (q 0 , b) = qt (qt , a) = qt (qf , a) = qf (q 1 , a) = qf CSC 361 (qt , b) = qt (qf , b) = q 1 (q 1 , b) = q 1 Finite Automata 15
Language Acceptor b a qf q 0 a b qt CSC 361 a q 1 b a, b Finite Automata 16
Vending Machine n Suppose: n n n All items cost 40¢ Coins accepted are 5¢, 10¢, 25¢ Recall What are these entities? Q is a set of states n n is the alphabet n n How do we move from state to state? q 0 is the starting state n n What are the input symbols? are the transitions n n What are the possible states? Where does the machine start from? F is the final state n CSC 361 When does the machine stop? Finite Automata 17
Vending Machine n Q: What are the possible states? n The status of the machine before and after any of the alphabet symbols have been applied n n n : What are the input symbols? n n Transition when a coin is deposited q 0: Where does the machine start from? n n The coin denominations : How do we move from state to state? n n The beginning! F is the final state n When does the machine stop? n n The present state represents how much money has been deposited Could also represent how much is left to deposit Not before you’ve deposited enough money Wait! What if you put in more than 40¢? CSC 361 Finite Automata 18
n Set of strings over {a, b} that contain bb n Design states by parititioning *. n n Strings containing bb Strings not containing bb n n Strings that end in b Strings that do not end in b Initial state: Final state: CSC 361 q 2 q 1 q 0 q 2 Finite Automata 19
State Diagram and Table a b a q 0 b q 1 q 2 b a CSC 361 a b q 0 q 1 q 0 q 2 q 2 Finite Automata 20
Strings over {a, b} containing even number of a’s and odd number of b’s. [Ea, Eb] a a [Oa, Eb] CSC 361 b b Finite Automata [Ea, Ob] a a [Oa, Ob] 21
Non-Determinism CSC 361 Finite Automata 22
Automata n Non-deterministic finite automaton n n More than one destination from a state with a distinct input At least one state has transitions that cannot be completely determined by the input and its current state It is possible to design a machine where a single input can have two paths to an accepting state transitions n CSC 361 Move from a state without input Finite Automata 23
NDFA n Nondeterministic finite automata n Quintuple A = (Q, , , s, F) where Q is a finite set of states Is an input alphabet Q x ( { }) x Q is the transition relation S Q is the initial state of the automaton F Q is the set of favorable states CSC 361 Finite Automata 24
NDFA n The range of is not a single element of q, but a subset of q n Example: (q 1, a) = {q 0, q 2} n n Either q 0 or q 2 could be resultant state Empty string (null input) can result in a change of state CSC 361 Finite Automata 25
NFA qi a qj a qi qj a DFA q a qk NFA CSC 361 Finite Automata 26
NDFA n Stuck state – no jumps out of state labeled with the input symbol n n n Can not lead to accepting state Removes need for trap state Input is accepted if any resultant configurations lead to an accepting state CSC 361 Finite Automata 27
NDFA n Given an NFA A = (Q, , , q 0, F), and a string w *: n n w is accepted by A if at least one of the configurations yielded by (q 0, w) is a configuration of the form (F, ) with f a favorable state L(A) = {w * : w is accepted by A} CSC 361 Finite Automata 28
Examples Non-Deterministic CSC 361 Finite Automata 29
Language Acceptor (Revisited) Design a FSA to accept strings of a language • strings of a’s and b’s that start and end with a n Only change is in morphing to n Some transitions eliminated CSC 361 Finite Automata 30
Language Acceptor b a qf q 0 a b qt CSC 361 a q 1 b a, b Finite Automata 31
Another Language Acceptor n Build a FA to accept strings of even length a, b q 0 n n q 1 q 2 Wait! This only accepts strings of length 2 How to update? CSC 361 Finite Automata 32
Another Language Acceptor n As a DFA? (What’s wrong here? ) a, b q 1 q 0 n As an NFA (use transitions) a, b q 0 CSC 361 a, b q 2 q 1 Finite Automata q 2 33
- Csc 361
- What is finite verb
- Learning objectives of non finite verbs
- Finite and non-finite verb
- Finite and non finite subordinate clauses
- Non finite forms of the verb qayda
- Lambda closure nfa
- Diagram fsa
- Finite automata
- Automata
- Alphabet in finite automata
- Soal uts teori bahasa dan automata
- Informal picture of finite automata
- Lexical analysis finite automata
- Deterministic finite state automata
- Contoh mesin fsa
- Kleene's theorem solved examples
- String matching finite automata
- Deterministic finite automata adalah
- Aturan tata bahasa reguler
- Dfa state diagram generator
- Gambarlah diagram transisi untuk nfa berikut
- Automata calculator
- Non deterministic finite automata
- Finite automata with epsilon transitions
- Limitations of finite automata
- Finite state automata didefinisikan dengan
- Finite automata
- Wa state rx services
- Wap 571
- Ee 361
- Ece 361
- Ece 361
- Ece 361