Regular expressions. Regular expressions. Regular expressions. Regular expressions. Remark (FAs with initial set recognize the regular languages)

Size: px
Start display at page:

Download "Regular expressions. Regular expressions. Regular expressions. Regular expressions. Remark (FAs with initial set recognize the regular languages)"

Transcription

1 Definition (Finite automata with set of initial states) A finite automata with set of initial states, or FA with initial set for short, is a 5-tupel (Q, Σ, δ, S, F ) where Q, Σ, δ, and F are defined as for an FA, and S Q is the set of initial states. An FA A = (Q, Σ, δ, S, F ) with set of initial states accepts a word w if there is some state s S such that the FA (Q, Σ, δ, s, F ) accepts w; the language recognized by A is L(A) = L( (Q, Σ, δ, s, F ) ). }{{} s S this is an FA Intuitively speaking, an FA with set of initial states S accepts an input w if and only if there is some starting state s S from which some accepting state can be reached on processing w. Remark (FAs with initial set recognize the regular languages) The class of languages recognized by FAs with set of initial state coincides with the regular languages. For every FA (Q, Σ, δ, s, F ), the FA with initial set (Q, Σ, δ, {s}, F ) accepts the same language, hence every regular language is recognized by an FA with set of initial states. Conversely, by definition the language recognized by an FA with initial set is a finite union of regular languages, hence is regular. The transition function of an FA (Q, Σ, δ, s, F ) can be extended to set arguments H Q by letting δ(h, w) = q H δ(q, w). Then an FA with initial set (Q, Σ, δ, S, F ) accepts a word w if for the corresponding function δ the set δ(s, w) intersects F. It can be shown that equivalently δ can be extended inductively by δ(h, λ) = H and δ(h, ua) = δ(q, a). q δ(h,u) Definition (Finite automata with ε transitions) A finite automata with ε-transitions, or ε-fa for short, is a 5-tupel E = (Q, Σ, δ, s, F ) where Q, Σ, s, and F are defined as for an FA, and δ : Q (Σ {ε}) 2 Q is a transition relation with ε-transitions. Given an ε-fa E as above, the ε-closure of a state q Q, or ε closure(q) for short, satisfies (i) q is a member of the ε-closure of q, (i) for each state q in the ε-closure of q, the set δ(q, ε) is contained in the ε-closure of q. Formally, the ε-closure of q is defined as the least subset X of Q that satisfies (i) and (ii) with ε-closure of q replaced by set X. The ε-closure of q contains exactly the states that are reachable from q in the directed graph on Q given by all ε-transitions. Definition (Extended transition function of an ε-fa) The transition relation δ of an ε-fa E = (Q, Σ, δ, s, F ) extends canonically to an (extended) transition relation δ : Q Σ 2 Q. The values δ(q, w) are defined by induction over the length of w simultaneously for all states q as follows. Basis w = λ: For all q Q let δ(q, λ) = ε closure(q). Induction step w = ua for some a Σ: For all q Q let δ(q, ua) = ε closure(q ). q δ(q,u) q δ(q,a) Intuitively, δ(q, w) is the set of states that can be reached from q after having processed w where a finite number of ε-transitions can be made initially and after reading each symbol of w. Note that in general it holds that δ(q, a) δ(q, a).

2 Definition (Language recognized by an ε-fa) The language recognized by an ε-fa E = (Q, Σ, δ, s, F ) is L(E) = {w Σ : δ(s, w) F }. Theorem (ε-fas recognize exactly the regular languages) The class of languages recognized by ε-fas coincides with the regular languages. Proof. Any FA can be transformed into an ε-fa recognizing the same language by simply letting δ(q, ε) = for all states q, hence any regular language is recognized by some ε-fa. Proof, cont.: It remains to show that the language recognized by a given ε-fa E(Q, Σ, δ E, s E, F ) is regular. We show this by constructing an FA with set of initial states N = (Q, Σ, δ N, S N, F ) such that L(E) = L(A) where we let S N = ε closure(s E ), δ N (q, a) = ε closure(q ) for all q Q, a Σ. q δ E (q,a) Intuitively speaking, the FA N can simulate E where ε-transitions that E may perform before reading the first symbol of its input are taken care of by changing s E into the set S N, ε-transitions that E may perform after reading a symbol a are taken care of by adding all states to δ N (q, a) that E can reach from q by first processing a, followed by finitely many ε-transitions. Proof, cont.: We show that for all words w over Σ it holds that δ E (s E, w) = δ N (S N, w). By definition, a word w is accepted by E if the set on the left-hand side of ( ) contains an accepting state of E. Similarly, a word w is accepted by N if the set on the right-hand side of ( ) contains an accepting state of E. Now E and N have the same set F of accepting states, hence it is immediate from ( ) that E and N recognize the same language. ( ) Proof, cont.: We show that for all words w over Σ it holds that δ E (s E, w) = δ N (S N, w) Basis w = λ: By definition, the sets δ E (s E, λ) and δ N (S N, λ) are both equal to the ε-closure of s E. Induction step w = ua for some a Σ: δ E (s E, ua) = q δ E (s E,u) = q S N q δ N (q,u) q δ E (q,a) ( ) ε closure(q ) }{{} =δ N (q,a) }{{} = δ N (q,ua) δ N (q, a) = δ N (S N, ua), where the second equation holds because the two sets δ E (s E, u) and δ N (s N, u) coincide by the induction hypothesis.

3 Definition (Concatenation and Kleene closure) The concatenation of two languages L 1 and L 2 is the language L 1 L 2 = {w 1 w 2 : w 1 L 1 and w 2 L 2 }. The Kleene closure of a language L is the language L = {w 1 w m : m N and w i L for i = 1,..., m}. Note that λ L for all L. The operation is called Kleene star. Theorem (Closure under concatenation and Kleene closure) The class of regular languages is closed under concatenation and Kleene closure, i.e., (i) If languages L 1 and L 2 are regular, then L 1 L 2 is also regular. (ii) If a language L is regular, then its Kleene closure L is also regular. Proof:(i) Let regular languages L 1 and L 2 be given, as well as FAs A 1 = (Q 1, Σ 1, δ 1, s 1, F 1 ) and A 2 = (Q 2, Σ 2, δ 2, s 2, F 2 ) such that L 1 = L(A 1 ) and L 2 = L(A 2 ). It suffices to construct an FA E with ε-transitions that recognizes the language L 1 L 2. Let E = (Q 1 Q 2, Σ 1 Σ 2, δ, s 1, F 2 ), where we can assume that Q 1 and Q 2 are disjoint. Moreover, we let δ 1 (q, a) in case q Q 1 and a Σ 1, δ 2 (q, a) in case q Q 2 and a Σ 2, δ(q, a) = {s 2 } in case q F 1 and a = ε, otherwise. By construction, the ε-fa E recognizes the language L 1 L 2, the straightforward verification of this fact is left to the reader. Proof, cont.:(ii) Let L = L(N) for some FA N = (Q, Σ, δ N, s N, F ). For some new state s E / Q, we construct an FA with ε-transitions, E = (Q {s E }, Σ, δ, s E, F {s E }), that recognizes the language L. We let δ N (s N, a) in case q = s E and a Σ, [λ L(E)] δ N (q, a) in case q Q and a Σ, [simulation of N] δ(q, a) = {s N } in case q F N and a = ε, [iteration] otherwise. [no other ε-trans.] The new initial state s E is accepting, hence enforces λ L(E). After the first transition, the ε-fa E works like N but has additional ε-transitions from the accepting states of N to the initial state of N, hence E allows to iterate accepting computations of N. By construction, the ε-fa E recognizes the language L. Proof, cont.: We show L L(E). The empty word λ is in L(E). All other words w L can be written in the form w = w 1 w m where m > 0, w i L, w i λ. We show by induction over m that all such w are accepted by E. Basis m = 1: Since w 1 L = L(N) is nonempty, by construction the ε-fa E and the FA N can reach exactly the same symbols on reading the first symbol of w 1, and from there on E can simulate all computations of N on input w including the accepting ones. Induction step m > 0: By the induction hypothesis, the nonempty word w = w 1 w m 1 is accepted by E. So there is an accepting computation of E on input w that - first reaches an accepting state q after having read w 1 w m 1, - then performs an ε-transition from q to s E, - finally simulates an accepting run of N on input w m.

4 Proof, cont.: We show L(E) L. Fix some nonempty w L(E). The word w is accepted by E, i.e., there are states q 0,..., q t Q E and symbols b 1,..., b t Σ {ε} such that q 0 = s E, q t F, and δ(q j 1, b j ) = q j for j = 1,..., t. If we let w 1,..., w m be the maximal subwords of b 1 b t over Σ in the natural order, we obtain w = w 1 w m where m > 0 and b 1 b t = ε k 0 w 1 ε k 1 w 2 ε k2 ε k m 2 w m 1 ε k m 1 w m ε km. By construction of E, for all j such that b j = ε we have q j 1 F and q j = s E, hence the processing of each word w i corresponds to a contiguous subsequence of q 0,..., q t that starts in state s E and ends in an accepting state, i.e., all w i are in L and w is in L. Remark (Closure properties of the regular languages) The class of regular languages over some fixed alphabet Σ contains the languages of the form, {λ}, {a} for a Σ, and is closed under union, concatenation and Kleene star. Definition () With an alphabet Σ understood, the set of regular expressions over Σ is denoted by RA and is inductively defined as follows. (i) and λ are regular expressions, (ii) a is a regular expression for all a Σ, (iii) if α and β are regular expressions, then α + β, αβ, and α are regular expressions. Definition (Semantics of regular expressions) With an alphabet Σ understood, the language L(α) denoted by an regular expression α is inductively defined as follows. (i) L( ) = and L(λ ) = {λ}, (ii) L(a ) = {a} for all a Σ, (iii) L(α + β) = L(α) L(β), L(α ) = (L(α)). L(αβ) = L(α)L(β), Theorem ( and regular languages) For any given alphabet Σ, a language L over Σ is regular if and only if there is a regular expression α over Σ such that L = L(α). Proof. Fix some alphabet Σ. First we show by induction over the inductive definition of regular expressions, that the language L(α) is regular for all regular expressions α over Σ. Basis: Induction step. The languages L( ), L(λ ), and L(a ) = {a} are regular. If γ = α + β, then L(γ) = L(α) L(β) is regular. If γ = αβ, then L(γ) = L(α)L(β) is regular. If γ = α, then L(γ) = (L(α)) is regular. The three assertions hold by closure of the class of regular languages under union, concatenation, and Kleene star, and because by the induction hypothesis we can assume that the languages L(α) and L(β) are regular.

5 Proof, cont.: Next we show that every regular L is equal to L(α) for some regular expression α. Given a regular language L, choose some DEA D that recognizes L such that D = (Q, Σ, δ, s, F ) where Q = {q 1,..., q k }, q i q j for i j. For all i, j {1,..., k} and l {0,..., k} let P i,j,l = {u Σ : u = u 1 u n for some n N and u 1,..., u n Σ, and there are indices r 2,..., r n 1 l such that δ(q i, u 1 u t ) = q rt δ(q rn 1, u n ) = q j }, for t = 1,..., n 1 and Proof, cont.: We show simultaneously for all i and j by induction over l, that for every triple i, j, l there is a regular expression α i,j,l such that P i,j,l = L(α i,j,l ). For i 0 such that s = q i0, we then have L = {j : q j F } P i 0,j,k = {j : q j F } L(α i 0,j,k) = L(+ {j : qj F }α i0,j,k). Basis l = 0: There cannot be intermediate states, hence we have { {a Σ: δ(q i, a) = q j } in case i j, P i,j,0 = {λ} {a Σ: δ(q i, a) = q i } in case i = j, i.e., the finite set P i,j,0 can be described by a regular expression. Induction step l > 0: We have that is, the set P i,j,l contains the words u such that δ(q i, u) = q j and, except possibly for the first state q i and the last state q j, all states occurring while processing u are in the set {q 1,..., q l }. P i,j,l = P i,j,l 1 P i,l,l 1 P l,l,l 1 P l,j,l 1, and accordingly we let α i,j,l = α i,j,l 1 + α i,l,l 1 α l,l,l 1 α l,j,l 1. Definition (Mirror word and mirror language) Given a word w = a 1, a n where the a i are symbols from some alphabet, the mirror word of w is w R = a n a 1. For a language L, the mirror language of L is L R = {w R : w L}. A word w is a palindrome if w = w R. Theorem (Closure under mirror languages) The class of regular languages is closed under mirror languages, that is, if L is regular, then its mirror language L R is also regular. Proof. Variant 1: Given a DEA D = (Q, Σ, δ, s, F ), the FA with set of initial states N = (Q, Σ, δ N, F, {s}) recognizes L R if we let δ N (q, a) = {q Q : δ(q, a) = q}. Intuitively speaking, the FA N simulates reversed computations of D. Proof, cont.: Variant 2: Show by induction over the definition of regular expressions, that for every regular expression α there is a regular expression α R such that (L(α)) R = L(α R ). Basis: The assertion holds for α equal to, to λ, or to a for some symbol a because in these cases we have (L(α)) R = L(α). Induction step. The mirror language of L(α + β) is L(α R + β R ), The mirror language of L(αβ) is L(β R α R ), The mirror language of L(α ) is L((α R ) ).

6 Definition (Homomorphisms) Let Σ 1 and Σ 2 be alphabets. A mapping h : Σ 1 Σ 2 is a homomorphism if for all words u and v over Σ 1 it holds that h(uv) = h(u)h(v). ( ) Proposition (Homomorphisms as mappings on Σ) For every homomorphism h : Σ Σ holds for all a 1,..., a n Σ 1 h(a 1 a n ) = h(a 1 ) h(a n ), ( ) which in case n = 0 reads as h(λ) = λ. Conversely, every mapping h : Σ 1 Σ 2 defines via ( ) a homomorphism h : Σ 1 Σ 2. Proof: Equation ( ) follows from ( ) by an easy inductive argument. Obviously ( ) implies that h is an homomorphism. Definition (Images of languages) Let h : Σ 1 Σ 2 be a mapping. For languages L 1 over Σ 1 and L 2 over Σ 2 let h[l 1 ] = {h(w): w L 1 } and h 1 [L 2 ] = {w Σ 1 : h(w) L 2 } be the images of L 1 under h and of L 2 under the inverse of h. Remark As usual, for a mapping h that is 1-to-1, we have L = h 1 [h[l]] for all languages L, whereas this fails in general. For example, if we let h(a) = b 0 for all a Σ 1 and some fixed b 0 Σ 2, then the language h 1 [h[l]] contains exactly the words w over Σ 1 such that there is some word of the same length in L. Theorem (Closure under homomorphisms) The class of regular languages is closed under homomorphisms, that is, for all regular languages L and all homomorphisms h, the language h[l] is again regular. Proof. Let h : Σ 1 Σ 2 be any homomorphism. We show by induction over the definition of regular expressions, that for every regular expression α there is a regular expression α h such that h[l(α)] = L(α h ). Basis: The image of a finite language under h is again finite, hence the assertion holds for α equal to, λ, or a for some a Σ 1. Induction step: The image of L(α + β) under h is equal to L(α h + β h ). The image of L(αβ) under h is equal to L(α h β h ). The image of L(α ) under h is equal to L(αh ). Theorem (Closure under inverse homomorphisms) The class of regular languages is closed under inverse homomorphisms, that is, for all regular languages L and all homomorphisms h, the language h 1 [L] is again regular. Proof. Let h : Σ 1 Σ 2 be a homomorphism. Let L be a language over Σ 2 that is recognized by some DFA D = (Q, Σ 2, δ D, s, F )). Consider the DFA A = (Q, Σ 1, δ, s, F ) where we let for all q Q and a Σ 1 δ(q, a) = δ D (q, h(a)). We leave it to the reader to show by induction on the word length, that for every word w over Σ 1 we have δ(s, w) = δ D (s, h(w)), and that hence A accepts w if and only if h(w) is in L.

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

Properties of Context-Free Languages. Closure Properties Decision Properties

Properties of Context-Free Languages. Closure Properties Decision Properties Properties of Context-Free Languages Closure Properties Decision Properties 1 Closure Properties of CFL s CFL s are closed under union, concatenation, and Kleene closure. Also, under reversal, homomorphisms

More information

CS 455/555: Mathematical preliminaries

CS 455/555: Mathematical preliminaries CS 455/555: Mathematical preliminaries Stefan D. Bruda Winter 2019 SETS AND RELATIONS Sets: Operations: intersection, union, difference, Cartesian product Big, powerset (2 A ) Partition (π 2 A, π, i j

More information

COM364 Automata Theory Lecture Note 2 - Nondeterminism

COM364 Automata Theory Lecture Note 2 - Nondeterminism COM364 Automata Theory Lecture Note 2 - Nondeterminism Kurtuluş Küllü March 2018 The FA we saw until now were deterministic FA (DFA) in the sense that for each state and input symbol there was exactly

More information

The Pumping Lemma and Closure Properties

The Pumping Lemma and Closure Properties The Pumping Lemma and Closure Properties Mridul Aanjaneya Stanford University July 5, 2012 Mridul Aanjaneya Automata Theory 1/ 27 Tentative Schedule HW #1: Out (07/03), Due (07/11) HW #2: Out (07/10),

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

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

UNIT-II. NONDETERMINISTIC FINITE AUTOMATA WITH ε TRANSITIONS: SIGNIFICANCE. Use of ε-transitions. s t a r t. ε r. e g u l a r

UNIT-II. NONDETERMINISTIC FINITE AUTOMATA WITH ε TRANSITIONS: SIGNIFICANCE. Use of ε-transitions. s t a r t. ε r. e g u l a r Syllabus R9 Regulation UNIT-II NONDETERMINISTIC FINITE AUTOMATA WITH ε TRANSITIONS: In the automata theory, a nondeterministic finite automaton (NFA) or nondeterministic finite state machine is a finite

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

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

Ogden s Lemma for CFLs

Ogden s Lemma for CFLs Ogden s Lemma for CFLs Theorem If L is a context-free language, then there exists an integer l such that for any u L with at least l positions marked, u can be written as u = vwxyz such that 1 x and at

More information

Equivalence of DFAs and NFAs

Equivalence of DFAs and NFAs CS 172: Computability and Complexity Equivalence of DFAs and NFAs It s a tie! DFA NFA Sanjit A. Seshia EECS, UC Berkeley Acknowledgments: L.von Ahn, L. Blum, M. Blum What we ll do today Prove that DFAs

More information

CS243, Logic and Computation Nondeterministic finite automata

CS243, Logic and Computation Nondeterministic finite automata CS243, Prof. Alvarez NONDETERMINISTIC FINITE AUTOMATA (NFA) Prof. Sergio A. Alvarez http://www.cs.bc.edu/ alvarez/ Maloney Hall, room 569 alvarez@cs.bc.edu Computer Science Department voice: (67) 552-4333

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

Finite Automata and Regular Languages (part III)

Finite Automata and Regular Languages (part III) Finite Automata and Regular Languages (part III) Prof. Dan A. Simovici UMB 1 / 1 Outline 2 / 1 Nondeterministic finite automata can be further generalized by allowing transitions between states without

More information

NPDA, CFG equivalence

NPDA, CFG equivalence NPDA, CFG equivalence Theorem A language L is recognized by a NPDA iff L is described by a CFG. Must prove two directions: ( ) L is recognized by a NPDA implies L is described by a CFG. ( ) L is described

More information

Regular expressions and Kleene s theorem

Regular expressions and Kleene s theorem and Informatics 2A: Lecture 5 Alex Simpson School of Informatics University of Edinburgh als@inf.ed.ac.uk 25 September, 2014 1 / 26 1 More closure properties of regular languages Operations on languages

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

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

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

Non-deterministic Finite Automata (NFAs)

Non-deterministic Finite Automata (NFAs) Algorithms & Models of Computation CS/ECE 374, Fall 27 Non-deterministic Finite Automata (NFAs) Part I NFA Introduction Lecture 4 Thursday, September 7, 27 Sariel Har-Peled (UIUC) CS374 Fall 27 / 39 Sariel

More information

CSE 105 Theory of Computation Professor Jeanne Ferrante

CSE 105 Theory of Computation  Professor Jeanne Ferrante CSE 105 Theory of Computation http://www.jflap.org/jflaptmp/ Professor Jeanne Ferrante 1 Today s agenda NFA Review and Design NFA s Equivalence to DFA s Another Closure Property proof for Regular Languages

More information

Languages. Non deterministic finite automata with ε transitions. First there was the DFA. Finite Automata. Non-Deterministic Finite Automata (NFA)

Languages. Non deterministic finite automata with ε transitions. First there was the DFA. Finite Automata. Non-Deterministic Finite Automata (NFA) Languages Non deterministic finite automata with ε transitions Recall What is a language? What is a class of languages? Finite Automata Consists of A set of states (Q) A start state (q o ) A set of accepting

More information

Fooling Sets and. Lecture 5

Fooling Sets and. Lecture 5 Fooling Sets and Introduction to Nondeterministic Finite Automata Lecture 5 Proving that a language is not regular Given a language, we saw how to prove it is regular (union, intersection, concatenation,

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

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

Regular Expressions. Definitions Equivalence to Finite Automata

Regular Expressions. Definitions Equivalence to Finite Automata Regular Expressions Definitions Equivalence to Finite Automata 1 RE s: Introduction Regular expressions are an algebraic way to describe languages. They describe exactly the regular languages. If E is

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

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

Lecture 7 Properties of regular languages

Lecture 7 Properties of regular languages Lecture 7 Properties of regular languages COT 4420 Theory of Computation Section 4.1 Closure properties of regular languages If L 1 and L 2 are regular languages, then we prove that: Union: L 1 L 2 Concatenation:

More information

Regular Expressions and Language Properties

Regular Expressions and Language Properties Regular Expressions and Language Properties Mridul Aanjaneya Stanford University July 3, 2012 Mridul Aanjaneya Automata Theory 1/ 47 Tentative Schedule HW #1: Out (07/03), Due (07/11) HW #2: Out (07/10),

More information

Deterministic Finite Automaton (DFA)

Deterministic Finite Automaton (DFA) 1 Lecture Overview Deterministic Finite Automata (DFA) o accepting a string o defining a language Nondeterministic Finite Automata (NFA) o converting to DFA (subset construction) o constructed from a regular

More information

Regular expressions and Kleene s theorem

Regular expressions and Kleene s theorem and Kleene s theorem Informatics 2A: Lecture 5 John Longley School of Informatics University of Edinburgh jrl@inf.ed.ac.uk 29 September 2016 1 / 21 1 More closure properties of regular languages Operations

More information

UNIT II REGULAR LANGUAGES

UNIT II REGULAR LANGUAGES 1 UNIT II REGULAR LANGUAGES Introduction: A regular expression is a way of describing a regular language. The various operations are closure, union and concatenation. We can also find the equivalent regular

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

Chapter 6: NFA Applications

Chapter 6: NFA Applications Chapter 6: NFA Applications Implementing NFAs The problem with implementing NFAs is that, being nondeterministic, they define a more complex computational procedure for testing language membership. To

More information

Intro to Theory of Computation

Intro to Theory of Computation Intro to Theory of Computation 1/19/2016 LECTURE 3 Last time: DFAs and NFAs Operations on languages Today: Nondeterminism Equivalence of NFAs and DFAs Closure properties of regular languages Sofya Raskhodnikova

More information

Subset construction. We have defined for a DFA L(A) = {x Σ ˆδ(q 0, x) F } and for A NFA. For any NFA A we can build a DFA A D such that L(A) = L(A D )

Subset construction. We have defined for a DFA L(A) = {x Σ ˆδ(q 0, x) F } and for A NFA. For any NFA A we can build a DFA A D such that L(A) = L(A D ) Search algorithm Clever algorithm even for a single word Example: find abac in abaababac See Knuth-Morris-Pratt and String searching algorithm on wikipedia 2 Subset construction We have defined for a DFA

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

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

Automata and Formal Languages - CM0081 Non-Deterministic Finite Automata

Automata and Formal Languages - CM0081 Non-Deterministic Finite Automata Automata and Formal Languages - CM81 Non-Deterministic Finite Automata Andrés Sicard-Ramírez Universidad EAFIT Semester 217-2 Non-Deterministic Finite Automata (NFA) Introduction q i a a q j a q k The

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

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

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

Theory of Computation (I) Yijia Chen Fudan University

Theory of Computation (I) Yijia Chen Fudan University Theory of Computation (I) Yijia Chen Fudan University Instructor Yijia Chen Homepage: http://basics.sjtu.edu.cn/~chen Email: yijiachen@fudan.edu.cn Textbook Introduction to the Theory of Computation Michael

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

Nondeterministic finite automata

Nondeterministic finite automata Lecture 3 Nondeterministic finite automata This lecture is focused on the nondeterministic finite automata (NFA) model and its relationship to the DFA model. Nondeterminism is an important concept in the

More information

How do regular expressions work? CMSC 330: Organization of Programming Languages

How do regular expressions work? CMSC 330: Organization of Programming Languages How do regular expressions work? CMSC 330: Organization of Programming Languages Regular Expressions and Finite Automata What we ve learned What regular expressions are What they can express, and cannot

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

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION CSE 105 THEORY OF COMPUTATION Spring 2016 http://cseweb.ucsd.edu/classes/sp16/cse105-ab/ Today's learning goals Sipser Ch 3.3, 4.1 State and use the Church-Turing thesis. Give examples of decidable problems.

More information

CS21 Decidability and Tractability

CS21 Decidability and Tractability CS21 Decidability and Tractability Lecture 2 January 5, 2018 January 5, 2018 CS21 Lecture 2 1 Outline Finite Automata Nondeterministic Finite Automata Closure under regular operations NFA, FA equivalence

More information

CS 121, Section 2. Week of September 16, 2013

CS 121, Section 2. Week of September 16, 2013 CS 121, Section 2 Week of September 16, 2013 1 Concept Review 1.1 Overview In the past weeks, we have examined the finite automaton, a simple computational model with limited memory. We proved that DFAs,

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

CMSC 330: Organization of Programming Languages. Theory of Regular Expressions Finite Automata

CMSC 330: Organization of Programming Languages. Theory of Regular Expressions Finite Automata : Organization of Programming Languages Theory of Regular Expressions Finite Automata Previous Course Review {s s defined} means the set of string s such that s is chosen or defined as given s A means

More information

Introduction to the Theory of Computation. Automata 1VO + 1PS. Lecturer: Dr. Ana Sokolova.

Introduction to the Theory of Computation. Automata 1VO + 1PS. Lecturer: Dr. Ana Sokolova. Introduction to the Theory of Computation Automata 1VO + 1PS Lecturer: Dr. Ana Sokolova http://cs.uni-salzburg.at/~anas/ Setup and Dates Lectures and Instructions 23.10. 3.11. 17.11. 24.11. 1.12. 11.12.

More information

Obtaining the syntactic monoid via duality

Obtaining the syntactic monoid via duality Radboud University Nijmegen MLNL Groningen May 19th, 2011 Formal languages An alphabet is a non-empty finite set of symbols. If Σ is an alphabet, then Σ denotes the set of all words over Σ. The set Σ forms

More information

Properties of Regular Languages (2015/10/15)

Properties of Regular Languages (2015/10/15) Chapter 4 Properties of Regular Languages (25//5) Pasbag, Turkey Outline 4. Proving Languages Not to e Regular 4.2 Closure Properties of Regular Languages 4.3 Decision Properties of Regular Languages 4.4

More information

Miscellaneous. Closure Properties Decision Properties

Miscellaneous. Closure Properties Decision Properties Miscellaneous Closure Properties Decision Properties 1 Closure Properties of CFL s CFL s are closed under union, concatenation, and Kleene closure. Also, under reversal, homomorphisms and inverse homomorphisms.

More information

Regular Languages. Problem Characterize those Languages recognized by Finite Automata.

Regular Languages. Problem Characterize those Languages recognized by Finite Automata. Regular Expressions Regular Languages Fundamental Question -- Cardinality Alphabet = Σ is finite Strings = Σ is countable Languages = P(Σ ) is uncountable # Finite Automata is countable -- Q Σ +1 transition

More information

Automata Theory and Formal Grammars: Lecture 1

Automata Theory and Formal Grammars: Lecture 1 Automata Theory and Formal Grammars: Lecture 1 Sets, Languages, Logic Automata Theory and Formal Grammars: Lecture 1 p.1/72 Sets, Languages, Logic Today Course Overview Administrivia Sets Theory (Review?)

More information

Introduction to the Theory of Computation. Automata 1VO + 1PS. Lecturer: Dr. Ana Sokolova.

Introduction to the Theory of Computation. Automata 1VO + 1PS. Lecturer: Dr. Ana Sokolova. Introduction to the Theory of Computation Automata 1VO + 1PS Lecturer: Dr. Ana Sokolova http://cs.uni-salzburg.at/~anas/ Setup and Dates Lectures Tuesday 10:45 pm - 12:15 pm Instructions Tuesday 12:30

More information

CSE 105 Homework 1 Due: Monday October 9, Instructions. should be on each page of the submission.

CSE 105 Homework 1 Due: Monday October 9, Instructions. should be on each page of the submission. CSE 5 Homework Due: Monday October 9, 7 Instructions Upload a single file to Gradescope for each group. should be on each page of the submission. All group members names and PIDs Your assignments in this

More information

Formal Languages, Automata and Models of Computation

Formal Languages, Automata and Models of Computation CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2011 1 Content - More Properties of Regular Languages (RL)

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

Lecture 2: Connecting the Three Models

Lecture 2: Connecting the Three Models IAS/PCMI Summer Session 2000 Clay Mathematics Undergraduate Program Advanced Course on Computational Complexity Lecture 2: Connecting the Three Models David Mix Barrington and Alexis Maciel July 18, 2000

More information

Further discussion of Turing machines

Further discussion of Turing machines Further discussion of Turing machines In this lecture we will discuss various aspects of decidable and Turing-recognizable languages that were not mentioned in previous lectures. In particular, we will

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

Foundations of Informatics: a Bridging Course

Foundations of Informatics: a Bridging Course Foundations of Informatics: a Bridging Course Week 3: Formal Languages and Semantics Thomas Noll Lehrstuhl für Informatik 2 RWTH Aachen University noll@cs.rwth-aachen.de http://www.b-it-center.de/wob/en/view/class211_id948.html

More information

Nondeterministic Finite Automata. Nondeterminism Subset Construction

Nondeterministic Finite Automata. Nondeterminism Subset Construction Nondeterministic Finite Automata Nondeterminism Subset Construction 1 Nondeterminism A nondeterministic finite automaton has the ability to be in several states at once. Transitions from a state on an

More information

What Is a Language? Grammars, Languages, and Machines. Strings: the Building Blocks of Languages

What Is a Language? Grammars, Languages, and Machines. Strings: the Building Blocks of Languages Do Homework 2. What Is a Language? Grammars, Languages, and Machines L Language Grammar Accepts Machine Strings: the Building Blocks of Languages An alphabet is a finite set of symbols: English alphabet:

More information

Context-free grammars and languages

Context-free grammars and languages Context-free grammars and languages The next class of languages we will study in the course is the class of context-free languages. They are defined by the notion of a context-free grammar, or a CFG for

More information

Computational Models - Lecture 5 1

Computational Models - Lecture 5 1 Computational Models - Lecture 5 1 Handout Mode Iftach Haitner and Yishay Mansour. Tel Aviv University. April 10/22, 2013 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice

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

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 Patterns A Pattern

More information

Properties of Regular Languages. BBM Automata Theory and Formal Languages 1

Properties of Regular Languages. BBM Automata Theory and Formal Languages 1 Properties of Regular Languages BBM 401 - Automata Theory and Formal Languages 1 Properties of Regular Languages Pumping Lemma: Every regular language satisfies the pumping lemma. A non-regular language

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

Outline. Nondetermistic Finite Automata. Transition diagrams. A finite automaton is a 5-tuple (Q, Σ,δ,q 0,F)

Outline. Nondetermistic Finite Automata. Transition diagrams. A finite automaton is a 5-tuple (Q, Σ,δ,q 0,F) Outline Nondeterminism Regular expressions Elementary reductions http://www.cs.caltech.edu/~cs20/a October 8, 2002 1 Determistic Finite Automata A finite automaton is a 5-tuple (Q, Σ,δ,q 0,F) Q is a finite

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

Chap. 1.2 NonDeterministic Finite Automata (NFA)

Chap. 1.2 NonDeterministic Finite Automata (NFA) Chap. 1.2 NonDeterministic Finite Automata (NFA) DFAs: exactly 1 new state for any state & next char NFA: machine may not work same each time More than 1 transition rule for same state & input Any one

More information

State Complexity of Two Combined Operations: Catenation-Union and Catenation-Intersection

State Complexity of Two Combined Operations: Catenation-Union and Catenation-Intersection International Journal of Foundations of Computer Science c World Scientific Publishing Company State Complexity of Two Combined Operations: Catenation-Union and Catenation-Intersection Bo Cui, Yuan Gao,

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

Einführung in die Computerlinguistik

Einführung in die Computerlinguistik Einführung in die Computerlinguistik Context-Free Grammars formal properties Laura Kallmeyer Heinrich-Heine-Universität Düsseldorf Summer 2018 1 / 20 Normal forms (1) Hopcroft and Ullman (1979) A normal

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

Finite Automata. BİL405 - Automata Theory and Formal Languages 1

Finite Automata. BİL405 - Automata Theory and Formal Languages 1 Finite Automata BİL405 - Automata Theory and Formal Languages 1 Deterministic Finite Automata (DFA) A Deterministic Finite Automata (DFA) is a quintuple A = (Q,,, q 0, F) 1. Q is a finite set of states

More information

Finite State Automata Design

Finite State Automata Design Finite State Automata Design Nicholas Mainardi 1 Dipartimento di Elettronica e Informazione Politecnico di Milano nicholas.mainardi@polimi.it March 14, 2017 1 Mostly based on Alessandro Barenghi s material,

More information

CS 154 Formal Languages and Computability Assignment #2 Solutions

CS 154 Formal Languages and Computability Assignment #2 Solutions CS 154 Formal Languages and Computability Assignment #2 Solutions Department of Computer Science San Jose State University Spring 2016 Instructor: Ron Mak www.cs.sjsu.edu/~mak Assignment #2: Question 1

More information

Theory of Computation

Theory of Computation Thomas Zeugmann Hokkaido University Laboratory for Algorithmics http://www-alg.ist.hokudai.ac.jp/ thomas/toc/ Lecture 1: Introducing Formal Languages Motivation I This course is about the study of a fascinating

More information

Computational Models Lecture 2 1

Computational Models Lecture 2 1 Computational Models Lecture 2 1 Handout Mode Ronitt Rubinfeld and Iftach Haitner. Tel Aviv University. March 16/18, 2015 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice

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

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION CSE 105 THEORY OF COMPUTATION Spring 2016 http://cseweb.ucsd.edu/classes/sp16/cse105-ab/ Today's learning goals Sipser Ch 2 Design a PDA and a CFG for a given language Give informal description for a PDA,

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

Foundations of

Foundations of 91.304 Foundations of (Theoretical) Computer Science Chapter 1 Lecture Notes (Section 1.3: Regular Expressions) David Martin dm@cs.uml.edu d with some modifications by Prof. Karen Daniels, Spring 2012

More information

Recitation 2 - Non Deterministic Finite Automata (NFA) and Regular OctoberExpressions

Recitation 2 - Non Deterministic Finite Automata (NFA) and Regular OctoberExpressions Recitation 2 - Non Deterministic Finite Automata (NFA) and Regular Expressions Orit Moskovich Gal Rotem Tel Aviv University October 28, 2015 Recitation 2 - Non Deterministic Finite Automata (NFA) and Regular

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

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

Automata on linear orderings

Automata on linear orderings Automata on linear orderings Véronique Bruyère Institut d Informatique Université de Mons-Hainaut Olivier Carton LIAFA Université Paris 7 September 25, 2006 Abstract We consider words indexed by linear

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

Let us first give some intuitive idea about a state of a system and state transitions before describing finite automata.

Let us first give some intuitive idea about a state of a system and state transitions before describing finite automata. Finite Automata Automata (singular: automation) are a particularly simple, but useful, model of computation. They were initially proposed as a simple model for the behavior of neurons. The concept of a

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

Finite Automata. Dr. Neil T. Dantam. Fall CSCI-561, Colorado School of Mines. Dantam (Mines CSCI-561) Finite Automata Fall / 35

Finite Automata. Dr. Neil T. Dantam. Fall CSCI-561, Colorado School of Mines. Dantam (Mines CSCI-561) Finite Automata Fall / 35 Finite Automata Dr. Neil T. Dantam CSCI-561, Colorado School of Mines Fall 2017 Dantam (Mines CSCI-561) Finite Automata Fall 2017 1 / 35 Outline Dantam (Mines CSCI-561) Finite Automata Fall 2017 2 / 35

More information