Lecture2 Regular Language

Slides:



Advertisements
Similar presentations
CS 208: Computing Theory Assoc. Prof. Dr. Brahim Hnich Faculty of Computer Sciences Izmir University of Economics.
Advertisements

YES-NO machines Finite State Automata as language recognizers.
1 Languages. 2 A language is a set of strings String: A sequence of letters Examples: “cat”, “dog”, “house”, … Defined over an alphabet: Languages.
Finite Automata Section 1.1 CSC 4170 Theory of Computation.
Intro to DFAs Readings: Sipser 1.1 (pages 31-44) With basic background from Sipser 0.
Intro to DFAs Readings: Sipser 1.1 (pages 31-44) With basic background from Sipser 0.
Lecture 3UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 3.
Finite Automata and Non Determinism
CS5371 Theory of Computation
Finite Automata Finite-state machine with no output. FA consists of States, Transitions between states FA is a 5-tuple Example! A string x is recognized.
Fall 2006Costas Busch - RPI1 Deterministic Finite Automata And Regular Languages.
Lecture 3 Goals: Formal definition of NFA, acceptance of a string by an NFA, computation tree associated with a string. Algorithm to convert an NFA to.
1 Languages and Finite Automata or how to talk to machines...
CS 310 – Fall 2006 Pacific University CS310 Finite Automata Sections: September 1, 2006.
Automata & Formal Languages, Feodor F. Dragan, Kent State University 1 CHAPTER 1 Regular Languages Contents Finite Automata (FA or DFA) definitions, examples,
Lecture 3 Goals: Formal definition of NFA, acceptance of a string by an NFA, computation tree associated with a string. Algorithm to convert an NFA to.
Foundations of (Theoretical) Computer Science Chapter 1 Lecture Notes (Section 1.1: DFA’s) David Martin With some modifications.
Finite Automata Costas Busch - RPI.
Nondeterminism (Deterministic) FA required for every state q and every symbol  of the alphabet to have exactly one arrow out of q labeled . What happens.
Regular Languages A language is regular over  if it can be built from ;, {  }, and { a } for every a 2 , using operators union ( [ ), concatenation.
Rosen 5th ed., ch. 11 Ref: Wikipedia
Lecture 2UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 2.
CSCI 2670 Introduction to Theory of Computing August 24, 2005.
REGULAR LANGUAGES.
Theory of Languages and Automata
Fall 2006Costas Busch - RPI1 Deterministic Finite Automaton (DFA) Input Tape “Accept” or “Reject” String Finite Automaton Output.
Languages Given an alphabet , we can make a word or string by concatenating the letters of . Concatenation of “x” and “y” is “xy” Typical example: 
Finite Automata – Definition and Examples Lecture 6 Section 1.1 Mon, Sep 3, 2007.
Modeling Computation: Finite State Machines without Output
Lecture Notes 
Transparency No. 2-1 Formal Language and Automata Theory Homework 2.
 2004 SDU Lecture4 Regular Expressions.  2004 SDU 2 Regular expressions A third way to view regular languages. Say that R is a regular expression if.
Costas Busch - LSU1 Deterministic Finite Automata And Regular Languages.
Theory of Computation Automata Theory Dr. Ayman Srour.
Theory of Languages and Automata By: Mojtaba Khezrian.
Fall 2004COMP 3351 Finite Automata. Fall 2004COMP 3352 Finite Automaton Input String Output String Finite Automaton.
Deterministic Finite-State Machine (or Deterministic Finite Automaton) A DFA is a 5-tuple, (S, Σ, T, s, A), consisting of: S: a finite set of states Σ:
Lecture Three: Finite Automata Finite Automata, Lecture 3, slide 1 Amjad Ali.
Introduction to Automata Theory Theory of Computation Lecture 3 Tasneem Ghnaimat.
Foundations of Computing Science
Languages.
Non Deterministic Automata
Deterministic Turing Machines
CSE 105 theory of computation
Pushdown Automata PDAs
Pushdown Automata PDAs
Deterministic Finite Automata
COSC 3340: Introduction to Theory of Computation
Nondeterministic Finite Automata
Finite Automata & Regular Languages
COSC 3340: Introduction to Theory of Computation
Deterministic Finite Automata
CSC 4170 Theory of Computation Nondeterminism Section 1.2.
Deterministic Finite Automata And Regular Languages Prof. Busch - LSU.
Non-Deterministic Finite Automata
COSC 3340: Introduction to Theory of Computation
Deterministic Finite State Automata
CSE322 Definition and description of finite Automata
Non Deterministic Automata
Finite Automata.
Deterministic Finite Automaton (DFA)
CSC 4170 Theory of Computation Nondeterminism Section 1.2.
Chapter 1 Regular Language
CSC 4170 Theory of Computation Finite Automata Section 1.1.
AUTOMATA THEORY.
Chapter # 5 by Cohen (Cont…)
CSE 105 theory of computation
Languages Given an alphabet , we can make a word or string by concatenating the letters of . Concatenation of “x” and “y” is “xy” Typical example: ={0,1},
CSE 105 theory of computation
Presentation transcript:

Lecture2 Regular Language  2004 SDU

DFA –deterministic finite automaton A DFA has: a finite set of states 1 special state – start (initial) state 0 or more special states - final (accept) states input alphabet transition table: (state, symbol)  next state q s q4 p a r (p, a) -> r  2004 SDU 2

Informally -- How does a DFA work? q1 a DFA begins in the start state. DFA goes into a loop until the entire input string is read. In each step, DFA consults a transition table and changes its state based on (q, a) where q - current state a – current symbol read After reading the input string, if the state is final, the input is accepted if the state is not final, the input is rejected Language recognized by a DFA or the language of a DFA – the set of all the strings accepted by the DFA.  2004 SDU 3

Pictorial representation of DFA state q Start state s Final state q4 transition p a r (p, a) -> r  2004 SDU 4

DFA Demo b b a b a a b b a b b a a a b b b Y N N 1 2  2004 SDU 5 1 2 b multiple of 3 b's b b a b a a b b a b b  2004 SDU 5 5

DFA Demo b a b a a b b a b b a a a b b b Y N N 1 2  2004 SDU 6 1 2 b multiple of 3 b's b a b a a b b a b b  2004 SDU 6 6

DFA Demo b a a a b b a b b a a a b b b Y N N 1 2  2004 SDU 7 1 2 b multiple of 3 b's b a a a b b a b b  2004 SDU 7 7

DFA Demo b a a b b a b b a a a b b b Y N N 1 2  2004 SDU 8 1 2 b multiple of 3 b's b a a b b a b b  2004 SDU 8 8

DFA Demo b a b b a b b a a a b b b Y N N 1 2  2004 SDU 9 1 2 b multiple of 3 b's b a b b a b b  2004 SDU 9 9

DFA Demo b a b a b b a a a b b b Y N N 1 2  2004 SDU 10 1 2 b multiple of 3 b's b a b a b b  2004 SDU 10 10

DFA Demo b a a b b a a a b b b Y N N 1 2  2004 SDU 11 1 2 b multiple of 3 b's b a a b b  2004 SDU 11 11

DFA Demo b a b b a a a b b b Y N N 1 2  2004 SDU 12 multiple of 3 b's 1 2 b multiple of 3 b's b a b b  2004 SDU 12 12

DFA Demo b a b a a a b b b Y N N 1 2  2004 SDU 13 multiple of 3 b's 1 2 b multiple of 3 b's b a b  2004 SDU 13 13

DFA Demo ACCEPT b a a a a b b b Y N N 1 2  2004 SDU 14 1 2 ACCEPT b multiple of 3 b's b a  2004 SDU 14 14

DFA Demo b a b b a a b b a a a b b b Y N N 1 2  2004 SDU 15 1 2 b multiple of 3 b's b a b b a a b b  2004 SDU 15 15

DFA Demo b a b a a b b a a a b b b Y N N 1 2  2004 SDU 16 1 2 b multiple of 3 b's b a b a a b b  2004 SDU 16 16

DFA Demo b a a a b b a a a b b b Y N N 1 2  2004 SDU 17 1 2 b multiple of 3 b's b a a a b b  2004 SDU 17 17

DFA Demo b a a b b a a a b b b Y N N 1 2  2004 SDU 18 1 2 b multiple of 3 b's b a a b b  2004 SDU 18 18

DFA Demo b a b b a a a b b b Y N N 1 2  2004 SDU 19 multiple of 3 b's 1 2 b multiple of 3 b's b a b b  2004 SDU 19 19

DFA Demo b a b a a a b b b Y N N 1 2  2004 SDU 20 multiple of 3 b's 1 2 b multiple of 3 b's b a b  2004 SDU 20 20

DFA Demo REJECT b a a a a b b b Y N N 1 2  2004 SDU 21 1 2 REJECT b multiple of 3 b's b a  2004 SDU 21 21

Example: Diagram of DFA q0 q1 a  2004 SDU 22

Step-By-Step a q0 q1 a aaa  2004 SDU 23

Step-By-Step a q0 q1 a aaa  2004 SDU 24

Step-By-Step a q0 q1 a aaa  2004 SDU 25

Step-By-Step a q0 q1 a aaa The string is accepted  2004 SDU 26

Formal definition of DFA A DFA is a 5-tuple: M = (Q, , , s, F) Where, Q is a finite set of states  is a finite set of input alphabet s  Q is the start state F  Q is the set of final states : Q   -> Q is the transition function // note that this is a function, so, for each state and each symbol, there is an arrow that points to another state.  2004 SDU 27

Formal definition of Computation Let M = (Q, , , s, F) be a finite automaton and let w = w1w2…wn be a string where each wi is a member of the alphabet . M accepts w if there is a sequence of states r0, r1, …, rn such that 1)r0 = s, 2)(ri, wi+1) = ri+1, for i=0, …, n-1. 3) rn F We say that M recognizes language A if A = {w | M accepts w}. Note that the language recognized by a DFA M (or the language of a DFA M) is unique! We write it as L(M). What is language of the following machine? Its formal description? q0 q1 a  2004 SDU 28

Regular Languages Definition: A Language is called regular if some DFA recognizes it.  2004 SDU 29

Given a language, how to define DFA? Creative process requiring you to: (i) Put yourself in DFA's shoes (ii) Find finite amount of info, based on which string accepted/rejected (iii) From step (ii), determine number of states and then transitions.  2004 SDU 30

Examples L = {w | w begins with a 0 and ends with a 1} 1 1 q0 q1 q2 1 1 q0 q1 q2 1 r 0,1  2004 SDU 31

Examples (cont.) L = {w | w contains the substring 101 } 0,1 1 1 1 s 1 1 1 1 s 1 10 101 More in exercises  2004 SDU 32