Lecture #5 Advanced Computation Theory Finite Automata
some properties on Theorem 1: For any state q Є Q and any symbol a Є Σ for a dfa M = (Σ, Q, q, δ, A), proof since, then By definition of, Also by definition
hence # Theorem 2: For any state q of Q and any string x and y over Σ for a dfa M = (Σ, Q, q, δ, A), Proof: it is going to be proven by induction on string y. that is the statement to be proven is For any arbitrary fixed string x is true for any y
now, Let us recall, *.*. and for, and, then if, then also Hence the theorem is true for By the definition of
assume is true for any arbitrary string y. we are going to prove that: is true for any arbitrary string a of Σ. By the definition of Thus the theorem has proven
fa can be found in different forms such as dfa: Deterministic Finite Automata, DFA nfa: Nondeterministic Finite Automata, NFA pfa: Pushdown Finite Automata, PDA
dfa Deterministic Finite Automata
Languages & dfa
Definition: for a given dfa (M), the language of M, denoted by L(M), is the set of all string that will be accept by M. A language L consider to be a regular language if there exist a dfa that accept that language, i.e. for any dfa there is a regular language L that recongize by such dfa
Example #1 Show whether L regular language or not? solution Given the language, L = {a 2n + 1 | n >= 0} if there is any dfa that recognizes/accepts L, then L is regular language.
Initially, M will be at the start state q 0 Once M encountered the first symbol is a, it will transit to state q 1 If no more input symbol the M will stay in state q 1 and that is the final state, since n >= 0.
If another symbol a is encountered then M will move to state q 0 One more symbol is a, should be there so as to make M, transits to state q1(accept state), since a 2n + 1 and n >= 0
Based on the above discussion, the dfa can be represented by transition diagram as follows q1q1 a q0q0 a Therefore, the dfa, M as model can be shown as:
Example #2 Prove that the language is regular
Is there any a dfa, M to show that the language is regular? Here the M, check whether the string begins with and ends with a, what is in between is immaterial. M goes into the final state whenever the second a is encountered. solution
If this isn’t the end of string, and another b is found, it will take the dfa out of the final state. Scanning out and each a takes the dfa into the final state. At initial state, if b is encountered then M moves to a trap state. Accordingly, the dfa, M as model can be shown as:
q0q0 q2q2 q3q3 a b a b q1q1 a, b b a The dfa, state diagram is shown in the following Figure.
Example #3 Find the dfa that recognizes/accepts the language, L that consists of set of all strings on starting with the prefix ba
The main issue here, the first two symbols (ba) in the string; after they have been read, no further decision need to be made. Therefore the dfa, M can be designed used only four states, initial state, two state to recognize ba ending in a final trap state, and one non-final trap state. solution
If the first symbol is b and the second symbol is a a, M goes to the final trap state, and it will remain there since the rest of the string doesn't matter. On the other hand if the first symbol isn’t a b, and the second symbol isn’t an a, M goes to the non- final trap state Therefore, the dfa, M as model can be shown as:
q0q0 q2q2 q3q3 b a a, b a b q1q1 The simple solution is shown as in the following Figure
Example #4 Find the dfa that recognize/accept the set of all languages on, where
Initially, M will be at the start state q 0 Once M encountered the first symbol is a, it will transit to state q 1 If M encountered b at state q 1 it moves to state q 2. M may stay in q 0 as an accepting state since ɛ L(M).
If no more input another symbol M will stay at state q 2 as an accepting state since ab L(M). At q 2, If M encounter b it moves to state q 3. If M encountered a at state q 3 it moves to state q 4 as an accept state.
If no more input symbol M will stay at state q 4 as an accepting state since abba L(M). If M encounter b at q 0 or q 3, a at q 1 or q 2, or a, b at q 4, it moves to state q 5 as trap state. At q 5 for input symbols a and b, M stays at q 5, since it is a trap state. Based on the above discussion, the dfa, M as model can be shown as:
q0q0 q2q2 q3q3 a b b a q1q1 a, b b q4q4 a q5q5 a b Then dfa transition diagram can be shown as