Finite State Automata

Size: px
Start display at page:

Download "Finite State Automata"

Transcription

1 Trento 2005 p. 1/4 Finite State Automata Automata: Theory and Practice Paritosh K. Pandya (TIFR, Mumbai, India) Unversity of Trento May 2005

2 Trento 2005 p. 2/4 Finite Word Langauges Alphabet Σ is collection of symbols (letters). E.g. Σ = {a,b}. Finite word is a finite sequence of letters. E.g. aabb. Set of all finite words is denoted by Σ. Langauge U is a set of words, i.e. U Σ. Example: (a) Words over Σ = {a,b} with equal number of a and b. E.g. aabb or abba. Language recognition problem: To determine whether a word belongs to a language. Most computational problems can be encoded as language recognition problem. Automata are computational devices to solve langauge recognition problems.

3 Trento 2005 p. 3/4 Finite State Automata Basic model of computational systems with finite memory. Widely applicable Embedded System Controllers. Languages: Esterel, Lustre, Verilog, SMV. Synchronous Circuits. Regular Expression Pattern Matching Grep, Lex, Perl, Awk, Emacs. Protocols Network Protocols Architecture: Bus, Cache Coherence... Mobile Telephony. Good decision procedures

4 Trento 2005 p. 4/4 Topics DFA, NFA and Equivalence Closure Properties and Decision Problems Regular Expressions and McNaughton Yamada Lemma Homomorphisms DFA minization Pumping Lemma Myhill Nerode Theorem Bisimulation and collapsing nondeterministic automta Textbook: Dexter Kozen, Automata and Computability. Springer, 1997.

5 Trento 2005 p. 5/4 Notation a,b Σ finite alphabet. u,v,w Σ finite words. ǫ empty word. u.v catenation. u i = u.u..u repeated i-times. U,V Σ Finite word languages. For a set S we use 2 S to denote all its subsets. 2 S def = {X X S}.

6 Trento 2005 p. 6/4 Deterministic Finite State Automaton Example: DFA A 1 over Σ = {a,b}. a b b s 1 s 2 a

7 Trento 2005 p. 6/4 Deterministic Finite State Automaton Example: DFA A 1 over Σ = {a,b}. a b b s 1 s 1 s 2 a The run of A 1 over the word abba is : a b b a s 1 s 2 s 2 s 1. For a given word the run is unique.

8 Trento 2005 p. 6/4 Deterministic Finite State Automaton Example: DFA A 1 over Σ = {a,b}. a b b s 1 s 1 s 2 a The run of A 1 over the word abba is : a b b a s 1 s 2 s 2 s 1. For a given word the run is unique. Recognises words which do not end in b.

9 Trento 2005 p. 7/4 DFA Definition DFA is (Q, Σ,δ,I,F) Q Finite set of states. Σ is the finite alphabet. q 0 Q the initial states. F Q set of final states. δ : Q Σ Q, transition function (total). Notation: We use q a q to denote δ(q,a) = q. A run of DFA A on u = a 0,a 1,...,a n 1 is a sequence of a states q 0,q 1,...,q n s.t. q i i qi+1 for 0 i < n. For a given word w the DFA has a unique run. A run accepting if last state q n F.

10 Trento 2005 p. 8/4 Regular Langauges Language accepted by A L(A) = {u Σ A has an accepting run on u}. A langauge accepted by a DFA is called a regular language.

11 Trento 2005 p. 8/4 Regular Langauges Language accepted by A L(A) = {u Σ A has an accepting run on u}. A langauge accepted by a DFA is called a regular language. Define ˆδ(q,u) inductively over u Σ. ˆδ(q,ǫ) = q, ˆδ(q,ua) = δ(ˆδ(q,u),a). For X Q define ˆδ(X,u) def = q X ˆδ(q,u).

12 Trento 2005 p. 9/4 Nondeterministic FSA NFA A 2. a,b b s 1 s b 2

13 Trento 2005 p. 9/4 Nondeterministic FSA NFA A 2. a,b b s 1 s b 2 A run of A 2 over the word abbb is: a b b b s 1 s 1 s 2 s 2. s 1 Another run over the same word abbb is: a b b b s 1 s 1 s 1 s 1. s 1 A 2 has no accepting run over the word aba as: a b a s 1 s 2 s 1 NFA can have 0, 1 or more than one runs on a given word.

14 Trento 2005 p. 9/4 Nondeterministic FSA NFA A 2 recognises words which end in b. a,b b s 1 s b 2 A run of A 2 over the word abbb is: a b b b s 1 s 1 s 2 s 2. s 1 Another run over the same word abbb is: a b b b s 1 s 1 s 1 s 1. s 1 A 2 has no accepting run over the word aba as: a b a s 1 s 2 s 1 NFA can have 0, 1 or more than one runs on a given word.

15 Trento 2005 p. 10/4 NFA Definition Nodeterministic Finite State Automaton: NFA is (Q, Σ,δ,I,F) Q Finite set of states. I Q set of initial states. F Q set of final states. δ Q Σ Q transition relation (edges). a We use q q to denote (q,a,q ) δ. Alternate Definition of δ δ : Q Σ 2 Q. Exercise: Given that Q = n and Σ = k, give the number of syntactically distinct NFAs.

16 Trento 2005 p. 11/4 NFA Runs A run of NFA A on u = a 0,a 1,...,a n 1 is a sequence of a states q 0,q 1,...,q n s.t. q i i qi+1 for 0 i < n and q 0 I. For a given word w the NFA can have many runs. A run accepting if last state q n F. Language accepted by A is L(A) = {u Σ A has an accepting run on u}.

17 Trento 2005 p. 11/4 NFA Runs A run of NFA A on u = a 0,a 1,...,a n 1 is a sequence of a states q 0,q 1,...,q n s.t. q i i qi+1 for 0 i < n and q 0 I. For a given word w the NFA can have many runs. A run accepting if last state q n F. Language accepted by A is L(A) = {u Σ A has an accepting run on u}. Define ˆδ(S,w) inductively on w as follows. ˆδ(S,a) = s S δ(s,a) ˆδ(S,ǫ) = S, ˆδ(S,wa) = ˆδ(ˆδ(S,w),a). Claim x L(A) ˆδ(I,x) F

18 Trento 2005 p. 12/4 Subset Construction Theorem (determinisation) Given NFA A = (Q, Σ,δ,I,F) we can construct a DFA A s.t. L(A) = L(A ).

19 Trento 2005 p. 12/4 Subset Construction Theorem (determinisation) Given NFA A = (Q, Σ,δ,I,F) we can construct a DFA A s.t. L(A) = L(A ). Subset construction: 0,1 p q 1 0,1 Consider ˆδ(I,w) the set of states reached after word w. We define (S, a). 0 1 {p} {p} {p,q} {p,q} {p,r} {p,q,r} {p,r} {p} {p,q} {p,q,r} {p,r} {p,q,r} r

20 Trento 2005 p. 13/4 Subset Construction (cont) Let A = (2 Q, Σ,,I,F ) where (S,a) = {q q δ(p,a) p S} F = {S 2 Q S F }. Claim: L(A) = L(A ). Proof Method: Show that ˆδ(S,w) = ˆ (S,w). Complexity A 2 A. Lower Bound Example: Consider NFA recognising words over {0, 1} such that the n-th last symbol is 1. Claim: Equivalent DFA will have at least 2 n states. (Home Exercise: Prove this.)

21 Trento 2005 p. 14/4 Closure Properties Theorem (boolean closure) Given NFA A 1,A 2 over Σ we can construct NFA A over Σ s.t. L(A) = L(A 1 ) (Complement). Size: A = 2 A 1. L(A) = L(A 1 ) L(A 2 ) (union). Size: A = A 1 + A 2. L(A) = L(A 1 ) L(A 2 ) (intersection). A = A 1 A 2.

22 Trento 2005 p. 15/4 Synchronous Product: Example s 0 a b b b b a a a s 1 a t 2 t 0 b t 1 A 1 recognises words with even number of b. A 2 recognises words with number of a mod 3 = 0. The Product Automaton A 1 A 2 with F = {s 0,t 0 }. s 0 a a a t s 0 t 1 2 s 0 t 0 b b b b s 1 t 2 s 1 t 0 a a a b b s 1 t 1

23 Trento 2005 p. 16/4 Synchronous Product Construction Let A 1 = (Q 1, Σ,δ 1,I 1,F 1 ) and A 2 = (Q 2, Σ,δ 2,I 2,F 2 ). Then, A 1 A 2 = (Q, Σ,δ,I,F) where Q = Q 1 Q 2. I = I 1 I 2. F = F 1 F 2. < p,q > a < p,q > iff p a p and q Theorem L(A 1 A 2 ) = L(A 1 ) L(A 2 ). a q. Semantics of many concurrent systems E.g. Esterel, Statecharts, Lustre, Synchronous circuits, SMV.

24 Trento 2005 p. 17/4 Synchronised Product Construction Let A 1 = (Q 1, Σ 1,δ 1,I 1,F 1 ) and A 2 = (Q 2, Σ 2,δ 2,I 2,F 2 ). Then, A 1 A 2 = (Q, Σ,δ,I,F) where Q = Q 1 Q 2. Σ = Σ 1 Σ 2. I = I 1 I 2. F = F 1 F 2. < p,q > < a p,q > if a Σ 1 Σ 2 and p a p and a q q. < p,q > a < p,q > if a Σ 1, a Σ 2 and p a p. < p,q > a < p,q > if a Σ 1, a Σ 2 and q a q.

25 Trento 2005 p. 18/4 Asynchronous Product Construction Let A 1 = (Q 1, Σ 1,δ 1,I 1,F 1 ) and A 2 = (Q 2, Σ 2,δ 2,I 2,F 2 ). Then, A 1 A A 2 = (Q, Σ,δ,I,F) where Q = Q 1 Q 2. Σ = Σ 1 Σ 2. I = I 1 I 2. F = F 1 F 2. < p,q > a < p,q > if a Σ 1 and p a p. < p,q > a < p,q > if a Σ 2 and q a q.

26 Trento 2005 p. 19/4 Decision Problems Theorem (Emptiness) Given NFA A we can decide whether L(A) =. Method Forward/Backward Reachability in Automaton graph using say Depth First Search. Complexity is O( Q + δ ). In practice, symbolic techniques are used and often more effective. Theorem (Language Containment) Given NFA A 1 and A 2 we can decide whether L(A 1 ) L(A 2 ). Method: L(A 1 ) L(A 2 ) iff L(A 1 ) L(A 2 ) =. Complexity is O( A 1 2 A 2 ).

27 Trento 2005 p. 20/4 Kleene Closure Let U,V Σ. (Catenation) Let U V def = {x y x U y V }. (Iteration) Let U i def = {x 1 x 2... x i x k U, 1 k < i}. By convention U 0 def = {ǫ}. (Kleene Closure) Let U def = 0 i U i. Theorem Regular langauges are closed under the operations U V and U V and U. Proof method: Using ǫ-nfa.

28 Trento 2005 p. 21/4 Regular Expressions Syntax: ǫ a reg 1.reg 2 reg 1 + reg 2 reg.

29 Trento 2005 p. 21/4 Regular Expressions Syntax: ǫ a reg 1.reg 2 reg 1 + reg 2 reg. Language L(reg) is defined inductively: L( ) =, L(a) = {a}, L(ǫ) = {ǫ}. L(re 1 re 2 ) = L(re 1 ) L(re 2 ), L(re 1 + re 2 ) = L(re 1 ) L(re 2 ), L(re ) = (L(re 1 )) Example: a.(b + bb).a. Words over a,b having either 1 b or 2 consecutive b.

30 Trento 2005 p. 21/4 Regular Expressions Syntax: ǫ a reg 1.reg 2 reg 1 + reg 2 reg. Language L(reg) is defined inductively: L( ) =, L(a) = {a}, L(ǫ) = {ǫ}. L(re 1 re 2 ) = L(re 1 ) L(re 2 ), L(re 1 + re 2 ) = L(re 1 ) L(re 2 ), L(re ) = (L(re 1 )) Example: a.(b + bb).a. Words over a,b having either 1 b or 2 consecutive b. Equivalence of RegExp and FSA (McNaughton, Yamada) Theorem: For every regular expression reg we can construct a language equivalent ǫ-nfa of size O( reg ).

31 Trento 2005 p. 22/4 Automata to RegExp Theorem: For every NFA A = (Q, Σ,δ,I,F) we can construct a langauge equivalent regular expression reg(a).

32 Trento 2005 p. 22/4 Automata to RegExp Theorem: For every NFA A = (Q, Σ,δ,I,F) we can construct a langauge equivalent regular expression reg(a). Construction Define regular expression α X p,q for X Q and p,q Q. This denotes set of words w such that A has a run on w from p to q where all intermediate states are from X.

33 Trento 2005 p. 22/4 Automata to RegExp Theorem: For every NFA A = (Q, Σ,δ,I,F) we can construct a langauge equivalent regular expression reg(a). Construction Define regular expression α X p,q for X Q and p,q Q. This denotes set of words w such that A has a run on w from p to q where all intermediate states are from X q 0 Example: p 0 r α q p,r = 10 α p,q p,r = Aim: To compute α p,q,r p,p

34 Trento 2005 p. 23/4 Automata to RegExp (2) α X p,r can be recursively defined using the following rules: α p,r = a a k where r δ(p,a i ) provided p r

35 Trento 2005 p. 23/4 Automata to RegExp (2) α X p,r can be recursively defined using the following rules: α p,r α p,p = a a k where r δ(p,a i ) = a a k + ǫ where p δ(p,a i ) provided p r

36 Trento 2005 p. 23/4 Automata to RegExp (2) α X p,r can be recursively defined using the following rules: α p,r α p,p = a a k where r δ(p,a i ) = a a k + ǫ where p δ(p,a i ) For any q X, α X p,r = α (X {q}) p,r + α (X {q}) p,q provided p r ( α (X {q}) q,q ) α (X {q}) q,r

37 Trento 2005 p. 23/4 Automata to RegExp (2) α X p,r can be recursively defined using the following rules: α p,r α p,p = a a k where r δ(p,a i ) = a a k + ǫ where p δ(p,a i ) For any q X, α X p,r = α (X {q}) p,r + α (X {q}) p,q provided p r ( α (X {q}) q,q ) α (X {q}) q,r The desired regular expression is given as follows: p I q F αq p,q.

38 Trento 2005 p. 24/4 Example Compute α p,q,r p,p α p,q,r p,p as It is easy to see that αp,p p,r = 0, αq,p p,r = 00(0 ), 0 p 1 0 q 1 0 = α p,r p,p + α p,r p,q (α p,r q,q) α p,r q,p. α p,r r p,q = 0 1 αq,q p,r = ǫ (0 )1 Hence α p,q,r p,p = (ǫ (0 )1) 00(0 )

39 Trento 2005 p. 25/4 Kleene Algebra Axiomatizing equivalence of regular expression. Not covered in this course. (See Kozen.)

40 Trento 2005 p. 26/4 Homomorphism Homomorphism is a map h : Σ Γ with the property u,v Σ. h(u v) = h(u) h(v). Consequences: h(ǫ) = ǫ. Giving h(a) for a Σ uniquely determines h.

41 Trento 2005 p. 26/4 Homomorphism Homomorphism is a map h : Σ Γ with the property u,v Σ. h(u v) = h(u) h(v). Consequences: h(ǫ) = ǫ. Giving h(a) for a Σ uniquely determines h. Theorem If h : Σ Γ is a homomorphism and B Γ is regular then h 1 (B) = {x Σ h(x) B} is also regular.

42 Trento 2005 p. 26/4 Homomorphism Homomorphism is a map h : Σ Γ with the property u,v Σ. h(u v) = h(u) h(v). Consequences: h(ǫ) = ǫ. Giving h(a) for a Σ uniquely determines h. Theorem If h : Σ Γ is a homomorphism and B Γ is regular then h 1 (B) = {x Σ h(x) B} is also regular. Proof method: Given DFA BB = (Q, Γ,δ,q 0,F) for B construct DFA AA for h 1 (B) as follows. AA def = (Q, Σ,δ,q 0,F) with δ (q,a) = ˆδ(q,h(a)).

43 Trento 2005 p. 27/4 Homomorphism (2) Theorem If h : Σ Γ is a homomorphism and A Σ is regular then h(a) = {h(x) x A} is also regular.

44 Trento 2005 p. 27/4 Homomorphism (2) Theorem If h : Σ Γ is a homomorphism and A Σ is regular then h(a) = {h(x) x A} is also regular. Proof method: Given regular epxression re for A, obtain h(re) by substituting every letter a by h(a). Then L(h(re)) = h(a).

45 Trento 2005 p. 27/4 Homomorphism (2) Theorem If h : Σ Γ is a homomorphism and A Σ is regular then h(a) = {h(x) x A} is also regular. Proof method: Given regular epxression re for A, obtain h(re) by substituting every letter a by h(a). Then L(h(re)) = h(a). Theorem (projection) Given NFA(A 1 ) over Σ and surjection h : Σ Γ, we can construct NFA(A 2 ) over Γ s.t. L(A 2 ) = h(l(a 1 )). Proof Method: Substitute label a by h(a) in each transition of A 1 to get A 2. Note that this can make DFA into NFA. We have A 2 = A 1.

46 Trento 2005 p. 27/4 Homomorphism (2) Theorem If h : Σ Γ is a homomorphism and A Σ is regular then h(a) = {h(x) x A} is also regular. Proof method: Given regular epxression re for A, obtain h(re) by substituting every letter a by h(a). Then L(h(re)) = h(a). Theorem (projection) Given NFA(A 1 ) over Σ and surjection h : Σ Γ, we can construct NFA(A 2 ) over Γ s.t. L(A 2 ) = h(l(a 1 )). Proof Method: Substitute label a by h(a) in each transition of A 1 to get A 2. Note that this can make DFA into NFA. We have A 2 = A 1. Example: Given regular A over {0, 1} the language hamming 3 (A) is regular.

47 Trento 2005 p. 28/4 DFA Minimization 0 a b 1 2 a b b a 3 4 a,b a,b 5 a,b

48 Trento 2005 p. 28/4 DFA Minimization 0 a b 1 2 a b b a 3 4 a,b a,b 5 a,b

49 Trento 2005 p. 28/4 DFA Minimization 0 a b 1 2 a b b a 3 4 a,b a,b 5 a,b p q def = x Σ. (ˆδ(p,x) F ˆδ(q,x) F)

50 Trento 2005 p. 28/4 DFA Minimization 0 a b 1 2 a b b a 3 4 a,b a,b 5 a,b p q def = x Σ. (ˆδ(p,x) F ˆδ(q,x) F) Equivalent Automaton a,b 6 7 a,b 8 a,b

51 Trento 2005 p. 29/4 DFA Minimization (2) p q def = x Σ. (ˆδ(p,x) F ˆδ(q,x) F)

52 Trento 2005 p. 29/4 DFA Minimization (2) p q def = x Σ. (ˆδ(p,x) F ˆδ(q,x) F) Proposition is an equivalence relation, i.e. (a) p. p p, (b) p,q. p q q p (c) p,q,r. p q q r p r (Exercise: Check that above properties are true.)

53 Trento 2005 p. 29/4 DFA Minimization (2) p q def = x Σ. (ˆδ(p,x) F ˆδ(q,x) F) Proposition is an equivalence relation, i.e. (a) p. p p, (b) p,q. p q q p (c) p,q,r. p q q r p r (Exercise: Check that above properties are true.) partitions Q into equivalence classes. Let [p] denote the equivalence class of p. Example The classes are {0}, {1, 2} and {3, 4, 5}.

54 Trento 2005 p. 30/4 Quotient Automaton Given DFA A = (Q, Σ,δ, [q 0 ],F) and as before, the Quotient automaton is A/ def = (Q, Σ,δ, [q 0 ],F ), where Q = {[p] p Q} δ ([p],a) = [δ(p,a)] F = {[f] f F }

55 Trento 2005 p. 30/4 Quotient Automaton Given DFA A = (Q, Σ,δ, [q 0 ],F) and as before, the Quotient automaton is A/ def = (Q, Σ,δ, [q 0 ],F ), where Q = {[p] p Q} δ ([p],a) = [δ(p,a)] F = {[f] f F } Well-formedness Theorem(Congruence) p q a Σ. δ(p,a) δ(q,a).

56 Trento 2005 p. 30/4 Quotient Automaton Given DFA A = (Q, Σ,δ, [q 0 ],F) and as before, the Quotient automaton is A/ def = (Q, Σ,δ, [q 0 ],F ), where Q = {[p] p Q} δ ([p],a) = [δ(p,a)] F = {[f] f F } Well-formedness Theorem(Congruence) p q a Σ. δ(p,a) δ(q,a). Now we can show that quotient automaton recognises the same language. Theorem ˆδ ([p],w) = [ˆδ(p,w)]. Corollary L(A/ ) = L(A).

57 Trento 2005 p. 31/4 Minimization algorithm 1. Make pairs table with (p,q) Q Q and p < q. 2. Mark (p,q) if p F q / F or vice versa. 3. Repeat following steps until no change occurs. (a) Pick unmarked state (p, q). (b) If (δ(p,a),δ(q,a)) is marked for some a Σ then mark (p,q)

58 Trento 2005 p. 31/4 Minimization algorithm 1. Make pairs table with (p,q) Q Q and p < q. 2. Mark (p,q) if p F q / F or vice versa. 3. Repeat following steps until no change occurs. (a) Pick unmarked state (p, q). (b) If (δ(p,a),δ(q,a)) is marked for some a Σ then mark (p,q) Termination: In each pass at least one new pair must get marked. Lemma (p,q) is marked iff x Σ.ˆδ(p,x) F ˆδ(q,x) / F or vice versa.

59 Trento 2005 p. 31/4 Minimization algorithm 1. Make pairs table with (p,q) Q Q and p < q. 2. Mark (p,q) if p F q / F or vice versa. 3. Repeat following steps until no change occurs. (a) Pick unmarked state (p, q). (b) If (δ(p,a),δ(q,a)) is marked for some a Σ then mark (p,q) Termination: In each pass at least one new pair must get marked. Lemma (p,q) is marked iff x Σ.ˆδ(p,x) F ˆδ(q,x) / F or vice versa. Question: Can there be a DFA smaller than A/ equivalent to A?

60 Trento 2005 p. 32/4 Pumping Lemma Idea: Consider a long word recognized by a DFA with n states. Consider substring y s.t. y n. Some state during y part of the run must repeat. The string between repeating states can be pumped.

61 Trento 2005 p. 32/4 Pumping Lemma Idea: Consider a long word recognized by a DFA with n states. Consider substring y s.t. y n. Some state during y part of the run must repeat. The string between repeating states can be pumped. Lemma For every regular language L n > 0 such that x,y,z with x y z L and y n u,v,w s.t. y = u v w with v > 0 and x u v i w z L for all 0 i.

62 Trento 2005 p. 32/4 Pumping Lemma Idea: Consider a long word recognized by a DFA with n states. Consider substring y s.t. y n. Some state during y part of the run must repeat. The string between repeating states can be pumped. Lemma For every regular language L n > 0 such that x,y,z with x y z L and y n u,v,w s.t. y = u v w with v > 0 and x u v i w z L for all 0 i. Pumping Lemma is used to prove that some langugages are not regular. E.g. {a 2n n 0}.

63 Trento 2005 p. 33/4 Proving non-regularity Game with Demon Demon claims L is regular and chooses n. You choose a string xyz L with y n. Demon partitions y = uvw with v 0. You show that xu(v i )wz / L for some i for your choice.

64 Trento 2005 p. 34/4 Myhill-Nerode Relations Let be an equivalence relation over Σ. is right congruent if x,y Σ, a Σ we have x y x a y a

65 Trento 2005 p. 34/4 Myhill-Nerode Relations Let be an equivalence relation over Σ. is right congruent if x,y Σ, a Σ we have x y x a y a Let R Σ (not necessarily regular). refines R if x,y Σ x y (x R y R)

66 Trento 2005 p. 34/4 Myhill-Nerode Relations Let be an equivalence relation over Σ. is right congruent if x,y Σ, a Σ we have x y x a y a Let R Σ (not necessarily regular). refines R if x,y Σ x y (x R y R) is of finite index if partitions the Σ into only finitely many equivalence classes.

67 Trento 2005 p. 34/4 Myhill-Nerode Relations Let be an equivalence relation over Σ. is right congruent if x,y Σ, a Σ we have x y x a y a Let R Σ (not necessarily regular). refines R if x,y Σ x y (x R y R) is of finite index if partitions the Σ into only finitely many equivalence classes. Equivalence relation is called Myhill-Nerode Relation refining R if it satisfies all the three properties above.

68 Trento 2005 p. 35/4 Machine Equivalence Given a DFA A = (Q, Σ,δ,q 0,F) define the induced equivalence A over Σ as follows: def x A y = ˆδ(q 0,x) = ˆδ(q 0,y).

69 Trento 2005 p. 35/4 Machine Equivalence Given a DFA A = (Q, Σ,δ,q 0,F) define the induced equivalence A over Σ as follows: def x A y = ˆδ(q 0,x) = ˆδ(q 0,y). Proposition A is a Myhill-Nerode relation refining L(A). Proof Method Check the following: (a) A is an equivalence relation over Σ. (b) x A y a. xa A ya. (c) x A y x L(A) y L(A) (d) A is of finite index.

70 Trento 2005 p. 35/4 Machine Equivalence Given a DFA A = (Q, Σ,δ,q 0,F) define the induced equivalence A over Σ as follows: def x A y = ˆδ(q 0,x) = ˆδ(q 0,y). Proposition A is a Myhill-Nerode relation refining L(A). Proof Method Check the following: (a) A is an equivalence relation over Σ. (b) x A y a. xa A ya. (c) x A y x L(A) y L(A) (d) A is of finite index. Example: We give automaton A and the induced equivalence partitions.

71 Trento 2005 p. 36/4 From Equivalence to DFA Let be Myhill-Nerode refining R. Define DFA A def = (Q, Σ,δ,q 0,F) as follows: Q def = {[x] x Σ } def q 0 = [ǫ] F def = {[x] x R} δ([x],a]) def = [xa]. (Check well-formedness.)

72 Trento 2005 p. 36/4 From Equivalence to DFA Let be Myhill-Nerode refining R. Define DFA A def = (Q, Σ,δ,q 0,F) as follows: Q def = {[x] x Σ } def q 0 = [ǫ] F def = {[x] x R} δ([x],a]) def = [xa]. (Check well-formedness.) Theorem L(A ) = R. Lemma ˆδ([x],y) = [xy].

73 Trento 2005 p. 37/4 Correspondence The A and A are inverses of each other. Theorem A =. Theorem If A is automaton without unreachable states then A A is isomorphic to A.

74 Trento 2005 p. 38/4 Language Induced Equivalence An equivalence relation 1 refines equivalence relation 2 provided x 1 y x 2 y (Set theoretically, 1 2.) Intuitively, 1 makes finer partitions than 2.

75 Trento 2005 p. 38/4 Language Induced Equivalence An equivalence relation 1 refines equivalence relation 2 provided x 1 y x 2 y (Set theoretically, 1 2.) Intuitively, 1 makes finer partitions than 2. Definition (Language Induced Equivalence) Given R Σ, def x R y = z Σ. (xz R yz R).

76 Trento 2005 p. 38/4 Language Induced Equivalence An equivalence relation 1 refines equivalence relation 2 provided x 1 y x 2 y (Set theoretically, 1 2.) Intuitively, 1 makes finer partitions than 2. Definition (Language Induced Equivalence) Given R Σ, def x R y = z Σ. (xz R yz R). Proposition R is right congruent. Proposition R refines R.

77 Trento 2005 p. 38/4 Language Induced Equivalence An equivalence relation 1 refines equivalence relation 2 provided x 1 y x 2 y (Set theoretically, 1 2.) Intuitively, 1 makes finer partitions than 2. Definition (Language Induced Equivalence) Given R Σ, def x R y = z Σ. (xz R yz R). Proposition R is right congruent. Proposition R refines R. Proposition(Coarseness) Let be right-congruent refining R. Then, R.

78 Trento 2005 p. 39/4 Myhill-Nerode Theorem Let R Σ. The following statements are equivalent. 1. R is regular 2. There exists a Myhill-Nerode relation refinining R. 3. The relation R is of finite index. The automaton A R gives the minimal DFA for R.

79 Trento 2005 p. 40/4 State Minimization is optimal Let A recognise R. Consider the quotient automaton M = A/ as before, and assume that it has no inaccessible states. Lemma x R y x M y

80 Trento 2005 p. 41/4 Bisimulation Postponed to the End of course. See Kozen Supplementary Lecture B.

Formal Language and Automata Theory (CS21004)

Formal Language and Automata Theory (CS21004) Theory (CS21004) Announcements The slide is just a short summary Follow the discussion and the boardwork Solve problems (apart from those we dish out in class) Table of Contents 1 2 3 Languages that are

More information

Finite Automata and Regular Languages

Finite Automata and Regular Languages Finite Automata and Regular Languages Topics to be covered in Chapters 1-4 include: deterministic vs. nondeterministic FA, regular expressions, one-way vs. two-way FA, minimization, pumping lemma for regular

More information

Closure Properties of Regular Languages. Union, Intersection, Difference, Concatenation, Kleene Closure, Reversal, Homomorphism, Inverse Homomorphism

Closure Properties of Regular Languages. Union, Intersection, Difference, Concatenation, Kleene Closure, Reversal, Homomorphism, Inverse Homomorphism Closure Properties of Regular Languages Union, Intersection, Difference, Concatenation, Kleene Closure, Reversal, Homomorphism, Inverse Homomorphism Closure Properties Recall a closure property is a statement

More information

HKN CS/ECE 374 Midterm 1 Review. Nathan Bleier and Mahir Morshed

HKN CS/ECE 374 Midterm 1 Review. Nathan Bleier and Mahir Morshed HKN CS/ECE 374 Midterm 1 Review Nathan Bleier and Mahir Morshed For the most part, all about strings! String induction (to some extent) Regular languages Regular expressions (regexps) Deterministic finite

More information

3515ICT: Theory of Computation. Regular languages

3515ICT: Theory of Computation. Regular languages 3515ICT: Theory of Computation Regular languages Notation and concepts concerning alphabets, strings and languages, and identification of languages with problems (H, 1.5). Regular expressions (H, 3.1,

More information

T (s, xa) = T (T (s, x), a). The language recognized by M, denoted L(M), is the set of strings accepted by M. That is,

T (s, xa) = T (T (s, x), a). The language recognized by M, denoted L(M), is the set of strings accepted by M. That is, Recall A deterministic finite automaton is a five-tuple where S is a finite set of states, M = (S, Σ, T, s 0, F ) Σ is an alphabet the input alphabet, T : S Σ S is the transition function, s 0 S is the

More information

Computational Models - Lecture 3 1

Computational Models - Lecture 3 1 Computational Models - Lecture 3 1 Handout Mode Iftach Haitner and Yishay Mansour. Tel Aviv University. March 13/18, 2013 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice

More information

UNIT-III REGULAR LANGUAGES

UNIT-III REGULAR LANGUAGES Syllabus R9 Regulation REGULAR EXPRESSIONS UNIT-III REGULAR LANGUAGES Regular expressions are useful for representing certain sets of strings in an algebraic fashion. In arithmetic we can use the operations

More information

Lecture Notes On THEORY OF COMPUTATION MODULE -1 UNIT - 2

Lecture Notes On THEORY OF COMPUTATION MODULE -1 UNIT - 2 BIJU PATNAIK UNIVERSITY OF TECHNOLOGY, ODISHA Lecture Notes On THEORY OF COMPUTATION MODULE -1 UNIT - 2 Prepared by, Dr. Subhendu Kumar Rath, BPUT, Odisha. UNIT 2 Structure NON-DETERMINISTIC FINITE AUTOMATA

More information

Context Free Languages. Automata Theory and Formal Grammars: Lecture 6. Languages That Are Not Regular. Non-Regular Languages

Context Free Languages. Automata Theory and Formal Grammars: Lecture 6. Languages That Are Not Regular. Non-Regular Languages Context Free Languages Automata Theory and Formal Grammars: Lecture 6 Context Free Languages Last Time Decision procedures for FAs Minimum-state DFAs Today The Myhill-Nerode Theorem The Pumping Lemma Context-free

More information

More on Finite Automata and Regular Languages. (NTU EE) Regular Languages Fall / 41

More on Finite Automata and Regular Languages. (NTU EE) Regular Languages Fall / 41 More on Finite Automata and Regular Languages (NTU EE) Regular Languages Fall 2016 1 / 41 Pumping Lemma is not a Sufficient Condition Example 1 We know L = {b m c m m > 0} is not regular. Let us consider

More information

Finite Automata and Languages

Finite Automata and Languages CS62, IIT BOMBAY Finite Automata and Languages Ashutosh Trivedi Department of Computer Science and Engineering, IIT Bombay CS62: New Trends in IT: Modeling and Verification of Cyber-Physical Systems (2

More information

COMP4141 Theory of Computation

COMP4141 Theory of Computation COMP4141 Theory of Computation Lecture 4 Regular Languages cont. Ron van der Meyden CSE, UNSW Revision: 2013/03/14 (Credits: David Dill, Thomas Wilke, Kai Engelhardt, Peter Höfner, Rob van Glabbeek) Regular

More information

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY 15-453 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY REVIEW for MIDTERM 1 THURSDAY Feb 6 Midterm 1 will cover everything we have seen so far The PROBLEMS will be from Sipser, Chapters 1, 2, 3 It will be

More information

DM17. Beregnelighed. Jacob Aae Mikkelsen

DM17. Beregnelighed. Jacob Aae Mikkelsen DM17 Beregnelighed Jacob Aae Mikkelsen January 12, 2007 CONTENTS Contents 1 Introduction 2 1.1 Operations with languages...................... 2 2 Finite Automata 3 2.1 Regular expressions/languages....................

More information

Computational Models - Lecture 4

Computational Models - Lecture 4 Computational Models - Lecture 4 Regular languages: The Myhill-Nerode Theorem Context-free Grammars Chomsky Normal Form Pumping Lemma for context free languages Non context-free languages: Examples Push

More information

CS 154, Lecture 3: DFA NFA, Regular Expressions

CS 154, Lecture 3: DFA NFA, Regular Expressions CS 154, Lecture 3: DFA NFA, Regular Expressions Homework 1 is coming out Deterministic Finite Automata Computation with finite memory Non-Deterministic Finite Automata Computation with finite memory and

More information

What we have done so far

What we have done so far What we have done so far DFAs and regular languages NFAs and their equivalence to DFAs Regular expressions. Regular expressions capture exactly regular languages: Construct a NFA from a regular expression.

More information

DD2371 Automata Theory

DD2371 Automata Theory KTH CSC VT 2008 DD2371 Automata Theory Dilian Gurov Lecture Outline 1. The lecturer 2. Introduction to automata theory 3. Course syllabus 4. Course objectives 5. Course organization 6. First definitions

More information

Warshall s algorithm

Warshall s algorithm Regular Expressions [1] Warshall s algorithm See Floyd-Warshall algorithm on Wikipedia The Floyd-Warshall algorithm is a graph analysis algorithm for finding shortest paths in a weigthed, directed graph

More information

Büchi Automata and their closure properties. - Ajith S and Ankit Kumar

Büchi Automata and their closure properties. - Ajith S and Ankit Kumar Büchi Automata and their closure properties - Ajith S and Ankit Kumar Motivation Conventional programs accept input, compute, output result, then terminate Reactive program : not expected to terminate

More information

Introduction to Kleene Algebra Lecture 9 CS786 Spring 2004 February 23, 2004

Introduction to Kleene Algebra Lecture 9 CS786 Spring 2004 February 23, 2004 Introduction to Kleene Algebra Lecture 9 CS786 Spring 2004 February 23, 2004 Completeness Here we continue the program begun in the previous lecture to show the completeness of Kleene algebra for the equational

More information

acs-04: Regular Languages Regular Languages Andreas Karwath & Malte Helmert Informatik Theorie II (A) WS2009/10

acs-04: Regular Languages Regular Languages Andreas Karwath & Malte Helmert Informatik Theorie II (A) WS2009/10 Regular Languages Andreas Karwath & Malte Helmert 1 Overview Deterministic finite automata Regular languages Nondeterministic finite automata Closure operations Regular expressions Nonregular languages

More information

Finite Automata and Regular languages

Finite Automata and Regular languages Finite Automata and Regular languages Huan Long Shanghai Jiao Tong University Acknowledgements Part of the slides comes from a similar course in Fudan University given by Prof. Yijia Chen. http://basics.sjtu.edu.cn/

More information

CS 154. Finite Automata, Nondeterminism, Regular Expressions

CS 154. Finite Automata, Nondeterminism, Regular Expressions CS 54 Finite Automata, Nondeterminism, Regular Expressions Read string left to right The DFA accepts a string if the process ends in a double circle A DFA is a 5-tuple M = (Q, Σ, δ, q, F) Q is the set

More information

Computational Models - Lecture 3

Computational Models - Lecture 3 Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 1 Computational Models - Lecture 3 Equivalence of regular expressions and regular languages (lukewarm leftover

More information

Constructions on Finite Automata

Constructions on Finite Automata Constructions on Finite Automata Informatics 2A: Lecture 4 Mary Cryan School of Informatics University of Edinburgh mcryan@inf.ed.ac.uk 24 September 2018 1 / 33 Determinization The subset construction

More information

Computational Models: Class 3

Computational Models: Class 3 Computational Models: Class 3 Benny Chor School of Computer Science Tel Aviv University November 2, 2015 Based on slides by Maurice Herlihy, Brown University, and modifications by Iftach Haitner and Yishay

More information

CS 208: Automata Theory and Logic

CS 208: Automata Theory and Logic CS 28: Automata Theory and Logic b a a start A x(la(x) y(x < y) L b (y)) B b Department of Computer Science and Engineering, Indian Institute of Technology Bombay of 32 Nondeterminism Alternation 2 of

More information

CS 154, Lecture 2: Finite Automata, Closure Properties Nondeterminism,

CS 154, Lecture 2: Finite Automata, Closure Properties Nondeterminism, CS 54, Lecture 2: Finite Automata, Closure Properties Nondeterminism, Why so Many Models? Streaming Algorithms 0 42 Deterministic Finite Automata Anatomy of Deterministic Finite Automata transition: for

More information

Before we show how languages can be proven not regular, first, how would we show a language is regular?

Before we show how languages can be proven not regular, first, how would we show a language is regular? CS35 Proving Languages not to be Regular Before we show how languages can be proven not regular, first, how would we show a language is regular? Although regular languages and automata are quite powerful

More information

Theory of Computation

Theory of Computation Fall 2002 (YEN) Theory of Computation Midterm Exam. Name:... I.D.#:... 1. (30 pts) True or false (mark O for true ; X for false ). (Score=Max{0, Right- 1 2 Wrong}.) (1) X... If L 1 is regular and L 2 L

More information

Pushdown automata. Twan van Laarhoven. Institute for Computing and Information Sciences Intelligent Systems Radboud University Nijmegen

Pushdown automata. Twan van Laarhoven. Institute for Computing and Information Sciences Intelligent Systems Radboud University Nijmegen Pushdown automata Twan van Laarhoven Institute for Computing and Information Sciences Intelligent Systems Version: fall 2014 T. van Laarhoven Version: fall 2014 Formal Languages, Grammars and Automata

More information

Unit 6. Non Regular Languages The Pumping Lemma. Reading: Sipser, chapter 1

Unit 6. Non Regular Languages The Pumping Lemma. Reading: Sipser, chapter 1 Unit 6 Non Regular Languages The Pumping Lemma Reading: Sipser, chapter 1 1 Are all languages regular? No! Most of the languages are not regular! Why? A finite automaton has limited memory. How can we

More information

Lecture 1: Finite State Automaton

Lecture 1: Finite State Automaton Lecture 1: Finite State Automaton Instructor: Ketan Mulmuley Scriber: Yuan Li January 6, 2015 1 Deterministic Finite Automaton Informally, a deterministic finite automaton (DFA) has finite number of s-

More information

2. Elements of the Theory of Computation, Lewis and Papadimitrou,

2. Elements of the Theory of Computation, Lewis and Papadimitrou, Introduction Finite Automata DFA, regular languages Nondeterminism, NFA, subset construction Regular Epressions Synta, Semantics Relationship to regular languages Properties of regular languages Pumping

More information

Chapter 5. Finite Automata

Chapter 5. Finite Automata Chapter 5 Finite Automata 5.1 Finite State Automata Capable of recognizing numerous symbol patterns, the class of regular languages Suitable for pattern-recognition type applications, such as the lexical

More information

Sri vidya college of engineering and technology

Sri vidya college of engineering and technology Unit I FINITE AUTOMATA 1. Define hypothesis. The formal proof can be using deductive proof and inductive proof. The deductive proof consists of sequence of statements given with logical reasoning in order

More information

CS 455/555: Finite automata

CS 455/555: Finite automata CS 455/555: Finite automata Stefan D. Bruda Winter 2019 AUTOMATA (FINITE OR NOT) Generally any automaton Has a finite-state control Scans the input one symbol at a time Takes an action based on the currently

More information

Automata: a short introduction

Automata: a short introduction ILIAS, University of Luxembourg Discrete Mathematics II May 2012 What is a computer? Real computers are complicated; We abstract up to an essential model of computation; We begin with the simplest possible

More information

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET Regular Languages and FA A language is a set of strings over a finite alphabet Σ. All languages are finite or countably infinite. The set of all languages

More information

Constructions on Finite Automata

Constructions on Finite Automata Constructions on Finite Automata Informatics 2A: Lecture 4 Alex Simpson School of Informatics University of Edinburgh als@inf.ed.ac.uk 23rd September, 2014 1 / 29 1 Closure properties of regular languages

More information

CS 154. Finite Automata vs Regular Expressions, Non-Regular Languages

CS 154. Finite Automata vs Regular Expressions, Non-Regular Languages CS 154 Finite Automata vs Regular Expressions, Non-Regular Languages Deterministic Finite Automata Computation with finite memory Non-Deterministic Finite Automata Computation with finite memory and guessing

More information

Regular Expressions Kleene s Theorem Equation-based alternate construction. Regular Expressions. Deepak D Souza

Regular Expressions Kleene s Theorem Equation-based alternate construction. Regular Expressions. Deepak D Souza Regular Expressions Deepak D Souza Department of Computer Science and Automation Indian Institute of Science, Bangalore. 11 August 2011 Outline 1 Regular Expressions 2 Kleene s Theorem 3 Equation-based

More information

Lecture 17: Language Recognition

Lecture 17: Language Recognition Lecture 17: Language Recognition Finite State Automata Deterministic and Non-Deterministic Finite Automata Regular Expressions Push-Down Automata Turing Machines Modeling Computation When attempting to

More information

We define the multi-step transition function T : S Σ S as follows. 1. For any s S, T (s,λ) = s. 2. For any s S, x Σ and a Σ,

We define the multi-step transition function T : S Σ S as follows. 1. For any s S, T (s,λ) = s. 2. For any s S, x Σ and a Σ, Distinguishability Recall A deterministic finite automaton is a five-tuple M = (S,Σ,T,s 0,F) where S is a finite set of states, Σ is an alphabet the input alphabet, T : S Σ S is the transition function,

More information

Computer Sciences Department

Computer Sciences Department 1 Reference Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER 3 objectives Finite automaton Infinite automaton Formal definition State diagram Regular and Non-regular

More information

Deterministic Finite Automata. Non deterministic finite automata. Non-Deterministic Finite Automata (NFA) Non-Deterministic Finite Automata (NFA)

Deterministic Finite Automata. Non deterministic finite automata. Non-Deterministic Finite Automata (NFA) Non-Deterministic Finite Automata (NFA) Deterministic Finite Automata Non deterministic finite automata Automata we ve been dealing with have been deterministic For every state and every alphabet symbol there is exactly one move that the machine

More information

Java II Finite Automata I

Java II Finite Automata I Java II Finite Automata I Bernd Kiefer Bernd.Kiefer@dfki.de Deutsches Forschungszentrum für künstliche Intelligenz November, 23 Processing Regular Expressions We already learned about Java s regular expression

More information

Fall 1999 Formal Language Theory Dr. R. Boyer. 1. There are other methods of nding a regular expression equivalent to a nite automaton in

Fall 1999 Formal Language Theory Dr. R. Boyer. 1. There are other methods of nding a regular expression equivalent to a nite automaton in Fall 1999 Formal Language Theory Dr. R. Boyer Week Four: Regular Languages; Pumping Lemma 1. There are other methods of nding a regular expression equivalent to a nite automaton in addition to the ones

More information

Computational Models - Lecture 3 1

Computational Models - Lecture 3 1 Computational Models - Lecture 3 1 Handout Mode Iftach Haitner. Tel Aviv University. November 14, 2016 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice Herlihy, Brown University.

More information

Computational Theory

Computational Theory Computational Theory Finite Automata and Regular Languages Curtis Larsen Dixie State University Computing and Design Fall 2018 Adapted from notes by Russ Ross Adapted from notes by Harry Lewis Curtis Larsen

More information

TAFL 1 (ECS-403) Unit- II. 2.1 Regular Expression: The Operators of Regular Expressions: Building Regular Expressions

TAFL 1 (ECS-403) Unit- II. 2.1 Regular Expression: The Operators of Regular Expressions: Building Regular Expressions TAFL 1 (ECS-403) Unit- II 2.1 Regular Expression: 2.1.1 The Operators of Regular Expressions: 2.1.2 Building Regular Expressions 2.1.3 Precedence of Regular-Expression Operators 2.1.4 Algebraic laws for

More information

Nondeterministic Finite Automata

Nondeterministic Finite Automata Nondeterministic Finite Automata Not A DFA Does not have exactly one transition from every state on every symbol: Two transitions from q 0 on a No transition from q 1 (on either a or b) Though not a DFA,

More information

Chapter 6. Properties of Regular Languages

Chapter 6. Properties of Regular Languages Chapter 6 Properties of Regular Languages Regular Sets and Languages Claim(1). The family of languages accepted by FSAs consists of precisely the regular sets over a given alphabet. Every regular set is

More information

Inf2A: Converting from NFAs to DFAs and Closure Properties

Inf2A: Converting from NFAs to DFAs and Closure Properties 1/43 Inf2A: Converting from NFAs to DFAs and Stuart Anderson School of Informatics University of Edinburgh October 13, 2009 Starter Questions 2/43 1 Can you devise a way of testing for any FSM M whether

More information

Lecture 3: Nondeterministic Finite Automata

Lecture 3: Nondeterministic Finite Automata Lecture 3: Nondeterministic Finite Automata September 5, 206 CS 00 Theory of Computation As a recap of last lecture, recall that a deterministic finite automaton (DFA) consists of (Q, Σ, δ, q 0, F ) where

More information

CS 275 Automata and Formal Language Theory

CS 275 Automata and Formal Language Theory CS 275 Automata and Formal Language Theory Course Notes Part II: The Recognition Problem (II) Chapter II.4.: Properties of Regular Languages (13) Anton Setzer (Based on a book draft by J. V. Tucker and

More information

Nondeterministic Finite Automata

Nondeterministic Finite Automata Nondeterministic Finite Automata COMP2600 Formal Methods for Software Engineering Katya Lebedeva Australian National University Semester 2, 206 Slides by Katya Lebedeva. COMP 2600 Nondeterministic Finite

More information

Notes on State Minimization

Notes on State Minimization U.C. Berkeley CS172: Automata, Computability and Complexity Handout 1 Professor Luca Trevisan 2/3/2015 Notes on State Minimization These notes present a technique to prove a lower bound on the number of

More information

COMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lec. 5 : DFA minimization

COMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lec. 5 : DFA minimization COMP-33 Theory of Computation Fall 27 -- Prof. Claude Crépeau Lec. 5 : DFA minimization COMP 33 Fall 27: Lectures Schedule 4. Context-free languages 5. Pushdown automata 6. Parsing 7. The pumping lemma

More information

Regular Expressions Kleene s Theorem Equation-based alternate construction. Regular Expressions. Deepak D Souza

Regular Expressions Kleene s Theorem Equation-based alternate construction. Regular Expressions. Deepak D Souza Regular Expressions Deepak D Souza Department of Computer Science and Automation Indian Institute of Science, Bangalore. 16 August 2012 Outline 1 Regular Expressions 2 Kleene s Theorem 3 Equation-based

More information

GEETANJALI INSTITUTE OF TECHNICAL STUDIES, UDAIPUR I

GEETANJALI INSTITUTE OF TECHNICAL STUDIES, UDAIPUR I GEETANJALI INSTITUTE OF TECHNICAL STUDIES, UDAIPUR I Internal Examination 2017-18 B.Tech III Year VI Semester Sub: Theory of Computation (6CS3A) Time: 1 Hour 30 min. Max Marks: 40 Note: Attempt all three

More information

Great Theoretical Ideas in Computer Science. Lecture 4: Deterministic Finite Automaton (DFA), Part 2

Great Theoretical Ideas in Computer Science. Lecture 4: Deterministic Finite Automaton (DFA), Part 2 5-25 Great Theoretical Ideas in Computer Science Lecture 4: Deterministic Finite Automaton (DFA), Part 2 January 26th, 27 Formal definition: DFA A deterministic finite automaton (DFA) M =(Q,,,q,F) M is

More information

TDDD65 Introduction to the Theory of Computation

TDDD65 Introduction to the Theory of Computation TDDD65 Introduction to the Theory of Computation Lecture 2 Gustav Nordh, IDA gustav.nordh@liu.se 2012-08-31 Outline - Lecture 2 Closure properties of regular languages Regular expressions Equivalence of

More information

Theory of Computation 4 Non-Deterministic Finite Automata

Theory of Computation 4 Non-Deterministic Finite Automata Theory of Computation 4 Non-Deterministic Finite Automata Frank Stephan Department of Computer Science Department of Mathematics National University of Singapore fstephan@comp.nus.edu.sg Theory of Computation

More information

Inf2A: The Pumping Lemma

Inf2A: The Pumping Lemma Inf2A: Stuart Anderson School of Informatics University of Edinburgh October 8, 2009 Outline 1 Deterministic Finite State Machines and Regular Languages 2 3 4 The language of a DFA ( M = Q, Σ, q 0, F,

More information

Uses of finite automata

Uses of finite automata Chapter 2 :Finite Automata 2.1 Finite Automata Automata are computational devices to solve language recognition problems. Language recognition problem is to determine whether a word belongs to a language.

More information

Closure under the Regular Operations

Closure under the Regular Operations September 7, 2013 Application of NFA Now we use the NFA to show that collection of regular languages is closed under regular operations union, concatenation, and star Earlier we have shown this closure

More information

CS 530: Theory of Computation Based on Sipser (second edition): Notes on regular languages(version 1.1)

CS 530: Theory of Computation Based on Sipser (second edition): Notes on regular languages(version 1.1) CS 530: Theory of Computation Based on Sipser (second edition): Notes on regular languages(version 1.1) Definition 1 (Alphabet) A alphabet is a finite set of objects called symbols. Definition 2 (String)

More information

Theory of Computation p.1/?? Theory of Computation p.2/?? Unknown: Implicitly a Boolean variable: true if a word is

Theory of Computation p.1/?? Theory of Computation p.2/?? Unknown: Implicitly a Boolean variable: true if a word is Abstraction of Problems Data: abstracted as a word in a given alphabet. Σ: alphabet, a finite, non-empty set of symbols. Σ : all the words of finite length built up using Σ: Conditions: abstracted as a

More information

Regular Language Equivalence and DFA Minimization. Equivalence of Two Regular Languages DFA Minimization

Regular Language Equivalence and DFA Minimization. Equivalence of Two Regular Languages DFA Minimization Regular Language Equivalence and DFA Minimization Equivalence of Two Regular Languages DFA Minimization Decision Property: Equivalence Given regular languages L and M, is L = M? Algorithm involves constructing

More information

Theory of Computation 3 Deterministic Finite Automata

Theory of Computation 3 Deterministic Finite Automata Theory of Computation 3 Deterministic Finite Automata Frank Stephan Department of Computer Science Department of Mathematics National University of Singapore fstephan@comp.nus.edu.sg Theory of Computation

More information

Extended transition function of a DFA

Extended transition function of a DFA Extended transition function of a DFA The next two pages describe the extended transition function of a DFA in a more detailed way than Handout 3.. p./43 Formal approach to accepted strings We define the

More information

Finite-State Machines (Automata) lecture 12

Finite-State Machines (Automata) lecture 12 Finite-State Machines (Automata) lecture 12 cl a simple form of computation used widely one way to find patterns 1 A current D B A B C D B C D A C next 2 Application Fields Industry real-time control,

More information

Constructive Formalization of Regular Languages

Constructive Formalization of Regular Languages Constructive Formalization of Regular Languages Jan-Oliver Kaiser Advisors: Christian Doczkal, Gert Smolka Supervisor: Gert Smolka UdS November 7, 2012 Jan-Oliver Kaiser (UdS) Constr. Formalization of

More information

Finite-state Machines: Theory and Applications

Finite-state Machines: Theory and Applications Finite-state Machines: Theory and Applications Unweighted Finite-state Automata Thomas Hanneforth Institut für Linguistik Universität Potsdam December 10, 2008 Thomas Hanneforth (Universität Potsdam) Finite-state

More information

Formal Models in NLP

Formal Models in NLP Formal Models in NLP Finite-State Automata Nina Seemann Universität Stuttgart Institut für Maschinelle Sprachverarbeitung Pfaffenwaldring 5b 70569 Stuttgart May 15, 2012 Nina Seemann (IMS) Formal Models

More information

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018 Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018 Lecture 14 Ana Bove May 14th 2018 Recap: Context-free Grammars Simplification of grammars: Elimination of ǫ-productions; Elimination of

More information

Regular Expression Unit 1 chapter 3. Unit 1: Chapter 3

Regular Expression Unit 1 chapter 3. Unit 1: Chapter 3 Unit 1: Chapter 3 (Regular Expression (RE) and Language) In previous lectures, we have described the languages in terms of machine like description-finite automata (DFA or NFA). Now we switch our attention

More information

Automata extended to nominal sets

Automata extended to nominal sets Bachelor thesis Computer Science Radboud University Automata extended to nominal sets Author: Joep Veldhoven s4456556 First supervisor/assessor: Jurriaan Rot jrot@cs.ru.nl Second and third supervisor:

More information

Deterministic Finite Automata (DFAs)

Deterministic Finite Automata (DFAs) CS/ECE 374: Algorithms & Models of Computation, Fall 28 Deterministic Finite Automata (DFAs) Lecture 3 September 4, 28 Chandra Chekuri (UIUC) CS/ECE 374 Fall 28 / 33 Part I DFA Introduction Chandra Chekuri

More information

Homomorphisms and Efficient State Minimization

Homomorphisms and Efficient State Minimization Homomorphisms and Efficient State Minimization Mridul Aanjaneya Stanford University July 10, 2012 Mridul Aanjaneya Automata Theory 1/ 23 Homomorphisms A homomorphism on an alphabet is a function that gives

More information

This lecture covers Chapter 7 of HMU: Properties of CFLs

This lecture covers Chapter 7 of HMU: Properties of CFLs This lecture covers Chapter 7 of HMU: Properties of CFLs Chomsky Normal Form Pumping Lemma for CFs Closure Properties of CFLs Decision Properties of CFLs Additional Reading: Chapter 7 of HMU. Chomsky Normal

More information

1 More finite deterministic automata

1 More finite deterministic automata CS 125 Section #6 Finite automata October 18, 2016 1 More finite deterministic automata Exercise. Consider the following game with two players: Repeatedly flip a coin. On heads, player 1 gets a point.

More information

Automata Theory. Lecture on Discussion Course of CS120. Runzhe SJTU ACM CLASS

Automata Theory. Lecture on Discussion Course of CS120. Runzhe SJTU ACM CLASS Automata Theory Lecture on Discussion Course of CS2 This Lecture is about Mathematical Models of Computation. Why Should I Care? - Ways of thinking. - Theory can drive practice. - Don t be an Instrumentalist.

More information

CSE 135: Introduction to Theory of Computation Optimal DFA

CSE 135: Introduction to Theory of Computation Optimal DFA CSE 35: Introduction to Theory of Computation Optimal DFA Sungjin Im University of California, Merced 2-9-25 Optimal Algorithms for Regular Languages Myhill-Nerode Theorem There is a unique optimal algorithm

More information

Deterministic Finite Automata (DFAs)

Deterministic Finite Automata (DFAs) Algorithms & Models of Computation CS/ECE 374, Fall 27 Deterministic Finite Automata (DFAs) Lecture 3 Tuesday, September 5, 27 Sariel Har-Peled (UIUC) CS374 Fall 27 / 36 Part I DFA Introduction Sariel

More information

Theory of Computation

Theory of Computation Theory of Computation COMP363/COMP6363 Prerequisites: COMP4 and COMP 6 (Foundations of Computing) Textbook: Introduction to Automata Theory, Languages and Computation John E. Hopcroft, Rajeev Motwani,

More information

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY 5-453 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY NON-DETERMINISM and REGULAR OPERATIONS THURSDAY JAN 6 UNION THEOREM The union of two regular languages is also a regular language Regular Languages Are

More information

Lecture 4: More on Regexps, Non-Regular Languages

Lecture 4: More on Regexps, Non-Regular Languages 6.045 Lecture 4: More on Regexps, Non-Regular Languages 6.045 Announcements: - Pset 1 is on piazza (as of last night) - If you don t have piazza access but are registered for 6.045, send email to TAs with

More information

Finite Universes. L is a fixed-length language if it has length n for some

Finite Universes. L is a fixed-length language if it has length n for some Finite Universes Finite Universes When the universe is finite (e.g., the interval 0, 2 1 ), all objects can be encoded by words of the same length. A language L has length n 0 if L =, or every word of

More information

NOTES ON AUTOMATA. Date: April 29,

NOTES ON AUTOMATA. Date: April 29, NOTES ON AUTOMATA 1. Monoids acting on sets We say that a monoid S with identity element ɛ acts on a set Q if q(st) = (qs)t and qɛ = q. As with groups, if we set s = t whenever qs = qt for all q Q, then

More information

Theory of computation: initial remarks (Chapter 11)

Theory of computation: initial remarks (Chapter 11) Theory of computation: initial remarks (Chapter 11) For many purposes, computation is elegantly modeled with simple mathematical objects: Turing machines, finite automata, pushdown automata, and such.

More information

CSE 135: Introduction to Theory of Computation Nondeterministic Finite Automata (cont )

CSE 135: Introduction to Theory of Computation Nondeterministic Finite Automata (cont ) CSE 135: Introduction to Theory of Computation Nondeterministic Finite Automata (cont ) Sungjin Im University of California, Merced 2-3-214 Example II A ɛ B ɛ D F C E Example II A ɛ B ɛ D F C E NFA accepting

More information

Classes and conversions

Classes and conversions Classes and conversions Regular expressions Syntax: r = ε a r r r + r r Semantics: The language L r of a regular expression r is inductively defined as follows: L =, L ε = {ε}, L a = a L r r = L r L r

More information

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION CSE 105 THEORY OF COMPUTATION "Winter" 2018 http://cseweb.ucsd.edu/classes/wi18/cse105-ab/ Today's learning goals Sipser Section 1.1 Design an automaton that recognizes a given language. Specify each of

More information

NFA and regex. the Boolean algebra of languages. regular expressions. Informatics 1 School of Informatics, University of Edinburgh

NFA and regex. the Boolean algebra of languages. regular expressions. Informatics 1 School of Informatics, University of Edinburgh NFA and regex cl the Boolean algebra of languages regular expressions Informatics The intersection of two regular languages is regular L = even numbers L = odd numbers L = mod L = mod Informatics The intersection

More information

CMPSCI 250: Introduction to Computation. Lecture #22: From λ-nfa s to NFA s to DFA s David Mix Barrington 22 April 2013

CMPSCI 250: Introduction to Computation. Lecture #22: From λ-nfa s to NFA s to DFA s David Mix Barrington 22 April 2013 CMPSCI 250: Introduction to Computation Lecture #22: From λ-nfa s to NFA s to DFA s David Mix Barrington 22 April 2013 λ-nfa s to NFA s to DFA s Reviewing the Three Models and Kleene s Theorem The Subset

More information

Introduction to Formal Languages, Automata and Computability p.1/51

Introduction to Formal Languages, Automata and Computability p.1/51 Introduction to Formal Languages, Automata and Computability Finite State Automata K. Krithivasan and R. Rama Introduction to Formal Languages, Automata and Computability p.1/51 Introduction As another

More information