Finite Automata and Regular Languages (part III)

Similar documents
Finite Automata and Regular Languages (part II)

Nondeterministic Finite Automata

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,

Theory of Computation (I) Yijia Chen Fudan University

CS 455/555: Finite automata

Grammars (part II) Prof. Dan A. Simovici UMB

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

Theory of Languages and Automata

Lecture 3: Nondeterministic Finite Automata

Nondeterministic Finite Automata

Nondeterministic Finite Automata. Nondeterminism Subset Construction

Finite Automata and Regular languages

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

Theory of Computation

Chapter Five: Nondeterministic Finite Automata

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

Automata and Formal Languages - CM0081 Non-Deterministic Finite Automata

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

CS243, Logic and Computation Nondeterministic finite automata

Theory of Computation (II) Yijia Chen Fudan University

Automata and Languages

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

Inf2A: Converting from NFAs to DFAs and Closure Properties

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

Lecture 4 Nondeterministic Finite Accepters

DM17. Beregnelighed. Jacob Aae Mikkelsen

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

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

Equivalence of DFAs and NFAs

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

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

Computational Theory

Finite Automata. Seungjin Choi

Closure under the Regular Operations

Sri vidya college of engineering and technology

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

Finite Automata and Regular Languages

CISC 4090: Theory of Computation Chapter 1 Regular Languages. Section 1.1: Finite Automata. What is a computer? Finite automata

Introduction to Finite-State Automata

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

C2.1 Regular Grammars

September 11, Second Part of Regular Expressions Equivalence with Finite Aut

CMSC 330: Organization of Programming Languages

C2.1 Regular Grammars

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

Computability and Complexity

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

Lecture 23 : Nondeterministic Finite Automata DRAFT Connection between Regular Expressions and Finite Automata

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

Chapter 2: Finite Automata

Non-deterministic Finite Automata (NFAs)

UNIT-III REGULAR LANGUAGES

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

Pushdown Automata. We have seen examples of context-free languages that are not regular, and hence can not be recognized by finite automata.

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

COM364 Automata Theory Lecture Note 2 - Nondeterminism

Chapter 6: NFA Applications

CSC173 Workshop: 13 Sept. Notes

Clarifications from last time. This Lecture. Last Lecture. CMSC 330: Organization of Programming Languages. Finite Automata.

Computer Sciences Department

Nondeterminism and Epsilon Transitions

Computational Models - Lecture 1 1

Formal Models in NLP

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

CS 154. Finite Automata, Nondeterminism, Regular Expressions

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

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

CS 208: Automata Theory and Logic

3515ICT: Theory of Computation. Regular languages

Lecture 1: Finite State Automaton

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

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Critical CS Questions

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 )

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 Σ,

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

Regular Expressions. Definitions Equivalence to Finite Automata

Finite Automata and Languages

2017/08/29 Chapter 1.2 in Sipser Ø Announcement:

Nondeterministic finite automata

September 7, Formal Definition of a Nondeterministic Finite Automaton

Finite Automata. Finite Automata

Non-Deterministic Finite Automata

(Refer Slide Time: 0:21)

More on Regular Languages and Non-Regular Languages

Context-Free languages (part II)

Theory of Computation

Computational Models Lecture 2 1

Theory of computation: initial remarks (Chapter 11)

CSE 105 Theory of Computation Professor Jeanne Ferrante

Computational Models - Lecture 5 1

Computational Models Lecture 2 1

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

Chapter Two: Finite Automata

Computational Models #1

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

Finite Automata. Mahesh Viswanathan

Java II Finite Automata I

Automata and Formal Languages - CM0081 Finite Automata and Regular Expressions

GEETANJALI INSTITUTE OF TECHNICAL STUDIES, UDAIPUR I

Transcription:

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 reading any input symbol. Definition A transition system (ts) is a 5-tuple T = (A, Q, θ, Q 0, F ), where A, Q, and F are as in a finite automaton, θ is a finite relation, θ Q A Q, called the transition relation of T, and Q 0 is a nonempty subset of Q called the set of initial states, and F is the set of final states. A transition in T is a triple (q, x, q ) θ. We refer to transitions of the form (q, λ, q ) as null transitions. 3 / 1

ransition systems are conveniently represented by labeled directed Tmultigraphs. Namely, if T = (A, Q, θ, Q 0, F ) is a transition system, then its graph is a labeled directed multigraph G(T) = (G, A, m) that has Q as its set of vertices. Each directed edge e with s(e) = q, d(e) = q, and m(e) = x corresponds to a triple (q, x, q ) θ, and every such triple is represented by an edge in G. Observe that, unlike the graph of a dfa or an ndfa, the edges of the directed graph of a ts can be labelled with words, including the null word. 4 / 1

Example The graph of the transition system T 1 = ({a, b, c}, {q 0, q 1, q 2, q 3 }, θ, {q 0 }, {q 3 }), where θ is given by θ = {(q 0, ab, q 1 ), (q 0, λ, q 2 ), (q 1, bc, q 2 ), (q 1, λ, q 3 ), (q 2, c, q 3 )} is shown below: q 1 ab λ q 0 bc q 3 λ c q 2 5 / 1

Extending the transition relation As we did with the transition functions of dfas and ndfas, we wish to extend the transition relation θ of a transition system T to the set Q A Q. The extension θ Q A Q is given next. 1 For every q Q define (q, λ, q) θ. 2 Every triple (q, x, q ) θ belongs to θ. 3 If (q, x, q ), (q, y, q ) θ, then (q, xy, q ) θ. Note that (q, w, q ) θ if and only if there is a path in G(T) that begins with q and ends with q such that the concatenated labels of the directed edges of this path form the word w. 6 / 1

Example q 1 ab λ q 0 bc q 3 λ c q 2 If T is the above transition system, then (q 0, abbcc, q 3 ) θ because (q 0, ab, q 1 ), (q 1, bc, q 2 ), (q 2, c, q 3 ) θ. Similarly, (q 0, c, q 3 ) θ because (q 0, λ, q 2 ), (q 2, c, q 3 ) θ. 7 / 1

Definition Let T = (A, Q, θ, Q 0, F ) be a transition system. The language accepted by T is L(T) = {x A (q 0, x, q) θ for some q 0 Q 0, q F }. Thus, a word x belongs to L(T) if there is a path in G(T) that begins in an initial state q 0 Q 0, labeled by x, such that the path ends in one of the states of F, the set of final states. 8 / 1

Transition systems generalize ndfas If M = (A, Q, δ, q 0, F ) is a nondeterministic automaton, define the transition system T M = (A, Q, θ, {q 0 }, F ), where θ = {(q, a, q ) q, q Q, a A and q δ(q, a)}. It can be shown by induction on x that (q, x, q ) θ if and only if q δ (q, x). This implies that L(T M ) = L(M). Therefore, every regular language can be accepted by a transition system. Furthermore, any language that can be accepted by a transition system is regular. 9 / 1

Lemma For every transition system T = (A, Q, θ, Q 0, F ) there exists a transition system T = (A, Q, θ, Q 0, F ) such that (q, x, q 1 ) θ implies x 1 and L(T ) = L(T). 10 / 1

Proof Define the relation θ and the set Q as follows: 1 Every state q Q also belongs to Q. 2 Every triple (q, x, q ) θ such that x 1 also belongs to θ. 3 If t = (q, x, q ) θ such that x = a 0... a n 1 and n 2, add n 1 new states q t 0,... qt n 2 to Q and the triples to θ. (q, a 0, q t 0), (q t 0, a 1, q t 1),..., (q t n 2, a n 1, q ) The ts T clearly satisfies the conditions of the lemma, since (q, x, q ) θ if and only if (q, x, q ) θ. 11 / 1

Theorem For every transition system T = (A, Q, θ, Q 0, F ) there exists a deterministic finite automaton M such that L(T) = L(M). Proof. By the previous Lemma we can assume that (q, x, q ) θ implies x 1. Define the deterministic finite automaton M = (A, P(Q),, Q 0, F ), where the initial state of M is Q 0 = {q Q (q 0, λ, q) θ for some q 0 Q 0 }, the set of final states is F = {S S Q, S F }, and the function is defined by (S, a) = {q Q (q, a, q ) θ for some q S}, for every S Q and a A. 12 / 1

Proof (cont d) It is not difficult to verify, by induction on x, that (Q 0, x) = {q Q (q 0, x, q ) θ for some q 0 Q 0 }, for x A. For the basis case, x = 0, so the above equality becomes Q 0 = {q Q (q 0, λ, q ) θ for some q 0 Q 0 }, which holds by the definition of Q 0. 13 / 1

Proof (cont d) Suppose that the equality holds for words of length n, and let y be a word of length n + 1. We can write y = xa, so (Q 0, y) = (Q 0, xa) = ( (Q 0, x), a) = ({q Q (q 0, x, q ) θ for some q 0 Q 0 }, a) (by the inductive hypothesis) = {r Q (q, a, r) θ, for some q such that (q 0, x, q ) θ for some q 0 Q 0 } (by the definition of ) = {r Q (q 0, xa, r) θ for some q 0 Q 0 } (by the definition of θ ) = {r Q (q 0, y, r) θ for some q 0 Q 0 }, which concludes our inductive argument. 14 / 1

Proof (cont d) From this it follows that L(M) = L(T). By definition, x L(M) if and only if (Q 0, x) F. This is equivalent to (Q 0, x) F. This is equivalent to the existence of a state q F such that (q 0, x, q ) θ for some q 0 Q 0, and this is equivalent to x L(T). 15 / 1

Corollary The class of languages that are accepted by transition systems is the class R of regular languages. 16 / 1

Definition Let T = (A, Q, θ, Q 0, F ) be a transition system. The λ-closure is the mapping K T : P(Q) P(Q) given by K T (S) = {q Q (s, λ, q) θ for some s S}. The set K T (S) comprises the states in S plus all the states that can be reached from a state in S using a series of λ-transitions. 17 / 1

Theorem Let T = (A, Q, θ, Q 0, F ) be a transition system. The λ-closure of T has the following properties. 1 S K T (S); 2 S S implies K T (S) K T (S ); 3 K T (K T (S)) = K T (S), for every S, S P(Q). 18 / 1

Proof Since (s, λ, s) θ it is immediate that S K T (S) for every S P(Q). The second part of the theorem is a direct consequence of the definition of K T. Note that Parts (i) and (ii) imply K T (S) K T (K T (S)). Let q K T (K T (S)). There is a state s S and a state r K T (S) such that (s, λ, r) θ and (r, λ, q) θ. By the definition of θ we obtain (s, λ, q) θ, so q K T (S). This implies K T (K T (S)) K T (S), which gives the last part of the theorem. 19 / 1

Definition Let T = (A, Q, θ, Q 0, F ) be a transition system. A K T -closed subset of Q is a set S such that S Q and K T (S) = S. 20 / 1

Example Consider the transition system T = ({a, b}, {q 0, q 1, q 2, q 3 }, θ, {q 0 }, {q 2, q 3 }) whose graph is shown λ q 1 b λ λ q 3 q 0 a q 2 λ 21 / 1

λ q 1 b λ λ q 3 q 0 a q 2 λ S K T (S) S K T (S) {q 1, q 2 } {q 1, q 2, q 3 } {q 0 } Q {q 1, q 3 } {q 1, q 2, q 3 } {q 1 } {q 1, q 2, q 3 } {q 2, q 3 } {q 1, q 2, q 3 } {q 2 } {q 1, q 2, q 3 } {q 0, q 1, q 2 } Q {q 3 } {q 3 } {q 0, q 1, q 3 } Q {q 0, q 1 } Q {q 0, q 2, q 3 } Q {q 0, q 2 } Q {q 1, q 2, q 3 } {q 1, q 2, q 3 } {q 0, q 3 } Q {q 0, q 1, q 2, q 3 } Q The closed subsets of Q are, {q 3 }, {q 1, q 2, q 3 }, and Q itself. 22 / 1

Theorem Let T = (A, Q, θ, Q 0, F ) be a transition system and let M = (A, P(Q),, Q 0, F ) be the dfa constructed in earlier. The set (S, a) is a K T -closed set of states for every subset S of Q and a A. 23 / 1

Proof To prove the theorem it suffices to show that K T ( (S, a)) (S, a). Let p K T ( (S, a)). There is p 1 (S, a) such that (p 1, λ, p) θ. The definition of (S, a) implies the existence of q S such that (q, a, p 1 ) θ. Thus, (q, a, p) θ, so p (q, a). 24 / 1

Corollary Let T = (A, Q, θ, Q 0, F ) be a transition system, and let M = (A, P(Q),, Q 0, F ) be the constructed dfa. The accessible states of the dfa M are K T -closed subsets of Q. Proof. The initial state Q 0 of M is obviously closed. If Q is an accessible state of M, then Q = (S, a) for some S Q. Therefore Q is closed. 25 / 1

Theorem Let T = (A, Q, θ, Q 0, F ) be a transition system, and let M = (A, P(Q),, Q 0, F ) be the dfa constructed earlier. Then, (S, a) = K T ({q Q (s, a, q) θ for some s S}), where S is an accessible state of M. 26 / 1

Proof Let s S. Note that if (s, a, q) θ and (q, λ, q 1 ) θ, then by the definition of θ we have (s, a, q 1 ) θ. Therefore, K T ({q Q (s, a, q) θ} (S, a). To prove the converse inclusion, (S, a) K T ({q Q (s, a, q) θ}, let (s, a, q 1 ) θ. Then, there is a path in G(T) that begins with s and ends with q 1 such that the concatenated labels of the directed edges of this path form the word a. This implies the existence of the states p, p Q such that (s, λ, p) θ, (p, a, p 1 ) θ, and (p 1, λ, q 1 ) θ. Since S is K T -closed it follows that p S and this gives the desired conclusion. 27 / 1

An Algorithm for Constructing a dfa corresponding to a ts Input: A transition system T = (A, Q, θ, Q 0, F ). Output: An accessible dfa M 1 such that L(M 1 ) = L(T). Method: Compute the increasing sequence of collections of subsets of Q, Q 0,..., Q i,..., where Q 0 = {Q 0} Q i+1 = Q i {U P(Q) U = (S, a) for some S Q i and a A}. 28 / 1

the computation of U = (S, a) can be done by computing first the set W = {q Q (s, a, q) θ for some s S} and then U = K T (W ). Stop when Q i+1 = Q i. The set Q i is the set of accessible states of M. Ouput M = ACC(M), the accessible component of M. 29 / 1

For the transition system λ q 1 b λ λ q 3 q 0 a q 2 λ 30 / 1

the transition system is: b a a Q {q 1, q 2, q 3 } a b a b b {q 3 } 31 / 1