Decidability and Recursive Languages

Similar documents
The Traveling Salesman Problem. Time Complexity under Nondeterminism. A Nondeterministic Algorithm for tsp (d)

Cook s Theorem: the First NP-Complete Problem

monotone circuit value

Levin Reduction and Parsimonious Reductions

You Have an NP-Complete Problem (for Your Thesis)

Another Variant of 3sat

Another Variant of 3sat. 3sat. 3sat Is NP-Complete. The Proof (concluded)

Sublinear Time Algorithms Oct 19, Lecture 1

On the computational complexity of spiking neural P systems

Yao s Minimax Principle

An effective perfect-set theorem

Lecture 5: Tuesday, January 27, Peterson s Algorithm satisfies the No Starvation property (Theorem 1)

COMPUTER SCIENCE 20, SPRING 2014 Homework Problems Recursive Definitions, Structural Induction, States and Invariants

IEOR E4004: Introduction to OR: Deterministic Models

MAC Learning Objectives. Learning Objectives (Cont.)

Game Theory: Normal Form Games

ExpTime Tableau Decision Procedures for Regular Grammar Logics with Converse

Algorithmic Game Theory and Applications. Lecture 11: Games of Perfect Information

Principles of Financial Computing. Introduction. Useful Journals. References

Semantics with Applications 2b. Structural Operational Semantics

Structural Induction

CSE 21 Winter 2016 Homework 6 Due: Wednesday, May 11, 2016 at 11:59pm. Instructions

DRAFT. 1 exercise in state (S, t), π(s, t) = 0 do not exercise in state (S, t) Review of the Risk Neutral Stock Dynamics

Trinomial Tree. Set up a trinomial approximation to the geometric Brownian motion ds/s = r dt + σ dw. a

Max Registers, Counters and Monotone Circuits

SAT and DPLL. Espen H. Lian. May 4, Ifi, UiO. Espen H. Lian (Ifi, UiO) SAT and DPLL May 4, / 59

CSCE 750, Fall 2009 Quizzes with Answers

Lecture 4: Divide and Conquer

Asymptotic Notation. Instructor: Laszlo Babai June 14, 2002

MAT385 Final (Spring 2009): Boolean Algebras, FSM, and old stuff

Gamma. The finite-difference formula for gamma is

Tug of War Game. William Gasarch and Nick Sovich and Paul Zimand. October 6, Abstract

CMPSCI 311: Introduction to Algorithms Second Midterm Practice Exam SOLUTIONS

SAT and DPLL. Introduction. Preliminaries. Normal forms DPLL. Complexity. Espen H. Lian. DPLL Implementation. Bibliography.

Rational Behaviour and Strategy Construction in Infinite Multiplayer Games

TABLEAU-BASED DECISION PROCEDURES FOR HYBRID LOGIC

Strong normalisation and the typed lambda calculus

Strategies and Nash Equilibrium. A Whirlwind Tour of Game Theory

Computational Independence

Trinomial Tree. Set up a trinomial approximation to the geometric Brownian motion ds/s = r dt + σ dw. a

Binomial Model for Forward and Futures Options

Futures Contracts vs. Forward Contracts

Lecture l(x) 1. (1) x X

Maximum Contiguous Subsequences

Essays on Some Combinatorial Optimization Problems with Interval Data

Principles of Financial Computing

THE TRAVELING SALESMAN PROBLEM FOR MOVING POINTS ON A LINE

Gödel algebras free over finite distributive lattices

Discrete Mathematics for CS Spring 2008 David Wagner Final Exam

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages

Binary Decision Diagrams

Chapter 5: Algorithms

Lecture 2: The Simple Story of 2-SAT

Comparison of proof techniques in game-theoretic probability and measure-theoretic probability

The Turing Definability of the Relation of Computably Enumerable In. S. Barry Cooper

Binary Decision Diagrams

Unary PCF is Decidable

arxiv: v1 [math.co] 31 Mar 2009

Development Separation in Lambda-Calculus

GAME THEORY. Department of Economics, MIT, Follow Muhamet s slides. We need the following result for future reference.

Principles of Financial Computing

Final exam solutions

Zero-Coupon Bonds (Pure Discount Bonds)

Dynamic Programming: An overview. 1 Preliminaries: The basic principle underlying dynamic programming

In this lecture, we will use the semantics of our simple language of arithmetic expressions,

Computing Unsatisfiable k-sat Instances with Few Occurrences per Variable

Bidding Languages. Chapter Introduction. Noam Nisan

Residuated Lattices of Size 12 extended version

Problem Set 2: Answers

Finding Equilibria in Games of No Chance

Extraction capacity and the optimal order of extraction. By: Stephen P. Holland

Can we have no Nash Equilibria? Can you have more than one Nash Equilibrium? CS 430: Artificial Intelligence Game Theory II (Nash Equilibria)

CS 4110 Programming Languages and Logics Lecture #2: Introduction to Semantics. 1 Arithmetic Expressions

TEST 1 SOLUTIONS MATH 1002

CTL Model Checking. Goal Method for proving M sat σ, where M is a Kripke structure and σ is a CTL formula. Approach Model checking!

5 Deduction in First-Order Logic

HW 1 Reminder. Principles of Programming Languages. Lets try another proof. Induction. Induction on Derivations. CSE 230: Winter 2007

Practical SAT Solving

arxiv: v1 [math.lo] 24 Feb 2014

Introduction to Greedy Algorithms: Huffman Codes

CS792 Notes Henkin Models, Soundness and Completeness

Risk Measurement in Credit Portfolio Models

CEC login. Student Details Name SOLUTIONS

Martingales. by D. Cox December 2, 2009

Recitation 1. Solving Recurrences. 1.1 Announcements. Welcome to 15210!

Bargaining and Competition Revisited Takashi Kunimoto and Roberto Serrano

Equilibrium Term Structure Models. c 2008 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 854

Recall: Data Flow Analysis. Data Flow Analysis Recall: Data Flow Equations. Forward Data Flow, Again

Q1. [?? pts] Search Traces

Finding the Sum of Consecutive Terms of a Sequence

Issues. Senate (Total = 100) Senate Group 1 Y Y N N Y 32 Senate Group 2 Y Y D N D 16 Senate Group 3 N N Y Y Y 30 Senate Group 4 D Y N D Y 22

Approximate Revenue Maximization with Multiple Items

Game Theory Fall 2003

Lecture 10: The knapsack problem

Lecture 7: Bayesian approach to MAB - Gittins index

Maximizing the Spread of Influence through a Social Network Problem/Motivation: Suppose we want to market a product or promote an idea or behavior in

Optimal Satisficing Tree Searches

Stochastic Processes and Brownian Motion

Section 5 Foundations of Shared Memory: Fault-Tolerant Simulations of read/write objects

Handout 4: Deterministic Systems and the Shortest Path Problem

Transcription:

Decidability and Recursive Languages Let L (Σ { }) be a language, i.e., a set of strings of symbols with a finite length. For example, {0, 01, 10, 210, 1010,...}. Let M be a TM such that for any string x: If x L, then M(x) = yes. If x L, then M(x) = no. We say M decides L. If L is decided by some TM, then L is recursive. c 2010 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 38

Recursive Languages: Examples The set of palindromes over any alphabet is recursive. The set of prime numbers { 2, 3, 5, 7, 11, 13, 17,... } is recursive. The set of C programs that do not contain a while, a for, or a goto is recursive. The set of C programs that do not contain an infinite loop is not recursive (to be proved later). c 2010 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 39

Acceptability and Recursively Enumerable Languages Let L (Σ { }) be a language. Let M be a TM such that for any string x: If x L, then M(x) = yes. If x L, then M(x) =. We say M accepts L. c 2010 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 40

Acceptability and Recursively Enumerable Languages (concluded) If L is accepted by some TM, then L is called a recursively enumerable language. a A recursively enumerable language can be generated by a TM, thus the name. That is, there is an algorithm such that for every x L, it will be printed out eventually. This algorithm may never terminate. a Post (1944). c 2010 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 41

Emil Post (1897 1954) c 2010 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 42

Recursive and Recursively Enumerable Languages Proposition 1 If L is recursive, then it is recursively enumerable. Let TM M decide L. We need to design a TM that accepts L. We next modify M s program to obtain M that accepts L. M is identical to M except that when M is about to halt with a no state, M goes into an infinite loop. M accepts L. c 2010 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 43

Recursively Enumerable Languages: Examples The set of C program-input pairs that do run into an infinite loop is recursively enumerable. Just run it in a simulator environment. The set of C programs that contain an infinite loop is not recursively enumerable (to be proved later). The set of valid statements of an axiomatic system is recursively enumerable. Try all possible proofs systematically. c 2010 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 44

Turing-Computable Functions Let f : (Σ { }) Σ. Optimization problems, root finding problems, etc. Let M be a TM with alphabet Σ. M computes f if for any string x (Σ { }), M(x) = f(x). We call f a recursive function a if such an M exists. a Kurt Gödel (1931). c 2010 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 45

Kurt Gödel (1906 1978) c 2010 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 46

Church s Thesis or the Church-Turing Thesis What is computable is Turing-computable; TMs are algorithms. a Many other computation models have been proposed. Recursive function (Gödel), λ calculus (Church), formal language (Post), assembly language-like RAM (Shepherdson & Sturgis), boolean circuits (Shannon), extensions of the Turing machine (more strings, two-dimensional strings, and so on), etc. All have been proved to be equivalent. a Kleene (1953). c 2010 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 47

Church s Thesis or the Church-Turing Thesis (concluded) No intuitively computable problems have been shown not to be Turing-computable yet. The thesis is a a profound claim about the physical laws of our universe, i.e.: any physical system that purports to be a computer is not capable of any computational task that a Turing machine is incapable of. a Smith (1998). c 2010 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 48

Alonso Church (1903 1995) c 2010 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 49

Stephen Kleene (1909 1994) c 2010 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 50

Extended Church s Thesis a All reasonably succinct encodings of problems are polynomially related. Representations of a graph as an adjacency matrix and as a linked list are both succinct. The unary representation of numbers is not succinct. The binary representation of numbers is succinct. 1001 vs. 111111111. All numbers for TMs will be binary from now on. a Some call it polynomial Church s thesis, which Lószló Lovász attributed to Leonid Levin. c 2010 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 51

Turing Machines with Multiple Strings A k-string Turing machine (TM) is a quadruple M = (K, Σ, δ, s). K, Σ, s are as before. δ : K Σ k (K {h, yes, no }) (Σ {,, }) k. All strings start with a. The first string contains the input. Decidability and acceptability are the same as before. When TMs compute functions, the output is on the last (kth) string. c 2010 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 52

A 2-String TM δ #1000110000111001110001110 #111110000 c 2010 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 53

palindrome Revisited A 2-string TM can decide palindrome in O(n) steps. It copies the input to the second string. The cursor of the first string is positioned at the first symbol of the input. The cursor of the second string is positioned at the last symbol of the input. The two cursors are then moved in opposite directions until the ends are reached. The machine accepts if and only if the symbols under the two cursors are identical at all steps. c 2010 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 54

δ #ababbaabbaabbaabbaba #ababbaabbaabbaabbaba c 2010 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 55

Configurations and Yielding The concept of configuration and yielding is the same as before except that a configuration is a (2k + 1)-tuple w i u i is the ith string. (q, w 1, u 1, w 2, u 2,..., w k, u k ). The ith cursor is reading the last symbol of w i. Recall that is each w i s first symbol. The k-string TM s initial configuration is 2k {}}{ (s,, x,, ɛ,, ɛ,...,, ɛ). }{{}}{{}}{{}}{{} 1 2 3 k c 2010 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 56

Time Complexity The multistring TM is the basis of our notion of the time expended by TM computations. If a k-string TM M halts after t steps on input x, then the time required by M on input x is t. If M(x) =, then the time required by M on x is. Machine M operates within time f(n) for f : N N if for any input string x, the time required by M on x is at most f( x ). x is the length of string x. Function f(n) is a time bound for M. c 2010 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 57

Time Complexity Classes a Suppose language L (Σ { }) is decided by a multistring TM operating in time f(n). We say L TIME(f(n)). TIME(f(n)) is the set of languages decided by TMs with multiple strings operating within time bound f(n). TIME(f(n)) is a complexity class. palindrome is in TIME(f(n)), where f(n) = O(n). a Hartmanis and Stearns (1965); (1965). Hartmanis, Lewis, and Stearns c 2010 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 58

Juris Hartmanis a (1928 ) a Turing Award (1993). c 2010 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 59

Richard Edwin Stearns a (1936 ) a Turing Award (1993). c 2010 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 60

The Simulation Technique Theorem 2 Given any k-string M operating within time f(n), there exists a (single-string) M operating within time O(f(n) 2 ) such that M(x) = M (x) for any input x. The single string of M implements the k strings of M. Represent configuration (q, w 1, u 1, w 2, u 2,..., w k, u k ) of M by configuration of M. (q, w 1u 1 w 2u 2 w ku k ) is a special delimiter. w i is w i with the first a and last symbols primed. a The first symbol is always. c 2010 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 61

The Proof (continued) The priming of the last symbol of w i ensures that M knows which symbol is under the cursor for each simulated string. a We use the primed version of the first symbol of w i (so becomes ). Recall the requirement on p. 20 that δ(q, ) = (p,, ) so that the cursor is not allowed to move to the left of. So the single cursor of M can move between the simulated strings of M. b a Added because of comments made by Mr. Che-Wei Chang (R95922093) on September 27, 2006. b Thanks to a lively discussion on September 22, 2009. c 2010 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 62

The Proof (continued) The initial configuration of M is (s, x k 1 pairs {}}{ ). We simulate each move of M thus: 1. M scans the string to pick up the k symbols under the cursors. The states of M must be enlarged to include K Σ k to remember them. The transition functions of M must also reflect it. 2. M then changes the string to reflect the overwriting of symbols and cursor movements of M. c 2010 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 63

The Proof (continued) It is possible that some strings of M need to be lengthened (see next page). The linear-time algorithm on p. 34 can be used for each such string. The simulation continues until M halts. M then erases all strings of M except the last one. Since M halts within time f( x ), none of its strings ever becomes longer than f( x ). a The length of the string of M at any time is O(kf( x )). a We tacitly assume f(n) n. c 2010 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 64

string 1 string 2 string 3 string 4 string 1 string 2 string 3 string 4 c 2010 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 65

The Proof (concluded) Simulating each step of M takes, per string of M, O(kf( x )) steps. O(f( x )) steps to collect information. O(kf( x )) steps to write and, if needed, to lengthen the string. M takes O(k 2 f( x )) steps to simulate each step of M because there are k strings. As there are f( x ) steps of M to simulate, M operates within time O(k 2 f( x ) 2 ). c 2010 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 66

Linear Speedup a Theorem 3 Let L TIME(f(n)). Then for any ɛ > 0, L TIME(f (n)), where f (n) = ɛf(n) + n + 2. a Hartmanis and Stearns (1965). c 2010 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 67

Implications of the Speedup Theorem State size can be traded for speed. m k Σ 3mk -fold increase to gain a speedup of O(m). If f(n) = cn with c > 1, then c can be made arbitrarily close to 1. If f(n) is superlinear, say f(n) = 14n 2 + 31n, then the constant in the leading term (14 in this example) can be made arbitrarily small. Arbitrary linear speedup can be achieved. a This justifies the big-o notation for the analysis of algorithms. a Can you apply the theorem multiple times to achieve superlinear speedup? Thanks to a question by a student on September 21, 2010. c 2010 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 68

By the linear speedup theorem, any polynomial time bound can be represented by its leading term n k for some k 1. If L is a polynomially decidable language, it is in TIME(n k ) for some k N. P Clearly, TIME(n k ) TIME(n k+1 ). The union of all polynomially decidable languages is denoted by P: P = k>0 TIME(n k ). P contains problems that can be efficiently solved. c 2010 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 69

Space Complexity Consider a k-string TM M with input x. Assume non- is never written over by. a The purpose is not to artificially downplay the space requirement. If M halts in configuration (H, w 1, u 1, w 2, u 2,..., w k, u k ), then the space required by M on input x is k i=1 w iu i. 2006. a Corrected by Ms. Chuan-Ju Wang (R95922018) on September 27, c 2010 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 70

Space Complexity (continued) Suppose we do not charge the space used only for input and output. Let k > 2 be an integer. A k-string Turing machine with input and output is a k-string TM that satisfies the following conditions. The input string is read-only. The last string, the output string, is write-only. So the cursor never moves to the left. The cursor of the input string does not wander off into the s. c 2010 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 71

Space Complexity (concluded) If M is a TM with input and output, then the space required by M on input x is k 1 i=2 w iu i. Machine M operates within space bound f(n) for f : N N if for any input x, the space required by M on x is at most f( x ). c 2010 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 72

Let L be a language. Space Complexity Classes Then L SPACE(f(n)) if there is a TM with input and output that decides L and operates within space bound f(n). SPACE(f(n)) is a set of languages. palindrome SPACE(log n): Keep 3 counters. As in the linear speedup theorem (Theorem 3), constant coefficients do not matter. c 2010 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 73

Nondeterminism a A nondeterministic Turing machine (NTM) is a quadruple N = (K, Σ,, s). K, Σ, s are as before. K Σ (K {h, yes, no }) Σ {,, } is a relation, not a function. b 2008. For each state-symbol combination, there may be multiple valid next steps or none at all. Multiple instructions may be applicable. a Rabin and Scott (1959). b Corrected by Mr. Jung-Ying Chen (D95723006) on September 23, c 2010 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 74

Nondeterminism (concluded) As before, a program contains lines of codes: (q 1, σ 1, p 1, ρ 1, D 1 ), (q 2, σ 2, p 2, ρ 2, D 2 ), (q n, σ n, p n, ρ n, D n ). In the deterministic case (p. 21), we wrote δ(q i, σ i ) = (p i, ρ i, D i ). A configuration yields another configuration in one step if there exists a rule in that makes this happen.. c 2010 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 75

Michael O. Rabin a (1931 ) a Turing Award (1976). c 2010 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 76

Dana Stewart Scott a (1932 ) a Turing Award (1976). c 2010 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 77

Computation Tree and Computation Path V K Ø QR Ù K Ø \HVÙ Ø \HV Ù c 2010 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 78

Decidability under Nondeterminism Let L be a language and N be an NTM. N decides L if for any x Σ, x L if and only if there is a sequence of valid configurations that ends in yes. It is not required that the NTM halts in all computation paths. a If x L, no nondeterministic choices should lead to a yes state. What is key is the algorithm s overall behavior not whether it gives a correct answer for each particular run. Determinism is a special case of nondeterminism. a So accepts may be a more proper term. c 2010 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 79

An Example Let L be the set of logical conclusions of a set of axioms. Predicates not in L may be false under the axioms. They may also be independent of the axioms. That is, they can be assumed true or false without contradicting the axioms. c 2010 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 80

An Example (concluded) Let φ be a predicate whose validity we would like to prove. Consider the nondeterministic algorithm: 1: b := true; 2: while the input predicate φ b do 3: Generate a logical conclusion of b by applying one of the axioms; {Nondeterministic choice.} 4: Assign this conclusion to b; 5: end while 6: yes ; This algorithm decides L. c 2010 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 81