Theory of Languages and Automata By: Mojtaba Khezrian.

Slides:



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

Nondeterministic Finite Automata CS 130: Theory of Computation HMU textbook, Chapter 2 (Sec 2.3 & 2.5)
YES-NO machines Finite State Automata as language recognizers.
FORMAL LANGUAGES, AUTOMATA, AND COMPUTABILITY
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.
1 Introduction to Computability Theory Lecture3: Regular Expressions Prof. Amos Israeli.
Lecture 3UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 3.
1 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY (For next time: Read Chapter 1.3 of the book)
Finite Automata and Non Determinism
CS5371 Theory of Computation
Introduction to the Theory of Computation John Paxton Montana State University Summer 2003.
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,
CS5371 Theory of Computation Lecture 6: Automata Theory IV (Regular Expression = NFA = DFA)
FSA Lecture 1 Finite State Machines. Creating a Automaton  Given a language L over an alphabet , design a deterministic finite automaton (DFA) M such.
1 Regular Languages Finite Automata eg. Supermarket automatic door: exit or entrance.
Topics Automata Theory Grammars and Languages Complexities
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
Regular Languages A language is regular over  if it can be built from ;, {  }, and { a } for every a 2 , using operators union ( [ ), concatenation.
CS490 Presentation: Automata & Language Theory Thong Lam Ran Shi.
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
REGULAR LANGUAGES.
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.
Introduction to CS Theory Lecture 3 – Regular Languages Piotr Faliszewski
1 For each language, give a regular expression that generates the language and a DFA that accepts it. L 1 = { w  {0, 1}* : has both 00 and 11 as substrings}
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: 
CHAPTER 1 Regular Languages
INHERENT LIMITATIONS OF COMPUTER PROGAMS CSci 4011.
1 For each language, give a DFA that accepts it. L 1 = { w  {a, b}* : w at most 2 a’s} L 2 = { w  {0, 1}* : has both 00 and 11 as substrings} L 3 = {
1.2 Three Basic Concepts Languages start variables Grammars Let us see a grammar for English. Typically, we are told “a sentence can Consist.
1 Introduction to the Theory of Computation Regular Expressions.
Regular Languages Chapter 1 Giorgi Japaridze Theory of Computability.
Theory of Computation Automata Theory Dr. Ayman Srour.
Theory of Languages and Automata By: Mojtaba Khezrian.
Theory of Computation Automata Theory Dr. Ayman Srour.
Theory of Computation Automata Theory Dr. Ayman Srour.
Nondeterminism The Chinese University of Hong Kong Fall 2011
Language Recognition MSU CSE 260.
Foundations of Computing Science
Lecture2 Regular Language
L1= { w  {a,b}* : w consists of all strings that begin with an even number of a's followed by an odd number of b's. } L2= { w  {a,b}* : the number of.
Theory of Languages and Automata
Natural Language Processing - Formal Language -
CSE 105 theory of computation
CS314 – Section 5 Recitation 3
Regular Expressions Sections:1.3 page 63 September 17, 2008
Finite Automata & Regular Languages
Jaya Krishna, M.Tech, Assistant Professor
REGULAR LANGUAGES AND REGULAR GRAMMARS
COT 4210 Lecture Notes - 3 By Njegos and Monika.
Deterministic Finite Automata And Regular Languages Prof. Busch - LSU.
Non-Deterministic Finite Automata
CS 154, Lecture 3: DFANFA, Regular Expressions.
COSC 3340: Introduction to Theory of Computation
Context-Free Grammars
CS 350 — Fall 2018 gilray.org/classes/fall2018/cs350/
NFAs and Transition Graphs
Chapter Five: Nondeterministic Finite Automata
FORMAL LANGUAGES, AUTOMATA, AND COMPUTABILITY
CSCI 2670 Introduction to Theory of Computing
CS21 Decidability and Tractability
CSE 105 theory of computation
Chapter 1 Regular Language
CSCI 2670 Introduction to Theory of Computing
NFAs and Transition Graphs
CHAPTER 1 Regular Languages
Non Deterministic Automata
CSE 105 theory of computation
Presentation transcript:

Theory of Languages and Automata By: Mojtaba Khezrian

Theory of Languages and Automata By Dr. Khezrian 2 Review Alphabetic ……. {0,1} String ….. x=‘101010’ Length of String ….. |x| Language Union Intersection Concat

Theory of Languages and Automata By Dr. Khezrian 3 Review

Theory of Languages and Automata By Dr. Khezrian 4 Grammar G =(V,T,P,S) V= nonFinal symbol T= Alphabetic P= Rules S= Starting symbol

Theory of Languages and Automata By Dr. Khezrian 5 Language of Grammar

Theory of Languages and Automata By Dr. Khezrian 6 Language of Grammar

Theory of Languages and Automata By Dr. Khezrian 7 Language of Grammar

Theory of Languages and Automata By Dr. Khezrian 8 Language of Grammar

Theory of Languages and Automata By Dr. Khezrian 9 How to Write Grammar? First split the language to small parts then write the grammar of them. Finally join all of them.

Theory of Languages and Automata By Dr. Khezrian 10 How to Write Grammar? 1: Split like: A A A …. A A is the symbol of even length

Theory of Languages and Automata By Dr. Khezrian 11 How to Write Grammar? 2: Split like: X A A is the symbol of even length X is the symbol of aa or ab or bb or ba

Theory of Languages and Automata By Dr. Khezrian 12 How to Write Grammar? 3: Split like: A B A,B is the symbol of even length

Theory of Languages and Automata By Dr. Khezrian 13 How to Write Grammar? 4: Split like: A X A is the symbol of even length X is the symbol of aa or ab or bb or ba

Theory of Languages and Automata By Dr. Khezrian 14 How to Write Grammar? Split like: X A A is the symbol of even length X is the symbol of a or b

Theory of Languages and Automata By Dr. Khezrian 15 How to Write Grammar? 1: Split like: b…a and a…b

Theory of Languages and Automata By Dr. Khezrian 16 How to Write Grammar? 2: Split like: b…a… and a…b…

Theory of Languages and Automata By Dr. Khezrian 17 How to Write Grammar? 3: Split like: AB

Theory of Languages and Automata By Dr. Khezrian 18 How to Write Grammar? 3: Split it to two languages: L1 and L2 L1: n,m are even L2: n,m are odd

Theory of Languages and Automata By Dr. Khezrian 19 How to Write Grammar?

Theory of Languages and Automata By Dr. Khezrian 20 Type of Grammar Type-3 Grammar (Regular Grammar) Type-2 Grammar (Context free Grammar) Type-1 Grammar (Context Sensitive Grammar) Type-0 Grammar

Theory of Languages and Automata By Dr. Khezrian 21 Type-3 Grammar (Regular Grammar) If it would be right-linear: Or left-linear:

Theory of Languages and Automata By Dr. Khezrian 22 Type-3 Grammar (Regular Grammar)

Theory of Languages and Automata By Dr. Khezrian 23 Type-2 Grammar (Context Free Grammar)

Theory of Languages and Automata By Dr. Khezrian 24 Type-1 Grammar (Context Sensetive Grammar)

Theory of Languages and Automata By Dr. Khezrian 25 Type-1 Grammar (Context Sensitive Grammar)

Theory of Languages and Automata By Dr. Khezrian 26 Type-0 Grammar

Theory of Languages and Automata By Dr. Khezrian 27 Type-0 Grammar

Theory of Languages and Automata By Dr. Khezrian 28 Type of Language Type-3 Language (Regular Language) Type-2 Language (Context Free Language) Type-1 Language (Context Sensitive Language) Type-0 Language

Theory of Languages and Automata By Dr. Khezrian 29 Type of Language Type-3 If there is a type-3 grammar for it Type-2 If there is a type-2 grammar and no type-3 grammar for it Type-1 If there is a type-1 grammar and no type-3 and type-2 grammar for it Type-0 If there is a type-0 grammar and no type-3 and type-2 and type-1 grammar for it

Theory of Languages and Automata By Dr. Khezrian 30 Type of Language

Theory of Languages and Automata By Dr. Khezrian 31 Type of Automata Automata for type-3 language (Finite Automata) Automata for type-2 language (Push-down Automata) Automata for type-1 language (Linear Bounded Automata) Automata for type-0 language (Turing Machine)

Theory of Languages and Automata By Dr. Khezrian 32 Type of Automata

Theory of Languages and Automata By Dr. Khezrian 33 Finite Machine

Theory of Languages and Automata By Dr. Khezrian 34 Finite Machine Accept: If at the end of string, machine is stated in one of final states. Reject: If at the end of string, machine is stated in one of non-final states or before end of string it’ll be stoped.

Theory of Languages and Automata By Dr. Khezrian 35 Finite Machine

Theory of Languages and Automata By Dr. Khezrian 36 Finite Machine

Theory of Languages and Automata By Dr. Khezrian 37 Example

Theory of Languages and Automata By Dr. Khezrian 38 Language of a Finite machine If A is the set of all strings that machine M accepts, we say that A is the language of machine M and write: L(M) = A.  M recognizes A  M accepts A.

Theory of Languages and Automata By Dr. Khezrian 39 Finite Machine

Theory of Languages and Automata By Dr. Khezrian 40 Finite Machine

Theory of Languages and Automata By Dr. Khezrian 41 Finite Machine

Theory of Languages and Automata By Dr. Khezrian 42 Example L(M1) = {w | w contains at least one 1 and even number of 0s follow the last 1}

Theory of Languages and Automata By Dr. Khezrian 43 Example L(M4) = {w | w accepts all strings that start and end with a or with b}

Theory of Languages and Automata By Dr. Khezrian 44 Example L(M5) = {w | keeps a running count of the sum of the numerical input symbols it reads, modulo 3}

Theory of Languages and Automata By Dr. Khezrian 45 Designing Finite Automata Put yourself in the place of the machine and then see how you would go about performing the machine’s task. Design a finite automaton to recognize the regular language of all strings that contain the string 001 as a substring.

Theory of Languages and Automata By Dr. Khezrian 46 Designing Finite Automata

Theory of Languages and Automata By Dr. Khezrian 47 Example

Theory of Languages and Automata By Dr. Khezrian 48 Example

Theory of Languages and Automata By Dr. Khezrian 49 Type of Finite Automata Deterministic Finite Automata (DFA) Nondeterministic Finite Automata (NDFA)

Theory of Languages and Automata By Dr. Khezrian 50 Deterministic Finite Automata (DFA)

Theory of Languages and Automata By Dr. Khezrian 51 Nondeterministic Finite Automata (NDFA)

Theory of Languages and Automata By Dr. Khezrian 52 Differences between DFA & NFA First, very state of a DFA always has exactly one exiting transition arrow for each symbol in the alphabet. In an NFA a state may have zero, one, or more exiting arrows for each alphabet symbol.

Theory of Languages and Automata By Dr. Khezrian 53 Differences between DFA & NFA Second, in a DFA, labels on the transition arrows are symbols from the alphabet. An NFA may have arrows labeled with members of the alphabet or. Zero, one, or many arrows may exit from each state with the label.

Theory of Languages and Automata By Dr. Khezrian 54 Differences between DFA & NFA

Theory of Languages and Automata By Dr. Khezrian 55 Example Consider the computation of N1 on input

Theory of Languages and Automata By Dr. Khezrian 56 Example (Cont.)

Theory of Languages and Automata By Dr. Khezrian 57 Example

Theory of Languages and Automata By Dr. Khezrian 58 Example NFA to DFA

Theory of Languages and Automata By Dr. Khezrian 59 Example NFA to DFA

Theory of Languages and Automata By Dr. Khezrian 60 Example NFA with to DFA

Theory of Languages and Automata By Dr. Khezrian 61 Pumping Lemma

Theory of Languages and Automata By Dr. Khezrian 62 Pumping Lemma

Theory of Languages and Automata By Dr. Khezrian 63 Pumping Lemma

Theory of Languages and Automata By Dr. Khezrian 64 Pumping Lemma

Theory of Languages and Automata By Dr. Khezrian 65 Pumping Lemma

Theory of Languages and Automata By Dr. Khezrian 66 Pumping Lemma

Theory of Languages and Automata By Dr. Khezrian 67 Pumping Lemma

Theory of Languages and Automata By Dr. Khezrian 68 Pumping Lemma

Theory of Languages and Automata By Dr. Khezrian 69 The Regular Operations Let A and B be languages. We define the regular operations union, concatenation, and star as follows:

Theory of Languages and Automata By Dr. Khezrian 70 Union Operations Let NFA1 recognize N1 and NFA2 recognize N2. Construct NFA3 to recognize N1 U N2.

Theory of Languages and Automata By Dr. Khezrian 71 Concatenation Operations

Theory of Languages and Automata By Dr. Khezrian 72 Union Operations We represent another NFA to recognize A*.

Theory of Languages and Automata By Dr. Khezrian 73 Regular Expression

Theory of Languages and Automata By Dr. Khezrian 74 Regular Expression Language

Theory of Languages and Automata By Dr. Khezrian 75 Example

Theory of Languages and Automata By Dr. Khezrian 76 Regular Language Cycle NDFA DFA NDFA-λ R RG

Theory of Languages and Automata By Dr. Khezrian 77 Regular Language Cycle NDFA DFA NDFA-λ R RG

Theory of Languages and Automata By Dr. Khezrian 78 Building an NFA from the Regular Expression

Theory of Languages and Automata By Dr. Khezrian 79 Building an NFA from the Regular Expression

Theory of Languages and Automata By Dr. Khezrian 80 Regular Language Cycle NDFA DFA NDFA-λ R RG

Theory of Languages and Automata By Dr. Khezrian 81 Building Grammar from the NFA G =(V,T,P,S)

Theory of Languages and Automata By Dr. Khezrian 82 Building Grammar from the NFA

Theory of Languages and Automata By Dr. Khezrian 83 Building Grammar from the NFA

Theory of Languages and Automata By Dr. Khezrian 84 Building Grammar from the NFA

Theory of Languages and Automata By Dr. Khezrian 85 Building Grammar from the NFA

Theory of Languages and Automata By Dr. Khezrian 86 Building Grammar from the NFA

Theory of Languages and Automata By Dr. Khezrian 87 Building Grammar from the NFA

Theory of Languages and Automata By Dr. Khezrian 88 Regular Language Cycle NDFA DFA NDFA-λ R RG

Theory of Languages and Automata By Dr. Khezrian 89 Building NFA from the Grammar G =(V,T,P,S)

Theory of Languages and Automata By Dr. Khezrian 90 Building NFA from the Grammar

Theory of Languages and Automata By Dr. Khezrian 91 Regular Language Cycle NDFA DFA NDFA-λ R RG

Theory of Languages and Automata By Dr. Khezrian 92 Building Grammar from the Regular expression

Theory of Languages and Automata By Dr. Khezrian 93 Building Grammar from the Regular expression

Theory of Languages and Automata By Dr. Khezrian 94 Building Grammar from the Regular expression

Theory of Languages and Automata By Dr. Khezrian 95 Building Grammar from the Regular expression

Theory of Languages and Automata By Dr. Khezrian 96 Regular Language Cycle NDFA DFA NDFA-λ R RG

Theory of Languages and Automata By Dr. Khezrian 97 Building Regular expression from the Grammar

Theory of Languages and Automata By Dr. Khezrian 98 Regular Language Cycle NDFA DFA NDFA-λ R RG

Theory of Languages and Automata By Dr. Khezrian 99 Regular Language Cycle NDFA DFA NDFA-λ R RG

Theory of Languages and Automata By Dr. Khezrian 100 Regular Language Cycle NDFA DFA NDFA-λ R RG

Theory of Languages and Automata By Dr. Khezrian 101 GNFA Formal Definition A generalized nondeterministic finite automaton is a 5-tuple, a 5-tuple (Q,Σ,δ,qstart, qaccept), where 1.Q is a finite set called states, 2.Σ is a the input alphabet, 3.δ : (−*+) ×(Q−*+ is the transition function, 4.qstart is the start state, and 5.qaccept is the accept state.

Theory of Languages and Automata By Dr. Khezrian 102 Assumptions For convenience we require that GNFAs always have a special form that meets the following conditions: 1.The start state has transition arrows going to every other state but no arrows coming in from any other state. 2.There is only a single accept state, and it has arrows coming in from every other state but no arrows going to any other state. Furthermore, the accept state is not the same as the start state. 3.Except for the start and accept states, one arrow goes from every state to every other state and also from each state to itself.

Theory of Languages and Automata By Dr. Khezrian 103 How to Eliminate a State?

Theory of Languages and Automata By Dr. Khezrian 104 Example

Theory of Languages and Automata By Dr. Khezrian 105 Example

Theory of Languages and Automata By Dr. Khezrian 106 Example (Cont.)