Introduction to computability Tutorial 7

Similar documents
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

The Emptiness Problem for Valence Automata or: Another Decidable Extension of Petri Nets

SE 3310b Theoretical Foundations of Software Engineering. Turing Machines. Aleksander Essex

Closure Properties of Context-Free Languages. Foundations of Computer Science Theory

CS5371 Theory of Computation. Lecture 9: Automata Theory VII (Pumping Lemma, Non-CFL, DPDA PDA)

V Honors Theory of Computation

Cliff s notes for equivalence of CFLs and L(PDAs) LisaCFL L = L(M) for some PDA M L=L(M)forsomePDAM L = L(G) for some CFG G

CS5371 Theory of Computation. Lecture 9: Automata Theory VII (Pumping Lemma, Non-CFL)

Computability and Complexity

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Pumping Lemma for CFLs

Harvard CS 121 and CSCI E-207 Lecture 10: CFLs: PDAs, Closure Properties, and Non-CFLs

Problem 2.6(d) [4 pts] Problem 2.12 [3pts] Original CFG:

Intro to Theory of Computation

DM17. Beregnelighed. Jacob Aae Mikkelsen

7.2 Turing Machines as Language Acceptors 7.3 Turing Machines that Compute Partial Functions

Context-Free Languages (Pre Lecture)

CS 154. Finite Automata vs Regular Expressions, Non-Regular Languages

Theory of Computation (IV) Yijia Chen Fudan University

Chapter 16: Non-Context-Free Languages

Pushdown Automata. We have seen examples of context-free languages that are not regular, and hence can not be recognized by finite automata.

HW6 Solutions. Micha l Dereziński. March 20, 2015

Grade 6 Math Circles October 20/21, Formalism and Languages: Beyond Regular Languages

CSE 355 Test 2, Fall 2016

Notes for Comp 497 (Comp 454) Week 5 2/22/05. Today we will look at some of the rest of the material in Part 1 of the book.

PUSHDOWN AUTOMATA (PDA)

SCHEME FOR INTERNAL ASSESSMENT TEST 3

2.1 Solution. E T F a. E E + T T + T F + T a + T a + F a + a

Intro to Theory of Computation

NPDA, CFG equivalence

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

Pushdown Automata. Notes on Automata and Theory of Computation. Chia-Ping Chen

CS375: Logic and Theory of Computing

3130CIT Theory of Computation

CSE 105 THEORY OF COMPUTATION

CS 154, Lecture 3: DFA NFA, Regular Expressions

CS 275 Automata and Formal Language Theory

CS5371 Theory of Computation. Lecture 10: Computability Theory I (Turing Machine)

Computation Histories

Context-Free and Noncontext-Free Languages

CSE 105 THEORY OF COMPUTATION. Spring 2018 review class

Solution to CS375 Homework Assignment 11 (40 points) Due date: 4/26/2017

Valence automata as a generalization of automata with storage

Section 1 (closed-book) Total points 30

Ogden s Lemma for CFLs

Theory of Computation (Classroom Practice Booklet Solutions)

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

CPSC 421: Tutorial #1

CISC 4090 Theory of Computation

Lecture 4: More on Regexps, Non-Regular Languages

Uses of finite automata

VTU QUESTION BANK. Unit 1. Introduction to Finite Automata. 1. Obtain DFAs to accept strings of a s and b s having exactly one a.

Properties of Context-Free Languages. Closure Properties Decision Properties

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

Solution Scoring: SD Reg exp.: a(a

Context-Free Languages

Lecture 12: Mapping Reductions

Homework Assignment 6 Answers

Variations of the Turing Machine

CSE 105 THEORY OF COMPUTATION

CpSc 421 Final Exam December 15, 2006

CISC 4090 Theory of Computation

CS 341 Homework 16 Languages that Are and Are Not Context-Free

CISC4090: Theory of Computation

SFWR ENG 2FA3. Solution to the Assignment #4

Lecture 17: Language Recognition

CS5371 Theory of Computation. Lecture 10: Computability Theory I (Turing Machine)

Functions on languages:

NOTES WEEK 01 DAY 1 SCOT ADAMS

Undecidable Problems and Reducibility

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Final exam study sheet for CS3719 Turing machines and decidability.

Harvard CS 121 and CSCI E-207 Lecture 12: General Context-Free Recognition

Theory of Computation Turing Machine and Pushdown Automata

Solutions to Problem Set 3

On the coinductive nature of centralizers

The Church-Turing Thesis

Chomsky Normal Form and TURING MACHINES. TUESDAY Feb 4

Rumination on the Formal Definition of DPDA

AC68 FINITE AUTOMATA & FORMULA LANGUAGES DEC 2013

CS 301. Lecture 18 Decidable languages. Stephen Checkoway. April 2, 2018

TAFL 1 (ECS-403) Unit- II. 2.1 Regular Expression: The Operators of Regular Expressions: Building Regular Expressions

CS500 Homework #2 Solutions

(b) If G=({S}, {a}, {S SS}, S) find the language generated by G. [8+8] 2. Convert the following grammar to Greibach Normal Form G = ({A1, A2, A3},

Automata Theory CS F-13 Unrestricted Grammars

CS21 Decidability and Tractability

Homework 5 - Solution

Turing Machines A Turing Machine is a 7-tuple, (Q, Σ, Γ, δ, q0, qaccept, qreject), where Q, Σ, Γ are all finite

Exam 1 CSU 390 Theory of Computation Fall 2007

CSCE 551: Chin-Tser Huang. University of South Carolina

CPS 220 Theory of Computation

Languages. Non deterministic finite automata with ε transitions. First there was the DFA. Finite Automata. Non-Deterministic Finite Automata (NFA)

CS311 Computational Structures Regular Languages and Regular Expressions. Lecture 4. Andrew P. Black Andrew Tolmach

Lecture 24: Randomized Complexity, Course Summary

The Pumping Lemma and Closure Properties

Student#: CISC-462 Exam, December XY, 2017 Page 1 of 12

NOTES WEEK 02 DAY 1. THEOREM 0.3. Let A, B and C be sets. Then

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION

Non-emptiness Testing for TMs

Transcription:

Introduction to computability Tutorial 7 Context free languages and Turing machines November 6 th 2014

Context-free languages 1. Show that the following languages are not context-free: a) L ta i b j a k j maxpi, kqu; b) L tw w w P t0, 1u u where w is the complement of w, that is, the word w where every 1 is replaced by a 0 and every 0 is replaced by a 1.

Useful techniques for proving that a language is not context free Strong version of the pumping lemma: Let L be a context-free language. Then there exists, a constant K such that for any word w P L satisfying w ě K can be written w uvxyz with v or y ε, vxy ď K and uv n xy n z P L for all ně0 Prove that the intersection of the language L with a regular language L R is not context-free. This implies that L is not context-free.

Turing machines 2. Let M pq, Γ, Σ, δ, q 0, 7, Hq be a Turing machine where Q tq 0, q 1, q 2, q 3 u, Γ ta, b, A, B, A 1, B 1 u, Σ ta, bu and δ contains the following transitions: pq 0, aq Ñ pq 1, A 1, Rq pq 1, #q Ñ pq 2, A, Lq pq 2, B 1 q Ñ pq 0, B, Rq pq 0, bq Ñ pq 3, B 1, Rq pq 2, aq Ñ pq 2, a, Lq pq 3, aq Ñ pq 3, a, Rq pq 1, aq Ñ pq 1, a, Rq pq 2, bq Ñ pq 2, b, Lq pq 3, bq Ñ pq 3, b, Rq pq 1, bq Ñ pq 1, b, Rq pq 2, Aq Ñ pq 2, A, Lq pq 3, Aq Ñ pq 3, A, Rq pq 1, Aq Ñ pq 1, A, Rq pq 2, Bq Ñ pq 2, B, Lq pq 3, Bq Ñ pq 3, B, Rq pq 1, Bq Ñ pq 1, B, Rq pq 2, A 1 q Ñ pq 0, A, Rq pq 3, #q Ñ pq 2, B, Lq a) What is on the tape after an execution of M on the word abab? b) Describe what the Turing machine M does on a word w P ta, bu.

$ q 0. abab#####

$ q 0. abab#####

$ q 0. abab#####

$ q 0. abab##### $ q 1. A 1 bab#####

$ q 0. abab##### $ q 1. A 1 bab##### $ q 2. A 1 baba####

$ q 0. abab##### $ q 1. A 1 bab##### $ q 2. A 1 baba#### $ q 2. A 1 baba####

$ q 0. abab##### $ q 1. A 1 bab##### $ q 2. A 1 baba#### $ q 2. A 1 baba#### $ q 0. AbabA####

$ q 0. abab##### $ q 1. A 1 bab##### $ q 2. A 1 baba#### $ q 2. A 1 baba#### $ q 0. AbabA#### $ q 3. AB 1 aba####

$ q 0. abab##### $ q 1. A 1 bab##### $ q 2. A 1 baba#### $ q 2. A 1 baba#### $ q 0. AbabA#### $ q 3. AB 1 aba#### $ q 3. AB 1 aba####

$ q 0. abab##### $ q 1. A 1 bab##### $ q 2. A 1 baba#### $ q 2. A 1 baba#### $ q 0. AbabA#### $ q 3. AB 1 aba#### $ q 3. AB 1 aba#### $ q 2. AB 1 abab###

$ q 0. abab##### $ q 1. A 1 bab##### $ q 2. A 1 baba#### $ q 2. A 1 baba#### $ q 0. AbabA#### $ q 3. AB 1 aba#### $ q 3. AB 1 aba#### $ q 2. AB 1 abab### $ q 2. AB 1 abab###

$ q 0. abab##### $ q 0. ABabAB### $ q 1. A 1 bab##### $ q 2. A 1 baba#### $ q 2. A 1 baba#### $ q 0. AbabA#### $ q 3. AB 1 aba#### $ q 3. AB 1 aba#### $ q 2. AB 1 abab### $ q 2. AB 1 abab###

$ q 0. abab##### $ q 0. ABabAB### $ q 1. ABA 1 bab### $ q 1. A 1 bab##### $ q 2. A 1 baba#### $ q 2. A 1 baba#### $ q 0. AbabA#### $ q 3. AB 1 aba#### $ q 3. AB 1 aba#### $ q 2. AB 1 abab### $ q 2. AB 1 abab###

$ q 0. abab##### $ q 0. ABabAB### $ q 1. ABA 1 bab### $ q 1. ABA 1 bab### $ q 1. A 1 bab##### $ q 2. A 1 baba#### $ q 2. A 1 baba#### $ q 0. AbabA#### $ q 3. AB 1 aba#### $ q 3. AB 1 aba#### $ q 2. AB 1 abab### $ q 2. AB 1 abab###

$ q 0. abab##### $ q 0. ABabAB### $ q 1. ABA 1 bab### $ q 1. ABA 1 bab### $ q 1. A 1 bab##### $ q 2. ABA 1 baba## $ q 2. A 1 baba#### $ q 2. A 1 baba#### $ q 0. AbabA#### $ q 3. AB 1 aba#### $ q 3. AB 1 aba#### $ q 2. AB 1 abab### $ q 2. AB 1 abab###

$ q 0. abab##### $ q 0. ABabAB### $ q 1. ABA 1 bab### $ q 1. ABA 1 bab### $ q 1. A 1 bab##### $ q 2. ABA 1 baba## $ q 2. A 1 baba#### $ q 2. ABA 1 baba## $ q 2. A 1 baba#### $ q 0. AbabA#### $ q 3. AB 1 aba#### $ q 3. AB 1 aba#### $ q 2. AB 1 abab### $ q 2. AB 1 abab###

$ q 0. abab##### $ q 0. ABabAB### $ q 1. ABA 1 bab### $ q 1. ABA 1 bab### $ q 1. A 1 bab##### $ q 2. ABA 1 baba## $ q 2. A 1 baba#### $ q 2. ABA 1 baba## $ q 2. A 1 baba#### $ q 0. ABAbABA## $ q 0. AbabA#### $ q 3. AB 1 aba#### $ q 3. AB 1 aba#### $ q 2. AB 1 abab### $ q 2. AB 1 abab###

$ q 0. abab##### $ q 0. ABabAB### $ q 1. ABA 1 bab### $ q 1. ABA 1 bab### $ q 1. A 1 bab##### $ q 2. ABA 1 baba## $ q 2. A 1 baba#### $ q 2. ABA 1 baba## $ q 2. A 1 baba#### $ q 0. ABAbABA## $ q 0. AbabA#### $ q 3. ABAB 1 ABA## $ q 3. AB 1 aba#### $ q 3. AB 1 aba#### $ q 2. AB 1 abab### $ q 2. AB 1 abab###

$ q 0. abab##### $ q 0. ABabAB### $ q 1. ABA 1 bab### $ q 1. ABA 1 bab### $ q 1. A 1 bab##### $ q 2. ABA 1 baba## $ q 2. A 1 baba#### $ q 2. ABA 1 baba## $ q 2. A 1 baba#### $ q 0. ABAbABA## $ q 0. AbabA#### $ q 3. ABAB 1 ABA## $ q 3. AB 1 aba#### $ q 3. ABAB 1 ABA## $ q 3. AB 1 aba#### $ q 2. AB 1 abab### $ q 2. AB 1 abab###

$ q 0. abab##### $ q 0. ABabAB### $ q 1. ABA 1 bab### $ q 1. ABA 1 bab### $ q 1. A 1 bab##### $ q 2. ABA 1 baba## $ q 2. A 1 baba#### $ q 2. ABA 1 baba## $ q 2. A 1 baba#### $ q 0. ABAbABA## $ q 0. AbabA#### $ q 3. ABAB 1 ABA## $ q 3. AB 1 aba#### $ q 3. ABAB 1 ABA## $ q 3. AB 1 aba#### $ q 2. ABAB 1 ABAB# $ q 2. AB 1 abab### $ q 2. AB 1 abab###

$ q 0. abab##### $ q 0. ABabAB### $ q 1. ABA 1 bab### $ q 1. ABA 1 bab### $ q 1. A 1 bab##### $ q 2. ABA 1 baba## $ q 2. A 1 baba#### $ q 2. ABA 1 baba## $ q 2. A 1 baba#### $ q 0. ABAbABA## $ q 0. AbabA#### $ q 3. ABAB 1 ABA## $ q 3. AB 1 aba#### $ q 3. ABAB 1 ABA## $ q 3. AB 1 aba#### $ q 2. ABAB 1 ABAB# $ q 2. AB 1 abab### $ q 2. ABAB 1 ABAB# $ q 2. AB 1 abab###

$ q 0. abab##### $ q 0. ABabAB### $ q 1. ABA 1 bab### $ q 1. ABA 1 bab### $ q 1. A 1 bab##### $ q 2. ABA 1 baba## $ q 2. A 1 baba#### $ q 2. ABA 1 baba## $ q 2. A 1 baba#### $ q 0. ABAbABA## $ q 0. AbabA#### $ q 3. ABAB 1 ABA## $ q 3. AB 1 aba#### $ q 3. ABAB 1 ABA## $ q 3. AB 1 aba#### $ q 2. ABAB 1 ABAB# $ q 2. AB 1 abab### $ q 2. ABAB 1 ABAB# $ q 2. AB 1 abab### $ q 0. ABABABAB#

Turing machines 2. Let M pq, Γ, Σ, δ, q 0, 7, Hq be a Turing machine where Q tq 0, q 1, q 2, q 3 u, Γ ta, b, A, B, A 1, B 1 u, Σ ta, bu and δ contains the following transitions: pq 0, aq Ñ pq 1, A 1, Rq pq 1, #q Ñ pq 2, A, Lq pq 2, B 1 q Ñ pq 0, B, Rq pq 0, bq Ñ pq 3, B 1, Rq pq 2, aq Ñ pq 2, a, Lq pq 3, aq Ñ pq 3, a, Rq pq 1, aq Ñ pq 1, a, Rq pq 2, bq Ñ pq 2, b, Lq pq 3, bq Ñ pq 3, b, Rq pq 1, bq Ñ pq 1, b, Rq pq 2, Aq Ñ pq 2, A, Lq pq 3, Aq Ñ pq 3, A, Rq pq 1, Aq Ñ pq 1, A, Rq pq 2, Bq Ñ pq 2, B, Lq pq 3, Bq Ñ pq 3, B, Rq pq 1, Bq Ñ pq 1, B, Rq pq 2, A 1 q Ñ pq 0, A, Rq pq 3, #q Ñ pq 2, B, Lq a) What is on the tape after an execution of M on the word abab? b) Describe what the Turing machine M does on a word w P ta, bu.

3. For each of the following languages, give a Turing machine that decides the language: a) ta n b n c n n ě 0u; b) ta n b n c m n ď m ă 2nu.

3. For each of the following languages, give a Turing machine that decides the language: a) ta n b n c n n ě 0u; b) ta n b n c m n ď m ă 2nu. 4. Give a Turing machine that for the following initial configuration ps 0, ε, $1 n 01 m $q terminates for any natural numbers n and m with the configuration pq f, ε, $1 n`m $q where s 0 is an initial and q f an accepting state of the machine.

5. One can define Turing machines that have the possibility to write a symbol without moving the read head. Such a Turing machine is thus a septuple M pq, Γ, Σ, δ, s, B, F q where Q, Γ, Σ, s, B and F have the usual meaning and where δ : Q ˆ Γ Ñ Q ˆ Γ ˆ tl, R, Su (S meaning "stay in the same place"). a) Define the derivation relation "$ M " (in one step) for these Turing machines. b) Show that this extension of the Turing machines does not change the class of recognized languages.