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

CISC 4090 Theory of Computation

Outline. Language Hierarchy

pp Variants of Turing Machines (Sec. 3.2)

CS21 Decidability and Tractability

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

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

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION

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

Turing Machines, continued

Computer Sciences Department

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

A Characterization of the Chomsky Hierarchy by String Turing Machines

Actually talking about Turing machines this time

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

Computability and Complexity

Introduction to Computers & Programming

Theory of Computations Spring 2016 Practice Final Exam Solutions

14.1 Encoding for different models of computation

COMP 382: Reasoning about algorithms

Theory of Computations Spring 2016 Practice Final

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2016

CSE 105 THEORY OF COMPUTATION

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

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

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

Recursively Enumerable Languages, Turing Machines, and Decidability

Lecture 18: Turing Machines

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

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

(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

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

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

Lexical Analysis. Chapter 2

Converting a DFA to a Regular Expression JP

Implementation of Lexical Analysis

Implementation of Lexical Analysis

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.

Implementation of Lexical Analysis

Turing Machines Part Two

CSC-461 Exam #2 April 16, 2014

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

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

CT32 COMPUTER NETWORKS DEC 2015

Turing Machine Languages

Compiler course. Chapter 3 Lexical Analysis

Lexical Analysis. Implementation: Finite Automata

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

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

Lexical Analysis. Lecture 2-4

CpSc 421 Final Solutions

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

lec3:nondeterministic finite state automata

Introduction to Lexical Analysis

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

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

Computability Summary

Finite Automata Part Three

Theory of Computation Dr. Weiss Extra Practice Exam Solutions

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

Formal Languages and Automata

CSE450. Translation of Programming Languages. Lecture 20: Automata and Regular Expressions

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

Theory of Programming Languages COMP360

Theory of Computer Science

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

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

CS 181 B&C EXAM #1 NAME. You have 90 minutes to complete this exam. You may assume without proof any statement proved in class.

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

Lexical Analysis. Lecture 3-4

Chapter 3 Lexical Analysis

Lecture 5: The Halting Problem. Michael Beeson

Problems, Languages, Machines, Computability, Complexity

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

6 NFA and Regular Expressions

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

Finite automata. We have looked at using Lex to build a scanner on the basis of regular expressions.

Finite Automata Part Three

Midterm I (Solutions) CS164, Spring 2002

Recursive and Recursively Enumerable Languages

Rice s Theorem and Enumeration

MIT Specifying Languages with Regular Expressions and Context-Free Grammars. Martin Rinard Massachusetts Institute of Technology

Kinder, Gentler Nation

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.

CSE 431S Scanning. Washington University Spring 2013

Formal languages and computation models

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

Formal Languages and Compilers Lecture IV: Regular Languages and Finite. Finite Automata

Lexical Analysis. Finite Automata. (Part 2 of 2)

MIT Specifying Languages with Regular Expressions and Context-Free Grammars


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

1 Parsing (25 pts, 5 each)

Transcription:

CSE 105 THEORY OF COMPUTATION Spring 2017 http://cseweb.ucsd.edu/classes/sp17/cse105-ab/

Today's learning goals Sipser Ch 2, 3.1 State and use the Church-Turing thesis. Describe several variants of Turing machines and informally explain why they are equally expressive. Explain what it means for a problem to be decidable. Justify the use of encoding. Give examples of decidable problems.

Review What's L(M)? Is M a decider? Consider the TM M = "On input w, 1. Run M 1 on w. If M 1 rejects, rejects. If M 1 accepts, go to 2. 2. Run M 2 on w. If M 2 accepts, accept. If M 2 rejects, reject." What kind of construction is this? A. Formal definition of TM B. Implementation-level description of TM C. High-level description of TM D. I don't know.

Describing TMs Sipser Section 3.3, p. 184 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 description: Description of algorithm, without implementation details of machine. As part of this description, can "call" and run another TM as a subroutine.

Subroutines Consider the TM M = "On input w, 1. Run M 1 on w. If M 1 rejects, rejects. If M 1 accepts, go to 2. 2. Run M 2 on w. If M 2 accepts, accept. If M 2 rejects, reject."

High-level description = 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.

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 All these models are equally expressive! Also: wildly different models λ-calculus, Post canonical systems, URMs, etc.

"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. e.g. DFA, NFA equally expressive

Nondeterministic TMs Sipser p. 178 Transition function Q x Γ P(Q x Γ x {L,R}) Sketch of proof of equivalence: To simulate nondeterministic machine: Use 3 tapes: "readonly" input tape, simulation tape, tape tracking nondeterministic braching.

Multitape TMs Sipser p. 176 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: To simulate multiple tapes with one tape: Use delimiter to keep tape contents separate, use special symbol to indicate location of each read/write head.

Very different model: Enumerators Sipser p. 180 Produce language as output rather than recognize input Finite State Control Printer a b a b. Unlimited work tape Computation proceeds according to transition function. At any point, machine may "send" a string to printer. 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 Σ." Proof: High level description of E Standard string 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: Assume L is Turing-recognizable. WTS some enumerator enumerates it. Assume L is enumerated by some enumerator. WTS L is Turing-recognizable.

Recognition and enumeration Sipser Theorem 3.21 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?

Recognition and enumeration Sipser Theorem 3.21 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 strings in Σ*. Define E as follows: E = "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?

M is TM that recognizes L D is TM that decides L E is enumerator that enumerates L If string w is in L then If string w is not in L then