Title: Context Free Languages, cont'
1 Context Free Languages,
cont. Thm L am bn cm dn n, m ? 0 is not
context-free. Pf Assume L is CF. Then ? p
gt 0 satisfying the conditions of the pumping
lemma. Consider w ap bp cp dp ? L. Suppose
w u v x y z as in the pumping lemma. v y
gt 0 ? a ? v y or b ? v y or c ? v y or d ?
v y. But a ? v y ? c ? v y, b ? v y ? d ?
v y, c ? v y ? a ? v y, d ? v y ? b ? v
y (since v x y ? p). Therefore u x2 y v2 z
has unequal of a's and c's, or b's and d's.
Since we cannot write wuvxyz satisfying the
conditions of the pumping lemma, it must be that
L is not CF. x
2(No Transcript)
3Ex 1 Q q1, , q4, S 0,1, G 0,
, Fq1, q4,
0, e ?0
e, e ?
q2
q1
1, 0 ?e
q4
1, 0 ?e
q3
e, ? e
What language does this accept? We either
accept right away (so e ÃŽ L), or we put 0s on
the stack for a while and then them off the
stack every time we see a 1. We accept when the
stack is next empty, so there must be an equal
number of 1s and 0s. The language is
0n1n.
4Ex 2 Q q1, , q4, S 0,1, G 0,
, Fq1, q4,
0, e ?0
e, e ?
1, e ?1
q2
q1
e, e ?e
0, 0 ?e
q4
q3
1, 1 ?e
e, ? e
This accepts w wR w ÃŽ S.
5Thm If a language is CF, then it is recognized
by some PDA. Pf (idea) Let L(V, S, R, S)
be a CFL. We will create a PDA as follows
(1. do this for each rule X ? y1y2yn,
yi ÃŽ Se U V)
qstart
e, X ?yn
e, e ?yn-1
e, e ?y1
. . .
e, e ?S
qloop
z, z ? e (2. do this for each z ÃŽ S).
e, ? e
qaccept
The idea is that the stack is the reverse of the
productions with the leftmost character on the
top -- we check the terminals off against
the input string to see if it can be generated
with the given rules.
6(Pf cont.) We start by pushing S on the stack
and cannot reach the accept state unless we pop
off the . In the mean time we stay at the state
qloop, and either make a substitution of some
non-terminal at the top of the stack using a rule
(in reverse), or we match a non-terminal at the
top of the stack with a character in w, and then
we remove them both. If there is a way to
generate w starting at S (in the CFG), then our
PDA will accept a leftmost derivation of w.
x
Thm If a PDA recognizes some language, then it
is CF.
We will skip this.
(
7Computability Theory
(Chapter 3 in Sipser) 30's Church - Lambda
Calculus Turing - Computation Church-Turing
Thesis Post - Combinatorics Turing
Machines - Now the input can be read multiple
times, and you can change input on the
(infinite) tape. There are still only a finite
number of states. (You can evaluate a stack on
the empty part of the tape - it would just be
very slow/tedious. We could also simulate a
queue, thus allowing us to accept things like w
w.)
8- Defn A Turing Machine is a 7-tuple
- (Q, ?, ?, ?, q0, qacc, qrej)
-
- Input Alphabet Tape Alphabet Accept State
Reject State. - ? Q x ? ? Q x ? x L, R.
- moves left or right
- Q Q - qacc, qrej),
- S is a subset of G,
- G contains the blank symbol (ÃŽ S).
-
/
9A configuration of a TM is (u, q, v) where u ?
?, v ? ? , q ? Q A TM accepts a
language L if w ? L ? (q0. w) ? (u, qacc, v).
u v
tape head
q
10Defn L is Turing-recognizable (recursively
enumerable) if ? a TM that accepts it. Defn L
is Turing-decidable (recursive) if it accepts L
and always halts.
Turing Recognizable
Turing Decidable
Regular CFL
Classes of languages