Equivalence of Regular Expressions and FSMs

Similar documents
Deterministic Finite Automaton (DFA)

Embedded systems specification and design

Lecture 3: Nondeterministic Finite Automata

This Lecture will Cover...

Regular Expressions. Definitions Equivalence to Finite Automata

Automata and Formal Languages - CM0081 Finite Automata and Regular Expressions

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

Closure under the Regular Operations

Decision, Computation and Language

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,

Ogden s Lemma for CFLs

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

Finite-State Transducers

Inf2A: Converting from NFAs to DFAs and Closure Properties

Closure under the Regular Operations

Introduction to Kleene Algebras

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

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

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

Non-deterministic Finite Automata (NFAs)

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

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

Regular Expressions and Language Properties

Takeaway Notes: Finite State Automata

1 Alphabets and Languages

This lecture covers Chapter 7 of HMU: Properties of CFLs

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

CMSC 330: Organization of Programming Languages

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

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

More About Turing Machines. Programming Tricks Restrictions Extensions Closure Properties

Chapter 6. Properties of Regular Languages

Finite State Machines 2

Nondeterministic Finite Automata

Sri vidya college of engineering and technology

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

Lexical Analysis. DFA Minimization & Equivalence to Regular Expressions

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

Lecture 2: Regular Expression

NPDA, CFG equivalence

FS Properties and FSTs

CSE 311: Foundations of Computing. Lecture 23: Finite State Machine Minimization & NFAs

COM364 Automata Theory Lecture Note 2 - Nondeterminism

Theory of Computation

Kleene Algebras and Algebraic Path Problems

MA/CSSE 474 Theory of Computation

Busch Complexity Lectures: Turing s Thesis. Costas Busch - LSU 1

CS 455/555: Finite automata

Theory of computation: initial remarks (Chapter 11)

Context-free grammars and languages

CSC236 Week 10. Larry Zhang

Johns Hopkins Math Tournament Proof Round: Automata

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

Computational Models #1

Theory of computation: initial remarks (Chapter 11)

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

Comment: The induction is always on some parameter, and the basis case is always an integer or set of integers.

Computational Models - Lecture 1 1

Lecture 4 Nondeterministic Finite Accepters

Foundations of

DFA to Regular Expressions

Automata and Languages

UNIT II REGULAR LANGUAGES

CS21 Decidability and Tractability

CS:4330 Theory of Computation Spring Regular Languages. Finite Automata and Regular Expressions. Haniel Barbosa

Variations of the Turing Machine

1 More finite deterministic automata

CSE 105 THEORY OF COMPUTATION

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

Finite Automata and Regular languages

CS 322 D: Formal languages and automata theory

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

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

Pushdown Automata. Chapter 12

Nondeterminism and Epsilon Transitions

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

CS243, Logic and Computation Nondeterministic finite automata

PS2 - Comments. University of Virginia - cs3102: Theory of Computation Spring 2010

Finite Automata Part Two

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

Formal Models in NLP

Formal Definition of a Finite Automaton. August 26, 2013

Nondeterministic Finite Automata. Nondeterminism Subset Construction

Introduction to Finite-State Automata

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

6.5.3 An NP-complete domino game

Finite Automata and Regular Languages

Uses of finite automata

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

Nondeterministic finite automata

Context Free Language Properties

Non-context-Free Languages. CS215, Lecture 5 c

Regular expressions and Kleene s theorem

Theory of Computation

Chapter Five: Nondeterministic Finite Automata

Regular expressions and Kleene s theorem

Automata & languages. A primer on the Theory of Computation. Laurent Vanbever. ETH Zürich (D-ITET) September,

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

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

NOTES ON AUTOMATA. Date: April 29,

Transcription:

Equivalence of Regular Expressions and FSMs Greg Plaxton Theory in Programming Practice, Spring 2005 Department of Computer Science University of Texas at Austin

Regular Language Recall that a language is a (possibly infinite) set of strings over some specified alphabet For any FSM M, the language accepted by M is the set of all strings accepted by M A language is regular if it is equal to the set of strings defined by some regular expression We ll prove that regular expressions and FSMs are equivalent in power Every FSM accepts a regular language Every regular language is accepted by some FSM

Every FSM Accepts a Regular Language Fix an FSM M, and number the states of M from 1 to n arbitrarily Let Rij k denote the set of strings that cause M to transition from state i to state j without visiting an intermediate state numbered higher than k Claim: For all i, j, and k, R k ij is a regular language We ll prove the claim by induction on k 0 Why does the claim imply the desired result? The key observation for carrying out the induction step is that R k ij = R k 1 ij R k 1 ik (Rk 1 kk ) R k 1 kj

Every Regular Language is Accepted by Some FSM We prove this result in three stages: First, we define the notion of a nondeterministic FSM and prove that deterministic and nondeterministic FSMs are equivalent in power Second, we define the notion of a nondeterministic FSM with ɛ- transitions and prove that nondeterministic FSMs with and without ɛ-transitions are equivalent in power Finally, we prove that every regular language is accepted by some nondeterministic FSM with ɛ-transitions

Nondeterministic Finite State Machines A nondeterministic FSM is the same as a (deterministic) FSM except that the transition function maps each state/symbol pair to a (possibly empty) subset of the states, as opposed to a single state When we run a nondeterministic machine on a given input string, we repeatedly choose the next state arbitrarily from the subset specified by the transition function An execution is good if the transition function never specifies an empty subset from which to choose the next state; otherwise, it is bad A nondeterministic FSM M is said to accept a string x if there exists some good execution of M on string x that terminates in an accepting state

Simulation of a Nondeterministic FSM by a (Deterministic) FSM Fix a nondeterministic FSM M and let S denote the set of states of M We simulate M via an FSM M with 2 S states, one corresponding to each subset of S The key idea is to define the transition function of M so that the following condition holds for any input x The execution of M on input x terminates in the state of M corresponding to the set of all states α of M such that some good execution of M on input x terminates in state α How do we define the accepting states of M in order to complete the construction properly?

Nondeterministic FSMs with ɛ-transitions A nondeterministic FSM with ɛ-transitions is the same as a nondeterministic FSM except that we allow transitions labeled ɛ (and called ɛ-transitions) that do not consume an input symbol The notion of a good execution is the same as we had for a nondeterministic FSM without ɛ-transitions, except that whenever we find ourselves in a state with one or more outgoing ɛ-transitions, we have the option to make such a transition without consuming an input symbol Acceptance is then defined in the same way as for nondeterministic FSMs: A nondeterministic FSM M with ɛ-transitions is said to accept a string x if there exists some good execution of M on string x that terminates in an accepting state

Simulation of a Nondeterministic FSM with ɛ-transitions by a (Ordinary) Nondeterministic FSM Fix a nondeterministic FSM M with ɛ-transitions We d like to create a nondeterministic FSM M without ɛ-transitions that simulates M Let the states of M be the same as the states of M We define the transition function of M so that there is a transition from state α to state β on input symbol a if and only if M admits a path from α to β where one transition is labeled with a and the remaining transitions are ɛ-transitions How do we define the accepting states of M in order to complete the construction properly?

Every Regular Language is Accepted by some Nondeterministic FSM with ɛ-transitions Recall that regular languages are defined in terms of regular expressions We prove the claim by structural induction on the definition of a regular expression Base case: We need to exhibit machines that accept the languages, {ɛ}, and {a} where a is an arbitrary symbol in the alphabet For the induction step, we need to consider regular expressions formed by concatenation, union, and Kleene closure of smaller regular expressions