Context Sensitive Languages and Linear Bounded Automata

Slides:



Advertisements
Similar presentations
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
Advertisements

Theory of Computation CS3102 – Spring 2014 A tale of computers, math, problem solving, life, love and tragic death Nathan Brunelle Department of Computer.
Natural Language Processing - Formal Language - (formal) Language (formal) Grammar.
CS21 Decidability and Tractability
1 Introduction to Computability Theory Lecture12: Decidable Languages Prof. Amos Israeli.
Introduction to Computability Theory
Linear Bounded Automata LBAs
CS 490: Automata and Language Theory Daniel Firpo Spring 2003.
Normal forms for Context-Free Grammars
Fall 2003Costas Busch - RPI1 Turing Machines (TMs) Linear Bounded Automata (LBAs)
CS490 Presentation: Automata & Language Theory Thong Lam Ran Shi.
CS/IT 138 THEORY OF COMPUTATION Chapter 1 Introduction to the Theory of Computation.
 Computability Theory Turing Machines Professor MSc. Ivan A. Escobar
TM Design Universal TM MA/CSSE 474 Theory of Computation.
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.
Parsing Introduction Syntactic Analysis I. Parsing Introduction 2 The Role of the Parser The Syntactic Analyzer, or Parser, is the heart of the front.
Theory of Computing Lecture 21 MAS 714 Hartmut Klauck.
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
 2005 SDU Lecture13 Reducibility — A methodology for proving un- decidability.
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
Computability Review homework. Video. Variations. Definitions. Enumerators. Hilbert's Problem. Algorithms. Summary Homework: Give formal definition of.
CSCI 2670 Introduction to Theory of Computing October 13, 2005.
1 Linear Bounded Automata LBAs. 2 Linear Bounded Automata (LBAs) are the same as Turing Machines with one difference: The input string tape space is the.
Overview of the theory of computation Episode 3 0 Turing machines The traditional concepts of computability, decidability and recursive enumerability.
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen Department of Computer Science University of Texas-Pan American.
1 Turing Machines - Chap 8 Turing Machines Recursive and Recursively Enumerable Languages.
Lecture 16b Turing Machines Topics: Closure Properties of Context Free Languages Cocke-Younger-Kasimi Parsing Algorithm June 23, 2015 CSCE 355 Foundations.
1 Unit – 5 : STATE MACHINES Syllabus: Languages and Grammars – Finite State Machines State machines and languages – Turing Machines – Computational Complexity.
Theory of Languages and Automata By: Mojtaba Khezrian.
Turing Machines CS 130 Theory of Computation HMU Textbook: Chap 8.
Week 14 - Friday.  What did we talk about last time?  Simplifying FSAs  Quotient automata.
Computability. Turing Machines Read input letter & tape letter, write tape letter, move left or right.
CS6800 Advance Theory of Computation Spring 2016 Nasser Alsaedi
February 1, 2016CS21 Lecture 121 CS21 Decidability and Tractability Lecture 12 February 1, 2016.
CSE 105 theory of computation
Busch Complexity Lectures: Turing Machines
Deterministic FA/ PDA Sequential Machine Theory Prof. K. J. Hintz
Linear Bounded Automata LBAs
Turing Machines.
CS21 Decidability and Tractability
Complexity and Computability Theory I
Natural Language Processing - Formal Language -
Context Sensitive Grammar & Turing Machines
Turing Machines Chapter 17.
Discrete Math II Howon Kim
CSE 105 theory of computation
CSE 2001: Introduction to Theory of Computation Fall 2013
CSCI 2670 Introduction to Theory of Computing
Turing Machines Acceptors; Enumerators
Course 2 Introduction to Formal Languages and Automata Theory (part 2)
Hierarchy of languages
Summary.
CSE322 The Chomsky Hierarchy
A HIERARCHY OF FORMAL LANGUAGES AND AUTOMATA
Jaya Krishna, M.Tech, Assistant Professor
Turing Machines Chapter 17.
Reducability Sipser, pages
CS21 Decidability and Tractability
MA/CSSE 474 Theory of Computation
CSE 105 theory of computation
MA/CSSE 474 Theory of Computation
Decidability and Tractability
CS21 Decidability and Tractability
CSE 105 theory of computation
Automata, Grammars and Languages
MA/CSSE 474 Theory of Computation
CSE 105 theory of computation
The Chomsky Hierarchy Costas Busch - LSU.
CSE 105 theory of computation
CSE 105 theory of computation
Presentation transcript:

Context Sensitive Languages and Linear Bounded Automata Benjamin Mayne CPSC 627 Context Sensitive Languages and Linear Bounded Automata

Introduction Context Sensitive languages/grammars Linear Bounded Automata (LBA) Equivalence of CSL and LBA Complexity of CSL’s / Variants Closure properties of CSL’s Decidability of CSL’s

Context Sensitive Grammars G = (V, , R, S) V is set of variables  is set of terminals R are rules of the form αAβ -> αγβ (A goes to γ in the context of α and β) where A  V, α, β  (V U Σ)*, and γ  (V U Σ)+ plus the rule S  ε if S is not on right side of any rule.

Continued | αAβ| ≤ | αγβ | CSG’s are called noncontracting grammars because no rule decreases the size of the string being generated. For example: S → aSBc → aaSBcBc → aaabcBcBc → aaabBcBcc → aaabbBccc → aaabbbccc

CSL example Consider the following CSG S → aSBc S → abc cB → Bc bB → bb The language generated is L(G) = {anbncn | n1}

Chomsky Hierarchy

Chomsky Hierarchy Language Class Complexity Machine Recursively Enumerable Undecidable Turing Machine Context-Sensitive Languages Exponential LBA Context-Free Languages Polynomial PDA Regular Languages Linear FSA

Context-sensitive languages Clearly, context-sensitive rules give a grammar more power than context-free grammars. A context-sensitive grammar can use the surrounding characters to decide to do different things with a variable, instead of always having to do the same thing every time. All productions in context-sensitive grammars are non-decreasing or non-contracting; that is, they never result in the length of the intermediate string being reduced.

Linear Bounded Automata A Turing machine that has the length of its tape limited to the length of the input string is called a linear-bounded automaton (LBA). A linear bounded automaton is a 7-tuple nondeterministic Turing machine M = (Q, S, G, d, q0,qaccept, qreject) except that: 1. There are two extra tape symbols < and >, which are not elements of G. 2. The TM begins in the configuration (q0<x>), with its tape head scanning the symbol < in cell 0. The > symbol is in the cell immediately to the right of the input string x. 3. The TM cannot replace < or > with anything else, nor move the tape head left of < or right of >.

Linear Bounded Automata

L = {anbncn : n  0} Q = {s,t,u,v,w}  = {a,b,c}  = {a,b,c,x} q0 = s  = {((s, <), (t, <, R)), ((t, >), (t, >, L )), ((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))}

The intuition behind the previous example is that on each pass through the input string, we match one a, one b and one c and replace each of them with an x until there are no a's, b's or c's left. Each of the states can be explained as follows: State t looks for the leftmost a, changes this to an x, and moves into state u. If no symbol from the input alphabet can be found, then the input string is accepted. State u moves right past any a's or x's until it finds a b. It changes this b to an x, and moves into state v. State v moves right past any b's or x's until it finds a c. It changes this c to an x, and moves into state w. State w moves left past any a's, b's, c's or x's until it reaches the start boundary, and moves into state t.

CSG = LBA A language is accepted by an LBA iff it is generated by a CSG. Just like equivalence between CFG and PDA Given an x  CSG G, you can intuitively see that and LBA can start with S, and nondeterministically choose all derivations from S and see if they are equal to the input string x. Because CSL’s are non-contracting, the LBA only needs to generate derivations of length  |x|. This is because if it generates a derivation longer than |x|, it will never be able to shrink to the size of |x|.

Complexity of CSL/Variants Since a context-sensitive language is equivalent to the languages recognized by an LBA, context-sensitive languages are exactly NSPACE(cn). Can be solved by nondeterministic TM using ‘cn’ space In complexity theory is thought to lie outside of NP. Recall that: P  NP  NPSPACE The degree of complexity of context-sensitive languages is too high for practical applications.

On the other hand, the context-free languages (CFL) are not powerful enough to completely describe all the syntactical aspects of a programming language like PASCAL, since some of them are inherently context dependent. So, there are classes of languages that are strictly in between CFL and CSL. Can make CFG’s more powerful or restrict the power of CSG’s.

Growing context-sensitive languages The start symbol occurs only in the left-hand side of a rule All rules are of the form that either the left-hand side consists of the start symbol or the right-hand side is strictly longer than the left-hand side Membership problem is NP-complete

Closure Properties Closed under: Union, Concatenation, * Closed under Intersection But what about: Complementation

Closed under Complementation? Up until 1988, context-sensitive languages were not known to be closed under complementation.

Complementation (continued) Show That NSPACE(n) = co-NSPACE(n) This means that all problems in NSPACE(n) are in co-NSPACE(n) and vice versa which means NSPACE(n) is closed under complementation. It immediately follows that context-sensitive languages are closed under complementation.

Decidability ALBA = {<M,w> | M is an LBA and M accepts w} Unlike ATM, ALBA is decidable. Proof: The ID of an LBA (like a TM) consists of the current tape contents (wi), the current state (q), and the current head position. (w1q0w2w3w4) For a turing machine, there are infinitely many ID’s However, for an LBA, there are a finite number. Precisely, there are n*|Q|*||n possible ID’s where n is the length of the input string. ||n is the number of possible tape strings. |Q| is the number of possible states. And n is the number of head positions.

Recall that computation of a Turing Machine was defined as a chain of IDs ID0 ⊢ ID1 ⊢ · · · ⊢ IDk, where ID0 is an initial configuration If an ID appears twice, then the machine is in a loop. On input {M,w}, where M is an LBA and w is an input word, 1. Simulate machine M for at most n*|Q|*||n steps of computation. 2. If M accepted, accept. If M rejected, reject. Otherwise, M must be in a loop; reject.

Decidability (continued) Theorem – ACSG = {<G,w> | G is a CSG that accepts w} is decidable. Theorem – Every context-sensitive language is decidable Like context-free languages

Theorem – ELBA = {<M> | M is an LBA and L(M) =  } is undecidable (This differs from context-free languages)

Sources Brainerd, Walter S. and Lawrence Landweber. Theory of Computation. New York: John Wiley & Sons, 1974. Immerman, Neil. “Nondeterministic Space is Closed Under Complementation.” Yale University, http://ieeexplore.ieee.org/iel2/209/274/00005270.pdf?isNumber=274&prod=IEEE%20CNF&arnumber=5270&arSt=112&ared=115&arAuthor=Immerman%2C+N.%3B

Questions?