CS5371 Theory of Computation

Slides:



Advertisements
Similar presentations
4b Lexical analysis Finite Automata
Advertisements

CS 208: Computing Theory Assoc. Prof. Dr. Brahim Hnich Faculty of Computer Sciences Izmir University of Economics.
Complexity and Computability Theory I Lecture #4 Rina Zviel-Girshin Leah Epstein Winter
CSE 105 Theory of Computation Alexander Tsiatas Spring 2012 Theory of Computation Lecture Slides by Alexander Tsiatas is licensed under a Creative Commons.
YES-NO machines Finite State Automata as language recognizers.
Chapter Two: Finite Automata
Finite Automata Section 1.1 CSC 4170 Theory of Computation.
CS21 Decidability and Tractability
NFAs Sipser 1.2 (pages 47–54). CS 311 Fall Recall… Last time we showed that the class of regular languages is closed under: –Complement –Union.
Finite Automata Great Theoretical Ideas In Computer Science Anupam Gupta Danny Sleator CS Fall 2010 Lecture 20Oct 28, 2010Carnegie Mellon University.
Intro to DFAs Readings: Sipser 1.1 (pages 31-44) With basic background from Sipser 0.
NFAs Sipser 1.2 (pages 47–54). CS 311 Mount Holyoke College 2 Recall… Last time we showed that the class of regular languages is closed under: –Complement.
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.
Courtesy Costas Busch - RPI1 Non Deterministic Automata.
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.
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...
Automata & Formal Languages, Feodor F. Dragan, Kent State University 1 CHAPTER 1 Regular Languages Contents Finite Automata (FA or DFA) definitions, examples,
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Nondeterminism.
CS5371 Theory of Computation Lecture 6: Automata Theory IV (Regular Expression = NFA = DFA)
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.
CS5371 Theory of Computation Lecture 4: Automata Theory II (DFA = NFA, Regular Language)
Topics Automata Theory Grammars and Languages Complexities
Introduction to Finite Automata Adapted from the slides of Stanford CS154.
1.Defs. a)Finite Automaton: A Finite Automaton ( FA ) has finite set of ‘states’ ( Q={q 0, q 1, q 2, ….. ) and its ‘control’ moves from state to state.
1 Non-Deterministic Finite Automata. 2 Alphabet = Nondeterministic Finite Automaton (NFA)
Rosen 5th ed., ch. 11 Ref: Wikipedia
Lecture 23: Finite State Machines with no Outputs Acceptors & Recognizers.
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
REGULAR LANGUAGES.
By: Er. Sukhwinder kaur.  What is Automata Theory? What is Automata Theory?  Alphabet and Strings Alphabet and Strings  Empty String Empty String 
4b 4b Lexical analysis Finite Automata. Finite Automata (FA) FA also called Finite State Machine (FSM) –Abstract model of a computing entity. –Decides.
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.
Formal Definition of Computation Let M = (Q, ∑, δ, q 0, F) be a finite automaton and let w = w 1 w w n be a string where each wi is a member of the.
Deterministic Finite Automata CS 130: Theory of Computation HMU textbook, Chapter 2 (Sec 2.2)
CS 208: Computing Theory Assoc. Prof. Dr. Brahim Hnich Faculty of Computer Sciences Izmir University of Economics.
Lecture Notes 
Nondeterministic Finite Automata (NFAs). Reminder: Deterministic Finite Automata (DFA) q For every state q in Q and every character  in , one and only.
Finite Automata Great Theoretical Ideas In Computer Science Victor Adamchik Danny Sleator CS Spring 2010 Lecture 20Mar 30, 2010Carnegie Mellon.
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen.
Lecture #4 Thinking of designing an abstract machine acts as finite automata. Advanced Computation Theory.
Lecture #5 Advanced Computation Theory Finite Automata.
Theory of Computation Automata Theory Dr. Ayman Srour.
  An alphabet is any finite set of symbols.  Examples: ASCII, Unicode, {0,1} ( binary alphabet ), {a,b,c}. Alphabets.
Theory of Computation Automata Theory Dr. Ayman Srour.
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.
Finite Automata.
Nondeterminism The Chinese University of Hong Kong Fall 2011
Lexical analysis Finite Automata
Lecture2 Regular Language
Non Deterministic Automata
Deterministic Finite Automata
Nondeterministic Finite Automata
Finite Automata & Regular Languages
Deterministic Finite Automata
Non-Deterministic Finite Automata
Chapter Two: Finite Automata
COSC 3340: Introduction to Theory of Computation
CSE322 Definition and description of finite Automata
Non Deterministic Automata
Finite Automata.
4b Lexical analysis Finite Automata
Chapter Five: Nondeterministic Finite Automata
4b Lexical analysis Finite Automata
Chapter 1 Regular Language
Non Deterministic Automata
Presentation transcript:

CS5371 Theory of Computation Lecture 3: Automata Theory I (DFA and NFA)

Objectives This time, we will look at how to define a very simple “computer” called deterministic finite automaton (DFA) Show that DFA can solve some string decision problem Then, we slightly change the definition of DFA to give another computer called non-deterministic finite automaton (NFA)

DFA Input String Acceptor Reject DFA A machine with finite number of states, some states are accepting states, others are rejecting states At any time, it is in one of the states It reads an input string, one character at a time

DFA Input String Acceptor Reject DFA After reading each character, it moves to another state depending on what is read and what is the current state If reading all characters, the DFA is in an accepting state, the input string is accepted. Otherwise, the input string is rejected.

Example of DFA The circles indicates the states q1 q2 0,1 start The circles indicates the states Its accepting state is marked with double circle The arrows pointing from a state q indicates how to move on reading a character when current state is q

Formal Definition of DFA A DFA is a 5-tuple (Q, , , qstart, F), where Q is a set consisting finite number of states  is an alphabet consisting finite number of characters : Q x   Q is the transition function qstart is the start state F is the set of accepting states Note: only 1 start state, and can have many accepting states

Formal Definition of DFA q1 q2 0,1 start Q = {q1, q2 },  = { 0, 1 }, qstart = q1, F = { q2 } (q1, 0) = q2, (q1, 1) = q2 (q2, 0) = q1, (q2, 1) = q1

Formal Definition of DFA’s Computation Recall how a DFA performs its computation (to decide whether an input string is accepted or rejected): If after reading the whole string, DFA is in an accepting state, then the input string is accepted; otherwise the input string is rejected How to define this formally??

Formal Definition of Computation Let M = (Q, , , qstart, F) be a DFA Let w = w1 w2 … wn be a string with each wi a member of the alphabet  Then, M accepts w if a sequence of states r0, r1, …, rn in Q exists with the three conditions: r0 = qstart (ri, wi+1) = ri+1 rn 2 F

Some Terminology Let M be a DFA Among all possible strings, M will accept some of them, and M will reject the remaining The set of strings which M accepts is called the language recognized by M That is, M recognizes A if A = { w | M accepts w }

Thinking What is an alphabet? What is a language? What are the min and max numbers of strings a DFA can accept? What are the min and max numbers of languages a DFA can recognize?

Designing a DFA [Example 1] How to design a DFA that accepts all binary strings that represent an even number? (e.g., accepts 110, 010, but rejects 111, 010101) Let’s pretend ourselves as a DFA… After reading a character, we must decide whether the string seen so far is in the language (what is the language we’re talking now??) because we don’t know if it is the last character…

Designing a DFA Answer: 1 1 qeven qodd start

Designing a DFA How to design a DFA that accepts all binary strings representing a multiple of 5? (E.g., 101, 1111, 11001, …) ?

NFA Every step of DFA’s computation follows in a unique way from the preceding step When a machine is in a given state, and reads the next input character, we know what the next state is In an NFA, several choices may exist for the next state

Example of NFA Difference with DFA q1 q4 0,1 0,  start q2 q3 1 Can move to more than 1 states, or nowhere, after reading a character (E.g., at q1, on reading 1, we can move to q1 or q2; at q2, on reading 1, nowhere to go!) Can move to another state without reading anything (E.g., at q2, the symbol  on arrow pointing at q3 indicates that we can move to q3 without reading anything)

What is accepted by NFA? Let M be an NFA (Informally,) M accepts a string w if there is at least one way to move from the start state to a final state according to the transition arrows, such that the concatenation of the true characters (that is, ignoring ) used by the transition is equal to w

What is accepted by this? q1 q4 0,1 0,  start q2 q3 1