1 Key to Homework #3 (Models of Computation, Spring, 2001) Finite state control with a 4-way read/write head 8 8 8 8 8 8 8 8 8 8 Figure (a)Figure (b) (over)

Slides:



Advertisements
Similar presentations
Chapter 5 Pushdown Automata
Advertisements

Lecture 16 Deterministic Turing Machine (DTM) Finite Control tape head.
Variants of Turing machines
Natural Language Processing - Formal Language - (formal) Language (formal) Grammar.
Turing Machines (At last!). Designing Universal Computational Devices Was Not The Only Contribution from Alan Turing… Enter the year 1940: The world is.
1 Introduction to Computability Theory Lecture12: Decidable Languages Prof. Amos Israeli.
Intro to DFAs Readings: Sipser 1.1 (pages 31-44) With basic background from Sipser 0.
Intro to DFAs Readings: Sipser 1.1 (pages 31-44) With basic background from Sipser 0.
61 Nondeterminism and Nodeterministic Automata. 62 The computational machine models that we learned in the class are deterministic in the sense that the.
Fall 2006Costas Busch - RPI1 Deterministic Finite Automata And Regular Languages.
1 Languages and Finite Automata or how to talk to machines...
56 Rumination on the Formal Definition of DPDA In the definition of DPDA, there are some parts that do not agree with our intuition. Let M = (Q, , ,
1 Homework #6 (Models of Computation, Spring, 2001) Due: Section 1; March 29 Section 2; March Let L be the language of the following grammar G 1.

CS 490: Automata and Language Theory Daniel Firpo Spring 2003.
79 Regular Expression Regular expressions over an alphabet  are defined recursively as follows. (1) Ø, which denotes the empty set, is a regular expression.
CS5371 Theory of Computation Lecture 10: Computability Theory I (Turing Machine)
Key to Homework #2 1. What is the language of L-system G = ({a, b, c}, h, acb ), where the rewriting rule h is defined as follows: h (a) = aa h (b) = cb.
Finite State Machines Data Structures and Algorithms for Information Processing 1.
CS5371 Theory of Computation Lecture 8: Automata Theory VI (PDA, PDA = CFG)
Finite State Machines Data Structures and Algorithms for Information Processing 1.
Regular Languages A language is regular over  if it can be built from ;, {  }, and { a } for every a 2 , using operators union ( [ ), concatenation.
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen Department of Computer Science University of Texas-Pan American.
Lecture 03: Theory of Automata:08 Finite Automata.
CS490 Presentation: Automata & Language Theory Thong Lam Ran Shi.
Lecture 2UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 2.
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.
1 Homework #7 (Models of Computation, Spring, 2001) Due: Section 1; April 16 (Monday) Section 2; April 17 (Tuesday) 2. Covert the following context-free.
Pushdown Automata (PDAs)
Lecture 07: Formal Methods in SE Finite Automata Lecture # 07 Qaisar Javaid Assistant Professor.
1 Computability Five lectures. Slides available from my web page There is some formality, but it is gentle,
Part VII. Models for Context-Free Languages 1/50.
Lecture # 28 Theory Of Automata By Dr. MM Alam 1.
1 1. Let A ={r, p, i } and B = { w, o, r, l, d }. What does each of the following (a), (b) and (c) denote? Briefly explain in plain English. (a) A * B.
Strings Basic data type in computational biology A string is an ordered succession of characters or symbols from a finite set called an alphabet Sequence.
Modeling Computation: Finite State Machines without Output
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.
Finding Regular Simple Paths Sept. 2013Yangjun Chen ACS Finding Regular Simple Paths in Graph Databases Basic definitions Regular paths Regular simple.
1 Turing Machines and Equivalent Models Section 13.1 Turing Machines.
98 Nondeterministic Automata vs Deterministic Automata We learned that NFA is a convenient model for showing the relationships among regular grammars,
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen Department of Computer Science University of Texas-Pan American.
Automata & Formal Languages, Feodor F. Dragan, Kent State University 1 CHAPTER 3 The Church-Turing Thesis Contents Turing Machines definitions, examples,
1 Introduction to Turing Machines
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 12 Mälardalen University 2007.
Summary of Previous Class There are languages that are not decidable –(we have not proved this yet) Why not extend Turing machines just as we did with.
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.
1 Turing Machines. 2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
CS 154 Formal Languages and Computability April 7 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron Mak.
CS6800 Advance Theory of Computation Spring 2016 Nasser Alsaedi
Costas Busch - LSU1 Deterministic Finite Automata And Regular Languages.
Recap: Nondeterministic Finite Automaton (NFA) A deterministic finite automaton (NFA) is a 5-tuple (Q, , ,s,F) where: Q is a finite set of elements called.
Fall 2004COMP 3351 Finite Automata. Fall 2004COMP 3352 Finite Automaton Input String Output String Finite Automaton.
Theory of Computation Pushdown Automata pda Lecture #10.
COSC 3340: Introduction to Theory of Computation
Non Deterministic Automata
Natural Language Processing - Formal Language -
Pushdown Automata Reading: Chapter 6.
Turing Machines Acceptors; Enumerators
COSC 3340: Introduction to Theory of Computation
CSC 4170 Theory of Computation Nondeterminism Section 1.2.
REGULAR LANGUAGES AND REGULAR GRAMMARS
Turing Machines (TM) Deterministic Turing Machine (DTM)
Deterministic Finite Automata And Regular Languages Prof. Busch - LSU.
Non-Deterministic Finite Automata
Non Deterministic Automata
Midterm (Models of Computation, Fall, 2000)
Deterministic Finite Automaton (DFA)
CSC 4170 Theory of Computation Nondeterminism Section 1.2.
Variants of Turing machines
Presentation transcript:

1 Key to Homework #3 (Models of Computation, Spring, 2001) Finite state control with a 4-way read/write head Figure (a)Figure (b) (over) Answer: (See next slide.) 1. (a) We know how to formally define a Turing machine with one-dimensional (1-D) tape and a finite state control with one two-way read/write head. How will you extend this definition and define a 2-D Turing machine with one two dimensional tape and a finite state control with one read/write head that can move up, down, to the left, to the right, or stay? (See Figure (a) below.) Write a complete formal definition of such computational model with a tuple (i.e., set of information) as we did for the Turing machines. 2. (b) Design a 2-D Turing machine which draws a figure of eight with 8’s on the blank tape as show in Figure (b) below. The machine should be in an accepting state when it has completed the drawing. What is the minimum number of states needed for this machine? Why? Your answer for this question will be evaluated according to the soundness of your argument.

2 1. (a) Answer: The 2-D TM can be formally defined as 6-tuple M = ( Q, , , , q 0, F ), where Q is the finite set of states,  is the set of tape symbols (alphabet) including the blank symbol, usually denoted by B (a square box in the text),  is the set of input symbols, which is a subset of , q 0 is the start state, F is the set of accepting states (F  Q ), and  is the transition function which maps Q    Q    {L, N, R, U, D}, where L, N, R are as defined in 1-D TM, and U and D are for moving up and down from the current position. 1.(b) Answer: Figure (a) below shows a straightforward design with 14 states, each state drawn at the relative location where the machine writes 8. Figure (b) is an improved version with 10 states. Notice that to reduce the number of states this machine uses the symbol written on the tape in the past moves. (For minimality, see next slide.) (B,8,R)(B,8,D) start (B,8,D) (B,8,L)(B,8,U) (B,8,R) (B,8,L) (8,8,U) (B,8,U) (8, 8, N) Figure (a) 2-D TM with 14 states (B,8,R) start (8,8,R)(B,8,L) (B,8,D) (8, 8’,D) (B,B,R) (B,B,L) (B, 8 *, R) (8, 8, D), Figure (b) 2-D TM with 10 states (B, 8 *,L) (8’, 8, L) (B,8,U) (8 *, 8, L) (B, 8, D) (8 *, 8, N)

3 Figure (a) 2-D TM with 8 states (B,8’,R)(B,8,R) start (B,8,D) (B,8,L) (8,8,N) (B,8,U) (8,8,D)(8’,8,R), (8,8,R), ** Notice that with the above idea, by increasing the number of different symbols to some constant k that can be written at the start state, it is possible with the same automaton shown above to draw a sequence of k square block of 8’s as illustrated below block k Surprisingly, after Sam put the key answers on the web, TA Yining reported that one of our students made 8- states automaton! I thought what should his idea be, and got the following. This implies that my proof in previous slide is incorrect.

4 The question concerning the minimality of the number of states is challenging. The argument is based on the minimum number of states required to write a symbol on a blank cell located at the distance (going along vertical and/or horizontal direction) of k blank cells from the current position. For the formal argument we need the following definition. Definition: For a given position p on a 2-D tape, we say a blank cell c is in an open column (or row) with respect to p, if c is located in the same column (or row) of p, and in the extension of the column (or row) from p to c there are only blank cells. Figure (a) below shows an example of cell c which is in an open row with respect to position p, where we assume that no symbol is written to the right of cell c. Claim: For any 2-D TM which is located in a position p, it takes at least k states to write (in a finite number of steps) a symbol on a blank cell c that is in an open column (or row) with respect to p separated by k cells. Proof. Suppose that the machine takes less than k. Then as Figure (b) below illustrates, the machine should move to the right entering a previous state (say state i). Notice that in j+1 st cell, the machine will write a i, and move to the right, and on the next blank cell, write a i+1, and so non. These transitions form a cycle and the machine will keep moving to the right. Now, using the above claim, we can prove the minimality (10 states) of the 2-D TM shown in Figure (b) in the preceding slide. Notice that the machine writes top row first, and comes down along the center column (writing at the center). Then the machine writes the bottom row. This way we can minimize the number of cells to be written that are in an open column or row with respect to possible machine positions. Notice that once the four corners have been written, the machine can move to those corners along the vertical column until it hits a flag (see the star marked 8’s). This can be done by a self-looping transition as shown in the state transition graph (see the highlighted loop). pca b Figure (a) 1j<k2i... (B,a 1,R)(B,a 2,R)(B,a i,R) (B,a j,R) Figure (b)

5 2. For each of the following languages L i construct a DPDA (deterministic pushdown automaton) which accepts L i. For your answer it it enough to show the state transition graph of the automaton. (Make sure if your machine does not have a bug by running it with several short input strings.) (a) L 1 = {a i b j ; | i > j > 0 } (b) L 2 = {a i b j ; | i  j > 0 } (c) L 3 = {a i b j ; | i  j  0 } (d) L 4 = {a i b j | i > j > 0 } (e) L 5 = {a i b j | i  j > 0 } (f) L 6 = {a i b j | i  j  0 } (g) L 7 = { a i b k c i | i, k > 0 } (h) L 8 = { a i b k c i | i, k  0 } start (a, Z 0 /aZ 0 ) ( a, a/aa ) (b, a/  ) (;, a/  ) (a) L 1 = {a i b j ; | i > j > 0 } start (a, Z 0 /aZ 0 ) ( a, a/aa ) (b, a/  ) (;, a/  ), (;, Z 0 /Z 0 ) (b) L 2 = {a i b j ; | i  j > 0 } start (a, Z 0 /aZ 0 ) ( a, a/aa ) (b, a/  ) (;, a/  ), (;, Z 0 /Z 0 ) (c) L 3 = {a i b j ; | i  j  0 } Answers: ( ;, Z 0 /Z 0 ) (;, a/a )

6 start (a, Z 0 /Z 0 ) ( a, a/aa ) (b, a/  ) (d) L 4 = {a i b j | i > j > 0 } (e) L 5 = {a i b j | i  j > 0 } start (a, Z 0 /aZ 0 ) ( a, a/aa ) (b, a/  ) start (f) L 5 = {a i b j | i  j  0 } (a, Z 0 /aZ 0 ), (a, a/aa) (b, a/  )

7 (g) L 7 = { a i b k c i | i, k > 0 } start (a, Z 0 /aZ 0 ) ( a, a/aa ) (b, a/a ) (c, a/  ) ( , Z 0 /Z 0 ) (c, a/  ) start (a, Z 0 /aZ 0 ) ( a, a/aa ) (b, a/a ) (c, a/  ) ( , Z 0 /Z 0 ) (c, a/  ) (h) L 8 = { a i b k c i | i, k  0 } (b, Z 0 /Z 0 )

8 3. For each of the following grammars, construct a DPDA which accepts the language generated by the grammar, where S is the only nonterminal, and others are all terminal symbols. For your answer it it enough to show the state transition graph of the automaton. (a) G 1 : S  aSbb | abb (b) G 2 : S  aSbb |  (c ) G 3 : S  aSbb | ccc (a) L(G 1 ) = { a i b 2i | i > 0 } start (a, Z 0 /aaZ 0 ) (b, a/  ) ( , Z 0 /Z 0 ) (b, a/  ) (a, a/aaa) (b) L(G 2 ) = { a i b 2i | i  0 } start (a, Z 0 /aaZ 0 ) (b, a/  ) ( , Z 0 /Z 0 ) (b, a/  ) (a, a/aaa) (c) L(G 3 ) = { a i cccb 2i | i  0 } ( , Z 0 /Z 0 ) (b, a/  ) start (a, Z 0 /aaZ 0 ) (c, a/a ) (a, a/aaa) (c, a/a ), (c, Z 0 /Z 0 ) (c, a/a ), (c, Z 0 /Z 0 )

9 4. For each of the following languages, construct a DFA (deterministic finite automaton) which accepts the language. For your answer it it enough to show the state transition graph of the automaton. (a) L 9 = {x | x  {a, m, t, o, u}* and x has automata as a substring. } (b) L 10 = {x | x  {a, b, c} +, and the leftmost and the rightmost symbols in x are same.} start 1 2 m, t, o, u a a u m, t, o t o m a t a a, m, t, o, u m, o, u m, t, u t, o, u m, t, o, u m, o,m, t, o, u a a a a to state 1 Answer (a): to state 2 u

10 Answer (b): start a b c b, c a, c a, b a b, c a, c a, b c b a b c