1 Design a PDA which accepts: L= { a n b m : n ≠ m }

Slides:



Advertisements
Similar presentations
Turing Machines Memory = an infinitely long tape Persistent storage A read/write tape head that can move around the tape Initially, the tape contains only.
Advertisements

Introduction to Computability Theory
Lecture 16 Deterministic Turing Machine (DTM) Finite Control tape head.
THE CHURCH-TURING T H E S I S “ TURING MACHINES” Pages COMPUTABILITY THEORY.
Turing Machines (At last!). Designing Universal Computational Devices Was Not The Only Contribution from Alan Turing… Enter the year 1940: The world is.
Turing Machines New capabilities: –infinite tape –can read OR write to tape –read/write head can move left and right q0q0 input tape.
1 Turing Machines. 2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
Fall 2004COMP 3351 Turing Machines. Fall 2004COMP 3352 The Language Hierarchy Regular Languages Context-Free Languages ? ?
CS 310 – Fall 2006 Pacific University CS310 Turing Machines Section 3.1 November 6, 2006.

CS5371 Theory of Computation Lecture 10: Computability Theory I (Turing Machine)
Turing Machines CS 105: Introduction to Computer Science.
Prof. Busch - LSU1 Turing Machines. Prof. Busch - LSU2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
1 Turing Machines. 2 A Turing Machine Tape Read-Write head Control Unit.
Complexity and Computability Theory I Lecture #13 Instructor: Rina Zviel-Girshin Lea Epstein Yael Moses.
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.
 Computability Theory Turing Machines Professor MSc. Ivan A. Escobar
Introduction to CS Theory Lecture 15 –Turing Machines Piotr Faliszewski
Dale Roberts Department of Computer and Information Science, School of Science, IUPUI CSCI 230 Models of Computation - Turing Machines Dale Roberts, Lecturer.
1 Which languages do the following TM’s accept over the alphabet Σ={a, b}? Recall: A TM M accepts a language L defined over an alphabet Σ if M halts on.
Turing Machines Chapter 17. Languages and Machines SD D Context-Free Languages Regular Languages reg exps FSMs cfgs PDAs unrestricted grammars Turing.
THE CHURCH-TURING T H E S I S “ TURING MACHINES” Part 1 – Pages COMPUTABILITY THEORY.
Computer Science 101 Theory of Computing. Computer Science is... The study of algorithms, with respect to –their formal properties –their linguistic realizations.
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Turing Machines.
CS 208: Computing Theory Assoc. Prof. Dr. Brahim Hnich
Lecture 9  2010 SDU Lecture9: Turing Machine.  2010 SDU 2 Historical Note Proposed by Alan Turing in 1936 in: On Computable Numbers, with an application.
Theorem: Turing decidable languages are closed under intersection.
1 Draw the machine schema for a TM which when started on a blank tape (input  ) halts with abbb on the tape in our standard input format.
1 Which languages do the following TM’s accept over the alphabet Σ={a, b}? Recall: A TM M accepts a language L defined over an alphabet Σ if M halts on.
CS 3240: Languages and Computation
CSCI 2670 Introduction to Theory of Computing October 7, 2004.
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 IDT Open Seminar ALAN TURING AND HIS LEGACY 100 Years Turing celebration Gordana Dodig Crnkovic, Computer Science and Network Department Mälardalen University.
1 Turing Machines and Equivalent Models Section 13.1 Turing Machines.
Overview of the theory of computation Episode 3 0 Turing machines The traditional concepts of computability, decidability and recursive enumerability.
1 Turing Machines - Chap 8 Turing Machines Recursive and Recursively Enumerable Languages.
Lecture 16b Turing Machines Topics: Closure Properties of Context Free Languages Cocke-Younger-Kasimi Parsing Algorithm June 23, 2015 CSCE 355 Foundations.
1 Turing Machines. 2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
Automata & Formal Languages, Feodor F. Dragan, Kent State University 1 CHAPTER 3 The Church-Turing Thesis Contents Turing Machines definitions, examples,
1 1. Design a TM which on a input w  {0, 1}*, shifts w over one position to the right. That is: (s, # w [#]) ├ * (h, # # w [#]). 2. Show the computation.
1 Introduction to Turing Machines
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 12 Mälardalen University 2007.
Chapter 9 Turing Machines What would happen if we change the stack in Pushdown Automata into some other storage device? Truing Machines, which maintains.
Turing Machines CS 130 Theory of Computation HMU Textbook: Chap 8.
1 Turing Machines. 2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
1 Turing Machines. 2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
CSCI 2670 Introduction to Theory of Computing September 29, 2005.
Theory of Computation Automata Theory Dr. Ayman Srour.
1 Assignment #5 is posted.. 2 An artist's rendition of a steam-powered Turing machine. There is a mural of this between the second and third floors in.
8. Introduction to Turing Machines
More variants of Turing Machines
CSCI 2670 Introduction to Theory of Computing
Busch Complexity Lectures: Turing Machines
Turing Machines.
CS21 Decidability and Tractability
COSC 3340: Introduction to Theory of Computation
Turing Machines Acceptors; Enumerators
Turing Machines (At last!).
Chapter 9 TURING MACHINES.
فصل سوم The Church-Turing Thesis
8. Introduction to Turing Machines
The Off-Line Machine Input File read-only (once) Input string
CS21 Decidability and Tractability
Decidability and Tractability
Computability Catch up last lecture. Turing machines. Variations
CS6382 Theory of Computation
Turing Machines Everything is an Integer
Intro to Theory of Computation
Presentation transcript:

1 Design a PDA which accepts: L= { a n b m : n ≠ m }

2 Announcements Assignment #4: Due at the beginning of class, Wed. July 18. No office hours today.

3 This cartoon appears in the book Computation Engineering: Applied Automata Theory and Logic by Dr. Ganesh Gopalakrishnan. Turing Machines

4 Classes of Languages

5 Turing machines are very simple (so it is easy to prove things about them) but are as capable as any current computer.

6 Turing machines: Operation: add read/write tape to DFA. Move: Based on current state and symbol scanned: 1.change states, and 2. either replace tape square contents with a symbol or move head one square left or one square right.

7 Input conventions: Tape has a left hand end but extends infinitely to the right (one-way infinite tape). All squares are initially blank- represented by the symbol #. On an input w, the tape starts out as: # w [#] (the [] contain the symbol scanned). For example, on input w= abaa: Special halt state called h.

8 L= { u u R : u  {a, b}*}. Design a TM which accepts L: It halts on input w if w in L and either hangs or computes forever when w is not in L. A TM halts immediately when entering the special halt state h. A TM hangs if the head falls off the left hand end of the tape or if it encounters an undefined transition.

9 Pseudo code for my algorithm: 1. Find leftmost input symbol and erase it. If there is no input left at this stage, halt. 2. Move head to right hand end of input using the state to remember the symbol at the left hand end of the tape. 3. If the symbol does not match, make the TM hang. Otherwise erase the symbol and go back to step 1.

10 TM rules: State Symbol Next state Head instruction // Move left to leftmost symbol. Rule 1: start # left L Rule 2: left a left L Rule 3: left b left L // When we find # at LH end, move R to check LH symbol. Rule 4: left # check R // If blank we are done- halt. Rule 5: check # h # // Blank out LH symbol and remember it using state. Rule 6: check a rema # Rule 7: check b remb # // Move off blank remembering LH symbol using state. Rule 8: rema # righta R Rule 9: remb # rightb R

11 // Move to RH symbol remembering symbol using state. Rule 10: righta a righta R Rule 11: righta b righta R Rule 12: rightb a rightb R Rule 13: rightb b rightb R // Check symbol at LH end. Rule 14: righta # checka L Rule 15: rightb # checkb L // If it matches, blank it out and start over. Rule 16: checka a start # Rule 17: checkb b start # // If not, hang because no transitions defined from undef. Rule 18: checka b undef b Rule 19: checka # undef # Rule 20: checkb a undef b Rule 21: checkb # undef #

12 (start, #abba[#]) ├ (left, #abb[a]) ├ (left, #ab[b]a) ├ (left, #a[b]ba) ├ (left, #[a]bba) ├ (left, [#]abba) ├ (check, #[a]bba) ├ (rema, #[#]bba) ├ (righta,##[b]ba) ├ (righta,##b[b]a) ├ (righta,##bb[a]) ├ (righta,##bba[#]) ├ (checka,##bb[a]) ├ (start, ##bb[#]) ├ (left, ##b[b]) ├ (left, ##[b]b) ├ (left, #[#]bb) ├ (check,##[b]b) ├ (remb, ##[#]b) ├ (rightb,###[b]) ├ (rightb,###b[#]) ├ (checkb,###[b]) ├ (start,###[#]) ├ (left, ##[#]) ├ (check,###[#]) ├ (h, ###[#]) An accepting computation:

13 A non-accepting computation: 1. (start, #aaba[#]) 2. (left, #aab[a]) 3. (left, #aa[b]a) 4. (left, #a[a]ba) 5. (left, #[a]aba) 6. (left, [#]aaba) 7. (check, #[a]aba) 8. (rema, #[#]aba) 9. (righta, ##[a]ba) 10. (righta, ##a[b]a) 11. (righta, ##ab[a]) 12. (righta, ##aba[#]) 13. (checka, ##ab[a]) 14. (start, ##ab[#]) 15. (left, ##a[b]) 16. (left, ##[a]b) 17. (left, #[#]ab) 18. (check, ##[a]b) 19. (rema, ##[#]b) 20. (righta, ###[b]) 21. (righta, ###b[#]) 22. (checka, ###[b]) 23. (undef, ###[b]) No valid transition, TM hangs.

14 Input to TM simulator: // This TM halts if the input is of the form u u^R where u // is in {a,b}* and hangs otherwise. start // Move left to leftmost symbol. start # left L // start algorithm to check if u u^R left a left L // Go left to LH end of input left b left L // Go left to LH end of input // When we find # at LH end, move R to check LH symbol. left # check R // Found # at LH end // If blank we are done- halt. check # h # // Done and answer is yes if input is all blank // Blank out LH symbol and remember it using state. check a rema # // Blank out LH symbol remember "a" using state check b remb # // Blank out LH symbol remember "b" using state // Move off blank remembering LH symbol using state. rema # righta R // Start going right (remember "a") remb # rightb R // Start going right (remember "b")

15 // Move right to RH symbol remembering LH one using state. righta a righta R // Move right (remember "a") righta b righta R // Move right (remember "a") rightb a rightb R // Move right (remember "b") rightb b rightb R // Move right (remember "b") // Check symbol at LH end. righta # checka L // Found RH end- check now if "a" rightb # checkb L // Found RH end- check now if "b" // If it matches, blank it out and start over. checka a start # // First symbol matches last one- start again checkb b start # // First symbol matches last one- start again // If not, hang because no transitions defined from undef checka b undef b // No match- move to state with no transitions defined checka # undef # // No match- move to state with no transitions defined checkb a undef b // No match- move to state with no transitions defined checkb # undef # // No match- move to state with no transitions defined $ abba // A string which is in L aaba // A string which is not in L

16 The format of the input to the TM simulator is as follows:... $...

17 Rules for TM Descriptions 1.The state name h is used to denote the halting state. 2.Use the symbol # to represent a blank. 3.If a line starts with // it is a comment. Comments can also be added on the same line as an instruction at the end of the line (start with //). 4.Each of the state names is an arbitrary string. The current symbol and new symbol each must be a single symbol. 6.The head instruction is either L (move the head one square left) or R (move the head one square right) or a symbol to replace the current tape square contents. 7.The $ indicates the end of the TM description.