Takeaway Notes: Finite State Automata

Similar documents
Nondeterministic finite automata

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,

(Refer Slide Time: 0:21)

Chapter Five: Nondeterministic Finite Automata

Lecture 3: Nondeterministic Finite Automata

COM364 Automata Theory Lecture Note 2 - Nondeterminism

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

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

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

Fooling Sets and. Lecture 5

Theory of Computation (I) Yijia Chen Fudan University

Decision, Computation and Language

Extended transition function of a DFA

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

Finite Automata Part Two

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

1 More finite deterministic automata

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Course 4 Finite Automata/Finite State Machines

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

CS 154. Finite Automata, Nondeterminism, Regular Expressions

CSE 135: Introduction to Theory of Computation Nondeterministic Finite Automata

Chap. 1.2 NonDeterministic Finite Automata (NFA)

Lecture 4: Finite Automata

CSE 105 Theory of Computation Professor Jeanne Ferrante

Finite Automata. Seungjin Choi

September 7, Formal Definition of a Nondeterministic Finite Automaton

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

Lecture 3: Finite Automata

Formal Definition of a Finite Automaton. August 26, 2013

CS243, Logic and Computation Nondeterministic finite automata

Closure under the Regular Operations

Deterministic Finite Automata (DFAs)

Deterministic Finite Automata (DFAs)

Equivalence of Regular Expressions and FSMs

Languages, regular languages, finite automata

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

CPS 220 Theory of Computation REGULAR LANGUAGES

Nondeterministic Finite Automata. Nondeterminism Subset Construction

CSC236 Week 10. Larry Zhang

CS 154, Lecture 3: DFA NFA, Regular Expressions

Lecture 1: Finite State Automaton

Lecture 3: Finite Automata

Nondeterminism. September 7, Nondeterminism

Automata: a short introduction

CSC236 Week 11. Larry Zhang

Finite Automata. Mahesh Viswanathan

Theory of computation: initial remarks (Chapter 11)

Non-deterministic Finite Automata (NFAs)

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

Formal Definition of Computation. August 28, 2013

Finite Automata and Regular Languages

Finite Automata and Regular languages

Deterministic Finite Automata (DFAs)

CSE 311: Foundations of Computing. Lecture 25: Pattern Matching, DFA NFA Regex Languages vs Representations

Inf2A: Converting from NFAs to DFAs and Closure Properties

CMSC 330: Organization of Programming Languages

CSE 105 THEORY OF COMPUTATION

CSC173 Workshop: 13 Sept. Notes

Deterministic (DFA) There is a fixed number of states and we can only be in one state at a time

Deterministic Finite Automaton (DFA)

CS 208: Automata Theory and Logic

Nondeterministic Finite Automata

Intro to Theory of Computation

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

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

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

Theory of computation: initial remarks (Chapter 11)

Formal Models in NLP

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

COMP/MATH 300 Topics for Spring 2017 June 5, Review and Regular Languages

A Note on Turing Machine Design

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

Nondeterministic Finite Automata

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 )

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

Finite Automata Part Two

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

Finite Automata (contd)

Finite Automata Part One

Theory of Computation Lecture 1. Dr. Nahla Belal

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

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

Introduction to the Theory of Computing

Nondeterminism and Epsilon Transitions

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

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

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

Computer Sciences Department

Theory of Computation (II) Yijia Chen Fudan University

Theory of Languages and Automata

Turing machines and linear bounded automata

Finite Automata Part One

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

CS 455/555: Finite automata

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

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

Finite Automata. Theorems - Unit I SUSAN ELIAS. Professor Department of Computer Science & Engineering Sri Venkateswara College of Engineering

Nondeterministic Finite Automata and Regular Expressions

Transcription:

Takeaway Notes: Finite State Automata Contents 1 Introduction 1 2 Basics and Ground Rules 2 2.1 Building Blocks.............................. 2 2.2 The Name of the Game.......................... 2 3 Deterministic Finite State Automata 3 3.1 About that δ............................... 3 3.2 ˆδ Leads to L................................ 4 4 Nondeterministic Finite State Automata 4 4.1 NFAs and DFAs are Equivalent!..................... 4 4.2 Implications of NFA-DFA Equivalency................. 5 4.3 The ɛ-transition............................. 5 5 Important Skills 5 6 Big Picture Points 6 1 Introduction This writeup is meant to provide key takeaways regarding finite state machines or automata. It is largely a distillation of the textbook and online video material, but seen through my individual lens in terms of emphasis and approach. Think of the textbook, the videos, this writeup, and the class meetings as if they were four portholes into the same subject. By exposing yourself to the same material in four different ways, the hope is that you walk away from this in a way that fulfills the objectives of the course. 1

2 Basics and Ground Rules 2.1 Building Blocks An alphabet is a finite set of symbols. Symbols can be anything. Our convention for denoting an alphabet mathematically is Σ. We concatenate symbols from Σ into strings. Strings are finite in length. Empty strings are denoted by ɛ. The length of a string w is denoted by w. Σ n denotes the set of all strings made up of symbols from Σ whose length is n. Σ 0 = {ɛ}. Σ is the set of all all all strings made up of symbols from Σ. Some fun equivalency games: Σ = Σ 0 Σ 1 Σ 2... Σ + = Σ 1 Σ 2 Σ 3... Σ = Σ 0 Σ + = {ɛ} Σ + A language L is any set of strings (strings of finite length, but there may be an infinite number of them) in Σ. More formally, we can say that L is some subset of Σ. 2.2 The Name of the Game We distill our notion of computation here to just recognizing whether some string in Σ belongs to a language L. The premise behind this distillation is that it reduces the problem to something precise and straightforward, with the idea that if something in this realm is already difficult to do, then everything else must be even more difficult than that. Similarly, although Σ can really consist of any number of symbols, most of the examples we ll see restrict Σ to two symbols. This is done primarily to keep from obligating ourselves to write out tons and tons of state transitions; it turns out that working with two-symbol alphabets is sufficient to convey all of the key ideas in this topic. Larger alphabets merely imply more of everything (states and state transitions). It s a classic case of the mathematical phrase without loss of generality. 2

3 Deterministic Finite State Automata The intuitive notion behind a deterministic finite state automaton or machine (DFA) is pretty straightforward. The trick is remembering how they translate formally, so that theorems can be proven about them. A DFA A is formalized as a tuple (this tuple-ization technique will be used over and over again, so it s worth remembering): A = (Q, Σ, δ, q 0, F ) Yep, that s a deterministic finite state machine. The symbols break down like this: Q is A s set of states Σ is its alphabet δ is the big one: it is A s transition function. This is effectively the diagram that we draw, but made completely formal and unambiguous q 0 is A s start state; hope it s obvious that q 0 Q F is A s accepting states; similarly as above, F Q 3.1 About that δ As stated above, there s a lot more that we can say about δ. To define it further, δ is a function δ(q, a) where q is a state in Q and a is a symbol in Σ. The value δ(q, a) is some other state p (also in Q, of course) that represents the new state of the machine if it is currently in state q and receives the symbol a. As human beings, it s very hard to think about δ in this way, so instead we use either state transition diagrams or transition tables to spell things out. So running a DFA is about computing the value of δ over and over again. We start at q 0 then take the input string one symbol at a time. This gives us δ(q 0, a). Then we take the next symbol and compute δ(δ(q 0, a), b). And so forth. We stop when the latest δ result is a state in F. This repeated execution leads us to the notion of an extended transition function. Instead of a state and a character, this function ˆδ takes a state and a string. Its result is the state of the machine after consuming the string starting at a given state. 3

3.2 ˆδ Leads to L The extended transition concept makes it easy for us to formally state if a machine accepts some input string w: w is accepted if ˆδ(q 0, w) F. Thus, we can now formally define the language L of a DFA A = Q, Σ, δ, q 0, F, written as L(A) (the language of the machine A ): L(A) = {w ˆδ(q 0, w) F } Set notation! Hope you remember that from past courses. 4 Nondeterministic Finite State Automata A major extension of the way we can describe finite state automata is to introduce nondeterminism. Conceptually, nondeterministic finite state automaton (NFA) can be transition to multiple states given the same symbol. This creates the image of having multiple paths through the machine for the same string. The NFA accepts a string if a path to an accepting/final state simply exists. The formal definition of an NFA is the same as that of a DFA except for the output of δ. In an NFA, δ(q, a) is a set of states rather than a single one. This set of states is a subset of Q. Because δ is different for an NFA, then so is ˆδ. For an NFA, ˆδ is the union of all intermediate state subsets produced by δ for a given string. And thus, the language that is accepted by a given NFA now becomes: L(A) = {w ˆδ(q 0, w) F } 4.1 NFAs and DFAs are Equivalent! NFAs make finite state machines much easier to define; however, a key finding in the study of these machines is that a DFA can be constructed from any NFA. In other words, they can all recognize the same set of languages. In other other words, NFAs aren t any more powerful than DFAs. This is a big claim, and therefore it must be formally proven. The sketch of the proof consists of the following steps: 1. State the algorithm that constructs a DFA out of an NFA (tl;dr the states in the DFA consist of combinations of states from the NFA, representing where the machine could be after receiving the next symbol in a string) 4

2. Show that for the machine D = (Q D, Σ, δ D, q 0, F D ) that emerges from N = (Q N, Σ, δ N, q 0, F N ) via this algorithm, L(D) = L(N) 3. i.e., {w ˆδ D (q 0, w) F D } = {w ˆδ N (q 0, w) F N } 4.2 Implications of NFA-DFA Equivalency Key points of this major finding: We are free to use NFAs to describe languages because we are assured that there is a DFA out there which will accept the exact same language. We like this freedom because, in many cases, NFAs are easier to define. They aren t any more powerful, but they are certainly more convenient. The cost of DFA conversion is the number of states: in the worst case, an NFA consisting of n states may blow up into a DFA of 2 n states, due to the way the constructive algorithm works. 4.3 The ɛ-transition A significant NFA extension is the inclusion of the empty string ɛ as one of the arguments into the transition function δ. i.e., These kinds of NFAs can change from one state to another without reading the next symbol in the string. This is intuitively sensible because NFAs can be in more than one state for the same input string anyway. If this is already true, why wait to read another symbol in order to go to the next state? ɛ transitions simply add to the set of possible states that a machine can be in for a given input string. 5 Important Skills What should one be able to do with this thought framework? Here are some key skillz: Define a DFA or NFA that will recognize some language L Infer the language L that is recognized by some DFA or NFA Prove a statement based on the formal definitions within this topic and/or a specific DFA or NFA tuple 5

Have an intuitive sense for what languages cannot be recognized by any DFA nor NFA Note that these correspond to what you are/will be asked to submit as course work for this general topic. 6 Big Picture Points Things you shouldn t forget even years after taking this course: Finite state automata represent the simplest model of computation that has been formally studied. As with all models of computation, finite state machines are equivalent to some language (i.e., the language whose strings they accept). Nondeterminism adds convenience but not power to these machines. And, looking ahead: keep an eye out for what extension/enhancement to the model does put it over the top in order to recognize the next level of languages. 6