Top Banner
Context Sensitive Grammar Aparna S Vijayan Department of Computer Science and Automation December 2, 2011 Aparna S Vijayan (CSA) CSG December 2, 2011 1 / 12
60

Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

Jan 10, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

Context Sensitive Grammar

Aparna S Vijayan

Department of Computer Science and Automation

December 2, 2011

Aparna S Vijayan (CSA) CSG December 2, 2011 1 / 12

Page 2: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

Contents

1 Definition of CSG

2 Context Sensitive Language(CSL)

3 Example of CSL

4 Chomsky Hierachy

Aparna S Vijayan (CSA) CSG December 2, 2011 2 / 12

Page 3: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

Contents

1 Definition of CSG

2 Context Sensitive Language(CSL)

3 Example of CSL

4 Chomsky Hierachy

Aparna S Vijayan (CSA) CSG December 2, 2011 2 / 12

Page 4: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

Contents

1 Definition of CSG

2 Context Sensitive Language(CSL)

3 Example of CSL

4 Chomsky Hierachy

Aparna S Vijayan (CSA) CSG December 2, 2011 2 / 12

Page 5: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

Contents

1 Definition of CSG

2 Context Sensitive Language(CSL)

3 Example of CSL

4 Chomsky Hierachy

Aparna S Vijayan (CSA) CSG December 2, 2011 2 / 12

Page 6: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

Contents

1 Definition of CSG

2 Context Sensitive Language(CSL)

3 Example of CSL

4 Chomsky Hierachy

Aparna S Vijayan (CSA) CSG December 2, 2011 2 / 12

Page 7: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

Definition

Context Sensitive Grammar(Type1 Grammar)

A context-sensitive grammar (CSG) is an unrestricted grammar inwhich every production has the formα→ β with |β| ≥ |α| (where α and β are strings of nonterminals andterminals).

The concept of context-sensitive grammar was introduced by NoamChomsky in the 1950.

In every derivation the length of the string never decreases.

The term ”context-sensitive” comes from a normal form for thesegrammars,where each production is of the form α1Aα2→α1βα2,withβ 6= ε.

They permit replacement of variable A by string β only in the”context ” α1 - α2.

Aparna S Vijayan (CSA) CSG December 2, 2011 3 / 12

Page 8: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

Formal Definition

A Context Sensitive Grammar is a 4-tuple , G = (N,Σ, P, S) where:

N=Set of non terminal symbols.

Σ=Set of terminal symbols.

S=Start symbol of the production.

P=Finite set of productions.All rules in P are of the form α1Aα2→α1βα2.

A ∈ N ( A is a single nonterminal)α1, α2, β ∈ (N ∪ Σ)+.

Aparna S Vijayan (CSA) CSG December 2, 2011 4 / 12

Page 9: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

Formal Definition

A Context Sensitive Grammar is a 4-tuple , G = (N,Σ, P, S) where:

N=Set of non terminal symbols.

Σ=Set of terminal symbols.

S=Start symbol of the production.

P=Finite set of productions.All rules in P are of the form α1Aα2→α1βα2.

A ∈ N ( A is a single nonterminal)α1, α2, β ∈ (N ∪ Σ)+.

Aparna S Vijayan (CSA) CSG December 2, 2011 4 / 12

Page 10: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

Formal Definition

A Context Sensitive Grammar is a 4-tuple , G = (N,Σ, P, S) where:

N=Set of non terminal symbols.

Σ=Set of terminal symbols.

S=Start symbol of the production.

P=Finite set of productions.All rules in P are of the form α1Aα2→α1βα2.

A ∈ N ( A is a single nonterminal)α1, α2, β ∈ (N ∪ Σ)+.

Aparna S Vijayan (CSA) CSG December 2, 2011 4 / 12

Page 11: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

Formal Definition

A Context Sensitive Grammar is a 4-tuple , G = (N,Σ, P, S) where:

N=Set of non terminal symbols.

Σ=Set of terminal symbols.

S=Start symbol of the production.

P=Finite set of productions.All rules in P are of the form α1Aα2→α1βα2.

A ∈ N ( A is a single nonterminal)α1, α2, β ∈ (N ∪ Σ)+.

Aparna S Vijayan (CSA) CSG December 2, 2011 4 / 12

Page 12: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

Formal Definition

A Context Sensitive Grammar is a 4-tuple , G = (N,Σ, P, S) where:

N=Set of non terminal symbols.

Σ=Set of terminal symbols.

S=Start symbol of the production.

P=Finite set of productions.

All rules in P are of the form α1Aα2→α1βα2.

A ∈ N ( A is a single nonterminal)α1, α2, β ∈ (N ∪ Σ)+.

Aparna S Vijayan (CSA) CSG December 2, 2011 4 / 12

Page 13: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

Formal Definition

A Context Sensitive Grammar is a 4-tuple , G = (N,Σ, P, S) where:

N=Set of non terminal symbols.

Σ=Set of terminal symbols.

S=Start symbol of the production.

P=Finite set of productions.All rules in P are of the form α1Aα2→α1βα2.

A ∈ N ( A is a single nonterminal)α1, α2, β ∈ (N ∪ Σ)+.

Aparna S Vijayan (CSA) CSG December 2, 2011 4 / 12

Page 14: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

Context Sensitive Language

The language generated by the Context Sensitive Grammar is calledcontext sensitive language.

If G is a Context Sensitive Grammar thenL(G)=

{w∣∣(w ∈ Σ∗) ∧

(S ⇒+

G w)}

.

Eg 1 of a context sensitive grammarG = {{S ,A,B,C , a, b, c} , {a, b, c} ,P,S}where P is the set of rules.

S→ aSBCS → aBCCB → BCaB → abbB → bbbC → bccC →cc

The language generated by this grammar is {anbncn|n ≥ 1} .

Aparna S Vijayan (CSA) CSG December 2, 2011 5 / 12

Page 15: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

Context Sensitive Language

The language generated by the Context Sensitive Grammar is calledcontext sensitive language.

If G is a Context Sensitive Grammar thenL(G)=

{w∣∣(w ∈ Σ∗) ∧

(S ⇒+

G w)}

.

Eg 1 of a context sensitive grammarG = {{S ,A,B,C , a, b, c} , {a, b, c} ,P,S}where P is the set of rules.

S→ aSBCS → aBCCB → BCaB → abbB → bbbC → bccC →cc

The language generated by this grammar is {anbncn|n ≥ 1} .

Aparna S Vijayan (CSA) CSG December 2, 2011 5 / 12

Page 16: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

Context Sensitive Language

The language generated by the Context Sensitive Grammar is calledcontext sensitive language.

If G is a Context Sensitive Grammar thenL(G)=

{w∣∣(w ∈ Σ∗) ∧

(S ⇒+

G w)}

.

Eg 1 of a context sensitive grammarG = {{S ,A,B,C , a, b, c} , {a, b, c} ,P,S}where P is the set of rules.

S→ aSBCS → aBCCB → BCaB → abbB → bbbC → bccC →cc

The language generated by this grammar is {anbncn|n ≥ 1} .Aparna S Vijayan (CSA) CSG December 2, 2011 5 / 12

Page 17: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

Context Sensitive Language

The derivation for the string aabbcc is

S ⇒ aSBC⇒ aaBCBC⇒ aabCBC⇒ aabBCC⇒ aabbCC⇒ aabbcC⇒ aabbcc

Aparna S Vijayan (CSA) CSG December 2, 2011 6 / 12

Page 18: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

Context Sensitive Language

The derivation for the string aabbcc is

S ⇒ aSBC

⇒ aaBCBC⇒ aabCBC⇒ aabBCC⇒ aabbCC⇒ aabbcC⇒ aabbcc

Aparna S Vijayan (CSA) CSG December 2, 2011 6 / 12

Page 19: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

Context Sensitive Language

The derivation for the string aabbcc is

S ⇒ aSBC⇒ aaBCBC

⇒ aabCBC⇒ aabBCC⇒ aabbCC⇒ aabbcC⇒ aabbcc

Aparna S Vijayan (CSA) CSG December 2, 2011 6 / 12

Page 20: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

Context Sensitive Language

The derivation for the string aabbcc is

S ⇒ aSBC⇒ aaBCBC⇒ aabCBC

⇒ aabBCC⇒ aabbCC⇒ aabbcC⇒ aabbcc

Aparna S Vijayan (CSA) CSG December 2, 2011 6 / 12

Page 21: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

Context Sensitive Language

The derivation for the string aabbcc is

S ⇒ aSBC⇒ aaBCBC⇒ aabCBC⇒ aabBCC

⇒ aabbCC⇒ aabbcC⇒ aabbcc

Aparna S Vijayan (CSA) CSG December 2, 2011 6 / 12

Page 22: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

Context Sensitive Language

The derivation for the string aabbcc is

S ⇒ aSBC⇒ aaBCBC⇒ aabCBC⇒ aabBCC⇒ aabbCC

⇒ aabbcC⇒ aabbcc

Aparna S Vijayan (CSA) CSG December 2, 2011 6 / 12

Page 23: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

Context Sensitive Language

The derivation for the string aabbcc is

S ⇒ aSBC⇒ aaBCBC⇒ aabCBC⇒ aabBCC⇒ aabbCC⇒ aabbcC

⇒ aabbcc

Aparna S Vijayan (CSA) CSG December 2, 2011 6 / 12

Page 24: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

Context Sensitive Language

The derivation for the string aabbcc is

S ⇒ aSBC⇒ aaBCBC⇒ aabCBC⇒ aabBCC⇒ aabbCC⇒ aabbcC⇒ aabbcc

Aparna S Vijayan (CSA) CSG December 2, 2011 6 / 12

Page 25: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

Example2 CSG L = (#a = #b = #c)

G2 =({S ,A,B,C , a, b, c} , {a, b, c} ,P,S)

S→ ABC

S →ABCS

AB→ BA

AC → CA

BC → CB

BA → AB

CA →AC

CB → BC

A → a

B →b

C →cAparna S Vijayan (CSA) CSG December 2, 2011 7 / 12

Page 26: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

Hierarchy of Formal Languages

Aparna S Vijayan (CSA) CSG December 2, 2011 8 / 12

Page 27: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

Relation between Formal Languages

The CFL’s not containing ε are properly contained in the contextsensitive languages

Not all Context Sensitive Languages are Context Free.

Every Context Sensitive Language is recusive.

Aparna S Vijayan (CSA) CSG December 2, 2011 9 / 12

Page 28: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

Chomsky Hierachy

Described by Chomsky in 1956.

Four classes of language Type 3,Type2,Type1,Type 0 from mostrestrictive to most general(Unestricted).

Each level of hierarchy can be characterized by a class of grammar.

Aparna S Vijayan (CSA) CSG December 2, 2011 10 / 12

Page 29: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

Chomsky Hierarchy

Type Language productions Device3 Regular A → aB, A → a Finite Automaton

2 CFL A → α Pushdown Automaton

1 CSL α→ β,|β| ≥ |α| Linear Bounded Automaton

0 RE α→ β Turing Machine

A,B→ Nonterminals

α,β→ string of terminals and nonterminals

a→ terminal symbol

Aparna S Vijayan (CSA) CSG December 2, 2011 11 / 12

Page 30: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

References

Introduction to Automata Theory Languages and Computation by ”JOHN EHOPCROFT”,”JEFFERY D.ULLMAN”.

Introduction to Languages and the Theory of Computation ”JOHN MARTIN”

http://en.wikipedia.org/wiki/Context-sensitive grammar

http://adammikeal.org/courses/compute/Chomsky

Aparna S Vijayan (CSA) CSG December 2, 2011 12 / 12

Page 31: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

Linear Bounded Automata

Indu John

Department of Computer Science and AutomationIndian Institute of Science, Bangalore

December 1, 2011

Indu John (Department of CSA) Linear Bounded Automata December 1, 2011 1 / 14

Page 32: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

Overview

Definition

Results about LBAs

CSLs and LBAs

Indu John (Department of CSA) Linear Bounded Automata December 1, 2011 2 / 14

Page 33: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

Overview

Definition

Results about LBAs

CSLs and LBAs

Indu John (Department of CSA) Linear Bounded Automata December 1, 2011 2 / 14

Page 34: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

Overview

Definition

Results about LBAs

CSLs and LBAs

Indu John (Department of CSA) Linear Bounded Automata December 1, 2011 2 / 14

Page 35: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

Overview

Definition

Results about LBAs

CSLs and LBAs

Indu John (Department of CSA) Linear Bounded Automata December 1, 2011 2 / 14

Page 36: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

Definition

A Turing machine that uses only the tape space occupied by the input iscalled a linear-bounded automaton (LBA).

A linear bounded automaton is a nondeterministic Turing machineM = (Q,Σ, Γ, δ, s, t, r) such that:

There are two special tape symbols < and >(the left end marker andright end marker).The TM begins in the configuration (s, < x >, 0).The TM cannot replace < or > with anything else, nor move the tapehead left of < or right of >.

Indu John (Department of CSA) Linear Bounded Automata December 1, 2011 3 / 14

Page 37: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

LBA

An equivalent definition of an LBA is that it uses only k times theamount of space occupied by the input string, where k is a constantfixed for the particular machine.

Possible to simulate k tape cells with a single tape cell, by increasingthe size of the tape alphabet

Examples: {anbncn|n ≥ 0}; counting number of a’s

This limitation makes the LBA a somewhat more accurate model ofcomputers that actually exist than a Turing machine, whose definitionassumes unlimited tape.

Indu John (Department of CSA) Linear Bounded Automata December 1, 2011 4 / 14

Page 38: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

LBA

An equivalent definition of an LBA is that it uses only k times theamount of space occupied by the input string, where k is a constantfixed for the particular machine.

Possible to simulate k tape cells with a single tape cell, by increasingthe size of the tape alphabet

Examples: {anbncn|n ≥ 0}; counting number of a’s

This limitation makes the LBA a somewhat more accurate model ofcomputers that actually exist than a Turing machine, whose definitionassumes unlimited tape.

Indu John (Department of CSA) Linear Bounded Automata December 1, 2011 4 / 14

Page 39: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

LBA

An equivalent definition of an LBA is that it uses only k times theamount of space occupied by the input string, where k is a constantfixed for the particular machine.

Possible to simulate k tape cells with a single tape cell, by increasingthe size of the tape alphabet

Examples: {anbncn|n ≥ 0}; counting number of a’s

This limitation makes the LBA a somewhat more accurate model ofcomputers that actually exist than a Turing machine, whose definitionassumes unlimited tape.

Indu John (Department of CSA) Linear Bounded Automata December 1, 2011 4 / 14

Page 40: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

LBA

An equivalent definition of an LBA is that it uses only k times theamount of space occupied by the input string, where k is a constantfixed for the particular machine.

Possible to simulate k tape cells with a single tape cell, by increasingthe size of the tape alphabet

Examples: {anbncn|n ≥ 0}; counting number of a’s

This limitation makes the LBA a somewhat more accurate model ofcomputers that actually exist than a Turing machine, whose definitionassumes unlimited tape.

Indu John (Department of CSA) Linear Bounded Automata December 1, 2011 4 / 14

Page 41: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

History

In 1960, Myhill introduced an automaton model today known asdeterministic linear bounded automaton.

Shortly thereafter, Landweber proved that the languages accepted bya deterministic LBA are always context-sensitive.

In 1964, Kuroda introduced the more general model of(nondeterministic) linear bounded automata, and showed that thelanguages accepted by them are precisely the context-sensitivelanguages.

Indu John (Department of CSA) Linear Bounded Automata December 1, 2011 5 / 14

Page 42: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

History

In 1960, Myhill introduced an automaton model today known asdeterministic linear bounded automaton.

Shortly thereafter, Landweber proved that the languages accepted bya deterministic LBA are always context-sensitive.

In 1964, Kuroda introduced the more general model of(nondeterministic) linear bounded automata, and showed that thelanguages accepted by them are precisely the context-sensitivelanguages.

Indu John (Department of CSA) Linear Bounded Automata December 1, 2011 5 / 14

Page 43: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

History

In 1960, Myhill introduced an automaton model today known asdeterministic linear bounded automaton.

Shortly thereafter, Landweber proved that the languages accepted bya deterministic LBA are always context-sensitive.

In 1964, Kuroda introduced the more general model of(nondeterministic) linear bounded automata, and showed that thelanguages accepted by them are precisely the context-sensitivelanguages.

Indu John (Department of CSA) Linear Bounded Automata December 1, 2011 5 / 14

Page 44: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

History

In 1960, Myhill introduced an automaton model today known asdeterministic linear bounded automaton.

Shortly thereafter, Landweber proved that the languages accepted bya deterministic LBA are always context-sensitive.

In 1964, Kuroda introduced the more general model of(nondeterministic) linear bounded automata, and showed that thelanguages accepted by them are precisely the context-sensitivelanguages.

Indu John (Department of CSA) Linear Bounded Automata December 1, 2011 5 / 14

Page 45: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

Number of configurations

Suppose that a given LBA M has

q states,m characters in the tape alphabet ,and the input length is n.

Then M can be in at most

α(n) =

Tapecontents︷︸︸︷mn ∗

Headposition︷︸︸︷n ∗

State︷︸︸︷q

configurations.

Indu John (Department of CSA) Linear Bounded Automata December 1, 2011 6 / 14

Page 46: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

Results about LBA

Halting Problem

The halting problem is solvable for linear bounded automata.

HaltLBA = {< M,w > |M is an LBA and M halts on w}is decidable.

An LBA that stops on input w must stop in at most α(|w |) steps

Membership problem

The membership problem is solvable for linear bounded automata.

ALBA = {< M,w > |M is an LBA and M accepts w}is decidable.

Indu John (Department of CSA) Linear Bounded Automata December 1, 2011 7 / 14

Page 47: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

Results about LBA

Halting Problem

The halting problem is solvable for linear bounded automata.

HaltLBA = {< M,w > |M is an LBA and M halts on w}is decidable.

An LBA that stops on input w must stop in at most α(|w |) steps

Membership problem

The membership problem is solvable for linear bounded automata.

ALBA = {< M,w > |M is an LBA and M accepts w}is decidable.

Indu John (Department of CSA) Linear Bounded Automata December 1, 2011 7 / 14

Page 48: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

Results about LBA

Emptiness Problem

The emptiness problem is unsolvable for linear bounded automata.

For every Turing machine there is a linear bounded automaton whichaccepts the set of strings which are valid halting computations for theTuring machine.

Indu John (Department of CSA) Linear Bounded Automata December 1, 2011 8 / 14

Page 49: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

LBA Problems

1 Is the class of languages accepted by LBA equal to the class oflanguages accepted by deterministic LBA?

Open Problem!

2 Is the class of languages accepted by LBA closed under complement?

Yes. (Immerman Szelepcsenyi Theorem)

Indu John (Department of CSA) Linear Bounded Automata December 1, 2011 9 / 14

Page 50: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

LBA Problems

1 Is the class of languages accepted by LBA equal to the class oflanguages accepted by deterministic LBA?

Open Problem!

2 Is the class of languages accepted by LBA closed under complement?

Yes. (Immerman Szelepcsenyi Theorem)

Indu John (Department of CSA) Linear Bounded Automata December 1, 2011 9 / 14

Page 51: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

LBA Problems

1 Is the class of languages accepted by LBA equal to the class oflanguages accepted by deterministic LBA?

Open Problem!

2 Is the class of languages accepted by LBA closed under complement?

Yes. (Immerman Szelepcsenyi Theorem)

Indu John (Department of CSA) Linear Bounded Automata December 1, 2011 9 / 14

Page 52: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

LBA Problems

1 Is the class of languages accepted by LBA equal to the class oflanguages accepted by deterministic LBA?

Open Problem!

2 Is the class of languages accepted by LBA closed under complement?

Yes. (Immerman Szelepcsenyi Theorem)

Indu John (Department of CSA) Linear Bounded Automata December 1, 2011 9 / 14

Page 53: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

LBA Problems

1 Is the class of languages accepted by LBA equal to the class oflanguages accepted by deterministic LBA?

Open Problem!

2 Is the class of languages accepted by LBA closed under complement?

Yes. (Immerman Szelepcsenyi Theorem)

Indu John (Department of CSA) Linear Bounded Automata December 1, 2011 9 / 14

Page 54: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

LBAs and CSLs

Theorem(Landweber-Kuroda)

A language is accepted by an LBA iff it is context sensitive.

Indu John (Department of CSA) Linear Bounded Automata December 1, 2011 10 / 14

Page 55: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

Proof

⇐If L is a CSL, then L is accepted by some LBA.

Let G = (N,Σ,S ,P) be the given grammar such that L(G ) = L.

Construct LBA M with tape alphabet Σ×{N ∪Σ}(2- track machine)

First track holds input string w

Second track holds a sentential form α of G , initialized to S .

Indu John (Department of CSA) Linear Bounded Automata December 1, 2011 11 / 14

Page 56: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

Proof...

If w = ε, M halts without accepting.

Repeat :1 Non-deterministically select a position i in α.2 Non-deterministically select a production β → γ of G .3 If β appears beginning in position i of α, replace β by γ there.

If the sentential form is longer than w , LBA halts without accepting.

4 Compare the resulting sentential form with w on track 1. If theymatch, accept. If not go to step 1.

Indu John (Department of CSA) Linear Bounded Automata December 1, 2011 12 / 14

Page 57: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

Proof...

⇒If there is a linear bounded automaton M accepting the language L, thenthere is a context sensitive grammar generating L− {ε}.

Sketch of proof :

Derivation simulates moves of LBA

Three types of productions1 Productions that can generate two copies of a string in Σ∗, along with

some symbols that act as markers to keep the two copies separate.2 Productions that can simulate a sequence of moves of M. During this

portion of a derivation, one of the two copies of the original string isleft unchanged; the other, representing the input tape to M, is modifiedaccordingly.

3 Productions that can erase everything but the unmodified copy of thestring, provided that the simulated moves of M applied to the othercopy cause M to accept.

Indu John (Department of CSA) Linear Bounded Automata December 1, 2011 13 / 14

Page 58: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

Proof...

⇒If there is a linear bounded automaton M accepting the language L, thenthere is a context sensitive grammar generating L− {ε}.

Sketch of proof :

Derivation simulates moves of LBA

Three types of productions1 Productions that can generate two copies of a string in Σ∗, along with

some symbols that act as markers to keep the two copies separate.2 Productions that can simulate a sequence of moves of M. During this

portion of a derivation, one of the two copies of the original string isleft unchanged; the other, representing the input tape to M, is modifiedaccordingly.

3 Productions that can erase everything but the unmodified copy of thestring, provided that the simulated moves of M applied to the othercopy cause M to accept.

Indu John (Department of CSA) Linear Bounded Automata December 1, 2011 13 / 14

Page 59: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

Proof...

⇒If there is a linear bounded automaton M accepting the language L, thenthere is a context sensitive grammar generating L− {ε}.

Sketch of proof :

Derivation simulates moves of LBA

Three types of productions1 Productions that can generate two copies of a string in Σ∗, along with

some symbols that act as markers to keep the two copies separate.2 Productions that can simulate a sequence of moves of M. During this

portion of a derivation, one of the two copies of the original string isleft unchanged; the other, representing the input tape to M, is modifiedaccordingly.

3 Productions that can erase everything but the unmodified copy of thestring, provided that the simulated moves of M applied to the othercopy cause M to accept.

Indu John (Department of CSA) Linear Bounded Automata December 1, 2011 13 / 14

Page 60: Context Sensitive Grammar - Indian Statistical Instituteansuman/flat2018/csl-lba.pdf · De nition Context Sensitive Grammar(Type1 Grammar) A context-sensitive grammar (CSG) is an

References

John Martin, ”Introduction to Languages and the Theory of Computation” , TataMcGraw-Hill, Third Edition.

John Hopcroft, Jeffery Ullman, ”Introduction to Automata Theory, Languages andComputation” .

http://www.cs.uky.edu/~lewis/texts/theory/automata/lb-auto.pdf

http://en.wikipedia.org/wiki/Linear_bounded_automaton

http://www.fit.vutbr.cz/~janousek/vyuka/vsl2/newer/class19.pdf

Indu John (Department of CSA) Linear Bounded Automata December 1, 2011 14 / 14