Chapter 5 Recursive and recursively enumerable functions Phrase-structure grammars.

Slides:



Advertisements
Similar presentations
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
Advertisements

Chapter 5 Pushdown Automata
Lecture 16 Deterministic Turing Machine (DTM) Finite Control tape head.
Variants of Turing machines
Foundations of (Theoretical) Computer Science Chapter 3 Lecture Notes (Section 3.2: Variants of Turing Machines) David Martin With.
February 6, 2015CS21 Lecture 141 CS21 Decidability and Tractability Lecture 14 February 6, 2015.
1 Introduction to Computability Theory Lecture12: Decidable Languages Prof. Amos Israeli.
More Turing Machines Sipser 3.2 (pages ). CS 311 Fall Multitape Turing Machines Formally, we need only change the transition function to.
More Turing Machines Sipser 3.2 (pages ).
Fall 2004COMP 3351 Undecidable problems for Recursively enumerable languages continued…
P, NP, PS, and NPS By Muhannad Harrim. Class P P is the complexity class containing decision problems which can be solved by a Deterministic Turing machine.
1 … NPDAs continued. 2 Pushing Strings Input symbol Pop symbol Push string.
Fall 2004COMP 3351 Recursively Enumerable and Recursive Languages.
Costas Busch - RPI1 Undecidable problems for Recursively enumerable languages continued…
CS 302: Discrete Math II A Review. An alphabet Σ is a finite set (e.g., Σ = {0,1}) A string over Σ is a finite-length sequence of elements of Σ For x.
Recursively Enumerable and Recursive Languages
1 The Chomsky Hierarchy. 2 Unrestricted Grammars: Rules have form String of variables and terminals String of variables and terminals.
Programming the TM qa  (,q) (,q) q1q1 0q1q1 R q1q1 1q1q1 R q1q1  h  Qa  (,q) (,q) q1q1 0q2q2  q1q1 1q3q3  q1q1  h  q2q2 0q4q4 R q2q2 1q4q4.

Fall 2004COMP 3351 Reducibility. Fall 2004COMP 3352 Problem is reduced to problem If we can solve problem then we can solve problem.
1 Decidability continued. 2 Undecidable Problems Halting Problem: Does machine halt on input ? State-entry Problem: Does machine enter state halt on input.
Fall 2006Costas Busch - RPI1 Non-Deterministic Finite Automata.
Fall 2005Costas Busch - RPI1 Recursively Enumerable and Recursive Languages.
Courtesy Costas Busch - RPI1 Reducibility. Courtesy Costas Busch - RPI2 Problem is reduced to problem If we can solve problem then we can solve problem.
Costas Busch - LSU1 Non-Deterministic Finite Automata.
Prof. Busch - LSU1 Turing Machines. Prof. Busch - LSU2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
1 Reducibility. 2 Problem is reduced to problem If we can solve problem then we can solve problem.
Chapter 9 Turing Machine (TMs).
Turing Machines A more powerful computation model than a PDA ?
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen Department of Computer Science University of Texas-Pan American.
1 Section 14.2 A Hierarchy of Languages Context-Sensitive Languages A context-sensitive grammar has productions of the form xAz  xyz, where A is a nonterminal.
Computability Construct TMs. Decidability. Preview: next class: diagonalization and Halting theorem.
1 More About Turing Machines “Programming Tricks” Restrictions Extensions Closure Properties.
Computability Chapter 5. Overview  Turing Machine (TM) considered to be the most general computational model that can be devised (Church-Turing thesis)
1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)
Computability Review homework. Video. Variations. Definitions. Enumerators. Hilbert's Problem. Algorithms. Summary Homework: Give formal definition of.
Recursively Enumerable Languages
Lecture 21 Reducibility. Many-one reducibility For two sets A c Σ* and B c Γ*, A ≤ m B if there exists a Turing-computable function f: Σ* → Γ* such that.
Discrete Structures ICS252 Chapter 5 Lecture 2. Languages and Grammars prepared By sabiha begum.
Recursively Enumerable and Recursive Languages
December 3, 2009Theory of Computation Lecture 21: Turing Machines III 1 Simulation of T in L Now the MIDDLE section of Q can be generated by replacing.
1 Introduction to Turing Machines
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 12 Mälardalen University 2007.
Unrestricted Grammars
Umans Complexity Theory Lectures Lecture 1b: Turing Machines & Halting Problem.
Turing Machines Sections 17.6 – The Universal Turing Machine Problem: All our machines so far are hardwired. ENIAC
Turing Machines CS 130 Theory of Computation HMU Textbook: Chap 8.
1 Turing Machines. 2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
FORMAL LANGUAGES, AUTOMATA, AND COMPUTABILITY * Read chapter 4 of the book for next time * Lecture9x.ppt.
Universal Turing Machine
CS6800 Advance Theory of Computation Spring 2016 Nasser Alsaedi
Recursively Enumerable and Recursive Languages. Definition: A language is recursively enumerable if some Turing machine accepts it.
Fall 2006Costas Busch - RPI1 RE languages and Enumerators.
Modeling Arithmetic, Computation, and Languages Mathematical Structures for Computer Science Chapter 8 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesAlgebraic.
Recursively Enumerable Languages
Busch Complexity Lectures: Turing Machines
Chapter 7 PUSHDOWN AUTOMATA.
Theory of Computation Lecture 22: Turing Machines III
Turing Machines 2nd 2017 Lecture 9.
CSE 105 theory of computation
Turing Machines Acceptors; Enumerators
Turing acceptable languages and Enumerators
Non-Deterministic Finite Automata
Non Deterministic Automata
Turing acceptable languages and Enumerators
CSE 105 theory of computation
Variants of Turing machines
MA/CSSE 474 Theory of Computation
Theory of Computation Lecture 23: Turing Machines III
CSE 105 theory of computation
Presentation transcript:

Chapter 5 Recursive and recursively enumerable functions Phrase-structure grammars

TM Computer read-only input tape read/write work tape δ: Q  (Σ  {ε})  Γ → (Q  {h})  (Γ  {L, R})  (Σ  {ε}) input tape alphabet work tape alphabet → assume read head always moves right ← → write-only output tape → assume output head always moves right output tape alphabet work tape symbols states M input output #  Σ

Partial Recursive functions Definition: A partial function f: Σ* → Δ* is partial recursive if it can be computed by a machine with input and output. If the machine doesn’t halt on input w, then f(w) = ↑ is undefined. Theorem: A function f is partial recursive iff its graph G f = { 〈 x, y 〉 : f(x) = y} is accepted by a machine. M xf(x)f(x) M 〈 x, y 〉 yes, if y = f(x)

Partial Recursive Proof: ( ⇒ ) Suppose there is a machine M which computes f. Here is a machine which accepts G f : Proof: ( ⇐ ) Suppose there is a machine M which accepts G f. Here is a machine which computes f: M x  x, y  =? y Only accepts when y = f(x). f(x)f(x)  x, y  print y y accept generator x M reject next k time bound guess Only prints when y = f(x). yes

Recursive Functions Definition: A (total) function f: Σ* → Δ* is (total) recursive if it can be computed by a TM with input and output. Note the machine must always halt. Theorem: A function f is recursive iff its graph G f = { 〈 x, y 〉 : f(x) = y} is decided by a machine. Proof: Same proof, except the time bound is not necessary. f(x) = y ⇔ M xy

Phrase-Structure Grammars A grammar with productions such that the left-hand side is any string of variables V and terminals T containing at least one variable: α → βα ∈ (V ∪ T)* \ T* β ∈ (V ∪ T)* We say γαδ ⇒ γβδ and define A ∈ V ⇒ * w ∈ T* as before. A context-sensitive grammar (CSG) has |β| ≥ |α|.

Context-Sensitive Grammar Example:equal numbers of three symbols. L = {w ∈ {a, b, c}* : w has an equal number of each} S → SABC | εA → aB → bC → c AB → BAAC → CABC → CB BA → ABCA → ACCB → BC Explanation: Every permutation can be generated by a product of adjacent transpositions (combinatorics).

TM → PSG Theorem: Every language accepted by a TM can be generated by a phrase-structure grammar. Proof: Take M = (Q, Σ, δ, s), #  Σ is blank symbol, h  Q is halt state. M accepts its input by erasing its tape. Suppose we have a grammar for generating strings. |T| = 3|Σ| + 2 S  * w [ sn …… n ] where σ 1 … σ m = w σ1σ1 σ2σ2 σmσm s indicating the start state, and n indicating “no head”. The symbolsand, [, ] are variables σ  Σ q  Q  {h} n  Q  {h} qn σσ “M in state q reading σ” “no head on this square”

TM → PSG Proof, cont. Add the following productions which will allow the grammar to keep track of the ID of M. ] ↔ n ] add or subtact as many blanks as desired # q → p if δ(q, a) = (p, b) ab qn → np if δ(q, a) = (p, R) abab nq → pn if δ(q, a) = (p, L) baba [ h ] → ε erase if tape is empty and M halts # □ a, b  Σ q  Q p  Q  {h}

PSG → TM Theorem: Every phrase-structure language can be accepted by some TM. Proof: We will construct a machine M with two tapes: (1) to hold the input, and (2) to hold a derivation α from the grammar. Starting with S on (2), non-deterministically do the following: (1) w (2) ←replace→ α β↓γβ↓γ i shift → or ←

PSG → TM Proof (A) Guess a position i in α to move to. AB R N finite control: (B) Guess a production β → γ of the grammar. (finite number of productions, finite number of choices): (C) If β appears in α at position i, replace β by γ by shifting over the remainder if necessary (α′). i.e. σ 1 … σ i −1 β α′  V  TV  T D L L A if match, R no match Repeat until this tape is all terminals. Then see if it matches the original input. (1) w (2) ←replace→ α β↓γβ↓γ shift → or ← i