REGULAR LANGUAGES.

Slides:



Advertisements
Similar presentations
Non-Deterministic Finite Automata
Advertisements

CSE 311 Foundations of Computing I
CSC 361NFA vs. DFA1. CSC 361NFA vs. DFA2 NFAs vs. DFAs NFAs can be constructed from DFAs using transitions: Called NFA- Suppose M 1 accepts L 1, M 2 accepts.
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
Nondeterministic Finite Automata CS 130: Theory of Computation HMU textbook, Chapter 2 (Sec 2.3 & 2.5)
1 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 3 School of Innovation, Design and Engineering Mälardalen University 2012.
Introduction to Computability Theory
Finite Automata Great Theoretical Ideas In Computer Science Anupam Gupta Danny Sleator CS Fall 2010 Lecture 20Oct 28, 2010Carnegie Mellon University.
1 Introduction to Computability Theory Lecture2: Non Deterministic Finite Automata Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture3: Regular Expressions Prof. Amos Israeli.
Introduction to Computability Theory
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
Courtesy Costas Busch - RPI1 Non Deterministic Automata.
1 Introduction to Computability Theory Lecture2: Non Deterministic Finite Automata (cont.) Prof. Amos Israeli.
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.
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.
Fall 2006Costas Busch - RPI1 Non-Deterministic Finite Automata.
CS5371 Theory of Computation Lecture 4: Automata Theory II (DFA = NFA, Regular Language)
1 Non-Deterministic Automata Regular Expressions.
1 Regular Languages Finite Automata eg. Supermarket automatic door: exit or entrance.
Introduction to Finite Automata Adapted from the slides of Stanford CS154.
Fall 2004COMP 3351 Another NFA Example. Fall 2004COMP 3352 Language accepted (redundant state)
Costas Busch - LSU1 Non-Deterministic Finite Automata.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
1 Non-Deterministic Finite Automata. 2 Alphabet = Nondeterministic Finite Automaton (NFA)
Nondeterministic Finite Automata CS 130: Theory of Computation HMU textbook, Chapter 2 (Sec 2.3 & 2.5)
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
1 Unit 1: Automata Theory and Formal Languages Readings 1, 2.2, 2.3.
Theory of Languages and Automata
Theory of Computation, Feodor F. Dragan, Kent State University 1 Regular expressions: definition An algebraic equivalent to finite automata. We can build.
By: Er. Sukhwinder kaur.  What is Automata Theory? What is Automata Theory?  Alphabet and Strings Alphabet and Strings  Empty String Empty String 
Lecture 05: Theory of Automata:08 Kleene’s Theorem and NFA.
4b 4b Lexical analysis Finite Automata. Finite Automata (FA) FA also called Finite State Machine (FSM) –Abstract model of a computing entity. –Decides.
Prof. Busch - LSU1 NFAs accept the Regular Languages.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University 2010.
CHAPTER 1 Regular Languages
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.
CS 208: Computing Theory Assoc. Prof. Dr. Brahim Hnich Faculty of Computer Sciences Izmir University of Economics.
INHERENT LIMITATIONS OF COMPUTER PROGAMS CSci 4011.
Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1 Chapter 1 Regular Languages Some slides are in courtesy.
Finite Automata Chapter 1. Automatic Door Example Top View.
Nondeterministic Finite Automata (NFAs). Reminder: Deterministic Finite Automata (DFA) q For every state q in Q and every character  in , one and only.
Chapter 5 Finite Automata Finite State Automata n Capable of recognizing numerous symbol patterns, the class of regular languages n Suitable for.
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen.
Theory of Computation Automata Theory Dr. Ayman Srour.
1/29/02CSE460 - MSU1 Nondeterminism-NFA Section 4.1 of Martin Textbook CSE460 – Computability & Formal Language Theory Comp. Science & Engineering Michigan.
Theory of Computation Automata Theory Dr. Ayman Srour.
Theory of Computation Automata Theory Dr. Ayman Srour.
Non Deterministic Automata
Finite Automata a b A simplest computational model
Finite Automata & Regular Languages
CSC 4170 Theory of Computation Nondeterminism Section 1.2.
Non-Deterministic Finite Automata
COSC 3340: Introduction to Theory of Computation
Non-Deterministic Finite Automata
CSE322 Definition and description of finite Automata
Nondeterministic Finite Automata
Non Deterministic Automata
CSC 4170 Theory of Computation Nondeterminism Section 1.2.
Chapter 1 Regular Language
CHAPTER 1 Regular Languages
CSCI 2670 Introduction to Theory of Computing
Nondeterminism The Chinese University of Hong Kong Fall 2010
Presentation transcript:

REGULAR LANGUAGES

FINITE AUTOMATA Finite automata are good models for computers with an extremely limited amount of memory. The controller for an automatic door is one example of such a device. The controller is in either of two states: "OPEN" or "CLOSED,"

State transition table ? F R B Closed Open

figure State End state arrow State transition table ? input State

Finite automaton It has three states, labeled ql, q2, and q3. The start state, q1, is indicated by the arrow pointing at it from nowhere. The accept state, q2, is the one with a double circle. The arrows going from one state to another are called transitions.

For example, when we feed the input string 1101 to the machine (state diagram), the processing proceeds as follows. Start in state q1. 2. Read 1, follow transition from q1 to q2. 3. Read 1, follow transition from q2 to q2. 4. Read 0, follow transition from q2 to q3. 5. Read 1, follow transition from q3 to q2- 6. Accept because Machine is in an accept state q2 at the end of the input.

FORMAL DEFINITION OF A FINITE AUTOMATON

Case M1

Case M1

EXAMPLES OF FINITE AUTOMATA Case M2

EXAMPLES OF FINITE AUTOMATA Case M2

REGULAR LANGUAGES

DESIGNING FINITE AUTOMATA you want to construct a finite automaton to recognize (the/a) language. you have determined the necessary information For example, suppose that the alphabet is { 0,1 } and that the language consists of all strings with an odd number of 1’s. You want to construct a finite automaton E1 to recognize this language.

1’s (even or odd)? Formal description????? Final state??????

THE REGULAR OPERATIONS In arithmetic, the basic objects are numbers and the tools are operations for manipulating them, such as + and x. In the theory of computation the objects are languages and the tools include operations specifically designed for manipulating them.

THE REGULAR OPERATIONS (cont.)

NON DETERMINISM/ DETERMINISM In a nondeterministic machine, several choices may exist for the next state at any point. Nondeterminism is a generalization of determinism. Deterministic computation - when the machine is in a given state and reads the next input symbol, we know what the next state will be-it is determined.

NON DETERMINISM/ DETERMINISM (cont.) The difference between a deterministic finite automaton, abbreviated DFA, and a nondeterministic finite automaton NFA: 1. every state of a DFA always has exactly one exiting transition arrow for each symbol in the alphabet. 2. in a DFA, labels on the transition arrows are symbols from the alphabet. This NFA has an arrow with the label є. 3. Nondeterminism may be viewed as a kind of parallel computation.

NON DETERMINISM/ DETERMINISM (cont.) If a state with an є symbol on an exiting arrow is encountered, something similar happens. Without reading any input, the machine splits into multiple copies, one following each of the exiting є -labeled arrows and one staying at the current state.

The nondeterministic finite automaton

The computation of input 010110

EXAMPLE 1.30. (homework??)

FORMAL DEFINITION OF A NONDETERMINISTIC FINITE AUTOMATON

FORMAL DEFINITION OF A NONDETERMINISTIC FINITE AUTOMATON

FORMAL DEFINITION OF A NONDETERMINISTIC FINITE AUTOMATON The following example explains a NFA M, with a binary alphabet, which determines if the input contains an even number of 0s or an even number of 1s. (Note that 0 occurrences is an even number of occurrences as well.) Let M = (Q, Σ, T, s0, F). Describe the formal description? Describe state transition table? Describe the state diagram?

FORMAL DEFINITION OF A NONDETERMINISTIC FINITE AUTOMATON Formal description: Σ = {0, 1}, Q = {s0, s1, s2, s3, s4}, E({s0}) = { s0, s1, s3 } F = {s1, s3}, and The transition function T can be defined by this state transition table.

state diagram 1 The input contains an even number of 0s

state diagram 2 The input contains an even number of 1s

state diagram 1+2

state diagram 1+2

NFA An NFA for a language can be smaller and easier to construct than a DFA Strings whose next-to-last symbol is 1: DFA: NFA:

EQUIVALENCE OF NFAS AND DFAS NFAS AND DFAS machines are equivalent if they recognize the same language. THEOREM 1.39 Every nondeterministic finite automaton has an equivalent deterministic finite automaton

PROOF IDEA How would you simulate the NFA if you were pretending to be a DFA? What do you need to keep track of as the input string is processed? In the examples of NFAs you kept track of the various branches of the computation by placing a finger on each state that could be active at given points in the input. You updated the simulation by moving, adding, and removing fingers according to the way the NFA operates. All you needed to keep track of was the set of states having fingers on them.

REGULAR EXPRESSIONS In arithmetic, we can use the operations + and x to build up expressions such as (5 + 3) x 4. Similarly, we can use the regular operations to build up expressions describing languages, which are called regular expressions. An example is: (O U 1)0*.

NONREGULAR LANGUAGES Home Work