SlideShare une entreprise Scribd logo
1  sur  27
EECS 2001: Introduction to the
Theory of Computation
Muhammad Umair Khan
Decidable Languages
EECS 2001 Introduction to Theory of Computation 2
 Problem: does a NFA / DFA accept a string?
 Problem: does a CFG generate a string?
 Problem: does a PDA accept a string?
 Problem: does TM accept a string?
 We need a yes or no answer. However, to get that answer, we
need the string to go through the DFA/NFA/CFG/PDA/TM
 We can reword our problem as a problem of acceptance
Decidable Languages
EECS 2001 Introduction to Theory of Computation 3
 The problem of acceptance for DFAs of testing whether a
particular string is accepted by a particular DFA can be
presented as a language.
 Such a language will contain pairs of DFA and its
corresponding acceptable strings
ADFA = {(w, D) | D is a DFA which accepts the string w}
w3= 100, Donly one 1
w1= 1100, Dequal 0s and 1s
w2= 001100, Dequal 0s begin/end
Decidable Languages
EECS 2001 Introduction to Theory of Computation 4
 Is ADFA Decidable?
 Can we have an algorithm which takes a DFA D and a string w
and decide whether w is accepted by D?
 If yes, then ADFA is decidable
 How can we achieve this?
Decidable Languages
EECS 2001 Introduction to Theory of Computation 5
 Recap
 Remember that we explored how one TM variant can be converted to
the other…
 Let us call that technique as “simulating TM1 on TM 2”
Decidable Languages
EECS 2001 Introduction to Theory of Computation 6
 Is ADFA Decidable?
 Let us make a TM (algorithm)
1. Simulate the DFA D on the TM and consume w
2. If D ends in the accept state, accept. If D ends in reject
state, reject.
Decidable Languages
EECS 2001 Introduction to Theory of Computation 7
 Is ADFA Decidable?
 Let us make a TM (algorithm)
1. Simulate the DFA D on the TM and consume w
a. keep track of D’s current state
b. keep track of where (the current position) the
machine is while reading w i.e. input
2. If D ends in the accept state, accept. If D ends in reject
state, reject.
Decidable Languages
EECS 2001 Introduction to Theory of Computation 8
 Is ADFA Decidable?
 Implementation details of the TM TDFA.
 Check the input, it should be a pair (D, w)
 D can be represented as Q, Σ, δ, q0, and F. If input is correct, move to the
next step, otherwise reject.
 Start the simulation of D on TDFA.
 Current state of D and current position on the input string w, are stored on the tape
of T.
 Example: at the beginning, the current state would be ___ and the current input
symbol would be the ___________________
 The state and current position keep getting updated based on _________
 When the last input symbol is consumed:
 AND D is in the final state (current state is in F), TDFA accepts.
 If D is not in the final state, TDFA rejects.
Decidable Languages
EECS 2001 Introduction to Theory of Computation 9
 Is ADFA Decidable?
 Implementation details of the TM TDFA.
 Check the input, it should be a pair (D, w)
 D can be represented as Q, Σ, δ, q0, and F. If input is correct, move to the
next step, otherwise reject.
 Start the simulation of D on TDFA.
 Current state of D and current position on the input string w, are stored on the
tape of T.
 Example: at the beginning, the current state would be q0 and the current input
symbol would be the leftmost symbol of w
 The state and current position keep getting updated based on δ
 When the last input symbol is consumed AND:
 D is in the final state (current state is in F), TDFA accepts.
 D is not in the final state, TDFA rejects.
Decidable Languages
EECS 2001 Introduction to Theory of Computation 10
 Is ANFA Decidable?
 TM (algorithm)
 Convert NFA N into DFA D
 Check the input, it should be a pair (D, w)
 D can be represented as Q, Σ, δ, q0, and F. If input is correct, move to the
next step, otherwise reject.
 Start the simulation of D on TDFA.
 Current state of D and current position on the input string w, are stored on the tape
of T.
 Example: at the beginning, the current state would be q0 and the current input
symbol would be the leftmost symbol of w
 The state and current position keep getting updated based on δ
 When the last input symbol is consumed AND:
 D is in the final state (current state is in F), TDFA accepts.
 D is not in the final state, TDFA rejects.
Decidable Languages
EECS 2001 Introduction to Theory of Computation 11
 Is AREX Decidable?
 TM (algorithm)
 Convert Regular Expression REX into NFA N and NFA N into DFA D
 Check the input, it should be a pair (D, w)
 D can be represented as Q, Σ, δ, q0, and F. If input is correct, move to the
next step, otherwise reject.
 Start the simulation of D on TREX.
 Current state of D and current position on the input string w, are stored on the tape
of T.
 Example: at the beginning, the current state would be q0 and the current input
symbol would be the leftmost symbol of w
 The state and current position keep getting updated based on δ
 When the last input symbol is consumed AND:
 D is in the final state (current state is in F), TREX accepts.
 D is not in the final state, TREX rejects.
Decidable Languages
EECS 2001 Introduction to Theory of Computation 12
 In all previous three examples, once we make the TDFA , it can
be used to develop other TMs.
 Think of it as a function call (in programming language terms).
 TDFA would be the called function
Decidable Languages
EECS 2001 Introduction to Theory of Computation 13
 Is the language Aempty Decidable? Also called emptiness testing
 Language which contains no strings
 How to represent it?
 EDFA = {⟨A⟩| A is a DFA and L(A) = ∅}.
Decidable Languages
EECS 2001 Introduction to Theory of Computation 14
 Is the language EDFA Decidable?
 EDFA = {⟨A⟩| A is a DFA and L(A) = ∅}.
 TM (algorithm)
 Start with labelling the initial state of A
 Label any state that can be reached from the already labelled states
using one of the valid transitions
 Repeat this step until no new states can be labelled
 Check whether among all the labelled states, if there is a final state. If
yes, then that means that through some valid sequence of transitions
(which an input string can use), we can get to the final state from the
initial state, reject.
 Remember: we want a DFA which does not accept any string.
Decidable Languages
EECS 2001 Introduction to Theory of Computation 15
 Can we decide whether two given DFAs are equal?
 EQDFA = {⟨A,B⟩| A and B are DFAs and L(A) = L(B)}.
 Any ideas?
Decidable Languages
EECS 2001 Introduction to Theory of Computation 16
 Can we decide whether two given DFAs are equal?
 EQDFA = {⟨A,B⟩| A and B are DFAs and L(A) = L(B)}.
 Design a new language L(C)
 Has all the strings in L(A) which are not in L(B)
 Has all the strings in L(B) which are not in L(A)
L(C) = L(A) ∩ L(B)’ ∪ L(A)’ ∩ L(B)
 this is also called symmetric difference of L(A) and L(B)
 L(C) = ∅ iff L(A) = L(B).
Decidable Languages
EECS 2001 Introduction to Theory of Computation 17
 Can we decide whether two given DFAs are equal?
 EQDFA = {⟨A,B⟩| A and B are DFAs and L(A) = L(B)}.
 Design a new language L(C)
 TM (algorithm)
 Construct DFA for L(C)
 Use TM for EDFA from the previous slides on the input
 If L(C) is empty, i.e., there are no acceptable string, then L(A) = L(B), accept.
 If L(C) is non-empty, i.e., there is at least one acceptable string, then L(A) ≠
L(B), reject.
Decidable Languages
EECS 2001 Introduction to Theory of Computation 18
 Is ACFG decidable?
 Similar to ADFA , here we aim to see whether a string w can be generated by a CFG.
 Any ideas?
Decidable Languages
EECS 2001 Introduction to Theory of Computation 19
 Is ACFG decidable?
 Similar to ADFA , here we aim to see whether a string w can be generated by a CFG.
 Any ideas?
 Can we go though all the different derivations?
 We might have to try infinitely many possibilities
 Especially, if the w is not an acceptable string, the TM will never stop. We will
never not if it is stuck or just processing.
Decidable Languages
EECS 2001 Introduction to Theory of Computation 20
 Is ACFG decidable?
 Similar to ADFA , here we aim to see whether a string w can be generated by a CFG.
 Any ideas?
 Can we go though all the different derivations?
 We might have to try infinitely many possibilities
 Especially, if the w is not an acceptable string, the TM will never stop. We will
never not if it is stuck or just processing.
 We need to convert the problem into one where there are only finite
derivations
 Any ideas?
Decidable Languages
EECS 2001 Introduction to Theory of Computation 21
 Is ACFG decidable?
 Similar to ADFA , here we aim to see whether a string w can be generated by a CFG.
 Any ideas?
 Can we go though all the different derivations?
 We might have to try infinitely many possibilities
 Especially, if the w is not an acceptable string, the TM will never stop. We will
never not if it is stuck or just processing.
 We need to convert the problem into one where there are only finite
derivations
 Any ideas? Chomsky Normal Form. If a CFG is in CNF, any derivation of w
has 2n-1 steps where n = |w|
Decidable Languages
EECS 2001 Introduction to Theory of Computation 22
 Is ACFG decidable?
 Similar to ADFA , here we aim to see whether a string w can be generated by a CFG.
 TM(algorithm)
 Convert CFG G into CNF
 List all the derivations of G with 2n-1 steps such that n = |w|
 If n = 0, list those derivations with one step
 If any of the above derivations generate w, accept, if not, reject.
Decidable Languages
EECS 2001 Introduction to Theory of Computation 23
 Is ECFG decidable?
 Similar to EDFA , here we aim to see whether any string at all can be generated by a
CFG.
 Ideas? Let us use the TM from ACFG
Decidable Languages
EECS 2001 Introduction to Theory of Computation 24
 Is ECFG decidable?
 Similar to EDFA , here we aim to see whether any string at all can be generated by a
CFG.
 Ideas? Let us use the TM from ACFG
 Try all the possible words?
 Infinite possibilities
 S  AB
 A  a
 BB
Decidable Languages
EECS 2001 Introduction to Theory of Computation 25
 Is ECFG decidable?
 Similar to EDFA , here we aim to see whether any string at all can be generated by a
CFG.
 Ideas?
 Can we find whether all variables terminate? i.e., generate terminal symbols
Decidable Languages
EECS 2001 Introduction to Theory of Computation 26
 Is ECFG decidable?
 Similar to EDFA , here we aim to see whether any string at all can be generated by
a CFG.
 TM (algorithm)
 Mark all the terminal symbols
 Mark any variable A if there is a rule in the grammar AX1X2X3…Xk and all
symbols on the RHS have already been marked.
 Keep repeating this until we cannot mark anymore variables
 If we were able to mark the start variable, reject (we were able to reach from the
start variable from terminals).
 If we were not able to mark the start variable, accept (we were not able to reach
the start variable from any of the terminals)
References
EECS 2001 Introduction to Theory of Computation 27
Ideas, problems and their solutions in this lecture/tutorial have been taken from
• Prof. Jeffery Edmonds’ Lecture notes for EECS 2001 at York University
• Prof. Suprakash Datta’ Lecture notes for EECS 2001 at York University
• Introduction to the Theory of Computation (3rd edition) by Michael Sipser
• Introduction to Theory of Computation by Anil Maheshwari and Michiel Smid
• Wikipedia and other webpages of different professors/universities

Contenu connexe

Similaire à Winter 9 Decidability.pptx

@vtucode.in-module-1-21CS51-5th-semester (1).pdf
@vtucode.in-module-1-21CS51-5th-semester (1).pdf@vtucode.in-module-1-21CS51-5th-semester (1).pdf
@vtucode.in-module-1-21CS51-5th-semester (1).pdf
FariyaTasneem1
 
Winter 10 Undecidability.pptx
Winter 10 Undecidability.pptxWinter 10 Undecidability.pptx
Winter 10 Undecidability.pptx
HarisPrince
 
Winter 10 Lecture 2 ATM Undecidability - Formal Proof.pptx
Winter 10 Lecture 2 ATM Undecidability - Formal Proof.pptxWinter 10 Lecture 2 ATM Undecidability - Formal Proof.pptx
Winter 10 Lecture 2 ATM Undecidability - Formal Proof.pptx
HarisPrince
 
02. chapter 3 lexical analysis
02. chapter 3   lexical analysis02. chapter 3   lexical analysis
02. chapter 3 lexical analysis
raosir123
 

Similaire à Winter 9 Decidability.pptx (20)

@vtucode.in-module-1-21CS51-5th-semester (1).pdf
@vtucode.in-module-1-21CS51-5th-semester (1).pdf@vtucode.in-module-1-21CS51-5th-semester (1).pdf
@vtucode.in-module-1-21CS51-5th-semester (1).pdf
 
Theory of computation and automata
Theory of computation and automataTheory of computation and automata
Theory of computation and automata
 
Theory of computation and automata
Theory of computation and automataTheory of computation and automata
Theory of computation and automata
 
Winter 10 Undecidability.pptx
Winter 10 Undecidability.pptxWinter 10 Undecidability.pptx
Winter 10 Undecidability.pptx
 
Winter 10 Lecture 2 ATM Undecidability - Formal Proof.pptx
Winter 10 Lecture 2 ATM Undecidability - Formal Proof.pptxWinter 10 Lecture 2 ATM Undecidability - Formal Proof.pptx
Winter 10 Lecture 2 ATM Undecidability - Formal Proof.pptx
 
Nondeterministic Finite Automata AFN.pdf
Nondeterministic Finite Automata AFN.pdfNondeterministic Finite Automata AFN.pdf
Nondeterministic Finite Automata AFN.pdf
 
Theory of computing presentation
Theory of computing presentationTheory of computing presentation
Theory of computing presentation
 
Finite Automata
Finite AutomataFinite Automata
Finite Automata
 
hghghghhghghgggggggggggggggggggggggggggggggggg
hghghghhghghgggggggggggggggggggggggggggggggggghghghghhghghgggggggggggggggggggggggggggggggggg
hghghghhghghgggggggggggggggggggggggggggggggggg
 
Theory of Computation - Lectures 4 and 5
Theory of Computation - Lectures 4 and 5Theory of Computation - Lectures 4 and 5
Theory of Computation - Lectures 4 and 5
 
TOC question bank.pdf
TOC question bank.pdfTOC question bank.pdf
TOC question bank.pdf
 
QB104545.pdf
QB104545.pdfQB104545.pdf
QB104545.pdf
 
Finite automata
Finite automataFinite automata
Finite automata
 
02. chapter 3 lexical analysis
02. chapter 3   lexical analysis02. chapter 3   lexical analysis
02. chapter 3 lexical analysis
 
1.3.1 deterministic finite automaton
1.3.1 deterministic finite automaton1.3.1 deterministic finite automaton
1.3.1 deterministic finite automaton
 
a7f0bc7785844884c4de624f61ce5978_MIT18_404f20_lec4.pptx
a7f0bc7785844884c4de624f61ce5978_MIT18_404f20_lec4.pptxa7f0bc7785844884c4de624f61ce5978_MIT18_404f20_lec4.pptx
a7f0bc7785844884c4de624f61ce5978_MIT18_404f20_lec4.pptx
 
The Theory of Finite Automata.pptx
The Theory of Finite Automata.pptxThe Theory of Finite Automata.pptx
The Theory of Finite Automata.pptx
 
QB104541.pdf
QB104541.pdfQB104541.pdf
QB104541.pdf
 
Finals-review.pptx
Finals-review.pptxFinals-review.pptx
Finals-review.pptx
 
Design and Analysis of Algorithms Assignment Help
Design and Analysis of Algorithms Assignment HelpDesign and Analysis of Algorithms Assignment Help
Design and Analysis of Algorithms Assignment Help
 

Plus de HarisPrince

Winter 12 Lecture Mapping Reducibility.pptx
Winter 12 Lecture Mapping Reducibility.pptxWinter 12 Lecture Mapping Reducibility.pptx
Winter 12 Lecture Mapping Reducibility.pptx
HarisPrince
 
Winter 11 Tutorial Reducibility.pptx
Winter 11 Tutorial Reducibility.pptxWinter 11 Tutorial Reducibility.pptx
Winter 11 Tutorial Reducibility.pptx
HarisPrince
 
Winter 8 Tutorial TM.pptx
Winter 8 Tutorial TM.pptxWinter 8 Tutorial TM.pptx
Winter 8 Tutorial TM.pptx
HarisPrince
 
Winter 11 Lecture Reducibility.pptx
Winter 11 Lecture Reducibility.pptxWinter 11 Lecture Reducibility.pptx
Winter 11 Lecture Reducibility.pptx
HarisPrince
 

Plus de HarisPrince (6)

Essays.pptx
Essays.pptxEssays.pptx
Essays.pptx
 
Winter 12 Lecture Mapping Reducibility.pptx
Winter 12 Lecture Mapping Reducibility.pptxWinter 12 Lecture Mapping Reducibility.pptx
Winter 12 Lecture Mapping Reducibility.pptx
 
Winter 11 Tutorial Reducibility.pptx
Winter 11 Tutorial Reducibility.pptxWinter 11 Tutorial Reducibility.pptx
Winter 11 Tutorial Reducibility.pptx
 
Winter 8 TM.pptx
Winter 8 TM.pptxWinter 8 TM.pptx
Winter 8 TM.pptx
 
Winter 8 Tutorial TM.pptx
Winter 8 Tutorial TM.pptxWinter 8 Tutorial TM.pptx
Winter 8 Tutorial TM.pptx
 
Winter 11 Lecture Reducibility.pptx
Winter 11 Lecture Reducibility.pptxWinter 11 Lecture Reducibility.pptx
Winter 11 Lecture Reducibility.pptx
 

Dernier

💚Call Girls In Amritsar 💯Anvi 📲🔝8725944379🔝Amritsar Call Girl No💰Advance Cash...
💚Call Girls In Amritsar 💯Anvi 📲🔝8725944379🔝Amritsar Call Girl No💰Advance Cash...💚Call Girls In Amritsar 💯Anvi 📲🔝8725944379🔝Amritsar Call Girl No💰Advance Cash...
💚Call Girls In Amritsar 💯Anvi 📲🔝8725944379🔝Amritsar Call Girl No💰Advance Cash...
Sheetaleventcompany
 
Call Girls in Lucknow Just Call 👉👉7877925207 Top Class Call Girl Service Avai...
Call Girls in Lucknow Just Call 👉👉7877925207 Top Class Call Girl Service Avai...Call Girls in Lucknow Just Call 👉👉7877925207 Top Class Call Girl Service Avai...
Call Girls in Lucknow Just Call 👉👉7877925207 Top Class Call Girl Service Avai...
adilkhan87451
 

Dernier (20)

Call Girls Amritsar Just Call 8250077686 Top Class Call Girl Service Available
Call Girls Amritsar Just Call 8250077686 Top Class Call Girl Service AvailableCall Girls Amritsar Just Call 8250077686 Top Class Call Girl Service Available
Call Girls Amritsar Just Call 8250077686 Top Class Call Girl Service Available
 
Andheri East ) Call Girls in Mumbai Phone No 9004268417 Elite Escort Service ...
Andheri East ) Call Girls in Mumbai Phone No 9004268417 Elite Escort Service ...Andheri East ) Call Girls in Mumbai Phone No 9004268417 Elite Escort Service ...
Andheri East ) Call Girls in Mumbai Phone No 9004268417 Elite Escort Service ...
 
Call Girls Mumbai Just Call 8250077686 Top Class Call Girl Service Available
Call Girls Mumbai Just Call 8250077686 Top Class Call Girl Service AvailableCall Girls Mumbai Just Call 8250077686 Top Class Call Girl Service Available
Call Girls Mumbai Just Call 8250077686 Top Class Call Girl Service Available
 
Low Rate Call Girls Bangalore {7304373326} ❤️VVIP NISHA Call Girls in Bangalo...
Low Rate Call Girls Bangalore {7304373326} ❤️VVIP NISHA Call Girls in Bangalo...Low Rate Call Girls Bangalore {7304373326} ❤️VVIP NISHA Call Girls in Bangalo...
Low Rate Call Girls Bangalore {7304373326} ❤️VVIP NISHA Call Girls in Bangalo...
 
💚Call Girls In Amritsar 💯Anvi 📲🔝8725944379🔝Amritsar Call Girl No💰Advance Cash...
💚Call Girls In Amritsar 💯Anvi 📲🔝8725944379🔝Amritsar Call Girl No💰Advance Cash...💚Call Girls In Amritsar 💯Anvi 📲🔝8725944379🔝Amritsar Call Girl No💰Advance Cash...
💚Call Girls In Amritsar 💯Anvi 📲🔝8725944379🔝Amritsar Call Girl No💰Advance Cash...
 
9630942363 Genuine Call Girls In Ahmedabad Gujarat Call Girls Service
9630942363 Genuine Call Girls In Ahmedabad Gujarat Call Girls Service9630942363 Genuine Call Girls In Ahmedabad Gujarat Call Girls Service
9630942363 Genuine Call Girls In Ahmedabad Gujarat Call Girls Service
 
Coimbatore Call Girls in Coimbatore 7427069034 genuine Escort Service Girl 10...
Coimbatore Call Girls in Coimbatore 7427069034 genuine Escort Service Girl 10...Coimbatore Call Girls in Coimbatore 7427069034 genuine Escort Service Girl 10...
Coimbatore Call Girls in Coimbatore 7427069034 genuine Escort Service Girl 10...
 
Call Girls Jaipur Just Call 9521753030 Top Class Call Girl Service Available
Call Girls Jaipur Just Call 9521753030 Top Class Call Girl Service AvailableCall Girls Jaipur Just Call 9521753030 Top Class Call Girl Service Available
Call Girls Jaipur Just Call 9521753030 Top Class Call Girl Service Available
 
Call Girls Madurai Just Call 9630942363 Top Class Call Girl Service Available
Call Girls Madurai Just Call 9630942363 Top Class Call Girl Service AvailableCall Girls Madurai Just Call 9630942363 Top Class Call Girl Service Available
Call Girls Madurai Just Call 9630942363 Top Class Call Girl Service Available
 
Call Girls Ahmedabad Just Call 9630942363 Top Class Call Girl Service Available
Call Girls Ahmedabad Just Call 9630942363 Top Class Call Girl Service AvailableCall Girls Ahmedabad Just Call 9630942363 Top Class Call Girl Service Available
Call Girls Ahmedabad Just Call 9630942363 Top Class Call Girl Service Available
 
Premium Bangalore Call Girls Jigani Dail 6378878445 Escort Service For Hot Ma...
Premium Bangalore Call Girls Jigani Dail 6378878445 Escort Service For Hot Ma...Premium Bangalore Call Girls Jigani Dail 6378878445 Escort Service For Hot Ma...
Premium Bangalore Call Girls Jigani Dail 6378878445 Escort Service For Hot Ma...
 
Call Girls Mysore Just Call 8250077686 Top Class Call Girl Service Available
Call Girls Mysore Just Call 8250077686 Top Class Call Girl Service AvailableCall Girls Mysore Just Call 8250077686 Top Class Call Girl Service Available
Call Girls Mysore Just Call 8250077686 Top Class Call Girl Service Available
 
Top Rated Call Girls Kerala ☎ 8250092165👄 Delivery in 20 Mins Near Me
Top Rated Call Girls Kerala ☎ 8250092165👄 Delivery in 20 Mins Near MeTop Rated Call Girls Kerala ☎ 8250092165👄 Delivery in 20 Mins Near Me
Top Rated Call Girls Kerala ☎ 8250092165👄 Delivery in 20 Mins Near Me
 
💕SONAM KUMAR💕Premium Call Girls Jaipur ↘️9257276172 ↙️One Night Stand With Lo...
💕SONAM KUMAR💕Premium Call Girls Jaipur ↘️9257276172 ↙️One Night Stand With Lo...💕SONAM KUMAR💕Premium Call Girls Jaipur ↘️9257276172 ↙️One Night Stand With Lo...
💕SONAM KUMAR💕Premium Call Girls Jaipur ↘️9257276172 ↙️One Night Stand With Lo...
 
Call Girls Service Jaipur {9521753030 } ❤️VVIP BHAWNA Call Girl in Jaipur Raj...
Call Girls Service Jaipur {9521753030 } ❤️VVIP BHAWNA Call Girl in Jaipur Raj...Call Girls Service Jaipur {9521753030 } ❤️VVIP BHAWNA Call Girl in Jaipur Raj...
Call Girls Service Jaipur {9521753030 } ❤️VVIP BHAWNA Call Girl in Jaipur Raj...
 
Call Girls Varanasi Just Call 8250077686 Top Class Call Girl Service Available
Call Girls Varanasi Just Call 8250077686 Top Class Call Girl Service AvailableCall Girls Varanasi Just Call 8250077686 Top Class Call Girl Service Available
Call Girls Varanasi Just Call 8250077686 Top Class Call Girl Service Available
 
Call Girls Service Jaipur {9521753030} ❤️VVIP RIDDHI Call Girl in Jaipur Raja...
Call Girls Service Jaipur {9521753030} ❤️VVIP RIDDHI Call Girl in Jaipur Raja...Call Girls Service Jaipur {9521753030} ❤️VVIP RIDDHI Call Girl in Jaipur Raja...
Call Girls Service Jaipur {9521753030} ❤️VVIP RIDDHI Call Girl in Jaipur Raja...
 
Mumbai ] (Call Girls) in Mumbai 10k @ I'm VIP Independent Escorts Girls 98333...
Mumbai ] (Call Girls) in Mumbai 10k @ I'm VIP Independent Escorts Girls 98333...Mumbai ] (Call Girls) in Mumbai 10k @ I'm VIP Independent Escorts Girls 98333...
Mumbai ] (Call Girls) in Mumbai 10k @ I'm VIP Independent Escorts Girls 98333...
 
Top Rated Hyderabad Call Girls Chintal ⟟ 9332606886 ⟟ Call Me For Genuine Se...
Top Rated  Hyderabad Call Girls Chintal ⟟ 9332606886 ⟟ Call Me For Genuine Se...Top Rated  Hyderabad Call Girls Chintal ⟟ 9332606886 ⟟ Call Me For Genuine Se...
Top Rated Hyderabad Call Girls Chintal ⟟ 9332606886 ⟟ Call Me For Genuine Se...
 
Call Girls in Lucknow Just Call 👉👉7877925207 Top Class Call Girl Service Avai...
Call Girls in Lucknow Just Call 👉👉7877925207 Top Class Call Girl Service Avai...Call Girls in Lucknow Just Call 👉👉7877925207 Top Class Call Girl Service Avai...
Call Girls in Lucknow Just Call 👉👉7877925207 Top Class Call Girl Service Avai...
 

Winter 9 Decidability.pptx

  • 1. EECS 2001: Introduction to the Theory of Computation Muhammad Umair Khan
  • 2. Decidable Languages EECS 2001 Introduction to Theory of Computation 2  Problem: does a NFA / DFA accept a string?  Problem: does a CFG generate a string?  Problem: does a PDA accept a string?  Problem: does TM accept a string?  We need a yes or no answer. However, to get that answer, we need the string to go through the DFA/NFA/CFG/PDA/TM  We can reword our problem as a problem of acceptance
  • 3. Decidable Languages EECS 2001 Introduction to Theory of Computation 3  The problem of acceptance for DFAs of testing whether a particular string is accepted by a particular DFA can be presented as a language.  Such a language will contain pairs of DFA and its corresponding acceptable strings ADFA = {(w, D) | D is a DFA which accepts the string w} w3= 100, Donly one 1 w1= 1100, Dequal 0s and 1s w2= 001100, Dequal 0s begin/end
  • 4. Decidable Languages EECS 2001 Introduction to Theory of Computation 4  Is ADFA Decidable?  Can we have an algorithm which takes a DFA D and a string w and decide whether w is accepted by D?  If yes, then ADFA is decidable  How can we achieve this?
  • 5. Decidable Languages EECS 2001 Introduction to Theory of Computation 5  Recap  Remember that we explored how one TM variant can be converted to the other…  Let us call that technique as “simulating TM1 on TM 2”
  • 6. Decidable Languages EECS 2001 Introduction to Theory of Computation 6  Is ADFA Decidable?  Let us make a TM (algorithm) 1. Simulate the DFA D on the TM and consume w 2. If D ends in the accept state, accept. If D ends in reject state, reject.
  • 7. Decidable Languages EECS 2001 Introduction to Theory of Computation 7  Is ADFA Decidable?  Let us make a TM (algorithm) 1. Simulate the DFA D on the TM and consume w a. keep track of D’s current state b. keep track of where (the current position) the machine is while reading w i.e. input 2. If D ends in the accept state, accept. If D ends in reject state, reject.
  • 8. Decidable Languages EECS 2001 Introduction to Theory of Computation 8  Is ADFA Decidable?  Implementation details of the TM TDFA.  Check the input, it should be a pair (D, w)  D can be represented as Q, Σ, δ, q0, and F. If input is correct, move to the next step, otherwise reject.  Start the simulation of D on TDFA.  Current state of D and current position on the input string w, are stored on the tape of T.  Example: at the beginning, the current state would be ___ and the current input symbol would be the ___________________  The state and current position keep getting updated based on _________  When the last input symbol is consumed:  AND D is in the final state (current state is in F), TDFA accepts.  If D is not in the final state, TDFA rejects.
  • 9. Decidable Languages EECS 2001 Introduction to Theory of Computation 9  Is ADFA Decidable?  Implementation details of the TM TDFA.  Check the input, it should be a pair (D, w)  D can be represented as Q, Σ, δ, q0, and F. If input is correct, move to the next step, otherwise reject.  Start the simulation of D on TDFA.  Current state of D and current position on the input string w, are stored on the tape of T.  Example: at the beginning, the current state would be q0 and the current input symbol would be the leftmost symbol of w  The state and current position keep getting updated based on δ  When the last input symbol is consumed AND:  D is in the final state (current state is in F), TDFA accepts.  D is not in the final state, TDFA rejects.
  • 10. Decidable Languages EECS 2001 Introduction to Theory of Computation 10  Is ANFA Decidable?  TM (algorithm)  Convert NFA N into DFA D  Check the input, it should be a pair (D, w)  D can be represented as Q, Σ, δ, q0, and F. If input is correct, move to the next step, otherwise reject.  Start the simulation of D on TDFA.  Current state of D and current position on the input string w, are stored on the tape of T.  Example: at the beginning, the current state would be q0 and the current input symbol would be the leftmost symbol of w  The state and current position keep getting updated based on δ  When the last input symbol is consumed AND:  D is in the final state (current state is in F), TDFA accepts.  D is not in the final state, TDFA rejects.
  • 11. Decidable Languages EECS 2001 Introduction to Theory of Computation 11  Is AREX Decidable?  TM (algorithm)  Convert Regular Expression REX into NFA N and NFA N into DFA D  Check the input, it should be a pair (D, w)  D can be represented as Q, Σ, δ, q0, and F. If input is correct, move to the next step, otherwise reject.  Start the simulation of D on TREX.  Current state of D and current position on the input string w, are stored on the tape of T.  Example: at the beginning, the current state would be q0 and the current input symbol would be the leftmost symbol of w  The state and current position keep getting updated based on δ  When the last input symbol is consumed AND:  D is in the final state (current state is in F), TREX accepts.  D is not in the final state, TREX rejects.
  • 12. Decidable Languages EECS 2001 Introduction to Theory of Computation 12  In all previous three examples, once we make the TDFA , it can be used to develop other TMs.  Think of it as a function call (in programming language terms).  TDFA would be the called function
  • 13. Decidable Languages EECS 2001 Introduction to Theory of Computation 13  Is the language Aempty Decidable? Also called emptiness testing  Language which contains no strings  How to represent it?  EDFA = {⟨A⟩| A is a DFA and L(A) = ∅}.
  • 14. Decidable Languages EECS 2001 Introduction to Theory of Computation 14  Is the language EDFA Decidable?  EDFA = {⟨A⟩| A is a DFA and L(A) = ∅}.  TM (algorithm)  Start with labelling the initial state of A  Label any state that can be reached from the already labelled states using one of the valid transitions  Repeat this step until no new states can be labelled  Check whether among all the labelled states, if there is a final state. If yes, then that means that through some valid sequence of transitions (which an input string can use), we can get to the final state from the initial state, reject.  Remember: we want a DFA which does not accept any string.
  • 15. Decidable Languages EECS 2001 Introduction to Theory of Computation 15  Can we decide whether two given DFAs are equal?  EQDFA = {⟨A,B⟩| A and B are DFAs and L(A) = L(B)}.  Any ideas?
  • 16. Decidable Languages EECS 2001 Introduction to Theory of Computation 16  Can we decide whether two given DFAs are equal?  EQDFA = {⟨A,B⟩| A and B are DFAs and L(A) = L(B)}.  Design a new language L(C)  Has all the strings in L(A) which are not in L(B)  Has all the strings in L(B) which are not in L(A) L(C) = L(A) ∩ L(B)’ ∪ L(A)’ ∩ L(B)  this is also called symmetric difference of L(A) and L(B)  L(C) = ∅ iff L(A) = L(B).
  • 17. Decidable Languages EECS 2001 Introduction to Theory of Computation 17  Can we decide whether two given DFAs are equal?  EQDFA = {⟨A,B⟩| A and B are DFAs and L(A) = L(B)}.  Design a new language L(C)  TM (algorithm)  Construct DFA for L(C)  Use TM for EDFA from the previous slides on the input  If L(C) is empty, i.e., there are no acceptable string, then L(A) = L(B), accept.  If L(C) is non-empty, i.e., there is at least one acceptable string, then L(A) ≠ L(B), reject.
  • 18. Decidable Languages EECS 2001 Introduction to Theory of Computation 18  Is ACFG decidable?  Similar to ADFA , here we aim to see whether a string w can be generated by a CFG.  Any ideas?
  • 19. Decidable Languages EECS 2001 Introduction to Theory of Computation 19  Is ACFG decidable?  Similar to ADFA , here we aim to see whether a string w can be generated by a CFG.  Any ideas?  Can we go though all the different derivations?  We might have to try infinitely many possibilities  Especially, if the w is not an acceptable string, the TM will never stop. We will never not if it is stuck or just processing.
  • 20. Decidable Languages EECS 2001 Introduction to Theory of Computation 20  Is ACFG decidable?  Similar to ADFA , here we aim to see whether a string w can be generated by a CFG.  Any ideas?  Can we go though all the different derivations?  We might have to try infinitely many possibilities  Especially, if the w is not an acceptable string, the TM will never stop. We will never not if it is stuck or just processing.  We need to convert the problem into one where there are only finite derivations  Any ideas?
  • 21. Decidable Languages EECS 2001 Introduction to Theory of Computation 21  Is ACFG decidable?  Similar to ADFA , here we aim to see whether a string w can be generated by a CFG.  Any ideas?  Can we go though all the different derivations?  We might have to try infinitely many possibilities  Especially, if the w is not an acceptable string, the TM will never stop. We will never not if it is stuck or just processing.  We need to convert the problem into one where there are only finite derivations  Any ideas? Chomsky Normal Form. If a CFG is in CNF, any derivation of w has 2n-1 steps where n = |w|
  • 22. Decidable Languages EECS 2001 Introduction to Theory of Computation 22  Is ACFG decidable?  Similar to ADFA , here we aim to see whether a string w can be generated by a CFG.  TM(algorithm)  Convert CFG G into CNF  List all the derivations of G with 2n-1 steps such that n = |w|  If n = 0, list those derivations with one step  If any of the above derivations generate w, accept, if not, reject.
  • 23. Decidable Languages EECS 2001 Introduction to Theory of Computation 23  Is ECFG decidable?  Similar to EDFA , here we aim to see whether any string at all can be generated by a CFG.  Ideas? Let us use the TM from ACFG
  • 24. Decidable Languages EECS 2001 Introduction to Theory of Computation 24  Is ECFG decidable?  Similar to EDFA , here we aim to see whether any string at all can be generated by a CFG.  Ideas? Let us use the TM from ACFG  Try all the possible words?  Infinite possibilities  S  AB  A  a  BB
  • 25. Decidable Languages EECS 2001 Introduction to Theory of Computation 25  Is ECFG decidable?  Similar to EDFA , here we aim to see whether any string at all can be generated by a CFG.  Ideas?  Can we find whether all variables terminate? i.e., generate terminal symbols
  • 26. Decidable Languages EECS 2001 Introduction to Theory of Computation 26  Is ECFG decidable?  Similar to EDFA , here we aim to see whether any string at all can be generated by a CFG.  TM (algorithm)  Mark all the terminal symbols  Mark any variable A if there is a rule in the grammar AX1X2X3…Xk and all symbols on the RHS have already been marked.  Keep repeating this until we cannot mark anymore variables  If we were able to mark the start variable, reject (we were able to reach from the start variable from terminals).  If we were not able to mark the start variable, accept (we were not able to reach the start variable from any of the terminals)
  • 27. References EECS 2001 Introduction to Theory of Computation 27 Ideas, problems and their solutions in this lecture/tutorial have been taken from • Prof. Jeffery Edmonds’ Lecture notes for EECS 2001 at York University • Prof. Suprakash Datta’ Lecture notes for EECS 2001 at York University • Introduction to the Theory of Computation (3rd edition) by Michael Sipser • Introduction to Theory of Computation by Anil Maheshwari and Michiel Smid • Wikipedia and other webpages of different professors/universities