Regular Expressions: Review A FA for a regular expressions can be built by composition: Ex: all strings over S={a,b} where  a “b” preceding an “a” (a+b)

Slides:



Advertisements
Similar presentations
CS 345: Chapter 9 Algorithmic Universality and Its Robustness
Advertisements

4b Lexical analysis Finite Automata
CMPS 3223 Theory of Computation
8/25/2009 Sofya Raskhodnikova Intro to Theory of Computation L ECTURE 1 Theory of Computation Course information Overview of the area Finite Automata Sofya.
1 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 3 School of Innovation, Design and Engineering Mälardalen University 2012.
Formal Languages: Review Alphabet: a finite set of symbols String: a finite sequence of symbols Language: a set of strings String length: number of symbols.
NP Completeness Tractability Polynomial time Computation vs. verification Power of non-determinism Encodings Transformation & reducibilities P vs. NP “Completeness”
Recap CS605: The Mathematics and Theory of Computer Science.
Formal Languages: Review Alphabet: a finite set of symbols String: a finite sequence of symbols Language: a set of strings String length: number of symbols.
Nathan Brunelle Department of Computer Science University of Virginia Theory of Computation CS3102 – Spring 2014 A tale.
1 Introduction to Computability Theory Lecture3: Regular Expressions Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture12: Decidable Languages Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture2: Non Deterministic Finite Automata Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture4: Regular Expressions Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture3: Regular Expressions Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture11: Variants of Turing Machines Prof. Amos Israeli.
1 The scanning process Main goal: recognize words/tokens Snapshot: At any point in time, the scanner has read some input and is on the way to identifying.
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.
CS5371 Theory of Computation Lecture 6: Automata Theory IV (Regular Expression = NFA = DFA)
79 Regular Expression Regular expressions over an alphabet  are defined recursively as follows. (1) Ø, which denotes the empty set, is a regular expression.
Lecture 5UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 5.
Lexical Analysis Part 2 Professor Yihjia Tsai Tamkang University.
Context-Free Grammars: Review Basic idea: set of production rules induces a language Finite set of variables: V = {V 1, V 2,..., V k } Finite set of terminals:
Final Exam Review Cummulative Chapters 0, 1, 2, 3, 4, 5 and 7.
Nathan Brunelle Department of Computer Science University of Virginia Theory of Computation CS3102 – Spring 2014 A tale.
Nathan Brunelle Department of Computer Science University of Virginia Theory of Computation CS3102 – Spring 2014 A tale.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen Department of Computer Science University of Texas-Pan American.
Basics of automata theory
CS490 Presentation: Automata & Language Theory Thong Lam Ran Shi.
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
REGULAR LANGUAGES.
Introduction to CS Theory Lecture 15 –Turing Machines Piotr Faliszewski
4b 4b Lexical analysis Finite Automata. Finite Automata (FA) FA also called Finite State Machine (FSM) –Abstract model of a computing entity. –Decides.
Computability Construct TMs. Decidability. Preview: next class: diagonalization and Halting theorem.
Theory of Computing Lecture 21 MAS 714 Hartmut Klauck.
January 9, 2015CS21 Lecture 31 CS21 Decidability and Tractability Lecture 3 January 9, 2015.
1 Turing Machines Reading: Chapter 8. 2 Turing Machines are… Very powerful (abstract) machines that could simulate any modern day computer (although very,
Automata & Formal Languages, Feodor F. Dragan, Kent State University 1 CHAPTER 3 The Church-Turing Thesis Contents Turing Machines definitions, examples,
D E C I D A B I L I T Y 1. 2 Objectives To investigate the power of algorithms to solve problems. To explore the limits of algorithmic solvability. To.
CS 208: Computing Theory Assoc. Prof. Dr. Brahim Hnich Faculty of Computer Sciences Izmir University of Economics.
1 Section 13.1 Turing Machines A Turing machine (TM) is a simple computer that has an infinite amount of storage in the form of cells on an infinite tape.
1 Turing Machines and Equivalent Models Section 13.1 Turing Machines.
Formal Languages Alphabet: a finite set of symbols String: a finite sequence of symbols Language: a (possibly  ) set of strings String length: number.
98 Nondeterministic Automata vs Deterministic Automata We learned that NFA is a convenient model for showing the relationships among regular grammars,
Chapter 5 Finite Automata Finite State Automata n Capable of recognizing numerous symbol patterns, the class of regular languages n Suitable for.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 12 Mälardalen University 2007.
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen.
1 Introduction to the Theory of Computation Regular Expressions.
Formal Languages Alphabet: a finite set of symbols String: a finite sequence of symbols Language: a (possibly  ) set of strings String length: number.
Formal Languages Alphabet: a finite set of symbols String: a finite sequence of symbols Language: a (possibly  ) set of strings String length: number.
Theory of Computation Automata Theory Dr. Ayman Srour.
1 Section 11.2 Finite Automata Can a machine(i.e., algorithm) recognize a regular language? Yes! Deterministic Finite Automata A deterministic finite automaton.
1 8.4 Extensions to the Basic TM Extended TM’s to be studied: Multitape Turing machine Nondeterministic Turing machine The above extensions make no increase.
Lecture 09: Theory of Automata:2014 Asif NawazUIIT, PMAS-Arid Agriclture University Rawalpindi. Kleene’s Theorem and NFA.
MA/CSSE 474 Theory of Computation Decision Problems, Continued DFSMs.
CS6800 Advance Theory of Computation Spring 2016 Nasser Alsaedi
Theory of Computation Automata Theory Dr. Ayman Srour.
Topic 3: Automata Theory 1. OutlineOutline Finite state machine, Regular expressions, DFA, NDFA, and their equivalence, Grammars and Chomsky hierarchy.
Kleene’s Theorem and NFA
Non Deterministic Automata
Regular Expressions: Review
CSCI 2670 Introduction to Theory of Computing
Formal Languages: Review
Chapter 2 FINITE AUTOMATA.
REGULAR LANGUAGES AND REGULAR GRAMMARS
Jaya Krishna, M.Tech, Assistant Professor
Chapter 1 Regular Language
NP Completeness • Tractability • Polynomial time
Presentation transcript:

Regular Expressions: Review A FA for a regular expressions can be built by composition: Ex: all strings over S={a,b} where  a “b” preceding an “a” (a+b) * b(a+b) * a(a+b) * = (a+b) * ba(a+b) * baba      ba    Why?        b a b a      b a           b a b a      b a           b a b a      b a           Remove previous start/final states

FA Minimization: Review Idea: “Equivalent” states can be merged: b a a,b 3 states! 16 states! b a b a      b a           b a b a     b a           b a a,b       b a    merge

FA Minimization: Review Theorem [Hopcroft 1971]: the number N of states in a FA can be minimized within time O(N log N). Based on earlier work by [Huffman 1954] and [Moore 1956]. Conjecture: Minimizing the number of states in a nondeterministic FA can not be done in polynomial time. Theorem: Minimizing the number of states in a pushdown automaton (or TM) is undecidable. Project idea: implement a finite automaton minimization tool. Try to design it to run reasonably efficiently. Consider also including: A regular-expression-to-FA transformer, A non-deterministic-to-deterministic FA converter.

M FAs and Regular Expressions: Review Theorem: Any FA accepts a language denoted by some RE. Proof: Use “generalized finite automata” where each transition can be a regular expression (not just a symbol), and: Only one super start state and one (separate) super final state. Every state has transitions to all other states (including itself), except the super start state, with no incoming transitions, and the super final state, which has no outgoing transitions. Original FA M M         Ø Ø Ø Ø Ø Ø Ø Ø Ø  Generalized FA (GFA) M’ M’

FAs and Regular Expressions: Review Now reduce the size of the GFA by one state at each step. A transformation step is as follows: qiqi qjqj q’ R S T P qiqi qjqj P RS * T qiqi qjqj P + RS * T Such a transformation step is always possible, until the GFA has only two states, the super-start and super-final states: Label of last remaining transition is the regular expression corresponding to the language of the original FA! M’ P Corollary: FAs and REs denote the same class of languages.

Regular Expressions Identities: Review R+S = S+R R(ST) = (RS)T R(S+T) = RS+RT (R+S)T = RT+ST Ø * =  * =  R+Ø  = Ø+R = R R  =  R = R (R * ) * = R * (  + R) * = R * (R * S * ) * = (R+S) * R+  ≠ R RØ ≠ R

Extra credit: use this tool! (to implement some nontrivial TMs, PDAs, grammars, etc.)

Why Study Non-determinism? 1.Helps understand the ubiquitous concept of parallelism / concurrency; 2.Illuminates the structure of problems; 3.Can help save time & effort by solving intractable problems more efficiently; 4.Enables vast, deep, and general studies of “completeness” theories; 5.Helps explain why verifying proofs & solutions seems to be easier than constructing them;

Why Study Non-determinism? 6.Gave rise to new and novel mathematical approaches, proofs, and analyses; 7.Robustly decouples / abstracts complexity from underlying computational models; 8.Gives disciplined techniques for identifying “hardest” problems / languages; 9.Forged new unifications between computer science, math & logic; 10.Non-determinism is interesting fun, and cool!

Problem: compute in your head = 

Problem: What is the approximate value of: = e to 18,457,734,525,360,901,453,873,570 digits of precision! 1 + = 85 )( 3 2 6*7 9 -(4 ) 1 + = ? 85 1 )( = 85 1 )( 3 2 6*7 9 4 N N (1+9^(-(4^(7*6))))^(3^(2^85)) ≈ ?

Problem: Does the Pythagorean theorem generalize to arbitrary figures on the sides of a right triangle?

Problem: Does every closed simple curve contain the vertices of an equilateral triangle? What approaches fail? What techniques work and why? Lessons and generalizations

Problem: Can an 8x8 board with two opposite corners missing be tiles with 31 dominoes? = 31 x? What approaches fail? What techniques work and why? Lessons and generalizations

Problem: Explain the apparent discrepancy between the areas of the two arrangements. What approaches fail? What techniques work and why? Lessons and generalizations

Problem: Explain the apparent discrepancy between the areas of the three arrangements. What approaches fail? What techniques work and why? Lessons and generalizations

Larger alphabet: old: Σ={0,1} new: Σ’ ={a,b,c,d} Idea: Encode larger alphabet using smaller one. Encoding example: a=00, b=01, c=10, d=11 Turing Machine “Enhancements” badca old: δ b 01 new: δ'

Double-sided infinite tape: Turing Machine “Enhancements” Idea: Fold into a normal single-sided infinite tape old: δ L/R new: δ' L/RR/L

b Multiple heads: Turing Machine “Enhancements” Idea: Mark heads locations on tape and simulate Modified δ ' processes each “virtual” head independently: Each move of δ is simulated by a long scan & update δ ' updates & marks all “virtual” head positions bbbaaa ba bbbaaabab baB B A A bB BAb

Multiple tapes: Turing Machine “Enhancements” Idea: Interlace multiple tapes into a single tape Modified δ ' processes each “virtual” tape independently: Each move of δ is simulated by a long scan & update δ ' updates R/W head positions on all “virtual tapes”

Two-dimensional tape: Turing Machine “Enhancements” Idea: Flatten 2-D tape into a 1-D tape Modified 1-D δ ' simulates the original 2-D δ: Left/right δ moves: δ ' moves horizontally Up/down δ moves: δ ' jumps between tape sections $$$ This is how compilers implement 2D arrays!

Non-determinism: Turing Machine “Enhancements” Idea: Parallel-simulate non-deterministic threads Modified deterministic δ ' simulates the original ND δ: Each ND move by δ spawns another independent “thread” All current threads are simulated “in parallel” $$ $

Turing Machine “Enhancements” Theorem: Combinations of “enhancements” do not increase the power of Turing machines. Combinations: Idea: “Enhancements” are independent (and commutative WRT preserving the language recognized) Wol!dr Heoll Παωνλτ 3 ND