NFAs and Transition Graphs

Slides:



Advertisements
Similar presentations
4b Lexical analysis Finite Automata
Advertisements

Theory Of Automata By Dr. MM Alam
Regular Expressions and DFAs COP 3402 (Summer 2014)
1 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 3 School of Innovation, Design and Engineering Mälardalen University 2012.
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.
Cohen, Chapter 61 Introduction to Computational Theory Chapter 6.
COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf of Monash University.
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.
Finite Automata Chapter 5. Formal Language Definitions Why need formal definitions of language –Define a precise, unambiguous and uniform interpretation.
Topics Automata Theory Grammars and Languages Complexities
CSC 361Finite Automata1. CSC 361Finite Automata2 Formal Specification of Languages Generators Grammars Context-free Regular Regular Expressions Recognizers.
1 Non-Deterministic Finite Automata. 2 Alphabet = Nondeterministic Finite Automaton (NFA)
Theory of Computation, Feodor F. Dragan, Kent State University 1 Regular expressions: definition An algebraic equivalent to finite automata. We can build.
4b 4b Lexical analysis Finite Automata. Finite Automata (FA) FA also called Finite State Machine (FSM) –Abstract model of a computing entity. –Decides.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University 2010.
Lecture # 12. Nondeterministic Finite Automaton (NFA) Definition: An NFA is a TG with a unique start state and a property of having single letter as label.
Lecture 4 Theory of AUTOMATA
CMSC 330: Organization of Programming Languages Theory of Regular Expressions Finite Automata.
Lecture 04: Theory of Automata:08 Transition Graphs.
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen.
1 Section 11.2 Finite Automata Can a machine(i.e., algorithm) recognize a regular language? Yes! Deterministic Finite Automata A deterministic finite automaton.
Deterministic Finite Automata Nondeterministic Finite Automata.
L ECTURE 3 T HEORY OF AUTOMATA. E QUIVALENT R EGULAR E XPRESSIONS Definition Two regular expressions are said to be equivalent if they generate the same.
Lecture # 8 (Transition Graphs). Example Consider the language L of strings, defined over Σ={a, b}, having (containing) triple a or triple b. Consider.
WELCOME TO A JOURNEY TO CS419 Dr. Hussien Sharaf Dr. Mohammad Nassef Department of Computer Science, Faculty of Computers and Information, Cairo University.
Theory of Computation Automata Theory Dr. Ayman Srour.
Theory of Languages and Automata By: Mojtaba Khezrian.
WELCOME TO A JOURNEY TO CS419 Dr. Hussien Sharaf Dr. Mohammad Nassef Department of Computer Science, Faculty of Computers and Information, Cairo University.
Recap lecture 5 Different notations of transition diagrams, languages of strings of even length, Odd length, starting with b, ending in a (with different.
Nondeterminism The Chinese University of Hong Kong Fall 2011
Transition Graphs.
Generalized Transition Graphs
Lexical analysis Finite Automata
Non Deterministic Automata
FORMAL LANGUAGES AND AUTOMATA THEORY
Chapter 2 Finite Automata
CSC312 Automata Theory Chapter # 5 by Cohen Finite Automata
Theory of Computation Lecture # 9-10.
Pushdown Automata.
[Week#03,04] (b) - Finite Automata
Chapter 2 FINITE AUTOMATA.
REGULAR LANGUAGES AND REGULAR GRAMMARS
Non-deterministic Finite Automata (NFA)
Non-Deterministic Finite Automata
Principles of Computing – UFCFA3-30-1
Non-Deterministic Finite Automata
CSE322 Definition and description of finite Automata
Non Deterministic Automata
Finite Automata.
Finite Automata.
4b Lexical analysis Finite Automata
Recap lecture 6 Language of strings, beginning with and ending in different letters, Accepting all strings, accepting non-empty strings, accepting no string,
4b Lexical analysis Finite Automata
CSC312 Automata Theory Chapter # 5 by Cohen Finite Automata
CSC312 Automata Theory Transition Graphs Lecture # 9
Recap lecture 37 New format for FAs, input TAPE, START, ACCEPT , REJECT, READ states Examples of New Format of FAs, PUSHDOWN STACK , PUSH and POP states,
RECAP Lecture 7 FA of EVEN EVEN, FA corresponding to finite languages(using both methods), Transition graphs.
Recap Lecture 15 Examples of Kleene’s theorem part III (method 3), NFA, examples, avoiding loop using NFA, example, converting FA to NFA, examples, applying.
CSCI 2670 Introduction to Theory of Computing
NFAs and Transition Graphs
Chapter # 5 by Cohen (Cont…)
Recap Lecture 4 Regular expression of EVEN-EVEN language, Difference between a* + b* and (a+b)*, Equivalent regular expressions; sum, product and closure.
Recap Lecture 3 RE, Recursive definition of RE, defining languages by RE, { x}*, { x}+, {a+b}*, Language of strings having exactly one aa, Language of.
LECTURE # 07.
CHAPTER 1 Regular Languages
Non Deterministic Automata
Lexical Analysis Uses formalism of Regular Languages
Part Two : Nondeterministic Finite Automata
Presentation transcript:

NFAs and Transition Graphs Course: Theory Of Automata Topic: NFAs And Transition Graphs [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

Deterministic FA (DFA) The FAs that we have studied so far are DFA in that At every state there is exactly one outgoing transition for a character and the machine can follow the transition deterministically No duplicates No missing edges [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

Nondeterministic Finite Automata (NFA) The FA where a state can have more than one transition for the same character. This puts the machine in an indecisive state for which transition to follow Has duplicate transitions Can miss transitions for some characters Reduces number of states and transitions [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

Nondeterministic Finite Automata (NFA) Costly execution Needs concurrent processing to find a successful path An NFA can have a successful and unsuccessful path for the same input If an NFA has at least one successful path for an input it is considered to be valid Machine crashes for an undefined transition thus causing implicit reject [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

NFA Language recognition Acceptance If at least one successful path exists Rejection Either machine crashes on input or ] No successful path exists [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

Nondeterministic Finite Automata (NFA) Examples An NFA that accepts the language {bb, bbb} All words that contain bb in them All words contains a double letter [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

Epsilon Transitions ε- Transitions A null transition that changes state but doesn’t consume any character Possible with NFAs and Transition Graphs (discussed next) [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

Nondeterministic Finite Automata (NFA) Alphabet = Start [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

Example: Accepting Start 12/24/2018 [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

Example: Accepting First choice Start Parallel Processing Second choice [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

Example: Accepting Start No transition so leave it 12/24/2018 [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

Example: Accepting Since there is no more symbol to read and it is an accepting state Therefore, the NFA will “Accept” Start [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

Example: Rejecting Start 12/24/2018 [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

Example: Rejecting Start 12/24/2018 [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

Example: Rejecting Start No transition 12/24/2018 [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

Example: Rejecting No transition so leave the state Start Since there is no current state or accepting state therefore, NFA will “Reject” the input string. 12/24/2018 [Week#05,06] (a) - NFAs & Transition Graphs (TGs)

Language of the NFA Start 12/24/2018 [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

Transition Graph (TG) Relaxed input conditions Can read multiple characters before making a transition Thus every edge can be labeled with a substring instead of a single character Can have multiple start states [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

Transition Graph (TG) Definition:- A transition graph is a combination of the following: Finite number of states, at least one of which is start state and some (may be none) final states. Finite set of input letters (Σ) from which input strings are formed. Finite set of transitions that show how to go from one state to another based on reading specified substrings of input letters, possibly even the null string. [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

Transition Graph (TG) Note: These two machines are clearly equivalent. Remark: Every finite automaton is a transition graph. [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

Transition Graph (TG) Note: ε-Transitions is a null transition that changes state but doesn’t consume any character Possible with NFAs and Transition Graphs (discussed next) [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

Transition Graph (TG) 12/24/2018 [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

Transition Graph (TG) Example: Consider the language L of strings, defined over Σ = {a, b}, of all strings including null. The language L may be accepted by the following TG. There are more than one paths for aa. 1st path aa keeps at initial state. 2nd path aᴧa takes to the final state. 3rd path aa from final state. [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

Transition Graph (TG) Do we have more than 1 TG for a language? Note: We have got some relaxations in TGs. We are not bound to follow these relaxations, but we can use these relaxations. [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

Transition Graph (TG) Example: Consider the language L of strings, defined over Σ = {a, b}, not ending in b. The language L may be expressed by the RE ᴧ + (a+b)* a, may be accepted by the following TG. [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

Transition Graph (TG) Example: Build a TG accepting the language of strings, defined over Σ = {a, b}, ending in b. The language L may be expressed by the RE (a+b)* b, may be accepted by the following TG. [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

Transition Graph (TG) Example: Consider the language L of strings, defined over Σ = {a, b}, containing double aa. The language L may be expressed by the RE (a+b)* aa (a+b)*, may be accepted by the following TG. [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

Transition Graph (TG) Example: Consider the language L of strings, defined over Σ = {a, b}, having double aa or doubld bb. The language L may be expressed by the Regular Expression (a+b)* (aa+bb) (a+b)*. The language L may be accepted by the following TG. [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

Transition Graph (TG) 12/24/2018 [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

Transition Graph (TG) OR Note: In the above TG if the states are not labeled then it may not be considered to be a single TG. [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

Transition Graph (TG) Example: Consider the language L of strings, defined over Σ = {a, b}, that start and end in double letter . The language L may be expressed by the RE aa(a+b)*aa + aa(a+b)*bb + bb(a+b)*aa + bb(a+b)*bb. The language L may be accepted by the following TG. [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

Transition Graph (TG) Example: Consider the language L of strings, defined over Σ = {a, b}, start with b . The language L may be expressed by the RE b(a+b)*. The language L may be accepted by the following TG. [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

Transition Graph (TG) Example: Consider the language L of strings, defined over Σ = {a, b}, not ending in b . The language L may be expressed by the RE ᴧ+(a+b)*a. The language L may be accepted by the following TG. [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

Transition Graph (TG) Example: Consider the language L of strings, defined over Σ = {a, b}, containing aaa, bbb . The language L may be expressed by the RE (a+b)*(aaa+bbb)(a+b)*. The language L may be accepted by the following TG. [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

Transition Graph (TG) 12/24/2018 [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

Transition Graph (TG) 12/24/2018 [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

Transition Graph (TG) Example: Consider the language L of strings, defined over Σ = {a, b}, beginning and ending in different letters . The language L may be expressed by the regular expression a(a+b)*b + b(a+b)*a. The language L may be accepted by the following Transition Graph. [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

Transition Graph (TG) 12/24/2018 [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

Transition Graph (TG) Example: Consider the language L of strings of length two or more, defined over Σ = {a, b}, beginning and ending in same letters . The language L may be expressed by the regular expression a(a+b)*a+ b(a+b)*b. The language L may be accepted by the following Transition Graph. [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

Transition Graph (TG) 12/24/2018 [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

Transition Graph (TG) Example: Consider the EVEN-EVEN language, defined over Σ = {a, b}. The language may be expressed by the following RE (aa+bb+(ab +ba) (aa+bb)*(ab+ba)) * The language L may be accepted by the following TG [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

Transition Graph (TG) Examples All words that start and end with a double letter -1 +3 2 aa,bb a,b [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

Transition Graph (TG) 12/24/2018 [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

Transition Graph (TG) The arc from state 1 to state 2 is labeled with the string aa, which is not a single letter. There are two arcs leaving state 2 labeled with b. There is no arc leaving state 2 labeled with a. There is an arc from state 1 to state 3 labeled with , which is not a letter from . There is no arc leaving state 3 labeled with b. [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

Transition Graph (TG) 12/24/2018 [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

Transition Graph (TG) 12/24/2018 [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

Transition Graph (TG) 12/24/2018 [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

Transition Graph (TG) 12/24/2018 [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

Transition Graph (TG) 12/24/2018 [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

Transition Graph (TG) 12/24/2018 [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

Transition Graph (TG) 12/24/2018 [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

Transition Graph (TG) 12/24/2018 [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

Transition Graph (TG) Example: Build a TG accepting the language L of strings, defined over Σ = {a, b}, beginning with and ending in the same letters . The language may be expressed by the following regular expression a + b + a(a+b)*a + b(a+b)*b The language L may be accepted by the following TG [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018

Transition Graph (TG) 12/24/2018 [Week#05,06] (a) - NFAs & Transition Graphs (TGs) 12/24/2018