Tutorial 02 -- CSC3130 : Formal Languages and Automata Theory Tu Shikui ( ) SHB 905, Office hour: Thursday 2:30pm-3:30pm 2008-09-12.

Slides:



Advertisements
Similar presentations
Lecture 6 Nondeterministic Finite Automata (NFA)
Advertisements

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)*
FORMAL LANGUAGES, AUTOMATA, AND COMPUTABILITY
Examples for Finite Automata
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 Regular Expressions Highlights: –A regular expression is used to specify a language, and it does so precisely. –Regular expressions are very intuitive.
1 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY (For next time: Read Chapter 1.3 of the book)
Courtesy Costas Busch - RPI1 Non Deterministic Automata.
Transparency No. 4-1 Formal Language and Automata Theory Chapter 4 Patterns, Regular Expressions and Finite Automata (include lecture 7,8,9) Transparency.
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.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Regular.
Tutorial CSC3130 : Formal Languages and Automata Theory Tu Shikui ( ) SHB 905, Office hour: Thursday 2:30pm-3:30pm
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)
Lecture 8 Sept 29, 2011 Regular expressions – examples Converting DFA to regular expression. (same works for NFA to r.e. conversion.) Converting R.E. to.
CSC 361Finite Automata1. CSC 361Finite Automata2 Formal Specification of Languages Generators Grammars Context-free Regular Regular Expressions Recognizers.
Lecture 5UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 5.
Fall 2004COMP 3351 Another NFA Example. Fall 2004COMP 3352 Language accepted (redundant state)
Costas Busch - LSU1 Non-Deterministic Finite Automata.
1 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY For next time: Read 2.1 & 2.2.
Today Chapter 1: RE = Regular Languages, nonregular languages RL pumping lemma Chapter 2: Context-Free Languages (CFLs)
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong DFA to regular.
CSCI 3130: Formal languages and automata theory Tutorial 2 Chin.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong NFA to DFA.
Regular Expressions Hopcroft, Motawi, Ullman, Chap 3.
Prof. Busch - LSU1 NFAs accept the Regular Languages.
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.
CSCI 3130: Formal languages and automata theory Tutorial 3 Chin.
Finite Automata Chapter 1. Automatic Door Example Top View.
CSCI 3130: Formal languages and automata theory Tutorial 1 Lee Chin Ho.
Lecture Notes 
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Pushdown.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AA.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Pushdown.
Regular Expressions CS 130: Theory of Computation HMU textbook, Chapter 3.
 2004 SDU Lecture4 Regular Expressions.  2004 SDU 2 Regular expressions A third way to view regular languages. Say that R is a regular expression if.
CSCI 2670 Introduction to Theory of Computing September 7, 2004.
1 Lexical Analysis Uses formalism of Regular Languages Uses formalism of Regular Languages Regular Expressions Regular Expressions Deterministic Finite.
Theory of Computation Automata Theory Dr. Ayman Srour.
Lecture #5 Advanced Computation Theory Finite Automata.
1/29/02CSE460 - MSU1 Nondeterminism-NFA Section 4.1 of Martin Textbook CSE460 – Computability & Formal Language Theory Comp. Science & Engineering Michigan.
Chapter 2 Regular Languages & Finite Automata. Regular Expressions A finitary denotation of a regular language over . ØL Ø = Ø aL a = {a} where a ∈ 
CIS Automata and Formal Languages – Pei Wang
Formal Language & Automata Theory
Non Deterministic Automata
Examples for Finite Automata
Chapter 2 FINITE AUTOMATA.
More on DFA minimization and DFA equivalence
Non-Deterministic Finite Automata
COSC 3340: Introduction to Theory of Computation
CSE322 CONSTRUCTION OF FINITE AUTOMATA EQUIVALENT TO REGULAR EXPRESSION Lecture #9.
Non-Deterministic Finite Automata
Non Deterministic Automata
CSE322 Minimization of finite Automaton & REGULAR LANGUAGES
Finite Automata.
CSCI 2670 Introduction to Theory of Computing
CSCI 2670 Introduction to Theory of Computing
Chapter # 5 by Cohen (Cont…)
CSC312 Automata Theory Kleene’s Theorem Lecture # 12
Kleene’s Theorem (Part-3)
CSCI 2670 Introduction to Theory of Computing
Lexical Analysis Uses formalism of Regular Languages
CSCI 2670 Introduction to Theory of Computing
Nondeterminism The Chinese University of Hong Kong Fall 2010
Presentation transcript:

Tutorial CSC3130 : Formal Languages and Automata Theory Tu Shikui ( ) SHB 905, Office hour: Thursday 2:30pm-3:30pm

Outline From  NFA to NFA From DFA to RE Closed operators for Regular Languages

From  NFA to NFA  -transitions  is the empty string, “ it contains no alphabets ” ; It makes a state transition when seeing . It makes a state transition without receiving an input symbol (from alphabet); It makes a state transition unconditionally;  NFA NFA + Allows  -transitions; It brings “ programming convenience ” ; Closely related to regular expressions

From  NFA to NFA -- an example from Lecture notes (1/8) q0q0 q1q1 q2q2 ,b a a   NFA: NFA: q0q0 q1q1 q2q2 a, b a a a a

From  NFA to NFA -- an example from Lecture notes (2/8) q0q0 q1q1 q2q2 ,b a a   NFA: q0q0 q1q1 q2q2 NFA: (1) States stay the same (2) Start state stays the same

From  NFA to NFA -- an example from Lecture notes (3/8) q0q0 q1q1 q2q2 ,b a a   NFA: NFA: q0q0 q1q1 q2q2 Path in  NFA : qiqi qkqk qjqj …… qmqm a  Equivalent Path in NFA : qjqj a qiqi ? ? ?

From  NFA to NFA -- an example from Lecture notes (4/8) q0q0 q1q1 q2q2 ,b a a   NFA: NFA: q0q0 q1q1 q2q2 Path in  NFA : q0q0 q1q1 q0q0 a  Equivalent Path in NFA : q0q0 a q0q0 a ? ?

From  NFA to NFA -- an example from Lecture notes (5/8) q0q0 q1q1 q2q2 ,b a a   NFA: NFA: Path in  NFA : q0q0 q1q1 q1q1 a  Equivalent Path in NFA : q1q1 q0q0 q0q0 q1q1 q2q2 a, b ? a q1q1 b q0q0 a q1q1 b q0q0

From  NFA to NFA -- an example from Lecture notes (6/8) q0q0 q1q1 q2q2 ,b a a   NFA: NFA: Path in  NFA : Equivalent Path in NFA : q0q0 q1q1 q2q2 a, b a q0q0 q1q1 q1q1 a  q2q2 q0q0 q1q1 b q0q0 a q2q2 b q0q0 q2q2  q2q2 

From  NFA to NFA -- an example from Lecture notes (7/8) q0q0 q1q1 q2q2 ,b a a   NFA: NFA: q0q0 q1q1 q2q2 a, b a a a a

From  NFA to NFA -- an example from Lecture notes (8/8) q0q0 q1q1 q2q2 ,b a a   NFA: NFA: q0q0 q1q1 q2q2 a, b a a a a (4) The accepting states of the NFA are all states that can reach some accepting state of  NFA using only  -transitions

Outline From  NFA to NFA From DFA to RE Closed operators for Regular Languages

From DFA to RE -- General construction We inductively define R ij k as: R ii 0 = a i 1 + a i 2 + … + a i t +  (all loops around q i and  ) (all q i → q j ) R ij k = R ij k-1 + R ik k-1 (R kk k-1 )*R kj k-1 a path in M qiqi qkqk qjqj R ij 0 = a i 1 + a i 2 + … + a i t if i ≠ j a i 1,a i 2,…,a i t qiqi qiqi qjqj (for k > 0 )

From DFA to RE -- an example (1/3) q1q1 q2q2 R 11 0 = { , 1} = 1 +  R 12 0 = {0} = 0 R 21 0 = {0} = 0 R 22 0 = { , 1} = 1 +  1 q1q1 0 q1q1 q2q2 0 q1q1 q2q2 1 q2q2

From DFA to RE -- an example (2/3) q1q1 q2q2 R 11 0 = { , 1} = 1 +  ; R 12 0 = {0} = 0 R 21 0 = {0} = 0; R 22 0 = { , 1} = 1 +  R 11 1 = { , 1, 11, 111,...} = 1* R ij k = R ij k-1 + R ik k-1 (R kk k-1 )*R kj k-1 R 12 1 = R R 11 0 (R 11 0 )*R 12 0 = 0 + (1+  ) + 0 R 22 1 = R R 21 0 (R 11 0 )*R 12 0 = ( 1 +  ) + 0(1+  ) * 0 R 12 2 = R R 12 1 (R 22 1 )*R 22 1 = (0 + (1+  ) + 0) + (0 + (1+  ) + 0) (( 1 +  ) + 0(1+  ) * 0) + = (0 + (1+  ) + 0) (( 1 +  ) + 0(1+  ) * 0) * = (1+  ) * 0 (( 1 +  ) + 01 * 0) * = 1 * 0 ( * 0) *

From DFA to RE (3/3) -- Determine the accepted RE for DFA Suppose the DFA start state is q 1, and the accepting states are F = {q j 1  q j 2 …  q j t } Then the regular expression for this DFA is R 1j 1 n + R 1j 2 n + ….. + R 1j t n 0 0 q1q1 q2q2 11 R 12 2 =1 * 0 (1+01 * 0) *

Outline From  NFA to NFA From DFA to RE Closed operators for Regular Languages

Closed operators for Regular Languages -- An Exercise Prove or disprove the regular languages are closed under the following operations: (1). min ( L ) = { w | w is in L, but no proper prefix of w is in L }; (2). max ( L ) = { w | w is in L and for no x other than ε is wx in L }; (3). init ( L ) = { w | for some x, wx is in L } Hint: Start with a DFA for L and perform a construction to get the desired language.

(1). min(L) = { w | w is in L, but no proper prefix of w is in L }; What is “proper prefix”? For example, suppose the alphabet is { 0, 1 }, then: (1) “011”, “01” are proper prefixes of “ ”; (2)“ ” is a prefix of “ ”, but not a proper prefix; (3)“” (i.e., ε) is not a proper prefix of “ ”.

(1). min(L) = { w | w is in L, but no proper prefix of w is in L }; What does min ( L ) look like? Main idea: u q0q0 qjqj qkqk x w=ux A DFA for L: Cut the transitions going out of each accepting state. Example(1). L = { 00, 001, 0011, 101 }; min ( L ) = ? { 00, 001, 0011, 101 } Example(2). L = { a, a(bc) n, baa, cb m a }; min ( L ) = ? n,m = 0,1,2,…

Solution for (1) min(L) = { w | w is in L, but no proper prefix of w is in L };

Solution for (1) -- (cont.) min(L) = { w | w is in L, but no proper prefix of w is in L };

Properties of Regular Languages -- An Exercise Prove or disprove the regular languages are closed under the following operations: (1). min ( L ) = { w | w is in L, but no proper prefix of w is in L }; (2). max ( L ) = { w | w is in L and for no x other than ε is wx in L }; (3). init ( L ) = { w | for some x, wx is in L } Hint: Start with a DFA for L and perform a construction to get the desired language. Left as exercises at home!

End of this tutorial! Thanks for coming!