Академический Документы
Профессиональный Документы
Культура Документы
133
number of states of an LBA varies as a linear function of the
amount of input given to that LBA.
Here,
134
o F is the set of final states
135
LECTURE 35
S is a sentential form of G
S |- a
S |- aSa
aSa |- aaa
136
a, aaa, aaaaa, aaaaaaa are all strings generated by G. Clearly L(G), the
language generated by G, is {a n|n is odd}.
αAβ → αγβ,
137
provided that X doesn’t appear in any other productions. In the
general case:
X0X1 . . . Xm → Z0X1 . . . Xm
Z0X1 . . . Xm → Z0Z1 . . . Xm
...
...
138
F - The set of final states, where Q ∩ F = ∅. This ensures that
computation always halts when a final state is reached.
139
LECTURE 36
α is (V+T)*V(V+T)*
140
V : Variables
T : Terminals.
β is ( V + T )*.
In type 0 there must be at least one variable on Left side of
production.
For example,
Sab ba
A S.
α β
|α||β|
For Example,
S –> AB
AB –> abc
B –> b
141
| α | = 1.
Their is no restriction on β.
For example,
S –> AB
A –> a
B –> b
for example :
S –> ab.
142
LECTURE 37
and
Solution:
Idea:
143
If finally only capital letters remain between the border ♯
signs, then the automaton accepts (the input).
Formally, let
LBA = ({q0, q1, q2, q3, q4, qf}, {a,b,c}, {a,b,c,A,B,C,♯}, q0, ♯, δ, {qf})
144
15. δ (q0, A) = (q3, A, Right) – the head is positioned after the
last A and the state is changed to q0.
Otherwise the head reads the first letter of the input: if the
input starts with an a, then it is replaced by A and q1 is the new
state. If the first letter of the input is not a, then LBA gets stuck,
i.e., it is halting without acceptance, since there are no defined
transitions in this state for the other input letters.
145
number of a's and their order was correct (the input is in the
language a*b*c*), then LBA reaches the marker ♯ sign after the
input and accepts.
QED.
146
It is known that every context-sensitive language can be accepted by
deterministic Turing machines, using at most c2· ∣w∣2 + c1 · ∣w∣
+ c0 space during the computations, where c2, c1, c0 are constants.
However, it is neither proven nor disproved that deterministic linear
bounded automata (using c1 · ∣w∣ + c2 space) can recognize every
context-sensitive language. This is still a famous open problem.
147
LECTURE 38
ORGANIZATION OF LBA
configurations.
The halting problem is solvable for linear bounded automata.
o HaltLBA = {< M, w > |M is an LBA and M halts on w} is
decidable.
o An LBA that stops on input w must stop in at most α(|w|)
steps.
The membership problem is solvable for linear bounded
automata.
148
o ALBA = {< M,w > |M is an LBA and M accepts w} is
decidable.
The emptiness problem is unsolvable for linear bounded
automata.
o For every Turing machine there is a linear bounded
automaton which accepts the set of strings which are valid
halting computations for the Turing machine.
A language is accepted by an LBA iff it is context sensitive.
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.
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.
a. If the sentential form is longer than w, LBA halts
without accepting.
4. Compare the resulting sentential form with w on track 1. If
they match, accept. If not go to step 1.
If there is a linear bounded automaton M accepting the language
L, then there is a context sensitive grammar generating L − {}.
Derivation simulates moves of LBA
Three types of productions
o Productions that can generate two copies of a string in Σ∗ ,
along with some symbols that act as markers to keep the
two copies separate.
o 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 is left unchanged; the other,
representing the input tape to M, is modified accordingly.
149
o Productions that can erase everything but the unmodified
copy of the string, provided that the simulated moves of
M applied to the other copy cause M to accept.
o The LBA has no moves left from # or right from $, nor may
print another symbol over # or $.
150
LECTURE 39
G = (N1 ∪ N2 ∪ {S}, T, S,
151
G = (N1 ∪ N2 ∪ {S}, T, S, P1 ∪ P2 ∪ {S → S1S2}),
G = (N1 ∪ N2 ∪ {S}, T, S,
where S ∉ N1 ∪ N2.
Let
P1 ∪ P2 ∪ {S →
λ, S → S1, S → S1S2, S → S1S2S', S' → S1, S' → S1S2, S' → S1S2S'} \
{S1 → λ, S2 → λ}),
QED.
152
than 20 years. In the 1980's, Immerman, Szelepcsényi solved this
problem independently. We present this result without proof.
Proof. The proof uses the fact that this class is closed both under
union and complementation. Let us consider the context-
sensitive languages L1 and L2. Then, the complement of each of
them is context-sensitive according to the theorem of Immerman
and Szelepcsényi. Their union is also context-sensitive, as we
have proven constructively. The complement of this language is
also context-sensitive. However, this language is the same
as L1 ∩ L2 by the De Morgan law.
QED.
153
LECTURE 40
begin
int x;
...
x = 17;
...
end
154
Obviously, we would want the compiler to address this
kind of situation.
155
Theorem (Kuroda). Every context-sensitive grammar can
be written with productions of the form
A → BC AB → CD A → a
156