


























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



























TUESDAY Feb 4
A context-free grammar is in Chomsky normal
form if every rule is of the form:
A → a
S → ε
B and C aren’t start variables
a is a terminal
S is the start variable
Any variable A that is not the start variable
can only generate strings of length > 0
Theorem: If G is in CNF, w ∈ L(G) and |w| > 0,
then any derivation of w in G has length 2|w| - 1
Proof (by induction on |w|):
Base Case: If |w| = 1, then any derivation of
w must have length 1 (A → a)
Inductive Step: (^) Assume true for any string
of length at most k ≥ 1, and let |w| = k+
Since |w| > 1, derivation starts with A → BC
So w = xy where B ⇒* x, |x| > 0 and C ⇒* y, |y| > 0
By the inductive hypothesis, the length of
any derivation of w must be
1 + (2|x| - 1) + (2|y| - 1) = 2(|x| + |y|) - 1
and add the rule S 0
T → ε
0
(where A is not S 0
For each occurrence of A on right
hand side of a rule, add a new rule
with the occurrence deleted
If we have the rule B → A, add
B → ε , unless we have
previously removed B → ε
Whenever B → w appears, add
the rule A → w unless this was
a unit rule previously removed
S → ε
0
→ ε
0
0
→ ε
0
0
0
0
0
0
proper form:
0
0
1
2
1
2
3
3
0
0
1
3
1
3
q 0
q 1
q 0
q 1
0 → 0, R
read write move
→ , R
q accept
q reject
→ , R
0 → 0, R
read write move
→ , R
q accept
→ , R
Definition: A Turing Machine is a 7-tuple
T = (Q, Σ , Γ , δ, q 0
, q accept
, q reject
), where:
Q is a finite set of states
Γ is the tape alphabet, where ∈ Γ and Σ ⊆ Γ
q 0
∈ Q is the start state
Σ is the input alphabet, where ∉ Σ
δ : Q × Γ → Q × Γ × {L, R}
q accept
∈ Q is the accept state
q reject
∈ Q is the reject state, and q reject
≠ q accept
q 7
corresponds to:
A Turing Machine M accepts input w if there is a
sequence of configurations C 1
k
such that
1
is a start configuration of M on input w, ie C 1
is q 0
w
yields C i+
, ie M can legally go from C i
to
i+
in a single step
k
is an accepting configuration, ie the state of
the configuration is q accept
A TM recognizes a language iff it accepts all
and only those strings in the language
A TM decides a language L iff it accepts all
strings in L and rejects all strings not in L
A language L is called Turing-recognizable
or recursively enumerable or semi-decidable
iff some TM recognizes L
A language L is called decidable or recursive
iff some TM decides L