CSE 105 theory of computation

Slides:



Advertisements
Similar presentations
Regular operations Sipser 1.1 (pages 44 – 47). CS 311 Fall Building languages If L is a language, then its complement is L’ = {w | w ∉ L} Let A.
Advertisements

1 Introduction to Computability Theory Lecture3: Regular Expressions Prof. Amos Israeli.
Regular operations Sipser 1.1 (pages 44 – 47). CS 311 Mount Holyoke College 2 Building languages If L is a language, then its complement is L’ = {w |
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 Lecture4: Regular Expressions Prof. Amos Israeli.
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.
CS 490: Automata and Language Theory Daniel Firpo Spring 2003.
Normal forms for Context-Free Grammars
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
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.
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
CSCI 2670 Introduction to Theory of Computing September 1, 2005.
CHAPTER 1 Regular Languages
January 9, 2015CS21 Lecture 31 CS21 Decidability and Tractability Lecture 3 January 9, 2015.
INHERENT LIMITATIONS OF COMPUTER PROGAMS CSci 4011.
CS 208: Computing Theory Assoc. Prof. Dr. Brahim Hnich Faculty of Computer Sciences Izmir University of Economics.
Finite Automata Great Theoretical Ideas In Computer Science Victor Adamchik Danny Sleator CS Spring 2010 Lecture 20Mar 30, 2010Carnegie Mellon.
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen.
 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 11, 2007.
Complexity and Computability Theory I Lecture #5 Rina Zviel-Girshin Leah Epstein Winter
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.
CSE 105 theory of computation
CSE 105 theory of computation
CSE 105 theory of computation
CSE 105 theory of computation
PROPERTIES OF REGULAR LANGUAGES
Regular Expressions.
CSE 105 theory of computation
CSE 105 theory of computation
Formal Language & Automata Theory
CSE 105 theory of computation
CSE 105 theory of computation
CSE 105 theory of computation
Chapter Seven: Regular Expressions
CS 154, Lecture 3: DFANFA, Regular Expressions.
COSC 3340: Introduction to Theory of Computation
4. Properties of Regular Languages
Finite Automata Reading: Chapter 2.
4b Lexical analysis Finite Automata
FORMAL LANGUAGES, AUTOMATA, AND COMPUTABILITY
Closure Properties of Regular Languages
CSE 105 theory of computation
CS21 Decidability and Tractability
Instructor: Aaron Roth
Convert to a DFA: Start state: Final States: State Symbol Read- Q E(Q)
Convert to a DFA: Start state: Final States: P Symbol Q E(Q) a b.
CSE 105 theory of computation
CSE 105 theory of computation
CSE 105 theory of computation
CSE 105 theory of computation
Chapter 1 Regular Language
CSCI 2670 Introduction to Theory of Computing
CSE 105 theory of computation
CSE 105 theory of computation
CSE 105 theory of computation
CSE 105 theory of computation
CSE 105 theory of computation
CSE 105 theory of computation
CSE 105 theory of computation
CSE 105 theory of computation
CSE 105 theory of computation
CSE 105 theory of computation
CSE 105 theory of computation
CSE 105 theory of computation
CSE 105 theory of computation
Presentation transcript:

CSE 105 theory of computation Spring 2019 https://cseweb.ucsd.edu/classes/sp19/cse105-a/

Today's learning goals Sipser Ch 1.2, 1.3 Design NFA recognizing a given language Convert an NFA (with or without spontaneous moves) to a DFA recognizing the same language Decide whether or not a string is described by a given regular expression Design a regular expression to describe a given language Convert between regular expressions and automata

Nondeterministic finite automata "Guess" some stage of input at which switch modes "Guess" one of finite list of criteria to meet Input M2 M1 Accept if either (or both) accepts M1 Input M2

Acceptance in an NFA

NFA

Simulating NFA with DFA Not quite a closure proof, but … Proof: Given name variables for sets, machines assumed to exist. WTS state goal and outline plan. Construction using objects previously defined + new tools working towards goal. Give formal definition and explain. Correctness prove that construction works. Conclusion recap what you've proved.

Simulating NFA with DFA For any language recognized by an NFA, there is a DFA that recognizes this language. Proof: Given A, a language recognized by N = (Q,Σ,δ,q0,F) a NFA WTS there is some DFA M with L(M) = A Construction Correctness Conclusion

From NFA to DFA Which of the following strings is accepted by this NFA? The empty string 01 111 More than one of the above.

Subset construction Given A, a language recognized by N = (Q,Σ,δ,q0,F) a NFA WTS there is some DFA M with L(M) = A Construction Define M = (Q', Σ, δ',q0', F') with Q' = the power set of Q = { X | X is a subset of Q } q0' = { states N can be in before first input symbol read } F' = { } δ' ( ) =

From NFA to DFA Which states can this NFA be in before first input symbol is read? q0 any state q0, q1 q0, q4 q0, q1, q4

Subset construction Given A, a language recognized by N = (Q,Σ,δ,q0,F) a NFA WTS there is some DFA M with L(M) = A Construction Define M = (Q', Σ, δ',q0', F') with Q' = the power set of Q = { X | X is a subset of Q } q0' = { q0 } U δ((q0, ε)) … F' = { } δ' ( ) =

Subset construction Given A, a language recognized by N = (Q,Σ,δ,q0,F) a NFA WTS there is some DFA M with L(M) = A Construction Define M = (Q', Σ, δ',q0', F') with Q' = the power set of Q = { X | X is a subset of Q } q0' = { q0 } U δ((q0, ε)) … F' = { guarantee at least one computation is successful } δ' ( ) =

From NFA to DFA What does it mean for a set of states X to guarantee at least one computation is successful? X is a subset of F X = F X F is nonempty X is an element of F None of the above. U

Subset construction Given A, a language recognized by N = (Q,Σ,δ,q0,F) a NFA WTS there is some DFA M with L(M) = A Construction Define M = (Q', Σ, δ',q0', F') with Q' = the power set of Q = { X | X is a subset of Q } q0' = { q0 } U δ((q0, ε)) … F' = { X | X is a subset of Q and X F is nonempty } δ' ( (X, x) ) = { } U

Subset construction Given A, a language recognized by N = (Q,Σ,δ,q0,F) a NFA WTS there is some DFA M with L(M) = A Construction Define M = (Q', Σ, δ',q0', F') with Q' = the power set of Q = { X | X is a subset of Q } q0' = { q0 } U δ((q0, ε)) … F' = { X | X is a subset of Q and X F is nonempty } δ' ( (X, x) ) = { q in Q | q is in δ(r,x) for some r in X or accessible via spontaneous moves} U Types?

Subset construction warmup examples

Subset construction example

Recap Regular sets of strings i.e., those that aren't too complicated are those that are the language of some DFA, or equivalently, the language of some NFA. If a set of strings can be expressed as the result of complement, union, intersection, concatenation, Kleene star of regular languages, then it itself is regular.

Regular expressions Can all regular languages be expressed as those that are built up from very simple languages using the regular operations?

Inductive application of closure Sipser 1.52 p. 64 R is a regular expression over Σ if Σ is shorthand for (0 U 1) if Σ = {0,1}, Parentheses may be omitted, R+ means RR*, Rk means R concatenated with itself k times Watch out for overloaded symbols!

Syntax  Languages The language described by a regular expression, L(R): L ( (0 U 1)U1 ) = { } L ( ) = { }

L(R) Which of the following strings is not in the language described by ( ( (00)*(11) ) U 01 )* 00 01 1101 I don't know

L(R) Let L be the language over {a,b} described by the regular expression ((a U Ø) b*)* Which of the following is not true about L? Some strings in L have equal numbers of a's and b's L contains the string aaaaaa a's never follow b's in any string in L L can also be represented by the regular expression (ab*)* More than one of the above.

Regular expressions in practice Compilers: first phase of compiling transforms Strings to Tokens keywords, operators, identifiers, literals One regular expression for each token type Other software tools: grep, Perl, Python, Java, Ruby, …

"Regular = regular" Sipser Theorem 1.54 p. 66 Theorem: A language is regular if and only if some regular expression describes it. Lemma 1.55: If a language is described by a regular expression, then it is regular. Lemma 1.60: If a language is regular, then it is described by some regular expression