Computing languages by (bounded) local sets Dora Giammarresi Università di Roma “Tor Vergata”...

Post on 13-Jan-2016

220 views 4 download

Transcript of Computing languages by (bounded) local sets Dora Giammarresi Università di Roma “Tor Vergata”...

Computing languages by

(bounded) local sets

Dora GiammarresiUniversità di Roma “Tor Vergata”

Italy

Summary of the talk

Put in a unique framework some know (disjoint) results and get a:

Characterization of Chomsky’s hierarchy by

local sets + alphabetic projections

1.

Insert new families into Chomsky’s hierarchy by introducing new types of local sets:

Bounded-Grids Context-Sensitive languages

2.

Definition: String language L is local if all substrings of length 2 are in a finite set Θ. (L=L(Θ) )

Local (string) languages…

w with border

# #0 001 1

string w over Γ= {0, 1}

w= 0 001 1

Θ =finite set of strings of length 2

over Γ #…allowed substrings

0 0 0 0

0

1 1

1# #

… to define Regular languages

Theorem : L is regular local set of strings S such that L=π(S).

, Γ alphabets π: Γ alphabetic

projection

Local set

+

projection

= Finite automaton

Proof:

local alphabet Γ = edges of automaton

set Θ = pairs of consecutive edges

π gives labels of the edges

Local Picture Languages [GR’94]

picture p over Γ= {0, 1}

Definition: Picture language L is local if all subpictures of size 2x2 are in a finite set Θ . (L=L(Θ) )

p=

p with border# # # # # # ##### # # #

###

# # #

0 0 00 0 0 0

0 0

11

1

1 1 1

Θ =finite set of 2x2 pictures

over Γ #…allowed subpictures

00

000 0

00# #

#0# #

11 1 1

11

0 0 00 0 0 0

0 0

11

1

1 1 1

…to define Context-sensitive languages

Theorem [F69 – LS97]: L is context-sensitive local set of pictures S such that L=π(fr(S)).

Proof: () given an accepting run of an LBA, take all instantaneous configurations and write them in order, one above the others. This gives a local picture.

() given a local set of 2x2 squares, define corresponding context-sensitive grammar rules such that derivations correspond to the local pictures.

p=

fr(p) = frontier of p

# # # # # # ##### # # #

###

# # #0

00

00

1 011

122

222

Local sets of binary trees…

tree t with border

Definition: Tree set L is local if all 3-vertices sub-trees belong to a finite set Θ . (L=L(Θ) )

Θ =finite set of 3-vertices trees

over Γ #… allowed sub-trees

1 0

1

0 0

0

1 0

0

1 0

0

# #

1

1

0

# #

1

# #

1

# #

0

0

# #

1

# #

1

$

Γ= {0, 1, $}

…to define Context-free languages

Theorem [MW67]: L is context-free local set of binary trees S such that L=π(fr(S)).

Proof: Notice that a derivation tree of a context free grammar in Chomsky's Normal Form is actually a local binary tree (possibly after some minor modifications).

fr(t) = frontier of t

$

t=

# # # # # # # # # # # # # #

Look at them all together…

● Local sets of binary trees elementary binary tree: x y

z

● Local sets of lines elementary line:

x y x y

● Local sets of grids elementary grid:

x yz t

x y

z t

look at them all together…

● Sets of line graphs Γ= {0,1}

● Sets of binary trees

● Sets of grid graphs

frontier = all non-border vertices

frontier = vertices adjacent

to the leaves

frontier =

lowest

non-border row

# # # # # # # #

## # # # #

## # # # #

0 0 0 0

#

#

#

0 0 0 0

0 0 0 0

#

#

#

0 ## 0 0 0

Chomsky’s hierarchy by local sets

Proposition: Let L be a (string) language. Then:

3. L is context-sensitive

L is projection of the frontier of a local set of grids;

2. L is context-free

L is projection of the frontier of a local set of binary trees;

1. L is regular

L is projection of the frontier of a local set of lines;

Local sets as computations…

#

# # # # # # # # ## ## #####

##

##

######### # # # # # #

# # # # # # # # # # # # # #

# #

Regular

Context-free

Context-sensitiveLocal machines!

Remark on local computations

Size of local graph is measure of TIME of computation

NOT measure of SPACE!

No need to keep the all graph space:

• Lines left-to-right # #

• Trees leaves-to-root

$

# # # # # # # # # # # # # #• Grids bottom-to-top

# # # # # # # # ######

##

#

##

##

######### # # # # # #

New families into Chomsky’s hierarchy?

Define a new type of local sets ….

….. and get a new family of string languages!

# ## # # # # # # # ######

##

#

##

##

######### # # # # # #

$

# # # # # # # # # # # # # #

Regular

Context-free

Context-sensitive

What are the differences?

# ## # # # # # # # ######

##

#

##

##

######### # # # # # #

$

# # # # # # # # # # # # # #

Regular

Context-free

Context-sensitive

degree ≤ 2 ≤ 3 ≤ 4

≤ 4n O(n) not bounded by nsize n+2 O(1)BIG GAP!

Bounded Grids Local Sets Computations

Definition: grids with 2-sides frontiers

# # # # # # # ######

###### # ####

0 00 01 1

0

11

1 000

00

00

1

1111

1 1

0 00 01 1

0

11

1 1 0

length of w

n

Exact size depends on the position

where we turn the string!

size of local grid for w,

≤ (n+2)2

2

Bounded Grids Local Sets

Need to exploit geometric local properties of patterns defined in the pictures….

No more space for istantaneous configurations of

a run of a LBA automaton!

Use local picture languages theory

techniques [GR’94]

An example

L= anbn | n≥0 }

0 0 0 0 00 0 0 0

0 0 00 0

0

11 11 1 11 1 1 1

4 4 4 4 4# # # # #

# # # # #

########

########

π: Γ → projection

4 → a

0 → b

= {a,b}

Γ= {0,1,4}

Another example (use same idea!)

L= anbncn | n≥0 }

0 0 0 0 00 0 0 0

0 0 00 0

0

11 11 1 11 1 1 1

2 2 2 2 22 2 2 2

2 2 22 2

2

33 333

33

33 3

4 4 4 4 4 5 5 5 5 5 π: Γ → projection

4 → a

5 → b

2 → c

= {a,b,c}

Γ= {0,1,4,2,3,5}

Another example

L= wwR | w*} palindromes

a0a0

a0

a0

a0

a0

a0

a0

a0

a0

a0

a0

a0

a1 a1 a1a1 a1 a1 a1

a1a1a1a1a1a1

a1

a0b0b0

b0

b0b0

b0

b0

b1 b1 b1 b1 b1

b1 b1 π: Γ → projection

a0, a1 → a

b0, b1 → b

= {a,b}

Γ= {a0, b0, a1, b1}

Bounded Grids Computations

Bounded-grids context sensitive

(Bgrid-CS).

Theorem:

If L is a projection of the 2-sides frontier of a local picture language, then L is context-sensitive.

Proof:

Idea: define a LBA that “behaves” as a local machine:

all the writing operations effectively build the picture!

• non deterministically rewrite w=x1x2....xn , π(xi)=ai

• put w as frontier of a picture (non deterministically choose i

and put xi in the BR-corner of a picture)

• check that all bottom and right border subpictures are in Θ

Let w=a1a2....an

# #0

# # # # # #######

# 0 0 01 1111

1110

00

• finish to build the picture by elements of Θ

More examples

L= anb2nc(n+3) | n≥0 }

L= an | n≥0 }; L= a2 | n≥0 }

L= ap | p prime}; L= af | f not prime}

L= ww | w* }

L= w|w| | |w|>1}

2 n

Closure properties

Theorem: Bgrid-CS languages are closed under concatenation and Kleene's star.

Theorem: Bgrid-CS languages are closed under Boolean union and intersection.

Open problem

● Bgrid-CS languages = CS languages?

Remark 2: [ Gladkij]

there are CS-languages with no linear bounded derivations

Remark 1: [ R.Book71]

In 1971 R. Book defined infinite hierarchy of subfamilies of context-sensitive languages corresponding to different time bounding functions leaving open question whether hierarchy collaps.

Open problem

…recall that CS languages are closed under complement.

● Are Bgrid-CS languages closed under complement?

What about deterministic versions?

Deterministic Local B-grid (machines)

Open question: are deterministic B-grid CS languages equivalent to non-deterministic ones?

x1,x2,x3 Γ {#} there is at most one

Definition:

Set of 2x2 grids Θ is deterministic when,

yx1 x2

x3 Θ

Remark

● Bgrid-CS languages = CS languages

● Bgrid-CS languages are “deterministic”

DSPACE(n)=NSPACE(n)

Open problem (the last one!)

…turning back to characterization for the

Chomsky's hierarchy …….

● Can we define a “local set” to characterize recursive languages?

The end

Proof (by example) 1

1

0

0

p q

p0p0

p0 p1

p1

p1

q1

q0

q0

q0 q0

q1

= {0, 1}

p0q1

p1q1

Γ = {p0, p1, q0, q1 }

# p0

# p1

#

#q1

p0

p

pq

qπ: p0 , q0

p1 , q10

1

Look at them more generally…

Γ alphabet #1,…, #k Γ border symbol

• embedded labeled graph over Γ {#1,…, #k }

• frontier = (labels of) a path of non-border vertices

• border vertices = vertices carryng #1,…, #k

(string over Γ)• elementary graph = “small” graph shape

• local set of graphs = (labels of) a path of non-border vertices

Local sets

Definition:

A set of graphs S over Γ {#} is local if there exists a finite set of elementary graphs Θ over Γ {#} such that, for all s S, every subgraph of elementary size belongs to Θ. We write S= L (Θ).

Given a typology of graphs,

fix “shape” of elementary graph