CA320 - Computability & Complexity

Similar documents
Context Sensitive Grammar

Introduction to Formal Languages, Automata and Computability p.1/42

Automata Theory CS F-13 Unrestricted Grammars

UNRESTRICTED GRAMMARS

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

(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},

Computability and Complexity

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

The Post Correspondence Problem

AC68 FINITE AUTOMATA & FORMULA LANGUAGES DEC 2013

Chomsky Normal Form and TURING MACHINES. TUESDAY Feb 4

CS5371 Theory of Computation. Lecture 14: Computability V (Prove by Reduction)

5 Context-Free Languages

Theory of Computation - Module 4

Section 1 (closed-book) Total points 30

SCHEME FOR INTERNAL ASSESSMENT TEST 3

Pushdown Automata. Reading: Chapter 6

Computability and Complexity

Chapter 8. Turing Machine (TMs)

Turing Machines. Fall The Chinese University of Hong Kong. CSCI 3130: Formal languages and automata theory

Theory of Computation

Theory of Computation Turing Machine and Pushdown Automata

CA320 - Computability & Complexity

Languages. Languages. An Example Grammar. Grammars. Suppose we have an alphabet V. Then we can write:

Turing Machines. Our most powerful model of a computer is the Turing Machine. This is an FA with an infinite tape for storage.

Einführung in die Computerlinguistik

MTH401A Theory of Computation. Lecture 17

Theory of Computation

Sheet 1-8 Dr. Mostafa Aref Format By : Mostafa Sayed

Pushdown automata. Twan van Laarhoven. Institute for Computing and Information Sciences Intelligent Systems Radboud University Nijmegen

Computation Histories

October 6, Equivalence of Pushdown Automata with Context-Free Gramm

Introduction to Theory of Computing

Definition: A grammar G = (V, T, P,S) is a context free grammar (cfg) if all productions in P have the form A x where

Formal Definition of a Finite Automaton. August 26, 2013

Theory of Computation

Context-Free Grammars and Languages. Reading: Chapter 5

CS481F01 Prelim 2 Solutions

CS5371 Theory of Computation. Lecture 7: Automata Theory V (CFG, CFL, CNF)

A Universal Turing Machine

Undecidable Problems and Reducibility

Chapter 5. Finite Automata

CSE 105 THEORY OF COMPUTATION

Mildly Context-Sensitive Grammar Formalisms: Embedded Push-Down Automata

Grammars and Context-free Languages; Chomsky Hierarchy

CpSc 421 Final Exam December 15, 2006

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

Recap DFA,NFA, DTM. Slides by Prof. Debasis Mitra, FIT.

Testing Emptiness of a CFL. Testing Finiteness of a CFL. Testing Membership in a CFL. CYK Algorithm

MA/CSSE 474 Theory of Computation

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

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

Part I: Definitions and Properties

CS21004 Formal Languages and Automata Theory, Spring

Finite Automata Theory and Formal Languages TMV026/TMV027/DIT321 Responsible: Ana Bove

Properties of Context-Free Languages

SFWR ENG 2FA3. Solution to the Assignment #4

Turing machines and linear bounded automata

CISC4090: Theory of Computation

Automata Theory CS F-08 Context-Free Grammars

DM17. Beregnelighed. Jacob Aae Mikkelsen

Reducability. Sipser, pages

jflap demo Regular expressions Pumping lemma Turing Machines Sections 12.4 and 12.5 in the text

Embedded systems specification and design

HKN CS/ECE 374 Midterm 1 Review. Nathan Bleier and Mahir Morshed

Equivalent Variations of Turing Machines

Pushdown Automata (2015/11/23)

ECS 120 Lesson 20 The Post Correspondence Problem

CISC 4090 Theory of Computation

CS21 Decidability and Tractability

Computational Models - Lecture 4

Equivalence of TMs and Multitape TMs. Theorem 3.13 and Corollary 3.15 By: Joseph Lauman

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

Turing machines and linear bounded automata

Question Bank UNIT I

Theory of Computation (Classroom Practice Booklet Solutions)

Theory of Computation (II) Yijia Chen Fudan University

Pushdown Automata (Pre Lecture)

1 Unrestricted Computation

Harvard CS 121 and CSCI E-207 Lecture 10: Ambiguity, Pushdown Automata

Nondeterministic Finite Automata

CISC 4090 Theory of Computation

C6.2 Push-Down Automata

ECS 120 Lesson 15 Turing Machines, Pt. 1

Undecidability COMS Ashley Montanaro 4 April Department of Computer Science, University of Bristol Bristol, UK

Finite Automata. Finite Automata

Let us first give some intuitive idea about a state of a system and state transitions before describing finite automata.

Non-emptiness Testing for TMs

Computational Models - Lecture 5 1

Problem Session 5 (CFGs) Talk about the building blocks of CFGs: S 0S 1S ε - everything. S 0S0 1S1 A - waw R. S 0S0 0S1 1S0 1S1 A - xay, where x = y.

September 11, Second Part of Regular Expressions Equivalence with Finite Aut

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

Chapter 6. Properties of Regular Languages

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

CS 275 Automata and Formal Language Theory. Disclaimer. Course Notes Part II: The Recognition Problem (II) Chapter II.1: The Chomsky Hierarchy (12.

V Honors Theory of Computation

Automata and Computability. Solutions to Exercises

The Idea of a Pushdown Automaton

Homework. Context Free Languages. Announcements. Before We Start. Languages. Plan for today. Final Exam Dates have been announced.

The Unsolvability of the Halting Problem. Chapter 19

Transcription:

CA320 - Computability & Complexity David Sinclair Context-Sensitive Grammars An unrestricted grammar is a 4-tuple G = (V,Σ,S,P), where V and Σ are disjoint sets of variables and terminals respectively. S V is called the start symbol and P is a set of production rules of the form α β. A Context-Sensitive Grammar (CSG) is an unrestricted grammar in which every production is of the form α β and β α, i.e. no production rule is length-decreasing.

An example CSG is: An Example CSG S abct abc T ABCT ABC BA AB CA AC CB BC aa aa ab ab bb bb bc bc cc cc How a variable is derived depends on the context! An Example CSG (2) Here are some derivations from this CSG. S abc abc abc S abct abcabc abacbc aabcbc aabbcc aabbcc aabbcc aabbcc aabbcc aabbcc L(G) = {a n b n c n n 1} We have already shown that AnBnCn is not a context-free language using the CFG pumping lemma. But it is a context-sensitive language. CSLs are not a generalisation of CFGs as CSLs cannot have any Λ-productions.

Linear Bounded Automata A linear bounded automaton (LBA) is a finite state machine with a finite length data store called a tape. The tape consists of a sequence of cells, where each cell can store a symbol from the machine s alphabet. Symbols can be written or read from any position on this tape and therefore the LBA has a read-write head that can be moved left or right one cell. The tape is used both to store the input and any ongoing calculations. There are 2 special symbols, [ and ], that are used to mark the finite bounds of the tape. The read-write head cannot move beyond either of these symbols and it cannot overwrite these symbols. Linear Bounded Automata (2) At each step the LBA read the symbol under the read-write head, replaces the by another symbol (could be the same symbol) and then perform one of four possible actions A {Y,N,L,R}, where: Y denotes Yes, accept the input string N denotes No, reject the input string L denotes Left, move the read-write head one cell to the left R denotes Right, move the read-write head one cell to the right

Linear Bounded Automata (2) Formally, a linear bounded automaton is a 5-tuple M = {Q,Σ,Γ,q 0,δ} where: Q is a finite set of states; Σ is a finite alphabet (input symbols); Γ is a finite alphabet (store symbols); q 0 Q is the initial state; and δ : Q (Γ {[,]}) Q (Γ {[,]} A, is the transition function. If ((q,σ),(q,ψ, A)) δ then when in state q with σ at the current read-write head position, M will replace σ by ψ and perform action A and enter state q. M accepts w Σ iff it starts with configuration (q 0,[w]) and the action Y is taken. Linear Bounded Automaton Example An LBA to accept AnBnCn = {a n b n c n n 0} is: Q = {s,t,u,v,w} Σ = {a,b,c} Γ = {a,b,c,x} q 0 = s δ = {((s,[),(t,[,r)), ((t,]),(t,],y )),((t,x),(t,x,r)),((t,a),(u,x,r)), ((u,a),(u,a,r)),((u,x),(u,x,r)),((u,b),(v,x,r)) ((v,b),(v,b,r)),((v,x),(v,x,r)),((v,c),(w, x,l)) ((w,c),(w,c,l)),((w,b),(w,b,l)), ((w, a),(w, a,l)) ((w,x),(w,x,l)),((w,[),(t,[,r)) }

Linear Bounded Automaton Example (2) Or as a transition diagram; ]/]/R a/a/r b/b/r b/b/l a/a/l [/[/R a/x/r b/x/r c/x/l s t u v w x/x/r x/x/r c/c/l x/x/r x/x/l [/[/R where σ/ψ/a denotes reading symbol σ, writing symbol ψ and performing action A. Linear Bounded Automaton Example (3) Intuitively the previous LBA behaves as follows. The LBA performs multiple passes over the input string. On each pass (from left to right) starting at the start symbol [ in state t, the LBA coverts the first a into an x, and then the first b into an x and finally the first c into an x. After converting a c into an x (after matching it with an a and b) the LBA moves right to left until it reaches the start symbol [ and goes into state t. If the LBA in state t only encounters x symbols from the start symbol [ to the end symbol ], then the LBA performs a Y action. the LBA gets stuck in either state u, v or w if there is not a matching a, b or c symbol respectively. Can you design a better version of this LBA that actually rejects string that are not in the language AnBnCn?