1 Lecture 23 Decision problems about regular languages –Programs can be inputs to other programs FSA’s, NFA’s, regular expressions –Basic problems are.

Slides:



Advertisements
Similar presentations
Recognising Languages We will tackle the problem of defining languages by considering how we could recognise them. Problem: Is there a method of recognising.
Advertisements

Lecture 19. Reduction: More Undecidable problems
1 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 3 School of Innovation, Design and Engineering Mälardalen University 2012.
Discrete Mathematics Lecture 5 Alexander Bukharovich New York University.
1 Module 20 NFA’s with -transitions –NFA- ’s Formal definition Simplifies construction –LNFA- –Showing LNFA  is a subset of LNFA (extra credit) and therefore.
1 Introduction to Computability Theory Lecture12: Decidable Languages Prof. Amos Israeli.
Lexical Analysis III Recognizing Tokens Lecture 4 CS 4318/5331 Apan Qasem Texas State University Spring 2015.
1 Lecture 4 Topics –Problem solving Subroutine Theme –REC language class The class of solvable problems Closure properties.
CPSC 411, Fall 2008: Set 12 1 CPSC 411 Design and Analysis of Algorithms Set 12: Undecidability Prof. Jennifer Welch Fall 2008.
1 Lecture 4: Formal Definition of Solvability Analysis of decision problems –Two types of inputs:yes inputs and no inputs –Language recognition problem.
1 Module 15 FSA’s –Defining FSA’s –Computing with FSA’s Defining L(M) –Defining language class LFSA –Comparing LFSA to set of solvable languages (REC)
Lecture 9 Recursive and r.e. language classes
1 Lecture 14 Language class LFSA –Study limits of what can be done with FSA’s –Closure Properties –Comparing to other language classes.
1 Module 19 LNFA subset of LFSA –Theorem 4.1 on page 131 of Martin textbook –Compare with set closure proofs Main idea –A state in FSA represents a set.
1 Module 9 Recursive and r.e. language classes –representing solvable and half-solvable problems Proofs of closure properties –for the set of recursive.
Lecture 8 Recursively enumerable (r.e.) languages
Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)
1 Lecture 21 Regular languages review –Several ways to define regular languages –Two main types of proofs/algorithms Relative power of two computational.
1 Module 21 Closure Properties for LFSA using NFA’s –From now on, when I say NFA, I mean any NFA including an NFA- unless I add a specific restriction.
1 Undecidability Andreas Klappenecker [based on slides by Prof. Welch]
Why the algorithm works! Converting an NFA into an FSA.
1 Lecture 20 Regular languages are a subset of LFSA –algorithm for converting any regular expression into an equivalent NFA –Builds on existing algorithms.
1 Lecture 26 Decision problems about regular languages –Basic problems are solvable halting, accepting, and emptiness problems –Solvability of other problems.
12/3CSE NP-complete CSE Algorithms NP Completeness Approximations.
1 Lecture 10 Proving more specific problems are not recursive Reduction technique –Use subroutine theme to show that if one problem is unsolvable, so is.
Why the algorithm works! Simulating 2 FSA’s with 1 FSA.
1 Lecture 16 FSA’s –Defining FSA’s –Computing with FSA’s Defining L(M) –Defining language class LFSA –Comparing LFSA to set of solvable languages (REC)
1 Module 18 NFA’s –nondeterministic transition functions computations are trees, not paths –L(M) and LNFA LFSA subset of LNFA –Comparing computational.
Lecture 18 NFA’s with -transitions –NFA- ’s Formal definition Simplifies construction –LNFA- –Showing LNFA  is a subset of LNFA and therefore a subset.
1 Lecture 2 Topics –Importance of this material Fundamental Limitations –Connecting Problems and Languages Problems –Search, function and decision problems.
1 Lecture 16 FSA’s –Defining FSA’s –Computing with FSA’s Defining L(M) –Defining language class LFSA –Comparing LFSA to set of solvable languages (REC)
1 Lecture 5 Topics –Closure Properties for REC Proofs –2 examples Applications.
1 Lecture 18 Closure Properties of Language class LFSA –Remember ideas used in solvable languages unit –Set complement –Set intersection, union, difference,
1 Lecture 15 Distinguishability –Definition –Help in designing/debugging FSA’s NFA’s –nondeterministic transition functions computations are trees, not.
1 Lecture 16 NFA’s –nondeterministic transition functions computations are trees, not paths –L(M) and LNFA LFSA subset of LNFA –Comparing computational.
1 Module 25 Decision problems about regular languages –Basic problems are solvable halting, accepting, and emptiness problems –Solvability of other problems.
1 Lecture 19 Closure Properties for LFSA using NFA’s –union second proof –concatenation –Kleene closure.
CS5371 Theory of Computation Lecture 4: Automata Theory II (DFA = NFA, Regular Language)
1 Lecture 20 LNFA subset of LFSA –Theorem 4.1 on page 105 of Martin textbook –Compare with set closure proofs Main idea –A state in FSA represents a set.
1 Module 4: Formal Definition of Solvability Analysis of decision problems –Two types of inputs:yes inputs and no inputs –Language recognition problem.
Converting an NFA into an FSA Proving LNFA is a subset of LFSA.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
1 Module 10 Recursive and r.e. language classes –representing solvable and half-solvable problems Proofs of closure properties –for the set of recursive.
CS5371 Theory of Computation Lecture 12: Computability III (Decidable Languages relating to DFA, NFA, and CFG)
Lexical Analysis — Part II: Constructing a Scanner from Regular Expressions.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong NFA to DFA.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University 2010.
2. Regular Expressions and Automata 2007 년 3 월 31 일 인공지능 연구실 이경택 Text: Speech and Language Processing Page.33 ~ 56.
 2005 SDU Lecture13 Reducibility — A methodology for proving un- decidability.
Regular Expressions Fundamental Data Structures and Algorithms Peter Lee March 13, 2003.
1 Module 12 Computation and Configurations –Formal Definition –Examples.
1 Module 17 Closure Properties of Language class LFSA –Remember ideas used in solvable languages unit –Set complement –Set intersection, union, difference,
CS 461 – Oct. 28 TM applications –Recognize a language √ –Arithmetic √ –Enumerate a set –Encode a data structure or problem to solve Two kinds of TMs –Decider:
BİL711 Natural Language Processing1 Regular Expressions & FSAs Any regular expression can be realized as a finite state automaton (FSA) There are two kinds.
Decidability Decidable/Undecidable problems. Jaruloj Chongstitvatana Decidability2 Accepting: Definition Let T = (Q, , , , s) be a TM. T accepts.
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 Module 12 Computation and Configurations –Formal Definition –Examples.
Algorithms and Decision Procedures for Regular Languages Chapter 9.
 2005 SDU Lecture11 Decidability.  2005 SDU 2 Topics Discuss the power of algorithms to solve problems. Demonstrate that some problems can be solved.
Decidability.
Chapters 11 and 12 Decision Problems and Undecidability.
The Definition of Algorithm
CSE 105 theory of computation
Decision Properties of Regular Languages
Decidable Languages Costas Busch - LSU.
Instructor: Aaron Roth
Nondeterministic Finite State Automata (Dr. Torng)
CSE 105 theory of computation
More Undecidable Problems
CSE 105 theory of computation
Presentation transcript:

1 Lecture 23 Decision problems about regular languages –Programs can be inputs to other programs FSA’s, NFA’s, regular expressions –Basic problems are solvable halting, accepting, and emptiness problems –Solvability of other problems many-one reductions to basic problems

2 Problems with programs as inputs

3 Decision problems with numbers as inputs Examples –Primality: Input: integer n Yes/No question: Is n prime? –Zero: Input: integer n Yes/No question: Is n = 0? –Equal: Input: integers m, n Yes/No question: Is m=n?

4 Decision problems with programs as inputs Examples –Lines of code: Input: program P, integer n Yes/No question: Does P have less than n lines of code? –Empty language: Input: program P Yes/No question: Is L(P) = {}? –Equal: Input: programs P, Q Yes/No question: Is L(P) = L(Q)?

5 Language representation Empty language problem: –Input: program P –Yes/No question: Is L(P) = {}? How might we represent input program P? –As a string P over ASCII alphabet What is the language that corresponds to empty language decision problem? –The set of strings representing programs which are yes instances to the empty language problem

6 Programs In this unit, our programs are the following three types of objects –FSA’s –NFA’s –regular expressions Previously, they were C ++ programs –Review those topics after mastering today’s examples

7 Basic Decision Problems (and algorithms for solving them)

8 Divisibility Problem Input –integers m,n Question –Is m a divisor of n? Algorithm DIV for solving divisibility problem –Apply Euclid’s algorithm for finding the greatest common divisor to m and n –If greatest common divisor is m THEN yes ELSE no

9 Halting Problem Input –FSA M –Input string x to M Question –Does M halt on x? Algorithm for solving halting problem –Output yes Correct because an FSA always halts on all input strings

10 Accepting Problem Input –FSA M –Input string x to M Question –Is x in L(M)? Algorithm ACCEPT for solving accepting problem –Run M on x –If halting configuration is accepting THEN yes ELSE no Note this algorithm actually has to do something

11 Primality Problem Input –integer n Question –Is n a prime number? Algorithm for solving primality problem –for i = 2 to n-1 Do apply algorithm DIV to inputs i,n If answer for any i is yes THEN no ELSE yes

12 Empty Language Problem Input –FSA M Question –Is L(M)={}? How would you solve this problem?

13 Algorithms for solving empty language problem Algorithm 1 –View FSA M as a directed graph (nodes, arcs) –See if any accepting node is reachable from the start node Algorithm 2 –Let n be the number of states in FSA M –Run ACCEPT(M,x) for all input strings of length < n –If any are accepted THEN no ELSE yes Why is algorithm 2 correct? –Same underlying reason for why algorithm 1 works. –If any string is accepted by M, some string x must be accepted where M never is in the same state twice while processing x –This string x will have length at most n-1

14 Solving Other Problems (using many-one reductions)

15 Complement Empty Problem Input –FSA M Question –Is (L(M)) c ={}? Use many-one reductions to solve this problem –We will show that the Complement Empty problem many-one reduces to the Empty Language problem –How do we do this? Apply the construction which showed that LFSA is closed under set complement

16 Algorithm Description Convert input FSA M into an FSA M’ such that L(M’) = (L(M)) c –We do this by applying the algorithm which we used to show that LFSA is closed under complement Feed FSA M’ into algorithm which solves the empty language problem If that algorithm returns yes THEN yes ELSE no

17 Reduction Illustrated Algorithm for solving empty language problem FSA M Complement Construction FSA M’ Yes/No Algorithm for complement empty problem The complement construction algorithm is the many-one reduction function. If M is a yes input instance of CE, then M’ is a yes input instance of EL. If M is a no input instance of CE, then M’ is a no input instance of EL.

18 NFA Empty Problem Input –NFA M Question –Is L(M)={}? Use many-one reductions to solve this problem –We will show that the NFA Empty problem many-one reduces to the Empty Language problem –How do we do this? Apply the construction which showed that any NFA can be converted into an equivalent FSA

19 Algorithm Description Convert input NFA M into an FSA M’ such that L(M’) = L(M) –We do this by applying the algorithms which we used to show that LNFA is a subset of LFSA Feed FSA M’ into algorithm which solves the empty language problem If that algorithm returns yes THEN yes ELSE no

20 Reduction Illustrated Algorithm for solving empty language problem NFA M Subset Construction FSA M’ Yes/No Algorithm for NFA empty problem The subset construction algorithm is the many-one reduction function. If M is a yes input instance of NE, then M’ is a yes input instance of EL. If M is a no input instance of NE, then M’ is a no input instance of EL.

21 Equal Problem Input –FSA’s M 1 and M 2 Question –Is L(M 1 ) = L(M 2 )? Use many-one reductions to solve this problem –Try and reduce this problem to the empty language problem –If L(M 1 ) = L(M 2 ), then what combination of L(M 1 ) and L(M 2 ) must be empty?

22 Algorithm Description Convert input FSA’s M 1 and M 2 into an FSA M 3 such that L(M 3 ) = (L(M 1 ) - L(M 2 )) union (L(M 2 ) - L(M 1 )) –We do this by applying the algorithm which we used to show that LFSA is closed under symmetric difference (similar to intersection) Feed FSA M 3 into algorithm which solves the empty language problem If that algorithm returns yes THEN yes ELSE no

23 Reduction Illustrated Algorithm for solving empty language problem FSA M 1 FSA M 2 2FSA -> 1FSA Construction FSA M 3 Yes/No Algorithm for Equal problem The 2FSA->1FSA construction algorithm is the many-one reduction function. If (M 1,M 2 ) is a yes input instance of EQ, then M 3 is a yes input instance of EL. If (M 1,M 2 ) is a no input instance of EQ, then M 3 is a no input instance of EL.

24 Summary Decision problems with programs as inputs Basic problems –You need to develop algorithms from scratch based on properties of FSA’s Solving new problems –You need to figure out how to combine the various algorithms we have seen in this unit to solve the given problem