Deterministic Finite-State Automata

Similar documents
Finite-State Automata: Recap

Theory of Computation Regular Languages. (NTU EE) Regular Languages Fall / 38

Theory of Computation Regular Languages

Myhill-Nerode Theorem

CS375: Logic and Theory of Computing

NFAs and Regular Expressions. NFA-ε, continued. Recall. Last class: Today: Fun:

Non-Deterministic Finite Automata. Fall 2018 Costas Busch - RPI 1

Non Deterministic Automata. Linz: Nondeterministic Finite Accepters, page 51

Anatomy of a Deterministic Finite Automaton. Deterministic Finite Automata. A machine so simple that you can understand it in less than one minute

Let's start with an example:

Languages & Automata

a,b a 1 a 2 a 3 a,b 1 a,b a,b 2 3 a,b a,b a 2 a,b CS Determinisitic Finite Automata 1

Non-Deterministic Finite Automata

Automata and Languages

Non Deterministic Automata. Formal Languages and Automata - Yonsei CS 1

5.1 Definitions and Examples 5.2 Deterministic Pushdown Automata

AUTOMATA AND LANGUAGES. Definition 1.5: Finite Automaton

Recursively Enumerable and Recursive. Languages

Finite Automata. Informatics 2A: Lecture 3. John Longley. 22 September School of Informatics University of Edinburgh

Lecture 6 Regular Grammars

Finite Automata. Informatics 2A: Lecture 3. Mary Cryan. 21 September School of Informatics University of Edinburgh

CHAPTER 1 Regular Languages. Contents

Regular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Kleene-*

Introduction to ω-autamata

CS 373, Spring Solutions to Mock midterm 1 (Based on first midterm in CS 273, Fall 2008.)

11.1 Finite Automata. CS125 Lecture 11 Fall Motivation: TMs without a tape: maybe we can at least fully understand such a simple model?

1.4 Nonregular Languages

Deterministic Finite Automata

CMPSCI 250: Introduction to Computation. Lecture #31: What DFA s Can and Can t Do David Mix Barrington 9 April 2014

Nondeterminism. Nondeterministic Finite Automata. Example: Moves on a Chessboard. Nondeterminism (2) Example: Chessboard (2) Formal NFA

CHAPTER 1 Regular Languages. Contents. definitions, examples, designing, regular operations. Non-deterministic Finite Automata (NFA)

Finite Automata-cont d

Chapter Five: Nondeterministic Finite Automata. Formal Language, chapter 5, slide 1

CS:4330 Theory of Computation Spring Regular Languages. Equivalences between Finite automata and REs. Haniel Barbosa

Non-deterministic Finite Automata

CSCI 340: Computational Models. Kleene s Theorem. Department of Computer Science

Worked out examples Finite Automata

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true.

CSCI FOUNDATIONS OF COMPUTER SCIENCE

Minimal DFA. minimal DFA for L starting from any other

NFAs continued, Closure Properties of Regular Languages

Regular expressions, Finite Automata, transition graphs are all the same!!

Grammar. Languages. Content 5/10/16. Automata and Languages. Regular Languages. Regular Languages

Non-deterministic Finite Automata

Chapter 1, Part 1. Regular Languages. CSC527, Chapter 1, Part 1 c 2012 Mitsunori Ogihara 1

Prefix-Free Subsets of Regular Languages and Descriptional Complexity

a b b a pop push read unread

1.3 Regular Expressions

CMSC 330: Organization of Programming Languages. DFAs, and NFAs, and Regexps (Oh my!)

Some Theory of Computation Exercises Week 1

Harvard University Computer Science 121 Midterm October 23, 2012

CS375: Logic and Theory of Computing

CISC 4090 Theory of Computation

CS 275 Automata and Formal Language Theory

CSCI 340: Computational Models. Transition Graphs. Department of Computer Science

CS 301. Lecture 04 Regular Expressions. Stephen Checkoway. January 29, 2018

Closure Properties of Regular Languages

Speech Recognition Lecture 2: Finite Automata and Finite-State Transducers

Java II Finite Automata I

Agenda. Agenda. Regular Expressions. Examples of Regular Expressions. Regular Expressions (crash course) Computational Linguistics 1

3 Regular expressions

Lecture 09: Myhill-Nerode Theorem

In-depth introduction to main models, concepts of theory of computation:

Lecture 08: Feb. 08, 2019

Section: Other Models of Turing Machines. Definition: Two automata are equivalent if they accept the same language.

Assignment 1 Automata, Languages, and Computability. 1 Finite State Automata and Regular Languages

Homework 3 Solutions

State Minimization for DFAs

Lexical Analysis Finite Automate

Chapter 2 Finite Automata

This lecture covers Chapter 8 of HMU: Properties of CFLs

Fundamentals of Computer Science

NFAs continued, Closure Properties of Regular Languages

Nondeterminism and Nodeterministic Automata

Turing Machines Part One

Today s Topics Automata and Languages

Automata and Languages

Talen en Automaten Test 1, Mon 7 th Dec, h45 17h30

CMSC 330: Organization of Programming Languages

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

80 CHAPTER 2. DFA S, NFA S, REGULAR LANGUAGES. 2.6 Finite State Automata With Output: Transducers

Homework 4. 0 ε 0. (00) ε 0 ε 0 (00) (11) CS 341: Foundations of Computer Science II Prof. Marvin Nakayama

ɛ-closure, Kleene s Theorem,

Normal Forms for Context-free Grammars

Regular languages refresher

Intermediate Math Circles Wednesday, November 14, 2018 Finite Automata II. Nickolas Rollick a b b. a b 4

Converting Regular Expressions to Discrete Finite Automata: A Tutorial

Coalgebra, Lecture 15: Equations for Deterministic Automata

Good-for-Games Automata versus Deterministic Automata.

Speech Recognition Lecture 2: Finite Automata and Finite-State Transducers. Mehryar Mohri Courant Institute and Google Research

Automata Theory 101. Introduction. Outline. Introduction Finite Automata Regular Expressions ω-automata. Ralf Huuck.

Formal Languages and Automata

CS 330 Formal Methods and Models

First Midterm Examination

5. (±±) Λ = fw j w is string of even lengthg [ 00 = f11,00g 7. (11 [ 00)± Λ = fw j w egins with either 11 or 00g 8. (0 [ ffl)1 Λ = 01 Λ [ 1 Λ 9.

Revision Sheet. (a) Give a regular expression for each of the following languages:

Kleene s Theorem. Kleene s Theorem. Kleene s Theorem. Kleene s Theorem. Kleene s Theorem. Kleene s Theorem 2/16/15

Probabilistic Model Checking Michaelmas Term Dr. Dave Parker. Department of Computer Science University of Oxford

Scanner. Specifying patterns. Specifying patterns. Operations on languages. A scanner must recognize the units of syntax Some parts are easy:

E 1 (n) = E 0 (n-1) E 0 (n) = E 0 (n-1)+e 0 (n-2) T(n -1)=2E 0 (n-2) + E 0 (n-3)

Transcription:

Deterministic Finite-Stte Automt Deepk D Souz Deprtment of Computer Science nd Automtion Indin Institute of Science, Bnglore. 12 August 2013

Outline 1 Introduction 2

Exmple DFA 1 DFA for Odd number of s b b How DFA works.

Exmple DFA 1 DFA for Odd number of s b b e o How DFA works. Ech stte represents property of the input string red so fr: Stte e: Number of s seen is even. Stte o: Number of s seen is odd.

Exmple DFA 2 DFA for Contins the substring bb b, b b b Ech stte represents property of the input string red so fr:

Exmple DFA 2 DFA for Contins the substring bb b b b, b ɛ b bb Ech stte represents property of the input string red so fr: Stte ɛ: Not seen bb nd no suffix in or b. Stte : Not seen bb nd hs suffix. Stte b: Not seen bb nd hs suffix b. Stte bb: Seen bb.

Exmple DFA 3 Accept strings over {0, 1} which stisfy even prity in length 4 blocks. Accept 0101 1010 Reject 0101 1011 DFA for Even prity checker 0 1, e 0 2, e 0 3, e 0, e 0 1 1 1 1 1 1 0 0, o 0, 1 1, o 0 2, o 0 3, o 1

Exmple DFA 4 Accept strings over {, b, /, } which don t end inside C-style comment. Scn from left to right till first /* is encountered; from there to next */ is first comment; nd so on. Accept b/ /bb nd b/ / /bb /. Reject b/ nd b/ / /bb/.

Exmple DFA 4 Accept strings over {, b, /, } which don t end inside C-style comment. Scn from left to right till first /* is encountered; from there to next */ is first comment; nd so on. Accept b/ /bb nd b/ / /bb /. Reject b/ nd b/ / /bb/. DFA for C-comment trcker /, /, / / out pbc in pec

Definitions nd nottion An lphbet is finite set of set of symbols or letters. Eg. A = {, b, c}, Σ = {0, 1}. A string or word over n lphbet A is finite sequence of letters from A. Eg. b is string over {, b, c}. Empty string denoted by ɛ. Set of ll strings over A denoted by A. Wht is the size or crdinlity of A?

Definitions nd nottion An lphbet is finite set of set of symbols or letters. Eg. A = {, b, c}, Σ = {0, 1}. A string or word over n lphbet A is finite sequence of letters from A. Eg. b is string over {, b, c}. Empty string denoted by ɛ. Set of ll strings over A denoted by A. Wht is the size or crdinlity of A? Infinite but Countble: Cn enumerte in lexicogrphic order:. ɛ,, b, c,, b,...

Definitions nd nottion An lphbet is finite set of set of symbols or letters. Eg. A = {, b, c}, Σ = {0, 1}. A string or word over n lphbet A is finite sequence of letters from A. Eg. b is string over {, b, c}. Empty string denoted by ɛ. Set of ll strings over A denoted by A. Wht is the size or crdinlity of A? Infinite but Countble: Cn enumerte in lexicogrphic order: ɛ,, b, c,, b,.... Opertion of conctention on words: String u followed by string v: written u v or simply uv. Eg. bb = bb.

Definitions nd nottion: Lnguges A lnguge over n lphbet A is set of strings over A. Eg. for A = {, b, c}: L = {bc, b}. L 1 = {ɛ, b,, bb, b, b, b, bbb,...}. L 2 = {}. L 3 = {ɛ}. How mny lnguges re there over given lphbet A?

Definitions nd nottion: Lnguges A lnguge over n lphbet A is set of strings over A. Eg. for A = {, b, c}: L = {bc, b}. L 1 = {ɛ, b,, bb, b, b, b, bbb,...}. L 2 = {}. L 3 = {ɛ}. How mny lnguges re there over given lphbet A? Uncountbly infinite Use digonliztion rgument: ɛ b b b bb b b bb bbb L 0 0 1 0 0 0 1 1 0 0 0 0 0 L 1 0 0 0 0 0 0 0 0 0 0 0 0 L 2 1 1 0 1 0 1 1 0 0 1 0 1 L 3 0 0 0 0 0 0 0 0 0 0 0 0 L 4 0 1 0 0 0 1 1 0 0 0 0 0 L 5 1 1 0 1 0 1 1 0 0 1 0 1 L 6 0 1 0 0 0 1 1 0 0 0 0 0 L 7 0 0 0 0 0 0 1 0 0 0 1 0.

Definitions nd nottion: Lnguges Conctention of lnguges: L 1 L 2 = {u v u L 1, v L 2 }. Eg. {bc, b} {ɛ,, bb} = {bc, b, bc, b, bcbb, bbb}.

Definitions nd nottion: DFA A Deterministic Finite-Stte Automton A over n lphbet A is structure of the form (Q, s, δ, F ) where Q is finite set of sttes s Q is the strt stte δ : Q A Q is the trnsition function. F Q is the set of finl sttes.

Definitions nd nottion: DFA A Deterministic Finite-Stte Automton A over n lphbet A is structure of the form (Q, s, δ, F ) where Q is finite set of sttes s Q is the strt stte δ : Q A Q is the trnsition function. F Q is the set of finl sttes. Exmple of Odd s DFA: Here: Q = {e, o}, s = e, F = {o}, nd δ is given by: δ(e, ) = o, δ(e, b) = e, δ(o, ) = e, δ(o, b) = o. b e b o

Definitions nd nottion: Lnguge ccepted by DFA δ tells us how the DFA A behves on given word u. Define δ : Q A Q s δ(q, ɛ) = q δ(q, w ) = δ( δ(q, w), ). Lnguge ccepted by A, denoted L(A), is defined s: L(A) = {w A δ(s, w) F }. Eg. For A = DFA for Odd s, L(A) = {, b, b,, bb, bb, bb,...}.

Regulr Lnguges A lnguge L A is clled regulr if there is DFA A over A such tht L(A) = L. Exmples of regulr lnguges: Odd s, strings tht don t end inside C-style comment, {}, ny finite lnguge. All lnguges over A Regulr Are there non-regulr lnguges?

Regulr Lnguges A lnguge L A is clled regulr if there is DFA A over A such tht L(A) = L. Exmples of regulr lnguges: Odd s, strings tht don t end inside C-style comment, {}, ny finite lnguge. All lnguges over A Regulr Are there non-regulr lnguges? Yes, uncountbly mny, since Reg is only countble while clss of ll lnguges is uncountble.