CSE 105 THEORY OF COMPUTATION

Similar documents
CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION

Variants of Turing Machines

ECS 120 Lesson 16 Turing Machines, Pt. 2

Theory of Computation, Homework 3 Sample Solution

Equivalence of NTMs and TMs

Theory of Languages and Automata

CS21 Decidability and Tractability

Outline. Language Hierarchy

Midterm Exam II CIS 341: Foundations of Computer Science II Spring 2006, day section Prof. Marvin K. Nakayama

CISC 4090 Theory of Computation

pp Variants of Turing Machines (Sec. 3.2)

Theory of Computation p.1/?? Theory of Computation p.2/?? A Turing machine can do everything that any computing

Turing Machines. A transducer is a finite state machine (FST) whose output is a string and not just accept or reject.

Theory of Computations Spring 2016 Practice Final

Theory of Computations Spring 2016 Practice Final Exam Solutions

I have read and understand all of the instructions below, and I will obey the Academic Honor Code.

Computer Sciences Department

Introduction to Computers & Programming

Turing Machines, continued

Closure Properties of CFLs; Introducing TMs. CS154 Chris Pollett Apr 9, 2007.

Decidable Problems. We examine the problems for which there is an algorithm.

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2016

Actually talking about Turing machines this time

CSC-461 Exam #2 April 16, 2014

Computability and Complexity

COMP 382: Reasoning about algorithms

(a) R=01[((10)*+111)*+0]*1 (b) ((01+10)*00)*. [8+8] 4. (a) Find the left most and right most derivations for the word abba in the grammar

CSE 105 THEORY OF COMPUTATION

Lecture 18: Turing Machines

Chapter 14: Pushdown Automata

CSE 105 THEORY OF COMPUTATION

TAFL 1 (ECS-403) Unit- V. 5.1 Turing Machine. 5.2 TM as computer of Integer Function

Source of Slides: Introduction to Automata Theory, Languages, and Computation By John E. Hopcroft, Rajeev Motwani and Jeffrey D.

Limitations of Algorithmic Solvability In this Chapter we investigate the power of algorithms to solve problems Some can be solved algorithmically and

PDA s. and Formal Languages. Automata Theory CS 573. Outline of equivalence of PDA s and CFG s. (see Theorem 5.3)

14.1 Encoding for different models of computation

The Turing Machine. Unsolvable Problems. Undecidability. The Church-Turing Thesis (1936) Decision Problem. Decision Problems

CS5371 Theory of Computation. Lecture 8: Automata Theory VI (PDA, PDA = CFG)

University of Nevada, Las Vegas Computer Science 456/656 Fall 2016

Recursively Enumerable Languages, Turing Machines, and Decidability

A Characterization of the Chomsky Hierarchy by String Turing Machines

Turing Machine as Transducer. Turing Machines. Computation with Turing Machines. Computation with Turing Machines. Computation with Turing Machines

Turing Machine Languages

Today, we will dispel the notion that Java is a magical language that allows us to solve any problem we want if we re smart enough.

CS 275 Automata and Formal Language Theory. First Problem of URMs. (a) Definition of the Turing Machine. III.3 (a) Definition of the Turing Machine

Formal languages and computation models

Lexical Analysis. Chapter 2

Theory of Programming Languages COMP360

CS402 - Theory of Automata Glossary By

6.045J/18.400J: Automata, Computability and Complexity. Practice Quiz 2

We can create PDAs with multiple stacks. At each step we look at the current state, the current input symbol, and the top of each stack.

1. [5 points each] True or False. If the question is currently open, write O or Open.

1. (10 points) Draw the state diagram of the DFA that recognizes the language over Σ = {0, 1}

Does this program exist? Limits of computability. Does this program exist? A helper function. For example, if the string program is

Name: CS 341 Practice Final Exam. 1 a 20 b 20 c 20 d 20 e 20 f 20 g Total 207

Final Course Review. Reading: Chapters 1-9

Compiler course. Chapter 3 Lexical Analysis

t!1; R 0! 1; R q HALT

Lexical Analysis. Lecture 2-4

CT32 COMPUTER NETWORKS DEC 2015

CSCI 3130: Formal Languages and Automata Theory Lecture 16 The Chinese University of Hong Kong, Fall 2010

CSE 105 THEORY OF COMPUTATION

Finite Automata Part Three

Skyup's Media. PART-B 2) Construct a Mealy machine which is equivalent to the Moore machine given in table.

lec3:nondeterministic finite state automata

Lexical Analysis. Lecture 3-4

R10 SET a) Construct a DFA that accepts an identifier of a C programming language. b) Differentiate between NFA and DFA?


Theory Bridge Exam Example Questions Version of June 6, 2008

QUESTION BANK. Formal Languages and Automata Theory(10CS56)

CS 125 Section #4 RAMs and TMs 9/27/16

Implementation of Lexical Analysis

Theory of Computation Dr. Weiss Extra Practice Exam Solutions

Regular Languages (14 points) Solution: Problem 1 (6 points) Minimize the following automaton M. Show that the resulting DFA is minimal.

Enumerations and Turing Machines

Implementation of Lexical Analysis

Introduction to Lexical Analysis

We show that the composite function h, h(x) = g(f(x)) is a reduction h: A m C.

Lexical Analysis. Implementation: Finite Automata

Formal Languages and Automata

Problems, Languages, Machines, Computability, Complexity

Chapter 3 Lexical Analysis

1 Parsing (25 pts, 5 each)

CSCI 340: Computational Models. Turing Machines. Department of Computer Science

Lecture 5: The Halting Problem. Michael Beeson

Implementation of Lexical Analysis

Turing Machines Part Two

Last lecture CMSC330. This lecture. Finite Automata: States. Finite Automata. Implementing Regular Expressions. Languages. Regular expressions

CpSc 421 Final Solutions

6 NFA and Regular Expressions

CS 125 Section #10 Midterm 2 Review 11/5/14

CSE 120. Computer Science Principles

Lexical Analysis - 2

CS402 Theory of Automata Solved Subjective From Midterm Papers. MIDTERM SPRING 2012 CS402 Theory of Automata

Finite Automata. Dr. Nadeem Akhtar. Assistant Professor Department of Computer Science & IT The Islamia University of Bahawalpur

Regular Expressions & Automata

III. Supplementary Materials

Computation Engineering Applied Automata Theory and Logic. Ganesh Gopalakrishnan University of Utah. ^J Springer

1. Draw the state graphs for the finite automata which accept sets of strings composed of zeros and ones which:

Transcription:

CSE 105 THEORY OF COMPUTATION Fall 2016 http://cseweb.ucsd.edu/classes/fa16/cse105-abc/

Today's learning goals Sipser sec 3.2 Describe several variants of Turing machines and informally explain why they are equally expressive. Give high-level description for TMs (recognizers and enumerators) used in constructions Prove properties of the classes of recognizable and decidable sets. State and use the Church-Turing thesis.

Turing decidable languages Context-free languages Regular languages

Describing TMs Sipser p. 159 Formal definition: set of states, input alphabet, tape alphabet, transition function, state state, accept state, reject state. Implementation-level definition: English prose to describe Turing machine head movements relative to contents of tape. High-level desciption: Description of algorithm, without implementation details of machine. As part of this description, can "call" and run another TM as a subroutine.

Variants of TMs Scratch work, copy input, Multiple tapes Parallel computation Nondeterminism Printing vs. accepting Enumerators More flexible transition function Can "stay put" Can "get stuck" lots of examples in exercises to Chapter 3

"Equally expressive" Model 1 Model 2 Model 1 is equally expressive as Model 2 iff ü every language recognized by some machine in Model 1 is recognizable by some machine in Model 2, and ü every language recognized by some machine in Model 2 is recognizable by some machine in Model 1.

Multitape TMs Sipser p. 150 As part of construction of machine, declare some finite number of tapes that are available. Input given on tape 1, rest of the tapes start blank. Each tape has its own read/write head. Transition function Q x Γ k à Q x Γ k x {L,R} k Sketch of proof of equivalence: A. Given TM, build multitape TM recognizing same language. B. Given k-tape TM, build (1- tape) TM recognizing same language.

Nondeterministic TMs Sipser p. 152 Transition function Q x Γ à P(Q x Γ x {L,R}) Sketch of proof of equivalence: A. Given TM, build nondeterminstic TM recognizing same language. B. Given nondeterministic TM, build (deterministic) TM recognizing same language. Idea: Try all possible branches of nondeterministic computation. 3 tapes: "read-only" input tape, simulation tape, tape tracking nondeterministic braching.

Enumerators What about machines that produce output rather than accept input? Finite State Control a b a b. Computation proceeds according to transition function. At any point, machine may "send" a string to printer. Unlimited tape L(E) = { w E eventually, in finite time, prints w}

Enumerators What about machines that produce output rather than accept input? Finite State Control a b a b. Can L(E) be infinite? A. No, strings must be printed in finite time. B. No, strings must be all be finite length. C. Yes, it may happen if E does not halt. D. Yes, all L(E) Computation are infinite. proceeds E. I don't know. according to transition function. At any point, machine may "send" a string to printer. Unlimited tape L(E) = { w E eventually, in finite time, prints w}

Set of all strings "For each Σ, there is an enumerator whose language is the set of all strings over Σ." A. True B. False C. Depends on Σ. D. I don't know.

Set of all strings "For each Σ, there is an enumerator whose language is the set of all strings over Σ." A. True B. False C. Depends on Σ. D. I don't know. Lexicographic ordering: order strings first by length, then dictionary order. (p. 14)

Recognition and enumeration Sipser Theorem 3.21 Theorem: A language L is Turing-recognizable iff some enumerator enumerates L. Proof: A. Assume L is Turing-recognizable. WTS some enumerator enumerates it. B. Assume L is enumerated by some enumerator. WTS L is Turing-recognizable.

Recognition and enumeration Sipser Theorem 3.21 A. Assume L is Turing-recognizable. WTS some enumerator enumerates it. Let M be a TM that recognizes L. We'll use M in a subroutine for highlevel description of enumerator E. Let s 1, s 2, be a list of all possible strings of Σ*. Define E as follows: E = "On input w, ignore input and repeat the following for each value of i=1,2,3 1. Run M for i steps on each input s 1,, s i 2. If any of the i computations of M accepts, print out the accepted string. Correctness?

Recognition and enumeration Sipser Theorem 3.21 B. Assume the enumerator E enumerates L. WTS L is Turingrecognizable. We'll use E in a subroutine for high-level description of Turing machine M that will recognize L. Define M as follows: M = "On input w, 1. Run E. Every time E prints a string, compare it to w. 2. If w ever appears as the output of E, accept. Correctness?

Variants of TMs Scratch work, copy input, Multiple tapes Parallel computation Nondeterminism Printing vs. accepting Enumerators More flexible transition function Can "stay put" Can "get stuck" lots of examples in exercises to Chapter 3 Also: wildly different models λ-calculus, Post canonical systems, URMs, etc.

Variants of TMs Scratch work, copy input, Multiple tapes Parallel computation Nondeterminism Printing vs. accepting Enumerators More flexible transition function All these models are Can "stay put" equally expressive! Can "get stuck" lots of examples in exercises to Chapter 3 Also: wildly different models λ-calculus, Post canonical systems, URMs, etc.

Regular Context- Free Turing- Decidable Turing- Recognizable

Algorithm Wikipedia "self-contained step-by-step set of operations to be performed" CSE 20 textbook "An algorithm is a finite sequence of precise instructions for performing a computation or for solving a problem." Church-Turing thesis Each algorithm can be implemented by some Turing machine.

Some algorithms Examples of algorithms / algorithmic problems: 1. Recognize whether a string is a palindrome. 2. Reverse a string. 3. Recognize Pythagorean triples. 4. Compute the gcd of two positive integers. 5. Check whether a string is accepted by a DFA. 6. Convert a regular expression to an equivalent NFA. 7. Check whether the language of a PDA is infinite.

Which of the following is true? A. All these algorithms have inputs of the same type. B. The inputs of each of these algorithms can be encoded as finite strings. C. Some of these problems don't have algorithmic solutions. Some algorithms Examples D. I don't know. of algorithms / algorithmic problems: 1. Recognize whether a string is a palindrome. 2. Reverse a string. 3. Recognize Pythagorean triples. 4. Compute the gcd of two positive integers. 5. Check whether a string is accepted by a DFA. 6. Convert a regular expression to an equivalent NFA. 7. Check whether the language of a PDA is infinite.

Encoding input for TMs Sipser p. 159 By definition, TM inputs are strings To define TM M: "On input w 1... 2... 3. For inputs that aren't strings, we have to encode the object (represent it as a string) first Notation: <O> is the string that represents (encodes) the object O <O 1,, O n > is the single string that represents the tuple of objects O 1,, O n

Encoding inputs Payoff: problems we care about can be reframed as languages of strings e.g. "Recognize whether a string is a palindrome." { w w in {0,1}* and w = w R } e.g. "Recognize Pythagorean triples." { <a,b,c> a,b,c integers and a 2 + b 2 = c 2 } e.g. "Check whether a string is accepted by a DFA." { <B,w> B is a DFA over Σ, w in Σ*, and w is in L(B) } e.g. "Check whether the language of a PDA is infinite." { <A> A is a PDA and L(A) is infinite}