Computing languages by (bounded) local sets

Download Report

Transcript Computing languages by (bounded) local sets

Computing languages by
(bounded) local sets
Dora Giammarresi
Università di Roma “Tor Vergata”
Italy
Summary of the talk
1. Put in a unique framework some know (disjoint)
results and get a:
Characterization of Chomsky’s hierarchy by
local sets + alphabetic projections
2. Insert new families into Chomsky’s hierarchy by
introducing new types of local sets:
Bounded-Grids Context-Sensitive languages
Local (string) languages…
string w over Γ= {0, 1}
# 0 10 01 #
w= 0 1 0 0 1
Θ=
0 0 1 0
# 0
1 #
w with border
0 1
…
finite set of strings of length 2
over Γ #
allowed substrings
Definition: String language L is local if all
substrings of length 2 are in a finite set Θ.
(L=L(Θ) )
… to define Regular languages
, Γ alphabets
π: Γ
 alphabetic
projection
Theorem : L is regular 
 local set of strings S such that L=π(S).
Proof:
Local
set
local
alphabet
Γ = edges of automaton
Finite automaton
=
+
set Θ = pairs of consecutive edges
π projection
gives labels of the edges
Local Picture Languages [GR’94]
picture p over Γ= {0, 1}
# # # # # # #
# 0 1 0 0 1 #
# 0 0 1 0 0 #
# 1 0 1 0 1 #
# # # # # # #
0 1 0 0 1
p= 0 0 1 0 0
1 01 0 1
Θ=
0 1
1 0
00
# #
00
0 0
0#
# #
p with border
1 1
1 1
…
finite set of 2x2 pictures
over Γ #
allowed subpictures
Definition: Picture language L is local if all
subpictures of size 2x2 are in a finite set Θ . (L=L(Θ) )
…to define Context-sensitive languages
p=
#
#
#
#
#
# # # # # #
2 0 1 2 0 #
2 0 1 0 2 #
0 1 0 2 1 #
# # # # # #
fr(p) = frontier of p
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
()
given a localand
setwrite
of 2x2
squares,
define
configurations
them
in order,
onecorresponding
above the others.
context-sensitive
This gives a localgrammar
picture. rules such that derivations
correspond to the local pictures.
Local sets of binary trees…
$
Γ= {0, 1, $}
1
tree t with border
1
#
1
Θ=
1
0
0
0
0
1
#
1
0
# #
1
# #
0
# #
1
# #
#
0
0
1
#
…
1
0
0
0
finite set of 3-vertices trees
over Γ #
allowed sub-trees
Definition: Tree set L is local if all 3-vertices
sub-trees belong to a finite set Θ . (L=L(Θ) )
…to define Context-free languages
$
t=
fr(t) = frontier of t
# # # # # # # # # # # # # #
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).
Look at them all together…
● Local sets of lines
● Local sets of binary trees
● Local sets of grids
elementary
line:
y
x
z
elementary
binary tree:
elementary
grid:
x y
y
x
x
y
z
t
x y
z t
look at them all together…
Γ= {0,1}
● Sets of line graphs
#
0
0
0
0
#
frontier = all non-border vertices
● Sets of binary trees
frontier = vertices adjacent
to the leaves
● Sets of grid graphs
#
#
#
#
#
#
#
0
0
0
0
#
#
0
0
0
0
#
#
0
0
0
0
#
#
#
#
#
#
#
# # # # # # # #
frontier =
lowest
non-border row
Chomsky’s hierarchy by local sets
Proposition: Let L be a (string) language. Then:
1. L is regular 
L is projection of the frontier of a local set of lines;
2. L is context-free 
L is projection of the frontier of a local set of binary trees;
3. L is context-sensitive 
L is projection of the frontier of a local set of grids;
Local sets as computations…
Local machines!
Context-sensitive
Context-free
#
Regular
#
#
############ ##
# # # # # # # ##
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
# # # # # # # ##
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?
Context-sensitive
Context-free
$
Regular
#
#
############ ##
# # # # # # # ##
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
# # # # # # # ##
Define a new type of local sets ….
….. and get a new family of string languages!
What are the differences?
Context-sensitive
Context-free
$
Regular
#
#
############ ##
degree
size
≤2
n+2 O(1)
≤3
BIG GAP!
≤ 4n O(n)
# # # # # # # ##
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
# # # # # # # ##
≤4
not bounded by n
Bounded Grids Local Sets
Computations
Definition: grids with 2-sides frontiers
#
#
#
#
#
#
#
1
0
1
0
#
#
1
0
0
1
#
#
0
1
1
0
#
#
0
1
1
0
#
#
1
0
0
1
#
length of w
n
#
0
1
1
0
#
#
#
#
#
#
#
0
1
1
0 1 0 0 1 0 1 1 0
size of local grid for w,
≤ (n+2)2
2
Exact size depends on the position
where we turn the string!
Bounded Grids Local Sets
No more space for istantaneous configurations of
a run of a LBA automaton!
Need to exploit geometric local properties of
patterns defined in the pictures….
Use local picture languages theory
techniques [GR’94]
An example
L= anbn | n≥0 }
#
#
#
#
#
#
#
#
#
1
1
1
1
0
4
#
#
1
1
1
0
0
4
#
#
1
1
0
0
0
4
#
#
1
0
0
0
0
4
#
#
0
0
0
0
0
4
#
#
#
#
#
#
#
#
#
= {a,b}
Γ= {0,1,4}
π: Γ → 
4→ a
0→ b
projection
Another example (use same idea!)
L= anbncn | n≥0 }
1
1
1
1
0
4
1
1
1
0
0
4
1
1
0
0
0
4
1
0
0
0
0
4
0
0
0
0
0
4
3
3
3
3
2
5
3
3
3
2
2
5
3
3
2
2
2
5
3
2
2
2
2
5
2
2
2
2
2
5
= {a,b,c}
Γ= {0,1,4,2,3,5}
π: Γ → 
4→ a
5→ b
2→ c
projection
Another example
L= wwR | w*} palindromes
a1 a1 a1 a1
a0 b1 b1 b1
a0 b0 a1 a1
a0 b0 a0 a1
a0 b0 a0 a0
a0 b0 a0 a0
a0 b0 a0 a0
a1
b1
a1
a1
b1
b0
b0
a1
b1
a1
a1
b1
a1
a0
= {a,b}
Γ= {a0, b0, a1, b1}
→ 
a0, a1 → a
b0, b1 → b
π: Γ
projection
Bounded Grids Computations
Theorem:
If L is a projection of the 2-sides frontier of a local
picture language, then L is context-sensitive.
Bounded-grids context sensitive
(Bgrid-CS).
Proof:
Let w=a1a2....an
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 Θ
• finish to build the picture by elements of Θ
0
11
#0100
#####
0
1
0
1
#
#
1
1
1
0
#
#
#
#
#
#
#
More examples
 L= anb2nc(n+3) | n≥0 }

2
n
L= a |
n≥0 };
 L= ap | p prime};
L= ww | w* }
 L= w|w| | |w|>1}
n
2
L= a |
n≥0 }
L= af | f not prime}
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 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.
Remark 2: [ Gladkij]
there are CS-languages with no linear bounded derivations
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)
Definition:
Set of 2x2 grids Θ is deterministic when,
 x1,x2,x3  Γ {#} there is at most one
y x3
x1 x2
Θ
Open question: are deterministic B-grid CS languages
equivalent to non-deterministic ones?
Remark
● Bgrid-CS languages are “deterministic”
● Bgrid-CS languages
=
CS languages
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)
p0
p1
q
p
= {0, 1}
q0
Γ = {p0, p1, q0, q1 }
π: p0 , q0
p1 , q1
q1
0
1
# p0
p0 p0
p1 q1
q0 q1
q1 p0
p0 #
# p1
p0 p1
p1 q0
q0 q0
q1 p1
q1 #
Look at them more generally…
Γ alphabet
#1,…, #k Γ border symbol
• embedded labeled graph over Γ {#1,…, #k }
• border vertices = vertices carryng #1,…, #k
• frontier = (labels of) a path of non-border vertices
(string over Γ)
• elementary graph = “small” graph shape
• local set of graphs = (labels of) a path of non-border
vertices
Local sets
Given a typology of graphs,
fix “shape” of elementary graph
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 (Θ).