Exercises for Chapter 2. Summary for the Quiz Some numbers –199  less than 100  55 Conclusion –There are students who did read textbook at least for.

Slides:



Advertisements
Similar presentations
Applied Computer Science II Chapter 4: Decidability Prof. Dr. Luc De Raedt Institut für Informatik Albert-Ludwigs Universität Freiburg Germany.
Advertisements

CSE 311 Foundations of Computing I
4b Lexical analysis Finite Automata
Nondeterministic Finite Automata CS 130: Theory of Computation HMU textbook, Chapter 2 (Sec 2.3 & 2.5)
CSE 105 Theory of Computation Alexander Tsiatas Spring 2012 Theory of Computation Lecture Slides by Alexander Tsiatas is licensed under a Creative Commons.
Theory Of Automata By Dr. MM Alam
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 From NFA to Regular Language. Induction on k= # of states other than initial and final states K=0 a a* b a c d c*a(d+bc*a)*
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.
CSCI 2670 Introduction to Theory of Computing September 15, 2004.
Compiler Construction
Costas Busch - RPI1 Single Final State for NFAs. Costas Busch - RPI2 Any NFA can be converted to an equivalent NFA with a single final state.
Courtesy Costas Busch - RPI1 Non Deterministic Automata.
Fall 2006Costas Busch - RPI1 Regular Expressions.
1 Regular Expressions. 2 Regular expressions describe regular languages Example: describes the language.
Fall 2004COMP 3351 Single Final State for NFA. Fall 2004COMP 3352 Any NFA can be converted to an equivalent NFA with a single final state.
College of Computer Science & Technology Compiler Construction Principles & Implementation Techniques -1- Compiler Construction Principles & Implementation.
1 Single Final State for NFAs and DFAs. 2 Observation Any Finite Automaton (NFA or DFA) can be converted to an equivalent NFA with a single final state.
1 Non-Deterministic Automata Regular Expressions.
Fall 2004COMP 3351 Another NFA Example. Fall 2004COMP 3352 Language accepted (redundant state)
Lecture 4UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 4.
CS5371 Theory of Computation Lecture 12: Computability III (Decidable Languages relating to DFA, NFA, and CFG)
1 A Single Final State for Finite Accepters. 2 Observation Any Finite Accepter (NFA or DFA) can be converted to an equivalent NFA with a single final.
Fall 2004COMP 3351 Regular Expressions. Fall 2004COMP 3352 Regular Expressions Regular expressions describe regular languages Example: describes the language.
CSE 311: Foundations of Computing Fall 2014 Lecture 23: State Minimization, NFAs.
Regular Expressions (RE) Empty set Φ A RE denotes the empty set Empty string λ A RE denotes the set {λ} Symbol a A RE denotes the set {a} Alternation M.
1 Regular Expressions. 2 Regular expressions describe regular languages Example: describes the language.
CSCI 2670 Introduction to Theory of Computing September 15, 2005.
4b 4b Lexical analysis Finite Automata. Finite Automata (FA) FA also called Finite State Machine (FSM) –Abstract model of a computing entity. –Decides.
Module 2 How to design Computer Language Huma Ayub Software Construction Lecture 8.
COMP3190: Principle of Programming Languages DFA and its equivalent, scanner.
Regular Expressions Prepared by Manuel E. Bermúdez, Ph.D. Associate Professor University of Florida Programming Language Translators.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University 2010.
CSCI 2670 Introduction to Theory of Computing September 1, 2005.
Regular Expressions and Languages A regular expression is a notation to represent languages, i.e. a set of strings, where the set is either finite or contains.
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.
CSCI 2670 Introduction to Theory of Computing October 12, 2005.
Regular Expressions Costas Busch - LSU.
Theory of Computing CSCI 356/541 Lab Session. Outline Lab 1: Finite Automata  Construct and Run Construct and Run  Manipulating Transitions Manipulating.
Finite Automata Chapter 1. Automatic Door Example Top View.
Regular Grammars Reading: 3.3. What we know so far…  FSA = Regular Language  Regular Expression describes a Regular Language  Every Regular Language.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University 2007.
CSCI 2670 Introduction to Theory of Computing September 14, 2005.
Mathematical Foundations of Computer Science Chapter 3: Regular Languages and Regular Grammars.
Transparency No. 2-1 Formal Language and Automata Theory Homework 2.
1 Chapter Constructing Efficient Finite Automata.
CSE 311 Foundations of Computing I Lecture 24 FSM Limits, Pattern Matching Autumn 2011 CSE 3111.
Algorithms for hard problems Automata and tree automata Juris Viksna, 2015.
Jianguo Lu : Lab 3 Jan 30, Winter 2004.
CS 154 Formal Languages and Computability February 11 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron.
Regular Expressions CS 130: Theory of Computation HMU textbook, Chapter 3.
1 Chapter 3 Regular Languages.  2 3.1: Regular Expressions (1)   Regular Expression (RE):   E is a regular expression over  if E is one of:
1 Some Properties of Regular Languages. 2 Properties Concatenation:Star: Union: Are regular Languages For regular languages and.
LECTURE 5 Scanning. SYNTAX ANALYSIS We know from our previous lectures that the process of verifying the syntax of the program is performed in two stages:
1 Lexical Analysis Uses formalism of Regular Languages Uses formalism of Regular Languages Regular Expressions Regular Expressions Deterministic Finite.
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.
1 1. Eliminate all  -transitions from the following FA without changing the number of states and the language accepted by the automaton. You should also.
COMP3190: Principle of Programming Languages DFA and its equivalent, scanner.
1/29/02CSE460 - MSU1 Nondeterminism-NFA Section 4.1 of Martin Textbook CSE460 – Computability & Formal Language Theory Comp. Science & Engineering Michigan.
Chapter 2 FINITE AUTOMATA.
REGULAR LANGUAGES AND REGULAR GRAMMARS
Regular Expressions Prof. Busch - LSU.
Regular Expression to NFA
Regular Expression to NFA
Review for the Midterm. Overview (Chapter 1):
Lexical Analysis Uses formalism of Regular Languages
Finite Automata Fall 2018.
CSCI 2670 Introduction to Theory of Computing
Presentation transcript:

Exercises for Chapter 2

Summary for the Quiz Some numbers –199  less than 100  55 Conclusion –There are students who did read textbook at least for review; –Most submitted answers are actually correct; –Rethinks on teaching method

Explanations on RE A regular expression defines a set of strings(language); A regular expression states the common pattern(structure) of the strings that belong to its language; For the same set of strings, there could be several RE definitions for it; Explanation of three operations –( 顺序 ; 选择 ; 重复 );

Example of RE {a, b, c} Defining a set of strings, where each string should starts with “a” and ends with “c”; Defining a set of strings, if “a” appears in one string, “c” should appear right after “a”;

From RE to NFA The generated NFA could be different, but they are equivalent; –The only criteria for judging whether the generated NFA is correct: L(RE) = L(NFA) You can follow the general rules; There are some shortcuts;

Rules ■  is a regular expression , L(  )={ } ■ is a regular expression , L( )={ } ■ for any c , c is a regular expression, L(c)={c} S0S0 S S0S0 S c

Rules ■ ( A ), L( (A) )= L(A), no change; ■ A B , L( A B )= L(A)L(B) NFA(A) NFA(B) 

Rules ■ ( A ), L( (A) )= L(A), no change; ■ A | B , L( A | B )=L(A)  L(B) NFA(A) NFA(B)    

Rules ■ A* , L( A*)= L(A)* NFA(A)   

Attention The rules introduced above are effective for those NFAs that have one start state and one terminal state; Any NFA can be extended to meet this requirement; …… NFA ……    

Quiz (a|b)*abb(a|b)* Follow the rules a   b   a bb   

Quiz (a|b)*abb(a|b)* Follow the process in the textbook (a|b)*abb(a|b)* (a|b)* abb (a|b)*  bb b a a   b a

Quiz (a|b)*abb(a|b)* The NFA without  edge; 1 a b b a b b a

ab {1} 0 {1,2}{1} {1,2} {1,3} {1,2}{1,4}* {1,2,4}*{1,4}* {1,2,4}* {1,3,4}* {1,2,4}*{1,4}*

ab {1} 0 {1,2}{1} {1,2} {1,3} {1,2}{1,4}* {1,2,4}*{1,4}* {1,2,4}* {1,3,4}* {1,2,4}*{1,4}* {1} --- S0; {1,2} --- S1; {1,3} --- S2; {1,4} --- S3; {1,2,4} --- S4; {1,3,4} --- S5; ab S0 0 S1S0 S1 S2 S1S3* S4*S3* S4* S5* S4*S3*

Minimizing DFA Current groups:{S0,S1,S2}, {S3,S4,S5} Splitting {S0, S1,S2}  {S0,S1},{S2} Current groups:{S0,S1},{S2}, {S3,S4,S5} Splitting {S0, S1}  {S0},{S1} ab S0 0 S1S0 S1 S2 S1S3*

Minimizing DFA Current groups:{S0},{S1},{S2}, {S3,S4,S5} Splitting {S3, S4,S5}  {S3,S4,S5} ab S3*S4*S3* S4* S5* S4*S3*

Minimized DFA ab S0 0 S1S0 S1 S2 S1S3* S4*S3* S4* S5* S4*S3* {S0},{S1},{S2}, {S3,S4,S5} {S0} ; {S1} ; {S2} ; {S3,S4,S5} --- 3; ab *

You should know how to do these problems!!!!