CS 490: Automata and Language Theory Daniel Firpo Spring 2003.

Slides:



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

CFGs and PDAs Sipser 2 (pages ). Long long ago…
CS21 Decidability and Tractability
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 Lecture12: Decidable Languages Prof. Amos Israeli.
CFGs and PDAs Sipser 2 (pages ). Last time…
Introduction to Computability Theory
CFG => PDA Sipser 2 (pages ).
NFAs Sipser 1.2 (pages 47–54). CS 311 Mount Holyoke College 2 Recall… Last time we showed that the class of regular languages is closed under: –Complement.
1 Introduction to Computability Theory Lecture7: PushDown Automata (Part 1) Prof. Amos Israeli.
CFG => PDA Sipser 2 (pages ). CS 311 Fall Formally… A pushdown automaton is a sextuple M = (Q, Σ, Γ, δ, q 0, F), where – Q is a finite set.
Decidable languages Sipser 4.1 (pages ). CS 311 Mount Holyoke College 2 Hierarchy of languages All languages Turing-recognizable Turing-decidable.
CS5371 Theory of Computation
Introduction to the Theory of Computation John Paxton Montana State University Summer 2003.
Fall 2006Costas Busch - RPI1 Deterministic Finite Automata And Regular Languages.
CS 310 – Fall 2006 Pacific University CS310 Pushdown Automata Sections: 2.2 page 109 October 9, 2006.
Foundations of (Theoretical) Computer Science Chapter 2 Lecture Notes (Section 2.2: Pushdown Automata) Prof. Karen Daniels, Fall 2009 with acknowledgement.
January 14, 2015CS21 Lecture 51 CS21 Decidability and Tractability Lecture 5 January 14, 2015.
Pushdown Automaton (PDA)
Grammars, Languages and Finite-state automata Languages are described by grammars We need an algorithm that takes as input grammar sentence And gives a.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
1 Non-Deterministic Finite Automata. 2 Alphabet = Nondeterministic Finite Automaton (NFA)
CS5371 Theory of Computation Lecture 12: Computability III (Decidable Languages relating to DFA, NFA, and CFG)
CS 3240: Languages and Computation Pushdown Automata & CF Grammars NOTE: THESE ARE ONLY PARTIAL SLIDES RELATED TO WEEKS 9 AND 10. PLEASE REFER TO THE TEXTBOOK.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
CS490 Presentation: Automata & Language Theory Thong Lam Ran Shi.
CSE202: Introduction to Formal Languages and Automata Theory Chapter 9 The Turing Machine These class notes are based on material from our textbook, An.
CSCI 2670 Introduction to Theory of Computing September 28, 2005.
Theory of Languages and Automata
TM Design Universal TM MA/CSSE 474 Theory of Computation.
Pushdown Automata CS 130: Theory of Computation HMU textbook, Chap 6.
Pushdown Automata (PDAs)
4b 4b Lexical analysis Finite Automata. Finite Automata (FA) FA also called Finite State Machine (FSM) –Abstract model of a computing entity. –Decides.
CS 461 – Sept. 19 Last word on finite automata… –Scanning tokens in a compiler –How do we implement a “state” ? Chapter 2 introduces the 2 nd model of.
Turing Machines Chapter 17. Languages and Machines SD D Context-Free Languages Regular Languages reg exps FSMs cfgs PDAs unrestricted grammars Turing.
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
CS 208: Computing Theory Assoc. Prof. Dr. Brahim Hnich Faculty of Computer Sciences Izmir University of Economics.
INHERENT LIMITATIONS OF COMPUTER PROGAMS CSci 4011.
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
Foundations of (Theoretical) Computer Science Chapter 2 Lecture Notes (Section 2.2: Pushdown Automata) Prof. Karen Daniels, Fall 2010 with acknowledgement.
Computability Review homework. Video. Variations. Definitions. Enumerators. Hilbert's Problem. Algorithms. Summary Homework: Give formal definition of.
CSCI 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Pushdown.
CSCI 2670 Introduction to Theory of Computing October 13, 2005.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Pushdown.
using Deterministic Finite Automata & Nondeterministic Finite Automata
Automata & Formal Languages, Feodor F. Dragan, Kent State University 1 CHAPTER 3 The Church-Turing Thesis Contents Turing Machines definitions, examples,
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Pushdown.
Pushdown Automata Hopcroft, Motawi, Ullman, Chap 6.
FORMAL LANGUAGES, AUTOMATA, AND COMPUTABILITY
Deterministic Finite Automata Nondeterministic Finite Automata.
Theory of Computation Automata Theory Dr. Ayman Srour.
1 Unit – 5 : STATE MACHINES Syllabus: Languages and Grammars – Finite State Machines State machines and languages – Turing Machines – Computational Complexity.
Theory of Languages and Automata By: Mojtaba Khezrian.
1 Turing Machines. 2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
CS6800 Advance Theory of Computation Spring 2016 Nasser Alsaedi
Lecture 11  2004 SDU Lecture7 Pushdown Automaton.
Pushdown Automata - like NFA-  but also has a stack - transition takes the current state, the current input symbol, and the top-of-the-stack symbol (which.
Language Recognition MSU CSE 260.
CSE 105 theory of computation
CSE322 The Chomsky Hierarchy
Chapter 3: The CHURCH-Turing thesis
Intro to Theory of Computation
Context-Free Grammars
Pushdown automata a_introduction.htm.
CS21 Decidability and Tractability
Decidability and Tractability
Chapter 1 Regular Language
The Chomsky Hierarchy Costas Busch - LSU.
Presentation transcript:

CS 490: Automata and Language Theory Daniel Firpo Spring 2003

Regular Languages Finite Automata (also known as the Finite State Machine) Regular Expressions

Regular Languages: Finite Automata Formally, a finite automaton is a 5-tuple (Q, Σ, δ, q 0, F), where: Q is a finite set of states, Σ is a finite set called the alphabet (of the automaton), δ : Q x Σ --> Q is the transition function, q 0  Q is the start state, and F  Q is the set of accept states.

Regular Languages: Finite Automata Finite Automaton are visually represented as state diagrams. For example: Finite Automaton, M: q1q1 q2q2 q3q ,1

Regular Languages: Finite Automata Finite Automaton, M: M = (Q, Σ, δ, q 0, F): Q = {q 1, q 2, q 3 }, Σ = {0,1}, δ is described as: 01 –q 1 q 1 q 2 –q 2 q 3 q 2 –q 3 q 2 q 2 q 1 is the start state, And F = {q 2 }. q1q1 q2q2 q3q ,1

Regular Languages: Finite Automata The type of finite automaton described in the preceding example is a deterministic finite automaton (DFA). An easier model to work with is the nondeterministic finite automaton (NFA).

Regular Languages: Finite Automata While in a DFA, every state must have exactly one transition path for each symbol in the automaton’s alphabet, an NFA can have as one, none, or as many transition path as it needs for each symbol in the alphabet. An NFA can also have a transition path(s) for the empty input, ε. DFA’a and NFA’s are equivalent.

Regular Languages: Finite Automata Formally, an NFA is a 5-tuple (Q, Σ, δ, q 0, F), where: Q is a finite set of states, Σ is a finite set called the alphabet (of the automaton), δ : Q x Σ ε --> P(Q) is the transition function, q 0  Q is the start state, and F  Q is the set of accept states.

q4q4 Regular Languages: Finite Automata The NFA, N: N = (Q, Σ, δ, q 0, F): Q = {q 1, q 2, q 3, q 4 }, Σ = {0,1}, δ is described as: 01 ε –q 1 { q 1 }{q 1,q 2 }Ø –q 2 { q 3 } Ø{q 3 } –q 3 Ø q 2 Ø –q 4 {q 4 }{q 4 } Ø q 1 is the start state, And F = {q 4 }. q1q1 q2q2 0,1 1 q3q3 0, ε 1

Regular Languages: Regular Operations: Union: A  B = {x|x  A or x  B}, Concatenation: AB = {xy|x  A and x  B}, Star: A * = {x 1 x 2 …x k |k  0 and each x i  A}. The class of regular languages is closed under the regular operations. That is, if A and B are regular languages, than so is A  B, AB, and A *.

Regular Languages: Regular Expressions Formally, we say that R is a regular expression if R is: A, for some a in the alphabet Σ, ε, the empty string, Ø, the empty language, A  B, AB, or A *, Where A and B are regular languages.

Regular Languages: Regular Expressions Regular expressions are useful for designing compilers. The syntax of the tokens, the elemental objects in a programming language, such as the variables and constants, can be described by regular expressions. Once this is done, systems generate the lexical analyzer, which processes the input program. Regular expressions and finite automata are equivalent.

Context-Free Languages Pushdown automata (PDA) Context-free grammars (CFG)

Context-Free Languages: Pushdown Automaton A PDA is very similar to a NFA. The main difference is that a PDA has a stack, which serves to provide additional memory to the automata.

Context-Free Languages: Pushdown Automaton Formally, a pushdown automaton is a 6-tuple (Q, Σ, Γ, δ, q 0, F), where: Q is a finite set of states, Σ is a finite set called the alphabet (of the automaton), Γ is the stack alphabet, δ : Q x Σ ε x Γ ε --> P(Q x Γ ε ) is the transition function, q 0  Q is the start state, and F  Q is the set of accept states.

q4q4 q3q3 Context-Free Languages: Pushdown Automata The PDA, M: M = (Q, Σ, Γ, δ, q 0, F): Q = {q 1, q 2, q 3, q 4 }, Σ = {0,1}, Γ = {0,$}, δ is described on the next slide, q 1 is the start state, And F = {q 1,q 4 }. q1q1 q2q2 0,ε  0 ε,ε  ε 1,0  ε ε,$  ε

Context-Free Languages: Pushdown Automata The PDA, M: δ is described by: q4q4 q3q3 q1q1 q2q2 0,ε  0 ε,ε  ε 1,0  ε ε,$  ε Σ ε -- Γ0$ ε 0$ ε 0$ ε q1q1 q 2,$ q2q2 q 2,0q3,εq3,ε q3q3 q3,εq3,ε q4,εq4,ε q4q4

Context-Free Languages: Context-Free Grammars Formally, a context-free grammar is a 4- tuple, (V, Σ, R, S), where: V is a finite set of variables, Σ is a finite set of terminals, R is a finite set of rules, and S  V is the start variable.

Context-Free Languages: Context-Free Grammars For example, the following grammar: –G = (V, Σ, R, S), where –V = {S,T}, –Σ = {0,1}, –and R, the rules, are S  0S1 | T T  ε Generates strings such as 01, 0011, and The language of this grammar, L(G), is: {0 n 1 n | n  0}. CFG’s and PDA’s are equivalent.

Turing Machines Turing Machines (TM) are similar to PDA’s, but with memory that is unlimited and unrestricted. The Turing Machine uses an infinite tape. The tape head can read and write symbols on the tape. It can also move to the left or right over the tape. Turing machines have accept states and reject states, which take immediate effect.

Turing Machines Turing machines are formally defined as a 7-tuple, (Q, Σ, Γ, δ, q 0, q accept, q reject ), where Q is a finite set of states, Σ is the input alphabet, Γ is the tape alphabet, containing the special blank symbol, , where   Γ and Σ  Γ, δ : Q x Γ  Q x Γ x {L,R} is the transition function, q 0  Q is the start state, q accept  Q is the accept state, and q reject  Q is the reject state, where q reject != q accept.

Turing Machines An example, the Turing machine, M: q3q3 q1q1 xRxR q5q5 0LxL0LxL q2q2 q5q5 xRxR q reject q accept xRxR RxRRxR RR RR 0,R0,R 0x,R0x,R LL RR 0x,R0x,R 0x0x

Turing Machines In this Turing Machine, M = (Q,Σ,Γ,δ,q 0,q accept,q reject ), such that Q = {q 1,q 2,q 3,q 4,q 5,q accept,q reject }, Σ = {0}, Γ = {0,x,  }, δ is described by the state diagram on the previous slide, The start state is q 0, The accept state is q accept, and The reject state is q reject. M decides the language A = {0 2^n | n  0}.

Decidability A language is called Turing recognizable if some Turing machine recognizes it. When a Turing machine receives an input, it can either accept, reject, or loop. The machine fails to accept an input that either rejects or loops. A Turing machine that never loops (either accepts or rejects) is called a decider. A decider that recognizes a language is also said to decide the language. A language is decidable if some Turing machine decides it. The TM in the previous example was a decider.

Decidability The relationship among the four main classes of languages: Regular Context-free Decidable Turing-recognizable

Resource: Sipser, Michael. Introduction to the Theory of Computation. Boston: PWS Publishing Company, 1997.